Fix cogdo tasks and add textures for it

This commit is contained in:
John 2015-05-27 18:46:19 +03:00 committed by Loudrob
parent 167b42447b
commit 065f9125fd
4 changed files with 38 additions and 23 deletions

View file

@ -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)

View file

@ -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])

View file

@ -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'

View file

@ -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]