diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 0f6c92f8..a1909d2f 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -150,7 +150,7 @@ dclass DistributedPlayer : DistributedAvatar { setSC(uint16 msgIndex) broadcast ownsend airecv; setSCCustom(uint16 msgIndex) broadcast ownsend airecv; setFriendsList(uint32[] = []) ownrecv required db airecv; - setDISLid(uint32 = 0) broadcast ownrecv ram db airecv required; + setDISLid(uint32 = 0) airecv ram db; setWishName(string = "") db ram; setWishNameState(string = "OPEN") db ram; setAdminAccess(uint16 = 0) required broadcast ownrecv db; @@ -329,15 +329,11 @@ from toontown.coghq import DistributedSinkingPlatform/AI from toontown.suit import DistributedGoon/AI from toontown.suit import DistributedGridGoon/AI from toontown.coghq import BattleBlocker/AI -from toontown.ai import DistributedAprilToonsMgr/AI from toontown.ai import DistributedBlackCatMgr/AI from toontown.ai import DistributedReportMgr/AI from toontown.ai import DistributedPolarPlaceEffectMgr/AI -from toontown.ai import DistributedGreenToonEffectMgr/AI +from toontown.ai import DistributedEffectMgr/AI from toontown.ai import DistributedResistanceEmoteMgr/AI -from toontown.ai import DistributedScavengerHuntTarget/AI -from toontown.ai import DistributedTrickOrTreatTarget/AI -from toontown.ai import DistributedWinterCarolingTarget/AI from toontown.coghq import DistributedMint/AI from toontown.coghq import DistributedMintRoom/AI from toontown.coghq import DistributedMintBattle/AI @@ -559,7 +555,7 @@ dclass ToontownDistrict : DistributedDistrict { }; dclass ToontownDistrictStats : DistributedObject { - settoontownDistrictId(uint32) broadcast required ram; + setDistrictId(uint32) broadcast required ram; setAvatarCount(uint32) broadcast required ram; setInvasionStatus(uint8) broadcast required ram; }; @@ -641,7 +637,7 @@ dclass DistributedToon : DistributedPlayer { setSpeedChatStyleIndex(uint8 = 1) required ownsend broadcast db; setTrophyScore(uint16) broadcast ownrecv ram; setTeleportAccess(uint32[] = []) required ownrecv db; - setScavengerHunt(uint32[] = []) required ownrecv db; + setScavengerHunt(uint16[] = []) required ownrecv db; checkTeleportAccess(uint16) airecv ownsend; setTeleportOverride(uint8) clsend airecv; battleSOS(uint32) ownrecv clsend; @@ -718,9 +714,6 @@ dclass DistributedToon : DistributedPlayer { setCurrentKart(uint32) broadcast ownrecv ram; squish(uint8) ownsend airecv; announceBingo() broadcast ownrecv; - trickOrTreatTargetMet(uint32) ownrecv; - trickOrTreatMilestoneMet() ownrecv; - winterCarolingTargetMet(uint32) ownrecv; setCogSummonsEarned(uint8[] = [0*32]) required ownrecv db; reqCogSummons(char [0-256], uint32) ownsend airecv; cogSummonsResponse(string, uint32, uint32) ownrecv; @@ -733,7 +726,6 @@ dclass DistributedToon : DistributedPlayer { setGolfCourseBest(uint8 [3] = [0*3]) required ownrecv db; setUnlimitedSwing(uint8) broadcast ownrecv ram; logSuspiciousEvent(char [0-1024]) ownsend airecv; - logMessage(char [0-1024]) ownsend airecv; forceLogoutWithNotify() ownrecv; setPinkSlips(uint8 = 0) required ownrecv db; setNametagStyle(uint8 = 0) required broadcast ownrecv db; @@ -750,12 +742,12 @@ dclass DistributedToon : DistributedPlayer { setPartyStatus(uint64, uint8) ownrecv airecv; announcePartyStarted(uint64) ownrecv; setNeverStartedPartyRefunded(uint64, int8, uint16) ownrecv; - setDISLid(uint32) ram db airecv; setAnimalSound(uint8 index) ram broadcast ownrecv; setBuffs(uint32[] = []) required ownrecv db; setRedeemedCodes(string [] = []) required ownrecv db; setEmblems(uint32[] = [0, 0]) required ownrecv db; setTrueFriends(uint32[] = []) required clsend ownrecv db; + setNextKnockHeal(uint32) ram airecv; }; dclass DistributedPartyGate : DistributedObject { @@ -1210,8 +1202,6 @@ dclass DistributedTargetGame : DistributedMinigame { }; dclass EstateManager : DistributedObject { - startAprilFools() broadcast; - stopAprilFools() broadcast; getEstateZone(uint32 avId) airecv clsend; setEstateZone(uint32 ownerId, uint32 zoneId); setAvHouseId(uint32, uint32[]) broadcast; @@ -1498,55 +1488,11 @@ dclass GroupManager : DistributedObject { removePlayerFromGroup(uint32, uint32) clsend airecv; }; -struct weeklyCalendarHoliday { - uint8 holidayId; - uint8 dayOfTheWeek; -}; - -struct yearlyCalendarHoliday { - uint8 holidayId; - uint8[] firstStartTime; - uint8[] lastEndTime; -}; - -struct oncelyCalendarHoliday { - uint8 holidayId; - uint16[] firstStartTime; - uint16[] lastEndTime; -}; - -struct relativelyCalendarHoliday { - uint8 holidayId; - uint16[] firstStartTime; - uint16[] lastEndTime; -}; - -struct startAndEndTime { - uint16[] startTime; - uint16[] endTime; -}; - -struct multipleStartHoliday { - uint8 holidayId; - startAndEndTime times[]; -}; - dclass NewsManager : DistributedObject { - setPopulation(uint32) broadcast ram; - setBingoWin(uint32) broadcast ram; - setBingoStart() broadcast; - setBingoEnd() broadcast; - setCircuitRaceStart() broadcast; - setCircuitRaceEnd() broadcast; + startHoliday(uint8) broadcast; + endHoliday(uint8) broadcast; + setActiveHolidays(uint8[]); 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; }; dclass PurchaseManager : DistributedObject { @@ -1791,7 +1737,7 @@ dclass DistributedCogHQDoor : DistributedDoor { }; dclass DistributedCogHQExteriorDoor : DistributedCogHQDoor { - selectLobby(uint32) broadcast ram; + selectLobby(uint32) broadcast; confirmEntrance(uint32, bool) airecv clsend; }; @@ -1893,6 +1839,7 @@ dclass DistributedNPCGlove : DistributedNPCToonBase { }; dclass DistributedKnockKnockDoor : DistributedAnimatedProp { + requestToonup() airecv clsend; }; dclass DistributedElevator : DistributedObject { @@ -2433,12 +2380,6 @@ dclass DistributedPetProxy : DistributedPet { setDominantMood(string) broadcast ram; }; -dclass DistributedAprilToonsMgr : DistributedObject { - setEventActive(uint8 eventId, bool) broadcast; - requestEventsList() clsend airecv; - requestEventsListResp(uint8 []); -}; - dclass DistributedBlackCatMgr : DistributedObject { doBlackCatTransformation() broadcast; requestBlackCatTransformation() airecv clsend; @@ -2452,28 +2393,16 @@ dclass DistributedPolarPlaceEffectMgr : DistributedObject { addPolarPlaceEffect() airecv clsend; }; -dclass DistributedGreenToonEffectMgr : DistributedObject { - addGreenToonEffect() airecv clsend; +dclass DistributedEffectMgr : DistributedObject { + setHoliday(uint8) required broadcast; + requestEffect() airecv clsend; + effectDone(uint8); }; dclass DistributedResistanceEmoteMgr : DistributedObject { addResistanceEmote() clsend airecv; }; -dclass DistributedScavengerHuntTarget : DistributedObject { - attemptScavengerHunt() airecv clsend; -}; - -dclass DistributedTrickOrTreatTarget : DistributedObject { - doScavengerHunt(int8); - requestScavengerHunt() airecv clsend; -}; - -dclass DistributedWinterCarolingTarget : DistributedObject { - doScavengerHunt(int8) broadcast; - requestScavengerHunt() airecv clsend; -}; - dclass DistributedVehicle : DistributedSmoothNode { setOwner(uint32) required broadcast ram; setState(char, uint32) broadcast ram; @@ -3202,27 +3131,27 @@ dclass DistributedPartyManager : DistributedObject { }; dclass GlobalLobbyManager : DistributedObjectGlobal { - lobbyManagerAIHello(uint32 channel); - queryLobby(uint32 hostId); - addLobby(DoId avId, uint64 lobbyId); - toonJoinedLobby(uint64 lobbyId, uint32 avId); - toonLeftLobby(uint64 lobbyId, uint32 avId); - requestLobbySlot(uint64 lobbyId, uint32 avId); - lobbyDone(uint64 lobbyId); - allocIds(uint16 count); + lobbyManagerAIHello(uint32 channel); + queryLobby(uint32 hostId); + addLobby(DoId avId, uint64 lobbyId); + toonJoinedLobby(uint64 lobbyId, uint32 avId); + toonLeftLobby(uint64 lobbyId, uint32 avId); + requestLobbySlot(uint64 lobbyId, uint32 avId); + lobbyDone(uint64 lobbyId); + allocIds(uint16 count); }; dclass GlobalPartyManager : DistributedObjectGlobal { - partyManagerAIHello(uint32 channel); - queryParty(uint32 hostId); - addParty(DoId avId, uint64 partyId, string start, string end, int8 isPrivate, - int8 inviteTheme, activity [], decoration [], DoIdList inviteeIds); - partyHasStarted(uint64 partyId, uint32 shardId, uint32 zoneId, string hostName); - toonJoinedParty(uint64 partyId, uint32 avId); - toonLeftParty(uint64 partyId, uint32 avId); - requestPartySlot(uint64 partyId, uint32 avId, uint32 gateId); - partyDone(uint64 partyId); - allocIds(uint16 count); + partyManagerAIHello(uint32 channel); + queryParty(uint32 hostId); + addParty(DoId avId, uint64 partyId, string start, string end, int8 isPrivate, + int8 inviteTheme, activity [], decoration [], DoIdList inviteeIds); + partyHasStarted(uint64 partyId, uint32 shardId, uint32 zoneId, string hostName); + toonJoinedParty(uint64 partyId, uint32 avId); + toonLeftParty(uint64 partyId, uint32 avId); + requestPartySlot(uint64 partyId, uint32 avId, uint32 gateId); + partyDone(uint64 partyId); + allocIds(uint16 count); }; struct PotentialToon { @@ -3322,4 +3251,4 @@ dclass TTSFriendsManager : DistributedObjectGlobal { }; dclass ARGManager : DistributedObjectGlobal { -}; +}; \ No newline at end of file diff --git a/dependencies/config/events/grand-opening.prc b/dependencies/config/events/grand-opening.prc deleted file mode 100644 index a9de8ebe..00000000 --- a/dependencies/config/events/grand-opening.prc +++ /dev/null @@ -1,38 +0,0 @@ -# Safe zones: -want-donalds-dock #f -want-daisys-garden #f -want-minnies-melodyland #f -want-the-burrrgh #f -want-donalds-dreamland #f -want-goofy-speedway #f -want-outdoor-zone #f -want-golf-zone #f - -# Safe zone settings: -want-treasure-planners #f - -# Cog headquarters: -want-cog-headquarters #f - -# Trolley minigames: -want-minigames #f - -# Cog buildings: -silly-street-building-min 14 -silly-street-building-max 14 -silly-street-building-chance 100.0 -loopy-lane-building-min 14 -loopy-lane-building-max 14 -loopy-lane-building-chance 100.0 -punchline-place-building-min 14 -punchline-place-building-max 14 -punchline-place-building-chance 100.0 - -# Core features: -want-fishing #f -want-housing #f -want-pets #f -want-parties #t - -# Optional: -want-talkative-tyler #f diff --git a/dependencies/config/holidays/christmas.prc b/dependencies/config/holidays/christmas.prc deleted file mode 100644 index fbd0cec4..00000000 --- a/dependencies/config/holidays/christmas.prc +++ /dev/null @@ -1,2 +0,0 @@ -want-christmas #t -active-holidays 4, 57 \ No newline at end of file diff --git a/dependencies/config/holidays/halloween.prc b/dependencies/config/holidays/halloween.prc deleted file mode 100644 index f407096c..00000000 --- a/dependencies/config/holidays/halloween.prc +++ /dev/null @@ -1,2 +0,0 @@ -want-halloween #t -active-holidays 26, 27, 13 \ No newline at end of file diff --git a/dependencies/config/release/dev.prc b/dependencies/config/release/dev.prc index 944a04bf..03c7bf6e 100644 --- a/dependencies/config/release/dev.prc +++ b/dependencies/config/release/dev.prc @@ -38,4 +38,4 @@ show-population #t want-instant-parties #t cogdo-pop-factor 1.5 cogdo-ratio 0.5 -default-directnotify-level info +default-directnotify-level info \ No newline at end of file diff --git a/dependencies/config/release/en.prc b/dependencies/config/release/en.prc deleted file mode 100644 index cdd5644b..00000000 --- a/dependencies/config/release/en.prc +++ /dev/null @@ -1,2 +0,0 @@ -# Distribution: -distribution en diff --git a/dependencies/config/release/test.prc b/dependencies/config/release/test.prc deleted file mode 100644 index 43ec9cd0..00000000 --- a/dependencies/config/release/test.prc +++ /dev/null @@ -1,23 +0,0 @@ -# Distribution: -distribution test - -# Server: -server-version SERVER_VERSION -client-agents 8 -shard-low-pop 100 -shard-mid-pop 150 - -# Core features: -want-housing #t -want-pets #f -want-parties #t -want-cogdominiums #t -want-lawbot-cogdo #f -boarding-group-merges #t - -# Optional: -cogdo-pop-factor 1.5 -cogdo-ratio 0.4 - -# Staff events: -cfo-staff-event #f diff --git a/otp/ai/BanManagerAI.py b/otp/ai/BanManagerAI.py index 9b53f4a1..6cb300fd 100755 --- a/otp/ai/BanManagerAI.py +++ b/otp/ai/BanManagerAI.py @@ -122,8 +122,6 @@ def kick(reason='No reason specified'): Kick the target from the game server. """ target = spellbook.getTarget() - if target == spellbook.getInvoker(): - return "You can't kick yourself!" datagram = PyDatagram() datagram.addServerHeader( target.GetPuppetConnectionChannel(target.doId), diff --git a/otp/avatar/LocalAvatar.py b/otp/avatar/LocalAvatar.py index 07244010..872b63f8 100755 --- a/otp/avatar/LocalAvatar.py +++ b/otp/avatar/LocalAvatar.py @@ -28,7 +28,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis wantDevCameraPositions = base.config.GetBool('want-dev-camera-positions', 0) wantMouse = base.config.GetBool('want-mouse', 0) sleepTimeout = base.config.GetInt('sleep-timeout', 120) - swimTimeout = base.config.GetInt('afk-timeout', 600) __enableMarkerPlacement = base.config.GetBool('place-markers', 0) def __init__(self, cr, chatMgr, talkAssistant = None, passMessagesThrough = False): @@ -63,7 +62,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis self.sleepFlag = 0 self.isDisguised = 0 self.movingFlag = 0 - self.swimmingFlag = 0 self.lastNeedH = None self.accept('friendOnline', self.__friendOnline) self.accept('friendOffline', self.__friendOffline) @@ -977,42 +975,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis self.sleepCallback = None return - def startSleepSwimTest(self): - taskName = self.taskName('sleepSwimTest') - taskMgr.remove(taskName) - task = Task.Task(self.sleepSwimTest) - self.lastMoved = globalClock.getFrameTime() - self.lastState = None - self.lastAction = None - self.sleepSwimTest(task) - taskMgr.add(self.sleepSwimTest, taskName, 35) - return - - def stopSleepSwimTest(self): - taskName = self.taskName('sleepSwimTest') - taskMgr.remove(taskName) - self.stopSound() - - def sleepSwimTest(self, task): - now = globalClock.getFrameTime() - speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds() - if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'): - if not self.swimmingFlag: - self.swimmingFlag = 1 - elif self.swimmingFlag: - self.swimmingFlag = 0 - if self.swimmingFlag or self.hp <= 0: - self.wakeUp() - elif not self.sleepFlag: - now = globalClock.getFrameTime() - if now - self.lastMoved > self.swimTimeout: - self.swimTimeoutAction() - return Task.done - return Task.cont - - def swimTimeoutAction(self): - pass - def trackAnimToSpeed(self, task): speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds() if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'): diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 906398c2..ffbf1af1 100755 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -445,10 +445,6 @@ class OTPClientRepository(ClientRepositoryBase): def __handleLoginDone(self, doneStatus): mode = doneStatus['mode'] if mode == 'success': - if hasattr(self, 'toontownTimeManager'): - timestamp = time.gmtime(doneStatus['timestamp']) - dateString = time.strftime(self.toontownTimeManager.formatStr, timestamp) - self.lastLoggedIn = self.toontownTimeManager.convertStrToToontownTime(dateString) self.loginFSM.request('waitForGameList') elif mode == 'reject': self.loginFSM.request('reject') diff --git a/otp/otpbase/OTPLocalizerEnglish.py b/otp/otpbase/OTPLocalizerEnglish.py index 1713ab63..663d12a3 100755 --- a/otp/otpbase/OTPLocalizerEnglish.py +++ b/otp/otpbase/OTPLocalizerEnglish.py @@ -1618,20 +1618,6 @@ SpeedChatStaticTextToontown = {100: 'Hi!', 21206: 'Speak!', 30100: "Happy April Toons' Week!", 30101: "Welcome to my April Toons' Week party!", - 30102: 'The Silly Meter is back in Toon Hall!', - 30110: 'Mickey is in Daisy Gardens.', - 30111: 'Daisy is in Toontown Central.', - 30112: 'Minnie is in The Brrrgh.', - 30113: 'Pluto is in Melodyland.', - 30114: 'Donald is sleepwalking at the Speedway.', - 30115: 'Goofy is in Dreamland.', - 30120: 'Mickey is acting like Daisy!', - 30121: 'Daisy is acting like Mickey!', - 30122: 'Minnie is acting like Pluto!', - 30123: 'Pluto is acting like Minnie!', - 30124: 'Pluto is talking!', - 30125: 'Goofy is acting like Donald!', - 30126: 'Donald is dreaming he is Goofy!', 30130: 'Watch how far I can jump.', 30131: 'Wow, you jumped really far!', 30132: 'Hey, Doodles can talk!', @@ -2312,8 +2298,6 @@ KartRacingMenuSections = [-1, 'TAUNTS'] AprilToonsMenuSections = [-1, 'GREETINGS', - 'PLAYGROUNDS', - 'CHARACTERS', 'ESTATES'] SillyHolidayMenuSections = [-1, 'WORLD', 'BATTLE'] CarolMenuSections = [-1] diff --git a/otp/speedchat/SCStaticTextTerminal.py b/otp/speedchat/SCStaticTextTerminal.py index e7250983..64ce7266 100755 --- a/otp/speedchat/SCStaticTextTerminal.py +++ b/otp/speedchat/SCStaticTextTerminal.py @@ -3,8 +3,10 @@ from otp.otpbase.OTPLocalizer import SpeedChatStaticText SCStaticTextMsgEvent = 'SCStaticTextMsg' def decodeSCStaticTextMsg(textId): - return SpeedChatStaticText.get(textId, None) + if 30200 <= textId <= 30205: + textId += 20 + return SpeedChatStaticText.get(textId, None) class SCStaticTextTerminal(SCTerminal): diff --git a/toontown/ai/DistributedAprilToonsMgr.py b/toontown/ai/DistributedAprilToonsMgr.py deleted file mode 100755 index 2012cee0..00000000 --- a/toontown/ai/DistributedAprilToonsMgr.py +++ /dev/null @@ -1,43 +0,0 @@ -from direct.distributed.DistributedObject import DistributedObject -from direct.directnotify import DirectNotifyGlobal -from toontown.toonbase.AprilToonsGlobals import * -from toontown.toonbase import ToontownGlobals - -class DistributedAprilToonsMgr(DistributedObject): - notify = DirectNotifyGlobal.directNotify.newCategory('AprilToonsMgr') - - def __init__(self, cr): - DistributedObject.__init__(self, cr) - cr.aprilToonsMgr = self - self.events = [] - - def announceGenerate(self): - DistributedObject.announceGenerate(self) - self.d_requestEventsList() - - def d_requestEventsList(self): - self.notify.debug("Requesting events list from AI.") - self.sendUpdate('requestEventsList', []) - - def requestEventsListResp(self, eventIds): - self.events = eventIds - self.checkActiveEvents() - - def isEventActive(self, eventId): - # NOTE: Possible race condition where the client checks for if an event is active - # *before* it gets a response from the AI. - if not base.cr.config.GetBool('want-april-toons', False): - # If this DO is generated but we don't want april toons, always return - # false regardless. - return False - return eventId in self.events - - def setEventActive(self, eventId, active): - if active and eventId not in self.events: - self.events.append(eventId) - elif not active and eventId in self.events: - del self.events[eventId] - - def checkActiveEvents(self): - if self.isEventActive(EventGlobalGravity): - base.localAvatar.controlManager.currentControls.setGravity(ToontownGlobals.GravityValue * 0.75) diff --git a/toontown/ai/DistributedAprilToonsMgrAI.py b/toontown/ai/DistributedAprilToonsMgrAI.py deleted file mode 100755 index 98c5ae7d..00000000 --- a/toontown/ai/DistributedAprilToonsMgrAI.py +++ /dev/null @@ -1,35 +0,0 @@ -from direct.distributed.DistributedObjectAI import DistributedObjectAI -from otp.ai.MagicWordGlobal import * -from direct.task import Task -from toontown.toonbase.AprilToonsGlobals import * - -class DistributedAprilToonsMgrAI(DistributedObjectAI): - def __init__(self, air): - DistributedObjectAI.__init__(self, air) - # Define the default events we want for this year - self.events = [EventRandomDialogue, - EventRandomEffects, - EventEstateGravity, - EventGlobalGravity] - - def getEvents(self): - return self.events - - def isEventActive(self, eventId): - if not self.air.config.GetBool('want-april-toons', False): - # If this DO is generated but we don't want april toons, always return - # false regardless. - return False - return eventId in self.events - - def requestEventsList(self): - avId = self.air.getAvatarIdFromSender() - self.sendUpdateToAvatarId(avId, 'requestEventsListResp', [self.getEvents()]) - - def toggleEvent(self, eventId): - if eventId in self.getEvents(): - del self.getEvents()[eventId] - self.sendUpdate('setEventActive', [eventId, False]) - else: - self.getEvents().append(eventId) - self.sendUpdate('setEventActive', [eventId, True]) diff --git a/toontown/ai/DistributedBlackCatMgrAI.py b/toontown/ai/DistributedBlackCatMgrAI.py index b8080bd0..28642714 100755 --- a/toontown/ai/DistributedBlackCatMgrAI.py +++ b/toontown/ai/DistributedBlackCatMgrAI.py @@ -13,7 +13,7 @@ class DistributedBlackCatMgrAI(DistributedObjectAI): avId = self.air.getAvatarIdFromSender() av = self.air.doId2do.get(avId) - if not av or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a: + if not av or av.getTutorialAck() or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a: return newDNA = ToonDNA() diff --git a/toontown/ai/DistributedEffectMgr.py b/toontown/ai/DistributedEffectMgr.py new file mode 100644 index 00000000..8a561d97 --- /dev/null +++ b/toontown/ai/DistributedEffectMgr.py @@ -0,0 +1,49 @@ +from direct.distributed.DistributedObject import DistributedObject +from otp.speedchat import SpeedChatGlobals +import HolidayGlobals, time + +class DistributedEffectMgr(DistributedObject): + + def __init__(self, cr): + DistributedObject.__init__(self, cr) + self.nextTime = 0 + + def delete(self): + self.ignoreAll() + DistributedObject.delete(self) + + def setHoliday(self, holiday): + self.holiday = holiday + self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.__saidPhrase) + + def __saidPhrase(self, phraseId): + if not self.cr.newsManager.isHolidayRunning(self.holiday): + return + + currentTime = time.time() + + if self.nextTime > currentTime: + return + + holidayInfo = HolidayGlobals.getHoliday(self.holiday) + + if 'speedchatIndexes' not in holidayInfo or phraseId not in holidayInfo['speedchatIndexes']: + return + + if 'effectDelay' in holidayInfo: + self.nextTime = currentTime + holidayInfo['effectDelay'] + + self.sendUpdate('requestEffect') + + def effectDone(self, amount): + holidayInfo = HolidayGlobals.getHoliday(self.holiday) + + self.cr.newsManager.broadcastHoliday(holidayInfo, 'effectMessage') + + if 'scavengerHunt' in holidayInfo: + type = holidayInfo['scavengerHunt'] + + if type == HolidayGlobals.TRICK_OR_TREAT: + base.localAvatar.trickOrTreatTargetMet(amount) + elif type == HolidayGlobals.WINTER_CAROLING: + base.localAvatar.winterCarolingTargetMet(amount) \ No newline at end of file diff --git a/toontown/ai/DistributedEffectMgrAI.py b/toontown/ai/DistributedEffectMgrAI.py new file mode 100644 index 00000000..f7c6cb0c --- /dev/null +++ b/toontown/ai/DistributedEffectMgrAI.py @@ -0,0 +1,43 @@ +from direct.distributed.DistributedObjectAI import DistributedObjectAI +import HolidayGlobals +import datetime + +class DistributedEffectMgrAI(DistributedObjectAI): + + def __init__(self, air, holiday, effectId): + DistributedObjectAI.__init__(self, air) + self.holiday = holiday + self.effectId = effectId + + def getHoliday(self): + return self.holiday + + def requestEffect(self): + if not self.air.newsManager.isHolidayRunning(self.holiday): + return + + avId = self.air.getAvatarIdFromSender() + av = self.air.doId2do.get(avId) + + if not av: + return + + holidayInfo = HolidayGlobals.getHoliday(self.holiday) + expireTime = int(HolidayGlobals.getServerTime(HolidayGlobals.getEndDate(holidayInfo) + datetime.timedelta(days=1)) / 60) + + if 'scavengerHunt' in holidayInfo: + scavengerHunt = av.getScavengerHunt() + + if self.zoneId in scavengerHunt: + self.sendUpdateToAvatarId(avId, 'effectDone', [0]) + else: + scavengerHunt.append(self.zoneId) + av.b_setScavengerHunt(scavengerHunt) + av.addMoney(HolidayGlobals.CAROLING_REWARD) + self.sendUpdateToAvatarId(avId, 'effectDone', [HolidayGlobals.CAROLING_REWARD]) + + if len(scavengerHunt) == HolidayGlobals.SCAVENGER_HUNT_LOCATIONS: + av.b_setCheesyEffect(self.effectId, 0, expireTime) + else: + av.b_setCheesyEffect(self.effectId, 0, expireTime) + self.sendUpdateToAvatarId(avId, 'effectDone', [0]) \ No newline at end of file diff --git a/toontown/ai/DistributedGreenToonEffectMgr.py b/toontown/ai/DistributedGreenToonEffectMgr.py deleted file mode 100755 index 8fe4c605..00000000 --- a/toontown/ai/DistributedGreenToonEffectMgr.py +++ /dev/null @@ -1,32 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed import DistributedObject -from direct.interval.IntervalGlobal import * -from otp.speedchat import SpeedChatGlobals -from toontown.toonbase import TTLocalizer - -class DistributedGreenToonEffectMgr(DistributedObject.DistributedObject): - notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGreenToonEffectMgr') - - def __init__(self, cr): - DistributedObject.DistributedObject.__init__(self, cr) - - def announceGenerate(self): - DistributedObject.DistributedObject.announceGenerate(self) - DistributedGreenToonEffectMgr.notify.debug('announceGenerate') - self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid) - - def phraseSaid(self, phraseId): - greenPhrase = 30450 - if phraseId == greenPhrase: - self.addGreenToonEffect() - - def delete(self): - self.ignore(SpeedChatGlobals.SCStaticTextMsgEvent) - DistributedObject.DistributedObject.delete(self) - - def addGreenToonEffect(self): - DistributedGreenToonEffectMgr.notify.debug('addGreenToonEffect') - av = base.localAvatar - self.sendUpdate('addGreenToonEffect', []) - msgTrack = Sequence(Func(av.setSystemMessage, 0, TTLocalizer.GreenToonEffectMsg)) - msgTrack.start() diff --git a/toontown/ai/DistributedGreenToonEffectMgrAI.py b/toontown/ai/DistributedGreenToonEffectMgrAI.py deleted file mode 100755 index ac6345e5..00000000 --- a/toontown/ai/DistributedGreenToonEffectMgrAI.py +++ /dev/null @@ -1,20 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.DistributedObjectAI import DistributedObjectAI -from direct.distributed.ClockDelta import * -from direct.fsm.FSM import FSM - -class DistributedGreenToonEffectMgrAI(DistributedObjectAI, FSM): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGreenToonEffectMgrAI") - - def __init__(self, air): - DistributedObjectAI.__init__(self, air) - FSM.__init__(self, 'GreenToonFSM') - self.air = air - - def enterOff(self): - self.requestDelete() - - def addGreenToonEffect(self): - avId = self.air.getAvatarIdFromSender() - av = self.air.doId2do.get(avId) - av.b_setCheesyEffect(15, 0, 0) diff --git a/toontown/ai/DistributedScavengerHuntTarget.py b/toontown/ai/DistributedScavengerHuntTarget.py deleted file mode 100755 index 3406e2a2..00000000 --- a/toontown/ai/DistributedScavengerHuntTarget.py +++ /dev/null @@ -1,40 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed import DistributedObject -from otp.speedchat import SpeedChatGlobals - -class DistributedScavengerHuntTarget(DistributedObject.DistributedObject): - notify = DirectNotifyGlobal.directNotify.newCategory('DistributedScavengerHuntTarget') - - def __init__(self, cr): - DistributedObject.DistributedObject.__init__(self, cr) - - def setupListenerDetails(self): - self.triggered = False - self.triggerDelay = 15 - self.accept(SpeedChatGlobals.SCCustomMsgEvent, self.phraseSaid) - - def phraseSaid(self, phraseId): - self.notify.debug('Checking if phrase was said') - helpPhrase = 10003 - - def reset(): - self.triggered = False - - if phraseId == helpPhrase and not self.triggered: - self.triggered = True - self.attemptScavengerHunt() - taskMgr.doMethodLater(self.triggerDelay, reset, 'ScavengerHunt-phrase-reset', extraArgs=[]) - - def announceGenerate(self): - DistributedObject.DistributedObject.announceGenerate(self) - DistributedScavengerHuntTarget.notify.debug('announceGenerate') - self.setupListenerDetails() - - def delete(self): - self.ignoreAll() - taskMgr.remove('ScavengerHunt-phrase-reset') - DistributedObject.DistributedObject.delete(self) - - def attemptScavengerHunt(self): - DistributedScavengerHuntTarget.notify.debug('attempScavengerHunt') - self.sendUpdate('attemptScavengerHunt', []) diff --git a/toontown/ai/DistributedScavengerHuntTargetAI.py b/toontown/ai/DistributedScavengerHuntTargetAI.py deleted file mode 100755 index 168ee9e4..00000000 --- a/toontown/ai/DistributedScavengerHuntTargetAI.py +++ /dev/null @@ -1,8 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.DistributedObjectAI import DistributedObjectAI - -class DistributedScavengerHuntTargetAI(DistributedObjectAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedScavengerHuntTargetAI") - - def attemptScavengerHunt(self): - pass diff --git a/toontown/ai/DistributedTrickOrTreatTarget.py b/toontown/ai/DistributedTrickOrTreatTarget.py deleted file mode 100755 index 66705b90..00000000 --- a/toontown/ai/DistributedTrickOrTreatTarget.py +++ /dev/null @@ -1,40 +0,0 @@ -from otp.speedchat import SpeedChatGlobals -from direct.directnotify import DirectNotifyGlobal -from direct.distributed import DistributedObject -from direct.interval.IntervalGlobal import * - -class DistributedTrickOrTreatTarget(DistributedObject.DistributedObject): - notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTrickOrTreatTarget') - - def __init__(self, cr): - DistributedObject.DistributedObject.__init__(self, cr) - self.triggered = False - self.triggerDelay = 15 - - def announceGenerate(self): - DistributedObject.DistributedObject.announceGenerate(self) - DistributedTrickOrTreatTarget.notify.debug('announceGenerate') - self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid) - - def phraseSaid(self, phraseId): - self.notify.debug('Checking if phrase was said') - helpPhrase = 10003 - - def reset(): - self.triggered = False - - if phraseId == helpPhrase and not self.triggered: - self.triggered = True - self.d_requestScavengerHunt() - taskMgr.doMethodLater(self.triggerDelay, reset, 'ScavengerHunt-phrase-reset', extraArgs=[]) - - def delete(self): - self.ignore(SpeedChatGlobals.SCStaticTextMsgEvent) - DistributedObject.DistributedObject.delete(self) - - def d_requestScavengerHunt(self): - self.sendUpdate('requestScavengerHunt', []) - - def doScavengerHunt(self, amount): - DistributedTrickOrTreatTarget.notify.debug('doScavengerHunt') - base.localAvatar.trickOrTreatTargetMet(amount) diff --git a/toontown/ai/DistributedTrickOrTreatTargetAI.py b/toontown/ai/DistributedTrickOrTreatTargetAI.py deleted file mode 100755 index 2f2ddd55..00000000 --- a/toontown/ai/DistributedTrickOrTreatTargetAI.py +++ /dev/null @@ -1,30 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.DistributedObjectAI import DistributedObjectAI -from direct.fsm.FSM import FSM - -class DistributedTrickOrTreatTargetAI(DistributedObjectAI, FSM): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedTrickOrTreatTargetAI") - - def __init__(self, air): - DistributedObjectAI.__init__(self, air) - FSM.__init__(self, 'TrickOrTreatTargeFSM') - self.air = air - - def enterOff(self): - self.requestDelete() - - def requestScavengerHunt(self): - avId = self.air.getAvatarIdFromSender() - av = self.air.doId2do.get(avId) - if av is None: - return - scavengerHunt = av.getScavengerHunt() - if self.zoneId in scavengerHunt: - self.sendUpdateToAvatarId(avId, 'doScavengerHunt', [0]) - else: - self.sendUpdateToAvatarId(avId, 'doScavengerHunt', [100]) - scavengerHunt.append(self.zoneId) - av.b_setScavengerHunt(scavengerHunt) - av.addMoney(100) - if len(scavengerHunt) == 6: - av.b_setCheesyEffect(12, 0, 0) diff --git a/toontown/ai/DistributedWinterCarolingTarget.py b/toontown/ai/DistributedWinterCarolingTarget.py deleted file mode 100755 index 1dea9523..00000000 --- a/toontown/ai/DistributedWinterCarolingTarget.py +++ /dev/null @@ -1,43 +0,0 @@ -from otp.speedchat import SpeedChatGlobals -from direct.directnotify import DirectNotifyGlobal -from direct.distributed import DistributedObject -from direct.interval.IntervalGlobal import * - -class DistributedWinterCarolingTarget(DistributedObject.DistributedObject): - notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWinterCarolingTarget') - - def __init__(self, cr): - DistributedObject.DistributedObject.__init__(self, cr) - self.triggered = False - self.triggerDelay = 15 - - def announceGenerate(self): - DistributedObject.DistributedObject.announceGenerate(self) - DistributedWinterCarolingTarget.notify.debug('announceGenerate') - self.accept(SpeedChatGlobals.SCStaticTextMsgEvent, self.phraseSaid) - - def phraseSaid(self, phraseId): - self.notify.debug('Checking if phrase was said') - helpPhrases = [] - for i in xrange(6): - helpPhrases.append(30220 + i) - - def reset(): - self.triggered = False - - if phraseId in helpPhrases and not self.triggered: - self.triggered = True - self.d_requestScavengerHunt() - taskMgr.doMethodLater(self.triggerDelay, reset, 'ScavengerHunt-phrase-reset', extraArgs=[]) - - def delete(self): - self.ignore(SpeedChatGlobals.SCStaticTextMsgEvent) - DistributedObject.DistributedObject.delete(self) - - def d_requestScavengerHunt(self): - self.sendUpdate('requestScavengerHunt', []) - - def doScavengerHunt(self, amount): - DistributedWinterCarolingTarget.notify.debug('doScavengerHunt') - av = base.localAvatar - av.winterCarolingTargetMet(amount) diff --git a/toontown/ai/DistributedWinterCarolingTargetAI.py b/toontown/ai/DistributedWinterCarolingTargetAI.py deleted file mode 100755 index 90bf9931..00000000 --- a/toontown/ai/DistributedWinterCarolingTargetAI.py +++ /dev/null @@ -1,29 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.DistributedObjectAI import DistributedObjectAI -from direct.fsm.FSM import FSM - -class DistributedWinterCarolingTargetAI(DistributedObjectAI, FSM): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedWinterCarolingTargetAI") - - def __init__(self, air): - DistributedObjectAI.__init__(self, air) - FSM.__init__(self, 'WinterCarolingFSM') - self.air = air - - def enterOff(self): - self.requestDelete() - - def requestScavengerHunt(self): - avId = self.air.getAvatarIdFromSender() - av = self.air.doId2do.get(avId) - if av is None: - return - scavengerHunt = av.getScavengerHunt() - if self.zoneId in scavengerHunt: - self.sendUpdate('doScavengerHunt', [0]) - else: - self.sendUpdate('doScavengerHunt', [100]) - scavengerHunt.append(self.zoneId) - av.b_setScavengerHunt(scavengerHunt) - if len(scavengerHunt) == 6: - av.b_setCheesyEffect(14, 0, 0) 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/HalloweenHolidayDecorator.py b/toontown/ai/HalloweenHolidayDecorator.py index bdd1800f..ce5cbbde 100755 --- a/toontown/ai/HalloweenHolidayDecorator.py +++ b/toontown/ai/HalloweenHolidayDecorator.py @@ -80,8 +80,7 @@ class HalloweenHolidayDecorator(HolidayDecorator.HolidayDecorator): for light in place.loader.hood.halloweenLights: light.setColorScaleOff(0) - holidayIds = base.cr.newsManager.getDecorationHolidayId() - if ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds and ToontownGlobals.SPOOKY_COSTUMES not in holidayIds: + if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN): return if (self.__checkHoodValidity() or self.__checkStreetValidity()) and hasattr(base.cr.playGame, 'hood') and base.cr.playGame.hood and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky: preShow = Sequence(Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 1.5, Vec4(1, 1, 1, 0.25)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(0.55, 0.55, 0.65, 1)), Func(__lightDecorationOn__)), Func(self.__startSpookySky)) @@ -97,8 +96,7 @@ class HalloweenHolidayDecorator(HolidayDecorator.HolidayDecorator): distributedEstate = base.cr.doFind('DistributedEstate') if distributedEstate: distributedEstate.unloadWitch() - holidayIds = base.cr.newsManager.getDecorationHolidayId() - if len(holidayIds) > 0: + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN): self.decorate() return storageFile = base.cr.playGame.hood.storageDNAFile diff --git a/toontown/ai/HolidayDecorator.py b/toontown/ai/HolidayDecorator.py index 6f9df79e..a90a95e2 100755 --- a/toontown/ai/HolidayDecorator.py +++ b/toontown/ai/HolidayDecorator.py @@ -1,4 +1,3 @@ -from toontown.toonbase import ToontownGlobals from direct.interval.IntervalGlobal import Parallel, Sequence, Func, Wait from pandac.PandaModules import Vec4, TransformState, NodePath, TransparencyAttrib @@ -21,10 +20,6 @@ class HolidayDecorator: self.swapIval.start() def undecorate(self): - holidayIds = base.cr.newsManager.getDecorationHolidayId() - if len(holidayIds) > 0: - self.decorate() - return storageFile = base.cr.playGame.hood.storageDNAFile if storageFile: loadDNAFile(self.dnaStore, storageFile, CSDefault) @@ -34,10 +29,11 @@ class HolidayDecorator: def updateHoodDNAStore(self): hood = base.cr.playGame.hood - holidayIds = base.cr.newsManager.getDecorationHolidayId() - for holiday in holidayIds: - for storageFile in hood.holidayStorageDNADict.get(holiday, []): - loadDNAFile(self.dnaStore, storageFile, CSDefault) + + for key, value in self.holidayStorageDNADict.iteritems(): + if base.cr.newsManager.isHolidayRunning(key): + for storageFile in value: + loadDNAFile(self.dnaStore, storageFile, CSDefault) def getSwapVisibleIval(self, wait = 5.0, tFadeOut = 3.0, tFadeIn = 3.0): loader = base.cr.playGame.hood.loader @@ -65,4 +61,4 @@ class HolidayDecorator: s = Sequence(Wait(wait), np.colorScaleInterval(tFadeOut, Vec4(1, 1, 1, 0), startColorScale=Vec4(1, 1, 1, 1), blendType='easeInOut'), Func(np.detachNode), Func(np.clearTransparency), newNP.colorScaleInterval(tFadeOut, Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0), blendType='easeInOut'), Func(newNP.clearTransparency), Func(newNP.clearColorScale)) p.append(s) - return p + return p \ No newline at end of file diff --git a/toontown/ai/HolidayGlobals.py b/toontown/ai/HolidayGlobals.py new file mode 100644 index 00000000..c5f44a6a --- /dev/null +++ b/toontown/ai/HolidayGlobals.py @@ -0,0 +1,152 @@ +from toontown.toonbase import ToontownGlobals, TTLocalizer +from toontown.parties import ToontownTimeZone +import calendar, datetime + +TIME_ZONE = ToontownTimeZone.ToontownTimeZone() +TRICK_OR_TREAT = 0 +WINTER_CAROLING = 1 +CAROLING_REWARD = 100 +SCAVENGER_HUNT_LOCATIONS = 6 + +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 + }, + ToontownGlobals.BLACK_CAT_DAY: { + 'startDay': 13, + 'endDay': 13, + 'startMessage': TTLocalizer.BlackCatHolidayStart, + 'ongoingMessage': TTLocalizer.BlackCatHolidayStart, + 'endMessage': TTLocalizer.BlackCatHolidayEnd + }, + ToontownGlobals.APRIL_TOONS_WEEK: { + 'startMonth': 4, + 'startDay': 1, + 'endMonth': 4, + 'endDay': 7, + 'startMessage': TTLocalizer.AprilToonsWeekStart, + 'ongoingMessage': TTLocalizer.AprilToonsWeekStart, + 'endMessage': TTLocalizer.AprilToonsWeekEnd + }, + ToontownGlobals.IDES_OF_MARCH: { + 'startMonth': 3, + 'startDay': 14, + 'endMonth': 3, + 'endDay': 20, + 'startMessage': TTLocalizer.IdesOfMarchStart, + 'ongoingMessage': TTLocalizer.IdesOfMarchStart, + 'endMessage': TTLocalizer.IdesOfMarchEnd, + 'speedchatIndexes': [30450], # It's easy to be green! + 'effectMessage': TTLocalizer.GreenToonEffectMsg, + 'effectDelay': 10 + }, + ToontownGlobals.CHRISTMAS: { + 'startMonth': 12, + 'startDay': 14, + 'endMonth': 1, + 'endDay': 4, + 'startMessage': TTLocalizer.WinterCarolingStart, + 'ongoingMessage': TTLocalizer.WinterCarolingStart, + 'endMessage': TTLocalizer.WinterCarolingEnd, + 'speedchatIndexes': range(30200, 30206), + 'effectDelay': 15, + 'scavengerHunt': WINTER_CAROLING + }, + ToontownGlobals.HALLOWEEN: { + 'startMonth': 10, + 'startDay': 13, + 'endMonth': 10, + 'endDay': 31, + 'startMessage': TTLocalizer.TrickOrTreatStart, + 'ongoingMessage': TTLocalizer.TrickOrTreatStart, + 'endMessage': TTLocalizer.TrickOrTreatEnd, + 'speedchatIndexes': [10003], + 'effectDelay': 15, + 'scavengerHunt': TRICK_OR_TREAT + }, + ToontownGlobals.SUMMER_FIREWORKS: { + 'startMonth': 6, + 'startDay': 30, + 'endMonth': 7, + 'endDay': 15, + 'startMessage': TTLocalizer.SummerFireworksStart, + 'ongoingMessage': TTLocalizer.SummerFireworksStart, + 'endMessage': TTLocalizer.SummerFireworksEnd + }, + ToontownGlobals.NEW_YEAR_FIREWORKS: { + 'startMonth': 12, + 'startDay': 31, + 'endMonth': 1, + 'endDay': 7, + 'startMessage': TTLocalizer.NewYearFireworksStart, + 'ongoingMessage': TTLocalizer.NewYearFireworksStart, + 'endMessage': TTLocalizer.NewYearFireworksEnd + }, + ToontownGlobals.VALENTOONS_DAY: { + 'startMonth': 2, + 'startDay': 9, + 'endMonth': 2, + 'endDay': 16, + 'startMessage': TTLocalizer.ValentinesDayStart, + 'ongoingMessage': TTLocalizer.ValentinesDayStart, + 'endMessage': TTLocalizer.ValentinesDayEnd + } +} + +def getHoliday(id): + return Holidays.get(id, {}) + +def getServerTime(date): + epoch = datetime.datetime.fromtimestamp(0, TIME_ZONE) + delta = date - epoch + + return delta.total_seconds() + +def getStartDate(holiday, rightNow=None): + if not rightNow: + rightNow = datetime.datetime.now() + + startMonth = holiday['startMonth'] if 'startMonth' in holiday else rightNow.month + startDay = holiday['startDay'] if 'startDay' in holiday else (rightNow.day if 'weekDay' in holiday else calendar.monthrange(rightNow.year, startMonth)[0]) + startDate = datetime.datetime(rightNow.year, startMonth, startDay, tzinfo=TIME_ZONE) + + return startDate + +def getEndDate(holiday, rightNow=None): + if not rightNow: + rightNow = datetime.datetime.now() + + endMonth = holiday['endMonth'] if 'endMonth' in holiday else rightNow.month + endDay = holiday['endDay'] if 'endDay' in holiday else (rightNow.day if 'weekDay' in holiday else calendar.monthrange(rightNow.year, endMonth)[1]) + endYear = rightNow.year + + if 'startMonth' in holiday and holiday['startMonth'] > endMonth: + endYear += 1 + + endDate = datetime.datetime(endYear, endMonth, endDay, tzinfo=TIME_ZONE) + + return endDate \ No newline at end of file diff --git a/toontown/ai/NewsManager.py b/toontown/ai/NewsManager.py index f18a7361..367c48e6 100755 --- a/toontown/ai/NewsManager.py +++ b/toontown/ai/NewsManager.py @@ -1,724 +1,105 @@ -from otp.ai.MagicWordGlobal import * -from panda3d.core import * -from direct.distributed import DistributedObject -from direct.directnotify import DirectNotifyGlobal +from direct.distributed.DistributedObject import DistributedObject from direct.interval.IntervalGlobal import * -from toontown.toonbase import TTLocalizer, ToontownGlobals, ToontownBattleGlobals from toontown.battle import SuitBattleGlobals +from toontown.estate import Estate +from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer from toontown.suit import SuitDNA -from copy import deepcopy -import HolidayDecorator, HalloweenHolidayDecorator, calendar +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 setActiveHolidays(self, ids): + for id in ids: + self.startHoliday(id, True) - 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) + holiday = HolidayGlobals.getHoliday(id) + + self.activeHolidays.append(id) + self.broadcastHoliday(holiday, 'ongoingMessage' if ongoing else 'startMessage') + self.startSpecialHoliday(id) - 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 endHoliday(self, id): + if id not in self.activeHolidays or id not in HolidayGlobals.Holidays: + return - def getInvading(self): - return self.invading + holiday = HolidayGlobals.getHoliday(id) - 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 + self.activeHolidays.remove(id) + self.broadcastHoliday(holiday, 'endMessage') + self.endSpecialHoliday(id) - 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 startSpecialHoliday(self, id): + if id == ToontownGlobals.LAUGHING_MAN: + for toon in base.cr.toons.values(): + toon.generateLaughingMan() + elif id == ToontownGlobals.APRIL_TOONS_WEEK: + if isinstance(base.cr.playGame.getPlace(), Estate.Estate): + base.localAvatar.startAprilToonsControls() - def setHolidayIdList(self, holidayIdList): + base.localAvatar.chatMgr.chatInputSpeedChat.addAprilToonsMenu() + elif id == ToontownGlobals.IDES_OF_MARCH: + base.localAvatar.chatMgr.chatInputSpeedChat.addIdesOfMarchMenu() + elif id == ToontownGlobals.HALLOWEEN: + base.localAvatar.chatMgr.chatInputSpeedChat.addHalloweenMenu() + elif id == ToontownGlobals.CHRISTMAS: + base.localAvatar.chatMgr.chatInputSpeedChat.addWinterMenu() - def isEnding(id): - return id not in holidayIdList + def endSpecialHoliday(self, id): + if id == ToontownGlobals.LAUGHING_MAN: + for toon in base.cr.toons.values(): + toon.swapToonHead(laughingMan=toon.getWantLaughingMan()) + elif id == ToontownGlobals.APRIL_TOONS_WEEK: + if isinstance(base.cr.playGame.getPlace(), Estate.Estate): + base.localAvatar.stopAprilToonsControls() - 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() + base.localAvatar.chatMgr.chatInputSpeedChat.removeAprilToonsMenu() + elif id == ToontownGlobals.IDES_OF_MARCH: + base.localAvatar.chatMgr.chatInputSpeedChat.removeIdesOfMarchMenu() + elif id == ToontownGlobals.HALLOWEEN: + base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu() + elif id == ToontownGlobals.CHRISTMAS: + base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu() - 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 setInvasionStatus(self, msgType, suitType, remaining, flags): + if msgType not in ToontownGlobals.SuitInvasions: + return - def setTopToonsMarathonEnd(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonEnd) + if suitType in SuitDNA.suitHeadTypes: + attributes = SuitBattleGlobals.SuitAttributes[suitType] + suitNames = {'singular': attributes['name'], 'plural': attributes['pluralname']} + elif suitType in SuitDNA.suitDepts: + suitNames = {'singular': SuitDNA.getDeptFullname(suitType), 'plural': SuitDNA.getDeptFullnameP(suitType)} + else: + return - def setWinterDecorationsStart(self): - base.localAvatar.setSystemMessage(0, TTLocalizer.WinterDecorationsStart) + track = Sequence() + base.localAvatar.inventory.setInvasionCreditMultiplier(1 if msgType in ToontownGlobals.EndingInvasions else ToontownBattleGlobals.getInvasionMultiplier()) + + for i, message in enumerate(ToontownGlobals.SuitInvasions[msgType]): + track.append(Wait(5 if i else 1)) + track.append(Func(base.localAvatar.setSystemMessage, 0, (TTLocalizer.SuitInvasionPrefix + message) % suitNames)) - 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!' + track.start() \ No newline at end of file diff --git a/toontown/ai/NewsManagerAI.py b/toontown/ai/NewsManagerAI.py index 9753e89f..b7bcf648 100755 --- a/toontown/ai/NewsManagerAI.py +++ b/toontown/ai/NewsManagerAI.py @@ -1,77 +1,110 @@ -from direct.directnotify.DirectNotifyGlobal import directNotify from direct.distributed.DistributedObjectAI import DistributedObjectAI +from direct.distributed.ClockDelta import globalClockDelta +from direct.task import Task +from toontown.effects.DistributedFireworkShowAI import DistributedFireworkShowAI +from toontown.effects import FireworkShows +from toontown.toonbase import ToontownGlobals +from toontown.parties import PartyGlobals +import HolidayGlobals +import datetime, random class NewsManagerAI(DistributedObjectAI): - notify = directNotify.newCategory('NewsManagerAI') + def __init__(self, air): + DistributedObjectAI.__init__(self, air) + self.activeHolidays = [] + self.fireworkTask = None + 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) + self.deleteFireworkTask() + + def deleteFireworkTask(self): + if self.fireworkTask: + taskMgr.remove(self.fireworkTask) + self.fireworkTask = None + + def __handleAvatarEntered(self, av): + avId = av.getDoId() - def __handleAvatarEntered(self, avatar): if self.air.suitInvasionManager.getInvading(): - self.air.suitInvasionManager.notifyInvasionBulletin(avatar.getDoId()) + self.air.suitInvasionManager.notifyInvasionBulletin(avId) - def isHolidayRunning(self, holidayId): - return False + self.sendUpdateToAvatarId(avId, 'setActiveHolidays', [self.activeHolidays]) - def setPopulation(self, todo0): - pass + def getActiveHolidays(self): + return self.activeHolidays - def setBingoWin(self, todo0): - pass + def __checkHolidays(self, task=None): + date = datetime.datetime.utcnow().replace(tzinfo=HolidayGlobals.TIME_ZONE) - def setBingoStart(self): - pass + for id in HolidayGlobals.Holidays: + holiday = HolidayGlobals.Holidays[id] + running = self.isHolidayRunning(id) + + if self.isHolidayInRange(holiday, date): + if not running: + self.startHoliday(id) + elif running: + self.endHoliday(id) - def setBingoEnd(self): - pass + return Task.again + + def isHolidayInRange(self, holiday, date): + if 'weekDay' in holiday: + return holiday['weekDay'] == date.weekday() + else: + return HolidayGlobals.getStartDate(holiday) <= date <= HolidayGlobals.getEndDate(holiday) - def setCircuitRaceStart(self): - pass + def isHolidayRunning(self, id): + return id in self.activeHolidays - def setCircuitRaceEnd(self): - pass + def startHoliday(self, id): + if id in self.activeHolidays or id not in HolidayGlobals.Holidays: + return - def setInvasionStatus(self, msgType, cogType, numRemaining, skeleton): - self.sendUpdate('setInvasionStatus', args=[msgType, cogType, numRemaining, skeleton]) + 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 setHolidayIdList(self, holidays): - self.sendUpdate('setHolidayIdList', holidays) + 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') + elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]: + if not self.fireworkTask: + self.fireworkTask = taskMgr.doMethodLater(3600, self.startFireworks, 'newsFireworkTask', extraArgs=[id, Task.again]) + taskMgr.doMethodLater(10, self.startFireworks, 'newsFireworkTask-initial', extraArgs=[id, Task.done]) - def holidayNotify(self): - pass + def endSpecialHoliday(self, id): + if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY: + messenger.send('checkBingoState') + elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]: + self.deleteFireworkTask() + + def startFireworks(self, type, again, task=None): + maxShow = len(FireworkShows.shows.get(type, [])) - 1 - def setWeeklyCalendarHolidays(self, todo0): - pass + for hood in self.air.hoods: + if hood.zoneId == ToontownGlobals.GolfZone: + continue - def getWeeklyCalendarHolidays(self): - return [] + fireworkShow = DistributedFireworkShowAI(self.air) + fireworkShow.generateWithRequired(hood.zoneId) + fireworkShow.b_startShow(type, random.randint(0, maxShow), globalClockDelta.getRealNetworkTime()) - 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 + return again \ No newline at end of file diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index c6112b29..1e3c64e0 100755 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -88,8 +88,6 @@ class ToontownAIRepository(ToontownInternalRepository): self.wantCogdominiums = self.config.GetBool('want-cogdominiums', True) self.wantTrackClsends = self.config.GetBool('want-track-clsends', False) self.baseXpMultiplier = self.config.GetFloat('base-xp-multiplier', 1.0) - self.wantHalloween = self.config.GetBool('want-halloween', False) - self.wantChristmas = self.config.GetBool('want-christmas', False) self.cogSuitMessageSent = False @@ -193,7 +191,7 @@ class ToontownAIRepository(ToontownInternalRepository): self.claimOwnership(self.districtId) self.districtStats = ToontownDistrictStatsAI(self) - self.districtStats.settoontownDistrictId(self.districtId) + self.districtStats.setDistrictId(self.districtId) self.districtStats.generateWithRequiredAndId( self.allocateChannel(), self.getGameDoId(), 3) self.notify.info('Created ToontownDistrictStats(%d)' % self.districtStats.doId) diff --git a/toontown/battle/BattleCalculatorAI.py b/toontown/battle/BattleCalculatorAI.py index 6c846636..e5196dde 100755 --- a/toontown/battle/BattleCalculatorAI.py +++ b/toontown/battle/BattleCalculatorAI.py @@ -1168,9 +1168,7 @@ class BattleCalculatorAI: toonId = targetList[currTarget] toon = self.battle.getToon(toonId) result = 0 - if toon and toon.immortalMode: - result = 1 - elif self.TOONS_TAKE_NO_DAMAGE: + if (toon and toon.immortalMode) or self.TOONS_TAKE_NO_DAMAGE: result = 0 elif self.__suitAtkHit(attackIndex): atkType = attack[SUIT_ATK_COL] diff --git a/toontown/battle/DistributedBattleBase.py b/toontown/battle/DistributedBattleBase.py index 1ff82317..1944fbb6 100755 --- a/toontown/battle/DistributedBattleBase.py +++ b/toontown/battle/DistributedBattleBase.py @@ -574,10 +574,10 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): def setChosenToonAttacks(self, ids, tracks, levels, targets): if self.__battleCleanedUp: return - self.notify.debug('setChosenToonAttacks() - (%s), (%s), (%s), (%s)' % (ids, + print 'setChosenToonAttacks() - (%s), (%s), (%s), (%s)' % (ids, tracks, levels, - targets)) + targets) toonIndices = [] targetIndices = [] unAttack = 0 @@ -599,7 +599,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): if track == SOS: targetIndex = -1 elif track == NPCSOS: - targetIndex = -1 + targetIndex = targets[i] elif track == PETSOS: targetIndex = -1 elif track == PASS: diff --git a/toontown/battle/DistributedBattleBaseAI.py b/toontown/battle/DistributedBattleBaseAI.py index acd94f1c..f59317d8 100755 --- a/toontown/battle/DistributedBattleBaseAI.py +++ b/toontown/battle/DistributedBattleBaseAI.py @@ -1361,7 +1361,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas pass elif track != SOS: toon = self.getToon(toonId) - if toon != None: + if toon != None and not toon.unlimitedGags: check = toon.inventory.useItem(track, level) if check == -1: self.air.writeServerEvent('suspicious', toonId, 'Toon generating movie for non-existant gag track %s level %s' % (track, level)) @@ -1634,8 +1634,6 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas toon.inventory.zeroInv(1) deadToons.append(activeToon) self.notify.debug('AFTER ROUND: toon: %d setHp: %d' % (toon.doId, toon.hp)) - if toon.unlimitedGags: - toon.doRestock(noUber=0) for deadToon in deadToons: self.__removeToon(deadToon) diff --git a/toontown/building/DistributedBossElevator.py b/toontown/building/DistributedBossElevator.py index 41ed951d..ec07fe34 100755 --- a/toontown/building/DistributedBossElevator.py +++ b/toontown/building/DistributedBossElevator.py @@ -73,7 +73,7 @@ class DistributedBossElevator(DistributedElevatorExt.DistributedElevatorExt): def setBossOfficeZoneForce(self, zoneId): place = self.cr.playGame.getPlace() if place: - place.fsm.request('elevator', [self, 1]) + place.fsm.request('elevator', [self]) hoodId = self.cr.playGame.hood.hoodId doneStatus = {'loader': 'cogHQLoader', 'where': 'cogHQBossBattle', diff --git a/toontown/building/DistributedKnockKnockDoor.py b/toontown/building/DistributedKnockKnockDoor.py index c654d7af..cec83632 100755 --- a/toontown/building/DistributedKnockKnockDoor.py +++ b/toontown/building/DistributedKnockKnockDoor.py @@ -90,7 +90,11 @@ class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp) pos = doorNP.getBounds().getCenter() self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2)) d = duration * 0.125 - track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChatText, TTLocalizer.DoorKnockKnock), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[0]), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[1]), Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4)), Func(self.cleanupTrack)) + track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChatText, TTLocalizer.DoorKnockKnock), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[0]), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[1])) + if avatar == base.localAvatar: + track.append(Func(self.sendUpdate, 'requestToonup')) + track.append(Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4))) + track.append(Func(self.cleanupTrack)) track.delayDelete = DelayDelete.DelayDelete(avatar, 'knockKnockTrack') return track diff --git a/toontown/building/DistributedKnockKnockDoorAI.py b/toontown/building/DistributedKnockKnockDoorAI.py index a14d8033..4e21dfed 100755 --- a/toontown/building/DistributedKnockKnockDoorAI.py +++ b/toontown/building/DistributedKnockKnockDoorAI.py @@ -1,11 +1,8 @@ -import DistributedAnimatedPropAI -from direct.directnotify import DirectNotifyGlobal -from direct.distributed.ClockDelta import * -from direct.fsm import ClassicFSM -from direct.fsm import State from direct.task.Task import Task from otp.ai.AIBaseGlobal import * - +from toontown.toonbase import ToontownGlobals +import DistributedAnimatedPropAI +import time class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedPropAI): def __init__(self, air, propId): @@ -38,3 +35,12 @@ class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedP DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitPlaying(self) taskMgr.remove(self.doLaterTask) self.doLaterTask = None + + def requestToonup(self): + av = self.air.doId2do.get(self.air.getAvatarIdFromSender()) + + if (not av) or av.getHp() == av.getMaxHp() or av.getNextKnockHeal() > time.time(): + return + + av.toonUp(ToontownGlobals.KnockKnockHeal) + av.b_setNextKnockHeal(int(time.time() + ToontownGlobals.KnockKnockCooldown)) \ No newline at end of file diff --git a/toontown/chat/TTSCWhiteListTerminal.py b/toontown/chat/TTSCWhiteListTerminal.py index 5c0c88e2..caa42b5f 100755 --- a/toontown/chat/TTSCWhiteListTerminal.py +++ b/toontown/chat/TTSCWhiteListTerminal.py @@ -2,10 +2,6 @@ from otp.speedchat.SCTerminal import SCTerminal from otp.otpbase.OTPLocalizer import SpeedChatStaticText SCStaticTextMsgEvent = 'SCStaticTextMsg' -def decodeSCStaticTextMsg(textId): - return SpeedChatStaticText.get(textId, None) - - class TTSCWhiteListTerminal(SCTerminal): def __init__(self, textId, parentMenu = None): diff --git a/toontown/coghq/DistributedCogKart.py b/toontown/coghq/DistributedCogKart.py index 6319e012..d7896360 100755 --- a/toontown/coghq/DistributedCogKart.py +++ b/toontown/coghq/DistributedCogKart.py @@ -152,7 +152,7 @@ class DistributedCogKart(DistributedElevatorExt.DistributedElevatorExt): def setCountryClubInteriorZoneForce(self, zoneId): place = self.cr.playGame.getPlace() if place: - place.fsm.request('elevator', [self, 1]) + place.fsm.request('elevator', [self]) hoodId = self.cr.playGame.hood.hoodId countryClubId = self.countryClubId if bboard.has('countryClubIdOverride'): diff --git a/toontown/coghq/DistributedFactoryElevatorExt.py b/toontown/coghq/DistributedFactoryElevatorExt.py index 48808e0b..8729e964 100755 --- a/toontown/coghq/DistributedFactoryElevatorExt.py +++ b/toontown/coghq/DistributedFactoryElevatorExt.py @@ -72,7 +72,7 @@ class DistributedFactoryElevatorExt(DistributedElevatorExt.DistributedElevatorEx def setFactoryInteriorZoneForce(self, zoneId): place = self.cr.playGame.getPlace() if place: - place.fsm.request('elevator', [self, 1]) + place.fsm.request('elevator', [self]) hoodId = self.cr.playGame.hood.hoodId doneStatus = {'loader': 'cogHQLoader', 'where': 'factoryInterior', diff --git a/toontown/coghq/DistributedLawOfficeElevatorExt.py b/toontown/coghq/DistributedLawOfficeElevatorExt.py index 8cdac786..bbace6fc 100755 --- a/toontown/coghq/DistributedLawOfficeElevatorExt.py +++ b/toontown/coghq/DistributedLawOfficeElevatorExt.py @@ -81,7 +81,7 @@ class DistributedLawOfficeElevatorExt(DistributedElevatorExt.DistributedElevator def setLawOfficeInteriorZoneForce(self, zoneId): place = self.cr.playGame.getPlace() if place: - place.fsm.request('elevator', [self, 1]) + place.fsm.request('elevator', [self]) hoodId = self.cr.playGame.hood.hoodId doneStatus = {'loader': 'cogHQLoader', 'where': 'stageInterior', diff --git a/toontown/coghq/DistributedMintElevatorExt.py b/toontown/coghq/DistributedMintElevatorExt.py index 5e35babc..05f49a85 100755 --- a/toontown/coghq/DistributedMintElevatorExt.py +++ b/toontown/coghq/DistributedMintElevatorExt.py @@ -86,7 +86,7 @@ class DistributedMintElevatorExt(DistributedElevatorExt.DistributedElevatorExt): def setMintInteriorZoneForce(self, zoneId): place = self.cr.playGame.getPlace() if place: - place.fsm.request('elevator', [self, 1]) + place.fsm.request('elevator', [self]) hoodId = self.cr.playGame.hood.hoodId mintId = self.mintId if bboard.has('mintIdOverride'): diff --git a/toontown/coghq/MoleHill.py b/toontown/coghq/MoleHill.py index 4ea33933..47d071ac 100755 --- a/toontown/coghq/MoleHill.py +++ b/toontown/coghq/MoleHill.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import NodePath, Point3, CollisionSphere, CollisionNode, Vec4 +from pandac.PandaModules import NodePath, Point3, CollisionTube, CollisionNode, Vec4 from direct.interval.IntervalGlobal import Sequence, LerpPosInterval, Parallel, LerpScaleInterval, Track, ParticleInterval, Wait, Func from toontown.toonbase import ToontownGlobals from toontown.coghq import MoleFieldBase @@ -35,7 +35,7 @@ class MoleHill(NodePath): self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm') self.moleHead.reparentTo(self.mole) moleColName = 'moleCol-%d-%s' % (self.moleField.doId, self.index) - moleSphere = CollisionSphere(0, 0, 0, 1.0) + moleSphere = CollisionTube(0, 0, 0, 0, 0, 1, 1) collNode = CollisionNode(moleColName) collNode.setIntoCollideMask(ToontownGlobals.WallBitmask) collNode.addSolid(moleSphere) diff --git a/toontown/distributed/PlayGame.py b/toontown/distributed/PlayGame.py index 5e0bd8c9..03e74023 100755 --- a/toontown/distributed/PlayGame.py +++ b/toontown/distributed/PlayGame.py @@ -393,9 +393,6 @@ class PlayGame(StateData.StateData): base.localAvatar.chatMgr.obscure(1, 1) base.localAvatar.obscureFriendsListButton(1) requestStatus['how'] = 'tutorial' - if base.config.GetString('language', 'english') == 'japanese': - musicVolume = base.config.GetFloat('tutorial-music-volume', 0.5) - requestStatus['musicVolume'] = musicVolume self.hood.enter(requestStatus) def exitTutorialHood(self): @@ -557,8 +554,4 @@ class PlayGame(StateData.StateData): return self.place def getPlaceId(self): - if self.hood: - return self.hood.hoodId - else: - return None - return None + return self.hood.hoodId if self.hood else None diff --git a/toontown/distributed/ToontownDistrictStats.py b/toontown/distributed/ToontownDistrictStats.py index 8cf519f1..38f25034 100755 --- a/toontown/distributed/ToontownDistrictStats.py +++ b/toontown/distributed/ToontownDistrictStats.py @@ -67,15 +67,15 @@ class ToontownDistrictStats(DistributedObject.DistributedObject): def __init__(self, cr): DistributedObject.DistributedObject.__init__(self, cr) - self.toontownDistrictId = 0 + self.districtId = 0 - def settoontownDistrictId(self, value): - self.toontownDistrictId = value + def setDistrictId(self, value): + self.districtId = value def setAvatarCount(self, avatarCount): - if self.toontownDistrictId in self.cr.activeDistrictMap: - self.cr.activeDistrictMap[self.toontownDistrictId].avatarCount = avatarCount + if self.districtId in self.cr.activeDistrictMap: + self.cr.activeDistrictMap[self.districtId].avatarCount = avatarCount def setInvasionStatus(self, invasionStatus): - if self.toontownDistrictId in self.cr.activeDistrictMap: - self.cr.activeDistrictMap[self.toontownDistrictId].invasionStatus = invasionStatus \ No newline at end of file + if self.districtId in self.cr.activeDistrictMap: + self.cr.activeDistrictMap[self.districtId].invasionStatus = invasionStatus \ No newline at end of file diff --git a/toontown/distributed/ToontownDistrictStatsAI.py b/toontown/distributed/ToontownDistrictStatsAI.py index 0364cc43..73d2cc59 100755 --- a/toontown/distributed/ToontownDistrictStatsAI.py +++ b/toontown/distributed/ToontownDistrictStatsAI.py @@ -20,17 +20,17 @@ class ToontownDistrictStatsAI(DistributedObjectAI): status = {'population': self.avatarCount} self.air.netMessenger.send('shardStatus', [self.air.ourChannel, status]) - def settoontownDistrictId(self, districtId): + def setDistrictId(self, districtId): self.districtId = districtId - def d_settoontownDistrictId(self, districtId): - self.sendUpdate('settoontownDistrictId', [districtId]) + def d_setDistrictId(self, districtId): + self.sendUpdate('setDistrictId', [districtId]) - def b_settoontownDistrictId(self, districtId): - self.settoontownDistrictId(districtId) - self.d_settoontownDistrictId(districtId) + def b_setDistrictId(self, districtId): + self.setDistrictId(districtId) + self.d_setDistrictId(districtId) - def gettoontownDistrictId(self): + def getDistrictId(self): return self.districtId def setAvatarCount(self, avatarCount): diff --git a/toontown/effects/DistributedFireworkShowAI.py b/toontown/effects/DistributedFireworkShowAI.py index 7663114c..e04b2d7b 100755 --- a/toontown/effects/DistributedFireworkShowAI.py +++ b/toontown/effects/DistributedFireworkShowAI.py @@ -43,9 +43,9 @@ def fireworks(showName='july4'): """ showName = showName.lower() if showName == 'july4': - showType = ToontownGlobals.JULY4_FIREWORKS + showType = ToontownGlobals.SUMMER_FIREWORKS elif showName == 'newyears': - showType = ToontownGlobals.NEWYEARS_FIREWORKS + showType = ToontownGlobals.NEW_YEAR_FIREWORKS elif showName == 'summer': showType = PartyGlobals.FireworkShows.Summer else: diff --git a/toontown/effects/FireworkShow.py b/toontown/effects/FireworkShow.py index a73a7830..269565ea 100755 --- a/toontown/effects/FireworkShow.py +++ b/toontown/effects/FireworkShow.py @@ -15,9 +15,9 @@ colors = [Vec4(1, 1, 1, 1), Vec4(1, 0.1, 1, 1), Vec4(0.1, 1, 1, 1), Vec4(0.1, 0.5, 1, 1)] -fireworkShowTypes = [ToontownGlobals.JULY4_FIREWORKS, +fireworkShowTypes = [ToontownGlobals.SUMMER_FIREWORKS, PartyGlobals.FireworkShows.Summer, - ToontownGlobals.NEWYEARS_FIREWORKS, + ToontownGlobals.NEW_YEAR_FIREWORKS, ToontownGlobals.COMBO_FIREWORKS] class FireworkShow(NodePath): @@ -43,7 +43,7 @@ class FireworkShow(NodePath): def rD(): return random.randint(1, 20) / 10.0 - showData = {ToontownGlobals.JULY4_FIREWORKS: [[FireworkType.GlowFlare, + showData = {ToontownGlobals.SUMMER_FIREWORKS: [[FireworkType.GlowFlare, Vec3(-90, 0, 80), Vec3(120, 0, 0), rS(), @@ -739,7 +739,7 @@ class FireworkShow(NodePath): Vec4(1, 1, 1, 1), 1.5, 10.0]], - ToontownGlobals.NEWYEARS_FIREWORKS: [[FireworkType.GlowFlare, + ToontownGlobals.NEW_YEAR_FIREWORKS: [[FireworkType.GlowFlare, Vec3(0, 0, 180), Vec3(-120, 0, 0), rS(), @@ -1075,10 +1075,10 @@ class FireworkShow(NodePath): rC(), 2.0, 10.0]]} - showData[ToontownGlobals.COMBO_FIREWORKS] = showData[ToontownGlobals.NEWYEARS_FIREWORKS] - sectionData = {ToontownGlobals.JULY4_FIREWORKS: [(0, 24), (24, len(showData[ToontownGlobals.JULY4_FIREWORKS]))], + showData[ToontownGlobals.COMBO_FIREWORKS] = showData[ToontownGlobals.NEW_YEAR_FIREWORKS] + sectionData = {ToontownGlobals.SUMMER_FIREWORKS: [(0, 24), (24, len(showData[ToontownGlobals.SUMMER_FIREWORKS]))], PartyGlobals.FireworkShows.Summer: [(0, 24), (24, len(showData[PartyGlobals.FireworkShows.Summer]))], - ToontownGlobals.NEWYEARS_FIREWORKS: [(0, len(showData[PartyGlobals.FireworkShows.Summer]))], + ToontownGlobals.NEW_YEAR_FIREWORKS: [(0, len(showData[PartyGlobals.FireworkShows.Summer]))], ToontownGlobals.COMBO_FIREWORKS: [(0, len(showData[PartyGlobals.FireworkShows.Summer]))]} showMusic = {} @@ -1089,7 +1089,7 @@ class FireworkShow(NodePath): else: return False - def __init__(self, showType = ToontownGlobals.NEWYEARS_FIREWORKS): + def __init__(self, showType = ToontownGlobals.NEW_YEAR_FIREWORKS): NodePath.__init__(self, 'FireworkShow') self.showType = showType self.sectionIvals = [] diff --git a/toontown/effects/FireworkShowMixin.py b/toontown/effects/FireworkShowMixin.py index 4a5a82c6..f497b2a7 100755 --- a/toontown/effects/FireworkShowMixin.py +++ b/toontown/effects/FireworkShowMixin.py @@ -19,7 +19,7 @@ class FireworkShowMixin: self.startDelay = startDelay self.timestamp = None self.fireworkShow = None - self.eventId = JULY4_FIREWORKS + self.eventId = SUMMER_FIREWORKS self.accept('MusicEnabled', self.startMusic) return @@ -77,13 +77,13 @@ class FireworkShowMixin: return def preShow(self, eventId, songId, startT): - if eventId == JULY4_FIREWORKS: + if eventId == SUMMER_FIREWORKS: instructionMessage = TTLocalizer.FireworksInstructions startMessage = TTLocalizer.FireworksJuly4Beginning endMessage = TTLocalizer.FireworksJuly4Ending songs = ['tt_summer', 'firework_music'] musicFile = 'phase_4/audio/bgm/%s.ogg' % songs[songId] - elif eventId == NEWYEARS_FIREWORKS: + elif eventId == NEW_YEAR_FIREWORKS: instructionMessage = TTLocalizer.FireworksInstructions startMessage = TTLocalizer.FireworksNewYearsEveBeginning endMessage = TTLocalizer.FireworksNewYearsEveEnding @@ -146,9 +146,9 @@ class FireworkShowMixin: base.camLens.setFar(DefaultCameraFar) def postShow(self, eventId): - if eventId == JULY4_FIREWORKS: + if eventId == SUMMER_FIREWORKS: endMessage = TTLocalizer.FireworksJuly4Ending - elif eventId == NEWYEARS_FIREWORKS: + elif eventId == NEW_YEAR_FIREWORKS: endMessage = TTLocalizer.FireworksNewYearsEveEnding elif eventId == PartyGlobals.FireworkShows.Summer: endMessage = TTLocalizer.FireworksActivityEnding diff --git a/toontown/effects/FireworkShows.py b/toontown/effects/FireworkShows.py index 2c4c1c52..c1f196ec 100755 --- a/toontown/effects/FireworkShows.py +++ b/toontown/effects/FireworkShows.py @@ -1,7 +1,7 @@ from FireworkGlobals import * from toontown.toonbase import ToontownGlobals from toontown.parties import PartyGlobals -shows = {ToontownGlobals.JULY4_FIREWORKS: [((2, +shows = {ToontownGlobals.SUMMER_FIREWORKS: [((2, ROCKET, RED, RED, @@ -5065,7 +5065,7 @@ shows = {ToontownGlobals.JULY4_FIREWORKS: [((2, -23, 3, 100))], - ToontownGlobals.NEWYEARS_FIREWORKS: [((0.5, + ToontownGlobals.NEW_YEAR_FIREWORKS: [((0.5, ROCKET, WHITE, WHITE, diff --git a/toontown/effects/ScavengerHuntEffects.py b/toontown/effects/ScavengerHuntEffects.py index bd7cd344..eec1ef24 100755 --- a/toontown/effects/ScavengerHuntEffects.py +++ b/toontown/effects/ScavengerHuntEffects.py @@ -1,9 +1,7 @@ -from panda3d.core import * from direct.interval.IntervalGlobal import * -from toontown.toonbase import ToontownGlobals -from toontown.toonbase import TTLocalizer from direct.gui.DirectFrame import DirectFrame from direct.gui.DirectLabel import DirectLabel +from toontown.toonbase import ToontownGlobals, TTLocalizer class ScavengerHuntEffect: images = None @@ -11,7 +9,9 @@ class ScavengerHuntEffect: def __init__(self, beanAmount): if not ScavengerHuntEffect.images: ScavengerHuntEffect.images = loader.loadModel('phase_4/models/props/tot_jar') + self.npRoot = DirectFrame(parent=aspect2d, relief=None, scale=0.75, pos=(0, 0, 0.6)) + if beanAmount > 0: self.npRoot.setColorScale(VBase4(1, 1, 1, 0)) self.jar = DirectFrame(parent=self.npRoot, relief=None, image=ScavengerHuntEffect.images.find('**/tot_jar')) @@ -32,29 +32,19 @@ class ScavengerHuntEffect: self.npRoot.setColorScale(VBase4(1, 1, 1, 0)) self.attemptFailedMsg() self.track = Sequence(LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 1), startColorScale=VBase4(1, 1, 1, 0)), Wait(5), LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1)), Func(self.destroy)) - return def play(self): if self.npRoot: self.track.start() def stop(self): - if self.track != None: - if self.track.isPlaying(): - self.track.finish() - return - - def cleanupIntervals(self, interval): - while len(interval) > 0: - if isinstance(interval[0], Sequence) or isinstance(interval[0], Parallel): - self.cleanupIntervals(interval[0]) - interval.pop(0) - else: - interval.pop(0) + if self.track != None and self.track.isPlaying(): + self.track.finish() def destroy(self): self.stop() self.track = None + if hasattr(self, 'eventImage') and self.eventImage: self.eventImage.detachNode() del self.eventImage @@ -67,53 +57,38 @@ class ScavengerHuntEffect: if hasattr(self, 'npRoot') and self.npRoot: self.npRoot.destroy() del self.npRoot - return - class TrickOrTreatTargetEffect(ScavengerHuntEffect): def __init__(self, beanAmount): ScavengerHuntEffect.__init__(self, beanAmount) + if beanAmount > 0: self.pumpkin = DirectFrame(parent=self.eventImage, relief=None, image=ScavengerHuntEffect.images.find('**/tot_pumpkin_tall')) - return def attemptFailedMsg(self): pLabel = DirectLabel(parent=self.npRoot, relief=None, pos=(0.0, 0.0, -0.15), text=TTLocalizer.TrickOrTreatMsg, text_fg=(0.95, 0.5, 0.0, 1.0), text_scale=0.12, text_font=ToontownGlobals.getSignFont()) - return def destroy(self): if hasattr(self, 'pumpkin') and self.pumpkin: self.pumpkin.destroy() - ScavengerHuntEffect.destroy(self) + ScavengerHuntEffect.destroy(self) class WinterCarolingEffect(ScavengerHuntEffect): def __init__(self, beanAmount): ScavengerHuntEffect.__init__(self, beanAmount) + if beanAmount > 0: sm = loader.loadModel('phase_5.5/models/estate/tt_m_prp_ext_snowman_icon') self.snowman = DirectFrame(parent=self.eventImage, relief=None, image=sm, scale=20.0) - return def attemptFailedMsg(self): pLabel = DirectLabel(parent=self.npRoot, relief=None, pos=(0.0, 0.0, -0.15), text=TTLocalizer.WinterCarolingMsg, text_fg=(0.9, 0.9, 1.0, 1.0), text_scale=0.12, text_font=ToontownGlobals.getSignFont()) - return def destroy(self): if hasattr(self, 'snowman') and self.snowman: self.snowman.destroy() - ScavengerHuntEffect.destroy(self) - -class TrickOrTreatMilestoneEffect: - - def __init__(self): - pass - - def play(self): - pass - - def stop(self): - pass + ScavengerHuntEffect.destroy(self) \ No newline at end of file diff --git a/toontown/estate/DistributedEstate.py b/toontown/estate/DistributedEstate.py index d04cc386..d02390a4 100755 --- a/toontown/estate/DistributedEstate.py +++ b/toontown/estate/DistributedEstate.py @@ -68,13 +68,10 @@ class DistributedEstate(DistributedObject.DistributedObject): self.defaultSignModel = loader.loadModel('phase_13/models/parties/eventSign') self.activityIconsModel = loader.loadModel('phase_4/models/parties/eventSignIcons') self.lt = base.localAvatar - newsManager = base.cr.newsManager - if newsManager: - holidayIds = base.cr.newsManager.getDecorationHolidayId() - if ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds or ToontownGlobals.SPOOKY_COSTUMES in holidayIds: - self.loadWitch() - else: - self.loadAirplane() + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN): + self.loadWitch() + else: + self.loadAirplane() self.loadFlowerSellBox() self.loadFishSellBox() self.oldClear = base.win.getClearColor() diff --git a/toontown/estate/Estate.py b/toontown/estate/Estate.py index 6aaecf06..3e22431c 100755 --- a/toontown/estate/Estate.py +++ b/toontown/estate/Estate.py @@ -99,21 +99,14 @@ class Estate(Place.Place): def enter(self, requestStatus): hoodId = requestStatus['hoodId'] zoneId = requestStatus['zoneId'] - newsManager = base.cr.newsManager if config.GetBool('want-estate-telemetry-limiter', 1): limiter = TLGatherAllAvs('Estate', RotationLimitToH) else: limiter = TLNull() self._telemLimiter = limiter - if newsManager: - holidayIds = base.cr.newsManager.getDecorationHolidayId() - if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds or ToontownGlobals.SPOOKY_COSTUMES in holidayIds) and self.loader.hood.spookySkyFile: - lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky)) - lightsOff.start() - else: - self.loader.hood.startSky() - lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) - lightsOn.start() + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN) and self.loader.hood.spookySkyFile: + lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky)) + lightsOff.start() else: self.loader.hood.startSky() lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) @@ -124,11 +117,7 @@ class Estate(Place.Place): self.loader.enterAnimatedProps(i) self.loader.geom.reparentTo(render) - # The client April Toons Manager is currently broken, so we have to do this hacky thing instead. :( - #if hasattr(base.cr, 'aprilToonsMgr'): - #if self.isEventActive(AprilToonsGlobals.EventEstateGravity): - #base.localAvatar.startAprilToonsControls() - if base.config.GetBool('want-april-toons'): + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK): base.localAvatar.startAprilToonsControls() self.accept('doorDoneEvent', self.handleDoorDoneEvent) self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger) @@ -136,7 +125,7 @@ class Estate(Place.Place): def exit(self): base.localAvatar.stopChat() - if base.config.GetBool('want-april-toons'): + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK): base.localAvatar.stopAprilToonsControls() self._telemLimiter.destroy() del self._telemLimiter @@ -327,7 +316,6 @@ class Estate(Place.Place): self.__setUnderwaterFog() base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8) self.cameraSubmerged = 1 - self.walkStateData.setSwimSoundAudible(1) def __emergeCamera(self): if self.cameraSubmerged == 0: @@ -336,7 +324,6 @@ class Estate(Place.Place): self.loader.hood.sky.setFogOff() self.__setFaintFog() self.cameraSubmerged = 0 - self.walkStateData.setSwimSoundAudible(0) def forceUnderWater(self): self.toonSubmerged = 0 @@ -362,11 +349,7 @@ class Estate(Place.Place): if hasattr(self, 'walkStateData'): self.walkStateData.fsm.request('walking') self.toonSubmerged = 0 - # The client April Toons Manager is currently broken, so we have to do this hacky thing instead. :( - #if hasattr(base.cr, 'aprilToonsMgr'): - #if self.isEventActive(AprilToonsGlobals.EventEstateGravity): - #base.localAvatar.startAprilToonsControls() - if base.config.GetBool('want-april-toons'): + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK): base.localAvatar.startAprilToonsControls() def __setUnderwaterFog(self): diff --git a/toontown/estate/EstateManager.py b/toontown/estate/EstateManager.py index dfc5d491..bc43024f 100755 --- a/toontown/estate/EstateManager.py +++ b/toontown/estate/EstateManager.py @@ -68,11 +68,3 @@ class EstateManager(DistributedObject.DistributedObject): def removeFriend(self, ownerId, avId): self.notify.debug('removeFriend ownerId = %s, avId = %s' % (ownerId, avId)) self.sendUpdate('removeFriend', [ownerId, avId]) - - def startAprilFools(self): - if isinstance(base.cr.playGame.getPlace(), Estate.Estate): - base.cr.playGame.getPlace().startAprilFoolsControls() - - def stopAprilFools(self): - if isinstance(base.cr.playGame.getPlace(), Estate.Estate): - base.cr.playGame.getPlace().stopAprilFoolsControls() diff --git a/toontown/fishing/FishGlobals.py b/toontown/fishing/FishGlobals.py index f5cba8ed..54ec9f10 100755 --- a/toontown/fishing/FishGlobals.py +++ b/toontown/fishing/FishGlobals.py @@ -713,15 +713,12 @@ def getValue(genus, species, weight): value = OVERALL_VALUE_SCALE * (rarityValue + weightValue) finalValue = int(ceil(value)) base = getBase() - if hasattr(base, 'cr') and base.cr: - if hasattr(base.cr, 'newsManager') and base.cr.newsManager: - holidayIds = base.cr.newsManager.getHolidayIdList() - if ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY in holidayIds or ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH in holidayIds: - finalValue *= JellybeanFishingHolidayScoreMultiplier - elif simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY) or simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH): - finalValue *= JellybeanFishingHolidayScoreMultiplier - return finalValue + newsManager = base.cr.newsManager if hasattr(base, 'cr') else simbase.air.newsManager + if newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY) or newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH): + finalValue *= JellybeanFishingHolidayScoreMultiplier + + return finalValue __totalNumFish = 0 __emptyRodDict = {} diff --git a/toontown/golf/PhysicsWorldBase.py b/toontown/golf/PhysicsWorldBase.py index 23b468aa..19a2b36e 100755 --- a/toontown/golf/PhysicsWorldBase.py +++ b/toontown/golf/PhysicsWorldBase.py @@ -720,12 +720,3 @@ class PhysicsWorldBase: someNodePathGeom = None self.bodyList.append((None, body)) return (someNodePathGeom, body) - - def attachMarker(self, body): - if self.canRender: - testMarker = render.attachNewNode('Joint Marker') - ballmodel = loader.loadModel('models/misc/sphere') - ballmodel.reparentTo(testMarker) - ballmodel.setScale(0.25) - testMarker.setPos(0.0, 0.0, -100.0) - self.odePandaRelationList.append((testMarker, body)) diff --git a/toontown/hood/BRHood.py b/toontown/hood/BRHood.py index 242ee7cb..343d750e 100755 --- a/toontown/hood/BRHood.py +++ b/toontown/hood/BRHood.py @@ -3,7 +3,6 @@ from toontown.town.BRTownLoader import BRTownLoader from toontown.toonbase import ToontownGlobals from toontown.hood.ToonHood import ToonHood - class BRHood(ToonHood): notify = directNotify.newCategory('BRHood') @@ -16,7 +15,5 @@ class BRHood(ToonHood): TITLE_COLOR = (0.3, 0.6, 1.0, 1.0) HOLIDAY_DNA = { - ToontownGlobals.WINTER_DECORATIONS: ['phase_8/dna/winter_storage_BR.pdna'], - ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_8/dna/winter_storage_BR.pdna'], - ToontownGlobals.HALLOWEEN_PROPS: ['phase_8/dna/halloween_props_storage_BR.pdna'], - ToontownGlobals.SPOOKY_PROPS: ['phase_8/dna/halloween_props_storage_BR.pdna']} + ToontownGlobals.CHRISTMAS: ['phase_8/dna/winter_storage_BR.pdna'], + ToontownGlobals.HALLOWEEN: ['phase_8/dna/halloween_props_storage_BR.pdna']} \ No newline at end of file diff --git a/toontown/hood/BRHoodAI.py b/toontown/hood/BRHoodAI.py index c1f159b5..f219eaf7 100755 --- a/toontown/hood/BRHoodAI.py +++ b/toontown/hood/BRHoodAI.py @@ -2,7 +2,7 @@ from toontown.hood import HoodAI from toontown.safezone import DistributedTrolleyAI from toontown.toonbase import ToontownGlobals from toontown.ai import DistributedPolarPlaceEffectMgrAI -from toontown.ai import DistributedTrickOrTreatTargetAI +from toontown.ai import DistributedEffectMgrAI class BRHoodAI(HoodAI.HoodAI): def __init__(self, air): @@ -22,12 +22,14 @@ class BRHoodAI(HoodAI.HoodAI): self.PolarPlaceEffectManager = DistributedPolarPlaceEffectMgrAI.DistributedPolarPlaceEffectMgrAI(self.air) self.PolarPlaceEffectManager.generateWithRequired(3821) - - if simbase.air.wantHalloween: - self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) - self.TrickOrTreatTargetManager.generateWithRequired(3707) + + self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12) + self.trickOrTreatMgr.generateWithRequired(3707) # Snowplace Like Home, Sleet Street + + self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14) + self.winterCarolingMgr.generateWithRequired(3828) # Snowman's Land, Polar Place def createTrolley(self): self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air) self.trolley.generateWithRequired(self.zoneId) - self.trolley.start() + self.trolley.start() \ No newline at end of file diff --git a/toontown/hood/DDHood.py b/toontown/hood/DDHood.py index 7e2a8602..bb9b569a 100755 --- a/toontown/hood/DDHood.py +++ b/toontown/hood/DDHood.py @@ -15,16 +15,12 @@ class DDHood(ToonHood): SPOOKY_SKY_FILE = 'phase_3.5/models/props/BR_sky' TITLE_COLOR = (0.8, 0.6, 0.5, 1.0) underwaterColor = Vec4(0.0, 0.0, 0.6, 1.0) - HOLIDAY_DNA = { - ToontownGlobals.WINTER_DECORATIONS: ['phase_6/dna/winter_storage_DD.pdna'], - ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_6/dna/winter_storage_DD.pdna'], - ToontownGlobals.HALLOWEEN_PROPS: ['phase_6/dna/halloween_props_storage_DD.pdna'], - ToontownGlobals.SPOOKY_PROPS: ['phase_6/dna/halloween_props_storage_DD.pdna']} - def __init__(self, parentFSM, doneEvent, dnaStore, hoodId): - ToonHood.__init__(self, parentFSM, doneEvent, dnaStore, hoodId) + HOLIDAY_DNA = { + ToontownGlobals.CHRISTMAS: ['phase_6/dna/winter_storage_DD.pdna'], + ToontownGlobals.HALLOWEEN: ['phase_6/dna/halloween_props_storage_DD.pdna']} def load(self): ToonHood.load(self) - self.fog = Fog('DDFog') + self.fog = Fog('DDFog') \ No newline at end of file diff --git a/toontown/hood/DDHoodAI.py b/toontown/hood/DDHoodAI.py index 3ceea6a9..11901617 100755 --- a/toontown/hood/DDHoodAI.py +++ b/toontown/hood/DDHoodAI.py @@ -2,8 +2,7 @@ from toontown.hood import HoodAI from toontown.safezone import DistributedBoatAI from toontown.safezone import DistributedTrolleyAI from toontown.toonbase import ToontownGlobals -from toontown.ai import DistributedTrickOrTreatTargetAI - +from toontown.ai import DistributedEffectMgrAI class DDHoodAI(HoodAI.HoodAI): def __init__(self, air): @@ -23,9 +22,11 @@ class DDHoodAI(HoodAI.HoodAI): self.createTrolley() self.createBoat() - if simbase.air.wantHalloween: - self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) - self.TrickOrTreatTargetManager.generateWithRequired(1834) + self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12) + self.trickOrTreatMgr.generateWithRequired(1834) # Rudderly Ridiculous, Lighthouse Lane + + self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14) + self.winterCarolingMgr.generateWithRequired(1707) # Gifts with a Porpoise, Seaweed Street def createTrolley(self): self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air) @@ -35,4 +36,4 @@ class DDHoodAI(HoodAI.HoodAI): def createBoat(self): self.boat = DistributedBoatAI.DistributedBoatAI(self.air) self.boat.generateWithRequired(self.zoneId) - self.boat.start() + self.boat.start() \ No newline at end of file diff --git a/toontown/hood/DGHood.py b/toontown/hood/DGHood.py index 3ca0974b..ce2fc224 100755 --- a/toontown/hood/DGHood.py +++ b/toontown/hood/DGHood.py @@ -3,7 +3,6 @@ from toontown.town.DGTownLoader import DGTownLoader from toontown.toonbase import ToontownGlobals from toontown.hood.ToonHood import ToonHood - class DGHood(ToonHood): notify = directNotify.newCategory('DGHood') @@ -16,7 +15,5 @@ class DGHood(ToonHood): TITLE_COLOR = (0.8, 0.6, 1.0, 1.0) HOLIDAY_DNA = { - ToontownGlobals.WINTER_DECORATIONS: ['phase_8/dna/winter_storage_DG.pdna'], - ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_8/dna/winter_storage_DG.pdna'], - ToontownGlobals.HALLOWEEN_PROPS: ['phase_8/dna/halloween_props_storage_DG.pdna'], - ToontownGlobals.SPOOKY_PROPS: ['phase_8/dna/halloween_props_storage_DG.pdna']} + ToontownGlobals.CHRISTMAS: ['phase_8/dna/winter_storage_DG.pdna'], + ToontownGlobals.HALLOWEEN: ['phase_8/dna/halloween_props_storage_DG.pdna']} diff --git a/toontown/hood/DGHoodAI.py b/toontown/hood/DGHoodAI.py index 5e049939..cf3bad65 100755 --- a/toontown/hood/DGHoodAI.py +++ b/toontown/hood/DGHoodAI.py @@ -4,11 +4,10 @@ from toontown.safezone import DistributedButterflyAI from toontown.safezone import DistributedDGFlowerAI from toontown.safezone import DistributedTrolleyAI from toontown.toonbase import ToontownGlobals -#from toontown.ai import DistributedGreenToonEffectMgrAI -from toontown.ai import DistributedTrickOrTreatTargetAI - +from toontown.ai import DistributedEffectMgrAI class DGHoodAI(HoodAI.HoodAI): + def __init__(self, air): HoodAI.HoodAI.__init__(self, air, ToontownGlobals.DaisyGardens, @@ -28,12 +27,14 @@ class DGHoodAI(HoodAI.HoodAI): if simbase.config.GetBool('want-butterflies', True): self.createButterflies() - #self.GreenToonEffectManager = DistributedGreenToonEffectMgrAI.DistributedGreenToonEffectMgrAI(self.air) - #self.GreenToonEffectManager.generateWithRequired(5819) + self.greenToonMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.IDES_OF_MARCH, 15) + self.greenToonMgr.generateWithRequired(5819) - if simbase.air.wantHalloween: - self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) - self.TrickOrTreatTargetManager.generateWithRequired(5620) + self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12) + self.trickOrTreatMgr.generateWithRequired(5620) # Rake It Inn, Elm Street + + self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14) + self.winterCarolingMgr.generateWithRequired(5626) # Pine Needle Crafts, Elm Street def shutdown(self): HoodAI.HoodAI.shutdown(self) @@ -53,8 +54,9 @@ class DGHoodAI(HoodAI.HoodAI): def createButterflies(self): playground = ButterflyGlobals.DG ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.DG) + for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.DG]): for _ in xrange(0, ButterflyGlobals.NUM_BUTTERFLIES[ButterflyGlobals.DG]): butterfly = DistributedButterflyAI.DistributedButterflyAI(self.air, playground, i, self.zoneId) butterfly.generateWithRequired(self.zoneId) - butterfly.start() + butterfly.start() \ No newline at end of file diff --git a/toontown/hood/DLHood.py b/toontown/hood/DLHood.py index 286dad4e..87dc4867 100755 --- a/toontown/hood/DLHood.py +++ b/toontown/hood/DLHood.py @@ -3,7 +3,6 @@ from toontown.town.DLTownLoader import DLTownLoader from toontown.toonbase import ToontownGlobals from toontown.hood.ToonHood import ToonHood - class DLHood(ToonHood): notify = directNotify.newCategory('DLHood') @@ -15,7 +14,5 @@ class DLHood(ToonHood): TITLE_COLOR = (1.0, 0.9, 0.5, 1.0) HOLIDAY_DNA = { - ToontownGlobals.WINTER_DECORATIONS: ['phase_8/dna/winter_storage_DL.pdna'], - ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_8/dna/winter_storage_DL.pdna'], - ToontownGlobals.HALLOWEEN_PROPS: ['phase_8/dna/halloween_props_storage_DL.pdna'], - ToontownGlobals.SPOOKY_PROPS: ['phase_8/dna/halloween_props_storage_DL.pdna']} + ToontownGlobals.CHRISTMAS: ['phase_8/dna/winter_storage_DL.pdna'], + ToontownGlobals.HALLOWEEN: ['phase_8/dna/halloween_props_storage_DL.pdna']} diff --git a/toontown/hood/DLHoodAI.py b/toontown/hood/DLHoodAI.py index 245a4c8e..3ce55554 100755 --- a/toontown/hood/DLHoodAI.py +++ b/toontown/hood/DLHoodAI.py @@ -2,8 +2,7 @@ from toontown.hood import HoodAI from toontown.safezone import DistributedTrolleyAI, DistributedPillowAI from toontown.toonbase import ToontownGlobals from toontown.ai import DistributedResistanceEmoteMgrAI -from toontown.ai import DistributedTrickOrTreatTargetAI - +from toontown.ai import DistributedEffectMgrAI class DLHoodAI(HoodAI.HoodAI): def __init__(self, air): @@ -20,12 +19,15 @@ class DLHoodAI(HoodAI.HoodAI): if simbase.config.GetBool('want-minigames', True): self.createTrolley() + self.resistanceEmoteManager = DistributedResistanceEmoteMgrAI.DistributedResistanceEmoteMgrAI(self.air) self.resistanceEmoteManager.generateWithRequired(9720) - if simbase.air.wantHalloween: - self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) - self.TrickOrTreatTargetManager.generateWithRequired(9619) + self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12) + self.trickOrTreatMgr.generateWithRequired(9619) # Relax to the Max, Lullaby Lane + + self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14) + self.winterCarolingMgr.generateWithRequired(9722) # Dream On Talent Agency, Pajama Place self.createPillow() @@ -36,4 +38,4 @@ class DLHoodAI(HoodAI.HoodAI): def createPillow(self): self.pillow = DistributedPillowAI.DistributedPillowAI(self.air) - self.pillow.generateWithRequired(self.zoneId) + self.pillow.generateWithRequired(self.zoneId) \ No newline at end of file diff --git a/toontown/hood/EstateHood.py b/toontown/hood/EstateHood.py index 02523019..7ebd888d 100755 --- a/toontown/hood/EstateHood.py +++ b/toontown/hood/EstateHood.py @@ -30,10 +30,8 @@ class EstateHood(Hood): self.storageDNAFile = 'phase_5.5/dna/storage_estate.pdna' self.holidayStorageDNADict = { - WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'], - WACKY_WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'], - HALLOWEEN_PROPS: ['phase_5.5/dna/halloween_props_storage_estate.pdna'], - SPOOKY_PROPS: ['phase_5.5/dna/halloween_props_storage_estate.pdna']} + CHRISTMAS: ['phase_5.5/dna/winter_storage_estate.pdna'], + HALLOWEEN: ['phase_5.5/dna/halloween_props_storage_estate.pdna']} self.skyFile = 'phase_3.5/models/props/TT_sky' self.spookySkyFile = 'phase_3.5/models/props/BR_sky' diff --git a/toontown/hood/GSHood.py b/toontown/hood/GSHood.py index 83cfd0fe..f30ab959 100755 --- a/toontown/hood/GSHood.py +++ b/toontown/hood/GSHood.py @@ -22,4 +22,4 @@ class GSHood(ToonHood): base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar) base.localAvatar.chatMgr.chatInputSpeedChat.removeKartRacingMenu() - ToonHood.exit(self) + ToonHood.exit(self) \ No newline at end of file diff --git a/toontown/hood/GenericAnimatedProp.py b/toontown/hood/GenericAnimatedProp.py index d439b675..0b3afa94 100755 --- a/toontown/hood/GenericAnimatedProp.py +++ b/toontown/hood/GenericAnimatedProp.py @@ -8,12 +8,12 @@ from toontown.hood import HoodUtil class GenericAnimatedProp(AnimatedProp.AnimatedProp): notify = DirectNotifyGlobal.directNotify.newCategory('GenericAnimatedProp') - AnimsUsingWav = [] def __init__(self, node): AnimatedProp.AnimatedProp.__init__(self, node) self.origAnimNameToSound = {} code = node.getTag('DNACode') + if code.startswith('interactive_prop_'): pathStr = code[len('interactive_prop_'):].split('__')[0] elif code.startswith('animated_prop_generic_'): @@ -23,10 +23,12 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): nextUnderscore = tempStr.find('_') finalStr = tempStr[nextUnderscore + 1:] pathStr = finalStr.split('__')[0] + phaseDelimeter = len('phase_') + pathStr[len('phase_'):].find('_') phaseStr = pathStr[:phaseDelimeter] pathTokens = pathStr[phaseDelimeter + 1:].split('_') self.path = phaseStr + for path in pathTokens: self.path += '/' self.path += path @@ -39,6 +41,11 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): def delete(self): AnimatedProp.AnimatedProp.delete(self) + + if hasattr(self, 'soundNode'): + self.soundNode.removeNode() + del self.soundNode + self.node.cleanup() del self.node del self.trashcan @@ -67,6 +74,7 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): self.hoodId = ToontownGlobals.ToontownCentral fullString = str(node) splits = fullString.split('/') + if len(splits) >= 5: visId = int(splits[4]) self.visId = visId @@ -80,28 +88,22 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): def createSoundInterval(self, origAnimNameWithPath, maximumDuration): if not hasattr(base, 'localAvatar'): return Sequence() - sfxVolume = 1.0 - cutoff = 45 + if not hasattr(self, 'soundPath'): self.soundPath = self.path.replace('/models/char', '/audio/sfx') + origAnimName = origAnimNameWithPath.split('/')[-1] - theSound = self.origAnimNameToSound.get(origAnimName) - if not theSound: - soundfile = origAnimName.replace('tt_a_ara', 'tt_s_ara') - fullPath = self.soundPath + '/' + soundfile - if origAnimName in self.AnimsUsingWav: - theSound = loader.loadSfx(fullPath + '.ogg') - else: - theSound = loader.loadSfx(fullPath + '.ogg') - self.origAnimNameToSound[origAnimName] = theSound - if theSound: - soundDur = theSound.length() - if maximumDuration < soundDur: - if base.config.GetBool('interactive-prop-info', False): - if self.visId == localAvatar.zoneId and origAnimName != 'tt_a_ara_dga_hydrant_idleIntoFight': - self.notify.warning('anim %s had duration of %s while sound has duration of %s' % (origAnimName, maximumDuration, soundDur)) - soundDur = maximumDuration - result = SoundInterval(theSound, node=self.node, listenerNode=base.localAvatar, volume=sfxVolume, cutOff=cutoff, startTime=0, duration=soundDur) - else: - result = Sequence() - return result + sound = self.origAnimNameToSound.get(origAnimName) + + if not sound: + sound = loader.loadSfx('%s/%s.ogg' % (self.soundPath, origAnimName.replace('tt_a_ara', 'tt_s_ara'))) + self.origAnimNameToSound[origAnimName] = sound + + if sound: + if not hasattr(self, 'soundNode'): + self.soundNode = render.attachNewNode('Sound Node') + self.soundNode.setPos(self.trashcan.getBounds().getCenter()) + + return SoundInterval(sound, node=self.soundNode, listenerNode=base.localAvatar, volume=1.0, cutOff=45, startTime=0, duration=min(sound.length(), maximumDuration)) + + return Sequence() \ No newline at end of file diff --git a/toontown/hood/Hood.py b/toontown/hood/Hood.py index 4d5942c9..5d983306 100755 --- a/toontown/hood/Hood.py +++ b/toontown/hood/Hood.py @@ -76,28 +76,24 @@ class Hood(StateData.StateData): def load(self): files = [] + if self.storageDNAFile: files.append(self.storageDNAFile) - newsManager = base.cr.newsManager - if newsManager: - holidayIds = base.cr.newsManager.getDecorationHolidayId() - for holiday in holidayIds: - for storageFile in self.holidayStorageDNADict.get(holiday, []): + + for key, value in self.holidayStorageDNADict.iteritems(): + if base.cr.newsManager.isHolidayRunning(key): + for storageFile in value: files.append(storageFile) - if ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds and ToontownGlobals.SPOOKY_COSTUMES not in holidayIds or not self.spookySkyFile: - self.sky = loader.loadModel(self.skyFile) - self.sky.setTag('sky', 'Regular') - self.sky.setScale(1.0) - self.sky.setFogOff() - else: - self.sky = loader.loadModel(self.spookySkyFile) - self.sky.setTag('sky', 'Halloween') - if not newsManager: + if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN) or not self.spookySkyFile: self.sky = loader.loadModel(self.skyFile) self.sky.setTag('sky', 'Regular') self.sky.setScale(1.0) self.sky.setFogOff() + else: + self.sky = loader.loadModel(self.spookySkyFile) + self.sky.setTag('sky', 'Halloween') + dnaBulk = DNABulkLoader(self.dnaStore, tuple(files)) dnaBulk.loadDNAFiles() diff --git a/toontown/hood/HydrantInteractiveProp.py b/toontown/hood/HydrantInteractiveProp.py index 15463bce..b279a33a 100755 --- a/toontown/hood/HydrantInteractiveProp.py +++ b/toontown/hood/HydrantInteractiveProp.py @@ -111,8 +111,8 @@ class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): if self.hasOverrideIval(origAnimName): result.append(Func(self.showWater)) - anim = self.createAnimIval('fight0' if 'fightBoost' in origAnimName else 'fight1') - result.append(anim) + animAndSound = self.createAnimAndSoundIval('fight0' if 'fightBoost' in origAnimName else 'fight1') + result.append(animAndSound) result.append(Func(self.hideWater)) - return result + return result \ No newline at end of file diff --git a/toontown/hood/HydrantOneAnimatedProp.py b/toontown/hood/HydrantOneAnimatedProp.py deleted file mode 100644 index 71f2bdde..00000000 --- a/toontown/hood/HydrantOneAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class HydrantOneAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('HydrantOneAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_ttc_hydrant_firstMoveArmUp1', 40 * PauseTimeMult), - 1: ('tt_a_ara_ttc_hydrant_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_ttc_hydrant_firstMoveArmUp2', 10 * PauseTimeMult), - 3: ('tt_a_ara_ttc_hydrant_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_ttc_hydrant_firstMoveJumpBalance', 6 * PauseTimeMult), - 5: ('tt_a_ara_ttc_hydrant_firstMoveArmUp3', 4 * PauseTimeMult), - 6: ('tt_a_ara_ttc_hydrant_firstMoveJumpSpin', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 3 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'hydrant', self.PhaseInfo, ToontownGlobals.HYDRANT_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/HydrantTwoAnimatedProp.py b/toontown/hood/HydrantTwoAnimatedProp.py deleted file mode 100644 index c94435ec..00000000 --- a/toontown/hood/HydrantTwoAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class HydrantTwoAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('HydrantTwoAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_ttc_hydrant_firstMoveArmUp1', 40 * PauseTimeMult), - 1: ('tt_a_ara_ttc_hydrant_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_ttc_hydrant_firstMoveArmUp2', 10 * PauseTimeMult), - 3: ('tt_a_ara_ttc_hydrant_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_ttc_hydrant_firstMoveJumpBalance', 6 * PauseTimeMult), - 5: ('tt_a_ara_ttc_hydrant_firstMoveArmUp3', 4 * PauseTimeMult), - 6: ('tt_a_ara_ttc_hydrant_firstMoveJumpSpin', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 5 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'hydrant', self.PhaseInfo, ToontownGlobals.HYDRANT_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/HydrantZeroAnimatedProp.py b/toontown/hood/HydrantZeroAnimatedProp.py deleted file mode 100644 index 98249ad1..00000000 --- a/toontown/hood/HydrantZeroAnimatedProp.py +++ /dev/null @@ -1,17 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class HydrantZeroAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('HydrantZeroAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_ttc_hydrant_firstMoveArmUp1', 40 * PauseTimeMult), - 1: ('tt_a_ara_ttc_hydrant_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_ttc_hydrant_firstMoveArmUp2', 10 * PauseTimeMult), - 3: ('tt_a_ara_ttc_hydrant_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_ttc_hydrant_firstMoveJumpBalance', 6 * PauseTimeMult), - 5: ('tt_a_ara_ttc_hydrant_firstMoveArmUp3', 4 * PauseTimeMult), - 6: ('tt_a_ara_ttc_hydrant_firstMoveJumpSpin', 2 * PauseTimeMult)} - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'hydrant', self.PhaseInfo, ToontownGlobals.HYDRANT_ZERO_HOLIDAY) diff --git a/toontown/hood/InteractiveAnimatedProp.py b/toontown/hood/InteractiveAnimatedProp.py index 18123b11..84d57f88 100755 --- a/toontown/hood/InteractiveAnimatedProp.py +++ b/toontown/hood/InteractiveAnimatedProp.py @@ -1,13 +1,11 @@ -import math -import random -import GenericAnimatedProp -from direct.actor import Actor -from direct.interval.IntervalGlobal import Sequence, ActorInterval, Wait, Func, Parallel -from direct.fsm import FSM -from direct.showbase.PythonUtil import weightedChoice from pandac.PandaModules import TextNode, Vec3 +from direct.actor import Actor +from direct.fsm import FSM +from direct.interval.IntervalGlobal import Sequence, ActorInterval, Wait, Func, SoundInterval, Parallel +from direct.showbase.PythonUtil import weightedChoice from toontown.toonbase import ToontownGlobals -from toontown.hood import ZoneUtil +import GenericAnimatedProp +import math, random def clearPythonIvals(ival): if hasattr(ival, 'function'): @@ -17,8 +15,6 @@ def clearPythonIvals(ival): clearPythonIvals(oneIval) ival.pythonIvals = [] - return - class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): ZoneToIdles = {} @@ -44,6 +40,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.okToStartNextAnim = False cellIndexStr = node.getTag('DNACellIndex') self.cellIndex = ord(cellIndexStr) + self.origAnimNameToSound = {} self.lastPlayingAnimPhase = 0 self.buildingsMakingMeSad = set() GenericAnimatedProp.GenericAnimatedProp.__init__(self, node) @@ -67,20 +64,25 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.numIdles = len(self.ZoneToIdles[self.hoodId]) if self.hoodId in self.ZoneToFightAnims: self.numFightAnims = len(self.ZoneToFightAnims[self.hoodId]) + self.idleInterval = None anim = node.getTag('DNAAnim') self.trashcan = Actor.Actor(node, copy=0) self.trashcan.reparentTo(node) animDict = {} animDict['anim'] = '%s/%s' % (self.path, anim) + for i in xrange(self.numIdles): baseAnim = self.ZoneToIdles[self.hoodId][i] + if isinstance(baseAnim, tuple): baseAnim = baseAnim[0] + animStr = self.path + '/' + baseAnim animKey = 'idle%d' % i animDict[animKey] = animStr settleName = self.getSettleName(i) + if settleName: settleStr = self.path + '/' + settleName settleKey = 'settle%d' % i @@ -95,14 +97,17 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): animStr = self.path + '/' + self.ZoneToIdleIntoFightAnims[self.hoodId] animKey = 'idleIntoFight' animDict[animKey] = animStr + if self.hoodId in self.ZoneToIdleIntoFightAnims: animStr = self.path + '/' + self.ZoneToVictoryAnims[self.hoodId] animKey = 'victory' animDict[animKey] = animStr + if self.hoodId in self.ZoneToSadAnims: animStr = self.path + '/' + self.ZoneToSadAnims[self.hoodId] animKey = 'sad' animDict[animKey] = animStr + self.trashcan.loadAnims(animDict) self.trashcan.pose('anim', 0) self.node = self.trashcan @@ -113,6 +118,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def createIdleInterval(self): result = Sequence() + if self.numIdles >= 3: numberOfAnimsAbove2 = self.numIdles - 2 for rareIdle in xrange(2, self.numIdles): @@ -152,26 +158,28 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def createBattleCheerInterval(self): result = Sequence() + for i in xrange(self.numFightAnims): animKey = 'fight%d' % i - animIval = self.createAnimIval(animKey) + animAndSoundIval = self.createAnimAndSoundIval(animKey) origAnimName = self.node.getAnimFilename(animKey).split('/')[-1] if self.hasOverrideIval(origAnimName): result.append(self.getOverrideIval(origAnimName)) elif self.hasSpecialIval(origAnimName): - result.append(Parallel(animIval, self.getSpecialIval(origAnimName))) + result.append(Parallel(animAndSoundIval, self.getSpecialIval(origAnimName))) else: - result.append(animIval) + result.append(animAndSoundIval) self.createBattleCheerText() battleCheerTextIval = Sequence(Func(self.hpText.show), self.hpText.posInterval(duration=4.0, pos=Vec3(0, 0, 7), startPos=(0, 0, 3)), Func(self.hpText.hide)) ivalWithText = Parallel(battleCheerTextIval, result) + return ivalWithText def createSadInterval(self): result = Sequence() if self.hoodId in self.ZoneToSadAnims: - result = self.createAnimIval('sad') + result = self.createAnimAndSoundIval('sad') return result def hasSpecialIval(self, origAnimName): @@ -188,18 +196,21 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def createVictoryInterval(self): result = Sequence() + if self.hoodId in self.ZoneToVictoryAnims: - animIval = self.createAnimIval('victory') - result.append(animIval) + animAndSoundIval = self.createAnimAndSoundIval('victory') + result.append(animAndSoundIval) + return result def enter(self): GenericAnimatedProp.GenericAnimatedProp.enter(self) + if base.config.GetBool('props-buff-battles', True): self.notify.debug('props buff battles is true') self.node.stop() self.node.pose('idle0', 0) - self.idleInterval.loop() + self.requestIdleOrSad() else: self.notify.debug('props do not buff battles') self.node.stop() @@ -215,6 +226,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): if not hasattr(self, 'node') or not self.node: self.notify.warning("requestIdleOrSad returning hasattr(self,'node')=%s" % hasattr(self, 'node')) return + if self.buildingsMakingMeSad: self.request('Sad') else: @@ -248,6 +260,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def chooseIdleAnimToRun(self): result = self.numIdles - 1 + if base.config.GetBool('randomize-interactive-idles', True): pairs = [] for i in xrange(self.numIdles): @@ -261,47 +274,54 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): result = self.lastPlayingAnimPhase + 1 if result >= len(self.ZoneToIdles[self.hoodId]): result = 0 + return result def startNextIdleAnim(self): - self.notify.debug('startNextAnim self.okToStartNextAnim=%s' % self.okToStartNextAnim) if not hasattr(self, 'node') or not self.node: self.notify.warning("startNextIdleAnim returning hasattr(self,'node')=%s" % hasattr(self, 'node')) return + self.curIval = None + if self.okToStartNextAnim: self.notify.debug('got pass okToStartNextAnim') whichAnim = self.chooseIdleAnimToRun() - if self.visId == localAvatar.zoneId: - self.notify.debug('whichAnim=%s' % whichAnim) self.lastPlayingAnimPhase = whichAnim self.curIval = self.createIdleAnimSequence(whichAnim) self.notify.debug('starting curIval of length %s' % self.curIval.getDuration()) self.curIval.start() else: - self.curIval = Wait(10) + self.curIval = Wait(3) self.notify.debug('false self.okToStartNextAnim=%s' % self.okToStartNextAnim) - return - def createIdleAnimInterval(self, whichIdleAnim, startingTime = 0): + def createIdleAnimAndSoundInterval(self, whichIdleAnim, startingTime = 0): animIval = self.node.actorInterval('idle%d' % whichIdleAnim, startTime=startingTime) animIvalDuration = animIval.getDuration() origAnimName = self.ZoneToIdles[self.hoodId][whichIdleAnim] + if isinstance(origAnimName, tuple): origAnimName = origAnimName[0] + + soundIval = self.createSoundInterval(origAnimName, animIvalDuration) + soundIvalDuration = soundIval.getDuration() + if self.hasSpecialIval(origAnimName): specialIval = self.getSpecialIval(origAnimName) - return Parallel(animIval, specialIval) + return Parallel(animIval, soundIval, specialIval) else: - return animIval + return Parallel(animIval, soundIval) def createIdleAnimSequence(self, whichIdleAnim): dummyResult = Sequence(Wait(self.IdlePauseTime)) + if not hasattr(self, 'node') or not self.node: self.notify.warning("createIdleAnimSequence returning dummyResult hasattr(self,'node')=%s" % hasattr(self, 'node')) return dummyResult - idleAnim = self.createIdleAnimInterval(whichIdleAnim) - result = Sequence(idleAnim, Wait(self.IdlePauseTime), Func(self.startNextIdleAnim)) + + idleAnimAndSound = self.createIdleAnimAndSoundInterval(whichIdleAnim) + result = Sequence(idleAnimAndSound, Wait(self.IdlePauseTime), Func(self.startNextIdleAnim)) + if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple) and len(self.ZoneToIdles[self.hoodId][whichIdleAnim]) > 2: info = self.ZoneToIdles[self.hoodId][whichIdleAnim] origAnimName = info[0] @@ -314,17 +334,14 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): pauseTime = random.randrange(minPauseTime, maxPauseTime + 1) result = Sequence() for i in xrange(numberOfLoops): - result.append(idleAnim) + result.append(idleAnimAndSound) if self.getSettleName(whichIdleAnim): result.append(self.node.actorInterval('settle%d' % whichIdleAnim)) result.append(Wait(pauseTime)) result.append(Func(self.startNextIdleAnim)) - return result - def gotoFaceoff(self): - self.notify.debugStateCall(self) - self.request('Faceoff') + return result def gotoBattleCheer(self): self.notify.debugStateCall(self) @@ -345,22 +362,14 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def buildingLiberated(self, buildingDoId): self.buildingsMakingMeSad.discard(buildingDoId) + if not self.buildingsMakingMeSad: self.gotoIdle() - def enterFaceoff(self): - self.notify.debugStateCall(self) - self.curIval = self.createFaceoffInterval() - self.curIval.start() - - def exitFaceoff(self): - self.notify.debugStateCall(self) - self.curIval.pause() - self.curIval = None - def calcWhichIdleAnim(self, animName): result = 0 info = self.ZoneToIdles[self.hoodId] + for index, curInfo in enumerate(info): if isinstance(curInfo, tuple): if curInfo[0] == animName: @@ -373,82 +382,74 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): return result - def createFaceoffInterval(self): - result = Sequence() - if self.lastIdleAnimName: - whichIdleAnim = self.calcWhichIdleAnim(self.lastIdleAnimName) - anim = self.createIdleAnimInterval(whichIdleAnim, self.lastIdleTime) - result.append(anim) - idleIntoFightIval = self.createAnimIval('idleIntoFight') - result.append(idleIntoFightIval) - result.append(Func(self.gotoBattleCheer)) - return result - def enterBattleCheer(self): self.notify.debugStateCall(self) self.curIval = self.battleCheerInterval + if self.curIval: self.curIval.loop() def exitBattleCheer(self): self.notify.debugStateCall(self) + if self.curIval: self.curIval.finish() self.curIval = None - return def enterVictory(self): self.notify.debugStateCall(self) self.curIval = self.victoryInterval + if self.curIval: self.curIval.loop() def exitVictory(self): self.notify.debugStateCall(self) + if self.curIval: self.curIval.finish() self.curIval = None - return def enterSad(self): self.notify.debugStateCall(self) self.curIval = self.sadInterval + if self.curIval: self.curIval.loop() def exitSad(self): self.notify.debugStateCall(self) + if self.curIval: self.curIval.finish() self.curIval = None - return def getSettleName(self, whichIdleAnim): - result = None if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple) and len(self.ZoneToIdles[self.hoodId][whichIdleAnim]) > 3: - result = self.ZoneToIdles[self.hoodId][whichIdleAnim][3] - return result + return self.ZoneToIdles[self.hoodId][whichIdleAnim][3] + return None def getOrigIdleAnimName(self, whichIdleAnim): - result = None - if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple): - result = self.ZoneToIdles[self.hoodId][whichIdleAnim][0] - else: - result = self.ZoneToIdles[self.hoodId][whichIdleAnim] - return result + anim = self.ZoneToIdles[self.hoodId][whichIdleAnim] - def createAnimIval(self, animKey): + return anim[0] if isinstance(anim, tuple) else anim + + def createAnimAndSoundIval(self, animKey): animIval = self.node.actorInterval(animKey) animIvalDuration = animIval.getDuration() origAnimName = self.node.getAnimFilename(animKey) + soundIval = self.createSoundInterval(origAnimName, animIvalDuration) + soundIvalDuration = soundIval.getDuration() + if self.hasSpecialIval(origAnimName): specialIval = self.getSpecialIval(origAnimName) - return Parallel(animIval, specialIval) + return Parallel(animIval, soundIval, specialIval) else: - return animIval + return Parallel(animIval, soundIval) def clearCurIval(self): if self.curIval: self.curIval.finish() + clearPythonIvals(self.curIval) - self.curIval = None + self.curIval = None \ No newline at end of file diff --git a/toontown/hood/MMHood.py b/toontown/hood/MMHood.py index fe77c620..311f81e3 100755 --- a/toontown/hood/MMHood.py +++ b/toontown/hood/MMHood.py @@ -16,7 +16,5 @@ class MMHood(ToonHood): TITLE_COLOR = (1.0, 0.5, 0.5, 1.0) HOLIDAY_DNA = { - ToontownGlobals.WINTER_DECORATIONS: ['phase_6/dna/winter_storage_MM.pdna'], - ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_6/dna/winter_storage_MM.pdna'], - ToontownGlobals.HALLOWEEN_PROPS: ['phase_6/dna/halloween_props_storage_MM.pdna'], - ToontownGlobals.SPOOKY_PROPS: ['phase_6/dna/halloween_props_storage_MM.pdna']} + ToontownGlobals.CHRISTMAS: ['phase_6/dna/winter_storage_MM.pdna'], + ToontownGlobals.HALLOWEEN: ['phase_6/dna/halloween_props_storage_MM.pdna']} \ No newline at end of file diff --git a/toontown/hood/MMHoodAI.py b/toontown/hood/MMHoodAI.py index a8ae2a11..6595d45f 100755 --- a/toontown/hood/MMHoodAI.py +++ b/toontown/hood/MMHoodAI.py @@ -2,7 +2,7 @@ from toontown.hood import HoodAI from toontown.safezone import DistributedTrolleyAI from toontown.safezone import DistributedMMPianoAI from toontown.toonbase import ToontownGlobals -from toontown.ai import DistributedTrickOrTreatTargetAI +from toontown.ai import DistributedEffectMgrAI class MMHoodAI(HoodAI.HoodAI): def __init__(self, air): @@ -24,11 +24,13 @@ class MMHoodAI(HoodAI.HoodAI): self.piano = DistributedMMPianoAI.DistributedMMPianoAI(self.air) self.piano.generateWithRequired(self.zoneId) - if simbase.air.wantHalloween: - self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) - self.TrickOrTreatTargetManager.generateWithRequired(4835) + self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12) + self.trickOrTreatMgr.generateWithRequired(4835) # Ursatz for Really Kool Katz, Tenor Terrace + + self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14) + self.winterCarolingMgr.generateWithRequired(4614) # Shave and a Haircut for a Song, Alto Avenue def createTrolley(self): self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air) self.trolley.generateWithRequired(self.zoneId) - self.trolley.start() + self.trolley.start() \ No newline at end of file diff --git a/toontown/hood/MailboxInteractiveProp.py b/toontown/hood/MailboxInteractiveProp.py index fa2a315f..e9db742c 100755 --- a/toontown/hood/MailboxInteractiveProp.py +++ b/toontown/hood/MailboxInteractiveProp.py @@ -69,9 +69,6 @@ class MailboxInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) - def __init__(self, node): - InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node) - def setupActor(self, node): self.pieActor = Actor.Actor('phase_5/models/char/tt_r_prp_ext_piePackage', {'fightBoost': 'phase_5/models/char/tt_a_prp_ext_piePackage_fightBoost'}) self.pieActor.reparentTo(self.node) diff --git a/toontown/hood/MailboxOneAnimatedProp.py b/toontown/hood/MailboxOneAnimatedProp.py deleted file mode 100644 index 26ca187d..00000000 --- a/toontown/hood/MailboxOneAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class MailboxOneAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('MailboxOneAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin1', 40 * PauseTimeMult), - 1: (('tt_a_ara_dod_mailbox_firstMoveStruggle', 'tt_a_ara_dod_mailbox_firstMoveJump'), 20 * PauseTimeMult), - 2: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin3', 8 * PauseTimeMult), - 4: ('tt_a_ara_dod_mailbox_firstMoveJumpSummersault', 6 * PauseTimeMult), - 5: ('tt_a_ara_dod_mailbox_firstMoveJumpFall', 4 * PauseTimeMult), - 6: ('tt_a_ara_dod_mailbox_firstMoveJump3Summersaults', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 3 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'mailbox', self.PhaseInfo, ToontownGlobals.MAILBOX_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/MailboxTwoAnimatedProp.py b/toontown/hood/MailboxTwoAnimatedProp.py deleted file mode 100644 index 8c2472a7..00000000 --- a/toontown/hood/MailboxTwoAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class MailboxTwoAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('MailboxTwoAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin1', 40 * PauseTimeMult), - 1: (('tt_a_ara_dod_mailbox_firstMoveStruggle', 'tt_a_ara_dod_mailbox_firstMoveJump'), 20 * PauseTimeMult), - 2: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin3', 8 * PauseTimeMult), - 4: ('tt_a_ara_dod_mailbox_firstMoveJumpSummersault', 6 * PauseTimeMult), - 5: ('tt_a_ara_dod_mailbox_firstMoveJumpFall', 4 * PauseTimeMult), - 6: ('tt_a_ara_dod_mailbox_firstMoveJump3Summersaults', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 5 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'mailbox', self.PhaseInfo, ToontownGlobals.MAILBOX_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/MailboxZeroAnimatedProp.py b/toontown/hood/MailboxZeroAnimatedProp.py deleted file mode 100644 index 2ccdf35b..00000000 --- a/toontown/hood/MailboxZeroAnimatedProp.py +++ /dev/null @@ -1,17 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class MailboxZeroAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('MailboxZeroAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin1', 40 * PauseTimeMult), - 1: (('tt_a_ara_dod_mailbox_firstMoveStruggle', 'tt_a_ara_dod_mailbox_firstMoveJump'), 20 * PauseTimeMult), - 2: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin3', 8 * PauseTimeMult), - 4: ('tt_a_ara_dod_mailbox_firstMoveJumpSummersault', 6 * PauseTimeMult), - 5: ('tt_a_ara_dod_mailbox_firstMoveJumpFall', 4 * PauseTimeMult), - 6: ('tt_a_ara_dod_mailbox_firstMoveJump3Summersaults', 2 * PauseTimeMult)} - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'mailbox', self.PhaseInfo, ToontownGlobals.MAILBOX_ZERO_HOLIDAY) diff --git a/toontown/hood/PartyHood.py b/toontown/hood/PartyHood.py index f2393539..b46c9bc3 100755 --- a/toontown/hood/PartyHood.py +++ b/toontown/hood/PartyHood.py @@ -27,8 +27,7 @@ class PartyHood(Hood.Hood): self.safeZoneLoaderClass = PartyLoader.PartyLoader self.partyActivityDoneEvent = 'partyActivityDone' self.storageDNAFile = 'phase_13/dna/storage_party_sz.pdna' - self.holidayStorageDNADict = {WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'], - WACKY_WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna']} + self.holidayStorageDNADict = {CHRISTMAS: ['phase_5.5/dna/winter_storage_estate.pdna']} self.skyFile = 'phase_3.5/models/props/TT_sky' self.popupInfo = None return diff --git a/toontown/hood/SellbotHQAI.py b/toontown/hood/SellbotHQAI.py index 093282a2..576c3451 100755 --- a/toontown/hood/SellbotHQAI.py +++ b/toontown/hood/SellbotHQAI.py @@ -56,9 +56,7 @@ class SellbotHQAI(CogHQAI.CogHQAI): self.factoryElevators.append(factoryElevator) def createFactoryBoardingParty(self): - factoryIdList = [] - for factoryElevator in self.factoryElevators: - factoryIdList.append(factoryElevator.doId) + factoryIdList = [elevator.doId for elevator in self.factoryElevators] self.factoryBoardingParty = DistributedBoardingPartyAI(self.air, factoryIdList, 4) self.factoryBoardingParty.generateWithRequired(ToontownGlobals.SellbotFactoryExt) diff --git a/toontown/hood/SleepingHydrantAnimatedProp.py b/toontown/hood/SleepingHydrantAnimatedProp.py deleted file mode 100755 index 0b6845b6..00000000 --- a/toontown/hood/SleepingHydrantAnimatedProp.py +++ /dev/null @@ -1,26 +0,0 @@ -import AnimatedProp -from direct.interval.IntervalGlobal import * -from direct.task import Task -import math - -class SleepingHydrantAnimatedProp(AnimatedProp.AnimatedProp): - - def __init__(self, node): - AnimatedProp.AnimatedProp.__init__(self, node) - self.task = None - return - - def bobTask(self, task): - self.node.setSz(1.0 + 0.08 * math.sin(task.time)) - return Task.cont - - def enter(self): - AnimatedProp.AnimatedProp.enter(self) - self.task = taskMgr.add(self.bobTask, self.uniqueName('bobTask')) - - def exit(self): - AnimatedProp.AnimatedProp.exit(self) - if self.task: - taskMgr.remove(self.task) - self.task = None - return diff --git a/toontown/hood/TTHood.py b/toontown/hood/TTHood.py index ccf9ee29..b43760d1 100755 --- a/toontown/hood/TTHood.py +++ b/toontown/hood/TTHood.py @@ -1,11 +1,9 @@ +from otp.ai.MagicWordGlobal import * from toontown.safezone.TTSafeZoneLoader import TTSafeZoneLoader from toontown.town.TTTownLoader import TTTownLoader from toontown.toonbase import ToontownGlobals from toontown.hood.ToonHood import ToonHood -from otp.ai.MagicWordGlobal import * - - class TTHood(ToonHood): notify = directNotify.newCategory('TTHood') @@ -18,11 +16,8 @@ class TTHood(ToonHood): TITLE_COLOR = (1.0, 0.5, 0.4, 1.0) HOLIDAY_DNA = { - ToontownGlobals.WINTER_DECORATIONS: ['phase_4/dna/winter_storage_TT.pdna', 'phase_4/dna/winter_storage_TT_sz.pdna'], - ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_4/dna/winter_storage_TT.pdna', 'phase_4/dna/winter_storage_TT_sz.pdna'], - ToontownGlobals.HALLOWEEN_PROPS: ['phase_4/dna/halloween_props_storage_TT.pdna', 'phase_4/dna/halloween_props_storage_TT_sz.pdna'], - ToontownGlobals.SPOOKY_PROPS: ['phase_4/dna/halloween_props_storage_TT.pdna', 'phase_4/dna/halloween_props_storage_TT_sz.pdna']} - + ToontownGlobals.CHRISTMAS: ['phase_4/dna/winter_storage_TT.pdna', 'phase_4/dna/winter_storage_TT_sz.pdna'], + ToontownGlobals.HALLOWEEN: ['phase_4/dna/halloween_props_storage_TT.pdna', 'phase_4/dna/halloween_props_storage_TT_sz.pdna']} @magicWord(category=CATEGORY_CREATIVE) def spooky(): @@ -42,4 +37,4 @@ def spooky(): fadeOut.start() spookySfx = base.loadSfx('phase_4/audio/sfx/spooky.ogg') spookySfx.play() - return 'Activating the spooky effect...' + return 'Activating the spooky effect...' \ No newline at end of file diff --git a/toontown/hood/TTHoodAI.py b/toontown/hood/TTHoodAI.py index 1d5f4fee..5a4347f2 100755 --- a/toontown/hood/TTHoodAI.py +++ b/toontown/hood/TTHoodAI.py @@ -5,9 +5,7 @@ from toontown.safezone import DistributedTrolleyAI from toontown.toon import NPCToons from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals -from toontown.ai import DistributedTrickOrTreatTargetAI -from toontown.ai import DistributedWinterCarolingTargetAI - +from toontown.ai import DistributedEffectMgrAI class TTHoodAI(HoodAI.HoodAI): def __init__(self, air): @@ -32,13 +30,11 @@ class TTHoodAI(HoodAI.HoodAI): (ToontownGlobals.ToontownCentral, TTLocalizer.NPCToonNames[2021], ('dss', 'ls', 's', 'm', 13, 41, 13, 13, 1, 6, 1, 6, 0, 18, 0), 'm', 1, NPCToons.NPC_GLOVE), ToontownGlobals.ToontownCentral, posIndex=0) - if simbase.air.wantHalloween: - self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) - self.TrickOrTreatTargetManager.generateWithRequired(2649) + self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12) + self.trickOrTreatMgr.generateWithRequired(2649) # All Fun and Games Shop, Silly Street - if simbase.air.wantChristmas: - self.WinterCarolingTargetManager = DistributedWinterCarolingTargetAI.DistributedWinterCarolingTargetAI(self.air) - self.WinterCarolingTargetManager.generateWithRequired(2649) + self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14) + self.winterCarolingMgr.generateWithRequired(2659) # Joy Buzzers to the World, Silly Street def shutdown(self): HoodAI.HoodAI.shutdown(self) @@ -52,8 +48,9 @@ class TTHoodAI(HoodAI.HoodAI): def createButterflies(self): playground = ButterflyGlobals.TTC ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.TTC) + for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.TTC]): for _ in xrange(0, ButterflyGlobals.NUM_BUTTERFLIES[ButterflyGlobals.TTC]): butterfly = DistributedButterflyAI.DistributedButterflyAI(self.air, playground, i, self.zoneId) butterfly.generateWithRequired(self.zoneId) - butterfly.start() + butterfly.start() \ No newline at end of file diff --git a/toontown/hood/TrashcanInteractiveProp.py b/toontown/hood/TrashcanInteractiveProp.py index 1ac6c658..25689e74 100755 --- a/toontown/hood/TrashcanInteractiveProp.py +++ b/toontown/hood/TrashcanInteractiveProp.py @@ -66,7 +66,4 @@ class TrashcanInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_trashcan_fightBoost', 'tt_a_ara_tbr_trashcan_fightCheer', 'tt_a_ara_tbr_trashcan_fightIdle'), ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_trashcan_fightBoost', 'tt_a_ara_ddl_trashcan_fightCheer', 'tt_a_ara_ddl_trashcan_fightIdle')} - IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) - - def __init__(self, node): - InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node) \ No newline at end of file + IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) \ No newline at end of file diff --git a/toontown/hood/TrashcanOneAnimatedProp.py b/toontown/hood/TrashcanOneAnimatedProp.py deleted file mode 100644 index 68d4331a..00000000 --- a/toontown/hood/TrashcanOneAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class TrashcanOneAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanOneAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dga_trashcan_firstMoveLidFlip1', 40 * PauseTimeMult), - 1: ('tt_a_ara_dga_trashcan_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_dga_trashcan_firstMoveLidFlip2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dga_trashcan_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_dga_trashcan_firstMoveLidFlip3', 6 * PauseTimeMult), - 5: ('tt_a_ara_dga_trashcan_firstMoveJumpHit', 4 * PauseTimeMult), - 6: ('tt_a_ara_dga_trashcan_firstMoveJumpJuggle', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 3 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'trashcan', self.PhaseInfo, ToontownGlobals.TRASHCAN_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/TrashcanTwoAnimatedProp.py b/toontown/hood/TrashcanTwoAnimatedProp.py deleted file mode 100644 index f0b86cec..00000000 --- a/toontown/hood/TrashcanTwoAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class TrashcanTwoAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanTwoAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dga_trashcan_firstMoveLidFlip1', 40 * PauseTimeMult), - 1: ('tt_a_ara_dga_trashcan_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_dga_trashcan_firstMoveLidFlip2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dga_trashcan_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_dga_trashcan_firstMoveLidFlip3', 6 * PauseTimeMult), - 5: ('tt_a_ara_dga_trashcan_firstMoveJumpHit', 4 * PauseTimeMult), - 6: ('tt_a_ara_dga_trashcan_firstMoveJumpJuggle', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 5 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'trashcan', self.PhaseInfo, ToontownGlobals.TRASHCAN_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/TrashcanZeroAnimatedProp.py b/toontown/hood/TrashcanZeroAnimatedProp.py deleted file mode 100644 index 7b432ad9..00000000 --- a/toontown/hood/TrashcanZeroAnimatedProp.py +++ /dev/null @@ -1,17 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class TrashcanZeroAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanZeroAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dga_trashcan_firstMoveLidFlip1', 40 * PauseTimeMult), - 1: ('tt_a_ara_dga_trashcan_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_dga_trashcan_firstMoveLidFlip2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dga_trashcan_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_dga_trashcan_firstMoveLidFlip3', 6 * PauseTimeMult), - 5: ('tt_a_ara_dga_trashcan_firstMoveJumpHit', 4 * PauseTimeMult), - 6: ('tt_a_ara_dga_trashcan_firstMoveJumpJuggle', 2 * PauseTimeMult)} - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'trashcan', self.PhaseInfo, ToontownGlobals.TRASHCAN_ZERO_HOLIDAY) diff --git a/toontown/minigame/DistributedTwoDGame.py b/toontown/minigame/DistributedTwoDGame.py index 882f7165..0ed16d91 100755 --- a/toontown/minigame/DistributedTwoDGame.py +++ b/toontown/minigame/DistributedTwoDGame.py @@ -474,10 +474,8 @@ class DistributedTwoDGame(DistributedMinigame): self.updateScore(avId, ToonBlitzGlobals.ScoreGainPerTreasure * treasure.value) else: self.notify.error('WHOA!! treasureIndex %s is out of range; numTreasures = %s' % (treasureIndex, numTreasures)) - base.localAvatar.sendLogMessage('treasureIndex %s is out of range; numTreasures = %s' % (treasureIndex, numTreasures)) else: self.notify.error('WHOA!! sectionIndex %s is out of range; numSections = %s' % (sectionIndex, numSections)) - base.localAvatar.sendLogMessage('sectionIndex %s is out of range; numSections = %s' % (sectionIndex, numSections)) def __enemyShot(self, sectionIndex, enemyIndex): self.sectionMgr.sections[sectionIndex].enemyMgr.enemies[enemyIndex].doShotTrack() diff --git a/toontown/parties/CalendarGuiDay.py b/toontown/parties/CalendarGuiDay.py index e37f119f..b9d87ca6 100755 --- a/toontown/parties/CalendarGuiDay.py +++ b/toontown/parties/CalendarGuiDay.py @@ -1,14 +1,11 @@ -import datetime -import time -from pandac.PandaModules import TextNode, Vec3, Vec4, PlaneNode, Plane, Point3 +from pandac.PandaModules import TextNode, PlaneNode, Plane from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG -from direct.directnotify import DirectNotifyGlobal from direct.gui import DirectGuiGlobals -from toontown.toonbase import TTLocalizer -from toontown.toonbase import ToontownGlobals +from toontown.ai import HolidayGlobals +from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.parties.PartyInfo import PartyInfo from toontown.parties import PartyGlobals -from toontown.ai.NewsManager import NewsManager +import datetime def myStrftime(myTime): result = '' @@ -18,9 +15,7 @@ def myStrftime(myTime): result += myTime.strftime(':%M %p') return result - class CalendarGuiDay(DirectFrame): - notify = directNotify.newCategory('CalendarGuiDay') ScrollListTextSize = 0.03 def __init__(self, parent, myDate, startDate, dayClickCallback = None, onlyFutureDaysClickable = False): @@ -30,27 +25,11 @@ class CalendarGuiDay(DirectFrame): self.dayClickCallback = dayClickCallback self.onlyFutureDaysClickable = onlyFutureDaysClickable DirectFrame.__init__(self, parent=parent) - self.timedEvents = [] - self.partiesInvitedToToday = [] - self.hostedPartiesToday = [] - self.yearlyHolidaysToday = [] - self.showMarkers = base.config.GetBool('show-calendar-markers', 0) self.filter = ToontownGlobals.CalendarFilterShowAll self.load() self.createGuiObjects() self.update() - def createDummyLocators(self): - self.dayButtonLocator = self.attachNewNode('dayButtonLocator') - self.dayButtonLocator.setX(0.1) - self.dayButtonLocator.setZ(-0.05) - self.numberLocator = self.attachNewNode('numberLocator') - self.numberLocator.setX(0.09) - self.scrollLocator = self.attachNewNode('scrollLocator') - self.selectedLocator = self.attachNewNode('selectedLocator') - self.selectedLocator.setX(0.11) - self.selectedLocator.setZ(-0.06) - def load(self): dayAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar_box') dayAsset.reparentTo(self) @@ -65,21 +44,11 @@ class CalendarGuiDay(DirectFrame): self.defaultBox = self.find('**/boxBlank') self.scrollBottomRightLocator = self.find('**/loc_bottomRightList') self.scrollDownLocator = self.find('**/loc_scrollDown') - self.attachMarker(self.scrollDownLocator) self.scrollUpLocator = self.find('**/loc_scrollUp') - self.attachMarker(self.scrollUpLocator) - - def attachMarker(self, parent, scale = 0.005, color = (1, 0, 0)): - if self.showMarkers: - marker = loader.loadModel('phase_3/models/misc/sphere') - marker.reparentTo(parent) - marker.setScale(scale) - marker.setColor(*color) def createGuiObjects(self): self.dayButton = DirectButton(parent=self.dayButtonLocator, image=self.selectedFrame, relief=None, command=self.__clickedOnDay, pressEffect=1, rolloverSound=None, clickSound=None) - self.numberWidget = DirectLabel(parent=self.numberLocator, relief=None, text=str(self.myDate.day), text_scale=0.04, text_align=TextNode.ACenter, text_font=ToontownGlobals.getInterfaceFont(), text_fg=Vec4(110 / 255.0, 126 / 255.0, 255 / 255.0, 1)) - self.attachMarker(self.numberLocator) + self.numberWidget = DirectLabel(parent=self.numberLocator, relief=None, text=str(self.myDate.day), text_scale=0.04, text_align=TextNode.ACenter, text_font=ToontownGlobals.getInterfaceFont(), text_fg=(110 / 255.0, 126 / 255.0, 255 / 255.0, 1)) self.listXorigin = 0 self.listFrameSizeX = self.scrollBottomRightLocator.getX() - self.scrollLocator.getX() self.scrollHeight = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ() @@ -102,10 +71,10 @@ class CalendarGuiDay(DirectFrame): self.scrollList = DirectScrolledList(parent=self.scrollLocator, relief=None, pos=(0, 0, 0), incButton_image=(arrowUp, arrowDown, arrowHover, - arrowUp), incButton_relief=None, incButton_scale=(self.arrowButtonXScale, 1, self.arrowButtonZScale), incButton_pos=incButtonPos, incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(arrowUp, + arrowUp), incButton_relief=None, incButton_scale=(self.arrowButtonXScale, 1, self.arrowButtonZScale), incButton_pos=incButtonPos, incButton_image3_color=(1, 1, 1, 0.2), decButton_image=(arrowUp, arrowDown, arrowHover, - arrowUp), decButton_relief=None, decButton_scale=(self.arrowButtonXScale, 1, -self.arrowButtonZScale), decButton_pos=decButtonPos, decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, -0.03), numItemsVisible=4, incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed) + arrowUp), decButton_relief=None, decButton_scale=(self.arrowButtonXScale, 1, -self.arrowButtonZScale), decButton_pos=decButtonPos, decButton_image3_color=(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, -0.03), numItemsVisible=4, incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed) itemFrameParent = self.scrollList.itemFrame.getParent() self.scrollList.incButton.reparentTo(self.scrollDownLocator) self.scrollList.decButton.reparentTo(self.scrollUpLocator) @@ -113,10 +82,9 @@ class CalendarGuiDay(DirectFrame): arrowDown.removeNode() arrowHover.removeNode() clipper = PlaneNode('clipper') - clipper.setPlane(Plane(Vec3(-1, 0, 0), Point3(0.23, 0, 0))) + clipper.setPlane(Plane((-1, 0, 0), (0.23, 0, 0))) clipNP = self.scrollList.component('itemFrame').attachNewNode(clipper) self.scrollList.component('itemFrame').setClipPlane(clipNP) - return def scrollButtonPressed(self): self.__clickedOnDay() @@ -141,59 +109,25 @@ class CalendarGuiDay(DirectFrame): else: self.defaultBox.show() self.todayBox.hide() - return def destroy(self): if self.dayClickCallback is not None: self.numberWidget.destroy() self.dayClickCallback = None - self.notify.debug('desroying %s' % self.myDate) try: for item in self.scrollList['items']: if hasattr(item, 'description') and item.description and hasattr(item.description, 'destroy'): - self.notify.debug('desroying description of item %s' % item) item.unbind(DGG.ENTER) item.unbind(DGG.EXIT) item.description.destroy() except e: - self.notify.debug('pass %s' % self.myDate) + pass self.scrollList.removeAndDestroyAllItems() self.scrollList.destroy() self.dayButton.destroy() DirectFrame.destroy(self) - return - - def addWeeklyHolidays(self): - if not self.filter == ToontownGlobals.CalendarFilterShowAll and not self.filter == ToontownGlobals.CalendarFilterShowOnlyHolidays: - return - if base.cr.newsManager: - holidays = base.cr.newsManager.getHolidaysForWeekday(self.myDate.weekday()) - holidayName = '' - holidayDesc = '' - for holidayId in holidays: - if holidayId in TTLocalizer.HolidayNamesInCalendar: - holidayName = TTLocalizer.HolidayNamesInCalendar[holidayId][0] - holidayDesc = TTLocalizer.HolidayNamesInCalendar[holidayId][1] - else: - holidayName = TTLocalizer.UnknownHoliday % holidayId - self.addTitleAndDescToScrollList(holidayName, holidayDesc) - - self.scrollList.refresh() - if base.config.GetBool('calendar-test-items', 0): - if self.myDate.date() + datetime.timedelta(days=-1) == base.cr.toontownTimeManager.getCurServerDateTime().date(): - testItems = ('1:00 AM Party', '2:00 AM CEO', '11:15 AM Party', '5:30 PM CJ', '11:00 PM Party', 'Really Really Long String') - for text in testItems: - newItem = DirectLabel(relief=None, text=text, text_scale=self.ScrollListTextSize, text_align=TextNode.ALeft) - self.scrollList.addItem(newItem) - - if self.myDate.date() + datetime.timedelta(days=-2) == base.cr.toontownTimeManager.getCurServerDateTime().date(): - testItems = ('1:00 AM Party', '3:00 AM CFO', '11:00 AM Party') - textSize = self.ScrollListTextSize - for text in testItems: - newItem = DirectLabel(relief=None, text=text, text_scale=textSize, text_align=TextNode.ALeft) - self.scrollList.addItem(newItem) def updateArrowButtons(self): numItems = 0 @@ -210,209 +144,42 @@ class CalendarGuiDay(DirectFrame): self.scrollList.decButton.show() def collectTimedEvents(self): - self.timedEvents = [] if self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyParties: for party in localAvatar.partiesInvitedTo: if party.startTime.date() == self.myDate.date(): - self.partiesInvitedToToday.append(party) - self.timedEvents.append((party.startTime.time(), party)) + self.addPartyToScrollList(party) for party in localAvatar.hostedParties: if party.startTime.date() == self.myDate.date(): - self.hostedPartiesToday.append(party) - self.timedEvents.append((party.startTime.time(), party)) + self.addPartyToScrollList(party) - if base.cr.newsManager and (self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyHolidays): - base.cr.newsManager.setYearlyCalendarHolidays([(13, (10, 5, 0, 0), (10, 6, 12, 0)), (26, (10, 1, 0, 0), (11, 1, 0, 0))]) - yearlyHolidays = base.cr.newsManager.getYearlyHolidaysForDate(self.myDate) - for holiday in yearlyHolidays: - holidayId = holiday[1] - holidayStart = holiday[2] - holidayEnd = holiday[3] - holidayType = holiday[0] - if holidayStart[0] == self.myDate.month and holidayStart[1] == self.myDate.day: - myTime = datetime.time(holidayStart[2], holidayStart[3]) - elif holidayEnd[0] == self.myDate.month and holidayEnd[1] == self.myDate.day: - myTime = datetime.time(holidayEnd[2], holidayEnd[3]) - else: - self.notify.error('holiday is not today %s' % holiday) - self.timedEvents.append((myTime, holiday)) + if self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyHolidays: + for id, holiday in HolidayGlobals.Holidays.iteritems(): + title, description = TTLocalizer.HolidayNamesInCalendar[id] - oncelyHolidays = base.cr.newsManager.getOncelyHolidaysForDate(self.myDate) - for holiday in oncelyHolidays: - holidayId = holiday[1] - holidayStart = holiday[2] - holidayEnd = holiday[3] - holidayType = holiday[0] - if holidayStart[0] == self.myDate.year and holidayStart[1] == self.myDate.month and holidayStart[2] == self.myDate.day: - myTime = datetime.time(holidayStart[3], holidayStart[4]) - elif holidayEnd[0] == self.myDate.year and holidayEnd[1] == self.myDate.month and holidayEnd[2] == self.myDate.day: - myTime = datetime.time(holidayEnd[3], holidayEnd[4]) - else: - self.notify.error('holiday is not today %s' % holiday) - self.timedEvents.append((myTime, holiday)) + if 'weekDay' in holiday: + if self.myDate.weekday() == holiday['weekDay']: + self.addTitleAndDescToScrollList(title, description) + elif 'startMonth' in holiday or 'startDay' in holiday: + startDate = HolidayGlobals.getStartDate(holiday, self.myDate) + endDate = HolidayGlobals.getEndDate(holiday, self.myDate) + + if self.isDateMatch(self.myDate, startDate): + if self.isDateMatch(startDate, endDate): + description = '%s. %s' % (title, description) + else: + description = '%s. %s %s %s' % (title, description, TTLocalizer.CalendarEndsAt, endDate.strftime('%b %d')) - multipleStartHolidays = base.cr.newsManager.getMultipleStartHolidaysForDate(self.myDate) - for holiday in multipleStartHolidays: - holidayId = holiday[1] - holidayStart = holiday[2] - holidayEnd = holiday[3] - holidayType = holiday[0] - if holidayStart[0] == self.myDate.year and holidayStart[1] == self.myDate.month and holidayStart[2] == self.myDate.day: - myTime = datetime.time(holidayStart[3], holidayStart[4]) - elif holidayEnd[0] == self.myDate.year and holidayEnd[1] == self.myDate.month and holidayEnd[2] == self.myDate.day: - myTime = datetime.time(holidayEnd[3], holidayEnd[4]) - else: - self.notify.error('holiday is not today %s' % holiday) - self.timedEvents.append((myTime, holiday)) + self.addTitleAndDescToScrollList(title, description) + elif self.isDateMatch(self.myDate, endDate): + title = '%s %s' % (TTLocalizer.CalendarEndOf, title) + description = '%s. %s %s' % (title, TTLocalizer.CalendarStartedOn, startDate.strftime('%b %d')) - relativelyHolidays = base.cr.newsManager.getRelativelyHolidaysForDate(self.myDate) - for holiday in relativelyHolidays: - holidayId = holiday[1] - holidayStart = holiday[2] - holidayEnd = holiday[3] - holidayType = holiday[0] - if holidayStart[0] == self.myDate.month and holidayStart[1] == self.myDate.day: - myTime = datetime.time(holidayStart[2], holidayStart[3]) - elif holidayEnd[0] == self.myDate.month and holidayEnd[1] == self.myDate.day: - myTime = datetime.time(holidayEnd[2], holidayEnd[3]) - else: - self.notify.error('holiday is not today %s' % holiday) - self.timedEvents.append((myTime, holiday)) - - def timedEventCompare(te1, te2): - if te1[0] < te2[0]: - return -1 - elif te1[0] == te2[0]: - return 0 - else: - return 1 - - self.timedEvents.sort(cmp=timedEventCompare) - for timedEvent in self.timedEvents: - if isinstance(timedEvent[1], PartyInfo): - self.addPartyToScrollList(timedEvent[1]) - elif isinstance(timedEvent[1], tuple) and timedEvent[1][0] == NewsManager.YearlyHolidayType: - self.addYearlyHolidayToScrollList(timedEvent[1]) - elif isinstance(timedEvent[1], tuple) and timedEvent[1][0] == NewsManager.OncelyHolidayType: - self.addOncelyHolidayToScrollList(timedEvent[1]) - elif isinstance(timedEvent[1], tuple) and timedEvent[1][0] == NewsManager.OncelyMultipleStartHolidayType: - self.addOncelyMultipleStartHolidayToScrollList(timedEvent[1]) - elif isinstance(timedEvent[1], tuple) and timedEvent[1][0] == NewsManager.RelativelyHolidayType: - self.addRelativelyHolidayToScrollList(timedEvent[1]) - - def addYearlyHolidayToScrollList(self, holiday): - holidayId = holiday[1] - holidayStart = holiday[2] - holidayEnd = holiday[3] - holidayType = holiday[0] - holidayText = '' - startTime = datetime.time(holidayStart[2], holidayStart[3]) - endTime = datetime.time(holidayEnd[2], holidayEnd[3]) - startDate = datetime.date(self.myDate.year, holidayStart[0], holidayStart[1]) - endDate = datetime.date(self.myDate.year, holidayEnd[0], holidayEnd[1]) - if endDate < startDate: - endDate = datetime.date(endDate.year + 1, endDate.month, endDate.day) - if holidayId in TTLocalizer.HolidayNamesInCalendar: - holidayName = TTLocalizer.HolidayNamesInCalendar[holidayId][0] - holidayDesc = TTLocalizer.HolidayNamesInCalendar[holidayId][1] - else: - holidayName = TTLocalizer.UnknownHoliday % holidayId - holidayDesc = TTLocalizer.UnknownHoliday % holidayId - if holidayStart[0] == holidayEnd[0] and holidayStart[1] == holidayEnd[1]: - holidayText = myStrftime(startTime) - holidayText += ' ' + holidayName - holidayDesc += ' ' + TTLocalizer.CalendarEndsAt + myStrftime(endTime) - elif self.myDate.month == holidayStart[0] and self.myDate.day == holidayStart[1]: - holidayText = myStrftime(startTime) - holidayText += ' ' + holidayName - holidayDesc = holidayName + '. ' + holidayDesc - holidayDesc += ' ' + TTLocalizer.CalendarEndsAt + endDate.strftime(TTLocalizer.HolidayFormat) + myStrftime(endTime) - elif self.myDate.month == holidayEnd[0] and self.myDate.day == holidayEnd[1]: - holidayText = myStrftime(endTime) - holidayText += ' ' + TTLocalizer.CalendarEndDash + holidayName - holidayDesc = TTLocalizer.CalendarEndOf + holidayName - holidayDesc += '. ' + TTLocalizer.CalendarStartedOn + startDate.strftime(TTLocalizer.HolidayFormat) + myStrftime(startTime) - else: - self.notify.error('unhandled case') - self.addTitleAndDescToScrollList(holidayText, holidayDesc) - - def addOncelyHolidayToScrollList(self, holiday): - holidayId = holiday[1] - holidayStart = holiday[2] - holidayEnd = holiday[3] - holidayType = holiday[0] - holidayText = '' - startTime = datetime.time(holidayStart[3], holidayStart[4]) - endTime = datetime.time(holidayEnd[3], holidayEnd[4]) - startDate = datetime.date(holidayStart[0], holidayStart[1], holidayStart[2]) - endDate = datetime.date(holidayStart[0], holidayEnd[1], holidayEnd[2]) - if endDate < startDate: - endDate = datetime.date(endDate.year + 1, endDate.month, endDate.day) - if holidayId in TTLocalizer.HolidayNamesInCalendar: - holidayName = TTLocalizer.HolidayNamesInCalendar[holidayId][0] - holidayDesc = TTLocalizer.HolidayNamesInCalendar[holidayId][1] - else: - holidayName = TTLocalizer.UnknownHoliday % holidayId - holidayDesc = '' - if holidayStart[1] == holidayEnd[1] and holidayStart[2] == holidayEnd[2]: - holidayText = myStrftime(startTime) - holidayText += ' ' + holidayName - holidayDesc = holidayName + '. ' + holidayDesc - holidayDesc += ' ' + TTLocalizer.CalendarEndsAt + myStrftime(endTime) - elif self.myDate.year == holidayStart[0] and self.myDate.month == holidayStart[1] and self.myDate.day == holidayStart[2]: - holidayText = myStrftime(startTime) - holidayText += ' ' + holidayName - holidayDesc = holidayName + '. ' + holidayDesc - holidayDesc += ' ' + TTLocalizer.CalendarEndsAt + endDate.strftime(TTLocalizer.HolidayFormat) + myStrftime(endTime) - elif self.myDate.year == holidayEnd[0] and self.myDate.month == holidayEnd[1] and self.myDate.day == holidayEnd[2]: - holidayText = myStrftime(endTime) - holidayText += ' ' + TTLocalizer.CalendarEndDash + holidayName - holidayDesc = TTLocalizer.CalendarEndOf + holidayName - holidayDesc += '. ' + TTLocalizer.CalendarStartedOn + startDate.strftime(TTLocalizer.HolidayFormat) + myStrftime(startTime) - else: - self.notify.error('unhandled case') - self.addTitleAndDescToScrollList(holidayText, holidayDesc) - - def addOncelyMultipleStartHolidayToScrollList(self, holiday): - self.addOncelyHolidayToScrollList(holiday) - - def addRelativelyHolidayToScrollList(self, holiday): - holidayId = holiday[1] - holidayStart = holiday[2] - holidayEnd = holiday[3] - holidayType = holiday[0] - holidayText = '' - startTime = datetime.time(holidayStart[2], holidayStart[3]) - endTime = datetime.time(holidayEnd[2], holidayEnd[3]) - startDate = datetime.date(self.myDate.year, holidayStart[0], holidayStart[1]) - endDate = datetime.date(self.myDate.year, holidayEnd[0], holidayEnd[1]) - if endDate < startDate: - endDate.year += 1 - if holidayId in TTLocalizer.HolidayNamesInCalendar: - holidayName = TTLocalizer.HolidayNamesInCalendar[holidayId][0] - holidayDesc = TTLocalizer.HolidayNamesInCalendar[holidayId][1] - else: - holidayName = TTLocalizer.UnknownHoliday % holidayId - holidayDesc = '' - if holidayStart[0] == holidayEnd[0] and holidayStart[1] == holidayEnd[1]: - holidayText = myStrftime(startTime) - holidayText += ' ' + holidayName - holidayDesc += ' ' + TTLocalizer.CalendarEndsAt + myStrftime(endTime) - elif self.myDate.month == holidayStart[0] and self.myDate.day == holidayStart[1]: - holidayText = myStrftime(startTime) - holidayText += ' ' + holidayName - holidayDesc = holidayName + '. ' + holidayDesc - holidayDesc += ' ' + TTLocalizer.CalendarEndsAt + endDate.strftime(TTLocalizer.HolidayFormat) + myStrftime(endTime) - elif self.myDate.month == holidayEnd[0] and self.myDate.day == holidayEnd[1]: - holidayText = myStrftime(endTime) - holidayText += ' ' + TTLocalizer.CalendarEndDash + holidayName - holidayDesc = TTLocalizer.CalendarEndOf + holidayName - holidayDesc += '. ' + TTLocalizer.CalendarStartedOn + startDate.strftime(TTLocalizer.HolidayFormat) + myStrftime(startTime) - else: - self.notify.error('unhandled case') - self.addTitleAndDescToScrollList(holidayText, holidayDesc) + self.addTitleAndDescToScrollList(title, description) + def isDateMatch(self, date1, date2): + return date1.day == date2.day and date1.month == date2.month + def addTitleAndDescToScrollList(self, title, desc): textSize = self.ScrollListTextSize descTextSize = 0.05 @@ -429,7 +196,6 @@ class CalendarGuiDay(DirectFrame): newItem.bind(DGG.ENTER, self.enteredTextItem, extraArgs=[newItem, desc, descUnderItemZAdjust]) newItem.bind(DGG.EXIT, self.exitedTextItem, extraArgs=[newItem]) self.scrollList.addItem(newItem) - return def exitedTextItem(self, newItem, mousepos): newItem.description.hide() @@ -473,7 +239,6 @@ class CalendarGuiDay(DirectFrame): newItem.description.hide() newItem.bind(DGG.ENTER, self.enteredTextItem, extraArgs=[newItem, newItem.description, descUnderItemZAdjust]) newItem.bind(DGG.EXIT, self.exitedTextItem, extraArgs=[newItem]) - return def __clickedOnScrollItem(self): self.__clickedOnDay() @@ -488,7 +253,6 @@ class CalendarGuiDay(DirectFrame): return if self.dayClickCallback: self.dayClickCallback(self) - self.notify.debug('we got clicked on %s' % self.myDate.date()) messenger.send('clickedOnDay', [self.myDate.date()]) def updateSelected(self, selected): @@ -513,7 +277,6 @@ class CalendarGuiDay(DirectFrame): def update(self): self.numberWidget['text'] = str(self.myDate.day) self.adjustForMonth() - self.addWeeklyHolidays() self.collectTimedEvents() self.updateArrowButtons() @@ -524,7 +287,6 @@ class CalendarGuiDay(DirectFrame): self.scrollList.removeAndDestroyAllItems() self.update() - class MiniInviteVisual(DirectFrame): def __init__(self, parent, partyInfo): @@ -544,7 +306,6 @@ class MiniInviteVisual(DirectFrame): self.whosePartyLabel = DirectLabel(parent=self, relief=None, pos=(0.07, 0.0, -0.04), text=' ', text_scale=0.04, text_wordwrap=8, textMayChange=True) self.whenTextLabel = DirectLabel(parent=self, relief=None, text=' ', pos=(0.07, 0.0, -0.13), text_scale=0.04, textMayChange=True) self.partyStatusLabel = DirectLabel(parent=self, relief=None, text=' ', pos=(0.07, 0.0, -0.175), text_scale=0.04, textMayChange=True) - return def show(self): self.reparentTo(self.parent) @@ -580,4 +341,4 @@ class MiniInviteVisual(DirectFrame): del self.whosePartyLabel del self.whenTextLabel del self.partyStatusLabel - DirectFrame.destroy(self) + DirectFrame.destroy(self) \ No newline at end of file diff --git a/toontown/parties/CalendarGuiMonth.py b/toontown/parties/CalendarGuiMonth.py index 8aec1f02..1c22331d 100755 --- a/toontown/parties/CalendarGuiMonth.py +++ b/toontown/parties/CalendarGuiMonth.py @@ -1,10 +1,8 @@ -import calendar -from datetime import timedelta, datetime -from pandac.PandaModules import Vec4, TextNode +from pandac.PandaModules import TextNode from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG -from toontown.toonbase import TTLocalizer -from toontown.toonbase import ToontownGlobals +from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.parties.CalendarGuiDay import CalendarGuiDay +from datetime import timedelta, datetime class CalendarGuiMonth(DirectFrame): notify = directNotify.newCategory('CalendarGuiMonth') @@ -18,57 +16,19 @@ class CalendarGuiMonth(DirectFrame): if self.onlyFutureDaysClickable: self.onlyFutureMonthsClickable = True DirectFrame.__init__(self, parent=parent, scale=scale, pos=pos) - self.showMarkers = base.config.GetBool('show-calendar-markers', 0) self.load() self.createGuiObjects() self.lastSelectedDate = None self.accept('clickedOnDay', self.clickedOnDay) - return - - def createDummyLocators(self): - self.monthLocator = self.attachNewNode('monthLocator') - self.monthLocator.setZ(0.6) - self.weekDayLocators = [] - for i in xrange(7): - self.weekDayLocators.append(self.attachNewNode('weekDayLocator-%d' % i)) - self.weekDayLocators[i].setZ(0.5) - self.weekDayLocators[i].setX(i * 0.24 + -0.75) - - dayTopLeftX = -0.8 - dayTopLeftZ = 0.4 - self.dayLocators = [] - for row in xrange(6): - oneWeek = [] - for col in xrange(7): - newDayLoc = self.attachNewNode('dayLocator-row-%d-col-%d' % (row, col)) - newDayLoc.setX(col * 0.24 + dayTopLeftX) - newDayLoc.setZ(row * -0.18 + dayTopLeftZ) - oneWeek.append(newDayLoc) - - self.dayLocators.append(oneWeek) - - self.monthLeftLocator = self.attachNewNode('monthLeft') - self.monthLeftLocator.setPos(-0.3, 0, 0.65) - self.monthRightLocator = self.attachNewNode('monthRight') - self.monthRightLocator.setPos(0.3, 0, 0.65) - - def attachMarker(self, parent, scale = 0.01, color = (1, 0, 0)): - if self.showMarkers: - marker = loader.loadModel('phase_3/models/misc/sphere') - marker.reparentTo(parent) - marker.setScale(scale) - marker.setColor(*color) def load(self): monthAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar') monthAsset.reparentTo(self) self.monthLocator = self.find('**/locator_month/locator_month') - self.attachMarker(self.monthLocator) self.weekDayLocators = [] for weekday in ('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'): weekDayLoc = self.find('**/loc_%s' % weekday) self.weekDayLocators.append(weekDayLoc) - self.attachMarker(weekDayLoc) self.dayLocators = [] for row in xrange(6): @@ -111,13 +71,13 @@ class CalendarGuiMonth(DirectFrame): self.monthLeftArrow = DirectButton(parent=self.monthLeftLocator, relief=None, image=(arrowUp, arrowDown, arrowHover, - arrowUp), image3_color=Vec4(1, 1, 1, 0.5), scale=(-1.0, 1.0, 1.0), command=self.__doMonthLeft) + arrowUp), image3_color=(1, 1, 1, 0.5), scale=(-1.0, 1.0, 1.0), command=self.__doMonthLeft) if self.onlyFutureMonthsClickable: self.monthLeftArrow.hide() self.monthRightArrow = DirectButton(parent=self.monthRightLocator, relief=None, image=(arrowUp, arrowDown, arrowHover, - arrowUp), image3_color=Vec4(1, 1, 1, 0.5), command=self.__doMonthRight) + arrowUp), image3_color=(1, 1, 1, 0.5), command=self.__doMonthRight) def makeLabel(itemName, itemNum, *extraArgs): return DirectLabel(text=itemName, frameColor=(0, 0, 0, 0), text_scale=0.04) @@ -131,12 +91,11 @@ class CalendarGuiMonth(DirectFrame): self.filterList = DirectScrolledList(parent=self.filterLocator, relief=None, pos=(0, 0, 0), image=None, text_scale=0.025, incButton_image=(arrowUp, arrowDown, arrowHover, - arrowUp), incButton_relief=None, incButton_pos=filterLocatorDownPos, incButton_image3_color=Vec4(1, 1, 1, 0.2), incButtonCallback=self.filterChanged, decButton_image=(arrowUp, + arrowUp), incButton_relief=None, incButton_pos=filterLocatorDownPos, incButton_image3_color=(1, 1, 1, 0.2), incButtonCallback=self.filterChanged, decButton_image=(arrowUp, arrowDown, arrowHover, - arrowUp), decButton_relief=None, decButton_pos=filterLocatorUpPos, decButton_scale=(1, 1, -1), decButton_image3_color=Vec4(1, 1, 1, 0.2), decButtonCallback=self.filterChanged, numItemsVisible=1, itemMakeFunction=makeLabel, items=[TTLocalizer.CalendarShowAll, TTLocalizer.CalendarShowOnlyHolidays, TTLocalizer.CalendarShowOnlyParties], itemFrame_frameSize=(-.2, 0.2, -.02, 0.05), itemFrame_frameColor=(0, 0, 0, 0)) + arrowUp), decButton_relief=None, decButton_pos=filterLocatorUpPos, decButton_scale=(1, 1, -1), decButton_image3_color=(1, 1, 1, 0.2), decButtonCallback=self.filterChanged, numItemsVisible=1, itemMakeFunction=makeLabel, items=[TTLocalizer.CalendarShowAll, TTLocalizer.CalendarShowOnlyHolidays, TTLocalizer.CalendarShowOnlyParties], itemFrame_frameSize=(-.2, 0.2, -.02, 0.05), itemFrame_frameColor=(0, 0, 0, 0)) gui.removeNode() - return def getTopLeftDate(self): firstOfTheMonth = self.curDate.replace(day=1) @@ -169,7 +128,7 @@ class CalendarGuiMonth(DirectFrame): newMonth -= 12 while newMonth < 1: - if newYear - 1 > 1899: + if newYear - 1 > 2002: newMonth += 12 newYear -= 1 else: @@ -206,7 +165,6 @@ class CalendarGuiMonth(DirectFrame): self.filterList.destroy() DirectFrame.destroy(self) - return def clickedOnDay(self, dayDate): self.lastSelectedDate = dayDate @@ -215,10 +173,7 @@ class CalendarGuiMonth(DirectFrame): def updateSelectedDate(self): if self.lastSelectedDate: for oneGuiDay in self.guiDays: - if oneGuiDay.myDate.date() == self.lastSelectedDate: - oneGuiDay.updateSelected(True) - else: - oneGuiDay.updateSelected(False) + oneGuiDay.updateSelected(oneGuiDay.myDate.date() == self.lastSelectedDate) def clearSelectedDay(self): for oneGuiDay in self.guiDays: @@ -227,4 +182,4 @@ class CalendarGuiMonth(DirectFrame): def filterChanged(self): newFilter = self.filterList.getSelectedIndex() for guiDay in self.guiDays: - guiDay.changeFilter(newFilter) + guiDay.changeFilter(newFilter) \ No newline at end of file diff --git a/toontown/parties/GlobalPartyManagerUD.py b/toontown/parties/GlobalPartyManagerUD.py index 908a1dd3..69275c5b 100755 --- a/toontown/parties/GlobalPartyManagerUD.py +++ b/toontown/parties/GlobalPartyManagerUD.py @@ -22,7 +22,7 @@ class GlobalPartyManagerUD(DistributedObjectGlobalUD): PARTY_TIME_FORMAT = '%Y-%m-%d %H:%M:%S' startTime = datetime.strptime('2014-01-20 11:50:00', PARTY_TIME_FORMAT) endTime = datetime.strptime('2014-01-20 12:20:00', PARTY_TIME_FORMAT) - self.partyAllocator = UniqueIdAllocator(0, 100000000) + self.nextId = 0 #self.host2Party[100000001] = {'hostId': 100000001, 'start': startTime, 'end': endTime, 'partyId': 1717986918400000, 'decorations': [[3,5,7,6]], 'activities': [[10,13,6,18],[7,8,7,0]],'inviteTheme':1,'isPrivate':0,'inviteeIds':[]} config = getConfigShowbase() self.wantInstantParties = config.GetBool('want-instant-parties', 0) @@ -247,5 +247,6 @@ class GlobalPartyManagerUD(DistributedObjectGlobalUD): def allocIds(self, numIds): ids = [] while len(ids) < numIds: - ids.append(self.partyAllocator.allocate()) + ids.append(self.nextId) + self.nextId += 1 self.sendToAI('receiveId', ids) \ No newline at end of file diff --git a/toontown/parties/InviteVisual.py b/toontown/parties/InviteVisual.py index 5a17432a..6bfd04d9 100755 --- a/toontown/parties/InviteVisual.py +++ b/toontown/parties/InviteVisual.py @@ -6,7 +6,6 @@ from direct.showbase import PythonUtil from direct.fsm.FSM import FSM from toontown.parties import PartyGlobals from toontown.parties import PartyUtils -from toontown.toonbase.ToontownGlobals import VALENTINES_DAY class InviteVisual(DirectFrame): notify = directNotify.newCategory('InviteVisual') diff --git a/toontown/parties/PartyEditor.py b/toontown/parties/PartyEditor.py index 5a26add3..f8ff40e9 100755 --- a/toontown/parties/PartyEditor.py +++ b/toontown/parties/PartyEditor.py @@ -46,10 +46,9 @@ class PartyEditor(DirectObject, FSM): self.partyPlanner.gui.find('**/activitiesButtonDown_down'), self.partyPlanner.gui.find('**/activitiesButtonDown_rollover'), self.partyPlanner.gui.find('**/activitiesButtonDown_inactive')), incButton_relief=None, incButton_pos=(-0.05, 0.0, -0.94), itemFrame_pos=(pos[0], pos[1], pos[2] + 0.04), itemFrame_relief=None, numItemsVisible=1, items=[]) - holidayIds = base.cr.newsManager.getHolidayIdList() - isWinter = ToontownGlobals.WINTER_DECORATIONS in holidayIds or ToontownGlobals.WACKY_WINTER_DECORATIONS in holidayIds - isVictory = ToontownGlobals.VICTORY_PARTY_HOLIDAY in holidayIds - isValentine = ToontownGlobals.VALENTINES_DAY in holidayIds + isWinter = base.cr.newsManager.isHolidayRunning(ToontownGlobals.CHRISTMAS) + isVictory = base.cr.newsManager.isHolidayRunning(ToontownGlobals.VICTORY_PARTY_HOLIDAY) + isValentine = base.cr.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY) for activityId in PartyGlobals.PartyEditorActivityOrder: if not isVictory and activityId in PartyGlobals.VictoryPartyActivityIds or not isWinter and activityId in PartyGlobals.WinterPartyActivityIds or not isValentine and activityId in PartyGlobals.ValentinePartyActivityIds: pass diff --git a/toontown/parties/PartyPlanner.py b/toontown/parties/PartyPlanner.py index 658f27d0..db61e2e9 100755 --- a/toontown/parties/PartyPlanner.py +++ b/toontown/parties/PartyPlanner.py @@ -156,13 +156,12 @@ class PartyPlanner(DirectFrame, FSM): self.prevButton['state'] = DirectGuiGlobals.NORMAL self.nextButton.hide() defaultInviteTheme = PartyGlobals.InviteTheme.GenericMale - 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(): - defaultInviteTheme = PartyGlobals.InviteTheme.Racing - elif ToontownGlobals.VALENTINES_DAY in base.cr.newsManager.getHolidayIdList(): - defaultInviteTheme = PartyGlobals.InviteTheme.Valentoons + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.VICTORY_PARTY_HOLIDAY): + defaultInviteTheme = PartyGlobals.InviteTheme.VictoryParty + elif base.cr.newsManager.isHolidayRunning(ToontownGlobals.KARTING_TICKETS_HOLIDAY) or base.cr.newsManager.isHolidayRunning(ToontownGlobals.GRAND_PRIX): + defaultInviteTheme = PartyGlobals.InviteTheme.Racing + elif base.cr.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY): + defaultInviteTheme = PartyGlobals.InviteTheme.Valentoons if self.partyInfo is not None: del self.partyInfo activityList = self.partyEditor.partyEditorGrid.getActivitiesOnGrid() @@ -593,14 +592,12 @@ class PartyPlanner(DirectFrame, FSM): def __handleHolidays(self): self.inviteThemes = range(len(PartyGlobals.InviteTheme)) - if hasattr(base.cr, 'newsManager') and base.cr.newsManager: - holidayIds = base.cr.newsManager.getHolidayIdList() - if ToontownGlobals.VALENTINES_DAY not in holidayIds: - self.inviteThemes.remove(PartyGlobals.InviteTheme.Valentoons) - if ToontownGlobals.VICTORY_PARTY_HOLIDAY not in holidayIds: - self.inviteThemes.remove(PartyGlobals.InviteTheme.VictoryParty) - if ToontownGlobals.WINTER_DECORATIONS not in holidayIds and ToontownGlobals.WACKY_WINTER_DECORATIONS not in holidayIds: - self.inviteThemes.remove(PartyGlobals.InviteTheme.Winter) + if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY): + self.inviteThemes.remove(PartyGlobals.InviteTheme.Valentoons) + if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.VICTORY_PARTY_HOLIDAY): + self.inviteThemes.remove(PartyGlobals.InviteTheme.VictoryParty) + if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.CHRISTMAS): + self.inviteThemes.remove(PartyGlobals.InviteTheme.Winter) def _createFarewellPage(self): page = DirectFrame(self.frame) diff --git a/toontown/pets/Pet.py b/toontown/pets/Pet.py index 10e0ab5d..f46c7d7a 100755 --- a/toontown/pets/Pet.py +++ b/toontown/pets/Pet.py @@ -29,6 +29,7 @@ Component2IconDict = {'boredom': 'Bored', from toontown.nametag import * from toontown.nametag.NametagGlobals import * +from toontown.chat.ChatGlobals import * class Pet(Avatar.Avatar): notify = DirectNotifyGlobal.directNotify.newCategory('Pet') @@ -280,7 +281,7 @@ class Pet(Avatar.Avatar): moodIcons = loader.loadModel('phase_4/models/char/petEmotes') self.moodIcons = self.attachNewNode('moodIcons') self.moodIcons.setScale(2.0) - self.moodIcons.setZ(3.65) + self.moodIcons.setZ(4.65) moods = moodIcons.findAllMatches('**/+GeomNode') for moodNum in range(0, moods.getNumPaths()): mood = moods.getPath(moodNum) @@ -295,13 +296,8 @@ class Pet(Avatar.Avatar): return def showMood(self, mood): - if hasattr(base.cr, 'newsManager') and base.cr.newsManager: - holidayIds = base.cr.newsManager.getHolidayIdList() - if (ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds or ToontownGlobals.SILLYMETER_EXT_HOLIDAY in holidayIds) and not mood == 'confusion': - self.speakMood(mood) - return - else: - self.clearChat() + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK) and mood != 'confusion': + self.speakMood(mood) else: self.clearChat() mood = Component2IconDict[mood] @@ -322,12 +318,7 @@ class Pet(Avatar.Avatar): return def speakMood(self, mood): - if self.moodModel: - self.moodModel.hide() - if base.config.GetBool('want-speech-bubble', 1): - self.nametag.setChat(random.choice(TTLocalizer.SpokenMoods[mood]), CFSpeech) - else: - self.nametag.setChat(random.choice(TTLocalizer.SpokenMoods[mood]), CFThought) + self.setChatAbsolute(random.choice(TTLocalizer.SpokenMoods[mood]), CFSpeech) def getGenderString(self): if self.style: diff --git a/toontown/racing/DistributedRace.py b/toontown/racing/DistributedRace.py index 3cc605d2..000069d5 100755 --- a/toontown/racing/DistributedRace.py +++ b/toontown/racing/DistributedRace.py @@ -550,14 +550,14 @@ class DistributedRace(DistributedObject.DistributedObject): newLapT = (newT - self.startT) / self.curve.getMaxT() % 1.0 if newLapT - self.currLapT < -0.5: self.laps += 1 - self.changeMusicTempo(1 + self.laps * 0.5) + self.changeMusicTempo(1 + self.laps * 0.33) self.notify.debug('crossed the start line: %s, %s, %s, %s' % (self.laps, self.startT, self.currT, newT)) elif newLapT - self.currLapT > 0.5: self.laps -= 1 - self.changeMusicTempo(1 + self.laps * 0.5) + self.changeMusicTempo(1 + self.laps * 0.33) self.notify.debug('crossed the start line - wrong way: %s, %s, %s, %s' % (self.laps, self.startT, self.currT, @@ -1211,12 +1211,9 @@ class DistributedRace(DistributedObject.DistributedObject): self.musicTrack.start() def changeMusicTempo(self, newPR): - return # TODO: Reenable when we have music change support. if self.musicTrack: self.musicTrack.finish() - curPR = self.raceMusic.getPlayRate() - interval = LerpFunctionInterval(self.raceMusic.setPlayRate, fromData=curPR, toData=newPR, duration=3) - self.musicTrack = Sequence(interval) + self.musicTrack = Sequence(LerpFunctionInterval(self.raceMusic.setPlayRate, fromData=self.raceMusic.getPlayRate(), toData=newPR, duration=3)) self.musicTrack.start() def setRaceZone(self, zoneId, trackId): diff --git a/toontown/racing/RaceEndPanels.py b/toontown/racing/RaceEndPanels.py index a1f27e86..731c5803 100755 --- a/toontown/racing/RaceEndPanels.py +++ b/toontown/racing/RaceEndPanels.py @@ -293,7 +293,7 @@ class RaceWinningsPanel(DirectFrame): else: self.circuitTotalLabel.stash() self.raceTotalLabel.unstash() - if ToontownGlobals.KARTING_TICKETS_HOLIDAY not in base.cr.newsManager.getHolidayIdList() or self.race.raceType != RaceGlobals.Practice: + if (not base.cr.newsManager.isHolidayRunning(ToontownGlobals.KARTING_TICKETS_HOLIDAY)) or self.race.raceType != RaceGlobals.Practice: self.doubleTicketsLabel.stash() if ticBonus: ticketSeq.append(Sequence(Func(self.ticketFrame.hide), Func(self.bonusFrame.show), Func(self.trophyFrame.hide), Func(self.bonusComponents[0].configure, text=wrapStr(TTLocalizer.KartRace_RecordString % (TTLocalizer.KartRecordStrings[bonusType], TTLocalizer.KartRace_TrackNames[track], str(ticBonus)))), Wait(3))) diff --git a/toontown/safezone/DDPlayground.py b/toontown/safezone/DDPlayground.py index abd108be..f7ba4019 100755 --- a/toontown/safezone/DDPlayground.py +++ b/toontown/safezone/DDPlayground.py @@ -76,7 +76,6 @@ class DDPlayground(Playground.Playground): self.loader.seagullSound.stop() taskMgr.remove('dd-seagulls') self.cameraSubmerged = 1 - self.walkStateData.setSwimSoundAudible(1) def __emergeCamera(self): if self.cameraSubmerged == 0: @@ -86,7 +85,6 @@ class DDPlayground(Playground.Playground): self.nextSeagullTime = random.random() * 8.0 taskMgr.add(self.__seagulls, 'dd-seagulls') self.cameraSubmerged = 0 - self.walkStateData.setSwimSoundAudible(0) def __submergeToon(self): if self.toonSubmerged == 1: diff --git a/toontown/safezone/DistributedTreasure.py b/toontown/safezone/DistributedTreasure.py index f5bb362c..c482a520 100755 --- a/toontown/safezone/DistributedTreasure.py +++ b/toontown/safezone/DistributedTreasure.py @@ -59,6 +59,9 @@ class DistributedTreasure(DistributedObject.DistributedObject): def loadModel(self): modelPath, grabSoundPath = TreasureGlobals.TreasureModels[self.treasureType] + if base.cr.newsManager.isHolidayRunning(VALENTOONS_DAY): + modelPath = TreasureGlobals.ValentineTreasureModel + self.grabSound = base.loadSfx(grabSoundPath) self.rejectSound = base.loadSfx(self.rejectSoundPath) if self.nodePath == None: diff --git a/toontown/safezone/OZPlayground.py b/toontown/safezone/OZPlayground.py index 1553e493..e33ed860 100755 --- a/toontown/safezone/OZPlayground.py +++ b/toontown/safezone/OZPlayground.py @@ -65,7 +65,6 @@ class OZPlayground(Playground.Playground): self.loader.hood.setUnderwaterFog() base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8) self.cameraSubmerged = 1 - self.walkStateData.setSwimSoundAudible(1) def __emergeCamera(self): if self.cameraSubmerged == 0: @@ -73,7 +72,6 @@ class OZPlayground(Playground.Playground): self.loader.hood.setNoFog() self.loader.underwaterSound.stop() self.cameraSubmerged = 0 - self.walkStateData.setSwimSoundAudible(0) def __submergeToon(self): if self.toonSubmerged == 1: diff --git a/toontown/safezone/OZSafeZoneLoader.py b/toontown/safezone/OZSafeZoneLoader.py index 6cedaecb..336bfda2 100755 --- a/toontown/safezone/OZSafeZoneLoader.py +++ b/toontown/safezone/OZSafeZoneLoader.py @@ -47,7 +47,6 @@ class OZSafeZoneLoader(SafeZoneLoader): waterfallPlacer = self.geom.find('**/waterfall*') binMgr = CullBinManager.getGlobalPtr() binMgr.addBin('water', CullBinManager.BTFixed, 29) - binMgr = CullBinManager.getGlobalPtr() pool = self.geom.find('**/pPlane5*') pool.setTransparency(1) pool.setColorScale(1.0, 1.0, 1.0, 1.0) diff --git a/toontown/safezone/Playground.py b/toontown/safezone/Playground.py index d21788b9..dd845dab 100755 --- a/toontown/safezone/Playground.py +++ b/toontown/safezone/Playground.py @@ -166,6 +166,7 @@ class Playground(Place.Place): self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger) base.playMusic(self.loader.music, looping=1, volume=0.8) self.loader.geom.reparentTo(render) + for i in self.loader.nodeList: self.loader.enterAnimatedProps(i) @@ -178,47 +179,28 @@ class Playground(Place.Place): self.loader.hood.eventLights += geom.findAllMatches('**/prop_snow_tree*') self.loader.hood.eventLights += geom.findAllMatches('**/prop_tree*') self.loader.hood.eventLights += geom.findAllMatches('**/*christmas*') + for light in self.loader.hood.eventLights: light.setColorScaleOff(0) - newsManager = base.cr.newsManager - if newsManager: - holidayIds = base.cr.newsManager.getDecorationHolidayId() - #Halloween Event - if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds or ToontownGlobals.SPOOKY_COSTUMES in holidayIds) and self.loader.hood.spookySkyFile: - lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky), Func(__lightDecorationOn__)) - lightsOff.start() - else: - self.loader.hood.startSky() - lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) - lightsOn.start() - #Christmas Event - if (ToontownGlobals.WINTER_DECORATIONS in holidayIds or ToontownGlobals.WACKY_WINTER_DECORATIONS in holidayIds) and self.loader.hood.snowySkyFile: - lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.7, 0.7, 0.8, 1)), Func(self.loader.hood.startSnowySky), Func(__lightDecorationOn__)) - lightsOff.start() - self.snowEvent = BattleParticles.loadParticleFile('snowdisk.ptf') - self.snowEvent.setPos(0, 30, 10) - #2 and 3 are only for the blizzard event and should be removed - self.snowEvent2 = BattleParticles.loadParticleFile('snowdisk.ptf') - self.snowEvent2.setPos(0, 10, 10) - self.snowEvent3 = BattleParticles.loadParticleFile('snowdisk.ptf') - self.snowEvent3.setPos(0, 20, 5) - self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode('snowRender') - self.snowEventRender.setDepthWrite(2) - self.snowEventRender.setBin('fixed', 1) - self.snowEventFade = None - self.snowEvent.start(camera, self.snowEventRender) - #2 and 3 are only for the blizzard event and should be removed - self.snowEvent2.start(camera, self.snowEventRender) - self.snowEvent3.start(camera, self.snowEventRender) - else: - self.loader.hood.startSky() - lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) - lightsOn.start() + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN) and self.loader.hood.spookySkyFile: + lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky), Func(__lightDecorationOn__)) + lightsOff.start() + elif base.cr.newsManager.isHolidayRunning(ToontownGlobals.CHRISTMAS) and self.loader.hood.snowySkyFile: + lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.7, 0.7, 0.8, 1)), Func(self.loader.hood.startSnowySky), Func(__lightDecorationOn__)) + lightsOff.start() + self.snowEvent = BattleParticles.loadParticleFile('snowdisk.ptf') + self.snowEvent.setPos(0, 30, 10) + self.snowEventRender = base.cr.playGame.hood.loader.geom.attachNewNode('snowRender') + self.snowEventRender.setDepthWrite(2) + self.snowEventRender.setBin('fixed', 1) + self.snowEventFade = None + self.snowEvent.start(camera, self.snowEventRender) else: self.loader.hood.startSky() lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) lightsOn.start() + NametagGlobals.setWant2dNametags(True) self.zoneId = requestStatus['zoneId'] self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList) @@ -242,7 +224,6 @@ class Playground(Place.Place): for light in self.loader.hood.eventLights: light.reparentTo(hidden) - newsManager = base.cr.newsManager NametagGlobals.setWant2dNametags(False) for i in self.loader.nodeList: self.loader.exitAnimatedProps(i) diff --git a/toontown/safezone/SZTreasurePlannerAI.py b/toontown/safezone/SZTreasurePlannerAI.py index 00295e52..c43eb49a 100755 --- a/toontown/safezone/SZTreasurePlannerAI.py +++ b/toontown/safezone/SZTreasurePlannerAI.py @@ -1,5 +1,6 @@ from RegenTreasurePlannerAI import RegenTreasurePlannerAI from direct.directnotify import DirectNotifyGlobal +from toontown.toonbase import ToontownGlobals class SZTreasurePlannerAI(RegenTreasurePlannerAI): notify = DirectNotifyGlobal.directNotify.newCategory('SZTreasurePlannerAI') @@ -16,7 +17,7 @@ class SZTreasurePlannerAI(RegenTreasurePlannerAI): def validAvatar(self, treasure, av): # Avatars can only heal if they are missing some health, but aren't sad. if av.getHp() < av.getMaxHp() and av.getHp() > 0: - av.toonUp(self.healAmount) + av.toonUp(self.healAmount * 2 if simbase.air.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY) else self.healAmount) return True else: - return False + return False \ No newline at end of file diff --git a/toontown/safezone/TreasureGlobals.py b/toontown/safezone/TreasureGlobals.py index c1c63097..d9f6d1aa 100755 --- a/toontown/safezone/TreasureGlobals.py +++ b/toontown/safezone/TreasureGlobals.py @@ -9,6 +9,8 @@ TreasureDL = 5 TreasureOZ = 6 TreasureE = 7 +ValentineTreasureModel = 'phase_4/models/props/tt_m_ara_ext_heart' + TreasureModels = { TreasureTT: ( 'phase_4/models/props/icecream', diff --git a/toontown/safezone/Walk.py b/toontown/safezone/Walk.py index d101bf25..4d42db52 100755 --- a/toontown/safezone/Walk.py +++ b/toontown/safezone/Walk.py @@ -15,7 +15,6 @@ class Walk(StateData.StateData): State.State('swimming', self.enterSwimming, self.exitSwimming, ['walking', 'slowWalking']), State.State('slowWalking', self.enterSlowWalking, self.exitSlowWalking, ['walking', 'swimming'])], 'off', 'off') self.fsm.enterInitialState() - self.IsSwimSoundAudible = 0 self.swimSoundPlaying = 0 def load(self): @@ -66,36 +65,31 @@ class Walk(StateData.StateData): def exitWalking(self): base.localAvatar.stopTrackAnimToSpeed() - def setSwimSoundAudible(self, IsSwimSoundAudible): - self.IsSwimSoundAudible = IsSwimSoundAudible - if IsSwimSoundAudible == 0 and self.swimSoundPlaying: - self.swimSound.stop() - self.swimSoundPlaying = 0 - def enterSwimming(self, swimSound): base.localAvatar.setWalkSpeedNormal() base.localAvatar.applyBuffs() self.swimSound = swimSound self.swimSoundPlaying = 0 base.localAvatar.b_setAnimState('swim', base.localAvatar.animMultiplier) - base.localAvatar.startSleepSwimTest() - taskMgr.add(self.__swim, 'localToonSwimming') + taskMgr.add(self.__swimSoundTest, 'localToonSwimming') def exitSwimming(self): taskMgr.remove('localToonSwimming') self.swimSound.stop() del self.swimSound self.swimSoundPlaying = 0 - base.localAvatar.stopSleepSwimTest() + + def __swimSoundTest(self, task): + speed, rotSpeed, slideSpeed = base.localAvatar.controlManager.getSpeeds() - def __swim(self, task): - speed = base.mouseInterfaceNode.getSpeed() - if speed == 0 and self.swimSoundPlaying: + if (speed or rotSpeed): + if not self.swimSoundPlaying: + self.swimSoundPlaying = 1 + base.playSfx(self.swimSound, looping=1) + elif self.swimSoundPlaying: self.swimSoundPlaying = 0 self.swimSound.stop() - elif speed > 0 and self.swimSoundPlaying == 0 and self.IsSwimSoundAudible: - self.swimSoundPlaying = 1 - base.playSfx(self.swimSound, looping=1) + return Task.cont def enterSlowWalking(self): diff --git a/toontown/speedchat/TTSpeedChatTypes.py b/toontown/speedchat/TTSpeedChatTypes.py index b9d742af..7336cb95 100755 --- a/toontown/speedchat/TTSpeedChatTypes.py +++ b/toontown/speedchat/TTSpeedChatTypes.py @@ -13,10 +13,8 @@ from otp.otpbase import OTPLocalizer from SCSpecialMenu import SCSpecialMenu AprilToonsMenu = [ - (OTPLocalizer.AprilToonsMenuSections[1], [30100, 30102]), - (OTPLocalizer.AprilToonsMenuSections[2], [30110, 30111, 30112, 30113, 30114, 30115]), - (OTPLocalizer.AprilToonsMenuSections[3], [30120, 30121, 30122, 30123, 30124, 30125, 30126]), - (OTPLocalizer.AprilToonsMenuSections[4], [30130, 30131, 30132, 30133]), + (OTPLocalizer.AprilToonsMenuSections[1], [30100]), + (OTPLocalizer.AprilToonsMenuSections[2], [30130, 30131, 30132, 30133]), (OTPLocalizer.AprilToonsMenuSections[0], [30140, 30141]) ] @@ -85,7 +83,7 @@ VictoryPartiesMenu = [ ] WinterMenu = [ - (OTPLocalizer.WinterMenuSections[0], [30200, 30201, 30202, 30203, 30204, 30205]), + (OTPLocalizer.WinterMenuSections[0], range(30200, 30206)), (OTPLocalizer.WinterMenuSections[1], [30275, 30276, 30277]) ] diff --git a/toontown/suit/DistributedBossCogAI.py b/toontown/suit/DistributedBossCogAI.py index 4dbceac2..6b1ba371 100755 --- a/toontown/suit/DistributedBossCogAI.py +++ b/toontown/suit/DistributedBossCogAI.py @@ -223,8 +223,7 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): self.resetBattles() self.arenaSide = None self.makeBattleOneBattles() - self.barrier = self.beginBarrier('Introduction', self.involvedToons, 45, self.doneIntroduction) - return + self.barrier = self.beginBarrier('Introduction', self.involvedToons, 50, self.doneIntroduction) def doneIntroduction(self, avIds): self.b_setState('BattleOne') diff --git a/toontown/suit/DistributedLawbotBoss.py b/toontown/suit/DistributedLawbotBoss.py index 024a3ced..ddff5cc8 100755 --- a/toontown/suit/DistributedLawbotBoss.py +++ b/toontown/suit/DistributedLawbotBoss.py @@ -276,14 +276,6 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def __makeRollToBattleTwoMovie(self): startPos = Point3(ToontownGlobals.LawbotBossBattleOnePosHpr[0], ToontownGlobals.LawbotBossBattleOnePosHpr[1], ToontownGlobals.LawbotBossBattleOnePosHpr[2]) - if self.arenaSide: - topRampPos = Point3(*ToontownGlobals.LawbotBossTopRampPosB) - topRampTurnPos = Point3(*ToontownGlobals.LawbotBossTopRampTurnPosB) - p3Pos = Point3(*ToontownGlobals.LawbotBossP3PosB) - else: - topRampPos = Point3(*ToontownGlobals.LawbotBossTopRampPosA) - topRampTurnPos = Point3(*ToontownGlobals.LawbotBossTopRampTurnPosA) - p3Pos = Point3(*ToontownGlobals.LawbotBossP3PosA) battlePos = Point3(ToontownGlobals.LawbotBossBattleTwoPosHpr[0], ToontownGlobals.LawbotBossBattleTwoPosHpr[1], ToontownGlobals.LawbotBossBattleTwoPosHpr[2]) battleHpr = VBase3(ToontownGlobals.LawbotBossBattleTwoPosHpr[3], ToontownGlobals.LawbotBossBattleTwoPosHpr[4], ToontownGlobals.LawbotBossBattleTwoPosHpr[5]) bossTrack = Sequence() @@ -461,13 +453,11 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def loadPodium(self): self.podium = self.geom.find('**/Podium') - newZ = self.podium.getZ() - ToontownGlobals.LawbotBossBattleTwoPosHpr[2] if not self.debugPositions: - self.podium.setZ(newZ) + self.podium.setZ(ToontownGlobals.LawbotBossBattleOnePosHpr[2]) self.reflectedPodium = self.geom.find('**/Podium_Geo1_Refl') - reflectedZ = self.reflectedPodium.getZ() if not self.debugPositions: - self.reflectedPodium.setZ(reflectedZ) + self.reflectedPodium.setZ(ToontownGlobals.LawbotBossBattleTwoPosHpr[2]) if not self.reflectedPodium.isEmpty(): if self.debugPositions: self.reflectedPodium.show() @@ -687,12 +677,12 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): DistributedBossCog.DistributedBossCog.enterElevator(self) self.witnessToon.removeActive() self.reparentTo(render) - self.setPosHpr(*ToontownGlobals.LawbotBossBattleOnePosHpr) + self.setPosHpr(*ToontownGlobals.LawbotBossBattleTwoPosHpr) self.happy = 1 self.raised = 1 self.forward = 1 self.doAnimate() - self.__hideWitnessToon() + self.__showWitnessToon() if not self.mainDoor.isEmpty(): self.mainDoor.stash() if not self.reflectedMainDoor.isEmpty(): @@ -709,9 +699,8 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def enterIntroduction(self): self.notify.debug('----- enterIntroduction') self.reparentTo(render) - self.setPosHpr(*ToontownGlobals.LawbotBossBattleOnePosHpr) + self.setPosHpr(*ToontownGlobals.LawbotBossBattleTwoPosHpr) self.stopAnimate() - self.__hideWitnessToon() DistributedBossCog.DistributedBossCog.enterIntroduction(self) base.playMusic(self.promotionMusic, looping=1, volume=0.9) if not self.mainDoor.isEmpty(): @@ -732,13 +721,12 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def enterBattleOne(self): self.notify.debug('----- LawbotBoss.enterBattleOne ') + self.setPosHpr(*ToontownGlobals.LawbotBossBattleOnePosHpr) DistributedBossCog.DistributedBossCog.enterBattleOne(self) self.reparentTo(render) - self.setPosHpr(*ToontownGlobals.LawbotBossBattleOnePosHpr) self.clearChat() self.loop('Ff_neutral') self.notify.debug('self.battleANode = %s' % self.battleANode) - self.__hideWitnessToon() if self.battleA == None or self.battleB == None: pass return @@ -787,7 +775,6 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): self.setToonsToNeutral(self.involvedToons) self.clearChat() self.reparentTo(render) - self.__showWitnessToon() prepareBattleTwoMovie = self.__makePrepareBattleTwoMovie() intervalName = 'prepareBattleTwo' seq = Sequence(prepareBattleTwoMovie, name=intervalName) @@ -841,7 +828,6 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): self.clearChat() self.witnessToon.clearChat() self.releaseToons(finalBattle=1) - self.__showWitnessToon() if not self.useCannons: self.toonsToBattlePosition(self.toonsA, self.battleANode) self.toonsToBattlePosition(self.toonsB, self.battleBNode) @@ -912,7 +898,6 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): self.clearChat() self.reparentTo(render) base.playMusic(self.betweenBattleMusic, looping=1, volume=0.9) - self.__showWitnessToon() prepareBattleThreeMovie = self.__makePrepareBattleThreeMovie() self.acceptOnce('doneChatPage', self.__onToBattleThree) intervalName = 'prepareBattleThree' @@ -962,11 +947,6 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): self.setPosHpr(*ToontownGlobals.LawbotBossBattleThreePosHpr) self.bossMaxDamage = ToontownGlobals.LawbotBossMaxDamage base.playMusic(self.battleThreeMusic, looping=1, volume=0.9) - self.__showWitnessToon() - #diffSettings = ToontownGlobals.LawbotBossDifficultySettings[self.battleDifficulty] - #if diffSettings[4]: - #localAvatar.chatMgr.chatInputSpeedChat.removeCJMenu() - #localAvatar.chatMgr.chatInputSpeedChat.addCJMenu(self.bonusWeight) def __doneBattleThree(self): self.notify.debug('----- __doneBattleThree') @@ -1137,7 +1117,6 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): self.stash() self.stopAnimate() self.controlToons() - self.__showWitnessToon() self.witnessToon.reparentTo(render) self.witnessToon.setPosHpr(*ToontownGlobals.LawbotBossWitnessEpiloguePosHpr) self.witnessToon.loop('Sit') @@ -1371,29 +1350,28 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): if toon: delayDeletes.append(DelayDelete.DelayDelete(toon, 'LawbotBoss.makeIntroductionMovie')) - track = Parallel() - bossAnimTrack = Sequence( - ActorInterval(self, 'Ff_speech', startTime=2, duration=10, loop=1), - ActorInterval(self, 'Ff_lookRt', duration=3), - ActorInterval(self, 'Ff_lookRt', duration=3, startTime=3, endTime=0), - ActorInterval(self, 'Ff_neutral', duration=2), - ActorInterval(self, 'Ff_speech', duration=7, loop=1)) - track.append(bossAnimTrack) - attackToons = TTLocalizer.BossCogAttackToons - dialogTrack = Track( - (0, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro0, CFSpeech)), + finalPodiumPos = Point3(self.podium.getX(), self.podium.getY(), -ToontownGlobals.LawbotBossBattleTwoPosHpr[2]) + finalReflectedPodiumPos = Point3(self.reflectedPodium.getX(), self.reflectedPodium.getY(), 0.0) + finalBossPos = Point3(self.getX(), self.getY(), ToontownGlobals.LawbotBossBattleOnePosHpr[2]) + + track = Track( + (0, Parallel(self.podium.posInterval(5, finalPodiumPos), self.reflectedPodium.posInterval(5, finalReflectedPodiumPos), self.posInterval(5, finalBossPos), Func(self.loop, 'Ff_speech'), Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro0, CFSpeech))), + (5, Parallel(base.camera.posInterval(6, (-2.8, 5.6, 19.3), blendType='easeInOut'), self.posInterval(16, ToontownGlobals.LawbotBossBattleOnePosHpr[:3]))), (5.6, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro1, CFSpeech)), - (12, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro2, CFSpeech)), - (18, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro3, CFSpeech)), - (22, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro4, CFSpeech)), - (24, Sequence( - Func(self.clearChat), - self.loseCogSuits(self.toonsA + self.toonsB, render, (-2.798, -70, 10, 180, 0, 0)))), - (27, Sequence( - self.toonNormalEyes(self.involvedToons), - Func(self.loop, 'Ff_neutral'), - Func(self.setChatAbsolute, attackToons, CFSpeech)))) - track.append(dialogTrack) + (11, Parallel(Func(self.play, 'Ff_lookRt'), base.camera.posInterval(3, (-2.8, -50.6, 19.3), blendType='easeInOut'))), + (11.5, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro2, CFSpeech)), + (13, self.actorInterval('Ff_lookRt', playRate=-1)), + (15, Sequence(Func(base.camera.reparentTo, self.witnessToon), Func(base.camera.setPosHpr, 0, 8, 2, 180, 10, 0))), + (15.5, Sequence(Func(self.clearChat), Func(self.witnessToon.setChatAbsolute, TTLocalizer.LawbotBossTempIntro3, CFSpeech))), + (20, Sequence(Func(self.loop, 'Ff_speech'), Func(self.witnessToon.clearChat), Func(base.camera.reparentTo, render), Func(base.camera.setPosHpr, -2.4, -90.6, 19.5, 0, 0, 0))), + (21, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro4, CFSpeech)), + (25, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro5, CFSpeech)), + (29, Sequence(Func(self.loop, 'Ff_neutral'), Func(self.clearChat), self.loseCogSuits(self.toonsA + self.toonsB, render, (-2.798, -70, 10, 180, 0, 0)))), + (32, Sequence(self.toonNormalEyes(self.involvedToons), Func(self.loop, 'Ff_neutral'), Func(base.camera.reparentTo, render), Func(base.camera.setPosHpr, -2.4, -96.6, 4.5, 0, 20, 0))), + (33, Func(self.setChatAbsolute, TTLocalizer.LawbotBossTempIntro6, CFSpeech)), + (39, Sequence(Func(self.setChatAbsolute, TTLocalizer.BossCogAttackToons, CFSpeech), base.camera.posHprInterval(0.5, (-2.7, -90, 0), (0, 39.7, 8.3), blendType='easeInOut'))), + (42, Sequence())) + return Sequence( Func(self.stickToonsToFloor), track, diff --git a/toontown/suit/DistributedSellbotBoss.py b/toontown/suit/DistributedSellbotBoss.py index 41494006..31d9cd5a 100755 --- a/toontown/suit/DistributedSellbotBoss.py +++ b/toontown/suit/DistributedSellbotBoss.py @@ -66,7 +66,7 @@ class DistributedSellbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): self.strafeInterval = None self.onscreenMessage = None self.toonMopathInterval = [] - self.nerfed = ToontownGlobals.SELLBOT_NERF_HOLIDAY in base.cr.newsManager.getHolidayIdList() + self.nerfed = base.cr.newsManager.isHolidayRunning(ToontownGlobals.SELLBOT_NERF_HOLIDAY) self.localToonPromoted = True self.resetMaxDamage() diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 11c4d8f5..e44c7be4 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -251,16 +251,6 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.setGMIcon(access) def setDNA(self, dna): - if base.cr.newsManager: - if base.cr.newsManager.isHolidayRunning(ToontownGlobals.SPOOKY_BLACK_CAT): - black = 26 - heads = ['cls', - 'css', - 'csl', - 'cll'] - dna.setTemporary(random.choice(heads), black, black, black) - else: - dna.restoreTemporary(self.style) oldHat = self.getHat() oldGlasses = self.getGlasses() oldBackpack = self.getBackpack() @@ -1672,12 +1662,6 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.effect = TrickOrTreatTargetEffect(beanAmount) self.effect.play() - def trickOrTreatMilestoneMet(self): - if self.effect: - self.effect.stop() - self.effect = TrickOrTreatMilestoneEffect() - self.effect.play() - def winterCarolingTargetMet(self, beanAmount): if self.effect: self.effect.stop() @@ -2057,9 +2041,6 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute for soundSequence in removeList: self.soundSequenceList.remove(soundSequence) - def sendLogMessage(self, message): - self.sendUpdate('logMessage', [message]) - def setChatAbsolute(self, chatString, chatFlags, dialogue = None, interrupt = 1, quiet = 0): DistributedAvatar.DistributedAvatar.setChatAbsolute(self, chatString, chatFlags, dialogue, interrupt) diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index d19a05dd..d913ffe4 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -159,6 +159,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.reported = [] self.trueFriends = [] self.fishBingoTutorialDone = False + self.nextKnockHeal = 0 def generate(self): DistributedPlayerAI.DistributedPlayerAI.generate(self) @@ -1586,14 +1587,15 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.sendUpdate('setCheesyEffect', [effect, hoodId, expireTime]) def setCheesyEffect(self, effect, hoodId, expireTime): - if (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.WINTER_CAROLING)) and (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.WACKY_WINTER_CAROLING)) and effect == ToontownGlobals.CESnowMan: + if (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.CHRISTMAS)) and effect == ToontownGlobals.CESnowMan: self.b_setCheesyEffect(ToontownGlobals.CENormal, hoodId, expireTime) self.b_setScavengerHunt([]) return - elif (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN_PROPS)) and (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN_COSTUMES)) and (not simbase.air.wantHalloween) and effect == ToontownGlobals.CEPumpkin: + elif (not simbase.air.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN)) and effect == ToontownGlobals.CEPumpkin: self.b_setCheesyEffect(ToontownGlobals.CENormal, hoodId, expireTime) self.b_setScavengerHunt([]) return + self.savedCheesyEffect = effect self.savedCheesyHoodId = hoodId self.savedCheesyExpireTime = expireTime @@ -1605,7 +1607,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo taskMgr.doMethodLater(duration, self.__undoCheesyEffect, taskName) else: self.__undoCheesyEffect(None) - return def getCheesyEffect(self): return (self.savedCheesyEffect, self.savedCheesyHoodId, self.savedCheesyExpireTime) @@ -3654,13 +3655,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getNametagStyle(self): return self.nametagStyle - def logMessage(self, message): - avId = self.air.getAvatarIdFromSender() - try: - self.air.writeServerEvent('clientLog', avId, message) - except: - self.air.writeServerEvent('suspicious', avId, 'client sent us a clientLog that caused an exception') - def b_setMail(self, mail): self.d_setMail(mail) self.setMail(mail) @@ -4020,6 +4014,19 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getTrueFriends(self, trueFriends): return self.trueFriends + def setNextKnockHeal(self, nextKnockHeal): + self.nextKnockHeal = nextKnockHeal + + def d_setNextKnockHeal(self, nextKnockHeal): + self.sendUpdate('setNextKnockHeal', [nextKnockHeal]) + + def b_setNextKnockHeal(self, nextKnockHeal): + self.setNextKnockHeal(nextKnockHeal) + self.d_setNextKnockHeal(nextKnockHeal) + + def getNextKnockHeal(self): + return self.nextKnockHeal + @magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int]) def cheesyEffect(value, hood=0, expire=0): """ diff --git a/toontown/toon/DistributedToonUD.py b/toontown/toon/DistributedToonUD.py index ddb0a95e..8acf5e3b 100755 --- a/toontown/toon/DistributedToonUD.py +++ b/toontown/toon/DistributedToonUD.py @@ -421,15 +421,6 @@ class DistributedToonUD(DistributedObjectUD): def announceBingo(self): pass - def trickOrTreatTargetMet(self, todo0): - pass - - def trickOrTreatMilestoneMet(self): - pass - - def winterCarolingTargetMet(self, todo0): - pass - def setCogSummonsEarned(self, todo0): pass @@ -466,9 +457,6 @@ class DistributedToonUD(DistributedObjectUD): def logSuspiciousEvent(self, todo0): pass - def logMessage(self, todo0): - pass - def forceLogoutWithNotify(self): pass diff --git a/toontown/toon/LaughingManGlobals.py b/toontown/toon/LaughingManGlobals.py index 782c63be..1a1f2443 100755 --- a/toontown/toon/LaughingManGlobals.py +++ b/toontown/toon/LaughingManGlobals.py @@ -41,8 +41,3 @@ 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) -""" diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 6baf0c16..aa027051 100755 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -154,8 +154,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.accept(self.systemMsgAckGuiDoneEvent, self.hideSystemMsgAckGui) self.systemMsgAckGui = None self.createSystemMsgAckGui() - if not hasattr(base.cr, 'lastLoggedIn'): - base.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime('') self.acceptingNewFriends = True self.acceptingNonFriendWhispers = True self.physControls.event.addAgainPattern('again%in') @@ -1630,13 +1628,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): print 'Local Toon Anim State %s' % animName DistributedToon.DistributedToon.b_setAnimState(self, animName, animMultiplier, callback, extraArgs) - def swimTimeoutAction(self): - self.ignore('wakeup') - self.takeOffSuit() - base.cr.playGame.getPlace().fsm.request('final') - self.b_setAnimState('TeleportOut', 1, self.__handleSwimExitTeleport, [0]) - return Task.done - def __handleSwimExitTeleport(self, requestStatus): self.notify.info('closing shard...') base.cr.gameFSM.request('closeShard', ['afkTimeout']) @@ -1763,3 +1754,9 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.petId = petId if self.isLocal(): base.cr.addPetToFriendsMap() + + def startAprilToonsControls(self): + self.controlManager.currentControls.setGravity(ToontownGlobals.GravityValue * 0.75) + + def stopAprilToonsControls(self): + self.controlManager.currentControls.setGravity(ToontownGlobals.GravityValue * 2.0) diff --git a/toontown/toon/NPCFriendPanel.py b/toontown/toon/NPCFriendPanel.py index ca84b235..0405f90c 100755 --- a/toontown/toon/NPCFriendPanel.py +++ b/toontown/toon/NPCFriendPanel.py @@ -2,6 +2,38 @@ from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer, ToontownGlobals, ToontownBattleGlobals import NPCToons, ToonDNA, ToonHead +def createNPCToonHead(NPCID, dimension = 0.5): + NPCInfo = NPCToons.NPCToonDict[NPCID] + dnaList = NPCInfo[2] + gender = NPCInfo[3] + if dnaList == 'r': + dnaList = NPCToons.getRandomDNA(NPCID, gender) + dna = ToonDNA.ToonDNA() + dna.newToonFromProperties(*dnaList) + head = ToonHead.ToonHead() + head.setupHead(dna, forGui=1) + fitGeometry(head, fFlip=1, dimension=dimension) + return head + +def fitGeometry(geom, fFlip = 0, dimension = 0.5): + p1 = Point3() + p2 = Point3() + geom.calcTightBounds(p1, p2) + if fFlip: + t = p1[0] + p1.setX(-p2[0]) + p2.setX(-t) + d = p2 - p1 + biggest = max(d[0], d[2]) + s = dimension / biggest + mid = (p1 + d / 2.0) * s + geomXform = hidden.attachNewNode('geomXform') + for child in geom.getChildren(): + child.reparentTo(geomXform) + + geomXform.setPosHprScale(-mid[0], -mid[1] + 1, -mid[2], 180, 0, 0, s, s, s) + geomXform.reparentTo(geom) + class NPCFriendPanel(DirectFrame): def __init__(self, parent = aspect2d, callable = False, **kw): @@ -138,7 +170,7 @@ class NPCFriendCard(DirectFrame): self.front.show() self.back.hide() self.NPCName['text'] = TTLocalizer.NPCToonNames[NPCID] - self.NPCHead = self.createNPCToonHead(NPCID, dimension=1.2) + self.NPCHead = createNPCToonHead(NPCID, dimension=1.2) self.NPCHead.reparentTo(self.front) self.NPCHead.setZ(0.45) track, level, hp, rarity = NPCToons.getNPCTrackLevelHpRarity(NPCID) @@ -183,36 +215,4 @@ class NPCFriendCard(DirectFrame): def showBack(self): self.front.hide() - self.back.show() - - def createNPCToonHead(self, NPCID, dimension = 0.5): - NPCInfo = NPCToons.NPCToonDict[NPCID] - dnaList = NPCInfo[2] - gender = NPCInfo[3] - if dnaList == 'r': - dnaList = NPCToons.getRandomDNA(NPCID, gender) - dna = ToonDNA.ToonDNA() - dna.newToonFromProperties(*dnaList) - head = ToonHead.ToonHead() - head.setupHead(dna, forGui=1) - self.fitGeometry(head, fFlip=1, dimension=dimension) - return head - - def fitGeometry(self, geom, fFlip = 0, dimension = 0.5): - p1 = Point3() - p2 = Point3() - geom.calcTightBounds(p1, p2) - if fFlip: - t = p1[0] - p1.setX(-p2[0]) - p2.setX(-t) - d = p2 - p1 - biggest = max(d[0], d[2]) - s = dimension / biggest - mid = (p1 + d / 2.0) * s - geomXform = hidden.attachNewNode('geomXform') - for child in geom.getChildren(): - child.reparentTo(geomXform) - - geomXform.setPosHprScale(-mid[0], -mid[1] + 1, -mid[2], 180, 0, 0, s, s, s) - geomXform.reparentTo(geom) \ No newline at end of file + self.back.show() \ No newline at end of file diff --git a/toontown/toon/Toon.py b/toontown/toon/Toon.py index bf16e86c..47a1bf7b 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): @@ -1188,7 +1187,10 @@ class Toon(Avatar.Avatar, ToonHead): return self.shoes def getDialogueArray(self): - animalType = self.style.getType() + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK): + animalType = random.choice(TTLocalizer.AnimalToSpecies.keys()) + else: + animalType = self.style.getType() if animalType == 'dog': dialogueArray = DogDialogueArray elif animalType == 'cat': diff --git a/toontown/toon/ToonAvatarDetailPanel.py b/toontown/toon/ToonAvatarDetailPanel.py index 7ad4ef21..1b548b0c 100755 --- a/toontown/toon/ToonAvatarDetailPanel.py +++ b/toontown/toon/ToonAvatarDetailPanel.py @@ -192,7 +192,7 @@ class ToonAvatarDetailPanel(DirectFrame): if numItems == 0: image_color = Vec4(0.5, 0.5, 0.5, 1) geom_color = Vec4(0.2, 0.2, 0.2, 0.5) - elif self.avatar.getTrackBonusLevel(track) > -1: + elif self.avatar.getTrackBonusLevel(track) >= item: image_color = Vec4(0, 0.8, 0.4, 1) geom_color = None else: diff --git a/toontown/toonbase/AprilToonsGlobals.py b/toontown/toonbase/AprilToonsGlobals.py deleted file mode 100755 index c5d5d95f..00000000 --- a/toontown/toonbase/AprilToonsGlobals.py +++ /dev/null @@ -1,10 +0,0 @@ -# Events -EventRandomDialogue = 1 # Scrambles the dialogue SFX of toons -EventRandomEffects = 2 # Random cheesy effects (non-poof) are applied to the toon at random intervals -EventEstateGravity = 3 # Enables low gravity in estates -EventGlobalGravity = 4 # Enables low gravity everywhere - -# Constants -RandomCheesyList = [1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 11, 11] -RandomCheesyMinTime = 3 -RandomCheesyMaxTime = 60 diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 37a2c66c..b85f7754 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -3771,10 +3771,9 @@ PartyTugOfWarTitle = 'Party Tug-of-War' CalendarShowAll = 'Show All' CalendarShowOnlyHolidays = 'Show Only Holidays' CalendarShowOnlyParties = 'Show Only Parties' -CalendarEndsAt = 'Ends at ' -CalendarStartedOn = 'Started on ' -CalendarEndDash = 'End-' -CalendarEndOf = 'End of ' +CalendarEndsAt = 'Ends on' +CalendarStartedOn = 'Started on' +CalendarEndOf = 'End of' CalendarPartyGetReady = 'Get ready!' CalendarPartyGo = 'Go party!' CalendarPartyFinished = "It's over..." @@ -4606,37 +4605,64 @@ STOREOWNER_CONFIRM_LOSS = 'Your closet is full. You will lose the clothes you w STOREOWNER_OK = lOK STOREOWNER_CANCEL = lCancel STOREOWNER_TROPHY = 'Wow! You collected %s of %s fish. That deserves a trophy and a Laff boost!' -SuitInvasionBegin1 = lToonHQ + ': A Cog invasion has begun!!!' -SuitInvasionBegin2 = lToonHQ + ': %s have taken over Toontown!!!' -SuitInvasionEnd1 = lToonHQ + ': The %s invasion has ended!!!' -SuitInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' -SuitInvasionUpdate1 = lToonHQ + ': Keep it up, Toons!!!' -SuitInvasionUpdate2 = lToonHQ + ': The Cogs appear to be decreasing in numbers!!!' -SuitInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' -SuitInvasionBulletin2 = lToonHQ + ': %s have taken over Toontown!!!' -SkelecogInvasionBegin1 = lToonHQ + ": Hmm... We're getting a strange reading over here..." -SkelecogInvasionBegin2 = lToonHQ + ': The Cog factories are running out of parts to build new Cogs!' -SkelecogInvasionBegin3 = lToonHQ + ': Skelecogs have taken over Toontown!!!' -SkelecogInvasionEnd1 = lToonHQ + ': The Skelecog invasion has ended!!!' -SkelecogInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' -SkelecogInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' -SkelecogInvasionBulletin2 = lToonHQ + ': The Cog factories are running out of parts to build new Cogs!' -SkelecogInvasionBulletin3 = lToonHQ + ': Skelecogs have taken over Toontown!!!' -WaiterInvasionBegin1 = lToonHQ + ': It appears that the C.E.O. has fired all his waiters...' -WaiterInvasionBegin2 = lToonHQ + ': The unemployed waiters are invading Toontown!!!' -WaiterInvasionEnd1 = lToonHQ + ': The unemployed waiters have been defeated!!!' -WaiterInvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' -WaiterInvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' -WaiterInvasionBulletin2 = lToonHQ + ': The C.E.O. has fired all of his waiters!!!' -WaiterInvasionBulletin3 = lToonHQ + ": The unemployed waiters are invading Toontown!!!" -V2InvasionBegin1 = lToonHQ + ": Yikes!!! This isn't good, Toons!" -V2InvasionBegin2 = lToonHQ + ': A major firmware update has been released to the Cogs!!!' -V2InvasionBegin3 = lToonHQ + ': Version 2.0 %s have taken over Toontown!!!' -V2InvasionEnd1 = lToonHQ + ': The version 2.0 Cog invasion has ended!!!' -V2InvasionEnd2 = lToonHQ + ': The Toons have saved the day once again!!!' -V2InvasionBulletin1 = lToonHQ + ': There is a Cog invasion in progress!!!' -V2InvasionBulletin2 = lToonHQ + ': A major firmware update has been released to the Cogs!!!' -V2InvasionBulletin3 = lToonHQ + ': Version 2.0 %s have taken over Toontown!!!' +SuitInvasionPrefix = '%s: ' % lToonHQ +SuitInvasionBegin = [ + 'A Cog invasion has begun!!!', + '%(plural)s have taken over Toontown!!!' +] +SuitInvasionEnd = [ + 'The %(singular)s invasion has ended!!!', + 'The Toons have saved the day once again!!!' +] +SuitInvasionUpdate = [ + 'Keep it up, Toons!!!', + 'The Cogs appear to be decreasing in numbers!!!' +] +SuitInvasionBulletin = [ + 'There is a Cog invasion in progress!!!', + '%(plural)s have taken over Toontown!!!' +] +SkelecogInvasionBegin = [ + "Hmm... We're getting a strange reading over here...", + 'The Cog factories are running out of parts to build new Cogs!', + 'Skelecogs have taken over Toontown!!!' +] +SkelecogInvasionEnd = [ + 'The Skelecog invasion has ended!!!', + 'The Toons have saved the day once again!!!' +] +SkelecogInvasionBulletin = [ + 'There is a Cog invasion in progress!!!', + 'The Cog factories are running out of parts to build new Cogs!', + 'Skelecogs have taken over Toontown!!!' +] +WaiterInvasionBegin = [ + 'It appears that the C.E.O. has fired all his waiters...', + 'The unemployed waiters are invading Toontown!!!' +] +WaiterInvasionEnd = [ + 'The unemployed waiters have been defeated!!!', + 'The Toons have saved the day once again!!!' +] +WaiterInvasionBulletin = [ + 'There is a Cog invasion in progress!!!', + 'The C.E.O. has fired all of his waiters!!!', + 'The unemployed waiters are invading Toontown!!!' +] +V2InvasionBegin = [ + "Yikes!!! This isn't good, Toons!", + 'A major firmware update has been released to the Cogs!!!', + 'Version 2.0 %(plural)s have taken over Toontown!!!' +] +V2InvasionEnd = [ + 'The Version 2.0 %(singular)s invasion has ended!!!', + 'The Toons have saved the day once again!!!' +] +V2InvasionBulletin = [ + 'There is a Cog invasion in progress!!!', + 'A major firmware update has been released to the Cogs!!!', + 'Version 2.0 %(plural)s have taken over Toontown!!!' +] LeaderboardTitle = 'Toon Platoon' QuestScript101_0 = 'Come here! Use the arrow keys to move.' QuestScript101_1 = 'These are Cogs. They are robots that are trying to take over Toontown.' @@ -6880,7 +6906,6 @@ PetTrait2descriptions = {'hungerThreshold': ('Always Hungry', 'Often Affectionate', 'Always Affectionate')} FireworksInstructions = lToonHQ + ': Hit the "Page Up" key to see the show!' -startFireworksResponse = "Usage: startFireworksShow ['num']\n 'num' = %s - New Years\n %s - Party Summer \n %s - 4th of July" FireworksJuly4Beginning = lToonHQ + ': Welcome to summer fireworks! Enjoy the show!' FireworksJuly4Ending = lToonHQ + ': Hope you enjoyed the show! Have a great summer!' FireworksNewYearsEveBeginning = lToonHQ + ': Happy New Year! Enjoy the fireworks show, sponsored by Flippy!' @@ -7214,6 +7239,11 @@ 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!' +AprilToonsWeekStart = "It's April Toons Week!" +AprilToonsWeekEnd = 'April Toons Week is over. See you next year!' 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.' @@ -7513,11 +7543,13 @@ CircuitRaceOngoing = 'Welcome! The Toontown Grand Prix is currently in progress. CircuitRaceEnd = "That's all for today's Toontown Grand Prix at Goofy Speedway. See you next week!" TrickOrTreatMsg = 'You have already\nfound this treat!' WinterCarolingMsg = 'You have already been caroling here!' -LawbotBossTempIntro0 = "Hmmm what's on the docket today?" +LawbotBossTempIntro0 = "Hrmmm, what's on the docket for today?" LawbotBossTempIntro1 = 'Aha, we have a Toon on trial!' -LawbotBossTempIntro2 = "The prosecution's case is strong." -LawbotBossTempIntro3 = 'And here are the public defenders.' -LawbotBossTempIntro4 = "Wait a minute... You're Toons!" +LawbotBossTempIntro2 = "The prosecution's case is strong..." +LawbotBossTempIntro3 = "Hey, your honorable blindness, you're looking the wrong way!" +LawbotBossTempIntro4 = 'I may be blind...' +LawbotBossTempIntro5 = 'But Justice is NOT!' +LawbotBossTempIntro6 = 'I should have known you Toons would try to upset this trial.' LawbotBossTempJury1 = 'Jury selection will now commence.' LawbotBossHowToGetEvidence = 'Touch the witness stand to get evidence.' LawbotBossTrialChat1 = 'Court is now in session' @@ -7526,7 +7558,7 @@ LawbotBossNeedMoreEvidence = 'You need to get more evidence!' LawbotBossDefenseWins1 = 'Impossible! The defense won?' LawbotBossDefenseWins2 = 'No. I declare a mistrial! A new one will be scheduled.' LawbotBossDefenseWins3 = "Hrrmpphh. I'll be in my chambers." -LawbotBossProsecutionWins = 'I find in favor of the plaintiff' +LawbotBossProsecutionWins = 'I find in favor of the plaintiff!' LawbotBossReward = 'I award a promotion and the ability to summon Cogs' LawbotBossLeaveCannon = 'Leave cannon' LawbotBossPassExam = 'Bah, so you passed the bar exam.' @@ -7968,19 +8000,25 @@ BankUpgradeHolidayStart = 'Something Toontastic happened to your Jellybean Bank! HalloweenPropsHolidayStart = "It's Halloween in Toontown!" HalloweenPropsHolidayEnd = 'Halloween has ended. Boo!' SpookyPropsHolidayStart = 'Silly Meter spins Toontown into spooky mode!' -BlackCatHolidayStart = 'Create a Black Cat - Today only!' +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!" WinterDecorationsEnd = 'Winter Holiday is over - Happy New Year!' WackyWinterDecorationsStart = 'Brrr! Silly Meter goes from silly to chilly!' WinterCarolingStart = 'Caroling has come to Toontown. Sing for your Snowman Head - see the Blog for details!' +WinterCarolingEnd = 'Caroling is over. See you next year.' +TrickOrTreatStart = 'Happy Halloween! Trick or treat throughout Toontown to get a nifty Halloween pumpkin head reward!' +TrickOrTreatEnd = 'Halloween is over. See you next year.' ExpandedClosetsStart = 'Attention Toons: For a limited time, Members can purchase the new 50 item Closet from the Cattlelog for the low price of 50 Jellybeans!' KartingTicketsHolidayStart = 'Get double tickets from Practice races at Goofy Speedway today!' IdesOfMarchStart = 'Toons go GREEN!' +IdesOfMarchEnd = 'Hope you had fun being green.' LogoutForced = 'You have done something wrong\n and are being logged out automatically,\n additionally your account may be frozen.\n Try going on a walk outside, it is fun.' CountryClubToonEnterElevator = '%s \nhas jumped in the golf kart.' CountryClubBossConfrontedMsg = '%s is battling the Club President!' @@ -8212,19 +8250,21 @@ DayNamesAbbrev = ('MON', 'FRI', 'SAT', 'SUN') +SummerFireworksStart = 'Celebrate Summer with a fireworks show every hour in each playground!' +SummerFireworksEnd = 'Summer Fireworks are over. Hope you had fun.' +NewYearFireworksStart = 'Happy New Year! Enjoy a fireworks show every hour in each playground!' +NewYearFireworksEnd = 'New Year Fireworks are over. See you next year!' HolidayNamesInCalendar = {1: ('Summer Fireworks', 'Celebrate Summer with a fireworks show every hour in each playground!'), 2: ('New Year Fireworks', 'Happy New Year! Enjoy a fireworks show every hour in each playground!'), - 3: ('Bloodsucker Invasion', 'Help defend Toontown from the Bloodsucker invasion!'), + 3: ('Halloween', 'Happy Halloween! Trick or treat throughout Toontown to get a nifty Halloween pumpkin head reward!'), 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!'), + 9: ('Black Cat Day', 'Create a Toontastic Black Cat Toon - today only!'), + 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!'), @@ -8250,7 +8290,6 @@ HolidayNamesInCalendar = {1: ('Summer Fireworks', 'Celebrate Summer with a firew 54: ('Bean Counter Invasion', 'Stop the Bean Counter Cogs from invading Toontown!'), 55: ('Double Talker Invasion', 'Stop the Double Talker Cogs from invading Toontown!'), 56: ('Downsizer Invasion', 'Stop the Downsizer Cogs from invading Toontown!'), - 57: ('Caroling', 'Sing for your Snowman Head! See the Blog for details!'), 59: ("ValenToon's Day", "Celebrate ValenToon's Day from Feb 09 to Feb 16!"), 72: ('Yes Men Invasion', 'Stop the Yes Men Cogs from invading Toontown!'), 73: ('Tightwad Invasion', 'Stop the Tightwad Cogs from invading Toontown!'), @@ -8283,7 +8322,8 @@ HolidayNamesInCalendar = {1: ('Summer Fireworks', 'Celebrate Summer with a firew 101: ('Double Bean Days - Fishing', ''), 102: ('Jellybean Week', 'Celebrate Jellybean Week with double Jellybean rewards!'), 103: ("Top Toons New Year's Day Marathon", "Chances to win every hour! See the What's New Blog for details!"), - 105: ('Toons go GREEN!', 'Toons make a green scene at Green Bean Jeans on Oak Street in Daisy Gardens!')} + 105: ('Toons go GREEN!', 'Toons make a green scene at Green Bean Jeans on Oak Street in Daisy Gardens!'), + 123: ('Day of the Magic Cat', 'Toons gather around to honor the Magic Cat, the creator of the universe!')} UnknownHoliday = 'Unknown Holiday %d' HolidayFormat = '%b %d ' HourFormat = '12' diff --git a/toontown/toonbase/ToonBase.py b/toontown/toonbase/ToonBase.py index c34b4d5a..e375969f 100755 --- a/toontown/toonbase/ToonBase.py +++ b/toontown/toonbase/ToonBase.py @@ -112,11 +112,6 @@ class ToonBase(OTPBase.OTPBase): if cogdoGameSafezoneId != -1: self.cogdoGameSafezoneId = cogdoGameSafezoneId ToontownBattleGlobals.SkipMovie = self.config.GetBool('skip-battle-movies', 0) - self.creditCardUpFront = self.config.GetInt('credit-card-up-front', -1) - if self.creditCardUpFront == -1: - del self.creditCardUpFront - else: - self.creditCardUpFront = self.creditCardUpFront != 0 self.housingEnabled = self.config.GetBool('want-housing', 1) self.cannonsEnabled = self.config.GetBool('estate-cannons', 0) self.fireworksEnabled = self.config.GetBool('estate-fireworks', 0) diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index eea28b4b..53e27deb 100755 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -824,31 +824,42 @@ WaiterInvasionBulletin = 9 V2InvasionBegin = 10 V2InvasionEnd = 11 V2InvasionBulletin = 12 -NO_HOLIDAY = 0 -JULY4_FIREWORKS = 1 -NEWYEARS_FIREWORKS = 2 +EndingInvasions = [SuitInvasionEnd, SkelecogInvasionEnd, WaiterInvasionEnd, V2InvasionEnd] +SuitInvasions = { + SuitInvasionBegin: TTLocalizer.SuitInvasionBegin, + SuitInvasionEnd: TTLocalizer.SuitInvasionEnd, + SuitInvasionUpdate: TTLocalizer.SuitInvasionUpdate, + SuitInvasionBulletin: TTLocalizer.SuitInvasionBulletin, + SkelecogInvasionBegin: TTLocalizer.SkelecogInvasionBegin, + SkelecogInvasionEnd: TTLocalizer.SkelecogInvasionEnd, + SkelecogInvasionBulletin: TTLocalizer.SkelecogInvasionBulletin, + WaiterInvasionBegin: TTLocalizer.WaiterInvasionBegin, + WaiterInvasionEnd: TTLocalizer.WaiterInvasionEnd, + WaiterInvasionBulletin: TTLocalizer.WaiterInvasionBulletin, + V2InvasionBegin: TTLocalizer.V2InvasionBegin, + V2InvasionEnd: TTLocalizer.V2InvasionEnd, + V2InvasionBulletin: TTLocalizer.V2InvasionBulletin +} +SUMMER_FIREWORKS = 1 +NEW_YEAR_FIREWORKS = 2 HALLOWEEN = 3 -WINTER_DECORATIONS = 4 +CHRISTMAS = 4 SKELECOG_INVASION = 5 MR_HOLLYWOOD_INVASION = 6 -FISH_BINGO_NIGHT = 7 BLACK_CAT_DAY = 9 RESISTANCE_EVENT = 10 KART_RECORD_DAILY_RESET = 11 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 -HALLOWEEN_PROPS = 26 -HALLOWEEN_COSTUMES = 27 DECEMBER_INVASION = 28 -APRIL_FOOLS_COSTUMES = 29 +APRIL_TOONS_WEEK = 29 OCTOBER31_FIREWORKS = 31 NOVEMBER19_FIREWORKS = 32 SELLBOT_SURPRISE_1 = 33 @@ -876,9 +887,8 @@ COLD_CALLER_INVASION = 53 BEAN_COUNTER_INVASION = 54 DOUBLE_TALKER_INVASION = 55 DOWNSIZER_INVASION = 56 -WINTER_CAROLING = 57 HYDRANT_ZERO_HOLIDAY = 58 -VALENTINES_DAY = 59 +VALENTOONS_DAY = 59 SILLYMETER_HOLIDAY = 60 MAILBOX_ZERO_HOLIDAY = 61 TRASHCAN_ZERO_HOLIDAY = 62 @@ -931,12 +941,6 @@ JELLYBEAN_TROLLEY_HOLIDAY_MONTH = 113 JELLYBEAN_FISHING_HOLIDAY_MONTH = 114 JELLYBEAN_PARTIES_HOLIDAY_MONTH = 115 SILLYMETER_EXT_HOLIDAY = 116 -SPOOKY_BLACK_CAT = 117 -SPOOKY_TRICK_OR_TREAT = 118 -SPOOKY_PROPS = 119 -SPOOKY_COSTUMES = 120 -WACKY_WINTER_DECORATIONS = 121 -WACKY_WINTER_CAROLING = 122 LAUGHING_MAN = 123 TOT_REWARD_JELLYBEAN_AMOUNT = 100 TOT_REWARD_END_OFFSET_AMOUNT = 0 @@ -955,12 +959,6 @@ LawbotBossBattleTwoPosHpr = (-2.798, 0, 0, 0) -LawbotBossTopRampPosA = (-80, -35, 18) -LawbotBossTopRampTurnPosA = (-80, 10, 18) -LawbotBossP3PosA = (55, -9, 0) -LawbotBossTopRampPosB = (80, -35, 18) -LawbotBossTopRampTurnPosB = (80, 10, 18) -LawbotBossP3PosB = (55, -9, 0) LawbotBossBattleThreePosHpr = LawbotBossBattleTwoPosHpr LawbotBossBottomPos = (50, 39, 0) LawbotBossDeathPos = (50, 40, 0) @@ -1631,3 +1629,5 @@ FISHSALE_NONE = 0 FISHSALE_COMPLETE = 1 FISHSALE_TROPHY = 2 NPCCollisionDelay = 2.5 +KnockKnockHeal = 12 +KnockKnockCooldown = 600 diff --git a/toontown/toonbase/ToontownTimer.py b/toontown/toonbase/ToontownTimer.py index a8e72f26..1f275e82 100755 --- a/toontown/toonbase/ToontownTimer.py +++ b/toontown/toonbase/ToontownTimer.py @@ -80,15 +80,16 @@ class ToontownTimer(DirectFrame): if task.time >= task.duration: self.timerExpired() if task.callback: - task.callback() + task.callback(*task.extraArgs) return Task.done else: return Task.cont - def countdown(self, duration, callback = None): + def countdown(self, duration, callback = None, extraArgs = []): self.countdownTask = Task.Task(self._timerTask) self.countdownTask.duration = duration self.countdownTask.callback = callback + self.countdownTask.extraArgs = extraArgs taskMgr.remove('timerTask%s' % self.timerId) return taskMgr.add(self.countdownTask, 'timerTask%s' % self.timerId) @@ -113,4 +114,4 @@ class ToontownTimer(DirectFrame): def cleanup(self): self.destroy() - self.notify.warning('Call destroy, not cleanup') + self.notify.warning('Call destroy, not cleanup') \ No newline at end of file diff --git a/toontown/town/Street.py b/toontown/town/Street.py index 24ef2d41..0f533e41 100755 --- a/toontown/town/Street.py +++ b/toontown/town/Street.py @@ -115,16 +115,9 @@ class Street(BattlePlace.BattlePlace): for light in self.halloweenLights: light.setColorScaleOff(1) - newsManager = base.cr.newsManager - if newsManager: - holidayIds = base.cr.newsManager.getDecorationHolidayId() - if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds or ToontownGlobals.SPOOKY_COSTUMES in holidayIds) and self.loader.hood.spookySkyFile: - lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky)) - lightsOff.start() - else: - self.loader.hood.startSky() - lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) - lightsOn.start() + if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN) and self.loader.hood.spookySkyFile: + lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky)) + lightsOff.start() else: self.loader.hood.startSky() lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) @@ -146,7 +139,6 @@ class Street(BattlePlace.BattlePlace): for light in self.halloweenLights: light.reparentTo(hidden) - newsManager = base.cr.newsManager NametagGlobals.setWant2dNametags(False) self.loader.hood.stopSky() self.loader.music.stop() diff --git a/toontown/town/TownBattle.py b/toontown/town/TownBattle.py index 481e73fa..e53b7923 100755 --- a/toontown/town/TownBattle.py +++ b/toontown/town/TownBattle.py @@ -313,7 +313,10 @@ class TownBattle(StateData.StateData): elif tracks[i] == BattleBase.PASS_ATTACK: numTargets = 0 target = -2 - elif tracks[i] == BattleBase.SOS or tracks[i] == BattleBase.NPCSOS or tracks[i] == BattleBase.PETSOS: + elif tracks[i] == BattleBase.NPCSOS: + numTargets = 0 + target = targets[i] + elif tracks[i] == BattleBase.SOS or tracks[i] == BattleBase.PETSOS: numTargets = 0 target = -2 elif tracks[i] == HEAL_TRACK: @@ -332,8 +335,6 @@ class TownBattle(StateData.StateData): numTargets = None self.toonPanels[battleIndices[i]].setValues(battleIndices[i], tracks[i], levels[i], numTargets, target, self.localNum) - return - def chooseDefaultTarget(self): if self.track > -1: response = {} diff --git a/toontown/town/TownBattleToonPanel.py b/toontown/town/TownBattleToonPanel.py index 48152d78..67b70b51 100755 --- a/toontown/town/TownBattleToonPanel.py +++ b/toontown/town/TownBattleToonPanel.py @@ -7,6 +7,7 @@ from toontown.toon import LaffMeter from toontown.battle import BattleBase from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer +from toontown.toon.NPCFriendPanel import createNPCToonHead class TownBattleToonPanel(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('TownBattleToonPanel') @@ -21,6 +22,7 @@ class TownBattleToonPanel(DirectFrame): self.sosText.hide() self.fireText = DirectLabel(parent=self, relief=None, pos=(0.1, 0, 0.015), text=TTLocalizer.TownBattleToonFire, text_scale=0.06) self.fireText.hide() + self.sosHead = None self.undecidedText = DirectLabel(parent=self, relief=None, pos=(0.1, 0, 0.015), text=TTLocalizer.TownBattleUndecided, text_scale=0.1) self.healthText = DirectLabel(parent=self, text='', pos=(-0.06, 0, -0.075), text_scale=0.055) self.hpChangeEvent = None @@ -92,6 +94,7 @@ class TownBattleToonPanel(DirectFrame): self.gagNode.hide() self.whichText.hide() self.passNode.hide() + self.cleanupSosHead() if self.hasGag: self.gag.removeNode() self.hasGag = 0 @@ -103,7 +106,12 @@ class TownBattleToonPanel(DirectFrame): self.fireText.show() self.whichText.show() self.whichText['text'] = self.determineWhichText(numTargets, targetIndex, localNum, index) - elif track == BattleBase.SOS or track == BattleBase.NPCSOS or track == BattleBase.PETSOS: + elif track == BattleBase.NPCSOS: + self.sosHead = createNPCToonHead(targetIndex) + self.sosHead.reparentTo(self) + self.sosHead.setPos(0.1, 0, 0.045) + self.sosHead.setScale(0.24) + elif track == BattleBase.SOS or track == BattleBase.PETSOS: self.sosText.show() elif track >= MIN_TRACK_INDEX and track <= MAX_TRACK_INDEX: self.undecidedText.hide() @@ -119,7 +127,6 @@ class TownBattleToonPanel(DirectFrame): self.whichText['text'] = self.determineWhichText(numTargets, targetIndex, localNum, index) else: self.notify.error('Bad track value: %s' % track) - return def determineWhichText(self, numTargets, targetIndex, localNum, index): returnStr = '' @@ -151,8 +158,14 @@ class TownBattleToonPanel(DirectFrame): del self.gag self.gagNode.removeNode() del self.gagNode + self.cleanupSosHead() DirectFrame.destroy(self) + def cleanupSosHead(self): + if self.sosHead: + self.sosHead.removeNode() + self.sosHead = None + def cleanupLaffMeter(self): self.notify.debug('Cleaning up laffmeter!') self.ignore(self.hpChangeEvent)