Secret Experience

Secret Experience (https://secretexperience.net/)
-   [L2J] Dúvidas (https://secretexperience.net/l2j-duvidas/)
-   -   [Interlude] Entrega de itens por quest (Python) (https://secretexperience.net/l2j-duvidas/32454-entrega-de-itens-por-quest-python.html)

xadresz 04-08-2011 10:03 PM

Entrega de itens por quest (Python)
 
Bom tava tentando criar um shop mais ou menos igual ao monumento de heroes, só que para AIOx.

Tipo, o player usa o npc, o npc identifica como AIOx e entrega a dual sword.
Até aí consegui fazer, ele clica no npc sendo aio e pega a sword, só que quando ele entrega a dual ele da um erro no gameserver:

Código:

Traceback (innermost last):
  File "__init__.py", line 29, in onTalk
NameError: html

        at org.python.core.Py.NameError(Unknown Source)
        at org.python.core.PyFrame.getglobal(Unknown Source)
        at org.python.pycode._pyx41.onTalk$4(__init__.py:29)
        at org.python.pycode._pyx41.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$38.onTalk(Unknown Source)
        at com.l2jfrozen.gameserver.model.quest.Quest.notifyTalk(Quest.java:514)

        at com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance.showQuest
Window(L2NpcInstance.java:1892)
        at com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance.onBypassF
eedback(L2NpcInstance.java:1154)
        at com.l2jfrozen.gameserver.network.clientpackets.RequestBypassToServer.
runImpl(RequestBypassToServer.java:243)
        at com.l2jfrozen.gameserver.network.clientpackets.L2GameClientPacket.run
(L2GameClientPacket.java:88)
        at com.l2jfrozen.gameserver.network.L2GameClient.run(L2GameClient.java:1
197)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Parte do código onde entrega o Item:

Código:

def onTalk (self,npc,player):
    st = player.getQuestState(qn)
    if st.getPlayer().isAio():
      st.giveItems(9945,1)
      htmltext=html.replace("%bypass%",str(bypass)).replace("%objectId%",str(npc.getObjectId()))
    else :
      htmltext="You do not have AIOx Power!"
    return htmltext

Alguém poderia me ajudar??

allanalcantara 04-08-2011 11:03 PM

tenta por assim já que é quest ele reconhece como tal
Código:

if event:
      if st.giveItems(9994,0) # ID,Count ( ex: 57,50 ) toda vez que  você vim no NPC, ele pedirar 50(count) de Adenas(57)
          return
    return event

ou

if count < 1 and st.getPlayer().isAio() < 1 :
htmltext = "<html><head><body>oce nao tem itens suficiente para usar essa acao.</body></html>"

elif st.getPlayer().isAio() == 0 :
htmltext = "<html><head><body> Desculpe, voce nao e Aio</body></html>"
st.giveItems(ID,1)


algo tipo assim. auehauhehauea

st.playSound("ItemSound.quest_finish")
st.setState(State.COMPLETED)

xadresz 05-08-2011 12:06 PM

valeu a tentativa, mas agora ele não liga a quest, da erro:
Código:

Traceback (innermost last):
  (no code object) at line 0
SyntaxError: ('invalid syntax', ('__init__.py', 29, 32, '      if st.giveItems(9945,1)'))


Tá assim :
Código:

def onTalk (self,npc,player):
    st = player.getQuestState(qn)
    if st.getPlayer().isAio():
      if event:
      if st.giveItems(9945,1)
          return
    return event

      htmltext=html.replace("%bypass%",str(bypass)).replace("%objectId%",str(npc.getObjectId()))
    else :
      htmltext="You do not have AIOx Power!"
    return htmltext

Do jeito que tava, ele ligava normal, dava o item e tudo, só que quando entregava o item ele dava o erro lá de cima :(

Se alguém conseguir me ajudar eu posto o SHOP todo aqui pra galera no fórum.


Horários baseados na GMT -3. Agora são 05:26 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0