Jump to content
  • 0

[Help] Adapting a NPC Code to L2jFree Core...


Question

Posted

Hi again to all ^_^

 

Here me asking for some help jejeje 

 

A got a NPC that support to handle the Symbols (dyes)... Original one it's for L2jServer platform, but when y try to adapt it to L2jFree core i got some errors that cannot understand...

 

One of them are:

WARNING [07 Jan 22:33:12,864] com.l2jfree.gameserver.model.quest.Quest.showError(): /home/l2jfree/Gameserver/data/scripts/custom/955_NpcService/__init__.py

Traceback (innermost last):
  File "__init__.py", line 688, in onAdvEvent
  File "__init__.py", line 430, in optionsymbol
[b]TypeError: getAvailableHenna(): 1st arg can't be coerced to com.l2jfree.gameserver.model.actor.instance.L2PcInstance[/b]

        at org.python.core.Py.TypeError(Unknown Source)
        at org.python.core.PyReflectedFunction.throwError(Unknown Source)
        at org.python.core.PyReflectedFunction.throwBadArgError(Unknown Source)
        at org.python.core.PyReflectedFunction.throwError(Unknown Source)
        at org.python.core.PyReflectedFunction.__call__(Unknown Source)
        at org.python.core.PyMethod.__call__(Unknown Source)
        at org.python.core.PyObject.__call__(Unknown Source)
        at org.python.core.PyInstance.invoke(Unknown Source)
        at org.python.pycode._pyx443.optionsymbol$12(__init__.py:430)
        at org.python.pycode._pyx443.call_function(__init__.py)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyFunction.__call__(Unknown Source)
        at org.python.pycode._pyx443.onAdvEvent$21(__init__.py:688)
        at org.python.pycode._pyx443.call_function(__init__.py)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyFunction.__call__(Unknown Source)
        at org.python.core.PyMethod.__call__(Unknown Source)
        at org.python.core.PyObject.__call__(Unknown Source)
        at org.python.core.PyObject._jcallexc(Unknown Source)
        at org.python.core.PyObject._jcall(Unknown Source)
        at org.python.proxies.main$Quest$442.onAdvEvent(Unknown Source)
        at com.l2jfree.gameserver.model.quest.Quest.notifyEvent(Quest.java:425)
        at com.l2jfree.gameserver.model.actor.instance.L2PcInstance.processQuestEvent(L2PcInstance.java:1579)
        at com.l2jfree.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:171)
        at com.l2jfree.mmocore.network.ReceivablePacket.run(ReceivablePacket.java:64)
        at com.l2jfree.util.concurrent.ExecuteWrapper.execute(ExecuteWrapper.java:59)
        at com.l2jfree.gameserver.threadmanager.FIFORunnableQueue.removeAndExecuteFirst(FIFORunnableQueue.java:28)
        at com.l2jfree.gameserver.threadmanager.FIFOExecutableQueue.run(FIFOExecutableQueue.java:73)
        at com.l2jfree.util.concurrent.ExecuteWrapper.execute(ExecuteWrapper.java:59)
        at com.l2jfree.util.concurrent.ExecuteWrapper.run(ExecuteWrapper.java:40)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

 

 

 

On the script into thats lines a got the code:

def optionsymbol(st, cases,num):

if cases == "draws":
      [b]henna = HennaTreeTable.getInstance().getAvailableHenna(st.player.getClassId())[/b]
      hel = HennaEquipList(st.player, henna)
      st.player.sendPacket(hel)
   elif cases == "deletes":
      MAIN_HTML = "<html><title>Services Manager</title><body><center>"
      MAIN_HTML += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
      MAIN_HTML += "<font color=\"FF0000\">.::Select symbol you would like to remove::.</font><br><br><br1>"
      hasHennas = False
      i=0
      if num != "0": st.player.removeHenna(int(num))
      while i <= 2 :
         i+=1
         henna = st.player.getHenna(i)
         if henna != None:
            hasHennas = True
            MAIN_HTML += "<button value=\""+henna.getName()+"\" action=\"bypass -h Quest " +QUEST_INFO+ " symbol deletes "+str(i)+" 0\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>"
      if hasHennas == False:
         MAIN_HTML = "<html><title>Services Manager</title><body><center>"
         MAIN_HTML += "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><font color=\"FF0000\">You don't have any symbol to remove!</font><br>"
      MAIN_HTML += "</center></body></html>"
      return MAIN_HTML

 

 

And on the com.l2jfree.gameserver.datatables.HennaTreeTable.java on thats lines i got:

 

public L2Henna[] getAvailableHenna(L2PcInstance player)

{
      return _hennaTrees.get(player.getClassId().getId());
   }

 

And on the L2jServer platform in the same file i got:

public L2HennaInstance[] getAvailableHenna(ClassId classId)

{
      List<L2HennaInstance> result = new FastList<L2HennaInstance>();
      List<L2HennaInstance> henna = _hennaTrees.get(classId);
      if (henna == null)
      {
         // the hennatree for this class is undefined, so we give an empty list
         _log.warning("Hennatree for class " + classId + " is not defined !");
         return new L2HennaInstance[0];
      }
      
      for (L2HennaInstance temp : henna)
      {
         result.add(temp);
      }
      
      return result.toArray(new L2HennaInstance[result.size()]);
   }

As the creators know, there's should be a way to adapt this to L2jFree core???. Or someone else? By the way, lines in bold are the conflict codes...

 

Some basic description, NPC should add or remove Dyes depend of the class and available dyes from inventory.

 

But due i don't know to much about the L2j core at all (in general not L2jServer, not L2jFree, L2j in general), I'm still studying... I know that every core has it's own way of work...

 

Waiting for a help? please ^_^! My server it's on Linux, so didn't be much trouble with that didn't?

3 answers to this question

Recommended Posts

  • 0
Posted

getAvailableHenna(L2PcInstance player) awaits a L2PcInstance and you write : getAvailableHenna(st.player.getClassId()), which obviously returns a class id.

 

Change all getAvailableHenna(st.player.getClassId()) for getAvailableHenna(st.player) and normally that will work.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...