diff --git a/toontown/ai/QuestManagerAI.py b/toontown/ai/QuestManagerAI.py index 8be875d0..c7a50c95 100755 --- a/toontown/ai/QuestManagerAI.py +++ b/toontown/ai/QuestManagerAI.py @@ -81,7 +81,7 @@ class QuestManagerAI: # If it's a TrackChoiceQuest then present their track choices. if isinstance(questClass, Quests.TrackChoiceQuest): - npc.presentTrackChoice(avId, questId, questClass.getChoices(av)) + npc.presentTrackChoice(avId, questId, questClass.getChoices()) break # If there is another part to this quest then give them that. if Quests.getNextQuest(questId, npc, av)[0] != Quests.NA: diff --git a/toontown/quest/QuestPoster.py b/toontown/quest/QuestPoster.py index aeeb23ea..a5b9c577 100755 --- a/toontown/quest/QuestPoster.py +++ b/toontown/quest/QuestPoster.py @@ -419,8 +419,8 @@ class QuestPoster(DirectFrame): elif quest.getType() == Quests.TrackChoiceQuest: frameBgColor = 'green' invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons') - track1, track2 = quest.getChoices(base.localAvatar) + track1, track2 = quest.getChoices() lIconGeom = invModel.find('**/' + AvPropsNew[track1][1]) if not fComplete: diff --git a/toontown/quest/Quests.py b/toontown/quest/Quests.py index 4eac4cd8..75a9809e 100755 --- a/toontown/quest/Quests.py +++ b/toontown/quest/Quests.py @@ -289,6 +289,9 @@ class Quest: elif holderType == 'track': self.check(holder in self._cogTracks, 'invalid recovery item holder: %s for holderType: %s' % (holder, holderType)) + def checkTrackChoice(self, option): + self.check(option >= ToontownBattleGlobals.MIN_TRACK_INDEX and option <= ToontownBattleGlobals.MAX_TRACK_INDEX, 'invalid track option: %s' % option) + def checkNumFriends(self, num): self.check(1, 'invalid number of friends: %s' % num) @@ -1499,24 +1502,11 @@ class RecoverItemQuest(LocationBasedQuest): class TrackChoiceQuest(Quest): def __init__(self, id, quest): Quest.__init__(self, id, quest) + self.checkTrackChoice(self.quest[0]) + self.checkTrackChoice(self.quest[1]) - def getChoices(self, av): - trackAccess = av.getTrackAccess() - first = None - second = None - - for i in xrange(len(trackAccess)): - if trackAccess[i] == 0: - if first is None: - first = i - elif second is None: - second = i - break - - if first is None or second is None: - return (0, 1) - - return (first, second) + def getChoices(self): + return (self.quest[0], self.quest[1]) def getCompletionStatus(self, av, questDesc, npc = None): questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc @@ -1532,7 +1522,7 @@ class TrackChoiceQuest(Quest): return NotChosenString def getObjectiveStrings(self): - trackA, trackB = self.getChoices(base.localAvatar) + trackA, trackB = self.getChoices() trackAName = ToontownBattleGlobals.Tracks[trackA].capitalize() trackBName = ToontownBattleGlobals.Tracks[trackB].capitalize() return [trackAName, trackBName] @@ -1542,7 +1532,7 @@ class TrackChoiceQuest(Quest): 'trackB': self.getObjectiveStrings()[1]} def getSCStrings(self, toNpcId, progress): - trackA, trackB = self.getChoices(base.localAvatar) + trackA, trackB = self.getChoices() trackAName = ToontownBattleGlobals.Tracks[trackA].capitalize() trackBName = ToontownBattleGlobals.Tracks[trackB].capitalize() return [TTLocalizer.QuestsTrackChoiceQuestSCString % {'trackA': trackAName, @@ -1740,7 +1730,7 @@ QuestDict = { 170: (TT_TIER + 1, Cont, (VisitQuest,), Same, 2005, NA, 400, TTLocalizer.QuestDialogDict[170]), 171: (TT_TIER + 1, Cont, (VisitQuest,), Same, 2311, NA, 400, TTLocalizer.QuestDialogDict[171]), 172: (TT_TIER + 1, Cont, (VisitQuest,), Same, 2119, NA, 400, TTLocalizer.QuestDialogDict[172]), - 400: (TT_TIER + 1, Cont, (TrackChoiceQuest,), Same, Same, 400, NA, TTLocalizer.QuestDialogDict[400]), + 400: (TT_TIER + 1, Cont, (TrackChoiceQuest, ToontownBattleGlobals.SOUND_TRACK, ToontownBattleGlobals.HEAL_TRACK), Same, Same, 400, NA, TTLocalizer.QuestDialogDict[400]), 1001: (TT_TIER + 2, Start, (CogQuest, ToontownGlobals.ToontownCentral, 3, Any), Any, ToonHQ, Any, NA, DefaultDialog), 1002: (TT_TIER + 2, Start, (CogQuest, ToontownGlobals.ToontownCentral, 4, Any), Any, ToonHQ, Any, NA, DefaultDialog), 1003: (TT_TIER + 2, Start, (CogQuest, ToontownGlobals.ToontownCentral, 5, Any), Any, ToonHQ, Any, NA, DefaultDialog), @@ -1846,7 +1836,7 @@ QuestDict = { 1210: (TT_TIER + 3, Start, (CogQuest, Anywhere, 4, 'pp'), Any, ToonHQ, Any, NA, DefaultDialog), 1211: (TT_TIER + 3, Start, (CogQuest, Anywhere, 4, 'cc'), Any, ToonHQ, Any, NA, DefaultDialog), 1212: (TT_TIER + 3, Start, (CogQuest, Anywhere, 4, 'tm'), Any, ToonHQ, Any, NA, DefaultDialog), - 401: (DD_TIER, Start, (TrackChoiceQuest,), Any, ToonHQ, 400, NA, TTLocalizer.QuestDialogDict[401]), + 401: (DD_TIER, Start, (TrackChoiceQuest, ToontownBattleGlobals.DROP_TRACK, ToontownBattleGlobals.LURE_TRACK), Any, ToonHQ, 400, NA, TTLocalizer.QuestDialogDict[401]), 2001: (DD_TIER, Start, (CogQuest, Anywhere, 3, Any), Any, ToonHQ, Any, NA, DefaultDialog), 2002: (DD_TIER, Start, (CogQuest, Anywhere, 4, Any), Any, ToonHQ, Any, NA, DefaultDialog), 2003: (DD_TIER, Start, (CogQuest, Anywhere, 5, Any), Any, ToonHQ, Any, NA, DefaultDialog), @@ -2106,7 +2096,8 @@ QuestDict = { 3501: (DG_TIER, Cont, (DeliverItemQuest, 1000), Any, 5007, 1000, NA, DefaultDialog), 3502: (DG_TIER, Start, (RescueQuest, InVP, 1), Any, ToonHQ, Any, NA, DefaultDialog), 3503: (DG_TIER, Start, (RescueQuest, InFO, 2), Any, ToonHQ, Any, NA, DefaultDialog), - 4001: (MM_TIER, Start, (TrackChoiceQuest,), Any, ToonHQ, 400, NA, TTLocalizer.QuestDialogDict[4001]), + 4001: (MM_TIER, Start, (TrackChoiceQuest, ToontownBattleGlobals.TRAP_TRACK, ToontownBattleGlobals.HEAL_TRACK), Any, ToonHQ, 400, NA, TTLocalizer.QuestDialogDict[4001]), + 4002: (MM_TIER, Start, (TrackChoiceQuest, ToontownBattleGlobals.TRAP_TRACK, ToontownBattleGlobals.SOUND_TRACK), Any, ToonHQ, 400, NA, TTLocalizer.QuestDialogDict[4002]), 4010: (MM_TIER, Start, (CogQuest, Anywhere, 16, Any), Any, ToonHQ, Any, NA, DefaultDialog), 4011: (MM_TIER, Start, (CogQuest, Anywhere, 18, Any), Any, ToonHQ, Any, NA, DefaultDialog), 4012: (MM_TIER, Start, (CogQuest, Anywhere, 20, Any), Any, ToonHQ, Any, NA, DefaultDialog), @@ -2280,11 +2271,18 @@ QuestDict = { 5247: (BR_TIER, Start, (VisitQuest,), Any, 3112, NA, 5248, TTLocalizer.QuestDialogDict[5247]), 5248: (BR_TIER, Start, (CogLevelQuest, Anywhere, 10, 8), 3112, Same, NA, 5249, TTLocalizer.QuestDialogDict[5248]), 5249: (BR_TIER, Cont, (RecoverItemQuest, Anywhere, 3, 3018, VeryHard, AnyFish), Same, Same, NA, (5250, 5258, 5259, 5260), TTLocalizer.QuestDialogDict[5249]), - 5250: (BR_TIER, Cont, (BuildingQuest, Anywhere, 2, 'l', 4), Same, Same, NA, 5001, TTLocalizer.QuestDialogDict[5250]), - 5258: (BR_TIER, Cont, (BuildingQuest, Anywhere, 2, 'c', 4), Same, Same, NA, 5001, TTLocalizer.QuestDialogDict[5258]), - 5259: (BR_TIER, Cont, (BuildingQuest, Anywhere, 2, 'm', 4), Same, Same, NA, 5001, TTLocalizer.QuestDialogDict[5259]), - 5260: (BR_TIER, Cont, (BuildingQuest, Anywhere, 2, 's', 4), Same, Same, NA, 5001, TTLocalizer.QuestDialogDict[5260]), - 5001: (BR_TIER, Cont, (TrackChoiceQuest,), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), + 5250: (BR_TIER, Cont, (BuildingQuest, Anywhere, 2, 'l', 4), Same, Same, NA, (5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008), TTLocalizer.QuestDialogDict[5250]), + 5258: (BR_TIER, Cont, (BuildingQuest, Anywhere, 2, 'c', 4), Same, Same, NA, (5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008), TTLocalizer.QuestDialogDict[5258]), + 5259: (BR_TIER, Cont, (BuildingQuest, Anywhere, 2, 'm', 4), Same, Same, NA, (5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008), TTLocalizer.QuestDialogDict[5259]), + 5260: (BR_TIER, Cont, (BuildingQuest, Anywhere, 2, 's', 4), Same, Same, NA, (5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008), TTLocalizer.QuestDialogDict[5260]), + 5001: (BR_TIER, Cont, (TrackChoiceQuest, ToontownBattleGlobals.SOUND_TRACK, ToontownBattleGlobals.DROP_TRACK), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), + 5002: (BR_TIER, Cont, (TrackChoiceQuest, ToontownBattleGlobals.SOUND_TRACK, ToontownBattleGlobals.LURE_TRACK), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), + 5003: (BR_TIER, Cont, (TrackChoiceQuest, ToontownBattleGlobals.HEAL_TRACK, ToontownBattleGlobals.DROP_TRACK), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), + 5004: (BR_TIER, Cont, (TrackChoiceQuest, ToontownBattleGlobals.HEAL_TRACK, ToontownBattleGlobals.LURE_TRACK), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), + 5005: (BR_TIER, Cont, (TrackChoiceQuest, ToontownBattleGlobals.TRAP_TRACK, ToontownBattleGlobals.SOUND_TRACK), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), + 5006: (BR_TIER, Cont, (TrackChoiceQuest, ToontownBattleGlobals.TRAP_TRACK, ToontownBattleGlobals.HEAL_TRACK), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), + 5007: (BR_TIER, Cont, (TrackChoiceQuest, ToontownBattleGlobals.TRAP_TRACK, ToontownBattleGlobals.DROP_TRACK), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), + 5008: (BR_TIER, Cont, (TrackChoiceQuest, ToontownBattleGlobals.TRAP_TRACK, ToontownBattleGlobals.LURE_TRACK), Same, Same, 400, NA, TTLocalizer.TheBrrrghTrackQuestDict), 5020: (BR_TIER, Start, (CogQuest, Anywhere, 36, Any), Any, ToonHQ, Any, NA, DefaultDialog), 5021: (BR_TIER, Start, (CogQuest, Anywhere, 38, Any), Any, ToonHQ, Any, NA, DefaultDialog), 5022: (BR_TIER, Start, (CogQuest, Anywhere, 40, Any), Any, ToonHQ, Any, NA, DefaultDialog), @@ -3318,19 +3316,62 @@ def filterQuests(entireQuestPool, currentNpc, av): def chooseTrackChoiceQuest(tier, av, fixed = 0): + + def fixAndCallAgain(): + if not fixed and av.fixTrackAccess(): + notify.info('av %s trackAccess fixed: %s' % (av.getDoId(), trackAccess)) + return chooseTrackChoiceQuest(tier, av, fixed=1) + else: + return None + return None + + bestQuest = None + trackAccess = av.getTrackAccess() if tier == MM_TIER: - return 4001 + if trackAccess[ToontownBattleGlobals.HEAL_TRACK] == 1: + bestQuest = 4002 + elif trackAccess[ToontownBattleGlobals.SOUND_TRACK] == 1: + bestQuest = 4001 + else: + notify.warning('av %s has bogus trackAccess: %s' % (av.getDoId(), trackAccess)) + return fixAndCallAgain() elif tier == BR_TIER: - return 5247 + if trackAccess[ToontownBattleGlobals.SOUND_TRACK] + trackAccess[ToontownBattleGlobals.DROP_TRACK] == 0: + bestQuest = 5001 + elif trackAccess[ToontownBattleGlobals.SOUND_TRACK] + trackAccess[ToontownBattleGlobals.LURE_TRACK] == 0: + bestQuest = 5002 + elif trackAccess[ToontownBattleGlobals.HEAL_TRACK] + trackAccess[ToontownBattleGlobals.DROP_TRACK] == 0: + bestQuest = 5003 + elif trackAccess[ToontownBattleGlobals.HEAL_TRACK] + trackAccess[ToontownBattleGlobals.LURE_TRACK] == 0: + bestQuest = 5004 + elif trackAccess[ToontownBattleGlobals.TRAP_TRACK] + trackAccess[ToontownBattleGlobals.SOUND_TRACK] == 0: + bestQuest = 5005 + elif trackAccess[ToontownBattleGlobals.TRAP_TRACK] + trackAccess[ToontownBattleGlobals.HEAL_TRACK] == 0: + bestQuest = 5006 + elif trackAccess[ToontownBattleGlobals.TRAP_TRACK] + trackAccess[ToontownBattleGlobals.DROP_TRACK] == 0: + bestQuest = 5007 + elif trackAccess[ToontownBattleGlobals.TRAP_TRACK] + trackAccess[ToontownBattleGlobals.LURE_TRACK] == 0: + bestQuest = 5008 + else: + notify.warning('av %s has bogus trackAccess: %s' % (av.getDoId(), trackAccess)) + return fixAndCallAgain() else: - return seededRandomChoice(Tier2Reward2QuestsDict[tier][400]) + if notify.getDebug(): + notify.debug('questPool for reward 400 had no dynamic choice, tier: %s' % tier) + bestQuest = seededRandomChoice(Tier2Reward2QuestsDict[tier][400]) + if notify.getDebug(): + notify.debug('chooseTrackChoiceQuest: avId: %s trackAccess: %s tier: %s bestQuest: %s' % (av.getDoId(), + trackAccess, + tier, + bestQuest)) + return bestQuest def chooseMatchingQuest(tier, validQuestPool, rewardId, npc, av): questsMatchingReward = Tier2Reward2QuestsDict[tier].get(rewardId, []) if notify.getDebug(): notify.debug('questsMatchingReward: %s tier: %s = %s' % (rewardId, tier, questsMatchingReward)) - if rewardId == 400: + if rewardId == 400 and QuestDict[questsMatchingReward[0]][QuestDictNextQuestIndex] == NA: bestQuest = chooseTrackChoiceQuest(tier, av) if notify.getDebug(): notify.debug('single part track choice quest: %s tier: %s avId: %s trackAccess: %s bestQuest: %s' % (rewardId, diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 8e238681..d7a6c496 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -552,11 +552,11 @@ INCOMPLETE_WRONG_NPC = 4 COMPLETE = 5 LEAVING = 6 TheBrrrghTrackQuestDict = {GREETING: '', - QUEST: 'Now you are ready.\x07Go out and walk the earth until you know which track you would like to choose.\x07When you are certain, return to me.', + QUEST: 'Now you are ready.\x07Go out and walk the earth until you know which track you would like to choose.\x07Choose wisely, because this is your final track.\x07When you are certain, return to me.', INCOMPLETE_PROGRESS: 'Choose wisely.', INCOMPLETE_WRONG_NPC: 'Choose wisely.', - COMPLETE: 'Very wise choice!\x07Good luck. Return to me when you have mastered your new skill.', - LEAVING: ''} + COMPLETE: 'Very wise choice!', + LEAVING: 'Good luck. Return to me when you have mastered your new skill.'} QuestDialog_3225 = {QUEST: "Oh, thanks for coming, _avName_!\x07The Cogs in the neighborhood frightened away my delivery person.\x07I don't have anyone to deliver this salad to _toNpcName_!\x07Can you do it for me? Thanks so much!_where_"} QuestDialog_2910 = {QUEST: 'Back so soon?\x07Great job on the spring.\x07The final item is a counter weight.\x07Stop by and see _toNpcName_ and bring back whatever you can get._where_'} QuestDialogDict = { @@ -606,7 +606,7 @@ QuestDialogDict = { COMPLETE: 'Hope you have fun ordering things from Clarabelle!\x07I just finished redecorating my house. It looks Toontastic!\x07Keep doing ToonTasks to get more rewards!', LEAVING: QuestsDefaultLeaving}, 400: {GREETING: '', - QUEST: 'You will need more gags to fight higher level Cogs.\x07When you team up with other Toons against the Cogs, you can combine attacks for even more damage.\x07Try different combinations of gags to see what works best.\x07When you are ready to decide, come back here and choose.', + QUEST: 'Throw and Squirt are great, but you will need more gags to fight higher level Cogs.\x07When you team up with other Toons against the Cogs, you can combine attacks for even more damage.\x07Try different combinations of gags to see what works best.\x07For your next track, choose between Sound and Toonup.\x07Sound is special because when it hits, it damages all Cogs.\x07Toonup lets you heal other Toons in battle.\x07When you are ready to decide, come back here and choose.', INCOMPLETE_PROGRESS: 'Back so soon? Okay, are you ready to choose?', INCOMPLETE_WRONG_NPC: 'Think about your decision before choosing.', COMPLETE: 'Good decision. Now before you can use those gags, you must train for them.\x07You must complete a series of ToonTasks for training.\x07Each task will give you a single frame of your gag attack animation.\x07When you collect all 15, you can get the Final Gag Training task that will allow you to use your new gags.\x07You can check your progress in the Shticker Book.',