Merge branch 'news'

This commit is contained in:
John 2015-06-30 22:07:08 +03:00
commit be683c8fb0
127 changed files with 1070 additions and 2650 deletions

View file

@ -150,7 +150,7 @@ dclass DistributedPlayer : DistributedAvatar {
setSC(uint16 msgIndex) broadcast ownsend airecv; setSC(uint16 msgIndex) broadcast ownsend airecv;
setSCCustom(uint16 msgIndex) broadcast ownsend airecv; setSCCustom(uint16 msgIndex) broadcast ownsend airecv;
setFriendsList(uint32[] = []) ownrecv required db 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; setWishName(string = "") db ram;
setWishNameState(string = "OPEN") db ram; setWishNameState(string = "OPEN") db ram;
setAdminAccess(uint16 = 0) required broadcast ownrecv db; 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 DistributedGoon/AI
from toontown.suit import DistributedGridGoon/AI from toontown.suit import DistributedGridGoon/AI
from toontown.coghq import BattleBlocker/AI from toontown.coghq import BattleBlocker/AI
from toontown.ai import DistributedAprilToonsMgr/AI
from toontown.ai import DistributedBlackCatMgr/AI from toontown.ai import DistributedBlackCatMgr/AI
from toontown.ai import DistributedReportMgr/AI from toontown.ai import DistributedReportMgr/AI
from toontown.ai import DistributedPolarPlaceEffectMgr/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 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 DistributedMint/AI
from toontown.coghq import DistributedMintRoom/AI from toontown.coghq import DistributedMintRoom/AI
from toontown.coghq import DistributedMintBattle/AI from toontown.coghq import DistributedMintBattle/AI
@ -559,7 +555,7 @@ dclass ToontownDistrict : DistributedDistrict {
}; };
dclass ToontownDistrictStats : DistributedObject { dclass ToontownDistrictStats : DistributedObject {
settoontownDistrictId(uint32) broadcast required ram; setDistrictId(uint32) broadcast required ram;
setAvatarCount(uint32) broadcast required ram; setAvatarCount(uint32) broadcast required ram;
setInvasionStatus(uint8) broadcast required ram; setInvasionStatus(uint8) broadcast required ram;
}; };
@ -641,7 +637,7 @@ dclass DistributedToon : DistributedPlayer {
setSpeedChatStyleIndex(uint8 = 1) required ownsend broadcast db; setSpeedChatStyleIndex(uint8 = 1) required ownsend broadcast db;
setTrophyScore(uint16) broadcast ownrecv ram; setTrophyScore(uint16) broadcast ownrecv ram;
setTeleportAccess(uint32[] = []) required ownrecv db; setTeleportAccess(uint32[] = []) required ownrecv db;
setScavengerHunt(uint32[] = []) required ownrecv db; setScavengerHunt(uint16[] = []) required ownrecv db;
checkTeleportAccess(uint16) airecv ownsend; checkTeleportAccess(uint16) airecv ownsend;
setTeleportOverride(uint8) clsend airecv; setTeleportOverride(uint8) clsend airecv;
battleSOS(uint32) ownrecv clsend; battleSOS(uint32) ownrecv clsend;
@ -718,9 +714,6 @@ dclass DistributedToon : DistributedPlayer {
setCurrentKart(uint32) broadcast ownrecv ram; setCurrentKart(uint32) broadcast ownrecv ram;
squish(uint8) ownsend airecv; squish(uint8) ownsend airecv;
announceBingo() broadcast ownrecv; announceBingo() broadcast ownrecv;
trickOrTreatTargetMet(uint32) ownrecv;
trickOrTreatMilestoneMet() ownrecv;
winterCarolingTargetMet(uint32) ownrecv;
setCogSummonsEarned(uint8[] = [0*32]) required ownrecv db; setCogSummonsEarned(uint8[] = [0*32]) required ownrecv db;
reqCogSummons(char [0-256], uint32) ownsend airecv; reqCogSummons(char [0-256], uint32) ownsend airecv;
cogSummonsResponse(string, uint32, uint32) ownrecv; cogSummonsResponse(string, uint32, uint32) ownrecv;
@ -733,7 +726,6 @@ dclass DistributedToon : DistributedPlayer {
setGolfCourseBest(uint8 [3] = [0*3]) required ownrecv db; setGolfCourseBest(uint8 [3] = [0*3]) required ownrecv db;
setUnlimitedSwing(uint8) broadcast ownrecv ram; setUnlimitedSwing(uint8) broadcast ownrecv ram;
logSuspiciousEvent(char [0-1024]) ownsend airecv; logSuspiciousEvent(char [0-1024]) ownsend airecv;
logMessage(char [0-1024]) ownsend airecv;
forceLogoutWithNotify() ownrecv; forceLogoutWithNotify() ownrecv;
setPinkSlips(uint8 = 0) required ownrecv db; setPinkSlips(uint8 = 0) required ownrecv db;
setNametagStyle(uint8 = 0) required broadcast ownrecv db; setNametagStyle(uint8 = 0) required broadcast ownrecv db;
@ -750,12 +742,12 @@ dclass DistributedToon : DistributedPlayer {
setPartyStatus(uint64, uint8) ownrecv airecv; setPartyStatus(uint64, uint8) ownrecv airecv;
announcePartyStarted(uint64) ownrecv; announcePartyStarted(uint64) ownrecv;
setNeverStartedPartyRefunded(uint64, int8, uint16) ownrecv; setNeverStartedPartyRefunded(uint64, int8, uint16) ownrecv;
setDISLid(uint32) ram db airecv;
setAnimalSound(uint8 index) ram broadcast ownrecv; setAnimalSound(uint8 index) ram broadcast ownrecv;
setBuffs(uint32[] = []) required ownrecv db; setBuffs(uint32[] = []) required ownrecv db;
setRedeemedCodes(string [] = []) required ownrecv db; setRedeemedCodes(string [] = []) required ownrecv db;
setEmblems(uint32[] = [0, 0]) required ownrecv db; setEmblems(uint32[] = [0, 0]) required ownrecv db;
setTrueFriends(uint32[] = []) required clsend ownrecv db; setTrueFriends(uint32[] = []) required clsend ownrecv db;
setNextKnockHeal(uint32) ram airecv;
}; };
dclass DistributedPartyGate : DistributedObject { dclass DistributedPartyGate : DistributedObject {
@ -1210,8 +1202,6 @@ dclass DistributedTargetGame : DistributedMinigame {
}; };
dclass EstateManager : DistributedObject { dclass EstateManager : DistributedObject {
startAprilFools() broadcast;
stopAprilFools() broadcast;
getEstateZone(uint32 avId) airecv clsend; getEstateZone(uint32 avId) airecv clsend;
setEstateZone(uint32 ownerId, uint32 zoneId); setEstateZone(uint32 ownerId, uint32 zoneId);
setAvHouseId(uint32, uint32[]) broadcast; setAvHouseId(uint32, uint32[]) broadcast;
@ -1498,55 +1488,11 @@ dclass GroupManager : DistributedObject {
removePlayerFromGroup(uint32, uint32) clsend airecv; 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 { dclass NewsManager : DistributedObject {
setPopulation(uint32) broadcast ram; startHoliday(uint8) broadcast;
setBingoWin(uint32) broadcast ram; endHoliday(uint8) broadcast;
setBingoStart() broadcast; setActiveHolidays(uint8[]);
setBingoEnd() broadcast;
setCircuitRaceStart() broadcast;
setCircuitRaceEnd() broadcast;
setInvasionStatus(uint8, string, uint32, uint8) broadcast; setInvasionStatus(uint8, string, uint32, uint8) broadcast;
setHolidayIdList(uint32[]) broadcast ram;
holidayNotify() broadcast;
setWeeklyCalendarHolidays(weeklyCalendarHoliday []) required broadcast ram;
setYearlyCalendarHolidays(yearlyCalendarHoliday []) required broadcast ram;
setOncelyCalendarHolidays(oncelyCalendarHoliday []) required broadcast ram;
setRelativelyCalendarHolidays(relativelyCalendarHoliday []) required broadcast ram;
setMultipleStartHolidays(multipleStartHoliday []) required broadcast ram;
sendSystemMessage(string, uint8) broadcast ram;
}; };
dclass PurchaseManager : DistributedObject { dclass PurchaseManager : DistributedObject {
@ -1791,7 +1737,7 @@ dclass DistributedCogHQDoor : DistributedDoor {
}; };
dclass DistributedCogHQExteriorDoor : DistributedCogHQDoor { dclass DistributedCogHQExteriorDoor : DistributedCogHQDoor {
selectLobby(uint32) broadcast ram; selectLobby(uint32) broadcast;
confirmEntrance(uint32, bool) airecv clsend; confirmEntrance(uint32, bool) airecv clsend;
}; };
@ -1893,6 +1839,7 @@ dclass DistributedNPCGlove : DistributedNPCToonBase {
}; };
dclass DistributedKnockKnockDoor : DistributedAnimatedProp { dclass DistributedKnockKnockDoor : DistributedAnimatedProp {
requestToonup() airecv clsend;
}; };
dclass DistributedElevator : DistributedObject { dclass DistributedElevator : DistributedObject {
@ -2433,12 +2380,6 @@ dclass DistributedPetProxy : DistributedPet {
setDominantMood(string) broadcast ram; setDominantMood(string) broadcast ram;
}; };
dclass DistributedAprilToonsMgr : DistributedObject {
setEventActive(uint8 eventId, bool) broadcast;
requestEventsList() clsend airecv;
requestEventsListResp(uint8 []);
};
dclass DistributedBlackCatMgr : DistributedObject { dclass DistributedBlackCatMgr : DistributedObject {
doBlackCatTransformation() broadcast; doBlackCatTransformation() broadcast;
requestBlackCatTransformation() airecv clsend; requestBlackCatTransformation() airecv clsend;
@ -2452,28 +2393,16 @@ dclass DistributedPolarPlaceEffectMgr : DistributedObject {
addPolarPlaceEffect() airecv clsend; addPolarPlaceEffect() airecv clsend;
}; };
dclass DistributedGreenToonEffectMgr : DistributedObject { dclass DistributedEffectMgr : DistributedObject {
addGreenToonEffect() airecv clsend; setHoliday(uint8) required broadcast;
requestEffect() airecv clsend;
effectDone(uint8);
}; };
dclass DistributedResistanceEmoteMgr : DistributedObject { dclass DistributedResistanceEmoteMgr : DistributedObject {
addResistanceEmote() clsend airecv; 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 { dclass DistributedVehicle : DistributedSmoothNode {
setOwner(uint32) required broadcast ram; setOwner(uint32) required broadcast ram;
setState(char, uint32) broadcast ram; setState(char, uint32) broadcast ram;
@ -3202,27 +3131,27 @@ dclass DistributedPartyManager : DistributedObject {
}; };
dclass GlobalLobbyManager : DistributedObjectGlobal { dclass GlobalLobbyManager : DistributedObjectGlobal {
lobbyManagerAIHello(uint32 channel); lobbyManagerAIHello(uint32 channel);
queryLobby(uint32 hostId); queryLobby(uint32 hostId);
addLobby(DoId avId, uint64 lobbyId); addLobby(DoId avId, uint64 lobbyId);
toonJoinedLobby(uint64 lobbyId, uint32 avId); toonJoinedLobby(uint64 lobbyId, uint32 avId);
toonLeftLobby(uint64 lobbyId, uint32 avId); toonLeftLobby(uint64 lobbyId, uint32 avId);
requestLobbySlot(uint64 lobbyId, uint32 avId); requestLobbySlot(uint64 lobbyId, uint32 avId);
lobbyDone(uint64 lobbyId); lobbyDone(uint64 lobbyId);
allocIds(uint16 count); allocIds(uint16 count);
}; };
dclass GlobalPartyManager : DistributedObjectGlobal { dclass GlobalPartyManager : DistributedObjectGlobal {
partyManagerAIHello(uint32 channel); partyManagerAIHello(uint32 channel);
queryParty(uint32 hostId); queryParty(uint32 hostId);
addParty(DoId avId, uint64 partyId, string start, string end, int8 isPrivate, addParty(DoId avId, uint64 partyId, string start, string end, int8 isPrivate,
int8 inviteTheme, activity [], decoration [], DoIdList inviteeIds); int8 inviteTheme, activity [], decoration [], DoIdList inviteeIds);
partyHasStarted(uint64 partyId, uint32 shardId, uint32 zoneId, string hostName); partyHasStarted(uint64 partyId, uint32 shardId, uint32 zoneId, string hostName);
toonJoinedParty(uint64 partyId, uint32 avId); toonJoinedParty(uint64 partyId, uint32 avId);
toonLeftParty(uint64 partyId, uint32 avId); toonLeftParty(uint64 partyId, uint32 avId);
requestPartySlot(uint64 partyId, uint32 avId, uint32 gateId); requestPartySlot(uint64 partyId, uint32 avId, uint32 gateId);
partyDone(uint64 partyId); partyDone(uint64 partyId);
allocIds(uint16 count); allocIds(uint16 count);
}; };
struct PotentialToon { struct PotentialToon {
@ -3322,4 +3251,4 @@ dclass TTSFriendsManager : DistributedObjectGlobal {
}; };
dclass ARGManager : DistributedObjectGlobal { dclass ARGManager : DistributedObjectGlobal {
}; };

View file

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

View file

@ -1,2 +0,0 @@
want-christmas #t
active-holidays 4, 57

View file

@ -1,2 +0,0 @@
want-halloween #t
active-holidays 26, 27, 13

View file

@ -38,4 +38,4 @@ show-population #t
want-instant-parties #t want-instant-parties #t
cogdo-pop-factor 1.5 cogdo-pop-factor 1.5
cogdo-ratio 0.5 cogdo-ratio 0.5
default-directnotify-level info default-directnotify-level info

View file

@ -1,2 +0,0 @@
# Distribution:
distribution en

View file

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

View file

@ -122,8 +122,6 @@ def kick(reason='No reason specified'):
Kick the target from the game server. Kick the target from the game server.
""" """
target = spellbook.getTarget() target = spellbook.getTarget()
if target == spellbook.getInvoker():
return "You can't kick yourself!"
datagram = PyDatagram() datagram = PyDatagram()
datagram.addServerHeader( datagram.addServerHeader(
target.GetPuppetConnectionChannel(target.doId), target.GetPuppetConnectionChannel(target.doId),

View file

@ -28,7 +28,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
wantDevCameraPositions = base.config.GetBool('want-dev-camera-positions', 0) wantDevCameraPositions = base.config.GetBool('want-dev-camera-positions', 0)
wantMouse = base.config.GetBool('want-mouse', 0) wantMouse = base.config.GetBool('want-mouse', 0)
sleepTimeout = base.config.GetInt('sleep-timeout', 120) sleepTimeout = base.config.GetInt('sleep-timeout', 120)
swimTimeout = base.config.GetInt('afk-timeout', 600)
__enableMarkerPlacement = base.config.GetBool('place-markers', 0) __enableMarkerPlacement = base.config.GetBool('place-markers', 0)
def __init__(self, cr, chatMgr, talkAssistant = None, passMessagesThrough = False): def __init__(self, cr, chatMgr, talkAssistant = None, passMessagesThrough = False):
@ -63,7 +62,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.sleepFlag = 0 self.sleepFlag = 0
self.isDisguised = 0 self.isDisguised = 0
self.movingFlag = 0 self.movingFlag = 0
self.swimmingFlag = 0
self.lastNeedH = None self.lastNeedH = None
self.accept('friendOnline', self.__friendOnline) self.accept('friendOnline', self.__friendOnline)
self.accept('friendOffline', self.__friendOffline) self.accept('friendOffline', self.__friendOffline)
@ -977,42 +975,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.sleepCallback = None self.sleepCallback = None
return 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): def trackAnimToSpeed(self, task):
speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds() speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds()
if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'): if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'):

View file

@ -445,10 +445,6 @@ class OTPClientRepository(ClientRepositoryBase):
def __handleLoginDone(self, doneStatus): def __handleLoginDone(self, doneStatus):
mode = doneStatus['mode'] mode = doneStatus['mode']
if mode == 'success': 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') self.loginFSM.request('waitForGameList')
elif mode == 'reject': elif mode == 'reject':
self.loginFSM.request('reject') self.loginFSM.request('reject')

View file

@ -1618,20 +1618,6 @@ SpeedChatStaticTextToontown = {100: 'Hi!',
21206: 'Speak!', 21206: 'Speak!',
30100: "Happy April Toons' Week!", 30100: "Happy April Toons' Week!",
30101: "Welcome to my April Toons' Week party!", 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.', 30130: 'Watch how far I can jump.',
30131: 'Wow, you jumped really far!', 30131: 'Wow, you jumped really far!',
30132: 'Hey, Doodles can talk!', 30132: 'Hey, Doodles can talk!',
@ -2312,8 +2298,6 @@ KartRacingMenuSections = [-1,
'TAUNTS'] 'TAUNTS']
AprilToonsMenuSections = [-1, AprilToonsMenuSections = [-1,
'GREETINGS', 'GREETINGS',
'PLAYGROUNDS',
'CHARACTERS',
'ESTATES'] 'ESTATES']
SillyHolidayMenuSections = [-1, 'WORLD', 'BATTLE'] SillyHolidayMenuSections = [-1, 'WORLD', 'BATTLE']
CarolMenuSections = [-1] CarolMenuSections = [-1]

View file

@ -3,8 +3,10 @@ from otp.otpbase.OTPLocalizer import SpeedChatStaticText
SCStaticTextMsgEvent = 'SCStaticTextMsg' SCStaticTextMsgEvent = 'SCStaticTextMsg'
def decodeSCStaticTextMsg(textId): def decodeSCStaticTextMsg(textId):
return SpeedChatStaticText.get(textId, None) if 30200 <= textId <= 30205:
textId += 20
return SpeedChatStaticText.get(textId, None)
class SCStaticTextTerminal(SCTerminal): class SCStaticTextTerminal(SCTerminal):

View file

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

View file

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

View file

@ -13,7 +13,7 @@ class DistributedBlackCatMgrAI(DistributedObjectAI):
avId = self.air.getAvatarIdFromSender() avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId) av = self.air.doId2do.get(avId)
if not av or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a: if not av or av.getTutorialAck() or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a:
return return
newDNA = ToonDNA() newDNA = ToonDNA()

View file

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

View file

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

View file

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

View file

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

View file

@ -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', [])

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -103,9 +103,9 @@ def fish(fishName):
""" """
invoker = spellbook.getInvoker() invoker = spellbook.getInvoker()
if fishName.lower() == 'remove': 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.' 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.' return 'Removed your fish request.'
for genus, species in TTLocalizer.FishSpeciesNames: for genus, species in TTLocalizer.FishSpeciesNames:
@ -113,7 +113,7 @@ def fish(fishName):
if fishName.lower() != name.lower(): if fishName.lower() != name.lower():
continue continue
fishRequest = (genus, species.index(name)) 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 'A request for the fish %s was saved.' % name
return "Couldn't find a fish with the name %s!" % fishName return "Couldn't find a fish with the name %s!" % fishName

View file

@ -80,8 +80,7 @@ class HalloweenHolidayDecorator(HolidayDecorator.HolidayDecorator):
for light in place.loader.hood.halloweenLights: for light in place.loader.hood.halloweenLights:
light.setColorScaleOff(0) light.setColorScaleOff(0)
holidayIds = base.cr.newsManager.getDecorationHolidayId() if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN):
if ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds and ToontownGlobals.SPOOKY_COSTUMES not in holidayIds:
return 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: 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)) 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') distributedEstate = base.cr.doFind('DistributedEstate')
if distributedEstate: if distributedEstate:
distributedEstate.unloadWitch() distributedEstate.unloadWitch()
holidayIds = base.cr.newsManager.getDecorationHolidayId() if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN):
if len(holidayIds) > 0:
self.decorate() self.decorate()
return return
storageFile = base.cr.playGame.hood.storageDNAFile storageFile = base.cr.playGame.hood.storageDNAFile

View file

@ -1,4 +1,3 @@
from toontown.toonbase import ToontownGlobals
from direct.interval.IntervalGlobal import Parallel, Sequence, Func, Wait from direct.interval.IntervalGlobal import Parallel, Sequence, Func, Wait
from pandac.PandaModules import Vec4, TransformState, NodePath, TransparencyAttrib from pandac.PandaModules import Vec4, TransformState, NodePath, TransparencyAttrib
@ -21,10 +20,6 @@ class HolidayDecorator:
self.swapIval.start() self.swapIval.start()
def undecorate(self): def undecorate(self):
holidayIds = base.cr.newsManager.getDecorationHolidayId()
if len(holidayIds) > 0:
self.decorate()
return
storageFile = base.cr.playGame.hood.storageDNAFile storageFile = base.cr.playGame.hood.storageDNAFile
if storageFile: if storageFile:
loadDNAFile(self.dnaStore, storageFile, CSDefault) loadDNAFile(self.dnaStore, storageFile, CSDefault)
@ -34,10 +29,11 @@ class HolidayDecorator:
def updateHoodDNAStore(self): def updateHoodDNAStore(self):
hood = base.cr.playGame.hood hood = base.cr.playGame.hood
holidayIds = base.cr.newsManager.getDecorationHolidayId()
for holiday in holidayIds: for key, value in self.holidayStorageDNADict.iteritems():
for storageFile in hood.holidayStorageDNADict.get(holiday, []): if base.cr.newsManager.isHolidayRunning(key):
loadDNAFile(self.dnaStore, storageFile, CSDefault) for storageFile in value:
loadDNAFile(self.dnaStore, storageFile, CSDefault)
def getSwapVisibleIval(self, wait = 5.0, tFadeOut = 3.0, tFadeIn = 3.0): def getSwapVisibleIval(self, wait = 5.0, tFadeOut = 3.0, tFadeIn = 3.0):
loader = base.cr.playGame.hood.loader 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)) 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) p.append(s)
return p return p

View file

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

View file

@ -1,724 +1,105 @@
from otp.ai.MagicWordGlobal import * from direct.distributed.DistributedObject import DistributedObject
from panda3d.core import *
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from toontown.toonbase import TTLocalizer, ToontownGlobals, ToontownBattleGlobals
from toontown.battle import SuitBattleGlobals from toontown.battle import SuitBattleGlobals
from toontown.estate import Estate
from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer
from toontown.suit import SuitDNA from toontown.suit import SuitDNA
from copy import deepcopy import HolidayGlobals
import HolidayDecorator, HalloweenHolidayDecorator, calendar
decorationHolidays = [ToontownGlobals.WINTER_DECORATIONS, class NewsManager(DistributedObject):
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')
neverDisable = 1 neverDisable = 1
YearlyHolidayType = 1
OncelyHolidayType = 2
RelativelyHolidayType = 3
OncelyMultipleStartHolidayType = 4
def __init__(self, cr): def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr) DistributedObject.__init__(self, cr)
self.population = 0 self.invading = False
self.invading = 0 self.activeHolidays = []
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
base.localAvatar.inventory.setInvasionCreditMultiplier(1) base.localAvatar.inventory.setInvasionCreditMultiplier(1)
self.weeklyCalendarHolidays = [] base.cr.newsManager = self
return
def delete(self): def delete(self):
self.cr.newsManager = None self.cr.newsManager = None
if self.holidayDecorator: DistributedObject.delete(self)
self.holidayDecorator.exit()
DistributedObject.DistributedObject.delete(self)
return
def setPopulation(self, population): def isHolidayRunning(self, id):
self.population = population return id in self.activeHolidays
messenger.send('newPopulation', [population])
def setActiveHolidays(self, ids):
for id in ids:
self.startHoliday(id, True)
def getPopulation(self): def broadcastHoliday(self, holiday, type):
return self.population if type in holiday:
base.localAvatar.setSystemMessage(0, holiday[type])
def sendSystemMessage(self, message, style):
base.localAvatar.setSystemMessage(style, message) def startHoliday(self, id, ongoing=False):
if id in self.activeHolidays or id not in HolidayGlobals.Holidays:
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)
return return
multiplier = 1 holiday = HolidayGlobals.getHoliday(id)
if self.invading:
multiplier = ToontownBattleGlobals.getInvasionMultiplier() self.activeHolidays.append(id)
base.localAvatar.inventory.setInvasionCreditMultiplier(multiplier) self.broadcastHoliday(holiday, 'ongoingMessage' if ongoing else 'startMessage')
self.startSpecialHoliday(id)
track = Sequence(name='newsManagerWait', autoPause=1) def endHoliday(self, id):
for i, message in enumerate(messages): if id not in self.activeHolidays or id not in HolidayGlobals.Holidays:
if i == 0: return
track.append(Wait(1))
else:
track.append(Wait(5))
track.append(Func(base.localAvatar.setSystemMessage, 0, message))
track.start()
def getInvading(self): holiday = HolidayGlobals.getHoliday(id)
return self.invading
def startHoliday(self, holidayId): self.activeHolidays.remove(id)
if holidayId not in self.holidayIdList: self.broadcastHoliday(holiday, 'endMessage')
self.notify.info('setHolidayId: Starting Holiday %s' % holidayId) self.endSpecialHoliday(id)
self.holidayIdList.append(holidayId)
if holidayId in decorationHolidays:
self.decorationHolidayIds.append(holidayId)
if holidayId == ToontownGlobals.HALLOWEEN_PROPS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addHalloweenMenu()
self.setHalloweenPropsHolidayStart()
elif holidayId == ToontownGlobals.SPOOKY_PROPS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addHalloweenMenu()
self.setSpookyPropsHolidayStart()
elif holidayId == ToontownGlobals.WINTER_DECORATIONS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addWinterMenu()
self.setWinterDecorationsStart()
elif holidayId == ToontownGlobals.WACKY_WINTER_DECORATIONS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addWinterMenu()
self.setWackyWinterDecorationsStart()
if hasattr(base.cr.playGame, 'dnaStore') and hasattr(base.cr.playGame, 'hood') and hasattr(base.cr.playGame.hood, 'loader'):
if holidayId == ToontownGlobals.HALLOWEEN_COSTUMES or holidayId == ToontownGlobals.SPOOKY_COSTUMES:
self.holidayDecorator = HalloweenHolidayDecorator.HalloweenHolidayDecorator()
else:
self.holidayDecorator = HolidayDecorator.HolidayDecorator()
self.holidayDecorator.decorate()
messenger.send('decorator-holiday-%d-starting' % holidayId)
elif holidayId == ToontownGlobals.SILLY_SATURDAY_BINGO:
self.setBingoOngoing()
elif holidayId == ToontownGlobals.MORE_XP_HOLIDAY:
self.setMoreXpHolidayStart()
elif holidayId == ToontownGlobals.JELLYBEAN_DAY:
pass
elif holidayId == ToontownGlobals.CIRCUIT_RACING_EVENT:
self.setGrandPrixWeekendStart()
elif holidayId == ToontownGlobals.APRIL_FOOLS_COSTUMES:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addAprilToonsMenu()
elif holidayId == ToontownGlobals.WINTER_CAROLING:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addCarolMenu()
self.setWinterCarolingStart()
elif holidayId == ToontownGlobals.WACKY_WINTER_CAROLING:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addCarolMenu()
elif holidayId == ToontownGlobals.VALENTINES_DAY:
messenger.send('ValentinesDayStart')
base.localAvatar.setSystemMessage(0, TTLocalizer.ValentinesDayStart)
elif holidayId == ToontownGlobals.SILLY_CHATTER_ONE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseOneMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_TWO:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseTwoMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_THREE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseThreeMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_FOUR:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseFourMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_FIVE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseFiveMenu()
elif holidayId == ToontownGlobals.VICTORY_PARTY_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addVictoryPartiesMenu()
elif holidayId == ToontownGlobals.SELLBOT_NERF_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSellbotNerfHolidayStart()
base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotNerfMenu()
elif holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addJellybeanJamMenu(TTSCJellybeanJamMenu.JellybeanJamPhases.TROLLEY)
elif holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addJellybeanJamMenu(TTSCJellybeanJamMenu.JellybeanJamPhases.FISHING)
elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setJellybeanPartiesHolidayStart()
elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setJellybeanMonthHolidayStart()
elif holidayId == ToontownGlobals.BLACK_CAT_DAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setBlackCatHolidayStart()
elif holidayId == ToontownGlobals.SPOOKY_BLACK_CAT:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSpookyBlackCatHolidayStart()
elif holidayId == ToontownGlobals.LAUGHING_MAN:
if hasattr(base, 'localAvatar') and base.localAvatar:
self.setLaughingManHolidayStart()
elif holidayId == ToontownGlobals.TOP_TOONS_MARATHON:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setTopToonsMarathonStart()
elif holidayId == ToontownGlobals.SELLBOT_INVASION:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotInvasionMenu()
elif holidayId == ToontownGlobals.SELLBOT_FIELD_OFFICE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotFieldOfficeMenu()
elif holidayId == ToontownGlobals.IDES_OF_MARCH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setIdesOfMarchStart()
base.localAvatar.chatMgr.chatInputSpeedChat.addIdesOfMarchMenu()
elif holidayId == ToontownGlobals.EXPANDED_CLOSETS:
self.setExpandedClosetsStart()
elif holidayId == ToontownGlobals.KARTING_TICKETS_HOLIDAY:
self.setKartingTicketsHolidayStart()
return True
return False
def endHoliday(self, holidayId): def startSpecialHoliday(self, id):
if holidayId in self.holidayIdList: if id == ToontownGlobals.LAUGHING_MAN:
self.notify.info('setHolidayId: Ending Holiday %s' % holidayId) for toon in base.cr.toons.values():
self.holidayIdList.remove(holidayId) toon.generateLaughingMan()
if holidayId in self.decorationHolidayIds: elif id == ToontownGlobals.APRIL_TOONS_WEEK:
self.decorationHolidayIds.remove(holidayId) if isinstance(base.cr.playGame.getPlace(), Estate.Estate):
if holidayId == ToontownGlobals.HALLOWEEN_PROPS: base.localAvatar.startAprilToonsControls()
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu()
self.setHalloweenPropsHolidayEnd()
elif holidayId == ToontownGlobals.SPOOKY_PROPS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu()
self.setSpookyPropsHolidayEnd()
elif holidayId == ToontownGlobals.WINTER_DECORATIONS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu()
self.setWinterDecorationsEnd()
elif holidayId == ToontownGlobals.WACKY_WINTER_DECORATIONS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu()
if hasattr(base.cr.playGame, 'dnaStore') and hasattr(base.cr.playGame, 'hood') and hasattr(base.cr.playGame.hood, 'loader'):
if holidayId == ToontownGlobals.HALLOWEEN_COSTUMES or holidayId == ToontownGlobals.SPOOKY_COSTUMES:
self.holidayDecorator = HalloweenHolidayDecorator.HalloweenHolidayDecorator()
else:
self.holidayDecorator = HolidayDecorator.HolidayDecorator()
self.holidayDecorator.undecorate()
messenger.send('decorator-holiday-%d-ending' % holidayId)
elif holidayId == ToontownGlobals.SILLY_SATURDAY_BINGO:
self.setBingoEnd()
elif holidayId == ToontownGlobals.MORE_XP_HOLIDAY:
self.setMoreXpHolidayEnd()
elif holidayId == ToontownGlobals.JELLYBEAN_DAY:
pass
elif holidayId == ToontownGlobals.CIRCUIT_RACING_EVENT:
self.setGrandPrixWeekendEnd()
elif holidayId == ToontownGlobals.APRIL_FOOLS_COSTUMES:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeAprilToonsMenu()
elif holidayId == ToontownGlobals.VALENTINES_DAY:
messenger.send('ValentinesDayStop')
base.localAvatar.setSystemMessage(0, TTLocalizer.ValentinesDayEnd)
elif holidayId == ToontownGlobals.SILLY_CHATTER_ONE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseOneMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_TWO:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseTwoMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_THREE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseThreeMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_FOUR:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseFourMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_FIVE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseFiveMenu()
elif holidayId == ToontownGlobals.VICTORY_PARTY_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeVictoryPartiesMenu()
elif holidayId == ToontownGlobals.WINTER_CAROLING:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeCarolMenu()
elif holidayId == ToontownGlobals.WACKY_WINTER_CAROLING:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeCarolMenu()
elif holidayId == ToontownGlobals.SELLBOT_NERF_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSellbotNerfHolidayEnd()
base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotNerfMenu()
elif holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu()
elif holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu()
elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setJellybeanPartiesHolidayEnd()
base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu()
elif holidayId == ToontownGlobals.BLACK_CAT_DAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setBlackCatHolidayEnd()
elif holidayId == ToontownGlobals.SPOOKY_BLACK_CAT:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSpookyBlackCatHolidayEnd()
elif holidayId == ToontownGlobals.LAUGHING_MAN:
if hasattr(base, 'localAvatar') and base.localAvatar:
self.setLaughingManHolidayEnd()
elif holidayId == ToontownGlobals.TOP_TOONS_MARATHON:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setTopToonsMarathonEnd()
elif holidayId == ToontownGlobals.SELLBOT_INVASION:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotInvasionMenu()
elif holidayId == ToontownGlobals.SELLBOT_FIELD_OFFICE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotFieldOfficeMenu()
elif holidayId == ToontownGlobals.IDES_OF_MARCH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeIdesOfMarchMenu()
return True
return False
def setHolidayIdList(self, holidayIdList): 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): def endSpecialHoliday(self, id):
return id not in holidayIdList 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): base.localAvatar.chatMgr.chatInputSpeedChat.removeAprilToonsMenu()
return id not in self.holidayIdList elif id == ToontownGlobals.IDES_OF_MARCH:
base.localAvatar.chatMgr.chatInputSpeedChat.removeIdesOfMarchMenu()
toEnd = filter(isEnding, self.holidayIdList) elif id == ToontownGlobals.HALLOWEEN:
for endingHolidayId in toEnd: base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu()
self.endHoliday(endingHolidayId) elif id == ToontownGlobals.CHRISTMAS:
base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu()
toStart = filter(isStarting, holidayIdList)
for startingHolidayId in toStart:
self.startHoliday(startingHolidayId)
messenger.send('setHolidayIdList', [holidayIdList])
def getDecorationHolidayId(self):
return self.decorationHolidayIds
def getHolidayIdList(self):
return self.holidayIdList
def setBingoWin(self, zoneId):
base.localAvatar.setSystemMessage(0, 'Bingo congrats!')
def setBingoStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoStart)
def setBingoOngoing(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoOngoing)
def setBingoEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoEnd)
def setCircuitRaceStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceStart)
def setCircuitRaceOngoing(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceOngoing)
def setCircuitRaceEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceEnd)
def setMoreXpHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayStart)
def setMoreXpHolidayOngoing(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayOngoing)
def setMoreXpHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayEnd)
def setJellybeanDayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanDayHolidayStart)
def setJellybeanDayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanDayHolidayEnd)
def setGrandPrixWeekendStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.GrandPrixWeekendHolidayStart)
def setGrandPrixWeekendEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.GrandPrixWeekendHolidayEnd)
def setSellbotNerfHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SellbotNerfHolidayStart)
def setSellbotNerfHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SellbotNerfHolidayEnd)
def setJellybeanTrolleyHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanTrolleyHolidayStart)
def setJellybeanTrolleyHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanTrolleyHolidayEnd)
def setJellybeanFishingHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanFishingHolidayStart)
def setJellybeanFishingHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanFishingHolidayEnd)
def setJellybeanPartiesHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanPartiesHolidayStart)
def setJellybeanMonthHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanMonthHolidayStart)
def setJellybeanPartiesHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanPartiesHolidayEnd)
def setHalloweenPropsHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.HalloweenPropsHolidayStart)
def setHalloweenPropsHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.HalloweenPropsHolidayEnd)
def setSpookyPropsHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyPropsHolidayStart)
def setSpookyPropsHolidayEnd(self):
pass
def setBlackCatHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.BlackCatHolidayStart)
def setBlackCatHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.BlackCatHolidayEnd)
def setSpookyBlackCatHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyBlackCatHolidayStart)
for currToon in base.cr.toons.values():
currToon.setDNA(currToon.style.clone())
def setSpookyBlackCatHolidayEnd(self):
for currToon in base.cr.toons.values():
currToon.setDNA(currToon.style.clone())
def setLaughingManHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.LaughingManHolidayStart)
for currToon in base.cr.toons.values():
currToon.generateLaughingMan()
def setLaughingManHolidayEnd(self): def setInvasionStatus(self, msgType, suitType, remaining, flags):
for currToon in base.cr.toons.values(): if msgType not in ToontownGlobals.SuitInvasions:
currToon.swapToonHead(laughingMan=currToon.getWantLaughingMan()) return
def setTopToonsMarathonStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonStart)
def setTopToonsMarathonEnd(self): if suitType in SuitDNA.suitHeadTypes:
base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonEnd) 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): track = Sequence()
base.localAvatar.setSystemMessage(0, TTLocalizer.WinterDecorationsStart) 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): track.start()
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!'

View file

@ -1,77 +1,110 @@
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.distributed.DistributedObjectAI import DistributedObjectAI 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): class NewsManagerAI(DistributedObjectAI):
notify = directNotify.newCategory('NewsManagerAI')
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.activeHolidays = []
self.fireworkTask = None
def announceGenerate(self): def announceGenerate(self):
DistributedObjectAI.announceGenerate(self) DistributedObjectAI.announceGenerate(self)
self.__checkHolidays()
self.checkTask = taskMgr.doMethodLater(15, self.__checkHolidays, 'holidayCheckTask')
self.accept('avatarEntered', self.__handleAvatarEntered) 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(): if self.air.suitInvasionManager.getInvading():
self.air.suitInvasionManager.notifyInvasionBulletin(avatar.getDoId()) self.air.suitInvasionManager.notifyInvasionBulletin(avId)
def isHolidayRunning(self, holidayId): self.sendUpdateToAvatarId(avId, 'setActiveHolidays', [self.activeHolidays])
return False
def setPopulation(self, todo0): def getActiveHolidays(self):
pass return self.activeHolidays
def setBingoWin(self, todo0): def __checkHolidays(self, task=None):
pass date = datetime.datetime.utcnow().replace(tzinfo=HolidayGlobals.TIME_ZONE)
def setBingoStart(self): for id in HolidayGlobals.Holidays:
pass 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): return Task.again
pass
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): def isHolidayRunning(self, id):
pass return id in self.activeHolidays
def setCircuitRaceEnd(self): def startHoliday(self, id):
pass if id in self.activeHolidays or id not in HolidayGlobals.Holidays:
return
def setInvasionStatus(self, msgType, cogType, numRemaining, skeleton): self.activeHolidays.append(id)
self.sendUpdate('setInvasionStatus', args=[msgType, cogType, numRemaining, skeleton]) 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.activeHolidays.remove(id)
self.sendUpdate('setHolidayIdList', holidays) 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): def endSpecialHoliday(self, id):
pass 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): for hood in self.air.hoods:
pass if hood.zoneId == ToontownGlobals.GolfZone:
continue
def getWeeklyCalendarHolidays(self): fireworkShow = DistributedFireworkShowAI(self.air)
return [] fireworkShow.generateWithRequired(hood.zoneId)
fireworkShow.b_startShow(type, random.randint(0, maxShow), globalClockDelta.getRealNetworkTime())
def setYearlyCalendarHolidays(self, todo0): return again
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

View file

@ -88,8 +88,6 @@ class ToontownAIRepository(ToontownInternalRepository):
self.wantCogdominiums = self.config.GetBool('want-cogdominiums', True) self.wantCogdominiums = self.config.GetBool('want-cogdominiums', True)
self.wantTrackClsends = self.config.GetBool('want-track-clsends', False) self.wantTrackClsends = self.config.GetBool('want-track-clsends', False)
self.baseXpMultiplier = self.config.GetFloat('base-xp-multiplier', 1.0) 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 self.cogSuitMessageSent = False
@ -193,7 +191,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.claimOwnership(self.districtId) self.claimOwnership(self.districtId)
self.districtStats = ToontownDistrictStatsAI(self) self.districtStats = ToontownDistrictStatsAI(self)
self.districtStats.settoontownDistrictId(self.districtId) self.districtStats.setDistrictId(self.districtId)
self.districtStats.generateWithRequiredAndId( self.districtStats.generateWithRequiredAndId(
self.allocateChannel(), self.getGameDoId(), 3) self.allocateChannel(), self.getGameDoId(), 3)
self.notify.info('Created ToontownDistrictStats(%d)' % self.districtStats.doId) self.notify.info('Created ToontownDistrictStats(%d)' % self.districtStats.doId)

View file

@ -1168,9 +1168,7 @@ class BattleCalculatorAI:
toonId = targetList[currTarget] toonId = targetList[currTarget]
toon = self.battle.getToon(toonId) toon = self.battle.getToon(toonId)
result = 0 result = 0
if toon and toon.immortalMode: if (toon and toon.immortalMode) or self.TOONS_TAKE_NO_DAMAGE:
result = 1
elif self.TOONS_TAKE_NO_DAMAGE:
result = 0 result = 0
elif self.__suitAtkHit(attackIndex): elif self.__suitAtkHit(attackIndex):
atkType = attack[SUIT_ATK_COL] atkType = attack[SUIT_ATK_COL]

View file

@ -574,10 +574,10 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
def setChosenToonAttacks(self, ids, tracks, levels, targets): def setChosenToonAttacks(self, ids, tracks, levels, targets):
if self.__battleCleanedUp: if self.__battleCleanedUp:
return return
self.notify.debug('setChosenToonAttacks() - (%s), (%s), (%s), (%s)' % (ids, print 'setChosenToonAttacks() - (%s), (%s), (%s), (%s)' % (ids,
tracks, tracks,
levels, levels,
targets)) targets)
toonIndices = [] toonIndices = []
targetIndices = [] targetIndices = []
unAttack = 0 unAttack = 0
@ -599,7 +599,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
if track == SOS: if track == SOS:
targetIndex = -1 targetIndex = -1
elif track == NPCSOS: elif track == NPCSOS:
targetIndex = -1 targetIndex = targets[i]
elif track == PETSOS: elif track == PETSOS:
targetIndex = -1 targetIndex = -1
elif track == PASS: elif track == PASS:

View file

@ -1361,7 +1361,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
pass pass
elif track != SOS: elif track != SOS:
toon = self.getToon(toonId) toon = self.getToon(toonId)
if toon != None: if toon != None and not toon.unlimitedGags:
check = toon.inventory.useItem(track, level) check = toon.inventory.useItem(track, level)
if check == -1: if check == -1:
self.air.writeServerEvent('suspicious', toonId, 'Toon generating movie for non-existant gag track %s level %s' % (track, level)) 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) toon.inventory.zeroInv(1)
deadToons.append(activeToon) deadToons.append(activeToon)
self.notify.debug('AFTER ROUND: toon: %d setHp: %d' % (toon.doId, toon.hp)) self.notify.debug('AFTER ROUND: toon: %d setHp: %d' % (toon.doId, toon.hp))
if toon.unlimitedGags:
toon.doRestock(noUber=0)
for deadToon in deadToons: for deadToon in deadToons:
self.__removeToon(deadToon) self.__removeToon(deadToon)

View file

@ -73,7 +73,7 @@ class DistributedBossElevator(DistributedElevatorExt.DistributedElevatorExt):
def setBossOfficeZoneForce(self, zoneId): def setBossOfficeZoneForce(self, zoneId):
place = self.cr.playGame.getPlace() place = self.cr.playGame.getPlace()
if place: if place:
place.fsm.request('elevator', [self, 1]) place.fsm.request('elevator', [self])
hoodId = self.cr.playGame.hood.hoodId hoodId = self.cr.playGame.hood.hoodId
doneStatus = {'loader': 'cogHQLoader', doneStatus = {'loader': 'cogHQLoader',
'where': 'cogHQBossBattle', 'where': 'cogHQBossBattle',

View file

@ -90,7 +90,11 @@ class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp)
pos = doorNP.getBounds().getCenter() pos = doorNP.getBounds().getCenter()
self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2)) self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2))
d = duration * 0.125 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') track.delayDelete = DelayDelete.DelayDelete(avatar, 'knockKnockTrack')
return track return track

View file

@ -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 direct.task.Task import Task
from otp.ai.AIBaseGlobal import * from otp.ai.AIBaseGlobal import *
from toontown.toonbase import ToontownGlobals
import DistributedAnimatedPropAI
import time
class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedPropAI): class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedPropAI):
def __init__(self, air, propId): def __init__(self, air, propId):
@ -38,3 +35,12 @@ class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedP
DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitPlaying(self) DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitPlaying(self)
taskMgr.remove(self.doLaterTask) taskMgr.remove(self.doLaterTask)
self.doLaterTask = None 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))

View file

@ -2,10 +2,6 @@ from otp.speedchat.SCTerminal import SCTerminal
from otp.otpbase.OTPLocalizer import SpeedChatStaticText from otp.otpbase.OTPLocalizer import SpeedChatStaticText
SCStaticTextMsgEvent = 'SCStaticTextMsg' SCStaticTextMsgEvent = 'SCStaticTextMsg'
def decodeSCStaticTextMsg(textId):
return SpeedChatStaticText.get(textId, None)
class TTSCWhiteListTerminal(SCTerminal): class TTSCWhiteListTerminal(SCTerminal):
def __init__(self, textId, parentMenu = None): def __init__(self, textId, parentMenu = None):

View file

@ -152,7 +152,7 @@ class DistributedCogKart(DistributedElevatorExt.DistributedElevatorExt):
def setCountryClubInteriorZoneForce(self, zoneId): def setCountryClubInteriorZoneForce(self, zoneId):
place = self.cr.playGame.getPlace() place = self.cr.playGame.getPlace()
if place: if place:
place.fsm.request('elevator', [self, 1]) place.fsm.request('elevator', [self])
hoodId = self.cr.playGame.hood.hoodId hoodId = self.cr.playGame.hood.hoodId
countryClubId = self.countryClubId countryClubId = self.countryClubId
if bboard.has('countryClubIdOverride'): if bboard.has('countryClubIdOverride'):

View file

@ -72,7 +72,7 @@ class DistributedFactoryElevatorExt(DistributedElevatorExt.DistributedElevatorEx
def setFactoryInteriorZoneForce(self, zoneId): def setFactoryInteriorZoneForce(self, zoneId):
place = self.cr.playGame.getPlace() place = self.cr.playGame.getPlace()
if place: if place:
place.fsm.request('elevator', [self, 1]) place.fsm.request('elevator', [self])
hoodId = self.cr.playGame.hood.hoodId hoodId = self.cr.playGame.hood.hoodId
doneStatus = {'loader': 'cogHQLoader', doneStatus = {'loader': 'cogHQLoader',
'where': 'factoryInterior', 'where': 'factoryInterior',

View file

@ -81,7 +81,7 @@ class DistributedLawOfficeElevatorExt(DistributedElevatorExt.DistributedElevator
def setLawOfficeInteriorZoneForce(self, zoneId): def setLawOfficeInteriorZoneForce(self, zoneId):
place = self.cr.playGame.getPlace() place = self.cr.playGame.getPlace()
if place: if place:
place.fsm.request('elevator', [self, 1]) place.fsm.request('elevator', [self])
hoodId = self.cr.playGame.hood.hoodId hoodId = self.cr.playGame.hood.hoodId
doneStatus = {'loader': 'cogHQLoader', doneStatus = {'loader': 'cogHQLoader',
'where': 'stageInterior', 'where': 'stageInterior',

View file

@ -86,7 +86,7 @@ class DistributedMintElevatorExt(DistributedElevatorExt.DistributedElevatorExt):
def setMintInteriorZoneForce(self, zoneId): def setMintInteriorZoneForce(self, zoneId):
place = self.cr.playGame.getPlace() place = self.cr.playGame.getPlace()
if place: if place:
place.fsm.request('elevator', [self, 1]) place.fsm.request('elevator', [self])
hoodId = self.cr.playGame.hood.hoodId hoodId = self.cr.playGame.hood.hoodId
mintId = self.mintId mintId = self.mintId
if bboard.has('mintIdOverride'): if bboard.has('mintIdOverride'):

View file

@ -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 direct.interval.IntervalGlobal import Sequence, LerpPosInterval, Parallel, LerpScaleInterval, Track, ParticleInterval, Wait, Func
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.coghq import MoleFieldBase from toontown.coghq import MoleFieldBase
@ -35,7 +35,7 @@ class MoleHill(NodePath):
self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm') self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm')
self.moleHead.reparentTo(self.mole) self.moleHead.reparentTo(self.mole)
moleColName = 'moleCol-%d-%s' % (self.moleField.doId, self.index) 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 = CollisionNode(moleColName)
collNode.setIntoCollideMask(ToontownGlobals.WallBitmask) collNode.setIntoCollideMask(ToontownGlobals.WallBitmask)
collNode.addSolid(moleSphere) collNode.addSolid(moleSphere)

View file

@ -393,9 +393,6 @@ class PlayGame(StateData.StateData):
base.localAvatar.chatMgr.obscure(1, 1) base.localAvatar.chatMgr.obscure(1, 1)
base.localAvatar.obscureFriendsListButton(1) base.localAvatar.obscureFriendsListButton(1)
requestStatus['how'] = 'tutorial' 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) self.hood.enter(requestStatus)
def exitTutorialHood(self): def exitTutorialHood(self):
@ -557,8 +554,4 @@ class PlayGame(StateData.StateData):
return self.place return self.place
def getPlaceId(self): def getPlaceId(self):
if self.hood: return self.hood.hoodId if self.hood else None
return self.hood.hoodId
else:
return None
return None

View file

@ -67,15 +67,15 @@ class ToontownDistrictStats(DistributedObject.DistributedObject):
def __init__(self, cr): def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr) DistributedObject.DistributedObject.__init__(self, cr)
self.toontownDistrictId = 0 self.districtId = 0
def settoontownDistrictId(self, value): def setDistrictId(self, value):
self.toontownDistrictId = value self.districtId = value
def setAvatarCount(self, avatarCount): def setAvatarCount(self, avatarCount):
if self.toontownDistrictId in self.cr.activeDistrictMap: if self.districtId in self.cr.activeDistrictMap:
self.cr.activeDistrictMap[self.toontownDistrictId].avatarCount = avatarCount self.cr.activeDistrictMap[self.districtId].avatarCount = avatarCount
def setInvasionStatus(self, invasionStatus): def setInvasionStatus(self, invasionStatus):
if self.toontownDistrictId in self.cr.activeDistrictMap: if self.districtId in self.cr.activeDistrictMap:
self.cr.activeDistrictMap[self.toontownDistrictId].invasionStatus = invasionStatus self.cr.activeDistrictMap[self.districtId].invasionStatus = invasionStatus

View file

@ -20,17 +20,17 @@ class ToontownDistrictStatsAI(DistributedObjectAI):
status = {'population': self.avatarCount} status = {'population': self.avatarCount}
self.air.netMessenger.send('shardStatus', [self.air.ourChannel, status]) self.air.netMessenger.send('shardStatus', [self.air.ourChannel, status])
def settoontownDistrictId(self, districtId): def setDistrictId(self, districtId):
self.districtId = districtId self.districtId = districtId
def d_settoontownDistrictId(self, districtId): def d_setDistrictId(self, districtId):
self.sendUpdate('settoontownDistrictId', [districtId]) self.sendUpdate('setDistrictId', [districtId])
def b_settoontownDistrictId(self, districtId): def b_setDistrictId(self, districtId):
self.settoontownDistrictId(districtId) self.setDistrictId(districtId)
self.d_settoontownDistrictId(districtId) self.d_setDistrictId(districtId)
def gettoontownDistrictId(self): def getDistrictId(self):
return self.districtId return self.districtId
def setAvatarCount(self, avatarCount): def setAvatarCount(self, avatarCount):

View file

@ -43,9 +43,9 @@ def fireworks(showName='july4'):
""" """
showName = showName.lower() showName = showName.lower()
if showName == 'july4': if showName == 'july4':
showType = ToontownGlobals.JULY4_FIREWORKS showType = ToontownGlobals.SUMMER_FIREWORKS
elif showName == 'newyears': elif showName == 'newyears':
showType = ToontownGlobals.NEWYEARS_FIREWORKS showType = ToontownGlobals.NEW_YEAR_FIREWORKS
elif showName == 'summer': elif showName == 'summer':
showType = PartyGlobals.FireworkShows.Summer showType = PartyGlobals.FireworkShows.Summer
else: else:

View file

@ -15,9 +15,9 @@ colors = [Vec4(1, 1, 1, 1),
Vec4(1, 0.1, 1, 1), Vec4(1, 0.1, 1, 1),
Vec4(0.1, 1, 1, 1), Vec4(0.1, 1, 1, 1),
Vec4(0.1, 0.5, 1, 1)] Vec4(0.1, 0.5, 1, 1)]
fireworkShowTypes = [ToontownGlobals.JULY4_FIREWORKS, fireworkShowTypes = [ToontownGlobals.SUMMER_FIREWORKS,
PartyGlobals.FireworkShows.Summer, PartyGlobals.FireworkShows.Summer,
ToontownGlobals.NEWYEARS_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS,
ToontownGlobals.COMBO_FIREWORKS] ToontownGlobals.COMBO_FIREWORKS]
class FireworkShow(NodePath): class FireworkShow(NodePath):
@ -43,7 +43,7 @@ class FireworkShow(NodePath):
def rD(): def rD():
return random.randint(1, 20) / 10.0 return random.randint(1, 20) / 10.0
showData = {ToontownGlobals.JULY4_FIREWORKS: [[FireworkType.GlowFlare, showData = {ToontownGlobals.SUMMER_FIREWORKS: [[FireworkType.GlowFlare,
Vec3(-90, 0, 80), Vec3(-90, 0, 80),
Vec3(120, 0, 0), Vec3(120, 0, 0),
rS(), rS(),
@ -739,7 +739,7 @@ class FireworkShow(NodePath):
Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 1),
1.5, 1.5,
10.0]], 10.0]],
ToontownGlobals.NEWYEARS_FIREWORKS: [[FireworkType.GlowFlare, ToontownGlobals.NEW_YEAR_FIREWORKS: [[FireworkType.GlowFlare,
Vec3(0, 0, 180), Vec3(0, 0, 180),
Vec3(-120, 0, 0), Vec3(-120, 0, 0),
rS(), rS(),
@ -1075,10 +1075,10 @@ class FireworkShow(NodePath):
rC(), rC(),
2.0, 2.0,
10.0]]} 10.0]]}
showData[ToontownGlobals.COMBO_FIREWORKS] = showData[ToontownGlobals.NEWYEARS_FIREWORKS] showData[ToontownGlobals.COMBO_FIREWORKS] = showData[ToontownGlobals.NEW_YEAR_FIREWORKS]
sectionData = {ToontownGlobals.JULY4_FIREWORKS: [(0, 24), (24, len(showData[ToontownGlobals.JULY4_FIREWORKS]))], sectionData = {ToontownGlobals.SUMMER_FIREWORKS: [(0, 24), (24, len(showData[ToontownGlobals.SUMMER_FIREWORKS]))],
PartyGlobals.FireworkShows.Summer: [(0, 24), (24, len(showData[PartyGlobals.FireworkShows.Summer]))], 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]))]} ToontownGlobals.COMBO_FIREWORKS: [(0, len(showData[PartyGlobals.FireworkShows.Summer]))]}
showMusic = {} showMusic = {}
@ -1089,7 +1089,7 @@ class FireworkShow(NodePath):
else: else:
return False return False
def __init__(self, showType = ToontownGlobals.NEWYEARS_FIREWORKS): def __init__(self, showType = ToontownGlobals.NEW_YEAR_FIREWORKS):
NodePath.__init__(self, 'FireworkShow') NodePath.__init__(self, 'FireworkShow')
self.showType = showType self.showType = showType
self.sectionIvals = [] self.sectionIvals = []

View file

@ -19,7 +19,7 @@ class FireworkShowMixin:
self.startDelay = startDelay self.startDelay = startDelay
self.timestamp = None self.timestamp = None
self.fireworkShow = None self.fireworkShow = None
self.eventId = JULY4_FIREWORKS self.eventId = SUMMER_FIREWORKS
self.accept('MusicEnabled', self.startMusic) self.accept('MusicEnabled', self.startMusic)
return return
@ -77,13 +77,13 @@ class FireworkShowMixin:
return return
def preShow(self, eventId, songId, startT): def preShow(self, eventId, songId, startT):
if eventId == JULY4_FIREWORKS: if eventId == SUMMER_FIREWORKS:
instructionMessage = TTLocalizer.FireworksInstructions instructionMessage = TTLocalizer.FireworksInstructions
startMessage = TTLocalizer.FireworksJuly4Beginning startMessage = TTLocalizer.FireworksJuly4Beginning
endMessage = TTLocalizer.FireworksJuly4Ending endMessage = TTLocalizer.FireworksJuly4Ending
songs = ['tt_summer', 'firework_music'] songs = ['tt_summer', 'firework_music']
musicFile = 'phase_4/audio/bgm/%s.ogg' % songs[songId] musicFile = 'phase_4/audio/bgm/%s.ogg' % songs[songId]
elif eventId == NEWYEARS_FIREWORKS: elif eventId == NEW_YEAR_FIREWORKS:
instructionMessage = TTLocalizer.FireworksInstructions instructionMessage = TTLocalizer.FireworksInstructions
startMessage = TTLocalizer.FireworksNewYearsEveBeginning startMessage = TTLocalizer.FireworksNewYearsEveBeginning
endMessage = TTLocalizer.FireworksNewYearsEveEnding endMessage = TTLocalizer.FireworksNewYearsEveEnding
@ -146,9 +146,9 @@ class FireworkShowMixin:
base.camLens.setFar(DefaultCameraFar) base.camLens.setFar(DefaultCameraFar)
def postShow(self, eventId): def postShow(self, eventId):
if eventId == JULY4_FIREWORKS: if eventId == SUMMER_FIREWORKS:
endMessage = TTLocalizer.FireworksJuly4Ending endMessage = TTLocalizer.FireworksJuly4Ending
elif eventId == NEWYEARS_FIREWORKS: elif eventId == NEW_YEAR_FIREWORKS:
endMessage = TTLocalizer.FireworksNewYearsEveEnding endMessage = TTLocalizer.FireworksNewYearsEveEnding
elif eventId == PartyGlobals.FireworkShows.Summer: elif eventId == PartyGlobals.FireworkShows.Summer:
endMessage = TTLocalizer.FireworksActivityEnding endMessage = TTLocalizer.FireworksActivityEnding

View file

@ -1,7 +1,7 @@
from FireworkGlobals import * from FireworkGlobals import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.parties import PartyGlobals from toontown.parties import PartyGlobals
shows = {ToontownGlobals.JULY4_FIREWORKS: [((2, shows = {ToontownGlobals.SUMMER_FIREWORKS: [((2,
ROCKET, ROCKET,
RED, RED,
RED, RED,
@ -5065,7 +5065,7 @@ shows = {ToontownGlobals.JULY4_FIREWORKS: [((2,
-23, -23,
3, 3,
100))], 100))],
ToontownGlobals.NEWYEARS_FIREWORKS: [((0.5, ToontownGlobals.NEW_YEAR_FIREWORKS: [((0.5,
ROCKET, ROCKET,
WHITE, WHITE,
WHITE, WHITE,

View file

@ -1,9 +1,7 @@
from panda3d.core import *
from direct.interval.IntervalGlobal 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.DirectFrame import DirectFrame
from direct.gui.DirectLabel import DirectLabel from direct.gui.DirectLabel import DirectLabel
from toontown.toonbase import ToontownGlobals, TTLocalizer
class ScavengerHuntEffect: class ScavengerHuntEffect:
images = None images = None
@ -11,7 +9,9 @@ class ScavengerHuntEffect:
def __init__(self, beanAmount): def __init__(self, beanAmount):
if not ScavengerHuntEffect.images: if not ScavengerHuntEffect.images:
ScavengerHuntEffect.images = loader.loadModel('phase_4/models/props/tot_jar') 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)) self.npRoot = DirectFrame(parent=aspect2d, relief=None, scale=0.75, pos=(0, 0, 0.6))
if beanAmount > 0: if beanAmount > 0:
self.npRoot.setColorScale(VBase4(1, 1, 1, 0)) self.npRoot.setColorScale(VBase4(1, 1, 1, 0))
self.jar = DirectFrame(parent=self.npRoot, relief=None, image=ScavengerHuntEffect.images.find('**/tot_jar')) 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.npRoot.setColorScale(VBase4(1, 1, 1, 0))
self.attemptFailedMsg() 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)) 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): def play(self):
if self.npRoot: if self.npRoot:
self.track.start() self.track.start()
def stop(self): def stop(self):
if self.track != None: if self.track != None and self.track.isPlaying():
if self.track.isPlaying(): self.track.finish()
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)
def destroy(self): def destroy(self):
self.stop() self.stop()
self.track = None self.track = None
if hasattr(self, 'eventImage') and self.eventImage: if hasattr(self, 'eventImage') and self.eventImage:
self.eventImage.detachNode() self.eventImage.detachNode()
del self.eventImage del self.eventImage
@ -67,53 +57,38 @@ class ScavengerHuntEffect:
if hasattr(self, 'npRoot') and self.npRoot: if hasattr(self, 'npRoot') and self.npRoot:
self.npRoot.destroy() self.npRoot.destroy()
del self.npRoot del self.npRoot
return
class TrickOrTreatTargetEffect(ScavengerHuntEffect): class TrickOrTreatTargetEffect(ScavengerHuntEffect):
def __init__(self, beanAmount): def __init__(self, beanAmount):
ScavengerHuntEffect.__init__(self, beanAmount) ScavengerHuntEffect.__init__(self, beanAmount)
if beanAmount > 0: if beanAmount > 0:
self.pumpkin = DirectFrame(parent=self.eventImage, relief=None, image=ScavengerHuntEffect.images.find('**/tot_pumpkin_tall')) self.pumpkin = DirectFrame(parent=self.eventImage, relief=None, image=ScavengerHuntEffect.images.find('**/tot_pumpkin_tall'))
return
def attemptFailedMsg(self): 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()) 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): def destroy(self):
if hasattr(self, 'pumpkin') and self.pumpkin: if hasattr(self, 'pumpkin') and self.pumpkin:
self.pumpkin.destroy() self.pumpkin.destroy()
ScavengerHuntEffect.destroy(self)
ScavengerHuntEffect.destroy(self)
class WinterCarolingEffect(ScavengerHuntEffect): class WinterCarolingEffect(ScavengerHuntEffect):
def __init__(self, beanAmount): def __init__(self, beanAmount):
ScavengerHuntEffect.__init__(self, beanAmount) ScavengerHuntEffect.__init__(self, beanAmount)
if beanAmount > 0: if beanAmount > 0:
sm = loader.loadModel('phase_5.5/models/estate/tt_m_prp_ext_snowman_icon') 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) self.snowman = DirectFrame(parent=self.eventImage, relief=None, image=sm, scale=20.0)
return
def attemptFailedMsg(self): 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()) 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): def destroy(self):
if hasattr(self, 'snowman') and self.snowman: if hasattr(self, 'snowman') and self.snowman:
self.snowman.destroy() self.snowman.destroy()
ScavengerHuntEffect.destroy(self)
ScavengerHuntEffect.destroy(self)
class TrickOrTreatMilestoneEffect:
def __init__(self):
pass
def play(self):
pass
def stop(self):
pass

View file

@ -68,13 +68,10 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.defaultSignModel = loader.loadModel('phase_13/models/parties/eventSign') self.defaultSignModel = loader.loadModel('phase_13/models/parties/eventSign')
self.activityIconsModel = loader.loadModel('phase_4/models/parties/eventSignIcons') self.activityIconsModel = loader.loadModel('phase_4/models/parties/eventSignIcons')
self.lt = base.localAvatar self.lt = base.localAvatar
newsManager = base.cr.newsManager if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN):
if newsManager: self.loadWitch()
holidayIds = base.cr.newsManager.getDecorationHolidayId() else:
if ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds or ToontownGlobals.SPOOKY_COSTUMES in holidayIds: self.loadAirplane()
self.loadWitch()
else:
self.loadAirplane()
self.loadFlowerSellBox() self.loadFlowerSellBox()
self.loadFishSellBox() self.loadFishSellBox()
self.oldClear = base.win.getClearColor() self.oldClear = base.win.getClearColor()

View file

@ -99,21 +99,14 @@ class Estate(Place.Place):
def enter(self, requestStatus): def enter(self, requestStatus):
hoodId = requestStatus['hoodId'] hoodId = requestStatus['hoodId']
zoneId = requestStatus['zoneId'] zoneId = requestStatus['zoneId']
newsManager = base.cr.newsManager
if config.GetBool('want-estate-telemetry-limiter', 1): if config.GetBool('want-estate-telemetry-limiter', 1):
limiter = TLGatherAllAvs('Estate', RotationLimitToH) limiter = TLGatherAllAvs('Estate', RotationLimitToH)
else: else:
limiter = TLNull() limiter = TLNull()
self._telemLimiter = limiter self._telemLimiter = limiter
if newsManager: if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN) and self.loader.hood.spookySkyFile:
holidayIds = base.cr.newsManager.getDecorationHolidayId() lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky))
if (ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds or ToontownGlobals.SPOOKY_COSTUMES in holidayIds) and self.loader.hood.spookySkyFile: lightsOff.start()
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()
else: else:
self.loader.hood.startSky() self.loader.hood.startSky()
lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1)) 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.enterAnimatedProps(i)
self.loader.geom.reparentTo(render) self.loader.geom.reparentTo(render)
# The client April Toons Manager is currently broken, so we have to do this hacky thing instead. :( if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK):
#if hasattr(base.cr, 'aprilToonsMgr'):
#if self.isEventActive(AprilToonsGlobals.EventEstateGravity):
#base.localAvatar.startAprilToonsControls()
if base.config.GetBool('want-april-toons'):
base.localAvatar.startAprilToonsControls() base.localAvatar.startAprilToonsControls()
self.accept('doorDoneEvent', self.handleDoorDoneEvent) self.accept('doorDoneEvent', self.handleDoorDoneEvent)
self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger) self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
@ -136,7 +125,7 @@ class Estate(Place.Place):
def exit(self): def exit(self):
base.localAvatar.stopChat() base.localAvatar.stopChat()
if base.config.GetBool('want-april-toons'): if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK):
base.localAvatar.stopAprilToonsControls() base.localAvatar.stopAprilToonsControls()
self._telemLimiter.destroy() self._telemLimiter.destroy()
del self._telemLimiter del self._telemLimiter
@ -327,7 +316,6 @@ class Estate(Place.Place):
self.__setUnderwaterFog() self.__setUnderwaterFog()
base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8) base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8)
self.cameraSubmerged = 1 self.cameraSubmerged = 1
self.walkStateData.setSwimSoundAudible(1)
def __emergeCamera(self): def __emergeCamera(self):
if self.cameraSubmerged == 0: if self.cameraSubmerged == 0:
@ -336,7 +324,6 @@ class Estate(Place.Place):
self.loader.hood.sky.setFogOff() self.loader.hood.sky.setFogOff()
self.__setFaintFog() self.__setFaintFog()
self.cameraSubmerged = 0 self.cameraSubmerged = 0
self.walkStateData.setSwimSoundAudible(0)
def forceUnderWater(self): def forceUnderWater(self):
self.toonSubmerged = 0 self.toonSubmerged = 0
@ -362,11 +349,7 @@ class Estate(Place.Place):
if hasattr(self, 'walkStateData'): if hasattr(self, 'walkStateData'):
self.walkStateData.fsm.request('walking') self.walkStateData.fsm.request('walking')
self.toonSubmerged = 0 self.toonSubmerged = 0
# The client April Toons Manager is currently broken, so we have to do this hacky thing instead. :( if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK):
#if hasattr(base.cr, 'aprilToonsMgr'):
#if self.isEventActive(AprilToonsGlobals.EventEstateGravity):
#base.localAvatar.startAprilToonsControls()
if base.config.GetBool('want-april-toons'):
base.localAvatar.startAprilToonsControls() base.localAvatar.startAprilToonsControls()
def __setUnderwaterFog(self): def __setUnderwaterFog(self):

View file

@ -68,11 +68,3 @@ class EstateManager(DistributedObject.DistributedObject):
def removeFriend(self, ownerId, avId): def removeFriend(self, ownerId, avId):
self.notify.debug('removeFriend ownerId = %s, avId = %s' % (ownerId, avId)) self.notify.debug('removeFriend ownerId = %s, avId = %s' % (ownerId, avId))
self.sendUpdate('removeFriend', [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()

View file

@ -713,15 +713,12 @@ def getValue(genus, species, weight):
value = OVERALL_VALUE_SCALE * (rarityValue + weightValue) value = OVERALL_VALUE_SCALE * (rarityValue + weightValue)
finalValue = int(ceil(value)) finalValue = int(ceil(value))
base = getBase() base = getBase()
if hasattr(base, 'cr') and base.cr: newsManager = base.cr.newsManager if hasattr(base, 'cr') else simbase.air.newsManager
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
if newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY) or newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH):
finalValue *= JellybeanFishingHolidayScoreMultiplier
return finalValue
__totalNumFish = 0 __totalNumFish = 0
__emptyRodDict = {} __emptyRodDict = {}

View file

@ -720,12 +720,3 @@ class PhysicsWorldBase:
someNodePathGeom = None someNodePathGeom = None
self.bodyList.append((None, body)) self.bodyList.append((None, body))
return (someNodePathGeom, 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))

View file

@ -3,7 +3,6 @@ from toontown.town.BRTownLoader import BRTownLoader
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.hood.ToonHood import ToonHood from toontown.hood.ToonHood import ToonHood
class BRHood(ToonHood): class BRHood(ToonHood):
notify = directNotify.newCategory('BRHood') notify = directNotify.newCategory('BRHood')
@ -16,7 +15,5 @@ class BRHood(ToonHood):
TITLE_COLOR = (0.3, 0.6, 1.0, 1.0) TITLE_COLOR = (0.3, 0.6, 1.0, 1.0)
HOLIDAY_DNA = { HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ['phase_8/dna/winter_storage_BR.pdna'], ToontownGlobals.CHRISTMAS: ['phase_8/dna/winter_storage_BR.pdna'],
ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_8/dna/winter_storage_BR.pdna'], ToontownGlobals.HALLOWEEN: ['phase_8/dna/halloween_props_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']}

View file

@ -2,7 +2,7 @@ from toontown.hood import HoodAI
from toontown.safezone import DistributedTrolleyAI from toontown.safezone import DistributedTrolleyAI
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.ai import DistributedPolarPlaceEffectMgrAI from toontown.ai import DistributedPolarPlaceEffectMgrAI
from toontown.ai import DistributedTrickOrTreatTargetAI from toontown.ai import DistributedEffectMgrAI
class BRHoodAI(HoodAI.HoodAI): class BRHoodAI(HoodAI.HoodAI):
def __init__(self, air): def __init__(self, air):
@ -22,12 +22,14 @@ class BRHoodAI(HoodAI.HoodAI):
self.PolarPlaceEffectManager = DistributedPolarPlaceEffectMgrAI.DistributedPolarPlaceEffectMgrAI(self.air) self.PolarPlaceEffectManager = DistributedPolarPlaceEffectMgrAI.DistributedPolarPlaceEffectMgrAI(self.air)
self.PolarPlaceEffectManager.generateWithRequired(3821) self.PolarPlaceEffectManager.generateWithRequired(3821)
if simbase.air.wantHalloween: self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12)
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) self.trickOrTreatMgr.generateWithRequired(3707) # Snowplace Like Home, Sleet Street
self.TrickOrTreatTargetManager.generateWithRequired(3707)
self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14)
self.winterCarolingMgr.generateWithRequired(3828) # Snowman's Land, Polar Place
def createTrolley(self): def createTrolley(self):
self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air) self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air)
self.trolley.generateWithRequired(self.zoneId) self.trolley.generateWithRequired(self.zoneId)
self.trolley.start() self.trolley.start()

View file

@ -15,16 +15,12 @@ class DDHood(ToonHood):
SPOOKY_SKY_FILE = 'phase_3.5/models/props/BR_sky' SPOOKY_SKY_FILE = 'phase_3.5/models/props/BR_sky'
TITLE_COLOR = (0.8, 0.6, 0.5, 1.0) TITLE_COLOR = (0.8, 0.6, 0.5, 1.0)
underwaterColor = Vec4(0.0, 0.0, 0.6, 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): HOLIDAY_DNA = {
ToonHood.__init__(self, parentFSM, doneEvent, dnaStore, hoodId) ToontownGlobals.CHRISTMAS: ['phase_6/dna/winter_storage_DD.pdna'],
ToontownGlobals.HALLOWEEN: ['phase_6/dna/halloween_props_storage_DD.pdna']}
def load(self): def load(self):
ToonHood.load(self) ToonHood.load(self)
self.fog = Fog('DDFog') self.fog = Fog('DDFog')

View file

@ -2,8 +2,7 @@ from toontown.hood import HoodAI
from toontown.safezone import DistributedBoatAI from toontown.safezone import DistributedBoatAI
from toontown.safezone import DistributedTrolleyAI from toontown.safezone import DistributedTrolleyAI
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.ai import DistributedTrickOrTreatTargetAI from toontown.ai import DistributedEffectMgrAI
class DDHoodAI(HoodAI.HoodAI): class DDHoodAI(HoodAI.HoodAI):
def __init__(self, air): def __init__(self, air):
@ -23,9 +22,11 @@ class DDHoodAI(HoodAI.HoodAI):
self.createTrolley() self.createTrolley()
self.createBoat() self.createBoat()
if simbase.air.wantHalloween: self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12)
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) self.trickOrTreatMgr.generateWithRequired(1834) # Rudderly Ridiculous, Lighthouse Lane
self.TrickOrTreatTargetManager.generateWithRequired(1834)
self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14)
self.winterCarolingMgr.generateWithRequired(1707) # Gifts with a Porpoise, Seaweed Street
def createTrolley(self): def createTrolley(self):
self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air) self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air)
@ -35,4 +36,4 @@ class DDHoodAI(HoodAI.HoodAI):
def createBoat(self): def createBoat(self):
self.boat = DistributedBoatAI.DistributedBoatAI(self.air) self.boat = DistributedBoatAI.DistributedBoatAI(self.air)
self.boat.generateWithRequired(self.zoneId) self.boat.generateWithRequired(self.zoneId)
self.boat.start() self.boat.start()

View file

@ -3,7 +3,6 @@ from toontown.town.DGTownLoader import DGTownLoader
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.hood.ToonHood import ToonHood from toontown.hood.ToonHood import ToonHood
class DGHood(ToonHood): class DGHood(ToonHood):
notify = directNotify.newCategory('DGHood') notify = directNotify.newCategory('DGHood')
@ -16,7 +15,5 @@ class DGHood(ToonHood):
TITLE_COLOR = (0.8, 0.6, 1.0, 1.0) TITLE_COLOR = (0.8, 0.6, 1.0, 1.0)
HOLIDAY_DNA = { HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ['phase_8/dna/winter_storage_DG.pdna'], ToontownGlobals.CHRISTMAS: ['phase_8/dna/winter_storage_DG.pdna'],
ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_8/dna/winter_storage_DG.pdna'], ToontownGlobals.HALLOWEEN: ['phase_8/dna/halloween_props_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']}

View file

@ -4,11 +4,10 @@ from toontown.safezone import DistributedButterflyAI
from toontown.safezone import DistributedDGFlowerAI from toontown.safezone import DistributedDGFlowerAI
from toontown.safezone import DistributedTrolleyAI from toontown.safezone import DistributedTrolleyAI
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
#from toontown.ai import DistributedGreenToonEffectMgrAI from toontown.ai import DistributedEffectMgrAI
from toontown.ai import DistributedTrickOrTreatTargetAI
class DGHoodAI(HoodAI.HoodAI): class DGHoodAI(HoodAI.HoodAI):
def __init__(self, air): def __init__(self, air):
HoodAI.HoodAI.__init__(self, air, HoodAI.HoodAI.__init__(self, air,
ToontownGlobals.DaisyGardens, ToontownGlobals.DaisyGardens,
@ -28,12 +27,14 @@ class DGHoodAI(HoodAI.HoodAI):
if simbase.config.GetBool('want-butterflies', True): if simbase.config.GetBool('want-butterflies', True):
self.createButterflies() self.createButterflies()
#self.GreenToonEffectManager = DistributedGreenToonEffectMgrAI.DistributedGreenToonEffectMgrAI(self.air) self.greenToonMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.IDES_OF_MARCH, 15)
#self.GreenToonEffectManager.generateWithRequired(5819) self.greenToonMgr.generateWithRequired(5819)
if simbase.air.wantHalloween: self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12)
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) self.trickOrTreatMgr.generateWithRequired(5620) # Rake It Inn, Elm Street
self.TrickOrTreatTargetManager.generateWithRequired(5620)
self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14)
self.winterCarolingMgr.generateWithRequired(5626) # Pine Needle Crafts, Elm Street
def shutdown(self): def shutdown(self):
HoodAI.HoodAI.shutdown(self) HoodAI.HoodAI.shutdown(self)
@ -53,8 +54,9 @@ class DGHoodAI(HoodAI.HoodAI):
def createButterflies(self): def createButterflies(self):
playground = ButterflyGlobals.DG playground = ButterflyGlobals.DG
ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.DG) ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.DG)
for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.DG]): for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.DG]):
for _ in xrange(0, ButterflyGlobals.NUM_BUTTERFLIES[ButterflyGlobals.DG]): for _ in xrange(0, ButterflyGlobals.NUM_BUTTERFLIES[ButterflyGlobals.DG]):
butterfly = DistributedButterflyAI.DistributedButterflyAI(self.air, playground, i, self.zoneId) butterfly = DistributedButterflyAI.DistributedButterflyAI(self.air, playground, i, self.zoneId)
butterfly.generateWithRequired(self.zoneId) butterfly.generateWithRequired(self.zoneId)
butterfly.start() butterfly.start()

View file

@ -3,7 +3,6 @@ from toontown.town.DLTownLoader import DLTownLoader
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.hood.ToonHood import ToonHood from toontown.hood.ToonHood import ToonHood
class DLHood(ToonHood): class DLHood(ToonHood):
notify = directNotify.newCategory('DLHood') notify = directNotify.newCategory('DLHood')
@ -15,7 +14,5 @@ class DLHood(ToonHood):
TITLE_COLOR = (1.0, 0.9, 0.5, 1.0) TITLE_COLOR = (1.0, 0.9, 0.5, 1.0)
HOLIDAY_DNA = { HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ['phase_8/dna/winter_storage_DL.pdna'], ToontownGlobals.CHRISTMAS: ['phase_8/dna/winter_storage_DL.pdna'],
ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_8/dna/winter_storage_DL.pdna'], ToontownGlobals.HALLOWEEN: ['phase_8/dna/halloween_props_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']}

View file

@ -2,8 +2,7 @@ from toontown.hood import HoodAI
from toontown.safezone import DistributedTrolleyAI, DistributedPillowAI from toontown.safezone import DistributedTrolleyAI, DistributedPillowAI
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.ai import DistributedResistanceEmoteMgrAI from toontown.ai import DistributedResistanceEmoteMgrAI
from toontown.ai import DistributedTrickOrTreatTargetAI from toontown.ai import DistributedEffectMgrAI
class DLHoodAI(HoodAI.HoodAI): class DLHoodAI(HoodAI.HoodAI):
def __init__(self, air): def __init__(self, air):
@ -20,12 +19,15 @@ class DLHoodAI(HoodAI.HoodAI):
if simbase.config.GetBool('want-minigames', True): if simbase.config.GetBool('want-minigames', True):
self.createTrolley() self.createTrolley()
self.resistanceEmoteManager = DistributedResistanceEmoteMgrAI.DistributedResistanceEmoteMgrAI(self.air) self.resistanceEmoteManager = DistributedResistanceEmoteMgrAI.DistributedResistanceEmoteMgrAI(self.air)
self.resistanceEmoteManager.generateWithRequired(9720) self.resistanceEmoteManager.generateWithRequired(9720)
if simbase.air.wantHalloween: self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12)
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) self.trickOrTreatMgr.generateWithRequired(9619) # Relax to the Max, Lullaby Lane
self.TrickOrTreatTargetManager.generateWithRequired(9619)
self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14)
self.winterCarolingMgr.generateWithRequired(9722) # Dream On Talent Agency, Pajama Place
self.createPillow() self.createPillow()
@ -36,4 +38,4 @@ class DLHoodAI(HoodAI.HoodAI):
def createPillow(self): def createPillow(self):
self.pillow = DistributedPillowAI.DistributedPillowAI(self.air) self.pillow = DistributedPillowAI.DistributedPillowAI(self.air)
self.pillow.generateWithRequired(self.zoneId) self.pillow.generateWithRequired(self.zoneId)

View file

@ -30,10 +30,8 @@ class EstateHood(Hood):
self.storageDNAFile = 'phase_5.5/dna/storage_estate.pdna' self.storageDNAFile = 'phase_5.5/dna/storage_estate.pdna'
self.holidayStorageDNADict = { self.holidayStorageDNADict = {
WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'], CHRISTMAS: ['phase_5.5/dna/winter_storage_estate.pdna'],
WACKY_WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'], HALLOWEEN: ['phase_5.5/dna/halloween_props_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']}
self.skyFile = 'phase_3.5/models/props/TT_sky' self.skyFile = 'phase_3.5/models/props/TT_sky'
self.spookySkyFile = 'phase_3.5/models/props/BR_sky' self.spookySkyFile = 'phase_3.5/models/props/BR_sky'

View file

@ -22,4 +22,4 @@ class GSHood(ToonHood):
base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar) base.camLens.setNearFar(ToontownGlobals.DefaultCameraNear, ToontownGlobals.DefaultCameraFar)
base.localAvatar.chatMgr.chatInputSpeedChat.removeKartRacingMenu() base.localAvatar.chatMgr.chatInputSpeedChat.removeKartRacingMenu()
ToonHood.exit(self) ToonHood.exit(self)

View file

@ -8,12 +8,12 @@ from toontown.hood import HoodUtil
class GenericAnimatedProp(AnimatedProp.AnimatedProp): class GenericAnimatedProp(AnimatedProp.AnimatedProp):
notify = DirectNotifyGlobal.directNotify.newCategory('GenericAnimatedProp') notify = DirectNotifyGlobal.directNotify.newCategory('GenericAnimatedProp')
AnimsUsingWav = []
def __init__(self, node): def __init__(self, node):
AnimatedProp.AnimatedProp.__init__(self, node) AnimatedProp.AnimatedProp.__init__(self, node)
self.origAnimNameToSound = {} self.origAnimNameToSound = {}
code = node.getTag('DNACode') code = node.getTag('DNACode')
if code.startswith('interactive_prop_'): if code.startswith('interactive_prop_'):
pathStr = code[len('interactive_prop_'):].split('__')[0] pathStr = code[len('interactive_prop_'):].split('__')[0]
elif code.startswith('animated_prop_generic_'): elif code.startswith('animated_prop_generic_'):
@ -23,10 +23,12 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp):
nextUnderscore = tempStr.find('_') nextUnderscore = tempStr.find('_')
finalStr = tempStr[nextUnderscore + 1:] finalStr = tempStr[nextUnderscore + 1:]
pathStr = finalStr.split('__')[0] pathStr = finalStr.split('__')[0]
phaseDelimeter = len('phase_') + pathStr[len('phase_'):].find('_') phaseDelimeter = len('phase_') + pathStr[len('phase_'):].find('_')
phaseStr = pathStr[:phaseDelimeter] phaseStr = pathStr[:phaseDelimeter]
pathTokens = pathStr[phaseDelimeter + 1:].split('_') pathTokens = pathStr[phaseDelimeter + 1:].split('_')
self.path = phaseStr self.path = phaseStr
for path in pathTokens: for path in pathTokens:
self.path += '/' self.path += '/'
self.path += path self.path += path
@ -39,6 +41,11 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp):
def delete(self): def delete(self):
AnimatedProp.AnimatedProp.delete(self) AnimatedProp.AnimatedProp.delete(self)
if hasattr(self, 'soundNode'):
self.soundNode.removeNode()
del self.soundNode
self.node.cleanup() self.node.cleanup()
del self.node del self.node
del self.trashcan del self.trashcan
@ -67,6 +74,7 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp):
self.hoodId = ToontownGlobals.ToontownCentral self.hoodId = ToontownGlobals.ToontownCentral
fullString = str(node) fullString = str(node)
splits = fullString.split('/') splits = fullString.split('/')
if len(splits) >= 5: if len(splits) >= 5:
visId = int(splits[4]) visId = int(splits[4])
self.visId = visId self.visId = visId
@ -80,28 +88,22 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp):
def createSoundInterval(self, origAnimNameWithPath, maximumDuration): def createSoundInterval(self, origAnimNameWithPath, maximumDuration):
if not hasattr(base, 'localAvatar'): if not hasattr(base, 'localAvatar'):
return Sequence() return Sequence()
sfxVolume = 1.0
cutoff = 45
if not hasattr(self, 'soundPath'): if not hasattr(self, 'soundPath'):
self.soundPath = self.path.replace('/models/char', '/audio/sfx') self.soundPath = self.path.replace('/models/char', '/audio/sfx')
origAnimName = origAnimNameWithPath.split('/')[-1] origAnimName = origAnimNameWithPath.split('/')[-1]
theSound = self.origAnimNameToSound.get(origAnimName) sound = self.origAnimNameToSound.get(origAnimName)
if not theSound:
soundfile = origAnimName.replace('tt_a_ara', 'tt_s_ara') if not sound:
fullPath = self.soundPath + '/' + soundfile sound = loader.loadSfx('%s/%s.ogg' % (self.soundPath, origAnimName.replace('tt_a_ara', 'tt_s_ara')))
if origAnimName in self.AnimsUsingWav: self.origAnimNameToSound[origAnimName] = sound
theSound = loader.loadSfx(fullPath + '.ogg')
else: if sound:
theSound = loader.loadSfx(fullPath + '.ogg') if not hasattr(self, 'soundNode'):
self.origAnimNameToSound[origAnimName] = theSound self.soundNode = render.attachNewNode('Sound Node')
if theSound: self.soundNode.setPos(self.trashcan.getBounds().getCenter())
soundDur = theSound.length()
if maximumDuration < soundDur: return SoundInterval(sound, node=self.soundNode, listenerNode=base.localAvatar, volume=1.0, cutOff=45, startTime=0, duration=min(sound.length(), maximumDuration))
if base.config.GetBool('interactive-prop-info', False):
if self.visId == localAvatar.zoneId and origAnimName != 'tt_a_ara_dga_hydrant_idleIntoFight': return Sequence()
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

View file

@ -76,28 +76,24 @@ class Hood(StateData.StateData):
def load(self): def load(self):
files = [] files = []
if self.storageDNAFile: if self.storageDNAFile:
files.append(self.storageDNAFile) files.append(self.storageDNAFile)
newsManager = base.cr.newsManager
if newsManager: for key, value in self.holidayStorageDNADict.iteritems():
holidayIds = base.cr.newsManager.getDecorationHolidayId() if base.cr.newsManager.isHolidayRunning(key):
for holiday in holidayIds: for storageFile in value:
for storageFile in self.holidayStorageDNADict.get(holiday, []):
files.append(storageFile) files.append(storageFile)
if ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds and ToontownGlobals.SPOOKY_COSTUMES not in holidayIds or not self.spookySkyFile: 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')
if not newsManager:
self.sky = loader.loadModel(self.skyFile) self.sky = loader.loadModel(self.skyFile)
self.sky.setTag('sky', 'Regular') self.sky.setTag('sky', 'Regular')
self.sky.setScale(1.0) self.sky.setScale(1.0)
self.sky.setFogOff() self.sky.setFogOff()
else:
self.sky = loader.loadModel(self.spookySkyFile)
self.sky.setTag('sky', 'Halloween')
dnaBulk = DNABulkLoader(self.dnaStore, tuple(files)) dnaBulk = DNABulkLoader(self.dnaStore, tuple(files))
dnaBulk.loadDNAFiles() dnaBulk.loadDNAFiles()

View file

@ -111,8 +111,8 @@ class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
if self.hasOverrideIval(origAnimName): if self.hasOverrideIval(origAnimName):
result.append(Func(self.showWater)) result.append(Func(self.showWater))
anim = self.createAnimIval('fight0' if 'fightBoost' in origAnimName else 'fight1') animAndSound = self.createAnimAndSoundIval('fight0' if 'fightBoost' in origAnimName else 'fight1')
result.append(anim) result.append(animAndSound)
result.append(Func(self.hideWater)) result.append(Func(self.hideWater))
return result return result

View file

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

View file

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

View file

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

View file

@ -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 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.toonbase import ToontownGlobals
from toontown.hood import ZoneUtil import GenericAnimatedProp
import math, random
def clearPythonIvals(ival): def clearPythonIvals(ival):
if hasattr(ival, 'function'): if hasattr(ival, 'function'):
@ -17,8 +15,6 @@ def clearPythonIvals(ival):
clearPythonIvals(oneIval) clearPythonIvals(oneIval)
ival.pythonIvals = [] ival.pythonIvals = []
return
class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
ZoneToIdles = {} ZoneToIdles = {}
@ -44,6 +40,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
self.okToStartNextAnim = False self.okToStartNextAnim = False
cellIndexStr = node.getTag('DNACellIndex') cellIndexStr = node.getTag('DNACellIndex')
self.cellIndex = ord(cellIndexStr) self.cellIndex = ord(cellIndexStr)
self.origAnimNameToSound = {}
self.lastPlayingAnimPhase = 0 self.lastPlayingAnimPhase = 0
self.buildingsMakingMeSad = set() self.buildingsMakingMeSad = set()
GenericAnimatedProp.GenericAnimatedProp.__init__(self, node) GenericAnimatedProp.GenericAnimatedProp.__init__(self, node)
@ -67,20 +64,25 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
self.numIdles = len(self.ZoneToIdles[self.hoodId]) self.numIdles = len(self.ZoneToIdles[self.hoodId])
if self.hoodId in self.ZoneToFightAnims: if self.hoodId in self.ZoneToFightAnims:
self.numFightAnims = len(self.ZoneToFightAnims[self.hoodId]) self.numFightAnims = len(self.ZoneToFightAnims[self.hoodId])
self.idleInterval = None self.idleInterval = None
anim = node.getTag('DNAAnim') anim = node.getTag('DNAAnim')
self.trashcan = Actor.Actor(node, copy=0) self.trashcan = Actor.Actor(node, copy=0)
self.trashcan.reparentTo(node) self.trashcan.reparentTo(node)
animDict = {} animDict = {}
animDict['anim'] = '%s/%s' % (self.path, anim) animDict['anim'] = '%s/%s' % (self.path, anim)
for i in xrange(self.numIdles): for i in xrange(self.numIdles):
baseAnim = self.ZoneToIdles[self.hoodId][i] baseAnim = self.ZoneToIdles[self.hoodId][i]
if isinstance(baseAnim, tuple): if isinstance(baseAnim, tuple):
baseAnim = baseAnim[0] baseAnim = baseAnim[0]
animStr = self.path + '/' + baseAnim animStr = self.path + '/' + baseAnim
animKey = 'idle%d' % i animKey = 'idle%d' % i
animDict[animKey] = animStr animDict[animKey] = animStr
settleName = self.getSettleName(i) settleName = self.getSettleName(i)
if settleName: if settleName:
settleStr = self.path + '/' + settleName settleStr = self.path + '/' + settleName
settleKey = 'settle%d' % i settleKey = 'settle%d' % i
@ -95,14 +97,17 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
animStr = self.path + '/' + self.ZoneToIdleIntoFightAnims[self.hoodId] animStr = self.path + '/' + self.ZoneToIdleIntoFightAnims[self.hoodId]
animKey = 'idleIntoFight' animKey = 'idleIntoFight'
animDict[animKey] = animStr animDict[animKey] = animStr
if self.hoodId in self.ZoneToIdleIntoFightAnims: if self.hoodId in self.ZoneToIdleIntoFightAnims:
animStr = self.path + '/' + self.ZoneToVictoryAnims[self.hoodId] animStr = self.path + '/' + self.ZoneToVictoryAnims[self.hoodId]
animKey = 'victory' animKey = 'victory'
animDict[animKey] = animStr animDict[animKey] = animStr
if self.hoodId in self.ZoneToSadAnims: if self.hoodId in self.ZoneToSadAnims:
animStr = self.path + '/' + self.ZoneToSadAnims[self.hoodId] animStr = self.path + '/' + self.ZoneToSadAnims[self.hoodId]
animKey = 'sad' animKey = 'sad'
animDict[animKey] = animStr animDict[animKey] = animStr
self.trashcan.loadAnims(animDict) self.trashcan.loadAnims(animDict)
self.trashcan.pose('anim', 0) self.trashcan.pose('anim', 0)
self.node = self.trashcan self.node = self.trashcan
@ -113,6 +118,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def createIdleInterval(self): def createIdleInterval(self):
result = Sequence() result = Sequence()
if self.numIdles >= 3: if self.numIdles >= 3:
numberOfAnimsAbove2 = self.numIdles - 2 numberOfAnimsAbove2 = self.numIdles - 2
for rareIdle in xrange(2, self.numIdles): for rareIdle in xrange(2, self.numIdles):
@ -152,26 +158,28 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def createBattleCheerInterval(self): def createBattleCheerInterval(self):
result = Sequence() result = Sequence()
for i in xrange(self.numFightAnims): for i in xrange(self.numFightAnims):
animKey = 'fight%d' % i animKey = 'fight%d' % i
animIval = self.createAnimIval(animKey) animAndSoundIval = self.createAnimAndSoundIval(animKey)
origAnimName = self.node.getAnimFilename(animKey).split('/')[-1] origAnimName = self.node.getAnimFilename(animKey).split('/')[-1]
if self.hasOverrideIval(origAnimName): if self.hasOverrideIval(origAnimName):
result.append(self.getOverrideIval(origAnimName)) result.append(self.getOverrideIval(origAnimName))
elif self.hasSpecialIval(origAnimName): elif self.hasSpecialIval(origAnimName):
result.append(Parallel(animIval, self.getSpecialIval(origAnimName))) result.append(Parallel(animAndSoundIval, self.getSpecialIval(origAnimName)))
else: else:
result.append(animIval) result.append(animAndSoundIval)
self.createBattleCheerText() 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)) 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) ivalWithText = Parallel(battleCheerTextIval, result)
return ivalWithText return ivalWithText
def createSadInterval(self): def createSadInterval(self):
result = Sequence() result = Sequence()
if self.hoodId in self.ZoneToSadAnims: if self.hoodId in self.ZoneToSadAnims:
result = self.createAnimIval('sad') result = self.createAnimAndSoundIval('sad')
return result return result
def hasSpecialIval(self, origAnimName): def hasSpecialIval(self, origAnimName):
@ -188,18 +196,21 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def createVictoryInterval(self): def createVictoryInterval(self):
result = Sequence() result = Sequence()
if self.hoodId in self.ZoneToVictoryAnims: if self.hoodId in self.ZoneToVictoryAnims:
animIval = self.createAnimIval('victory') animAndSoundIval = self.createAnimAndSoundIval('victory')
result.append(animIval) result.append(animAndSoundIval)
return result return result
def enter(self): def enter(self):
GenericAnimatedProp.GenericAnimatedProp.enter(self) GenericAnimatedProp.GenericAnimatedProp.enter(self)
if base.config.GetBool('props-buff-battles', True): if base.config.GetBool('props-buff-battles', True):
self.notify.debug('props buff battles is true') self.notify.debug('props buff battles is true')
self.node.stop() self.node.stop()
self.node.pose('idle0', 0) self.node.pose('idle0', 0)
self.idleInterval.loop() self.requestIdleOrSad()
else: else:
self.notify.debug('props do not buff battles') self.notify.debug('props do not buff battles')
self.node.stop() self.node.stop()
@ -215,6 +226,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
if not hasattr(self, 'node') or not self.node: if not hasattr(self, 'node') or not self.node:
self.notify.warning("requestIdleOrSad returning hasattr(self,'node')=%s" % hasattr(self, 'node')) self.notify.warning("requestIdleOrSad returning hasattr(self,'node')=%s" % hasattr(self, 'node'))
return return
if self.buildingsMakingMeSad: if self.buildingsMakingMeSad:
self.request('Sad') self.request('Sad')
else: else:
@ -248,6 +260,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def chooseIdleAnimToRun(self): def chooseIdleAnimToRun(self):
result = self.numIdles - 1 result = self.numIdles - 1
if base.config.GetBool('randomize-interactive-idles', True): if base.config.GetBool('randomize-interactive-idles', True):
pairs = [] pairs = []
for i in xrange(self.numIdles): for i in xrange(self.numIdles):
@ -261,47 +274,54 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
result = self.lastPlayingAnimPhase + 1 result = self.lastPlayingAnimPhase + 1
if result >= len(self.ZoneToIdles[self.hoodId]): if result >= len(self.ZoneToIdles[self.hoodId]):
result = 0 result = 0
return result return result
def startNextIdleAnim(self): def startNextIdleAnim(self):
self.notify.debug('startNextAnim self.okToStartNextAnim=%s' % self.okToStartNextAnim)
if not hasattr(self, 'node') or not self.node: if not hasattr(self, 'node') or not self.node:
self.notify.warning("startNextIdleAnim returning hasattr(self,'node')=%s" % hasattr(self, 'node')) self.notify.warning("startNextIdleAnim returning hasattr(self,'node')=%s" % hasattr(self, 'node'))
return return
self.curIval = None self.curIval = None
if self.okToStartNextAnim: if self.okToStartNextAnim:
self.notify.debug('got pass okToStartNextAnim') self.notify.debug('got pass okToStartNextAnim')
whichAnim = self.chooseIdleAnimToRun() whichAnim = self.chooseIdleAnimToRun()
if self.visId == localAvatar.zoneId:
self.notify.debug('whichAnim=%s' % whichAnim)
self.lastPlayingAnimPhase = whichAnim self.lastPlayingAnimPhase = whichAnim
self.curIval = self.createIdleAnimSequence(whichAnim) self.curIval = self.createIdleAnimSequence(whichAnim)
self.notify.debug('starting curIval of length %s' % self.curIval.getDuration()) self.notify.debug('starting curIval of length %s' % self.curIval.getDuration())
self.curIval.start() self.curIval.start()
else: else:
self.curIval = Wait(10) self.curIval = Wait(3)
self.notify.debug('false self.okToStartNextAnim=%s' % self.okToStartNextAnim) 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) animIval = self.node.actorInterval('idle%d' % whichIdleAnim, startTime=startingTime)
animIvalDuration = animIval.getDuration() animIvalDuration = animIval.getDuration()
origAnimName = self.ZoneToIdles[self.hoodId][whichIdleAnim] origAnimName = self.ZoneToIdles[self.hoodId][whichIdleAnim]
if isinstance(origAnimName, tuple): if isinstance(origAnimName, tuple):
origAnimName = origAnimName[0] origAnimName = origAnimName[0]
soundIval = self.createSoundInterval(origAnimName, animIvalDuration)
soundIvalDuration = soundIval.getDuration()
if self.hasSpecialIval(origAnimName): if self.hasSpecialIval(origAnimName):
specialIval = self.getSpecialIval(origAnimName) specialIval = self.getSpecialIval(origAnimName)
return Parallel(animIval, specialIval) return Parallel(animIval, soundIval, specialIval)
else: else:
return animIval return Parallel(animIval, soundIval)
def createIdleAnimSequence(self, whichIdleAnim): def createIdleAnimSequence(self, whichIdleAnim):
dummyResult = Sequence(Wait(self.IdlePauseTime)) dummyResult = Sequence(Wait(self.IdlePauseTime))
if not hasattr(self, 'node') or not self.node: if not hasattr(self, 'node') or not self.node:
self.notify.warning("createIdleAnimSequence returning dummyResult hasattr(self,'node')=%s" % hasattr(self, 'node')) self.notify.warning("createIdleAnimSequence returning dummyResult hasattr(self,'node')=%s" % hasattr(self, 'node'))
return dummyResult 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: if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple) and len(self.ZoneToIdles[self.hoodId][whichIdleAnim]) > 2:
info = self.ZoneToIdles[self.hoodId][whichIdleAnim] info = self.ZoneToIdles[self.hoodId][whichIdleAnim]
origAnimName = info[0] origAnimName = info[0]
@ -314,17 +334,14 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
pauseTime = random.randrange(minPauseTime, maxPauseTime + 1) pauseTime = random.randrange(minPauseTime, maxPauseTime + 1)
result = Sequence() result = Sequence()
for i in xrange(numberOfLoops): for i in xrange(numberOfLoops):
result.append(idleAnim) result.append(idleAnimAndSound)
if self.getSettleName(whichIdleAnim): if self.getSettleName(whichIdleAnim):
result.append(self.node.actorInterval('settle%d' % whichIdleAnim)) result.append(self.node.actorInterval('settle%d' % whichIdleAnim))
result.append(Wait(pauseTime)) result.append(Wait(pauseTime))
result.append(Func(self.startNextIdleAnim)) result.append(Func(self.startNextIdleAnim))
return result
def gotoFaceoff(self): return result
self.notify.debugStateCall(self)
self.request('Faceoff')
def gotoBattleCheer(self): def gotoBattleCheer(self):
self.notify.debugStateCall(self) self.notify.debugStateCall(self)
@ -345,22 +362,14 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def buildingLiberated(self, buildingDoId): def buildingLiberated(self, buildingDoId):
self.buildingsMakingMeSad.discard(buildingDoId) self.buildingsMakingMeSad.discard(buildingDoId)
if not self.buildingsMakingMeSad: if not self.buildingsMakingMeSad:
self.gotoIdle() 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): def calcWhichIdleAnim(self, animName):
result = 0 result = 0
info = self.ZoneToIdles[self.hoodId] info = self.ZoneToIdles[self.hoodId]
for index, curInfo in enumerate(info): for index, curInfo in enumerate(info):
if isinstance(curInfo, tuple): if isinstance(curInfo, tuple):
if curInfo[0] == animName: if curInfo[0] == animName:
@ -373,82 +382,74 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
return result 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): def enterBattleCheer(self):
self.notify.debugStateCall(self) self.notify.debugStateCall(self)
self.curIval = self.battleCheerInterval self.curIval = self.battleCheerInterval
if self.curIval: if self.curIval:
self.curIval.loop() self.curIval.loop()
def exitBattleCheer(self): def exitBattleCheer(self):
self.notify.debugStateCall(self) self.notify.debugStateCall(self)
if self.curIval: if self.curIval:
self.curIval.finish() self.curIval.finish()
self.curIval = None self.curIval = None
return
def enterVictory(self): def enterVictory(self):
self.notify.debugStateCall(self) self.notify.debugStateCall(self)
self.curIval = self.victoryInterval self.curIval = self.victoryInterval
if self.curIval: if self.curIval:
self.curIval.loop() self.curIval.loop()
def exitVictory(self): def exitVictory(self):
self.notify.debugStateCall(self) self.notify.debugStateCall(self)
if self.curIval: if self.curIval:
self.curIval.finish() self.curIval.finish()
self.curIval = None self.curIval = None
return
def enterSad(self): def enterSad(self):
self.notify.debugStateCall(self) self.notify.debugStateCall(self)
self.curIval = self.sadInterval self.curIval = self.sadInterval
if self.curIval: if self.curIval:
self.curIval.loop() self.curIval.loop()
def exitSad(self): def exitSad(self):
self.notify.debugStateCall(self) self.notify.debugStateCall(self)
if self.curIval: if self.curIval:
self.curIval.finish() self.curIval.finish()
self.curIval = None self.curIval = None
return
def getSettleName(self, whichIdleAnim): def getSettleName(self, whichIdleAnim):
result = None
if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple) and len(self.ZoneToIdles[self.hoodId][whichIdleAnim]) > 3: if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple) and len(self.ZoneToIdles[self.hoodId][whichIdleAnim]) > 3:
result = self.ZoneToIdles[self.hoodId][whichIdleAnim][3] return self.ZoneToIdles[self.hoodId][whichIdleAnim][3]
return result return None
def getOrigIdleAnimName(self, whichIdleAnim): def getOrigIdleAnimName(self, whichIdleAnim):
result = None anim = self.ZoneToIdles[self.hoodId][whichIdleAnim]
if isinstance(self.ZoneToIdles[self.hoodId][whichIdleAnim], tuple):
result = self.ZoneToIdles[self.hoodId][whichIdleAnim][0]
else:
result = self.ZoneToIdles[self.hoodId][whichIdleAnim]
return result
def createAnimIval(self, animKey): return anim[0] if isinstance(anim, tuple) else anim
def createAnimAndSoundIval(self, animKey):
animIval = self.node.actorInterval(animKey) animIval = self.node.actorInterval(animKey)
animIvalDuration = animIval.getDuration() animIvalDuration = animIval.getDuration()
origAnimName = self.node.getAnimFilename(animKey) origAnimName = self.node.getAnimFilename(animKey)
soundIval = self.createSoundInterval(origAnimName, animIvalDuration)
soundIvalDuration = soundIval.getDuration()
if self.hasSpecialIval(origAnimName): if self.hasSpecialIval(origAnimName):
specialIval = self.getSpecialIval(origAnimName) specialIval = self.getSpecialIval(origAnimName)
return Parallel(animIval, specialIval) return Parallel(animIval, soundIval, specialIval)
else: else:
return animIval return Parallel(animIval, soundIval)
def clearCurIval(self): def clearCurIval(self):
if self.curIval: if self.curIval:
self.curIval.finish() self.curIval.finish()
clearPythonIvals(self.curIval) clearPythonIvals(self.curIval)
self.curIval = None self.curIval = None

View file

@ -16,7 +16,5 @@ class MMHood(ToonHood):
TITLE_COLOR = (1.0, 0.5, 0.5, 1.0) TITLE_COLOR = (1.0, 0.5, 0.5, 1.0)
HOLIDAY_DNA = { HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ['phase_6/dna/winter_storage_MM.pdna'], ToontownGlobals.CHRISTMAS: ['phase_6/dna/winter_storage_MM.pdna'],
ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_6/dna/winter_storage_MM.pdna'], ToontownGlobals.HALLOWEEN: ['phase_6/dna/halloween_props_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']}

View file

@ -2,7 +2,7 @@ from toontown.hood import HoodAI
from toontown.safezone import DistributedTrolleyAI from toontown.safezone import DistributedTrolleyAI
from toontown.safezone import DistributedMMPianoAI from toontown.safezone import DistributedMMPianoAI
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.ai import DistributedTrickOrTreatTargetAI from toontown.ai import DistributedEffectMgrAI
class MMHoodAI(HoodAI.HoodAI): class MMHoodAI(HoodAI.HoodAI):
def __init__(self, air): def __init__(self, air):
@ -24,11 +24,13 @@ class MMHoodAI(HoodAI.HoodAI):
self.piano = DistributedMMPianoAI.DistributedMMPianoAI(self.air) self.piano = DistributedMMPianoAI.DistributedMMPianoAI(self.air)
self.piano.generateWithRequired(self.zoneId) self.piano.generateWithRequired(self.zoneId)
if simbase.air.wantHalloween: self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12)
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) self.trickOrTreatMgr.generateWithRequired(4835) # Ursatz for Really Kool Katz, Tenor Terrace
self.TrickOrTreatTargetManager.generateWithRequired(4835)
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): def createTrolley(self):
self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air) self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air)
self.trolley.generateWithRequired(self.zoneId) self.trolley.generateWithRequired(self.zoneId)
self.trolley.start() self.trolley.start()

View file

@ -69,9 +69,6 @@ class MailboxInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0)
def __init__(self, node):
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node)
def setupActor(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 = 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) self.pieActor.reparentTo(self.node)

View file

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

View file

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

View file

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

View file

@ -27,8 +27,7 @@ class PartyHood(Hood.Hood):
self.safeZoneLoaderClass = PartyLoader.PartyLoader self.safeZoneLoaderClass = PartyLoader.PartyLoader
self.partyActivityDoneEvent = 'partyActivityDone' self.partyActivityDoneEvent = 'partyActivityDone'
self.storageDNAFile = 'phase_13/dna/storage_party_sz.pdna' self.storageDNAFile = 'phase_13/dna/storage_party_sz.pdna'
self.holidayStorageDNADict = {WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'], self.holidayStorageDNADict = {CHRISTMAS: ['phase_5.5/dna/winter_storage_estate.pdna']}
WACKY_WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna']}
self.skyFile = 'phase_3.5/models/props/TT_sky' self.skyFile = 'phase_3.5/models/props/TT_sky'
self.popupInfo = None self.popupInfo = None
return return

View file

@ -56,9 +56,7 @@ class SellbotHQAI(CogHQAI.CogHQAI):
self.factoryElevators.append(factoryElevator) self.factoryElevators.append(factoryElevator)
def createFactoryBoardingParty(self): def createFactoryBoardingParty(self):
factoryIdList = [] factoryIdList = [elevator.doId for elevator in self.factoryElevators]
for factoryElevator in self.factoryElevators:
factoryIdList.append(factoryElevator.doId)
self.factoryBoardingParty = DistributedBoardingPartyAI(self.air, factoryIdList, 4) self.factoryBoardingParty = DistributedBoardingPartyAI(self.air, factoryIdList, 4)
self.factoryBoardingParty.generateWithRequired(ToontownGlobals.SellbotFactoryExt) self.factoryBoardingParty.generateWithRequired(ToontownGlobals.SellbotFactoryExt)

View file

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

View file

@ -1,11 +1,9 @@
from otp.ai.MagicWordGlobal import *
from toontown.safezone.TTSafeZoneLoader import TTSafeZoneLoader from toontown.safezone.TTSafeZoneLoader import TTSafeZoneLoader
from toontown.town.TTTownLoader import TTTownLoader from toontown.town.TTTownLoader import TTTownLoader
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.hood.ToonHood import ToonHood from toontown.hood.ToonHood import ToonHood
from otp.ai.MagicWordGlobal import *
class TTHood(ToonHood): class TTHood(ToonHood):
notify = directNotify.newCategory('TTHood') notify = directNotify.newCategory('TTHood')
@ -18,11 +16,8 @@ class TTHood(ToonHood):
TITLE_COLOR = (1.0, 0.5, 0.4, 1.0) TITLE_COLOR = (1.0, 0.5, 0.4, 1.0)
HOLIDAY_DNA = { HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ['phase_4/dna/winter_storage_TT.pdna', 'phase_4/dna/winter_storage_TT_sz.pdna'], ToontownGlobals.CHRISTMAS: ['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: ['phase_4/dna/halloween_props_storage_TT.pdna', 'phase_4/dna/halloween_props_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']}
@magicWord(category=CATEGORY_CREATIVE) @magicWord(category=CATEGORY_CREATIVE)
def spooky(): def spooky():
@ -42,4 +37,4 @@ def spooky():
fadeOut.start() fadeOut.start()
spookySfx = base.loadSfx('phase_4/audio/sfx/spooky.ogg') spookySfx = base.loadSfx('phase_4/audio/sfx/spooky.ogg')
spookySfx.play() spookySfx.play()
return 'Activating the spooky effect...' return 'Activating the spooky effect...'

View file

@ -5,9 +5,7 @@ from toontown.safezone import DistributedTrolleyAI
from toontown.toon import NPCToons from toontown.toon import NPCToons
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.ai import DistributedTrickOrTreatTargetAI from toontown.ai import DistributedEffectMgrAI
from toontown.ai import DistributedWinterCarolingTargetAI
class TTHoodAI(HoodAI.HoodAI): class TTHoodAI(HoodAI.HoodAI):
def __init__(self, air): 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, 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) ToontownGlobals.ToontownCentral, posIndex=0)
if simbase.air.wantHalloween: self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12)
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air) self.trickOrTreatMgr.generateWithRequired(2649) # All Fun and Games Shop, Silly Street
self.TrickOrTreatTargetManager.generateWithRequired(2649)
if simbase.air.wantChristmas: self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14)
self.WinterCarolingTargetManager = DistributedWinterCarolingTargetAI.DistributedWinterCarolingTargetAI(self.air) self.winterCarolingMgr.generateWithRequired(2659) # Joy Buzzers to the World, Silly Street
self.WinterCarolingTargetManager.generateWithRequired(2649)
def shutdown(self): def shutdown(self):
HoodAI.HoodAI.shutdown(self) HoodAI.HoodAI.shutdown(self)
@ -52,8 +48,9 @@ class TTHoodAI(HoodAI.HoodAI):
def createButterflies(self): def createButterflies(self):
playground = ButterflyGlobals.TTC playground = ButterflyGlobals.TTC
ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.TTC) ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.TTC)
for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.TTC]): for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.TTC]):
for _ in xrange(0, ButterflyGlobals.NUM_BUTTERFLIES[ButterflyGlobals.TTC]): for _ in xrange(0, ButterflyGlobals.NUM_BUTTERFLIES[ButterflyGlobals.TTC]):
butterfly = DistributedButterflyAI.DistributedButterflyAI(self.air, playground, i, self.zoneId) butterfly = DistributedButterflyAI.DistributedButterflyAI(self.air, playground, i, self.zoneId)
butterfly.generateWithRequired(self.zoneId) butterfly.generateWithRequired(self.zoneId)
butterfly.start() butterfly.start()

View file

@ -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.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')} 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) IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0)
def __init__(self, node):
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node)

View file

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

View file

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

View file

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

View file

@ -474,10 +474,8 @@ class DistributedTwoDGame(DistributedMinigame):
self.updateScore(avId, ToonBlitzGlobals.ScoreGainPerTreasure * treasure.value) self.updateScore(avId, ToonBlitzGlobals.ScoreGainPerTreasure * treasure.value)
else: else:
self.notify.error('WHOA!! treasureIndex %s is out of range; numTreasures = %s' % (treasureIndex, numTreasures)) 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: else:
self.notify.error('WHOA!! sectionIndex %s is out of range; numSections = %s' % (sectionIndex, numSections)) 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): def __enemyShot(self, sectionIndex, enemyIndex):
self.sectionMgr.sections[sectionIndex].enemyMgr.enemies[enemyIndex].doShotTrack() self.sectionMgr.sections[sectionIndex].enemyMgr.enemies[enemyIndex].doShotTrack()

View file

@ -1,14 +1,11 @@
import datetime from pandac.PandaModules import TextNode, PlaneNode, Plane
import time
from pandac.PandaModules import TextNode, Vec3, Vec4, PlaneNode, Plane, Point3
from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG
from direct.directnotify import DirectNotifyGlobal
from direct.gui import DirectGuiGlobals from direct.gui import DirectGuiGlobals
from toontown.toonbase import TTLocalizer from toontown.ai import HolidayGlobals
from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.parties.PartyInfo import PartyInfo from toontown.parties.PartyInfo import PartyInfo
from toontown.parties import PartyGlobals from toontown.parties import PartyGlobals
from toontown.ai.NewsManager import NewsManager import datetime
def myStrftime(myTime): def myStrftime(myTime):
result = '' result = ''
@ -18,9 +15,7 @@ def myStrftime(myTime):
result += myTime.strftime(':%M %p') result += myTime.strftime(':%M %p')
return result return result
class CalendarGuiDay(DirectFrame): class CalendarGuiDay(DirectFrame):
notify = directNotify.newCategory('CalendarGuiDay')
ScrollListTextSize = 0.03 ScrollListTextSize = 0.03
def __init__(self, parent, myDate, startDate, dayClickCallback = None, onlyFutureDaysClickable = False): def __init__(self, parent, myDate, startDate, dayClickCallback = None, onlyFutureDaysClickable = False):
@ -30,27 +25,11 @@ class CalendarGuiDay(DirectFrame):
self.dayClickCallback = dayClickCallback self.dayClickCallback = dayClickCallback
self.onlyFutureDaysClickable = onlyFutureDaysClickable self.onlyFutureDaysClickable = onlyFutureDaysClickable
DirectFrame.__init__(self, parent=parent) 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.filter = ToontownGlobals.CalendarFilterShowAll
self.load() self.load()
self.createGuiObjects() self.createGuiObjects()
self.update() 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): def load(self):
dayAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar_box') dayAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar_box')
dayAsset.reparentTo(self) dayAsset.reparentTo(self)
@ -65,21 +44,11 @@ class CalendarGuiDay(DirectFrame):
self.defaultBox = self.find('**/boxBlank') self.defaultBox = self.find('**/boxBlank')
self.scrollBottomRightLocator = self.find('**/loc_bottomRightList') self.scrollBottomRightLocator = self.find('**/loc_bottomRightList')
self.scrollDownLocator = self.find('**/loc_scrollDown') self.scrollDownLocator = self.find('**/loc_scrollDown')
self.attachMarker(self.scrollDownLocator)
self.scrollUpLocator = self.find('**/loc_scrollUp') 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): def createGuiObjects(self):
self.dayButton = DirectButton(parent=self.dayButtonLocator, image=self.selectedFrame, relief=None, command=self.__clickedOnDay, pressEffect=1, rolloverSound=None, clickSound=None) 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.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.attachMarker(self.numberLocator)
self.listXorigin = 0 self.listXorigin = 0
self.listFrameSizeX = self.scrollBottomRightLocator.getX() - self.scrollLocator.getX() self.listFrameSizeX = self.scrollBottomRightLocator.getX() - self.scrollLocator.getX()
self.scrollHeight = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ() 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, self.scrollList = DirectScrolledList(parent=self.scrollLocator, relief=None, pos=(0, 0, 0), incButton_image=(arrowUp,
arrowDown, arrowDown,
arrowHover, 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, arrowDown,
arrowHover, 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() itemFrameParent = self.scrollList.itemFrame.getParent()
self.scrollList.incButton.reparentTo(self.scrollDownLocator) self.scrollList.incButton.reparentTo(self.scrollDownLocator)
self.scrollList.decButton.reparentTo(self.scrollUpLocator) self.scrollList.decButton.reparentTo(self.scrollUpLocator)
@ -113,10 +82,9 @@ class CalendarGuiDay(DirectFrame):
arrowDown.removeNode() arrowDown.removeNode()
arrowHover.removeNode() arrowHover.removeNode()
clipper = PlaneNode('clipper') 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) clipNP = self.scrollList.component('itemFrame').attachNewNode(clipper)
self.scrollList.component('itemFrame').setClipPlane(clipNP) self.scrollList.component('itemFrame').setClipPlane(clipNP)
return
def scrollButtonPressed(self): def scrollButtonPressed(self):
self.__clickedOnDay() self.__clickedOnDay()
@ -141,59 +109,25 @@ class CalendarGuiDay(DirectFrame):
else: else:
self.defaultBox.show() self.defaultBox.show()
self.todayBox.hide() self.todayBox.hide()
return
def destroy(self): def destroy(self):
if self.dayClickCallback is not None: if self.dayClickCallback is not None:
self.numberWidget.destroy() self.numberWidget.destroy()
self.dayClickCallback = None self.dayClickCallback = None
self.notify.debug('desroying %s' % self.myDate)
try: try:
for item in self.scrollList['items']: for item in self.scrollList['items']:
if hasattr(item, 'description') and item.description and hasattr(item.description, 'destroy'): 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.ENTER)
item.unbind(DGG.EXIT) item.unbind(DGG.EXIT)
item.description.destroy() item.description.destroy()
except e: except e:
self.notify.debug('pass %s' % self.myDate) pass
self.scrollList.removeAndDestroyAllItems() self.scrollList.removeAndDestroyAllItems()
self.scrollList.destroy() self.scrollList.destroy()
self.dayButton.destroy() self.dayButton.destroy()
DirectFrame.destroy(self) 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): def updateArrowButtons(self):
numItems = 0 numItems = 0
@ -210,209 +144,42 @@ class CalendarGuiDay(DirectFrame):
self.scrollList.decButton.show() self.scrollList.decButton.show()
def collectTimedEvents(self): def collectTimedEvents(self):
self.timedEvents = []
if self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyParties: if self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyParties:
for party in localAvatar.partiesInvitedTo: for party in localAvatar.partiesInvitedTo:
if party.startTime.date() == self.myDate.date(): if party.startTime.date() == self.myDate.date():
self.partiesInvitedToToday.append(party) self.addPartyToScrollList(party)
self.timedEvents.append((party.startTime.time(), party))
for party in localAvatar.hostedParties: for party in localAvatar.hostedParties:
if party.startTime.date() == self.myDate.date(): if party.startTime.date() == self.myDate.date():
self.hostedPartiesToday.append(party) self.addPartyToScrollList(party)
self.timedEvents.append((party.startTime.time(), party))
if base.cr.newsManager and (self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyHolidays): if 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))]) for id, holiday in HolidayGlobals.Holidays.iteritems():
yearlyHolidays = base.cr.newsManager.getYearlyHolidaysForDate(self.myDate) title, description = TTLocalizer.HolidayNamesInCalendar[id]
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))
oncelyHolidays = base.cr.newsManager.getOncelyHolidaysForDate(self.myDate) if 'weekDay' in holiday:
for holiday in oncelyHolidays: if self.myDate.weekday() == holiday['weekDay']:
holidayId = holiday[1] self.addTitleAndDescToScrollList(title, description)
holidayStart = holiday[2] elif 'startMonth' in holiday or 'startDay' in holiday:
holidayEnd = holiday[3] startDate = HolidayGlobals.getStartDate(holiday, self.myDate)
holidayType = holiday[0] endDate = HolidayGlobals.getEndDate(holiday, self.myDate)
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]) if self.isDateMatch(self.myDate, startDate):
elif holidayEnd[0] == self.myDate.year and holidayEnd[1] == self.myDate.month and holidayEnd[2] == self.myDate.day: if self.isDateMatch(startDate, endDate):
myTime = datetime.time(holidayEnd[3], holidayEnd[4]) description = '%s. %s' % (title, description)
else: else:
self.notify.error('holiday is not today %s' % holiday) description = '%s. %s %s %s' % (title, description, TTLocalizer.CalendarEndsAt, endDate.strftime('%b %d'))
self.timedEvents.append((myTime, holiday))
multipleStartHolidays = base.cr.newsManager.getMultipleStartHolidaysForDate(self.myDate) self.addTitleAndDescToScrollList(title, description)
for holiday in multipleStartHolidays: elif self.isDateMatch(self.myDate, endDate):
holidayId = holiday[1] title = '%s %s' % (TTLocalizer.CalendarEndOf, title)
holidayStart = holiday[2] description = '%s. %s %s' % (title, TTLocalizer.CalendarStartedOn, startDate.strftime('%b %d'))
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))
relativelyHolidays = base.cr.newsManager.getRelativelyHolidaysForDate(self.myDate) self.addTitleAndDescToScrollList(title, description)
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)
def isDateMatch(self, date1, date2):
return date1.day == date2.day and date1.month == date2.month
def addTitleAndDescToScrollList(self, title, desc): def addTitleAndDescToScrollList(self, title, desc):
textSize = self.ScrollListTextSize textSize = self.ScrollListTextSize
descTextSize = 0.05 descTextSize = 0.05
@ -429,7 +196,6 @@ class CalendarGuiDay(DirectFrame):
newItem.bind(DGG.ENTER, self.enteredTextItem, extraArgs=[newItem, desc, descUnderItemZAdjust]) newItem.bind(DGG.ENTER, self.enteredTextItem, extraArgs=[newItem, desc, descUnderItemZAdjust])
newItem.bind(DGG.EXIT, self.exitedTextItem, extraArgs=[newItem]) newItem.bind(DGG.EXIT, self.exitedTextItem, extraArgs=[newItem])
self.scrollList.addItem(newItem) self.scrollList.addItem(newItem)
return
def exitedTextItem(self, newItem, mousepos): def exitedTextItem(self, newItem, mousepos):
newItem.description.hide() newItem.description.hide()
@ -473,7 +239,6 @@ class CalendarGuiDay(DirectFrame):
newItem.description.hide() newItem.description.hide()
newItem.bind(DGG.ENTER, self.enteredTextItem, extraArgs=[newItem, newItem.description, descUnderItemZAdjust]) newItem.bind(DGG.ENTER, self.enteredTextItem, extraArgs=[newItem, newItem.description, descUnderItemZAdjust])
newItem.bind(DGG.EXIT, self.exitedTextItem, extraArgs=[newItem]) newItem.bind(DGG.EXIT, self.exitedTextItem, extraArgs=[newItem])
return
def __clickedOnScrollItem(self): def __clickedOnScrollItem(self):
self.__clickedOnDay() self.__clickedOnDay()
@ -488,7 +253,6 @@ class CalendarGuiDay(DirectFrame):
return return
if self.dayClickCallback: if self.dayClickCallback:
self.dayClickCallback(self) self.dayClickCallback(self)
self.notify.debug('we got clicked on %s' % self.myDate.date())
messenger.send('clickedOnDay', [self.myDate.date()]) messenger.send('clickedOnDay', [self.myDate.date()])
def updateSelected(self, selected): def updateSelected(self, selected):
@ -513,7 +277,6 @@ class CalendarGuiDay(DirectFrame):
def update(self): def update(self):
self.numberWidget['text'] = str(self.myDate.day) self.numberWidget['text'] = str(self.myDate.day)
self.adjustForMonth() self.adjustForMonth()
self.addWeeklyHolidays()
self.collectTimedEvents() self.collectTimedEvents()
self.updateArrowButtons() self.updateArrowButtons()
@ -524,7 +287,6 @@ class CalendarGuiDay(DirectFrame):
self.scrollList.removeAndDestroyAllItems() self.scrollList.removeAndDestroyAllItems()
self.update() self.update()
class MiniInviteVisual(DirectFrame): class MiniInviteVisual(DirectFrame):
def __init__(self, parent, partyInfo): 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.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.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) 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): def show(self):
self.reparentTo(self.parent) self.reparentTo(self.parent)
@ -580,4 +341,4 @@ class MiniInviteVisual(DirectFrame):
del self.whosePartyLabel del self.whosePartyLabel
del self.whenTextLabel del self.whenTextLabel
del self.partyStatusLabel del self.partyStatusLabel
DirectFrame.destroy(self) DirectFrame.destroy(self)

View file

@ -1,10 +1,8 @@
import calendar from pandac.PandaModules import TextNode
from datetime import timedelta, datetime
from pandac.PandaModules import Vec4, TextNode
from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.toonbase import ToontownGlobals
from toontown.parties.CalendarGuiDay import CalendarGuiDay from toontown.parties.CalendarGuiDay import CalendarGuiDay
from datetime import timedelta, datetime
class CalendarGuiMonth(DirectFrame): class CalendarGuiMonth(DirectFrame):
notify = directNotify.newCategory('CalendarGuiMonth') notify = directNotify.newCategory('CalendarGuiMonth')
@ -18,57 +16,19 @@ class CalendarGuiMonth(DirectFrame):
if self.onlyFutureDaysClickable: if self.onlyFutureDaysClickable:
self.onlyFutureMonthsClickable = True self.onlyFutureMonthsClickable = True
DirectFrame.__init__(self, parent=parent, scale=scale, pos=pos) DirectFrame.__init__(self, parent=parent, scale=scale, pos=pos)
self.showMarkers = base.config.GetBool('show-calendar-markers', 0)
self.load() self.load()
self.createGuiObjects() self.createGuiObjects()
self.lastSelectedDate = None self.lastSelectedDate = None
self.accept('clickedOnDay', self.clickedOnDay) 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): def load(self):
monthAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar') monthAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar')
monthAsset.reparentTo(self) monthAsset.reparentTo(self)
self.monthLocator = self.find('**/locator_month/locator_month') self.monthLocator = self.find('**/locator_month/locator_month')
self.attachMarker(self.monthLocator)
self.weekDayLocators = [] self.weekDayLocators = []
for weekday in ('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'): for weekday in ('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'):
weekDayLoc = self.find('**/loc_%s' % weekday) weekDayLoc = self.find('**/loc_%s' % weekday)
self.weekDayLocators.append(weekDayLoc) self.weekDayLocators.append(weekDayLoc)
self.attachMarker(weekDayLoc)
self.dayLocators = [] self.dayLocators = []
for row in xrange(6): for row in xrange(6):
@ -111,13 +71,13 @@ class CalendarGuiMonth(DirectFrame):
self.monthLeftArrow = DirectButton(parent=self.monthLeftLocator, relief=None, image=(arrowUp, self.monthLeftArrow = DirectButton(parent=self.monthLeftLocator, relief=None, image=(arrowUp,
arrowDown, arrowDown,
arrowHover, 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: if self.onlyFutureMonthsClickable:
self.monthLeftArrow.hide() self.monthLeftArrow.hide()
self.monthRightArrow = DirectButton(parent=self.monthRightLocator, relief=None, image=(arrowUp, self.monthRightArrow = DirectButton(parent=self.monthRightLocator, relief=None, image=(arrowUp,
arrowDown, arrowDown,
arrowHover, 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): def makeLabel(itemName, itemNum, *extraArgs):
return DirectLabel(text=itemName, frameColor=(0, 0, 0, 0), text_scale=0.04) 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, self.filterList = DirectScrolledList(parent=self.filterLocator, relief=None, pos=(0, 0, 0), image=None, text_scale=0.025, incButton_image=(arrowUp,
arrowDown, arrowDown,
arrowHover, 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, arrowDown,
arrowHover, 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() gui.removeNode()
return
def getTopLeftDate(self): def getTopLeftDate(self):
firstOfTheMonth = self.curDate.replace(day=1) firstOfTheMonth = self.curDate.replace(day=1)
@ -169,7 +128,7 @@ class CalendarGuiMonth(DirectFrame):
newMonth -= 12 newMonth -= 12
while newMonth < 1: while newMonth < 1:
if newYear - 1 > 1899: if newYear - 1 > 2002:
newMonth += 12 newMonth += 12
newYear -= 1 newYear -= 1
else: else:
@ -206,7 +165,6 @@ class CalendarGuiMonth(DirectFrame):
self.filterList.destroy() self.filterList.destroy()
DirectFrame.destroy(self) DirectFrame.destroy(self)
return
def clickedOnDay(self, dayDate): def clickedOnDay(self, dayDate):
self.lastSelectedDate = dayDate self.lastSelectedDate = dayDate
@ -215,10 +173,7 @@ class CalendarGuiMonth(DirectFrame):
def updateSelectedDate(self): def updateSelectedDate(self):
if self.lastSelectedDate: if self.lastSelectedDate:
for oneGuiDay in self.guiDays: for oneGuiDay in self.guiDays:
if oneGuiDay.myDate.date() == self.lastSelectedDate: oneGuiDay.updateSelected(oneGuiDay.myDate.date() == self.lastSelectedDate)
oneGuiDay.updateSelected(True)
else:
oneGuiDay.updateSelected(False)
def clearSelectedDay(self): def clearSelectedDay(self):
for oneGuiDay in self.guiDays: for oneGuiDay in self.guiDays:
@ -227,4 +182,4 @@ class CalendarGuiMonth(DirectFrame):
def filterChanged(self): def filterChanged(self):
newFilter = self.filterList.getSelectedIndex() newFilter = self.filterList.getSelectedIndex()
for guiDay in self.guiDays: for guiDay in self.guiDays:
guiDay.changeFilter(newFilter) guiDay.changeFilter(newFilter)

View file

@ -22,7 +22,7 @@ class GlobalPartyManagerUD(DistributedObjectGlobalUD):
PARTY_TIME_FORMAT = '%Y-%m-%d %H:%M:%S' PARTY_TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
startTime = datetime.strptime('2014-01-20 11:50:00', PARTY_TIME_FORMAT) startTime = datetime.strptime('2014-01-20 11:50:00', PARTY_TIME_FORMAT)
endTime = datetime.strptime('2014-01-20 12:20: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':[]} #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() config = getConfigShowbase()
self.wantInstantParties = config.GetBool('want-instant-parties', 0) self.wantInstantParties = config.GetBool('want-instant-parties', 0)
@ -247,5 +247,6 @@ class GlobalPartyManagerUD(DistributedObjectGlobalUD):
def allocIds(self, numIds): def allocIds(self, numIds):
ids = [] ids = []
while len(ids) < numIds: while len(ids) < numIds:
ids.append(self.partyAllocator.allocate()) ids.append(self.nextId)
self.nextId += 1
self.sendToAI('receiveId', ids) self.sendToAI('receiveId', ids)

View file

@ -6,7 +6,6 @@ from direct.showbase import PythonUtil
from direct.fsm.FSM import FSM from direct.fsm.FSM import FSM
from toontown.parties import PartyGlobals from toontown.parties import PartyGlobals
from toontown.parties import PartyUtils from toontown.parties import PartyUtils
from toontown.toonbase.ToontownGlobals import VALENTINES_DAY
class InviteVisual(DirectFrame): class InviteVisual(DirectFrame):
notify = directNotify.newCategory('InviteVisual') notify = directNotify.newCategory('InviteVisual')

View file

@ -46,10 +46,9 @@ class PartyEditor(DirectObject, FSM):
self.partyPlanner.gui.find('**/activitiesButtonDown_down'), self.partyPlanner.gui.find('**/activitiesButtonDown_down'),
self.partyPlanner.gui.find('**/activitiesButtonDown_rollover'), 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=[]) 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 = base.cr.newsManager.isHolidayRunning(ToontownGlobals.CHRISTMAS)
isWinter = ToontownGlobals.WINTER_DECORATIONS in holidayIds or ToontownGlobals.WACKY_WINTER_DECORATIONS in holidayIds isVictory = base.cr.newsManager.isHolidayRunning(ToontownGlobals.VICTORY_PARTY_HOLIDAY)
isVictory = ToontownGlobals.VICTORY_PARTY_HOLIDAY in holidayIds isValentine = base.cr.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY)
isValentine = ToontownGlobals.VALENTINES_DAY in holidayIds
for activityId in PartyGlobals.PartyEditorActivityOrder: 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: 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 pass

View file

@ -156,13 +156,12 @@ class PartyPlanner(DirectFrame, FSM):
self.prevButton['state'] = DirectGuiGlobals.NORMAL self.prevButton['state'] = DirectGuiGlobals.NORMAL
self.nextButton.hide() self.nextButton.hide()
defaultInviteTheme = PartyGlobals.InviteTheme.GenericMale defaultInviteTheme = PartyGlobals.InviteTheme.GenericMale
if hasattr(base.cr, 'newsManager') and base.cr.newsManager: if base.cr.newsManager.isHolidayRunning(ToontownGlobals.VICTORY_PARTY_HOLIDAY):
if ToontownGlobals.VICTORY_PARTY_HOLIDAY in base.cr.newsManager.getHolidayIdList(): defaultInviteTheme = PartyGlobals.InviteTheme.VictoryParty
defaultInviteTheme = PartyGlobals.InviteTheme.VictoryParty elif base.cr.newsManager.isHolidayRunning(ToontownGlobals.KARTING_TICKETS_HOLIDAY) or base.cr.newsManager.isHolidayRunning(ToontownGlobals.GRAND_PRIX):
elif ToontownGlobals.KARTING_TICKETS_HOLIDAY in base.cr.newsManager.getHolidayIdList() or ToontownGlobals.CIRCUIT_RACING_EVENT in base.cr.newsManager.getHolidayIdList(): defaultInviteTheme = PartyGlobals.InviteTheme.Racing
defaultInviteTheme = PartyGlobals.InviteTheme.Racing elif base.cr.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY):
elif ToontownGlobals.VALENTINES_DAY in base.cr.newsManager.getHolidayIdList(): defaultInviteTheme = PartyGlobals.InviteTheme.Valentoons
defaultInviteTheme = PartyGlobals.InviteTheme.Valentoons
if self.partyInfo is not None: if self.partyInfo is not None:
del self.partyInfo del self.partyInfo
activityList = self.partyEditor.partyEditorGrid.getActivitiesOnGrid() activityList = self.partyEditor.partyEditorGrid.getActivitiesOnGrid()
@ -593,14 +592,12 @@ class PartyPlanner(DirectFrame, FSM):
def __handleHolidays(self): def __handleHolidays(self):
self.inviteThemes = range(len(PartyGlobals.InviteTheme)) self.inviteThemes = range(len(PartyGlobals.InviteTheme))
if hasattr(base.cr, 'newsManager') and base.cr.newsManager: if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY):
holidayIds = base.cr.newsManager.getHolidayIdList() self.inviteThemes.remove(PartyGlobals.InviteTheme.Valentoons)
if ToontownGlobals.VALENTINES_DAY not in holidayIds: if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.VICTORY_PARTY_HOLIDAY):
self.inviteThemes.remove(PartyGlobals.InviteTheme.Valentoons) self.inviteThemes.remove(PartyGlobals.InviteTheme.VictoryParty)
if ToontownGlobals.VICTORY_PARTY_HOLIDAY not in holidayIds: if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.CHRISTMAS):
self.inviteThemes.remove(PartyGlobals.InviteTheme.VictoryParty) self.inviteThemes.remove(PartyGlobals.InviteTheme.Winter)
if ToontownGlobals.WINTER_DECORATIONS not in holidayIds and ToontownGlobals.WACKY_WINTER_DECORATIONS not in holidayIds:
self.inviteThemes.remove(PartyGlobals.InviteTheme.Winter)
def _createFarewellPage(self): def _createFarewellPage(self):
page = DirectFrame(self.frame) page = DirectFrame(self.frame)

View file

@ -29,6 +29,7 @@ Component2IconDict = {'boredom': 'Bored',
from toontown.nametag import * from toontown.nametag import *
from toontown.nametag.NametagGlobals import * from toontown.nametag.NametagGlobals import *
from toontown.chat.ChatGlobals import *
class Pet(Avatar.Avatar): class Pet(Avatar.Avatar):
notify = DirectNotifyGlobal.directNotify.newCategory('Pet') notify = DirectNotifyGlobal.directNotify.newCategory('Pet')
@ -280,7 +281,7 @@ class Pet(Avatar.Avatar):
moodIcons = loader.loadModel('phase_4/models/char/petEmotes') moodIcons = loader.loadModel('phase_4/models/char/petEmotes')
self.moodIcons = self.attachNewNode('moodIcons') self.moodIcons = self.attachNewNode('moodIcons')
self.moodIcons.setScale(2.0) self.moodIcons.setScale(2.0)
self.moodIcons.setZ(3.65) self.moodIcons.setZ(4.65)
moods = moodIcons.findAllMatches('**/+GeomNode') moods = moodIcons.findAllMatches('**/+GeomNode')
for moodNum in range(0, moods.getNumPaths()): for moodNum in range(0, moods.getNumPaths()):
mood = moods.getPath(moodNum) mood = moods.getPath(moodNum)
@ -295,13 +296,8 @@ class Pet(Avatar.Avatar):
return return
def showMood(self, mood): def showMood(self, mood):
if hasattr(base.cr, 'newsManager') and base.cr.newsManager: if base.cr.newsManager.isHolidayRunning(ToontownGlobals.APRIL_TOONS_WEEK) and mood != 'confusion':
holidayIds = base.cr.newsManager.getHolidayIdList() self.speakMood(mood)
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()
else: else:
self.clearChat() self.clearChat()
mood = Component2IconDict[mood] mood = Component2IconDict[mood]
@ -322,12 +318,7 @@ class Pet(Avatar.Avatar):
return return
def speakMood(self, mood): def speakMood(self, mood):
if self.moodModel: self.setChatAbsolute(random.choice(TTLocalizer.SpokenMoods[mood]), CFSpeech)
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)
def getGenderString(self): def getGenderString(self):
if self.style: if self.style:

View file

@ -550,14 +550,14 @@ class DistributedRace(DistributedObject.DistributedObject):
newLapT = (newT - self.startT) / self.curve.getMaxT() % 1.0 newLapT = (newT - self.startT) / self.curve.getMaxT() % 1.0
if newLapT - self.currLapT < -0.5: if newLapT - self.currLapT < -0.5:
self.laps += 1 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.notify.debug('crossed the start line: %s, %s, %s, %s' % (self.laps,
self.startT, self.startT,
self.currT, self.currT,
newT)) newT))
elif newLapT - self.currLapT > 0.5: elif newLapT - self.currLapT > 0.5:
self.laps -= 1 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.notify.debug('crossed the start line - wrong way: %s, %s, %s, %s' % (self.laps,
self.startT, self.startT,
self.currT, self.currT,
@ -1211,12 +1211,9 @@ class DistributedRace(DistributedObject.DistributedObject):
self.musicTrack.start() self.musicTrack.start()
def changeMusicTempo(self, newPR): def changeMusicTempo(self, newPR):
return # TODO: Reenable when we have music change support.
if self.musicTrack: if self.musicTrack:
self.musicTrack.finish() self.musicTrack.finish()
curPR = self.raceMusic.getPlayRate() self.musicTrack = Sequence(LerpFunctionInterval(self.raceMusic.setPlayRate, fromData=self.raceMusic.getPlayRate(), toData=newPR, duration=3))
interval = LerpFunctionInterval(self.raceMusic.setPlayRate, fromData=curPR, toData=newPR, duration=3)
self.musicTrack = Sequence(interval)
self.musicTrack.start() self.musicTrack.start()
def setRaceZone(self, zoneId, trackId): def setRaceZone(self, zoneId, trackId):

View file

@ -293,7 +293,7 @@ class RaceWinningsPanel(DirectFrame):
else: else:
self.circuitTotalLabel.stash() self.circuitTotalLabel.stash()
self.raceTotalLabel.unstash() 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() self.doubleTicketsLabel.stash()
if ticBonus: 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))) 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)))

View file

@ -76,7 +76,6 @@ class DDPlayground(Playground.Playground):
self.loader.seagullSound.stop() self.loader.seagullSound.stop()
taskMgr.remove('dd-seagulls') taskMgr.remove('dd-seagulls')
self.cameraSubmerged = 1 self.cameraSubmerged = 1
self.walkStateData.setSwimSoundAudible(1)
def __emergeCamera(self): def __emergeCamera(self):
if self.cameraSubmerged == 0: if self.cameraSubmerged == 0:
@ -86,7 +85,6 @@ class DDPlayground(Playground.Playground):
self.nextSeagullTime = random.random() * 8.0 self.nextSeagullTime = random.random() * 8.0
taskMgr.add(self.__seagulls, 'dd-seagulls') taskMgr.add(self.__seagulls, 'dd-seagulls')
self.cameraSubmerged = 0 self.cameraSubmerged = 0
self.walkStateData.setSwimSoundAudible(0)
def __submergeToon(self): def __submergeToon(self):
if self.toonSubmerged == 1: if self.toonSubmerged == 1:

Some files were not shown because too many files have changed in this diff Show more