Jump to content
  • 0

l2jacis buffer


Question

11 answers to this question

Recommended Posts

  • 0
Posted

Wich import path should I put in it?

 

Here is my original buffer's .py file:

import sys

from com.br.l2jgarvian.gameserver.model.quest import State

from com.br.l2jgarvian.gameserver.model.quest import QuestState

from com.br.l2jgarvian.gameserver.model.quest.jython import QuestJython as JQuest

from com.br.l2jgarvian.gameserver.datatables import SkillTable

from com.br.l2jgarvian                  import L2DatabaseFactory

 

 

qn = "20701_NPCBuffer

 

And here goes the modded one:

import sys

from net.sf.l2j.gameserver.model.quest import State

from net.sf.l2j.gameserver.model.quest import QuestState

from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

from net.sf.l2j.gameserver.datatables import SkillTable

from net.sf.l2j                  import L2DatabaseFactory

 

 

qn = "20701_NPCBuffer"

 

So i got got this on the error log:

Traceback (innermost last):

  File "__init__.py", line 852, in ?

TypeError: net.sf.l2j.gameserver.model.quest.State(): expected 0 args; got 2

 

Could someone help me?  ;D

  • 0
Posted

It's a script, move it on script folders even if your server is launched and type //reload quest blabla. Eventually restart your server if custom script can't be reload that way (to be honest, I don't rem).

  • 0
Posted

Use Eclipse

 

Create L2BufferInstance.java and put in it the code:

 

/*

* This program is free software; you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation; either version 2, or (at your option)

* any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with this program; if not, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

* 02111-1307, USA.

*

* http://www.gnu.org/copyleft/gpl.html

*/

package net.sf.l2j.gameserver.model.actor.instance;

 

import java.util.StringTokenizer;

 

import net.sf.l2j.gameserver.ai.CtrlIntention;

import net.sf.l2j.gameserver.datatables.SkillTable;

import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;

import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;

import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

import net.sf.l2j.gameserver.network.serverpackets.SocialAction;

import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;

import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;

import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;

import net.sf.l2j.util.StringUtil;

import net.sf.l2j.util.Rnd;

 

/**

*

* @author DarthVader

* @version 1.3

*/

public final class L2BufferInstance extends L2NpcInstance

{

    public L2BufferInstance(int objectId, L2NpcTemplate template)

    {

        super(objectId, template);

    }

 

    @Override

    public void onBypassFeedback(L2PcInstance player, String command)

    {

        StringTokenizer st = new StringTokenizer(command, " ");

        String actualCommand = st.nextToken();

 

        int buffid = 0;

        int bufflevel = 1;

        if (st.countTokens() == 2) {

            buffid = Integer.valueOf(st.nextToken());

            bufflevel = Integer.valueOf(st.nextToken());

        }

        else if (st.countTokens() == 1)

            buffid = Integer.valueOf(st.nextToken());

 

        if (actualCommand.equalsIgnoreCase("getbuff")) {

            if (buffid != 0) {

                MagicSkillUse mgc = new MagicSkillUse(this, player, buffid, bufflevel, 5, 0);

                SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);

                showMessageWindow(player);

                player.broadcastPacket(mgc);

            }

        }

        else if (actualCommand.equalsIgnoreCase("restore")) {

            player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());

            player.setCurrentCp(player.getMaxCp());

            showMessageWindow(player);

        }

        else if (actualCommand.equalsIgnoreCase("cancel")) {

            player.stopAllEffects();

            showMessageWindow(player);

        }

        else

            super.onBypassFeedback(player, command);

    }

 

    @Override

    public void onAction(L2PcInstance player)

    {

        if (this != player.getTarget()) {

            player.setTarget(this);

            player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));

            player.sendPacket(new ValidateLocation(this));

        }

        else if (isInsideRadius(player, INTERACTION_DISTANCE, false, false)) {

            SocialAction sa = new SocialAction(this, Rnd.get(8));

            broadcastPacket(sa);

            player.setCurrentFolkNPC(this);

            showMessageWindow(player);

            player.sendPacket(ActionFailed.STATIC_PACKET);

        }

        else {

            player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);

            player.sendPacket(ActionFailed.STATIC_PACKET);

        }

    }

   

    private void showMessageWindow(L2PcInstance player)

    {

        NpcHtmlMessage html = new NpcHtmlMessage(1);

        final StringBuilder strBuffer = StringUtil.startAppend(3500, "<html><title>CLAW Magician</title><body><center>");

 

        if (player.isSitting()) {

            player.sendMessage("You can't use buffer while you're sitting.");

            strBuffer.append("Stand up, <font color=\"LEVEL\">%charname%</font>!<br>");

            strBuffer.append("How dare you to talk with me while you're sitting?!<br>");

        }

        else if (player.isAlikeDead()) {

            player.sendMessage("You can't use buffer while you're dead or using fake death.");

            strBuffer.append("Sadly, <font color=\"LEVEL\">%charname%</font>, you're dead.<br>");

            strBuffer.append("I can't offer any support effect for dead people...<br>");

        }

        else if (player.isInCombat()) {

            player.sendMessage("You can't use buffer while you're in combat.");

            strBuffer.append("Sadly, <font color=\"LEVEL\">%charname%</font>, I can't serve you.<br>");

            strBuffer.append("Came back when you will not be in a combat.<br>");

        }

        else {

            strBuffer.append("Welcome, <font color=\"LEVEL\">%charname%</font>!<br>");

            strBuffer.append("Here is the list of all available effects:<br>");

            strBuffer.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left>");

            strBuffer.append("<table width=300>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1204 2\">Wind Walk</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1040 3\">Shield</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1243 6\">Bless Shield</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1068 3\">Might</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1036 2\">Magic Barrier</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1259 4\">Resist Shock</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1035 4\">Mental Shield</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1045 6\">Blessed Body</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1304 3\">Advanced Block</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1048 6\">Blessed Soul</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1062 2\">Berserker Spirit</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1189 3\">Resist Wind</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1086 2\">Haste</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1240 3\">Guidance</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1393 3\">Unholy Resistance</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1242 3\">Death Whisper</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1077 3\">Focus</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1033 3\">Resist Poison</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1268 4\">Vampiric Rage</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1087 3\">Agility</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1191 3\">Resist Fire</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1085 3\">Acumen</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1059 3\">Empower</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1182 3\">Resist Aqua</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1303 2\">Wild Magic</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 1078 6\">Concentration</a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1352 1\">Elemental Protection</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1353 1\">Divine Protection</a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1397 3\">Clarity</a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1392 3\">Holy Resistance</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1043 1\">Holy Weapon</a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1032 3\">Invigor</a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1044 3\">Regeneration</a></td></tr>");

            strBuffer.append("<tr><td></td></tr>");

            strBuffer.append("<tr><td><font color=\"ff9900\">Dances:</font></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 275 1\">Fury</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 273 1\">Mystic</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 365 1\">Siren's</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 274 1\">Fire</a></td>  <td><a action=\"bypass -h npc_%objectId%_getbuff 276 1\">Concentration</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 310 1\">Vampire</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 271 1\">Warrior</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 277 1\">Light</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 272 1\">Inspiration</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 311 1\">Protection</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 309 1\">Earth Guard</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 307 1\">Aqua Guard</a></td></tr>");

            strBuffer.append("<tr><td></td></tr>");

            strBuffer.append("<tr><td><font color=\"ff9900\">Songs:</font></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 264 1\">Earth</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 269 1\">Hunter</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 270 1\">Invocation</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 266 1\">Water</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 267 1\">Warding</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 304 1\">Vitality</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 268 1\">Wind</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 364 1\">Champion</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 349 1\">Renewal</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 265 1\">Life</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 363 1\">Meditation</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 305 1\">Vengeance</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 308 1\">Storm Guard</a></td> <td><a action=\"bypass -h npc_%objectId%_getbuff 306 1\">Flame Guard</a></td></tr>");

            strBuffer.append("<tr><td></td></tr>");

            strBuffer.append("<tr><td><font color=\"ff9900\">Other:</font></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_cancel\"><font color=\"ffffff\">Cancel</font></a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1388 3\">Greater Might</a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1389 3\">Greater Shield</a></td></tr>");

            strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_restore\"><font color=\"ffffff\">Restore</font></a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1363 1\">Chant of Victory</a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1356 1\">Prophecy of Fire</a></td></tr>");

            strBuffer.append("<tr><td></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1355 1\">Prophecy of Water</a></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1357 1\">Prophecy of Wind</a></td></tr>");

            strBuffer.append("<tr><td></td><td><a action=\"bypass -h npc_%objectId%_getbuff 1413 1\">Magnus' Chant</a></td><td></td></tr>");

            strBuffer.append("</table><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left>");

        }

        strBuffer.append("</center></body></html>");

        html.setHtml(strBuffer.toString());

        html.replace("%objectId%", String.valueOf(getObjectId()));

        html.replace("%charname%", player.getName());

        player.sendPacket(html);

    }

}

 

 

 

Put L2BufferInstance.java file into

 

java/net/sf/l2j/gameserver/model/actor/instance/

 

 

 

Now create new npc with id 99 or whatever you want and set type to L2Buffer.

That's all. Now spawn your npc and enjoy.

 

P.s I hate htmls, so I made buffer dialog inside L2BufferInstance.

Guest
This topic is now closed to further replies.


  • Posts

    • First, don't really follow the "main voice", moreover if you consider it an hobby. Simply do what you want, you got only one life so use it as you want. If you make it an hobby, it's exactly like piano, or velo - only practice makes you better.   Secondly, how do you learn things ? It's actually a really important question, since some can simply be scholar, read books (theory) then practice ; and some simply can't read books. I'm the second type, I hated school, I find it boring - my knowledge in Java comes from try-and-fail. You improve your coding style every year or so, I can myself rewrite my own code (which I already considered top-notched) after a while. You always learn something new - even if Java barely evolves. L2J is a fun way to learn programming, it's a giant sandbox where you can edit anything, and I believe it should be taken as it.   My own way of learning was as follow : Add existing customs, no matter what they are : the point is to know main classes used by L2J / customs. L2J is barely Java knowledge ; the true knowledge is to know WHAT to search in WHICH location (what I call, organization). You have to understand than EVERYTHING you think already exists, in a form on another, in the source code. A custom is only the association of the different mechanisms you found "here and there", glued together in a proper goal. Once you know main classes to edit, and the customs you added are compiling fine, the main point is to know WHAT exactly you DID. Try to understand WHY and WHERE you actually copied the code. Third point would be to MANIPULATE the customs you added in order to fit your wish. First edit little values, then logic conditions ; eventually add a new Config, or a new functionality to the custom. Fourth point would be to begin to craft your own ideas. Once again, EVERYTHING already exists, in a form or another. You want a cycled event ? You got Seven Signs main task as exemple. Npc ? Search any type of Npc and figure out what it does. Fifth point would be to understand Java - mostly containers (WHAT and WHERE to use them), variables types and main Java mechanisms (inheritance, static modifier, etc). You should also begin to cut your code into maintainable classes or methods. Java can actually run without optimization, but bigger your ideas, more optimized and well-thought it should be. It's direct saved time in the future, and you would thank yourself doing so. Main tips : ALWAYS use any type of versioning system - GIT or SVN. It allows to save your work, step by step and eventually revert back anytime you want if you terribly messed up. L2J is 80% organization knowledge, and 20% Java knowledge. Basically, if you know WHAT and WHERE to search, if you aren't dumb, it's easy to replicate and re-use things. Cherry on top is to use a already good coded pack to avoid copy-paste crap and get bad habits. Avoid any type of russian or brazilian packs, for exemple - their best ability is to leak someone's else code. Obviously you need some default sense of logic, but Java and programming in general help you to improve it.   Finally, most of your questions could be solved joining related Discord (at least for aCis, I can't speak for others) - from the moment your question was correctly asked (and you seemed to search for the answer). My community (and myself) welcomes newbies, but got some issues with noobies.   The simpliest is to try, fail and repeat until you succeed - it sounds stupid, but that's basically how life works.   PS : about Java ressources, before ChatGPT, it was mostly about stackoverflow website, and site like Baeldung's one. With ChatGPT and alike, you generally double-cross AI output to avoid fucked up answers. Also, care about AI, they are often hallucinating really hard, even today. They can give you complete wrong answer, you tell them they are wrong, and they say "indeed, I suck, sorry - here's a new fucked up answer". You shouldn't 100% rely over AI answer, even if that can give sometimes legit answers, full code or just skeletons of ideas.   PPS : I don't think there are reliable ressources regarding L2J itself, also most of the proposed code decays pretty fast if the source code is actually maintained (at least for aCis). Still, old coded customs for old aCis sources are actually a good beginner challenge to apply on latest source.
    • WTS: - AQ - Baium - Zaken  - Frintezza - Vesper Fighter Focus Fire Element   pm for detalis
    • We have the best price! L2Reborn.org Signature x1 Franz NEW!! 1KK = $20 HURRY TO BUY AT THE TOP PRICE discord - adver745645
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock