Fix track choice tasks (TODO: Lil Oldman)

This commit is contained in:
Daniel 2015-03-23 10:14:45 +02:00
parent 51fae5711d
commit e588890876
4 changed files with 43 additions and 80 deletions

View file

@ -80,7 +80,7 @@ class QuestManagerAI:
# If it's a TrackChoiceQuest then present their track choices.
if isinstance(questClass, Quests.TrackChoiceQuest):
npc.presentTrackChoice(avId, questId, questClass.getChoices())
npc.presentTrackChoice(avId, questId, questClass.getChoices(av))
break
# If there is another part to this quest then give them that.
if Quests.getNextQuest(questId, npc, av)[0] != Quests.NA:

View file

@ -435,12 +435,18 @@ class QuestPoster(DirectFrame):
self.teleportButton.hide()
frameBgColor = 'green'
invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons')
track1, track2 = quest.getChoices()
lIconGeom = invModel.find('**/' + AvPropsNew[track1][1])
track1, track2 = quest.getChoices(base.localAvatar)
if track1 is not None:
lIconGeom = invModel.find('**/' + AvPropsNew[track1][1])
if not fComplete:
auxText = TTLocalizer.QuestPosterAuxOr
lPos.setX(-0.18)
rIconGeom = invModel.find('**/' + AvPropsNew[track2][1])
if track2 is not None:
rIconGeom = invModel.find('**/' + AvPropsNew[track2][1])
infoText = TTLocalizer.QuestPageNameAndDestination % (toNpcName,
toNpcBuildingName,
toNpcStreetName,

View file

@ -288,9 +288,6 @@ 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)
@ -1724,11 +1721,21 @@ 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):
return (self.quest[0], 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
return (first, second)
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
@ -1744,7 +1751,7 @@ class TrackChoiceQuest(Quest):
return NotChosenString
def getObjectiveStrings(self):
trackA, trackB = self.getChoices()
trackA, trackB = self.getChoices(base.localAvatar)
trackAName = ToontownBattleGlobals.Tracks[trackA].capitalize()
trackBName = ToontownBattleGlobals.Tracks[trackB].capitalize()
return [trackAName, trackBName]
@ -1754,7 +1761,7 @@ class TrackChoiceQuest(Quest):
'trackB': self.getObjectiveStrings()[1]}
def getSCStrings(self, toNpcId, progress):
trackA, trackB = self.getChoices()
trackA, trackB = self.getChoices(base.localAvatar)
trackAName = ToontownBattleGlobals.Tracks[trackA].capitalize()
trackBName = ToontownBattleGlobals.Tracks[trackB].capitalize()
return [TTLocalizer.QuestsTrackChoiceQuestSCString % {'trackA': trackAName,
@ -2054,7 +2061,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, ToontownBattleGlobals.SOUND_TRACK, ToontownBattleGlobals.HEAL_TRACK), Same, Same, 400, NA, TTLocalizer.QuestDialogDict[400]),
400: (TT_TIER + 1, Cont, (TrackChoiceQuest,), 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),
@ -2160,7 +2167,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, ToontownBattleGlobals.DROP_TRACK, ToontownBattleGlobals.LURE_TRACK), Any, ToonHQ, 400, NA, TTLocalizer.QuestDialogDict[401]),
401: (DD_TIER, Start, (TrackChoiceQuest,), 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),
@ -2418,8 +2425,7 @@ QuestDict = {
3263: (DG_TIER, Start, (CogQuest, ToontownGlobals.SellbotHQ, 20, Any), 5313, 5313, 702, NA, TTLocalizer.QuestDialogDict[3263]),
3500: (DG_TIER, Start, (CogQuest, ToontownGlobals.DaisyGardens, 25, Any), Any, ToonHQ, NA, 3501, DefaultDialog),
3501: (DG_TIER, Cont, (DeliverItemQuest, 1000), Any, 5007, 1000, NA, DefaultDialog),
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]),
4001: (MM_TIER, Start, (TrackChoiceQuest,), Any, ToonHQ, 400, NA, TTLocalizer.QuestDialogDict[4001]),
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),
@ -2581,18 +2587,11 @@ 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, 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),
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),
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),
@ -3588,62 +3587,19 @@ 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:
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()
return 4001
elif tier == BR_TIER:
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()
return 5247
else:
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
return seededRandomChoice(Tier2Reward2QuestsDict[tier][400])
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 and QuestDict[questsMatchingReward[0]][QuestDictNextQuestIndex] == NA:
if rewardId == 400:
bestQuest = chooseTrackChoiceQuest(tier, av)
if notify.getDebug():
notify.debug('single part track choice quest: %s tier: %s avId: %s trackAccess: %s bestQuest: %s' % (rewardId,

View file

@ -578,11 +578,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.\x07Choose wisely, because this is your final track.\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.\x07When you are certain, return to me.',
INCOMPLETE_PROGRESS: 'Choose wisely.',
INCOMPLETE_WRONG_NPC: 'Choose wisely.',
COMPLETE: 'Very wise choice!',
LEAVING: 'Good luck. Return to me when you have mastered your new skill.'}
COMPLETE: 'Very wise choice!\x07Good luck. Return to me when you have mastered your new skill.',
LEAVING: ''}
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 = {160: {GREETING: '',
@ -624,7 +624,7 @@ QuestDialogDict = {160: {GREETING: '',
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: '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.',
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.',
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.',
@ -9747,6 +9747,7 @@ LanguageSelectorConfirm = 'Are you sure you want to change your language to %s?
LanguageSelectorSameLanguage = "You're already using that language!"
PickTrackTitle = 'Pick your third track!'
PickTrackNotice = 'Choose a track!'
UnknownTrack = 'None'
# Buffs