All pastes #52245 Raw Edit

Anonymous

public text v1 · immutable
#52245 ·published 2006-04-29 18:56 UTC
rendered paste body
# Made by mtrix
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

CROKIAN_LAD = 804
CROKIAN_LAD_WARRIOR = 806
DAILAON_LAD = 805
FARHITE_LAD = 807
NOS_LAD = 808
SWAMP_TRIBE = 991
ADENA = 57
ALLIGATOR_TOOTH = 5863
TORN_MAP_FRAGMENT = 5864
PIRATES_TREASURE_MAP = 5915
AMOUNT = st.getQuestItemsCount(ALLIGATOR_TOOTH)*300
CHANCE = 30
CHANCE2 = 10

class Quest (JQuest) :

 def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

 def onEvent (self,event,st) :
     htmltext = event
     if event == "7895-00a.htm" :
         st.exitQuest(1)
     elif event == "1" :
         if st.getQuestItemsCount(TORN_MAP_FRAGMENT)>=10 :
             htmltext = "7895-06.htm"
         else :
             st.setState(STARTED)
             st.set("cond","1")
             htmltext = "7895-02.htm"
             st.playSound("ItemSound.quest_accept")
     elif event == "2" :
         st.takeItems(TORN_MAP_FRAGMENT,-1)
         st.giveItems(PIRATES_TREASURE_MAP,1)
         htmltext = "7895-07.htm"
         st.playSound("ItemSound.quest_itemget")
     elif event == "3" :
         st.exitQuest(1)
         st.playSound("ItemSound.quest_finish")
     return htmltext
 def onTalk (Self,npc,st):
     npcId = npc.getNpcId()
     htmltext = "<html><head><body>I have nothing to say you</body></html>"
     id = st.getState()
     level = st.getPlayer().getLevel()
     cond = st.getInt("cond")
     if npcId == 7895 :
         if id == CREATED and level>=38 :
             htmltext = "7895-01.htm"
         elif id == CREATED and level<38 :
             htmltext = "7895-00.htm"
         elif cond==1 and st.getQuestItemsCount(ALLIGATOR_TOOTH)==0 :
             htmltext = "7895-03.htm"
         elif cond==1 and st.getQuestItemsCount(ALLIGATOR_TOOTH)!=0 and st.getQuestItemsCount(ALLIGATOR_TOOTH)<100 :
             st.giveItems(ADENA,AMOUNT)
             st.takeItems(ALLIGATOR_TOOTH,-1)
             htmltext = "7895-04.htm"
         elif cond==1 and st.getQuestItemsCount(ALLIGATOR_TOOTH)>=100 :
             st.giveItems(ADENA,AMOUNT)
             st.takeItems(ALLIGATOR_TOOTH,-1)
             htmltext = "7895-05.htm"
     return htmltext
 def onKill (self,npc,st):
     npcId = npc.getNpcId()
     cond = st.getInt("cond")
     if npcId in (CROKIAN_LAD,CROKIAN_LAD_WARRIOR,DAILAON_LAD,FARHITE_LAD,NOS_LAD,SWAMP_TRIBE) and st.getRandom(100) <= CHANCE :
         st.giveItems(ALLIGATOR_TOOTH,1)
     if npcId in (CROKIAN_LAD,CROKIAN_LAD_WARRIOR,DAILAON_LAD,FARHITE_LAD,NOS_LAD,SWAMP_TRIBE) and st.getRandom(100) <= CHANCE2 and st.getQuestItemsCount(TORN_MAP_FRAGMENT)<10 :
         st.giveItems(TORN_MAP_FRAGMENT,1)
     return

QUEST       = Quest(354,"354_ConquestOfAlligatorIsland","Conquest Of Alligator Island")
CREATED     = State('Start', QUEST)
STARTED     = State('Started', QUEST)
COMPLETED   = State('Completed', QUEST)


QUEST.setInitialState(CREATED)
QUEST.addStartNpc(7895)

CREATED.addTalkId(7895)

STARTED.addTalkId(7895)

STARTED.addKillId(804)
STARTED.addKillId(805)
STARTED.addKillId(806)
STARTED.addKillId(807)
STARTED.addKillId(808)
STARTED.addKillId(991)

print "importing quests: 354: Conquest Of Alligator Island"