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): for i in xrange(0, len(avQuests), 5):
questDesc = avQuests[i : i + 5] questDesc = avQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[QuestIdIndex]) questClass = Quests.getQuest(questDesc[QuestIdIndex])
if questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE: if isinstance(questClass, Quests.BuildingQuest) and questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE:
if isinstance(questClass, Quests.BuildingQuest): if questClass.isLocationMatch(zoneId) and questClass.doesBuildingTypeCount(type):
if questClass.isLocationMatch(zoneId): if questClass.isCogdo() == cogdo and questClass.doesBuildingCount(av, activeToons):
if questClass.doesBuildingTypeCount(type): if floors >= questClass.getNumFloors():
if questClass.isCogdo() == cogdo: questDesc[QuestProgressIndex] += 1
if questClass.doesBuildingCount(av, activeToons):
if floors >= questClass.getNumFloors():
questDesc[QuestProgressIndex] += 1
questList.append(questDesc) questList.append(questDesc)
av.b_setQuests(questList) 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)) self.air.writeServerEvent('buildingDefeated', t, '%s|%s|%s|%s' % (self.track, self.numFloors, self.zoneId, victorList))
if toon != None: 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 continue
victorList.extend([None, None, None, None]) victorList.extend([None, None, None, None])

View file

@ -349,7 +349,17 @@ class QuestPoster(DirectFrame):
objectiveStrings = quest.getObjectiveStrings() objectiveStrings = quest.getObjectiveStrings()
captions = map(string.capwords, quest.getObjectiveStrings()) captions = map(string.capwords, quest.getObjectiveStrings())
imageColor = Vec4(*self.colors['white']) 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' frameBgColor = 'red'
if fComplete: if fComplete:
self.teleportButton.show() self.teleportButton.show()
@ -659,16 +669,6 @@ class QuestPoster(DirectFrame):
rIconGeom = None rIconGeom = None
lIconGeomScale = rIconGeomScale lIconGeomScale = rIconGeomScale
rIconGeomScale = 1 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: elif quest.getType() == Quests.RescueQuest:
self.teleportButton.hide() self.teleportButton.hide()
frameBgColor = 'blue' frameBgColor = 'blue'

View file

@ -836,6 +836,9 @@ class TexturedQuest:
node.setTexture(loader.loadTexture(texture)) node.setTexture(loader.loadTexture(texture))
return node return node
def hasFrame(self):
return True
def getFrame(self): def getFrame(self):
print 'getFrame from TexturedQuest not implemented!' print 'getFrame from TexturedQuest not implemented!'
return [None, None] return [None, None]
@ -953,7 +956,13 @@ class RescueNewbieQuest(RescueQuest, NewbieQuest):
else: else:
return 0 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', trackCodes = ['c',
'l', 'l',
'm', 'm',
@ -970,6 +979,15 @@ class BuildingQuest(CogQuest):
self.checkBuildingFloors(self.quest[3]) self.checkBuildingFloors(self.quest[3])
self.checkBuildingType(self.quest[4]) 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): def getNumFloors(self):
return self.quest[3] return self.quest[3]
@ -1042,9 +1060,9 @@ class BuildingQuest(CogQuest):
if self.isCogdo(): if self.isCogdo():
if buildingTrack == Any: if buildingTrack == Any:
text = TTLocalizer.QuestsCogdoQuestDescU if count == 1 else TTLocalizer.QuestsCogdoQuestDescMUI text = TTLocalizer.QuestsCogdoQuestDescU if count == 1 else TTLocalizer.QuestsCogdoQuestDescMI
else: else:
text = TTLocalizer.QuestsCogdoQuestDesc if count == 1 else TTLocalizer.QuestsCogdoQuestDescMI text = TTLocalizer.QuestsCogdoQuestDesc if count == 1 else TTLocalizer.QuestsCogdoQuestDescMUI
else: else:
floors = TTLocalizer.QuestsBuildingQuestFloorNumbers[self.getNumFloors() - 1] floors = TTLocalizer.QuestsBuildingQuestFloorNumbers[self.getNumFloors() - 1]