def enterMapPage(self): if base.localAvatar.getAdminToken() > -1: self.createPageButtons('inventoryPage', 'adminPage') else: self.createPageButtons('inventoryPage', None) self.setTitle("") themap = loader.loadModel('phase_3.5/models/gui/toontown_map.bam') self.frame = DirectFrame(parent=aspect2d, relief=None, image=themap, image_scale=(1.8, 1, 1.35), scale=0.97, pos=(0, 0, 0.0775)) cloudpos = [[(-0.61, 0, 0.18), (0.55, 0.25, 0.37), (180, 0, 0)], [(-0.54, 0, 0.34), (0.76, 0.4, 0.55), (180, 0, 0)], [(-0.55, 0, -0.09), (0.72, 0.4, 0.55), (0, 0, 0)], [(-0.67, 0, -0.51), (0.5, 0.29, 0.38), (180, 0, 0)], [(-0.67, 0, 0.51), (0.50, 0.29, 0.38), (0, 0, 0)], [(0.67, 0, 0.51), (0.5, 0.29, 0.38), (0, 0, 0)], [(0.35, 0, -0.46), (0.63, 0.35, 0.45), (0, 0, 0)], [(0.18, 0, -0.45), (0.52, 0.27, 0.32), (0, 0, 0)], [(0.67, 0, -0.44), (0.63, 0.35, 0.48), (180, 0, 0)]] hoodclouds = [ #[(0.02, 0, -0.17), (0.63, 0.35, 0.48), (180, 0, 0), CIGlobals.ToontownCentral], [(0.63, 0, -0.13), (0.63, 0.35, 0.40), (0, 0, 0), CIGlobals.DonaldsDock], [(0.51, 0, 0.25), (0.57, 0.35, 0.40), (0, 0, 0), CIGlobals.TheBrrrgh], [(0.03, 0, 0.19), (0.63, 0.35, 0.40), (180, 0, 0), CIGlobals.MinniesMelodyland], [(-0.08, 0, 0.46), (0.54, 0.35, 0.40), (0, 0, 0), CIGlobals.DonaldsDreamland], [(-0.28, 0, -0.49), (0.60, 0.35, 0.45), (0, 0, 0), CIGlobals.DaisyGardens] ] self.clouds = [] self.labels = [] for pos, scale, hpr in cloudpos: cloud = loader.loadModel('phase_3.5/models/gui/cloud.bam') cloud.reparentTo(self.frame) cloud.setPos(pos) cloud.setScale(scale) cloud.setHpr(hpr) self.clouds.append(cloud) for pos, scale, hpr, hood in hoodclouds: if not base.localAvatar.hasDiscoveredHood( ZoneUtil.getZoneId(hood)): cloud = loader.loadModel('phase_3.5/models/gui/cloud.bam') cloud.reparentTo(self.frame) cloud.setPos(pos) cloud.setScale(scale) cloud.setHpr(hpr) self.clouds.append(cloud) labeldata = [[(0, 0, -0.2), CIGlobals.ToontownCentral], [(0.65, 0, -0.125), CIGlobals.DonaldsDock], [(0.07, 0, 0.18), CIGlobals.MinniesMelodyland], [(-0.1, 0, 0.45), CIGlobals.DonaldsDreamland], [(0.5, 0, 0.25), CIGlobals.TheBrrrgh], [(-0.37, 0, -0.525), CIGlobals.DaisyGardens]] for pos, name in labeldata: if base.localAvatar.hasDiscoveredHood(ZoneUtil.getZoneId(name)): text = name if base.localAvatar.hasTeleportAccess( ZoneUtil.getZoneId(name)): text = 'Go To\n' + text label = DirectButton(parent=self.frame, relief=None, pos=pos, pad=(0.2, 0.16), text=('', text, text, ''), text_bg=Vec4(1, 1, 1, 0.4), text_scale=0.055, text_wordwrap=8, rolloverSound=None, clickSound=None, pressEffect=0, sortOrder=1, text_font=CIGlobals.getToonFont()) if base.localAvatar.hasTeleportAccess( ZoneUtil.getZoneId(name)): label['command'] = self.finished label['extraArgs'] = [ZoneUtil.getZoneId(name)] label.resetFrameSize() self.labels.append(label) currHoodName = base.cr.playGame.hood.id currLocation = '' if base.localAvatar.zoneId == CIGlobals.MinigameAreaId or base.localAvatar.getMyBattle( ) is not None: currLocation = '' elif ZoneUtil.getWhereName(base.localAvatar.zoneId) == 'playground': currLocation = 'Playground' elif ZoneUtil.getWhereName( base.localAvatar.zoneId) in ['street', 'interior']: currLocation = CIGlobals.BranchZone2StreetName[ ZoneUtil.getBranchZone(base.localAvatar.zoneId)] self.infoLabel = DirectLabel(relief=None, text='You are in: {0}\n{1}'.format( currHoodName, currLocation), scale=0.06, pos=(-0.4, 0, -0.74), parent=self.frame, text_align=TextNode.ACenter) if currHoodName in [CIGlobals.MinigameArea, CIGlobals.BattleTTC]: currHoodName = base.cr.playGame.lastHood btpText = "Back to Playground" btpEA = [ZoneUtil.getZoneId(currHoodName)] self.BTPButton = DirectButton(relief=None, text=btpText, geom=CIGlobals.getDefaultBtnGeom(), text_pos=(0, -0.018), geom_scale=(1.3, 1.11, 1.11), text_scale=0.06, parent=self.frame, text_font=CIGlobals.getToonFont(), pos=(0.25, 0, -0.75), command=self.finished, extraArgs=btpEA, scale=0.7) if base.localAvatar.zoneId != CIGlobals.MinigameAreaId: self.MGAButton = DirectButton(relief=None, text="Minigame Area", geom=CIGlobals.getDefaultBtnGeom(), text_pos=(0, -0.018), geom_scale=(1, 1.11, 1.11), text_scale=0.06, parent=self.frame, text_font=CIGlobals.getToonFont(), pos=(0.625, 0, -0.75), command=self.finished, extraArgs=[CIGlobals.MinigameAreaId], scale=0.7)
def makeQuestNotes(self, quests = None): notes = [] if not quests: quests = self.quests.values() for quest in quests: objective = quest.currentObjective note = QuestNote.QuestNote(quest.index) isDefeatObjective = objective.type in (Quests.DefeatCog, Quests.DefeatCogDept, Quests.DefeatCogInvasion, Quests.DefeatCogTournament, Quests.DefeatCogLevel) heading = None if isDefeatObjective: heading = Quests.DefeatText elif objective.type in [Quests.VisitNPC, Quests.VisitHQOfficer]: heading = Quests.VisitText note.setHeading(heading) taskInfo = None if isDefeatObjective: if objective.goal > 1: taskInfo = "%d " % objective.goal else: taskInfo = "a " if objective.type == Quests.DefeatCog: if objective.subject == Quests.Any: taskInfo += CIGlobals.Suits else: if objective.goal > 1: taskInfo += QuestGlobals.makePlural(CIGlobals.SuitNames[objective.subject]) else: taskInfo += CIGlobals.SuitNames[objective.subject] elif objective.type in (Quests.DefeatCogInvasion, Quests.DefeatCogTournament, Quests.DefeatCogDept): if objective.goal > 1: if objective.type == Quests.DefeatCogDept: taskInfo += QuestGlobals.AbbrToDept[objective.subject] elif objective.type == Quests.DefeatCogInvasion: taskInfo += QuestGlobals.QuestSubjects[1] elif objective.type == Quests.DefeatCogTournament: taskInfo += QuestGlobals.QuestSubjects[6] else: if objective.type == Quests.DefeatCogDept: taskInfo += QuestGlobals.makeSingular(QuestGlobals.AbbrToDept[objective.subject]) elif objective.type == Quests.DefeatCogInvasion: taskInfo += QuestGlobals.makeSingular(QuestGlobals.QuestSubjects[1]) elif objective.type == Quests.DefeatCogTournament: taskInfo += QuestGlobals.makeSingular(QuestGlobals.QuestSubjects[6]) elif objective.type == Quests.DefeatCogLevel: if objective.goal > 1: taskInfo += "Level %d+ %s" % (objective.minCogLevel, CIGlobals.Suits) else: taskInfo += "Level %d+ %s" % (objective.minCogLevel, CIGlobals.Suit) if objective.area == Quests.Any: taskInfo += "\nAnywhere" else: taskInfo += "\nin " + ZoneUtil.getHoodId(objective.area) elif objective.type == Quests.VisitNPC: nameOfNPC = CIGlobals.NPCToonNames[objective.npcId] placeOfNPC = CIGlobals.zone2TitleDict[objective.npcZone][0] taskInfo = nameOfNPC + "\nat " + placeOfNPC elif objective.type == Quests.VisitHQOfficer: taskInfo = "an HQ Officer\nat a Toon HQ" note.setTaskInfo(taskInfo) progress = "" if isDefeatObjective: if not objective.isComplete(): if isDefeatObjective: progress = "%d of %d " % (objective.progress, objective.goal) + QuestGlobals.makePastTense(Quests.DefeatText) note.setProgress(progress) else: note.setCompleted(1) elif objective.type == Quests.VisitNPC: streetZone = ZoneUtil.getBranchZone(objective.npcZone) if streetZone % 1000 >= 100: streetName = CIGlobals.BranchZone2StreetName[streetZone] else: streetName = "the Playground" hoodName = ZoneUtil.getHoodId(streetZone, 1) progress = "on %s\nin %s" % (streetName, hoodName) note.setProgress(progress) elif objective.type == Quests.VisitHQOfficer: progress = "Any Street\nAny Playground" note.setProgress(progress) reward = "" if quest.rewardType == Quests.RewardJellybeans: reward = "For %d jellybeans" elif quest.rewardType == Quests.RewardHealth: reward = "For a %d point Laff boost" elif quest.rewardType == Quests.RewardAccess: reward = "For access to %s" elif quest.rewardType == Quests.RewardNone: reward = "For no reward" if '%s' in reward or '%d' in reward: note.setReward(reward % quest.rewardValue) else: note.setReward(reward) notes.append(note) return notes
def makeQuestNotes(self, quests = None): notes = [] if not quests: quests = self.quests.values() for quest in quests: objective = quest.currentObjective note = QuestNote.QuestNote(quest.index) isDefeatObjective = objective.type in (Quests.DefeatCog, Quests.DefeatCogDept, Quests.DefeatCogInvasion, Quests.DefeatCogTournament, Quests.DefeatCogLevel) heading = None if isDefeatObjective: heading = Quests.DefeatText elif objective.type in [Quests.VisitNPC, Quests.VisitHQOfficer]: heading = Quests.VisitText note.setHeading(heading) taskInfo = None if isDefeatObjective: if objective.goal > 1: taskInfo = '%d ' % objective.goal else: taskInfo = 'a ' if objective.type == Quests.DefeatCog: if objective.subject == Quests.Any: taskInfo += CIGlobals.Suits elif objective.goal > 1: taskInfo += QuestGlobals.makePlural(CIGlobals.SuitNames[objective.subject]) else: taskInfo += CIGlobals.SuitNames[objective.subject] elif objective.type in (Quests.DefeatCogInvasion, Quests.DefeatCogTournament, Quests.DefeatCogDept): if objective.goal > 1: if objective.type == Quests.DefeatCogDept: taskInfo += QuestGlobals.AbbrToDept[objective.subject] else: taskInfo += QuestGlobals.makePlural(objective.subject) elif objective.type == Quests.DefeatCogDept: taskInfo += QuestGlobals.makeSingular(QuestGlobals.AbbrToDept[objective.subject]) else: taskInfo += objective.subject elif objective.type == Quests.DefeatCogLevel: if objective.goal > 1: taskInfo += 'Level %d+ %s' % (objective.minCogLevel, CIGlobals.Suits) else: taskInfo += 'Level %d+ %s' % (objective.minCogLevel, CIGlobals.Suit) if objective.area == Quests.Any: taskInfo += '\nAnywhere' else: taskInfo += '\nin ' + ZoneUtil.getHoodId(objective.area) elif objective.type == Quests.VisitNPC: nameOfNPC = CIGlobals.NPCToonNames[objective.npcId] placeOfNPC = CIGlobals.zone2TitleDict[objective.npcZone][0] taskInfo = nameOfNPC + '\nat ' + placeOfNPC elif objective.type == Quests.VisitHQOfficer: taskInfo = 'an HQ Officer\nat a Toon HQ' note.setTaskInfo(taskInfo) progress = '' if isDefeatObjective: if not objective.isComplete(): if isDefeatObjective: progress = '%d of %d ' % (objective.progress, objective.goal) + QuestGlobals.makePastTense(Quests.DefeatText) note.setProgress(progress) else: note.setCompleted(1) elif objective.type == Quests.VisitNPC: streetZone = ZoneUtil.getBranchZone(objective.npcZone) if streetZone % 1000 >= 100: streetName = CIGlobals.BranchZone2StreetName[streetZone] else: streetName = 'the Playground' hoodName = ZoneUtil.getHoodId(streetZone, 1) progress = 'on %s\nin %s' % (streetName, hoodName) note.setProgress(progress) elif objective.type == Quests.VisitHQOfficer: progress = 'Any Street\nAny Playground' note.setProgress(progress) reward = '' if quest.rewardType == Quests.RewardJellybeans: reward = 'For %d jellybeans' elif quest.rewardType == Quests.RewardHealth: reward = 'For a %d point Laff boost' elif quest.rewardType == Quests.RewardAccess: reward = 'For access to %s' elif quest.rewardType == Quests.RewardNone: reward = 'For no reward' if '%s' in reward or '%d' in reward: note.setReward(reward % quest.rewardValue) else: note.setReward(reward) notes.append(note) return notes
def enterMapPage(self): self.createPageButtons('inventoryPage', 'releaseNotesPage') self.setTitle('') themap = loader.loadModel('phase_3.5/models/gui/toontown_map.bam') self.frame = DirectFrame(parent=aspect2d, relief=None, image=themap, image_scale=(1.8, 1, 1.35), scale=0.97, pos=(0, 0, 0.0775)) cloudpos = [[(-0.61, 0, 0.18), (0.55, 0.25, 0.37), (180, 0, 0)], [(-0.54, 0, 0.34), (0.76, 0.4, 0.55), (180, 0, 0)], [(-0.55, 0, -0.09), (0.72, 0.4, 0.55), (0, 0, 0)], [(-0.67, 0, -0.51), (0.5, 0.29, 0.38), (180, 0, 0)], [(-0.67, 0, 0.51), (0.5, 0.29, 0.38), (0, 0, 0)], [(0.67, 0, 0.51), (0.5, 0.29, 0.38), (0, 0, 0)], [(0.35, 0, -0.46), (0.63, 0.35, 0.45), (0, 0, 0)], [(0.18, 0, -0.45), (0.52, 0.27, 0.32), (0, 0, 0)], [(0.67, 0, -0.44), (0.63, 0.35, 0.48), (180, 0, 0)]] hoodclouds = [[(0.63, 0, -0.13), (0.63, 0.35, 0.4), (0, 0, 0), CIGlobals.DonaldsDock], [(0.51, 0, 0.25), (0.57, 0.35, 0.4), (0, 0, 0), CIGlobals.TheBrrrgh], [(0.03, 0, 0.19), (0.63, 0.35, 0.4), (180, 0, 0), CIGlobals.MinniesMelodyland], [(-0.08, 0, 0.46), (0.54, 0.35, 0.4), (0, 0, 0), CIGlobals.DonaldsDreamland], [(-0.28, 0, -0.49), (0.6, 0.35, 0.45), (0, 0, 0), CIGlobals.DaisyGardens]] self.clouds = [] self.labels = [] for pos, scale, hpr in cloudpos: cloud = loader.loadModel('phase_3.5/models/gui/cloud.bam') cloud.reparentTo(self.frame) cloud.setPos(pos) cloud.setScale(scale) cloud.setHpr(hpr) self.clouds.append(cloud) for pos, scale, hpr, hood in hoodclouds: if not base.localAvatar.hasDiscoveredHood(ZoneUtil.getZoneId(hood)): cloud = loader.loadModel('phase_3.5/models/gui/cloud.bam') cloud.reparentTo(self.frame) cloud.setPos(pos) cloud.setScale(scale) cloud.setHpr(hpr) self.clouds.append(cloud) labeldata = [[(0, 0, -0.2), CIGlobals.ToontownCentral], [(0.65, 0, -0.125), CIGlobals.DonaldsDock], [(0.07, 0, 0.18), CIGlobals.MinniesMelodyland], [(-0.1, 0, 0.45), CIGlobals.DonaldsDreamland], [(0.5, 0, 0.25), CIGlobals.TheBrrrgh], [(-0.37, 0, -0.525), CIGlobals.DaisyGardens]] for pos, name in labeldata: if base.localAvatar.hasDiscoveredHood(ZoneUtil.getZoneId(name)): text = name if base.localAvatar.hasTeleportAccess(ZoneUtil.getZoneId(name)): text = 'Go To\n' + text label = DirectButton(parent=self.frame, relief=None, pos=pos, pad=(0.2, 0.16), text=('', text, text), text_bg=Vec4(1, 1, 1, 0.4), text_scale=0.055, text_wordwrap=8, rolloverSound=None, clickSound=None, pressEffect=0, sortOrder=1, text_font=CIGlobals.getToonFont()) if base.localAvatar.hasTeleportAccess(ZoneUtil.getZoneId(name)): label['command'] = self.finished label['extraArgs'] = [ZoneUtil.getZoneId(name)] label.resetFrameSize() self.labels.append(label) currHoodName = base.cr.playGame.hood.id currLocation = '' if base.localAvatar.zoneId == CIGlobals.MinigameAreaId: currLocation = '' elif base.localAvatar.getMyBattle() != None: currLocation = 'CogTropolis' elif ZoneUtil.getWhereName(base.localAvatar.zoneId) == 'playground': currLocation = 'Playground' elif ZoneUtil.getWhereName(base.localAvatar.zoneId) in ('street', 'interior'): currLocation = CIGlobals.BranchZone2StreetName[ZoneUtil.getBranchZone(base.localAvatar.zoneId)] self.infoLabel = DirectLabel(relief=None, text='You are in: {0}\n{1}'.format(currHoodName, currLocation), scale=0.06, pos=(-0.4, 0, -0.74), parent=self.frame, text_align=TextNode.ACenter) if currHoodName in [CIGlobals.MinigameArea, CIGlobals.BattleTTC]: currHoodName = base.cr.playGame.lastHood self.BTPButton = DirectButton(relief=None, text='Back to Playground', geom=CIGlobals.getDefaultBtnGeom(), text_pos=(0, -0.018), geom_scale=(1.3, 1.11, 1.11), text_scale=0.06, parent=self.frame, text_font=CIGlobals.getToonFont(), pos=(0.25, 0, -0.75), command=self.finished, extraArgs=[ZoneUtil.getZoneId(currHoodName)], scale=0.7) if base.localAvatar.zoneId != CIGlobals.MinigameAreaId: self.MGAButton = DirectButton(relief=None, text='Minigame Area', geom=CIGlobals.getDefaultBtnGeom(), text_pos=(0, -0.018), geom_scale=(1, 1.11, 1.11), text_scale=0.06, parent=self.frame, text_font=CIGlobals.getToonFont(), pos=(0.625, 0, -0.75), command=self.finished, extraArgs=[CIGlobals.MinigameAreaId], scale=0.7) return