mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-10-31 08:47:54 +00:00
toontown/ai cleanup
This commit is contained in:
parent
a71ed6fc7b
commit
59a6e2ece1
27 changed files with 66 additions and 77 deletions
|
@ -65,4 +65,4 @@ class AchievementsManagerAI():
|
||||||
def toonGotQuest(self, avId):
|
def toonGotQuest(self, avId):
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
if not av:
|
if not av:
|
||||||
return
|
return
|
||||||
|
|
|
@ -53,4 +53,4 @@ class CogPageManagerAI:
|
||||||
newCogRadar[dept] = cogRadar
|
newCogRadar[dept] = cogRadar
|
||||||
newBuildingRadar[dept] = buildingRadar
|
newBuildingRadar[dept] = buildingRadar
|
||||||
toon.b_setCogRadar(newCogRadar)
|
toon.b_setCogRadar(newCogRadar)
|
||||||
toon.b_setBuildingRadar(newBuildingRadar)
|
toon.b_setBuildingRadar(newBuildingRadar)
|
||||||
|
|
|
@ -14,11 +14,11 @@ class DistributedAprilToonsMgr(DistributedObject):
|
||||||
def announceGenerate(self):
|
def announceGenerate(self):
|
||||||
DistributedObject.announceGenerate(self)
|
DistributedObject.announceGenerate(self)
|
||||||
self.d_requestEventsList()
|
self.d_requestEventsList()
|
||||||
|
|
||||||
def d_requestEventsList(self):
|
def d_requestEventsList(self):
|
||||||
self.notify.debug("Requesting events list from AI.")
|
self.notify.debug("Requesting events list from AI.")
|
||||||
self.sendUpdate('requestEventsList', [])
|
self.sendUpdate('requestEventsList', [])
|
||||||
|
|
||||||
def requestEventsListResp(self, eventIds):
|
def requestEventsListResp(self, eventIds):
|
||||||
self.events = eventIds
|
self.events = eventIds
|
||||||
self.checkActiveEvents()
|
self.checkActiveEvents()
|
||||||
|
|
|
@ -9,15 +9,15 @@ def getDustCloudIval(toon):
|
||||||
dustCloud.setZ(3)
|
dustCloud.setZ(3)
|
||||||
dustCloud.setScale(0.4)
|
dustCloud.setScale(0.4)
|
||||||
dustCloud.createTrack()
|
dustCloud.createTrack()
|
||||||
|
|
||||||
if hasattr(toon, 'laffMeter'):
|
if hasattr(toon, 'laffMeter'):
|
||||||
toon.laffMeter.color = toon.style.getBlackColor()
|
toon.laffMeter.color = toon.style.getBlackColor()
|
||||||
|
|
||||||
sequence = Sequence(Wait(0.5), Func(dustCloud.reparentTo, toon), dustCloud.track, Func(dustCloud.destroy))
|
sequence = Sequence(Wait(0.5), Func(dustCloud.reparentTo, toon), dustCloud.track, Func(dustCloud.destroy))
|
||||||
|
|
||||||
if hasattr(toon, 'laffMeter'):
|
if hasattr(toon, 'laffMeter'):
|
||||||
sequence.append(Func(toon.laffMeter.adjustFace, toon.hp, toon.maxHp))
|
sequence.append(Func(toon.laffMeter.adjustFace, toon.hp, toon.maxHp))
|
||||||
|
|
||||||
return sequence
|
return sequence
|
||||||
|
|
||||||
class DistributedBlackCatMgr(DistributedObject.DistributedObject):
|
class DistributedBlackCatMgr(DistributedObject.DistributedObject):
|
||||||
|
@ -36,5 +36,4 @@ class DistributedBlackCatMgr(DistributedObject.DistributedObject):
|
||||||
self.sendUpdate('requestBlackCatTransformation')
|
self.sendUpdate('requestBlackCatTransformation')
|
||||||
|
|
||||||
def doBlackCatTransformation(self):
|
def doBlackCatTransformation(self):
|
||||||
print 'doit'
|
getDustCloudIval(base.localAvatar).start()
|
||||||
getDustCloudIval(base.localAvatar).start()
|
|
||||||
|
|
|
@ -9,15 +9,15 @@ class DistributedBlackCatMgrAI(DistributedObjectAI):
|
||||||
def requestBlackCatTransformation(self):
|
def requestBlackCatTransformation(self):
|
||||||
if not self.air.holidayManager.isHolidayRunning(ToontownGlobals.BLACK_CAT_DAY):
|
if not self.air.holidayManager.isHolidayRunning(ToontownGlobals.BLACK_CAT_DAY):
|
||||||
return
|
return
|
||||||
|
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
|
|
||||||
if not av or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a:
|
if not av or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a:
|
||||||
return
|
return
|
||||||
|
|
||||||
newDNA = ToonDNA()
|
newDNA = ToonDNA()
|
||||||
newDNA.makeFromNetString(av.getDNAString())
|
newDNA.makeFromNetString(av.getDNAString())
|
||||||
newDNA.updateToonProperties(armColor=26, legColor=26, headColor=26)
|
newDNA.updateToonProperties(armColor=26, legColor=26, headColor=26)
|
||||||
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
|
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
|
||||||
self.sendUpdateToAvatarId(avId, 'doBlackCatTransformation', [])
|
self.sendUpdateToAvatarId(avId, 'doBlackCatTransformation', [])
|
||||||
|
|
|
@ -9,12 +9,12 @@ class DistributedGreenToonEffectMgr(DistributedObject.DistributedObject):
|
||||||
|
|
||||||
def __init__(self, cr):
|
def __init__(self, cr):
|
||||||
DistributedObject.DistributedObject.__init__(self, cr)
|
DistributedObject.DistributedObject.__init__(self, cr)
|
||||||
|
|
||||||
def announceGenerate(self):
|
def announceGenerate(self):
|
||||||
DistributedObject.DistributedObject.announceGenerate(self)
|
DistributedObject.DistributedObject.announceGenerate(self)
|
||||||
DistributedGreenToonEffectMgr.notify.debug('announceGenerate')
|
DistributedGreenToonEffectMgr.notify.debug('announceGenerate')
|
||||||
self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid)
|
self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid)
|
||||||
|
|
||||||
def phraseSaid(self, phraseId):
|
def phraseSaid(self, phraseId):
|
||||||
greenPhrase = 30450
|
greenPhrase = 30450
|
||||||
if phraseId == greenPhrase:
|
if phraseId == greenPhrase:
|
||||||
|
|
|
@ -5,12 +5,12 @@ from direct.fsm.FSM import FSM
|
||||||
|
|
||||||
class DistributedGreenToonEffectMgrAI(DistributedObjectAI, FSM):
|
class DistributedGreenToonEffectMgrAI(DistributedObjectAI, FSM):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGreenToonEffectMgrAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGreenToonEffectMgrAI")
|
||||||
|
|
||||||
def __init__(self, air):
|
def __init__(self, air):
|
||||||
DistributedObjectAI.__init__(self, air)
|
DistributedObjectAI.__init__(self, air)
|
||||||
FSM.__init__(self, 'GreenToonFSM')
|
FSM.__init__(self, 'GreenToonFSM')
|
||||||
self.air = air
|
self.air = air
|
||||||
|
|
||||||
def enterOff(self):
|
def enterOff(self):
|
||||||
self.requestDelete()
|
self.requestDelete()
|
||||||
|
|
||||||
|
@ -18,5 +18,3 @@ class DistributedGreenToonEffectMgrAI(DistributedObjectAI, FSM):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
av.b_setCheesyEffect(15, 0, 0)
|
av.b_setCheesyEffect(15, 0, 0)
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
|
@ -16,31 +16,31 @@ def getDustCloudIval(toon):
|
||||||
if getattr(toon, 'laffMeter', None):
|
if getattr(toon, 'laffMeter', None):
|
||||||
seq.append(Func(toon.laffMeter.adjustFace, toon.hp, toon.maxHp))
|
seq.append(Func(toon.laffMeter.adjustFace, toon.hp, toon.maxHp))
|
||||||
return seq
|
return seq
|
||||||
|
|
||||||
class DistributedPolarBearMgr(DistributedObject.DistributedObject):
|
class DistributedPolarBearMgr(DistributedObject.DistributedObject):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPolarBearMgr')
|
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPolarBearMgr')
|
||||||
ActivateEvent = 'DistributedPolarBearMgr-activate'
|
ActivateEvent = 'DistributedPolarBearMgr-activate'
|
||||||
|
|
||||||
def __init__(self, cr):
|
def __init__(self, cr):
|
||||||
DistributedObject.DistributedObject.__init__(self, cr)
|
DistributedObject.DistributedObject.__init__(self, cr)
|
||||||
|
|
||||||
def announceGenerate(self):
|
def announceGenerate(self):
|
||||||
DistributedPolarBearMgr.notify.debug('announceGenerate')
|
DistributedPolarBearMgr.notify.debug('announceGenerate')
|
||||||
DistributedObject.DistributedObject.announceGenerate(self)
|
DistributedObject.DistributedObject.announceGenerate(self)
|
||||||
self.acceptOnce(DistributedPolarBearMgr.ActivateEvent, self.d_requestPolarBearTransformation)
|
self.acceptOnce(DistributedPolarBearMgr.ActivateEvent, self.d_requestPolarBearTransformation)
|
||||||
self.dustCloudIval = None
|
self.dustCloudIval = None
|
||||||
return
|
return
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
if self.dustCloudIval:
|
if self.dustCloudIval:
|
||||||
self.dustCloudIval.finish()
|
self.dustCloudIval.finish()
|
||||||
del self.dustCloudIval
|
del self.dustCloudIval
|
||||||
self.ignore(DistributedPolarBearMgr.ActivateEvent)
|
self.ignore(DistributedPolarBearMgr.ActivateEvent)
|
||||||
DistributedObject.DistributedObject.delete(self)
|
DistributedObject.DistributedObject.delete(self)
|
||||||
|
|
||||||
def d_requestPolarBearTransformation(self):
|
def d_requestPolarBearTransformation(self):
|
||||||
self.sendUpdate('requestPolarBearTransformation', [])
|
self.sendUpdate('requestPolarBearTransformation', [])
|
||||||
|
|
||||||
def doPolarBearTransformation(self, avId):
|
def doPolarBearTransformation(self, avId):
|
||||||
DistributedPolarBearMgr.notify.debug('doPolarBearTransformation')
|
DistributedPolarBearMgr.notify.debug('doPolarBearTransformation')
|
||||||
toon = self.cr.doId2do.get(avId)
|
toon = self.cr.doId2do.get(avId)
|
||||||
|
|
|
@ -4,12 +4,12 @@ from toontown.toon.ToonDNA import ToonDNA
|
||||||
|
|
||||||
class DistributedPolarBearMgrAI(DistributedObjectAI):
|
class DistributedPolarBearMgrAI(DistributedObjectAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPolarBearMgrAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPolarBearMgrAI")
|
||||||
|
|
||||||
def requestPolarBearTransformation(self):
|
def requestPolarBearTransformation(self):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
if not av: return
|
if not av: return
|
||||||
|
|
||||||
if av.dna.getAnimal() == 'bear' and av.dna.headColor != 0x00:
|
if av.dna.getAnimal() == 'bear' and av.dna.headColor != 0x00:
|
||||||
newDNA = ToonDNA()
|
newDNA = ToonDNA()
|
||||||
newDNA.makeFromNetString(av.getDNAString())
|
newDNA.makeFromNetString(av.getDNAString())
|
||||||
|
@ -17,5 +17,5 @@ class DistributedPolarBearMgrAI(DistributedObjectAI):
|
||||||
newDNA.armColor = 0x00
|
newDNA.armColor = 0x00
|
||||||
newDNA.legColor = 0x00
|
newDNA.legColor = 0x00
|
||||||
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' %avId)
|
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' %avId)
|
||||||
|
|
||||||
self.sendUpdate('doPolarBearTransformation', [avId])
|
self.sendUpdate('doPolarBearTransformation', [avId])
|
||||||
|
|
|
@ -14,7 +14,7 @@ class DistributedPolarPlaceEffectMgr(DistributedObject.DistributedObject):
|
||||||
DistributedObject.DistributedObject.announceGenerate(self)
|
DistributedObject.DistributedObject.announceGenerate(self)
|
||||||
DistributedPolarPlaceEffectMgr.notify.debug('announceGenerate')
|
DistributedPolarPlaceEffectMgr.notify.debug('announceGenerate')
|
||||||
self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid)
|
self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid)
|
||||||
|
|
||||||
def phraseSaid(self, phraseId):
|
def phraseSaid(self, phraseId):
|
||||||
helpPhrase = 104
|
helpPhrase = 104
|
||||||
if phraseId == helpPhrase:
|
if phraseId == helpPhrase:
|
||||||
|
|
|
@ -6,12 +6,12 @@ import time
|
||||||
|
|
||||||
class DistributedPolarPlaceEffectMgrAI(DistributedObjectAI, FSM):
|
class DistributedPolarPlaceEffectMgrAI(DistributedObjectAI, FSM):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPolarPlaceEffectMgrAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPolarPlaceEffectMgrAI")
|
||||||
|
|
||||||
def __init__(self, air):
|
def __init__(self, air):
|
||||||
DistributedObjectAI.__init__(self, air)
|
DistributedObjectAI.__init__(self, air)
|
||||||
FSM.__init__(self, 'ResistanceFSM')
|
FSM.__init__(self, 'ResistanceFSM')
|
||||||
self.air = air
|
self.air = air
|
||||||
|
|
||||||
def enterOff(self):
|
def enterOff(self):
|
||||||
self.requestDelete()
|
self.requestDelete()
|
||||||
|
|
||||||
|
@ -21,4 +21,3 @@ class DistributedPolarPlaceEffectMgrAI(DistributedObjectAI, FSM):
|
||||||
if not av: return
|
if not av: return
|
||||||
expireTime = int((time.time()/60) + 0.5) + 60
|
expireTime = int((time.time()/60) + 0.5) + 60
|
||||||
av.b_setCheesyEffect(13, 3000, expireTime)
|
av.b_setCheesyEffect(13, 3000, expireTime)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,6 @@ class DistributedReportMgr(DistributedObject.DistributedObject):
|
||||||
def delete(self):
|
def delete(self):
|
||||||
base.cr.reportMgr = None
|
base.cr.reportMgr = None
|
||||||
DistributedObject.DistributedObject.delete(self)
|
DistributedObject.DistributedObject.delete(self)
|
||||||
|
|
||||||
def sendReport(self, avId, category):
|
def sendReport(self, avId, category):
|
||||||
self.sendUpdate('sendReport', [avId, category])
|
self.sendUpdate('sendReport', [avId, category])
|
||||||
|
|
|
@ -11,27 +11,27 @@ class DistributedReportMgrAI(DistributedObjectAI):
|
||||||
self.reports = []
|
self.reports = []
|
||||||
self.interval = config.GetInt('report-interval', 600)
|
self.interval = config.GetInt('report-interval', 600)
|
||||||
self.scheduleReport()
|
self.scheduleReport()
|
||||||
|
|
||||||
def scheduleReport(self):
|
def scheduleReport(self):
|
||||||
threading.Timer(self.interval, self.sendAllReports).start()
|
threading.Timer(self.interval, self.sendAllReports).start()
|
||||||
|
|
||||||
def sendReport(self, avId, category):
|
def sendReport(self, avId, category):
|
||||||
if not ReportGlobals.isValidCategoryName(category) or not len(str(avId)) == 9:
|
if not ReportGlobals.isValidCategoryName(category) or not len(str(avId)) == 9:
|
||||||
return
|
return
|
||||||
|
|
||||||
reporter = self.air.doId2do.get(self.air.getAvatarIdFromSender())
|
reporter = self.air.doId2do.get(self.air.getAvatarIdFromSender())
|
||||||
|
|
||||||
if not reporter or reporter.isReported(avId):
|
if not reporter or reporter.isReported(avId):
|
||||||
return
|
return
|
||||||
|
|
||||||
timestamp = int(round(time.time() * 1000))
|
timestamp = int(round(time.time() * 1000))
|
||||||
self.reports.append('%s|%s|%s|%s' % (timestamp, reporter.doId, avId, category))
|
self.reports.append('%s|%s|%s|%s' % (timestamp, reporter.doId, avId, category))
|
||||||
|
|
||||||
def sendAllReports(self):
|
def sendAllReports(self):
|
||||||
self.scheduleReport()
|
self.scheduleReport()
|
||||||
|
|
||||||
if not self.reports or config.GetString('accountdb-type', 'developer') != 'remote':
|
if not self.reports or config.GetString('accountdb-type', 'developer') != 'remote':
|
||||||
return
|
return
|
||||||
|
|
||||||
executeHttpRequestAndLog('report', reports=','.join(self.reports))
|
executeHttpRequestAndLog('report', reports=','.join(self.reports))
|
||||||
self.reports = []
|
self.reports = []
|
||||||
|
|
|
@ -16,7 +16,7 @@ class DistributedResistanceEmoteMgr(DistributedObject.DistributedObject):
|
||||||
DistributedObject.DistributedObject.announceGenerate(self)
|
DistributedObject.DistributedObject.announceGenerate(self)
|
||||||
DistributedResistanceEmoteMgr.notify.debug('announceGenerate')
|
DistributedResistanceEmoteMgr.notify.debug('announceGenerate')
|
||||||
self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid)
|
self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid)
|
||||||
|
|
||||||
def phraseSaid(self, phraseId):
|
def phraseSaid(self, phraseId):
|
||||||
helpPhrase = 513
|
helpPhrase = 513
|
||||||
if phraseId == helpPhrase:
|
if phraseId == helpPhrase:
|
||||||
|
|
|
@ -11,7 +11,7 @@ class DistributedResistanceEmoteMgrAI(DistributedObjectAI, FSM):
|
||||||
DistributedObjectAI.__init__(self, air)
|
DistributedObjectAI.__init__(self, air)
|
||||||
FSM.__init__(self, 'ResistanceFSM')
|
FSM.__init__(self, 'ResistanceFSM')
|
||||||
self.air = air
|
self.air = air
|
||||||
|
|
||||||
def enterOff(self):
|
def enterOff(self):
|
||||||
self.requestDelete()
|
self.requestDelete()
|
||||||
|
|
||||||
|
@ -22,4 +22,3 @@ class DistributedResistanceEmoteMgrAI(DistributedObjectAI, FSM):
|
||||||
RESIST_INDEX = EmoteFuncDict['Resistance Salute']
|
RESIST_INDEX = EmoteFuncDict['Resistance Salute']
|
||||||
av.emoteAccess[RESIST_INDEX] = 1
|
av.emoteAccess[RESIST_INDEX] = 1
|
||||||
av.d_setEmoteAccess(av.emoteAccess)
|
av.d_setEmoteAccess(av.emoteAccess)
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,3 @@ class DistributedScavengerHuntTargetAI(DistributedObjectAI):
|
||||||
|
|
||||||
def attemptScavengerHunt(self):
|
def attemptScavengerHunt(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -23,4 +23,4 @@ class DistributedSillyMeterMgr(DistributedObject.DistributedObject):
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def getCurPhaseStartDate(self):
|
def getCurPhaseStartDate(self):
|
||||||
return -1
|
return -1
|
||||||
|
|
|
@ -3,4 +3,3 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
|
|
||||||
class DistributedSillyMeterMgrAI(DistributedObjectAI):
|
class DistributedSillyMeterMgrAI(DistributedObjectAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedSillyMeterMgrAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedSillyMeterMgrAI")
|
||||||
|
|
||||||
|
|
|
@ -27,14 +27,14 @@ class DistributedTrickOrTreatTarget(DistributedObject.DistributedObject):
|
||||||
self.triggered = True
|
self.triggered = True
|
||||||
self.d_requestScavengerHunt()
|
self.d_requestScavengerHunt()
|
||||||
taskMgr.doMethodLater(self.triggerDelay, reset, 'ScavengerHunt-phrase-reset', extraArgs=[])
|
taskMgr.doMethodLater(self.triggerDelay, reset, 'ScavengerHunt-phrase-reset', extraArgs=[])
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
self.ignore(SpeedChatGlobals.SCStaticTextMsgEvent)
|
self.ignore(SpeedChatGlobals.SCStaticTextMsgEvent)
|
||||||
DistributedObject.DistributedObject.delete(self)
|
DistributedObject.DistributedObject.delete(self)
|
||||||
|
|
||||||
def d_requestScavengerHunt(self):
|
def d_requestScavengerHunt(self):
|
||||||
self.sendUpdate('requestScavengerHunt', [])
|
self.sendUpdate('requestScavengerHunt', [])
|
||||||
|
|
||||||
def doScavengerHunt(self, amount):
|
def doScavengerHunt(self, amount):
|
||||||
DistributedTrickOrTreatTarget.notify.debug('doScavengerHunt')
|
DistributedTrickOrTreatTarget.notify.debug('doScavengerHunt')
|
||||||
base.localAvatar.trickOrTreatTargetMet(amount)
|
base.localAvatar.trickOrTreatTargetMet(amount)
|
||||||
|
|
|
@ -4,15 +4,15 @@ from direct.fsm.FSM import FSM
|
||||||
|
|
||||||
class DistributedTrickOrTreatTargetAI(DistributedObjectAI, FSM):
|
class DistributedTrickOrTreatTargetAI(DistributedObjectAI, FSM):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedTrickOrTreatTargetAI")
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedTrickOrTreatTargetAI")
|
||||||
|
|
||||||
def __init__(self, air):
|
def __init__(self, air):
|
||||||
DistributedObjectAI.__init__(self, air)
|
DistributedObjectAI.__init__(self, air)
|
||||||
FSM.__init__(self, 'TrickOrTreatTargeFSM')
|
FSM.__init__(self, 'TrickOrTreatTargeFSM')
|
||||||
self.air = air
|
self.air = air
|
||||||
|
|
||||||
def enterOff(self):
|
def enterOff(self):
|
||||||
self.requestDelete()
|
self.requestDelete()
|
||||||
|
|
||||||
def requestScavengerHunt(self):
|
def requestScavengerHunt(self):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
|
@ -28,4 +28,3 @@ class DistributedTrickOrTreatTargetAI(DistributedObjectAI, FSM):
|
||||||
av.addMoney(100)
|
av.addMoney(100)
|
||||||
if len(scavengerHunt) == 6:
|
if len(scavengerHunt) == 6:
|
||||||
av.b_setCheesyEffect(12, 0, 0)
|
av.b_setCheesyEffect(12, 0, 0)
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,11 @@ class DistributedWinterCarolingTarget(DistributedObject.DistributedObject):
|
||||||
self.triggered = True
|
self.triggered = True
|
||||||
self.d_requestScavengerHunt()
|
self.d_requestScavengerHunt()
|
||||||
taskMgr.doMethodLater(self.triggerDelay, reset, 'ScavengerHunt-phrase-reset', extraArgs=[])
|
taskMgr.doMethodLater(self.triggerDelay, reset, 'ScavengerHunt-phrase-reset', extraArgs=[])
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
self.ignore(SpeedChatGlobals.SCStaticTextMsgEvent)
|
self.ignore(SpeedChatGlobals.SCStaticTextMsgEvent)
|
||||||
DistributedObject.DistributedObject.delete(self)
|
DistributedObject.DistributedObject.delete(self)
|
||||||
|
|
||||||
def d_requestScavengerHunt(self):
|
def d_requestScavengerHunt(self):
|
||||||
self.sendUpdate('requestScavengerHunt', [])
|
self.sendUpdate('requestScavengerHunt', [])
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ class DistributedWinterCarolingTargetAI(DistributedObjectAI, FSM):
|
||||||
DistributedObjectAI.__init__(self, air)
|
DistributedObjectAI.__init__(self, air)
|
||||||
FSM.__init__(self, 'WinterCarolingFSM')
|
FSM.__init__(self, 'WinterCarolingFSM')
|
||||||
self.air = air
|
self.air = air
|
||||||
|
|
||||||
def enterOff(self):
|
def enterOff(self):
|
||||||
self.requestDelete()
|
self.requestDelete()
|
||||||
|
|
||||||
def requestScavengerHunt(self):
|
def requestScavengerHunt(self):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
|
@ -27,4 +27,3 @@ class DistributedWinterCarolingTargetAI(DistributedObjectAI, FSM):
|
||||||
av.b_setScavengerHunt(scavengerHunt)
|
av.b_setScavengerHunt(scavengerHunt)
|
||||||
if len(scavengerHunt) == 6:
|
if len(scavengerHunt) == 6:
|
||||||
av.b_setCheesyEffect(14, 0, 0)
|
av.b_setCheesyEffect(14, 0, 0)
|
||||||
|
|
||||||
|
|
|
@ -11,22 +11,22 @@ class HolidayManagerAI:
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
holidays = config.GetString('active-holidays','')
|
holidays = config.GetString('active-holidays','')
|
||||||
|
|
||||||
if holidays != '':
|
if holidays != '':
|
||||||
for holiday in holidays.split(","):
|
for holiday in holidays.split(","):
|
||||||
holiday = int(holiday)
|
holiday = int(holiday)
|
||||||
self.currentHolidays.append(holiday)
|
self.currentHolidays.append(holiday)
|
||||||
|
|
||||||
date = datetime.now()
|
date = datetime.now()
|
||||||
|
|
||||||
if date.month == 10 and date.day == 31:
|
if date.month == 10 and date.day == 31:
|
||||||
# Halloween: Black Cat Day
|
# Halloween: Black Cat Day
|
||||||
self.currentHolidays.append(ToontownGlobals.BLACK_CAT_DAY)
|
self.currentHolidays.append(ToontownGlobals.BLACK_CAT_DAY)
|
||||||
|
|
||||||
if date.weekday() == 6:
|
if date.weekday() == 6:
|
||||||
# Saturday: Fish Bingo
|
# Saturday: Fish Bingo
|
||||||
self.currentHolidays.append(ToontownGlobals.SILLY_SATURDAY_BINGO)
|
self.currentHolidays.append(ToontownGlobals.SILLY_SATURDAY_BINGO)
|
||||||
|
|
||||||
simbase.air.newsManager.setHolidayIdList([self.currentHolidays])
|
simbase.air.newsManager.setHolidayIdList([self.currentHolidays])
|
||||||
|
|
||||||
def isHolidayRunning(self, holidayId):
|
def isHolidayRunning(self, holidayId):
|
||||||
|
|
|
@ -731,17 +731,17 @@ def getHoliday(id):
|
||||||
return getattr(ToontownGlobals, id)
|
return getattr(ToontownGlobals, id)
|
||||||
|
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_PROGRAMMER, types=[str])
|
@magicWord(category=CATEGORY_PROGRAMMER, types=[str])
|
||||||
def startHoliday(id):
|
def startHoliday(id):
|
||||||
"""
|
"""
|
||||||
Start a holiday.
|
Start a holiday.
|
||||||
"""
|
"""
|
||||||
holiday = getHoliday(id.upper())
|
holiday = getHoliday(id.upper())
|
||||||
|
|
||||||
if holiday < 0:
|
if holiday < 0:
|
||||||
return "Couldn't find holiday " + id + '!'
|
return "Couldn't find holiday " + id + '!'
|
||||||
|
|
||||||
if base.cr.newsManager.startHoliday(holiday):
|
if base.cr.newsManager.startHoliday(holiday):
|
||||||
return 'Successfully started holiday ' + id + '!'
|
return 'Successfully started holiday ' + id + '!'
|
||||||
else:
|
else:
|
||||||
|
@ -753,11 +753,11 @@ def endHoliday(id):
|
||||||
End a holiday.
|
End a holiday.
|
||||||
"""
|
"""
|
||||||
holiday = getHoliday(id.upper())
|
holiday = getHoliday(id.upper())
|
||||||
|
|
||||||
if holiday < 0:
|
if holiday < 0:
|
||||||
return "Couldn't find holiday " + id + '!'
|
return "Couldn't find holiday " + id + '!'
|
||||||
|
|
||||||
if base.cr.newsManager.endHoliday(holiday):
|
if base.cr.newsManager.endHoliday(holiday):
|
||||||
return 'Successfully stopped holiday ' + id + '!'
|
return 'Successfully stopped holiday ' + id + '!'
|
||||||
else:
|
else:
|
||||||
return id + ' is not running!'
|
return id + ' is not running!'
|
||||||
|
|
|
@ -85,4 +85,3 @@ class NewsManagerAI(DistributedObjectAI):
|
||||||
|
|
||||||
def sendSystemMessage(self, todo0, todo1):
|
def sendSystemMessage(self, todo0, todo1):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,4 @@ def isValidCategoryName(value):
|
||||||
return value in categories
|
return value in categories
|
||||||
|
|
||||||
def getCategory(value):
|
def getCategory(value):
|
||||||
return categories[value]
|
return categories[value]
|
||||||
|
|
|
@ -9,10 +9,9 @@ class WelcomeValleyManagerAI(DistributedObjectAI):
|
||||||
|
|
||||||
def toonSetZone(self, doId, newZoneId):
|
def toonSetZone(self, doId, newZoneId):
|
||||||
pass #TODO
|
pass #TODO
|
||||||
|
|
||||||
def requestZoneIdMessage(self, todo0, todo1):
|
def requestZoneIdMessage(self, todo0, todo1):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def requestZoneIdResponse(self, todo0, todo1):
|
def requestZoneIdResponse(self, todo0, todo1):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue