From 065f9125fdbdb61b028d83aa3edb09625761b656 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 27 May 2015 18:46:19 +0300 Subject: [PATCH] Fix cogdo tasks and add textures for it --- toontown/ai/QuestManagerAI.py | 13 +++++------- toontown/building/DistributedBuildingAI.py | 2 +- toontown/quest/QuestPoster.py | 22 ++++++++++---------- toontown/quest/Quests.py | 24 +++++++++++++++++++--- 4 files changed, 38 insertions(+), 23 deletions(-) diff --git a/toontown/ai/QuestManagerAI.py b/toontown/ai/QuestManagerAI.py index eb873672..35236261 100755 --- a/toontown/ai/QuestManagerAI.py +++ b/toontown/ai/QuestManagerAI.py @@ -428,14 +428,11 @@ class QuestManagerAI: for i in xrange(0, len(avQuests), 5): questDesc = avQuests[i : i + 5] questClass = Quests.getQuest(questDesc[QuestIdIndex]) - if questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE: - if isinstance(questClass, Quests.BuildingQuest): - if questClass.isLocationMatch(zoneId): - if questClass.doesBuildingTypeCount(type): - if questClass.isCogdo() == cogdo: - if questClass.doesBuildingCount(av, activeToons): - if floors >= questClass.getNumFloors(): - questDesc[QuestProgressIndex] += 1 + if isinstance(questClass, Quests.BuildingQuest) and questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE: + if questClass.isLocationMatch(zoneId) and questClass.doesBuildingTypeCount(type): + if questClass.isCogdo() == cogdo and questClass.doesBuildingCount(av, activeToons): + if floors >= questClass.getNumFloors(): + questDesc[QuestProgressIndex] += 1 questList.append(questDesc) av.b_setQuests(questList) diff --git a/toontown/building/DistributedBuildingAI.py b/toontown/building/DistributedBuildingAI.py index 46790a7e..53924785 100755 --- a/toontown/building/DistributedBuildingAI.py +++ b/toontown/building/DistributedBuildingAI.py @@ -330,7 +330,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): self.air.writeServerEvent('buildingDefeated', t, '%s|%s|%s|%s' % (self.track, self.numFloors, self.zoneId, victorList)) if toon != None: - self.air.questManager.toonKilledBuilding(toon, self.track, self.difficulty, self.numFloors, self.zoneId, activeToons, 1) + self.air.questManager.toonKilledBuilding(toon, self.track, self.difficulty, 5, self.zoneId, activeToons, 1) continue victorList.extend([None, None, None, None]) diff --git a/toontown/quest/QuestPoster.py b/toontown/quest/QuestPoster.py index 07f2c23a..d0b53aec 100755 --- a/toontown/quest/QuestPoster.py +++ b/toontown/quest/QuestPoster.py @@ -349,7 +349,17 @@ class QuestPoster(DirectFrame): objectiveStrings = quest.getObjectiveStrings() captions = map(string.capwords, quest.getObjectiveStrings()) imageColor = Vec4(*self.colors['white']) - if quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest: + if isinstance(quest, Quests.TexturedQuest) and quest.hasFrame(): + self.teleportButton.hide() + frame = quest.getFrame() + frameBgColor = frame[1] + lIconGeom = frame[0] + lIconGeomScale = 0.13 + if not fComplete: + infoText = quest.getLocationName() + if infoText == '': + infoText = TTLocalizer.QuestPosterAnywhere + elif quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest: frameBgColor = 'red' if fComplete: self.teleportButton.show() @@ -659,16 +669,6 @@ class QuestPoster(DirectFrame): rIconGeom = None lIconGeomScale = rIconGeomScale rIconGeomScale = 1 - elif isinstance(quest, Quests.TexturedQuest): - self.teleportButton.hide() - frame = quest.getFrame() - frameBgColor = frame[1] - lIconGeom = frame[0] - lIconGeomScale = 0.13 - if not fComplete: - infoText = quest.getLocationName() - if infoText == '': - infoText = TTLocalizer.QuestPosterAnywhere elif quest.getType() == Quests.RescueQuest: self.teleportButton.hide() frameBgColor = 'blue' diff --git a/toontown/quest/Quests.py b/toontown/quest/Quests.py index 4650436d..8e085e8a 100755 --- a/toontown/quest/Quests.py +++ b/toontown/quest/Quests.py @@ -836,6 +836,9 @@ class TexturedQuest: node.setTexture(loader.loadTexture(texture)) return node + def hasFrame(self): + return True + def getFrame(self): print 'getFrame from TexturedQuest not implemented!' return [None, None] @@ -953,7 +956,13 @@ class RescueNewbieQuest(RescueQuest, NewbieQuest): else: return 0 -class BuildingQuest(CogQuest): +BUILDING_NAMES = { + Any: ['phase_3.5/maps/cogdo_icon.jpg', 'brown'], + 'l': ['phase_3.5/maps/lawbot_cogdo_icon.jpg', 'blue'], + 's': ['phase_3.5/maps/sellbot_cogdo_icon.jpg', 'red'] +} + +class BuildingQuest(CogQuest, TexturedQuest): trackCodes = ['c', 'l', 'm', @@ -970,6 +979,15 @@ class BuildingQuest(CogQuest): self.checkBuildingFloors(self.quest[3]) self.checkBuildingType(self.quest[4]) + def hasFrame(self): + return self.isCogdo() + + def getFrame(self): + print self.quest[2] + building = BUILDING_NAMES[self.quest[2]] + + return [self.getModelFromTexture(building[0]), building[1]] + def getNumFloors(self): return self.quest[3] @@ -1042,9 +1060,9 @@ class BuildingQuest(CogQuest): if self.isCogdo(): if buildingTrack == Any: - text = TTLocalizer.QuestsCogdoQuestDescU if count == 1 else TTLocalizer.QuestsCogdoQuestDescMUI + text = TTLocalizer.QuestsCogdoQuestDescU if count == 1 else TTLocalizer.QuestsCogdoQuestDescMI else: - text = TTLocalizer.QuestsCogdoQuestDesc if count == 1 else TTLocalizer.QuestsCogdoQuestDescMI + text = TTLocalizer.QuestsCogdoQuestDesc if count == 1 else TTLocalizer.QuestsCogdoQuestDescMUI else: floors = TTLocalizer.QuestsBuildingQuestFloorNumbers[self.getNumFloors() - 1]