diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 0f6c92f8..e952ceda 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -1532,21 +1532,9 @@ struct multipleStartHoliday { }; dclass NewsManager : DistributedObject { - setPopulation(uint32) broadcast ram; - setBingoWin(uint32) broadcast ram; - setBingoStart() broadcast; - setBingoEnd() broadcast; - setCircuitRaceStart() broadcast; - setCircuitRaceEnd() broadcast; - setInvasionStatus(uint8, string, uint32, uint8) broadcast; - setHolidayIdList(uint32[]) broadcast ram; - holidayNotify() broadcast; - setWeeklyCalendarHolidays(weeklyCalendarHoliday []) required broadcast ram; - setYearlyCalendarHolidays(yearlyCalendarHoliday []) required broadcast ram; - setOncelyCalendarHolidays(oncelyCalendarHoliday []) required broadcast ram; - setRelativelyCalendarHolidays(relativelyCalendarHoliday []) required broadcast ram; - setMultipleStartHolidays(multipleStartHoliday []) required broadcast ram; - sendSystemMessage(string, uint8) broadcast ram; + startHoliday(uint8) broadcast; + endHoliday(uint8) broadcast; + startHolidays(uint8[]); }; dclass PurchaseManager : DistributedObject { diff --git a/toontown/ai/FishManagerAI.py b/toontown/ai/FishManagerAI.py index d8eabc33..fe0b7c20 100755 --- a/toontown/ai/FishManagerAI.py +++ b/toontown/ai/FishManagerAI.py @@ -103,9 +103,9 @@ def fish(fishName): """ invoker = spellbook.getInvoker() if fishName.lower() == 'remove': - if invoker.doId not in simbase.air.fishManager.fishRequests: + if invoker.doId not in simbase.air.fishManager.requestedFish: return 'You have not requested a fish.' - del simbase.air.fishManager.fishRequests[invoker.doId] + del simbase.air.fishManager.requestedFish[invoker.doId] return 'Removed your fish request.' for genus, species in TTLocalizer.FishSpeciesNames: @@ -113,7 +113,7 @@ def fish(fishName): if fishName.lower() != name.lower(): continue fishRequest = (genus, species.index(name)) - simbase.air.fishManager.fishRequests[invoker.doId] = fishRequest + simbase.air.fishManager.requestedFish[invoker.doId] = fishRequest return 'A request for the fish %s was saved.' % name return "Couldn't find a fish with the name %s!" % fishName diff --git a/toontown/ai/HolidayGlobals.py b/toontown/ai/HolidayGlobals.py new file mode 100644 index 00000000..31a86620 --- /dev/null +++ b/toontown/ai/HolidayGlobals.py @@ -0,0 +1,34 @@ +from toontown.toonbase import ToontownGlobals, TTLocalizer + +Holidays = { + ToontownGlobals.LAUGHING_MAN: { + 'startMonth': 6, + 'startDay': 22, + 'endMonth': 6, + 'endDay': 22, + 'startMessage': TTLocalizer.LaughingManHolidayStart, + 'ongoingMessage': TTLocalizer.LaughingManHolidayOngoing, + 'endMessage': TTLocalizer.LaughingManHolidayEnd + }, + ToontownGlobals.GRAND_PRIX: { + 'weekDay': 0, + 'startMessage': TTLocalizer.CircuitRaceStart, + 'ongoingMessage': TTLocalizer.CircuitRaceOngoing, + 'endMessage': TTLocalizer.CircuitRaceEnd + }, + ToontownGlobals.FISH_BINGO: { + 'weekDay': 2, + 'startMessage': TTLocalizer.FishBingoStart, + 'ongoingMessage': TTLocalizer.FishBingoOngoing, + 'endMessage': TTLocalizer.FishBingoEnd + }, + ToontownGlobals.SILLY_SATURDAY: { + 'weekDay': 5, + 'startMessage': TTLocalizer.SillySaturdayStart, + 'ongoingMessage': TTLocalizer.SillySaturdayOngoing, + 'endMessage': TTLocalizer.SillySaturdayEnd + } +} + +def getHoliday(id): + return Holidays.get(id, {}) \ No newline at end of file diff --git a/toontown/ai/NewsManager.py b/toontown/ai/NewsManager.py index 78261183..0dd57897 100755 --- a/toontown/ai/NewsManager.py +++ b/toontown/ai/NewsManager.py @@ -1,724 +1,61 @@ -from otp.ai.MagicWordGlobal import * -from pandac.PandaModules import * -from direct.distributed import DistributedObject -from direct.directnotify import DirectNotifyGlobal -from direct.interval.IntervalGlobal import * -from toontown.toonbase import TTLocalizer, ToontownGlobals, ToontownBattleGlobals -from toontown.battle import SuitBattleGlobals -from toontown.suit import SuitDNA -from copy import deepcopy -import HolidayDecorator, HalloweenHolidayDecorator, calendar +from direct.distributed.DistributedObject import DistributedObject +from toontown.toonbase import ToontownGlobals +import HolidayGlobals -decorationHolidays = [ToontownGlobals.WINTER_DECORATIONS, - ToontownGlobals.WACKY_WINTER_DECORATIONS, - ToontownGlobals.HALLOWEEN_PROPS, - ToontownGlobals.SPOOKY_PROPS, - ToontownGlobals.HALLOWEEN_COSTUMES, - ToontownGlobals.SPOOKY_COSTUMES] - -class NewsManager(DistributedObject.DistributedObject): - notify = DirectNotifyGlobal.directNotify.newCategory('NewsManager') +class NewsManager(DistributedObject): neverDisable = 1 - YearlyHolidayType = 1 - OncelyHolidayType = 2 - RelativelyHolidayType = 3 - OncelyMultipleStartHolidayType = 4 def __init__(self, cr): - DistributedObject.DistributedObject.__init__(self, cr) - self.population = 0 - self.invading = 0 - - forcedHolidayDecorations = base.config.GetString('force-holiday-decorations', '') - self.decorationHolidayIds = [] - - if forcedHolidayDecorations != '': - forcedHolidayDecorations = forcedHolidayDecorations.split(',') - for HID in forcedHolidayDecorations: - try: - self.decorationHolidayIds.append(decorationHolidays[int(HID)]) - except: - print 'holidayId value error: "%s"... skipping' %HID - - self.holidayDecorator = None - self.holidayIdList = [] - base.cr.newsManager = self + DistributedObject.__init__(self, cr) + self.invading = False + self.activeHolidays = [] base.localAvatar.inventory.setInvasionCreditMultiplier(1) - self.weeklyCalendarHolidays = [] - return + base.cr.newsManager = self def delete(self): self.cr.newsManager = None - if self.holidayDecorator: - self.holidayDecorator.exit() - DistributedObject.DistributedObject.delete(self) - return + DistributedObject.delete(self) - def setPopulation(self, population): - self.population = population - messenger.send('newPopulation', [population]) + def isHolidayRunning(self, id): + return id in self.activeHolidays + + def startHolidays(self, ids): + for id in ids: + self.startHoliday(id, True) + + def getDecorationHolidayId(self): + return [] - def getPopulation(self): - return self.population - - def sendSystemMessage(self, message, style): - base.localAvatar.setSystemMessage(style, message) - - def setInvasionStatus(self, msgType, suitType, remaining, flags): - if suitType in SuitDNA.suitHeadTypes: - suitName = SuitBattleGlobals.SuitAttributes[suitType]['name'] - suitNamePlural = SuitBattleGlobals.SuitAttributes[suitType]['pluralname'] - elif suitType in SuitDNA.suitDepts: - suitName = SuitDNA.getDeptFullname(suitType) - suitNamePlural = SuitDNA.getDeptFullnameP(suitType) - - messages = [] - - if msgType == ToontownGlobals.SuitInvasionBegin: - messages.append(TTLocalizer.SuitInvasionBegin1) - messages.append(TTLocalizer.SuitInvasionBegin2 % suitNamePlural) - self.invading = 1 - elif msgType == ToontownGlobals.SuitInvasionEnd: - messages.append(TTLocalizer.SuitInvasionEnd1 % suitName) - messages.append(TTLocalizer.SuitInvasionEnd2) - self.invading = 0 - elif msgType == ToontownGlobals.SuitInvasionUpdate: - messages.append(TTLocalizer.SuitInvasionUpdate1) - messages.append(TTLocalizer.SuitInvasionUpdate2) - self.invading = 1 - elif msgType == ToontownGlobals.SuitInvasionBulletin: - messages.append(TTLocalizer.SuitInvasionBulletin1) - messages.append(TTLocalizer.SuitInvasionBulletin2 % suitNamePlural) - self.invading = 1 - elif msgType == ToontownGlobals.SkelecogInvasionBegin: - messages.append(TTLocalizer.SkelecogInvasionBegin1) - messages.append(TTLocalizer.SkelecogInvasionBegin2) - messages.append(TTLocalizer.SkelecogInvasionBegin3) - self.invading = 1 - elif msgType == ToontownGlobals.SkelecogInvasionEnd: - messages.append(TTLocalizer.SkelecogInvasionEnd1) - messages.append(TTLocalizer.SkelecogInvasionEnd2) - self.invading = 0 - elif msgType == ToontownGlobals.SkelecogInvasionBulletin: - messages.append(TTLocalizer.SkelecogInvasionBulletin1) - messages.append(TTLocalizer.SkelecogInvasionBulletin2) - messages.append(TTLocalizer.SkelecogInvasionBulletin3) - self.invading = 1 - elif msgType == ToontownGlobals.WaiterInvasionBegin: - messages.append(TTLocalizer.WaiterInvasionBegin1) - messages.append(TTLocalizer.WaiterInvasionBegin2) - self.invading = 1 - elif msgType == ToontownGlobals.WaiterInvasionEnd: - messages.append(TTLocalizer.WaiterInvasionEnd1) - messages.append(TTLocalizer.WaiterInvasionEnd2) - self.invading = 0 - elif msgType == ToontownGlobals.WaiterInvasionBulletin: - messages.append(TTLocalizer.WaiterInvasionBulletin1) - messages.append(TTLocalizer.WaiterInvasionBulletin2) - messages.append(TTLocalizer.WaiterInvasionBulletin3) - self.invading = 1 - elif msgType == ToontownGlobals.V2InvasionBegin: - messages.append(TTLocalizer.V2InvasionBegin1) - messages.append(TTLocalizer.V2InvasionBegin2) - messages.append(TTLocalizer.V2InvasionBegin3 % suitNamePlural) - self.invading = 1 - elif msgType == ToontownGlobals.V2InvasionEnd: - messages.append(TTLocalizer.V2InvasionEnd1) - messages.append(TTLocalizer.V2InvasionEnd2) - self.invading = 0 - elif msgType == ToontownGlobals.V2InvasionBulletin: - messages.append(TTLocalizer.V2InvasionBulletin1) - messages.append(TTLocalizer.V2InvasionBulletin2) - messages.append(TTLocalizer.V2InvasionBulletin3 % suitNamePlural) - self.invading = 1 - else: - self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType) + def broadcastHoliday(self, holiday, type): + if type in holiday: + base.localAvatar.setSystemMessage(0, holiday[type]) + + def startHoliday(self, id, ongoing=False): + if id in self.activeHolidays or id not in HolidayGlobals.Holidays: return - multiplier = 1 - if self.invading: - multiplier = ToontownBattleGlobals.getInvasionMultiplier() - base.localAvatar.inventory.setInvasionCreditMultiplier(multiplier) - - track = Sequence(name='newsManagerWait', autoPause=1) - for i, message in enumerate(messages): - if i == 0: - track.append(Wait(1)) - else: - track.append(Wait(5)) - track.append(Func(base.localAvatar.setSystemMessage, 0, message)) - track.start() - - def getInvading(self): - return self.invading - - def startHoliday(self, holidayId): - if holidayId not in self.holidayIdList: - self.notify.info('setHolidayId: Starting Holiday %s' % holidayId) - self.holidayIdList.append(holidayId) - if holidayId in decorationHolidays: - self.decorationHolidayIds.append(holidayId) - if holidayId == ToontownGlobals.HALLOWEEN_PROPS: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addHalloweenMenu() - self.setHalloweenPropsHolidayStart() - elif holidayId == ToontownGlobals.SPOOKY_PROPS: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addHalloweenMenu() - self.setSpookyPropsHolidayStart() - elif holidayId == ToontownGlobals.WINTER_DECORATIONS: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addWinterMenu() - self.setWinterDecorationsStart() - elif holidayId == ToontownGlobals.WACKY_WINTER_DECORATIONS: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addWinterMenu() - self.setWackyWinterDecorationsStart() - if hasattr(base.cr.playGame, 'dnaStore') and hasattr(base.cr.playGame, 'hood') and hasattr(base.cr.playGame.hood, 'loader'): - if holidayId == ToontownGlobals.HALLOWEEN_COSTUMES or holidayId == ToontownGlobals.SPOOKY_COSTUMES: - self.holidayDecorator = HalloweenHolidayDecorator.HalloweenHolidayDecorator() - else: - self.holidayDecorator = HolidayDecorator.HolidayDecorator() - self.holidayDecorator.decorate() - messenger.send('decorator-holiday-%d-starting' % holidayId) - elif holidayId == ToontownGlobals.SILLY_SATURDAY_BINGO: - self.setBingoOngoing() - elif holidayId == ToontownGlobals.MORE_XP_HOLIDAY: - self.setMoreXpHolidayStart() - elif holidayId == ToontownGlobals.JELLYBEAN_DAY: - pass - elif holidayId == ToontownGlobals.CIRCUIT_RACING_EVENT: - self.setGrandPrixWeekendStart() - elif holidayId == ToontownGlobals.APRIL_FOOLS_COSTUMES: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addAprilToonsMenu() - elif holidayId == ToontownGlobals.WINTER_CAROLING: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addCarolMenu() - self.setWinterCarolingStart() - elif holidayId == ToontownGlobals.WACKY_WINTER_CAROLING: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addCarolMenu() - elif holidayId == ToontownGlobals.VALENTINES_DAY: - messenger.send('ValentinesDayStart') - base.localAvatar.setSystemMessage(0, TTLocalizer.ValentinesDayStart) - elif holidayId == ToontownGlobals.SILLY_CHATTER_ONE: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseOneMenu() - elif holidayId == ToontownGlobals.SILLY_CHATTER_TWO: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseTwoMenu() - elif holidayId == ToontownGlobals.SILLY_CHATTER_THREE: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseThreeMenu() - elif holidayId == ToontownGlobals.SILLY_CHATTER_FOUR: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseFourMenu() - elif holidayId == ToontownGlobals.SILLY_CHATTER_FIVE: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseFiveMenu() - elif holidayId == ToontownGlobals.VICTORY_PARTY_HOLIDAY: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addVictoryPartiesMenu() - elif holidayId == ToontownGlobals.SELLBOT_NERF_HOLIDAY: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setSellbotNerfHolidayStart() - base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotNerfMenu() - elif holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addJellybeanJamMenu(TTSCJellybeanJamMenu.JellybeanJamPhases.TROLLEY) - elif holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addJellybeanJamMenu(TTSCJellybeanJamMenu.JellybeanJamPhases.FISHING) - elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setJellybeanPartiesHolidayStart() - elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY_MONTH: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setJellybeanMonthHolidayStart() - elif holidayId == ToontownGlobals.BLACK_CAT_DAY: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setBlackCatHolidayStart() - elif holidayId == ToontownGlobals.SPOOKY_BLACK_CAT: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setSpookyBlackCatHolidayStart() - elif holidayId == ToontownGlobals.LAUGHING_MAN: - if hasattr(base, 'localAvatar') and base.localAvatar: - self.setLaughingManHolidayStart() - elif holidayId == ToontownGlobals.TOP_TOONS_MARATHON: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setTopToonsMarathonStart() - elif holidayId == ToontownGlobals.SELLBOT_INVASION: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotInvasionMenu() - elif holidayId == ToontownGlobals.SELLBOT_FIELD_OFFICE: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotFieldOfficeMenu() - elif holidayId == ToontownGlobals.IDES_OF_MARCH: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setIdesOfMarchStart() - base.localAvatar.chatMgr.chatInputSpeedChat.addIdesOfMarchMenu() - elif holidayId == ToontownGlobals.EXPANDED_CLOSETS: - self.setExpandedClosetsStart() - elif holidayId == ToontownGlobals.KARTING_TICKETS_HOLIDAY: - self.setKartingTicketsHolidayStart() - return True - return False - - def endHoliday(self, holidayId): - if holidayId in self.holidayIdList: - self.notify.info('setHolidayId: Ending Holiday %s' % holidayId) - self.holidayIdList.remove(holidayId) - if holidayId in self.decorationHolidayIds: - self.decorationHolidayIds.remove(holidayId) - if holidayId == ToontownGlobals.HALLOWEEN_PROPS: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu() - self.setHalloweenPropsHolidayEnd() - elif holidayId == ToontownGlobals.SPOOKY_PROPS: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu() - self.setSpookyPropsHolidayEnd() - elif holidayId == ToontownGlobals.WINTER_DECORATIONS: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu() - self.setWinterDecorationsEnd() - elif holidayId == ToontownGlobals.WACKY_WINTER_DECORATIONS: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu() - if hasattr(base.cr.playGame, 'dnaStore') and hasattr(base.cr.playGame, 'hood') and hasattr(base.cr.playGame.hood, 'loader'): - if holidayId == ToontownGlobals.HALLOWEEN_COSTUMES or holidayId == ToontownGlobals.SPOOKY_COSTUMES: - self.holidayDecorator = HalloweenHolidayDecorator.HalloweenHolidayDecorator() - else: - self.holidayDecorator = HolidayDecorator.HolidayDecorator() - self.holidayDecorator.undecorate() - messenger.send('decorator-holiday-%d-ending' % holidayId) - elif holidayId == ToontownGlobals.SILLY_SATURDAY_BINGO: - self.setBingoEnd() - elif holidayId == ToontownGlobals.MORE_XP_HOLIDAY: - self.setMoreXpHolidayEnd() - elif holidayId == ToontownGlobals.JELLYBEAN_DAY: - pass - elif holidayId == ToontownGlobals.CIRCUIT_RACING_EVENT: - self.setGrandPrixWeekendEnd() - elif holidayId == ToontownGlobals.APRIL_FOOLS_COSTUMES: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeAprilToonsMenu() - elif holidayId == ToontownGlobals.VALENTINES_DAY: - messenger.send('ValentinesDayStop') - base.localAvatar.setSystemMessage(0, TTLocalizer.ValentinesDayEnd) - elif holidayId == ToontownGlobals.SILLY_CHATTER_ONE: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseOneMenu() - elif holidayId == ToontownGlobals.SILLY_CHATTER_TWO: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseTwoMenu() - elif holidayId == ToontownGlobals.SILLY_CHATTER_THREE: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseThreeMenu() - elif holidayId == ToontownGlobals.SILLY_CHATTER_FOUR: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseFourMenu() - elif holidayId == ToontownGlobals.SILLY_CHATTER_FIVE: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseFiveMenu() - elif holidayId == ToontownGlobals.VICTORY_PARTY_HOLIDAY: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeVictoryPartiesMenu() - elif holidayId == ToontownGlobals.WINTER_CAROLING: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeCarolMenu() - elif holidayId == ToontownGlobals.WACKY_WINTER_CAROLING: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeCarolMenu() - elif holidayId == ToontownGlobals.SELLBOT_NERF_HOLIDAY: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setSellbotNerfHolidayEnd() - base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotNerfMenu() - elif holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu() - elif holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu() - elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY_MONTH: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setJellybeanPartiesHolidayEnd() - base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu() - elif holidayId == ToontownGlobals.BLACK_CAT_DAY: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setBlackCatHolidayEnd() - elif holidayId == ToontownGlobals.SPOOKY_BLACK_CAT: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setSpookyBlackCatHolidayEnd() - elif holidayId == ToontownGlobals.LAUGHING_MAN: - if hasattr(base, 'localAvatar') and base.localAvatar: - self.setLaughingManHolidayEnd() - elif holidayId == ToontownGlobals.TOP_TOONS_MARATHON: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - self.setTopToonsMarathonEnd() - elif holidayId == ToontownGlobals.SELLBOT_INVASION: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotInvasionMenu() - elif holidayId == ToontownGlobals.SELLBOT_FIELD_OFFICE: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotFieldOfficeMenu() - elif holidayId == ToontownGlobals.IDES_OF_MARCH: - if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: - base.localAvatar.chatMgr.chatInputSpeedChat.removeIdesOfMarchMenu() - return True - return False - - def setHolidayIdList(self, holidayIdList): - - def isEnding(id): - return id not in holidayIdList - - def isStarting(id): - return id not in self.holidayIdList - - toEnd = filter(isEnding, self.holidayIdList) - for endingHolidayId in toEnd: - self.endHoliday(endingHolidayId) - - toStart = filter(isStarting, holidayIdList) - for startingHolidayId in toStart: - self.startHoliday(startingHolidayId) - - messenger.send('setHolidayIdList', [holidayIdList]) - - def getDecorationHolidayId(self): - return self.decorationHolidayIds - - def getHolidayIdList(self): - return self.holidayIdList - - def setBingoWin(self, zoneId): - base.localAvatar.setSystemMessage(0, 'Bingo congrats!') - - def setBingoStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoStart) - - def setBingoOngoing(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoOngoing) - - def setBingoEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoEnd) - - def setCircuitRaceStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceStart) - - def setCircuitRaceOngoing(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceOngoing) - - def setCircuitRaceEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceEnd) - - def setMoreXpHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayStart) - - def setMoreXpHolidayOngoing(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayOngoing) - - def setMoreXpHolidayEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayEnd) - - def setJellybeanDayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanDayHolidayStart) - - def setJellybeanDayEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanDayHolidayEnd) - - def setGrandPrixWeekendStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.GrandPrixWeekendHolidayStart) - - def setGrandPrixWeekendEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.GrandPrixWeekendHolidayEnd) - - def setSellbotNerfHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.SellbotNerfHolidayStart) - - def setSellbotNerfHolidayEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.SellbotNerfHolidayEnd) - - def setJellybeanTrolleyHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanTrolleyHolidayStart) - - def setJellybeanTrolleyHolidayEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanTrolleyHolidayEnd) - - def setJellybeanFishingHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanFishingHolidayStart) - - def setJellybeanFishingHolidayEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanFishingHolidayEnd) - - def setJellybeanPartiesHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanPartiesHolidayStart) - - def setJellybeanMonthHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanMonthHolidayStart) - - def setJellybeanPartiesHolidayEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanPartiesHolidayEnd) - - def setHalloweenPropsHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.HalloweenPropsHolidayStart) - - def setHalloweenPropsHolidayEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.HalloweenPropsHolidayEnd) - - def setSpookyPropsHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyPropsHolidayStart) - - def setSpookyPropsHolidayEnd(self): - pass - - def setBlackCatHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.BlackCatHolidayStart) - - def setBlackCatHolidayEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.BlackCatHolidayEnd) - - def setSpookyBlackCatHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyBlackCatHolidayStart) - for currToon in base.cr.toons.values(): - currToon.setDNA(currToon.style.clone()) - - def setSpookyBlackCatHolidayEnd(self): - for currToon in base.cr.toons.values(): - currToon.setDNA(currToon.style.clone()) - - def setLaughingManHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.LaughingManHolidayStart) - for currToon in base.cr.toons.values(): - currToon.generateLaughingMan() - - def setLaughingManHolidayEnd(self): - for currToon in base.cr.toons.values(): - currToon.swapToonHead(laughingMan=currToon.getWantLaughingMan()) - - def setTopToonsMarathonStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonStart) - - def setTopToonsMarathonEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonEnd) - - def setWinterDecorationsStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.WinterDecorationsStart) - - def setWinterDecorationsEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.WinterDecorationsEnd) - - def setWackyWinterDecorationsStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.WackyWinterDecorationsStart) - - def setWinterCarolingStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.WinterCarolingStart) - - def setExpandedClosetsStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.ExpandedClosetsStart) - - def setKartingTicketsHolidayStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.KartingTicketsHolidayStart) - - def setIdesOfMarchStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.IdesOfMarchStart) - - def holidayNotify(self): - for id in self.holidayIdList: - if id == 20: - self.setCircuitRaceOngoing() - - def setWeeklyCalendarHolidays(self, weeklyCalendarHolidays): - self.weeklyCalendarHolidays = weeklyCalendarHolidays - - def getHolidaysForWeekday(self, day): - result = [] - for item in self.weeklyCalendarHolidays: - if item[1] == day: - result.append(item[0]) - - return result - - def setYearlyCalendarHolidays(self, yearlyCalendarHolidays): - self.yearlyCalendarHolidays = yearlyCalendarHolidays - - def getYearlyHolidaysForDate(self, theDate): - result = [] - for item in self.yearlyCalendarHolidays: - if item[1][0] == theDate.month and item[1][1] == theDate.day: - newItem = [self.YearlyHolidayType] + list(item) - result.append(tuple(newItem)) - continue - if item[2][0] == theDate.month and item[2][1] == theDate.day: - newItem = [self.YearlyHolidayType] + list(item) - result.append(tuple(newItem)) - - return result - - def setMultipleStartHolidays(self, multipleStartHolidays): - self.multipleStartHolidays = multipleStartHolidays - - def getMultipleStartHolidaysForDate(self, theDate): - result = [] - for theHoliday in self.multipleStartHolidays: - times = theHoliday[1:] - tempTimes = times[0] - for startAndStopTimes in tempTimes: - startTime = startAndStopTimes[0] - endTime = startAndStopTimes[1] - if startTime[0] == theDate.year and startTime[1] == theDate.month and startTime[2] == theDate.day: - fakeOncelyHoliday = [theHoliday[0], startTime, endTime] - newItem = [self.OncelyMultipleStartHolidayType] + fakeOncelyHoliday - result.append(tuple(newItem)) - continue - if endTime[0] == theDate.year and endTime[1] == theDate.month and endTime[2] == theDate.day: - fakeOncelyHoliday = [theHoliday[0], startTime, endTime] - newItem = [self.OncelyMultipleStartHolidayType] + fakeOncelyHoliday - result.append(tuple(newItem)) - - return result - - def setOncelyCalendarHolidays(self, oncelyCalendarHolidays): - self.oncelyCalendarHolidays = oncelyCalendarHolidays - - def getOncelyHolidaysForDate(self, theDate): - result = [] - for item in self.oncelyCalendarHolidays: - if item[1][0] == theDate.year and item[1][1] == theDate.month and item[1][2] == theDate.day: - newItem = [self.OncelyHolidayType] + list(item) - result.append(tuple(newItem)) - continue - if item[2][0] == theDate.year and item[2][1] == theDate.month and item[2][2] == theDate.day: - newItem = [self.OncelyHolidayType] + list(item) - result.append(tuple(newItem)) - - return result - - def setRelativelyCalendarHolidays(self, relativelyCalendarHolidays): - self.relativelyCalendarHolidays = relativelyCalendarHolidays - - def getRelativelyHolidaysForDate(self, theDate): - result = [] - self.weekDaysInMonth = [] - self.numDaysCorMatrix = [(28, 0), (29, 1), (30, 2), (31, 3)] - - for i in xrange(7): - self.weekDaysInMonth.append((i, 4)) - - for holidayItem in self.relativelyCalendarHolidays: - item = deepcopy(holidayItem) - - newItem = [] - newItem.append(item[0]) - - i = 1 - while i < len(item): - sRepNum = item[i][1] - sWeekday = item[i][2] - eWeekday = item[i+1][2] - - while 1: - eRepNum = item[i+1][1] - - self.initRepMatrix(theDate.year, item[i][0]) - while self.weekDaysInMonth[sWeekday][1] < sRepNum: - sRepNum -= 1 - - sDay = self.dayForWeekday(theDate.year, item[i][0], sWeekday, sRepNum) - - self.initRepMatrix(theDate.year, item[i+1][0]) - while self.weekDaysInMonth[eWeekday][1] < eRepNum: - eRepNum -= 1 - - nDay = self.dayForWeekday(theDate.year, item[i+1][0], eWeekday, eRepNum) - - if ((nDay > sDay and - item[i+1][0] == item[i][0] and - (item[i+1][1] - item[i][1]) <= (nDay - sDay + abs(eWeekday - sWeekday))/7) or - item[i+1][0] != item[i][0]): - break - - if self.weekDaysInMonth[eWeekday][1] > eRepNum: - eRepNum += 1 - else: - item[i+1][0] += 1 - item[i+1][1] = 1 - - newItem.append([item[i][0], sDay, item[i][3], item[i][4], item[i][5]]) - - newItem.append([item[i+1][0], nDay, item[i+1][3], item[i+1][4], item[i+1][5]]) - - i += 2 - - if item[1][0] == theDate.month and newItem[1][1] == theDate.day: - nItem = [self.RelativelyHolidayType] + list(newItem) - result.append(tuple(nItem)) - continue - - if item[2][0] == theDate.month and newItem[2][1] == theDate.day: - nItem = [self.RelativelyHolidayType] + list(newItem) - result.append(tuple(nItem)) - - return result - - def dayForWeekday(self, year, month, weekday, repNum): - monthDays = calendar.monthcalendar(year, month) - if monthDays[0][weekday] == 0: - repNum += 1 - return monthDays[repNum - 1][weekday] - - def initRepMatrix(self, year, month): - for i in xrange(7): - self.weekDaysInMonth[i] = (i, 4) - - startingWeekDay, numDays = calendar.monthrange(year, month) - for i in xrange(4): - if numDays == self.numDaysCorMatrix[i][0]: - break - - for j in xrange(self.numDaysCorMatrix[i][1]): - self.weekDaysInMonth[startingWeekDay] = (self.weekDaysInMonth[startingWeekDay][0], self.weekDaysInMonth[startingWeekDay][1] + 1) - startingWeekDay = (startingWeekDay + 1) % 7 - - def isHolidayRunning(self, holidayId): - return holidayId in self.holidayIdList - -def getHoliday(id): - if id.isdigit(): - return int(id) - elif hasattr(ToontownGlobals, id): - return getattr(ToontownGlobals, id) - - return -1 - -@magicWord(category=CATEGORY_PROGRAMMER, types=[str]) -def startHoliday(id): - """ - Start a holiday. - """ - holiday = getHoliday(id.upper()) - - if holiday < 0: - return "Couldn't find holiday " + id + '!' - - if base.cr.newsManager.startHoliday(holiday): - return 'Successfully started holiday ' + id + '!' - else: - return id + ' is already running!' - -@magicWord(category=CATEGORY_PROGRAMMER, types=[str]) -def endHoliday(id): - """ - End a holiday. - """ - holiday = getHoliday(id.upper()) - - if holiday < 0: - return "Couldn't find holiday " + id + '!' - - if base.cr.newsManager.endHoliday(holiday): - return 'Successfully stopped holiday ' + id + '!' - else: - return id + ' is not running!' + holiday = HolidayGlobals.getHoliday(id) + + self.activeHolidays.append(id) + self.broadcastHoliday(holiday, 'ongoingMessage' if ongoing else 'startMessage') + self.startSpecialHoliday(id) + + def endHoliday(self, id): + if id not in self.activeHolidays or id not in HolidayGlobals.Holidays: + return + + holiday = HolidayGlobals.getHoliday(id) + + self.activeHolidays.remove(id) + self.broadcastHoliday(holiday, 'endMessage') + self.endSpecialHoliday(id) + + def startSpecialHoliday(self, id): + if id == ToontownGlobals.LAUGHING_MAN: + for toon in base.cr.toons.values(): + toon.generateLaughingMan() + + def endSpecialHoliday(self, id): + if id == ToontownGlobals.LAUGHING_MAN: + for toon in base.cr.toons.values(): + toon.swapToonHead(laughingMan=toon.getWantLaughingMan()) \ No newline at end of file diff --git a/toontown/ai/NewsManagerAI.py b/toontown/ai/NewsManagerAI.py index 9753e89f..ec6bc480 100755 --- a/toontown/ai/NewsManagerAI.py +++ b/toontown/ai/NewsManagerAI.py @@ -1,77 +1,68 @@ -from direct.directnotify.DirectNotifyGlobal import directNotify from direct.distributed.DistributedObjectAI import DistributedObjectAI +from direct.task import Task +from datetime import datetime +from toontown.toonbase import ToontownGlobals +import HolidayGlobals class NewsManagerAI(DistributedObjectAI): - notify = directNotify.newCategory('NewsManagerAI') + def __init__(self, air): + DistributedObjectAI.__init__(self, air) + self.activeHolidays = [] + def announceGenerate(self): DistributedObjectAI.announceGenerate(self) - + self.__checkHolidays() + self.checkTask = taskMgr.doMethodLater(15, self.__checkHolidays, 'holidayCheckTask') self.accept('avatarEntered', self.__handleAvatarEntered) + + def delete(self): + DistributedObjectAI.delete(self) + taskMgr.remove(self.checkTask) - def __handleAvatarEntered(self, avatar): - if self.air.suitInvasionManager.getInvading(): - self.air.suitInvasionManager.notifyInvasionBulletin(avatar.getDoId()) + def __handleAvatarEntered(self, av): + avId = av.getDoId() + + self.sendUpdateToAvatarId(avId, 'startHolidays', [self.activeHolidays]) + + def __checkHolidays(self, task=None): + date = datetime.now() - def isHolidayRunning(self, holidayId): - return False + for id in HolidayGlobals.Holidays: + holiday = HolidayGlobals.Holidays[id] + running = self.isHolidayRunning(id) + + if ('weekDay' not in holiday or date.weekday() == holiday['weekDay']) and ('startMonth' not in holiday or holiday['startMonth'] <= date.month <= holiday['endMonth']) and ('startDay' not in holiday or holiday['startDay'] <= date.day <= holiday['endDay']): + if not running: + self.startHoliday(id) + elif running: + self.endHoliday(id) - def setPopulation(self, todo0): - pass + return Task.again - def setBingoWin(self, todo0): - pass + def isHolidayRunning(self, id): + return id in self.activeHolidays - def setBingoStart(self): - pass + def startHoliday(self, id): + if id in self.activeHolidays or id not in HolidayGlobals.Holidays: + return - def setBingoEnd(self): - pass + self.activeHolidays.append(id) + self.startSpecialHoliday(id) + self.sendUpdate('startHoliday', [id]) + + def endHoliday(self, id): + if id not in self.activeHolidays or id not in HolidayGlobals.Holidays: + return - def setCircuitRaceStart(self): - pass + self.activeHolidays.remove(id) + self.endSpecialHoliday(id) + self.sendUpdate('endHoliday', [id]) + + def startSpecialHoliday(self, id): + if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY: + messenger.send('checkBingoState') - def setCircuitRaceEnd(self): - pass - - def setInvasionStatus(self, msgType, cogType, numRemaining, skeleton): - self.sendUpdate('setInvasionStatus', args=[msgType, cogType, numRemaining, skeleton]) - - def setHolidayIdList(self, holidays): - self.sendUpdate('setHolidayIdList', holidays) - - def holidayNotify(self): - pass - - def setWeeklyCalendarHolidays(self, todo0): - pass - - def getWeeklyCalendarHolidays(self): - return [] - - def setYearlyCalendarHolidays(self, todo0): - pass - - def getYearlyCalendarHolidays(self): - return [] - - def setOncelyCalendarHolidays(self, todo0): - pass - - def getOncelyCalendarHolidays(self): - return [] - - def setRelativelyCalendarHolidays(self, todo0): - pass - - def getRelativelyCalendarHolidays(self): - return [] - - def setMultipleStartHolidays(self, todo0): - pass - - def getMultipleStartHolidays(self): - return [] - - def sendSystemMessage(self, todo0, todo1): - pass \ No newline at end of file + def endSpecialHoliday(self, id): + if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY: + messenger.send('checkBingoState') \ No newline at end of file diff --git a/toontown/parties/PartyPlanner.py b/toontown/parties/PartyPlanner.py index 716d2f2f..1524463a 100755 --- a/toontown/parties/PartyPlanner.py +++ b/toontown/parties/PartyPlanner.py @@ -159,7 +159,7 @@ class PartyPlanner(DirectFrame, FSM): if hasattr(base.cr, 'newsManager') and base.cr.newsManager: if ToontownGlobals.VICTORY_PARTY_HOLIDAY in base.cr.newsManager.getHolidayIdList(): defaultInviteTheme = PartyGlobals.InviteTheme.VictoryParty - elif ToontownGlobals.KARTING_TICKETS_HOLIDAY in base.cr.newsManager.getHolidayIdList() or ToontownGlobals.CIRCUIT_RACING_EVENT in base.cr.newsManager.getHolidayIdList(): + elif ToontownGlobals.KARTING_TICKETS_HOLIDAY in base.cr.newsManager.getHolidayIdList() or ToontownGlobals.GRAND_PRIX in base.cr.newsManager.getHolidayIdList(): defaultInviteTheme = PartyGlobals.InviteTheme.Racing elif ToontownGlobals.VALENTINES_DAY in base.cr.newsManager.getHolidayIdList(): defaultInviteTheme = PartyGlobals.InviteTheme.Valentoons diff --git a/toontown/toon/LaughingManGlobals.py b/toontown/toon/LaughingManGlobals.py index dbe48c7d..980dac5e 100755 --- a/toontown/toon/LaughingManGlobals.py +++ b/toontown/toon/LaughingManGlobals.py @@ -40,9 +40,4 @@ def addHeadEffect(head, book=False): def addToonEffect(toon): for lod in toon.getLODNames(): - addHeadEffect(toon.getPart('head', lod)) - -""" -from toontown.toon import LaughingManGlobals -LaughingManGlobals.addToonEffect(base.localAvatar) -""" + addHeadEffect(toon.getPart('head', lod)) \ No newline at end of file diff --git a/toontown/toon/Toon.py b/toontown/toon/Toon.py index 81774ec3..4afcc323 100755 --- a/toontown/toon/Toon.py +++ b/toontown/toon/Toon.py @@ -839,8 +839,7 @@ class Toon(Avatar.Avatar, ToonHead): del self._Actor__commonBundleHandles['head'] if headStyle > -1: self.style.head = headStyle - if laughingMan > -1: - self.style.laughingMan = True if laughingMan else self.getWantLaughingManHoliday() + laughingMan = laughingMan or self.style.laughingMan or self.getWantLaughingManHoliday() self.generateToonHead(copy) self.generateToonColor() self.parentToonParts() @@ -848,7 +847,7 @@ class Toon(Avatar.Avatar, ToonHead): self.resetHeight() self.eyelids.request('open') self.startLookAround() - if self.style.laughingMan: + if laughingMan: LaughingManGlobals.addToonEffect(self) def generateToonColor(self): diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 37a2c66c..10b6da76 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -7214,6 +7214,9 @@ FishBingoTypeCorners = 'Four Corners' FishBingoTypeDiagonal = 'Diagonals' FishBingoTypeThreeway = 'Three Way' FishBingoTypeBlockout = 'BLOCKOUT!' +SillySaturdayStart = "It's time for Silly Saturday! Saturdays are silly with Fish Bingo and Grand Prix throughout the day!" +SillySaturdayOngoing = 'Welcome! Silly Saturday is currently in progress.' +SillySaturdayEnd = 'Silly Saturday is over. Hope you had fun. See you next week!' FishBingoStart = "It's time for Fish Bingo! Go to any available pier to play!" FishBingoOngoing = 'Welcome! Fish Bingo is currently in progress.' FishBingoEnd = 'Hope you had fun playing Fish Bingo.' @@ -7972,6 +7975,8 @@ BlackCatHolidayStart = 'Create a Black Cat - Today only!' BlackCatHolidayEnd = 'Black Cat day has ended!' SpookyBlackCatHolidayStart = 'Friday 13th means a Black Cat blast!' LaughingManHolidayStart = 'Today is the day of the Laughing Man!' +LaughingManHolidayOngoing = 'Welcome! The day of the Laughing Man is currently in progress.' +LaughingManHolidayEnd = 'The day of the Laughing Man has ended. Hope you had fun!' TopToonsMarathonStart = "The Top Toons New Year's Day Marathon has begun!" TopToonsMarathonEnd = "The Top Toons New Year's Day Marathon has ended." WinterDecorationsStart = "It's Winter Holiday time in Toontown!" @@ -8218,13 +8223,12 @@ HolidayNamesInCalendar = {1: ('Summer Fireworks', 'Celebrate Summer with a firew 4: ('Winter Holiday', 'Celebrate the Winter Holiday with Toontastic decorations, party and Cattlelog items, and more!'), 5: ('Skelecog Invasion', 'Stop the Skelecogs from invading Toontown!'), 6: ('Mr. Hollywood Invasion', 'Stop the Mr. Hollywood Cogs from invading Toontown!'), - 7: ('Fish Bingo', 'Fish Bingo Wednesday! Everyone at the pond works together to complete the card before time runs out.'), 8: ('Toon Species Election', 'Vote on the new Toon species! Will it be Goat? Will it be Pig?'), 9: ('Black Cat Day', 'Happy Halloween! Create a Toontastic Black Cat Toon - Today Only!'), 13: ('Trick or Treat', 'Happy Halloween! Trick or treat throughout Toontown to get a nifty Halloween pumpkin head reward!'), - 14: ('Grand Prix', 'Grand Prix Monday at Goofy Speedway! To win, collect the most points in three consecutive races!'), - 16: ('Grand Prix Weekend', 'Toons compete in circuit races at Goofy Speedway!'), - 19: ('Silly Saturdays', 'Saturdays are silly with Fish Bingo and Grand Prix throughout the day!'), + 16: ('Grand Prix', 'Grand Prix Monday at Goofy Speedway! To win, collect the most points in three consecutive races!'), + 17: ('Fish Bingo', 'Fish Bingo Wednesday! Everyone at the pond works together to complete the card before time runs out.'), + 18: ('Silly Saturdays', 'Saturdays are silly with Fish Bingo and Grand Prix throughout the day!'), 24: ('Ides of March', 'Beware the Ides of March! Stop the Backstabber Cogs from invading Toontown!'), 26: ('Halloween Decor', 'Celebrate Halloween as spooky trees and streetlights transform Toontown!'), 28: ('Winter Invasion', 'The sellbots are on the loose spreading their cold sales tactics!'), diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index c32e2736..be37d139 100755 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -831,7 +831,6 @@ HALLOWEEN = 3 WINTER_DECORATIONS = 4 SKELECOG_INVASION = 5 MR_HOLLYWOOD_INVASION = 6 -FISH_BINGO_NIGHT = 7 BLACK_CAT_DAY = 9 RESISTANCE_EVENT = 10 KART_RECORD_DAILY_RESET = 11 @@ -839,9 +838,9 @@ KART_RECORD_WEEKLY_RESET = 12 TRICK_OR_TREAT = 13 CIRCUIT_RACING = 14 POLAR_PLACE_EVENT = 15 -CIRCUIT_RACING_EVENT = 16 -SILLY_SATURDAY_BINGO = 19 -SILLY_SATURDAY_CIRCUIT = 20 +GRAND_PRIX = 16 +FISH_BINGO = 17 +SILLY_SATURDAY = 18 BOSSCOG_INVASION = 23 MARCH_INVASION = 24 MORE_XP_HOLIDAY = 25