Browse Source

JYTHON: Just a small cleanup of a couple onFirstTalks. Nothing major.

Emperorc 17 years ago
parent
commit
22d7908109

+ 8 - 12
datapack_development/data/scripts/quests/114_ResurrectionOfAnOldManager/__init__.py

@@ -198,19 +198,15 @@ class Quest (JQuest) :
 
  def onFirstTalk (self,npc,player): #atm custom, on retail it is when you walk to npcs radius
     st = player.getQuestState(qn)
-    if not st : 
-       npc.showChatWindow(player)
-       return
-    npcId = npc.getNpcId()
-    cond = st.getInt("cond")
-    if npcId == Stones and cond == 17:
-       st.playSound("ItemSound.quest_middle")
-       st.takeItems(Detector,1)
-       st.giveItems(Detector2,1)
-       st.set("cond","18")
-       player.sendPacket(ExShowScreenMessage("The radio signal detector is responding. # A suspicious pile of stones catches your eye.",4500))
+    if st : 
+        if npc.getNpcId() == Stones and st.getInt("cond") == 17:
+           st.playSound("ItemSound.quest_middle")
+           st.takeItems(Detector,1)
+           st.giveItems(Detector2,1)
+           st.set("cond","18")
+           player.sendPacket(ExShowScreenMessage("The radio signal detector is responding. # A suspicious pile of stones catches your eye.",4500))
     npc.showChatWindow(player)
-    return ""
+    return None
 
  def onTalk (self,npc,player):
     htmltext = "<html><head><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"

+ 13 - 13
datapack_development/data/scripts/quests/65_CertifiedSoulBreaker/__init__.py

@@ -8,6 +8,7 @@ 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.serverpackets      import CreatureSay
 from net.sf.l2j.gameserver.serverpackets      import SocialAction
+from net.sf.l2j.gameserver.serverpackets      import ActionFailed
 
 qn = "65_CertifiedSoulBreaker"
 
@@ -96,18 +97,17 @@ class Quest (JQuest) :
 
     def onFirstTalk (self,npc,player):
         st = player.getQuestState(qn)
-        if not st : return htmltext
-        npcId = npc.getNpcId()
-        cond = st.getInt("cond")
-        if npcId == Katenar and cond == 12:
-            st.unset("angel")
-            st.playSound("ItemSound.quest_itemget")
-            st.set("cond","13")
-            self.isAngelSpawned = 0
-            self.isKatenarSpawned = 0
-            st.giveItems(Document,1)
-            return "32242-01.htm"
-        return ""
+        if st :
+            if npc.getNpcId() == Katenar and st.getInt("cond") == 12:
+                st.unset("angel")
+                st.playSound("ItemSound.quest_itemget")
+                st.set("cond","13")
+                self.isAngelSpawned = 0
+                self.isKatenarSpawned = 0
+                st.giveItems(Document,1)
+                return "32242-01.htm"
+        player.sendPacket(ActionFailed.STATIC_PACKET)
+        return None
 
     def onTalk (self,npc,player):
         htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
@@ -288,4 +288,4 @@ QUEST.addTalkId(CargoBox)
 QUEST.addFirstTalkId(Katenar)
 
 QUEST.addKillId(Angel)
-QUEST.addKillId(Wyrm)
+QUEST.addKillId(Wyrm)

+ 6 - 8
datapack_development/data/scripts/quests/999_T1Tutorial/__init__.py

@@ -131,17 +131,16 @@ class Quest (JQuest) :
     return htmltext
 
  def onFirstTalk (self,npc,player):
+   qs = player.getQuestState(qnTutorial)
+   if not qs : 
+      npc.showChatWindow(player)
+      return None
    st = player.getQuestState(qn)
    if not st :
       st = self.newQuestState(player)
-   qs = st.getPlayer().getQuestState(qnTutorial)
-   if not qs : 
-      npc.showChatWindow(player)
-      return
    htmltext = ""
    Ex = qs.getInt("Ex")
    npcId = npc.getNpcId()
-   id = st.getState()
    step=st.getInt("step")
    onlyone=st.getInt("onlyone")
    level=player.getLevel()
@@ -152,10 +151,9 @@ class Quest (JQuest) :
    if (level >= 10 or onlyone) and npcTyp == 1:
        htmltext = "30575-05.htm"
    elif npcId in [30600, 30601, 30602, 30598, 30599, 32135]:
-     id = st.getState()
      reward=qs.getInt("reward")
      if reward == 0:
-       if player.getClassId().isMage() :
+       if isMage :
          st.playTutorialVoice("tutorial_voice_027")
          st.giveItems(SPIRITSHOT_NOVICE,100)
        else:
@@ -166,7 +164,7 @@ class Quest (JQuest) :
        qs.set("reward","1")
        st.exitQuest(False)
      npc.showChatWindow(player)
-     return
+     return None
    elif onlyone == 0 and level < 10 :
     if player.getRace().ordinal() == raceId :
       htmltext=htmlfiles[0]