def is_instant_complete_quest(self): for reqSource in QuestHelpers.generate_req_source_list(self.quest): if reqSource != 0: return False for reqItem in QuestHelpers.generate_req_item_list(self.quest): if reqItem != 0: return False for reqCreatureGo in QuestHelpers.generate_req_creature_or_go_list( self.quest): if reqCreatureGo != 0: return False for reqSpellCast in QuestHelpers.generate_req_spell_cast_list( self.quest): if reqSpellCast != 0: return False return True
def check_quest_requirements(self, quest_template): # Is the player character the required race. race_is_required = quest_template.RequiredRaces > 0 if race_is_required and not (quest_template.RequiredRaces & self.player_mgr.race_mask): return False # Is the character the required class. class_is_required = quest_template.RequiredClasses > 0 if class_is_required and not (quest_template.RequiredClasses & self.player_mgr.class_mask): return False # Does the character have the required source items. # TODO: Should we have this check? source_item_required = list( filter((0).__ne__, QuestHelpers.generate_req_source_list(quest_template))) source_item_count_list = list( filter( (0).__ne__, QuestHelpers.generate_req_source_count_list(quest_template))) for index, item in enumerate(source_item_required): if self.player_mgr.inventory.get_item_count( item) < source_item_count_list[index]: return False # Has the character already started the next quest in the chain. if quest_template.NextQuestInChain > 0 and quest_template.NextQuestInChain in self.completed_quests: return False # Does the character have the previous quest. if quest_template.PrevQuestId > 0 and quest_template.PrevQuestId not in self.completed_quests: return False # TODO: Does the character have the required skill return True
def requires_item(self, item_entry): req_item = QuestHelpers.generate_req_item_list(self.quest) req_src_item = QuestHelpers.generate_req_source_list(self.quest) return item_entry in req_item or item_entry in req_src_item