def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) # All of these are overridden in the subclasses self.NPC = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] self.Items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] self.Mob = [0, 1, 2] self.classid = 0 self.prevclass = 0 self.qn = "SagasSuperclass" self.X = [0, 1, 2] self.Y = [0, 1, 2] self.Z = [0, 1, 2] self.Text = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] self.Spawn_List = [] #all these are not overridden by the subclasses (either cause they are constant or used only for this script) self.CREATED = State('Start', self) self.STARTED = State('Started', self) self.COMPLETED = State('Completed', self)
htmltext = "30355-02.htm" st.takeItems(SENTRY_BLADE2_ID, 1) elif npcId == 30357 and st.getInt( "cond") == 1 and st.getQuestItemsCount( SENTRY_BLADE3_ID) == 1 and st.getQuestItemsCount( SENTRY_BLADE1_ID) == 0: htmltext = "30357-01.htm" st.takeItems(SENTRY_BLADE3_ID, 1) st.giveItems(OLD_BRONZE_SWORD_ID, 1) elif npcId == 30357 and st.getInt( "cond") == 1 and st.getQuestItemsCount( SENTRY_BLADE3_ID) == 0: htmltext = "30357-02.htm" st.takeItems(SENTRY_BLADE3_ID, 1) return htmltext QUEST = Quest(168, qn, "Deliver Supplies") CREATED = State('Start', QUEST) STARTING = State('Starting', QUEST) STARTED = State('Started', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(30349) QUEST.addTalkId(30349) QUEST.addTalkId(30355) QUEST.addTalkId(30357) QUEST.addTalkId(30360)
if not partyMember: return st = partyMember.getQuestState(qn) if st : if st.getState() == STARTED : count = st.getQuestItemsCount(TOP_QUALITY_MEAT) if st.getInt("cond") == 1 and count < 120 : chance = 100 * Config.RATE_DROP_QUEST numItems, chance = divmod(chance,100) if st.getRandom(100) < chance : numItems += 1 if numItems : if count + numItems >= 120 : numItems = 120 - count st.playSound("ItemSound.quest_middle") st.set("cond","2") else: st.playSound("ItemSound.quest_itemget") st.giveItems(TOP_QUALITY_MEAT,int(numItems)) return QUEST = Quest(631,qn,"Delicious Top Choice Meat") CREATED = State('Start', QUEST) STARTED = State('Started', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(TUNATUN) QUEST.addTalkId(TUNATUN) for npcId in range(21460,21468)+ range(21479,21487)+range(21498,21506) : QUEST.addKillId(npcId)
chance=int((npc.getLevel() - grade * 3 - 20)*Config.RATE_DROP_QUEST) item=DROP_LIST[npcId][0] random = st.getRandom(100) if item == KALDIS_COIN : if cond == 2 : if not st.getQuestItemsCount(item) and random < (chance - 10) : st.giveItems(item,1) st.playSound("ItemSound.quest_middle") st.set("cond","3") elif random < chance: st.giveItems(item,1) st.playSound("ItemSound.quest_itemget") return # Quest class and state definition QUEST = Quest(QUEST_NUMBER, str(QUEST_NUMBER)+"_"+QUEST_NAME, QUEST_DESCRIPTION) CREATED = State('Start', QUEST) SOLO = State('Solo', QUEST) PARTY = State('Party', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) # Quest NPC starter initialization QUEST.addStartNpc(SORINT) # Quest initialization for npc in [SORINT, BERNARD, PAGE, HAGGER, STAN, RALFORD, FERRIS, COLLOB, PANO, DUNING, LORAIN]: QUEST.addTalkId(npc) for mob in DROP_LIST.keys(): QUEST.addKillId(mob)
if player.isSubClassActive(): st.exitQuest(1) return htmltext # Dark Elves only if npcId in NPCS: htmltext = str(npcId) if race in [2]: if classId.level( ) == 1: # first occupation change already made htmltext += "-32.htm" elif classId.level( ) >= 2: # second/third occupation change already made htmltext += "-31.htm" elif id == 31: # DE Fighter return htmltext + "-01.htm" elif id == 38: # DE Mystic return htmltext + "-08.htm" else: htmltext += "-33.htm" # other races st.exitQuest(1) return htmltext QUEST = Quest(99997, qn, "village_master") CREATED = State('Start', QUEST) QUEST.setInitialState(CREATED) for npc in NPCS: QUEST.addStartNpc(npc) QUEST.addTalkId(npc)
else: foulPlayer = self.inProgressDuelMobs[npcId][0] if foulPlayer: # if not null (perhaps the player went offline)... st = foulPlayer.getQuestState(qn) if st: # the original player has not aborted the quest st.set( var, "5" ) # if the player cheats, give foul crystal and set stat to cheat st.giveItems(foul, 1) # finally, clear the inProgress mob info. self.inProgressDuelMobs.pop(npcId) return QUEST = Quest(230, qn, "Test Of Summoner") CREATED = State('Start', QUEST) PROGRESS = State('Progress', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(NPC[1]) # adds all npcs, mobs to the progress state for npcId in NPC: QUEST.addTalkId(npcId) for mobId in DROPLIST_LARA.keys(): QUEST.addKillId(mobId) for mobId in DROPLIST_SUMMON.keys(): QUEST.addKillId(mobId) QUEST.addAttackId(mobId) #for summonId in PLAYER_SUMMONS:
if not st : return if st.getState() != STARTED : return count = st.getQuestItemsCount(KASHA_WOLF_FANG) if count < 50 : numItems, chance = divmod(125,100) if st.getRandom(100) <= chance : numItems += 1 numItems = int(numItems) if numItems != 0 : if 50 <= (count + numItems) : numItems = 50 - count st.playSound("ItemSound.quest_middle") st.set("cond","2") else: st.playSound("ItemSound.quest_itemget") st.giveItems(KASHA_WOLF_FANG,numItems) return QUEST = Quest(271,qn,"Proof Of Valor") CREATED = State('Start', QUEST) STARTING = State('Starting', QUEST) # kept just for backwards compatibility STARTED = State('Started', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(30577) QUEST.addTalkId(30577) QUEST.addKillId(20475)
if count < maxcount: st.giveItems(item, 1) # spawns 5 new medusas around the dead queen *muha* if npcId == 27108: for i in range(5): st.addSpawn(20158) if count == maxcount - 1: st.playSound("ItemSound.quest_middle") st.set(var, str(isValue + 1)) else: st.playSound("ItemSound.quest_itemget") return QUEST = Quest(233, qn, "Test Of Warspirit") CREATED = State('Start', QUEST) PART1 = State('Part1', QUEST) PART2 = State('Part2', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(30510) for npcId in NPC: QUEST.addTalkId(npcId) for mobId in PART1_MOBS: QUEST.addKillId(mobId) for mobId in PART2_MOBS: QUEST.addKillId(mobId)
numItems, chance = divmod(chance,100) count = st.getQuestItemsCount(item) if st.getRandom(100) < chance : numItems += 1 if numItems : if count + numItems >= REQUIRED_SPIDER_LEGS : numItems = REQUIRED_SPIDER_LEGS - count st.playSound("ItemSound.quest_middle") else: st.playSound("ItemSound.quest_itemget") st.giveItems(item,int(numItems)) return # Quest class and state definition QUEST = Quest(419, qn, "Wolf Collar") CREATED = State('Start', QUEST) STARTED = State('Started', QUEST) SLAYED = State('Slayed', QUEST) TALKED = State('Talked', QUEST) COMPLETED = State('Completed', QUEST) # Quest initialization QUEST.setInitialState(CREATED) # Quest NPC starter initialization QUEST.addStartNpc(PET_MANAGER_MARTIN) # Quest mob initialization for mob in [SPIDER_H1,SPIDER_H2,SPIDER_H3,SPIDER_LE1,SPIDER_LE2,SPIDER_LE3,SPIDER_DE1,SPIDER_DE2,SPIDER_DE3,SPIDER_O1,SPIDER_O2,SPIDER_O3,SPIDER_D1,SPIDER_D2]: QUEST.addKillId(mob) # Quest NPC initialization
spawnedNpc) else: st.giveItems(R4[st.getRandom(len(R4))], 1) except: pass elif npcId == GREAT_DEMON_KING: try: st.getQuestTimer("greatdemon_timer1").cancel() st.giveItems(ADENA, 1412965) st.playSound("ItemSound.quest_itemget") except: pass return QUEST = Quest(334, qn, "The Wishing Potion") CREATED = State('Start', QUEST) STARTED = State('started', QUEST) #Following states kept for backwards compatibility only. MIDDLE = State('middle', QUEST) END = State('end', QUEST) COMPLETED = State('completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(ALCHEMIST_MATILD) QUEST.addTalkId(ALCHEMIST_MATILD) QUEST.addTalkId(TORAI) QUEST.addTalkId(RUPINA) QUEST.addTalkId(WISDOM_CHEST)
htmltext = "32115-05.htm" st.takeItems(M_EGG, 1) st.giveItems(57, 71318) st.setState(COMPLETED) st.set("cond", "0") st.playSound("ItemSound.quest_finish") elif npcId == KARAKAWEI: if cond == 4: htmltext = "32117-01.htm" if id == MIDDLE: htmltext = "32117-02.htm" elif cond == 5: htmltext = "32117-04.htm" elif npcId == MANTARASA and cond == 5: htmltext = "32118-01.htm" return htmltext QUEST = Quest(124, qn, "Meeting The Elroki") CREATED = State('Start', QUEST) STARTED = State('Started', QUEST) MIDDLE = State('Middle', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(MARQUEZ) QUEST.addTalkId(MARQUEZ) QUEST.addTalkId(MUSHIKA) QUEST.addTalkId(ASAMAH) QUEST.addTalkId(KARAKAWEI) QUEST.addTalkId(MANTARASA)
else: st.playSound("ItemSound.quest_itemget") return # only leaders are registered for onDeath. Therefore, st should always match that of the leader def onDeath(self, npc, pc, st): if st.getPlayer() == pc: timer1 = st.getQuestTimer("poison_timer") timer2 = st.getQuestTimer("chest_timer") if timer1 != None: timer1.cancel() if timer2 != None: timer2.cancel() st.exitQuest(1) if DEBUG: return "DEBUG: Leader died. Quest failed." QUEST = Quest(501, qn, qd) CREATED = State('Start', QUEST) PART2 = State('Part2', QUEST) PART3 = State('Part3', QUEST) PART4 = State('Part4', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) for i in [SIR_KRISTOF_RODEMAI, STATUE_OF_OFFERING]: QUEST.addStartNpc(i) QUEST.addTalkId(i) for i in [WITCH_KALIS, WITCH_ATHREA]: QUEST.addTalkId(i) for i in range(len(MOBS)):
def onTalk(self, npc, player): htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>" st = player.getQuestState(qn) if not st: return htmltext npcId = str(npc.getNpcId()) id = st.getState() if id == CREATED: st.set("cond", "0") if st.getInt("cond") == 0: htmltext = npcId + "-01.htm" elif check(st): htmltext = npcId + "-03.htm" elif st.getQuestItemsCount( RED_SOUL_CRYSTAL0_ID) == st.getQuestItemsCount( GREEN_SOUL_CRYSTAL0_ID) == st.getQuestItemsCount( BLUE_SOUL_CRYSTAL0_ID) == 0: htmltext = npcId + "-21.htm" return htmltext QUEST = Quest(350, qn, "Enhance Your Weapon") CREATED = State('Start', QUEST) STARTING = State('Starting', QUEST) STARTED = State('Started', QUEST) QUEST.setInitialState(CREATED) for npcId in NPC: QUEST.addStartNpc(npcId) QUEST.addTalkId(npcId)