Skip to content

[help] python script help!!!!!

Featured Replies

hi all exw auto to scriptaki gia na kanoun oi caln leader antalagh festival adena me reputation points

import sys
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest import QuestState
from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jserver.gameserver.network.serverpackets import SystemMessage

qn = "9995_ReputationManager"

#NPC
BRICE = 9995

#ITEMS
EUROS = 6673

#HTML

HTMLEXPLAIN = "<html><body>Brice:<BR>Wow ! You have some Event Coins for me ? You can exchange them for Clan Reputation points. But be careful, I'll take 3 Coins, 3 for 5000 Clan Reputation Points. Do you really want to continue ?<BR><a action=\"bypass -h Quest 9995_ReputationManager 1\">Yes, I need Clan Reputation points</a></body></html>"
HTMLNOLEADER = "<html><body>Brice:<BR>Hey, you're not a clan leader at all. Go away from me, liar !</body></html>"
HTMLCLANLVL = "<html><body>Brice:<BR>Hum, it seems your clan is not strong enough to receive my benediction. Come back when your clan level is lv5.</body></html>"
HTMLNOGOLD = "<html><body>Brice:<BR>What do you want to do ? Do you want to receive my benediction for free ? Bring me back some Coins, and maybe, I will trade with you.</body></html>"
HTMLOK = "<html><body>Brice:<BR>Thanks to you for this present, I give you Clan Reputation Points. Please, come again if you have any Coins to exchange.</body></html>"

class Quest (JQuest) :
    def __init__(self,id,name,descr) :

       JQuest.__init__(self,id,name,descr)
        
    def onEvent (self,event,st) :
      htmltext = "<html><body>I have no task right for you now.</body></html>"
      if event == "1" :
        if st.getPlayer().getClan() == None or st.getPlayer().isClanLeader() == 0 :
          # player is not in clan or is not clan leader
          htmltext = HTMLNOLEADER
          st.exitQuest(1)
          return htmltext
        else :
          if st.getPlayer().getClan().getLevel() < 5 :
            # player's clan is under lv5
            htmltext = HTMLCLANLVL
            st.exitQuest(1)
            return htmltext
          else :
           if st.getQuestItemsCount(EUROS) == 3:
              # player have some EUROS, the script take all of them
              st.getPlayer().sendPacket(SystemMessage(1777).addNumber( st.getQuestItemsCount(EUROS)+ 5000 ))
              st.getPlayer().getClan().setReputationScore( st.getPlayer().getClan().getReputationScore() + st.getQuestItemsCount(EUROS)+ 5000 , True)
              st.takeItems(EUROS, st.getQuestItemsCount(EUROS))
              htmltext = HTMLOK
              st.exitQuest(1)
              return htmltext
           else :
              # player haven't EUROS
              htmltext = HTMLNOGOLD
              st.exitQuest(1)
              return htmltext
      return htmltext


    def onTalk(self,npc,player) :
      st = player.getQuestState(qn)
      if not st :
        return "<html><body>I have nothing to say to you.</body></html>"
      npcId = npc.getNpcId()
      if npcId == BRICE :
        # first click, default script text after the first in /html/default/ folder
        st.set("cond","0")
        htmltext = HTMLEXPLAIN
      return htmltext


QUEST = Quest(9995,qn,"ReputationManager")

QUEST.addStartNpc(BRICE)
QUEST.addTalkId(BRICE)

 

alla otan milaw sto npc exw auto sto  gameserver console :

 

  File "__init__.py", line 46, in onEvent
AttributeError: setReputationScore

       at org.python.core.Py.AttributeError(Unknown Source)
       at org.python.core.PyInstance.invoke(Unknown Source)
       at org.python.pycode.serializable._pyx1280312495656.onEvent$3(__init__.p
y:46)
       at org.python.pycode.serializable._pyx1280312495656.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$427.onEvent(Unknown Source)
       at com.l2jserver.gameserver.model.quest.Quest.onAdvEvent(Quest.java:674)

       at com.l2jserver.gameserver.model.quest.Quest.notifyEvent(Quest.java:405
)
       at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.processQue
stEvent(L2PcInstance.java:1823)
       at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.
runImpl(RequestBypassToServer.java:238)
       at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run
(L2GameClientPacket.java:93)
       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)

Mporei Kaneis na helparei???

File "__init__.py", line 46, in onEvent

 

edw einai to provlima filos psaksto kalitera.

 

hmmm an kai dn pistevo alla tha dw amma mpwro na se help na rwtiso ena pedi prota :)

  • Author

fix it loc topic

fix it loc topic

 

ok.

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.