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

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

@ -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.
"""
target = spellbook.getTarget()
if target == spellbook.getInvoker():
return "You can't kick yourself!"
datagram = PyDatagram()
datagram.addServerHeader(
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)
wantMouse = base.config.GetBool('want-mouse', 0)
sleepTimeout = base.config.GetInt('sleep-timeout', 120)
swimTimeout = base.config.GetInt('afk-timeout', 600)
__enableMarkerPlacement = base.config.GetBool('place-markers', 0)
def __init__(self, cr, chatMgr, talkAssistant = None, passMessagesThrough = False):
@ -63,7 +62,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.sleepFlag = 0
self.isDisguised = 0
self.movingFlag = 0
self.swimmingFlag = 0
self.lastNeedH = None
self.accept('friendOnline', self.__friendOnline)
self.accept('friendOffline', self.__friendOffline)
@ -977,42 +975,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.sleepCallback = None
return
def startSleepSwimTest(self):
taskName = self.taskName('sleepSwimTest')
taskMgr.remove(taskName)
task = Task.Task(self.sleepSwimTest)
self.lastMoved = globalClock.getFrameTime()
self.lastState = None
self.lastAction = None
self.sleepSwimTest(task)
taskMgr.add(self.sleepSwimTest, taskName, 35)
return
def stopSleepSwimTest(self):
taskName = self.taskName('sleepSwimTest')
taskMgr.remove(taskName)
self.stopSound()
def sleepSwimTest(self, task):
now = globalClock.getFrameTime()
speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds()
if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'):
if not self.swimmingFlag:
self.swimmingFlag = 1
elif self.swimmingFlag:
self.swimmingFlag = 0
if self.swimmingFlag or self.hp <= 0:
self.wakeUp()
elif not self.sleepFlag:
now = globalClock.getFrameTime()
if now - self.lastMoved > self.swimTimeout:
self.swimTimeoutAction()
return Task.done
return Task.cont
def swimTimeoutAction(self):
pass
def trackAnimToSpeed(self, task):
speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds()
if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'):

View file

@ -445,10 +445,6 @@ class OTPClientRepository(ClientRepositoryBase):
def __handleLoginDone(self, doneStatus):
mode = doneStatus['mode']
if mode == 'success':
if hasattr(self, 'toontownTimeManager'):
timestamp = time.gmtime(doneStatus['timestamp'])
dateString = time.strftime(self.toontownTimeManager.formatStr, timestamp)
self.lastLoggedIn = self.toontownTimeManager.convertStrToToontownTime(dateString)
self.loginFSM.request('waitForGameList')
elif mode == 'reject':
self.loginFSM.request('reject')

View file

@ -1618,20 +1618,6 @@ SpeedChatStaticTextToontown = {100: 'Hi!',
21206: 'Speak!',
30100: "Happy April Toons' Week!",
30101: "Welcome to my April Toons' Week party!",
30102: 'The Silly Meter is back in Toon Hall!',
30110: 'Mickey is in Daisy Gardens.',
30111: 'Daisy is in Toontown Central.',
30112: 'Minnie is in The Brrrgh.',
30113: 'Pluto is in Melodyland.',
30114: 'Donald is sleepwalking at the Speedway.',
30115: 'Goofy is in Dreamland.',
30120: 'Mickey is acting like Daisy!',
30121: 'Daisy is acting like Mickey!',
30122: 'Minnie is acting like Pluto!',
30123: 'Pluto is acting like Minnie!',
30124: 'Pluto is talking!',
30125: 'Goofy is acting like Donald!',
30126: 'Donald is dreaming he is Goofy!',
30130: 'Watch how far I can jump.',
30131: 'Wow, you jumped really far!',
30132: 'Hey, Doodles can talk!',
@ -2312,8 +2298,6 @@ KartRacingMenuSections = [-1,
'TAUNTS']
AprilToonsMenuSections = [-1,
'GREETINGS',
'PLAYGROUNDS',
'CHARACTERS',
'ESTATES']
SillyHolidayMenuSections = [-1, 'WORLD', 'BATTLE']
CarolMenuSections = [-1]

View file

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

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()
av = self.air.doId2do.get(avId)
if not av or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a:
if not av or av.getTutorialAck() or av.dna.getAnimal() != 'cat' or av.dna.headColor == 0x1a:
return
newDNA = ToonDNA()

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()
if fishName.lower() == 'remove':
if invoker.doId not in simbase.air.fishManager.fishRequests:
if invoker.doId not in simbase.air.fishManager.requestedFish:
return 'You have not requested a fish.'
del simbase.air.fishManager.fishRequests[invoker.doId]
del simbase.air.fishManager.requestedFish[invoker.doId]
return 'Removed your fish request.'
for genus, species in TTLocalizer.FishSpeciesNames:
@ -113,7 +113,7 @@ def fish(fishName):
if fishName.lower() != name.lower():
continue
fishRequest = (genus, species.index(name))
simbase.air.fishManager.fishRequests[invoker.doId] = fishRequest
simbase.air.fishManager.requestedFish[invoker.doId] = fishRequest
return 'A request for the fish %s was saved.' % name
return "Couldn't find a fish with the name %s!" % fishName

View file

@ -80,8 +80,7 @@ class HalloweenHolidayDecorator(HolidayDecorator.HolidayDecorator):
for light in place.loader.hood.halloweenLights:
light.setColorScaleOff(0)
holidayIds = base.cr.newsManager.getDecorationHolidayId()
if ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds and ToontownGlobals.SPOOKY_COSTUMES not in holidayIds:
if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN):
return
if (self.__checkHoodValidity() or self.__checkStreetValidity()) and hasattr(base.cr.playGame, 'hood') and base.cr.playGame.hood and hasattr(base.cr.playGame.hood, 'sky') and base.cr.playGame.hood.sky:
preShow = Sequence(Parallel(LerpColorScaleInterval(base.cr.playGame.hood.sky, 1.5, Vec4(1, 1, 1, 0.25)), LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 2.5, Vec4(0.55, 0.55, 0.65, 1)), Func(__lightDecorationOn__)), Func(self.__startSpookySky))
@ -97,8 +96,7 @@ class HalloweenHolidayDecorator(HolidayDecorator.HolidayDecorator):
distributedEstate = base.cr.doFind('DistributedEstate')
if distributedEstate:
distributedEstate.unloadWitch()
holidayIds = base.cr.newsManager.getDecorationHolidayId()
if len(holidayIds) > 0:
if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN):
self.decorate()
return
storageFile = base.cr.playGame.hood.storageDNAFile

View file

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

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 panda3d.core import *
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObject import DistributedObject
from direct.interval.IntervalGlobal import *
from toontown.toonbase import TTLocalizer, ToontownGlobals, ToontownBattleGlobals
from toontown.battle import SuitBattleGlobals
from toontown.estate import Estate
from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer
from toontown.suit import SuitDNA
from copy import deepcopy
import HolidayDecorator, HalloweenHolidayDecorator, calendar
import HolidayGlobals
decorationHolidays = [ToontownGlobals.WINTER_DECORATIONS,
ToontownGlobals.WACKY_WINTER_DECORATIONS,
ToontownGlobals.HALLOWEEN_PROPS,
ToontownGlobals.SPOOKY_PROPS,
ToontownGlobals.HALLOWEEN_COSTUMES,
ToontownGlobals.SPOOKY_COSTUMES]
class NewsManager(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('NewsManager')
class NewsManager(DistributedObject):
neverDisable = 1
YearlyHolidayType = 1
OncelyHolidayType = 2
RelativelyHolidayType = 3
OncelyMultipleStartHolidayType = 4
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
self.population = 0
self.invading = 0
forcedHolidayDecorations = base.config.GetString('force-holiday-decorations', '')
self.decorationHolidayIds = []
if forcedHolidayDecorations != '':
forcedHolidayDecorations = forcedHolidayDecorations.split(',')
for HID in forcedHolidayDecorations:
try:
self.decorationHolidayIds.append(decorationHolidays[int(HID)])
except:
print 'holidayId value error: "%s"... skipping' %HID
self.holidayDecorator = None
self.holidayIdList = []
base.cr.newsManager = self
DistributedObject.__init__(self, cr)
self.invading = False
self.activeHolidays = []
base.localAvatar.inventory.setInvasionCreditMultiplier(1)
self.weeklyCalendarHolidays = []
return
base.cr.newsManager = self
def delete(self):
self.cr.newsManager = None
if self.holidayDecorator:
self.holidayDecorator.exit()
DistributedObject.DistributedObject.delete(self)
return
DistributedObject.delete(self)
def setPopulation(self, population):
self.population = population
messenger.send('newPopulation', [population])
def isHolidayRunning(self, id):
return id in self.activeHolidays
def getPopulation(self):
return self.population
def setActiveHolidays(self, ids):
for id in ids:
self.startHoliday(id, True)
def sendSystemMessage(self, message, style):
base.localAvatar.setSystemMessage(style, message)
def broadcastHoliday(self, holiday, type):
if type in holiday:
base.localAvatar.setSystemMessage(0, holiday[type])
def setInvasionStatus(self, msgType, suitType, remaining, flags):
if suitType in SuitDNA.suitHeadTypes:
suitName = SuitBattleGlobals.SuitAttributes[suitType]['name']
suitNamePlural = SuitBattleGlobals.SuitAttributes[suitType]['pluralname']
elif suitType in SuitDNA.suitDepts:
suitName = SuitDNA.getDeptFullname(suitType)
suitNamePlural = SuitDNA.getDeptFullnameP(suitType)
messages = []
if msgType == ToontownGlobals.SuitInvasionBegin:
messages.append(TTLocalizer.SuitInvasionBegin1)
messages.append(TTLocalizer.SuitInvasionBegin2 % suitNamePlural)
self.invading = 1
elif msgType == ToontownGlobals.SuitInvasionEnd:
messages.append(TTLocalizer.SuitInvasionEnd1 % suitName)
messages.append(TTLocalizer.SuitInvasionEnd2)
self.invading = 0
elif msgType == ToontownGlobals.SuitInvasionUpdate:
messages.append(TTLocalizer.SuitInvasionUpdate1)
messages.append(TTLocalizer.SuitInvasionUpdate2)
self.invading = 1
elif msgType == ToontownGlobals.SuitInvasionBulletin:
messages.append(TTLocalizer.SuitInvasionBulletin1)
messages.append(TTLocalizer.SuitInvasionBulletin2 % suitNamePlural)
self.invading = 1
elif msgType == ToontownGlobals.SkelecogInvasionBegin:
messages.append(TTLocalizer.SkelecogInvasionBegin1)
messages.append(TTLocalizer.SkelecogInvasionBegin2)
messages.append(TTLocalizer.SkelecogInvasionBegin3)
self.invading = 1
elif msgType == ToontownGlobals.SkelecogInvasionEnd:
messages.append(TTLocalizer.SkelecogInvasionEnd1)
messages.append(TTLocalizer.SkelecogInvasionEnd2)
self.invading = 0
elif msgType == ToontownGlobals.SkelecogInvasionBulletin:
messages.append(TTLocalizer.SkelecogInvasionBulletin1)
messages.append(TTLocalizer.SkelecogInvasionBulletin2)
messages.append(TTLocalizer.SkelecogInvasionBulletin3)
self.invading = 1
elif msgType == ToontownGlobals.WaiterInvasionBegin:
messages.append(TTLocalizer.WaiterInvasionBegin1)
messages.append(TTLocalizer.WaiterInvasionBegin2)
self.invading = 1
elif msgType == ToontownGlobals.WaiterInvasionEnd:
messages.append(TTLocalizer.WaiterInvasionEnd1)
messages.append(TTLocalizer.WaiterInvasionEnd2)
self.invading = 0
elif msgType == ToontownGlobals.WaiterInvasionBulletin:
messages.append(TTLocalizer.WaiterInvasionBulletin1)
messages.append(TTLocalizer.WaiterInvasionBulletin2)
messages.append(TTLocalizer.WaiterInvasionBulletin3)
self.invading = 1
elif msgType == ToontownGlobals.V2InvasionBegin:
messages.append(TTLocalizer.V2InvasionBegin1)
messages.append(TTLocalizer.V2InvasionBegin2)
messages.append(TTLocalizer.V2InvasionBegin3 % suitNamePlural)
self.invading = 1
elif msgType == ToontownGlobals.V2InvasionEnd:
messages.append(TTLocalizer.V2InvasionEnd1)
messages.append(TTLocalizer.V2InvasionEnd2)
self.invading = 0
elif msgType == ToontownGlobals.V2InvasionBulletin:
messages.append(TTLocalizer.V2InvasionBulletin1)
messages.append(TTLocalizer.V2InvasionBulletin2)
messages.append(TTLocalizer.V2InvasionBulletin3 % suitNamePlural)
self.invading = 1
else:
self.notify.warning('setInvasionStatus: invalid msgType: %s' % msgType)
def startHoliday(self, id, ongoing=False):
if id in self.activeHolidays or id not in HolidayGlobals.Holidays:
return
multiplier = 1
if self.invading:
multiplier = ToontownBattleGlobals.getInvasionMultiplier()
base.localAvatar.inventory.setInvasionCreditMultiplier(multiplier)
holiday = HolidayGlobals.getHoliday(id)
self.activeHolidays.append(id)
self.broadcastHoliday(holiday, 'ongoingMessage' if ongoing else 'startMessage')
self.startSpecialHoliday(id)
def endHoliday(self, id):
if id not in self.activeHolidays or id not in HolidayGlobals.Holidays:
return
holiday = HolidayGlobals.getHoliday(id)
self.activeHolidays.remove(id)
self.broadcastHoliday(holiday, 'endMessage')
self.endSpecialHoliday(id)
def startSpecialHoliday(self, id):
if id == ToontownGlobals.LAUGHING_MAN:
for toon in base.cr.toons.values():
toon.generateLaughingMan()
elif id == ToontownGlobals.APRIL_TOONS_WEEK:
if isinstance(base.cr.playGame.getPlace(), Estate.Estate):
base.localAvatar.startAprilToonsControls()
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 endSpecialHoliday(self, id):
if id == ToontownGlobals.LAUGHING_MAN:
for toon in base.cr.toons.values():
toon.swapToonHead(laughingMan=toon.getWantLaughingMan())
elif id == ToontownGlobals.APRIL_TOONS_WEEK:
if isinstance(base.cr.playGame.getPlace(), Estate.Estate):
base.localAvatar.stopAprilToonsControls()
base.localAvatar.chatMgr.chatInputSpeedChat.removeAprilToonsMenu()
elif id == ToontownGlobals.IDES_OF_MARCH:
base.localAvatar.chatMgr.chatInputSpeedChat.removeIdesOfMarchMenu()
elif id == ToontownGlobals.HALLOWEEN:
base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu()
elif id == ToontownGlobals.CHRISTMAS:
base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu()
def setInvasionStatus(self, msgType, suitType, remaining, flags):
if msgType not in ToontownGlobals.SuitInvasions:
return
if suitType in SuitDNA.suitHeadTypes:
attributes = SuitBattleGlobals.SuitAttributes[suitType]
suitNames = {'singular': attributes['name'], 'plural': attributes['pluralname']}
elif suitType in SuitDNA.suitDepts:
suitNames = {'singular': SuitDNA.getDeptFullname(suitType), 'plural': SuitDNA.getDeptFullnameP(suitType)}
else:
return
track = Sequence()
base.localAvatar.inventory.setInvasionCreditMultiplier(1 if msgType in ToontownGlobals.EndingInvasions else ToontownBattleGlobals.getInvasionMultiplier())
for i, message in enumerate(ToontownGlobals.SuitInvasions[msgType]):
track.append(Wait(5 if i else 1))
track.append(Func(base.localAvatar.setSystemMessage, 0, (TTLocalizer.SuitInvasionPrefix + message) % suitNames))
track = Sequence(name='newsManagerWait', autoPause=1)
for i, message in enumerate(messages):
if i == 0:
track.append(Wait(1))
else:
track.append(Wait(5))
track.append(Func(base.localAvatar.setSystemMessage, 0, message))
track.start()
def getInvading(self):
return self.invading
def startHoliday(self, holidayId):
if holidayId not in self.holidayIdList:
self.notify.info('setHolidayId: Starting Holiday %s' % holidayId)
self.holidayIdList.append(holidayId)
if holidayId in decorationHolidays:
self.decorationHolidayIds.append(holidayId)
if holidayId == ToontownGlobals.HALLOWEEN_PROPS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addHalloweenMenu()
self.setHalloweenPropsHolidayStart()
elif holidayId == ToontownGlobals.SPOOKY_PROPS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addHalloweenMenu()
self.setSpookyPropsHolidayStart()
elif holidayId == ToontownGlobals.WINTER_DECORATIONS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addWinterMenu()
self.setWinterDecorationsStart()
elif holidayId == ToontownGlobals.WACKY_WINTER_DECORATIONS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addWinterMenu()
self.setWackyWinterDecorationsStart()
if hasattr(base.cr.playGame, 'dnaStore') and hasattr(base.cr.playGame, 'hood') and hasattr(base.cr.playGame.hood, 'loader'):
if holidayId == ToontownGlobals.HALLOWEEN_COSTUMES or holidayId == ToontownGlobals.SPOOKY_COSTUMES:
self.holidayDecorator = HalloweenHolidayDecorator.HalloweenHolidayDecorator()
else:
self.holidayDecorator = HolidayDecorator.HolidayDecorator()
self.holidayDecorator.decorate()
messenger.send('decorator-holiday-%d-starting' % holidayId)
elif holidayId == ToontownGlobals.SILLY_SATURDAY_BINGO:
self.setBingoOngoing()
elif holidayId == ToontownGlobals.MORE_XP_HOLIDAY:
self.setMoreXpHolidayStart()
elif holidayId == ToontownGlobals.JELLYBEAN_DAY:
pass
elif holidayId == ToontownGlobals.CIRCUIT_RACING_EVENT:
self.setGrandPrixWeekendStart()
elif holidayId == ToontownGlobals.APRIL_FOOLS_COSTUMES:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addAprilToonsMenu()
elif holidayId == ToontownGlobals.WINTER_CAROLING:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addCarolMenu()
self.setWinterCarolingStart()
elif holidayId == ToontownGlobals.WACKY_WINTER_CAROLING:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addCarolMenu()
elif holidayId == ToontownGlobals.VALENTINES_DAY:
messenger.send('ValentinesDayStart')
base.localAvatar.setSystemMessage(0, TTLocalizer.ValentinesDayStart)
elif holidayId == ToontownGlobals.SILLY_CHATTER_ONE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseOneMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_TWO:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseTwoMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_THREE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseThreeMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_FOUR:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseFourMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_FIVE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSillyPhaseFiveMenu()
elif holidayId == ToontownGlobals.VICTORY_PARTY_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addVictoryPartiesMenu()
elif holidayId == ToontownGlobals.SELLBOT_NERF_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSellbotNerfHolidayStart()
base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotNerfMenu()
elif holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addJellybeanJamMenu(TTSCJellybeanJamMenu.JellybeanJamPhases.TROLLEY)
elif holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addJellybeanJamMenu(TTSCJellybeanJamMenu.JellybeanJamPhases.FISHING)
elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setJellybeanPartiesHolidayStart()
elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setJellybeanMonthHolidayStart()
elif holidayId == ToontownGlobals.BLACK_CAT_DAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setBlackCatHolidayStart()
elif holidayId == ToontownGlobals.SPOOKY_BLACK_CAT:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSpookyBlackCatHolidayStart()
elif holidayId == ToontownGlobals.LAUGHING_MAN:
if hasattr(base, 'localAvatar') and base.localAvatar:
self.setLaughingManHolidayStart()
elif holidayId == ToontownGlobals.TOP_TOONS_MARATHON:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setTopToonsMarathonStart()
elif holidayId == ToontownGlobals.SELLBOT_INVASION:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotInvasionMenu()
elif holidayId == ToontownGlobals.SELLBOT_FIELD_OFFICE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.addSellbotFieldOfficeMenu()
elif holidayId == ToontownGlobals.IDES_OF_MARCH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setIdesOfMarchStart()
base.localAvatar.chatMgr.chatInputSpeedChat.addIdesOfMarchMenu()
elif holidayId == ToontownGlobals.EXPANDED_CLOSETS:
self.setExpandedClosetsStart()
elif holidayId == ToontownGlobals.KARTING_TICKETS_HOLIDAY:
self.setKartingTicketsHolidayStart()
return True
return False
def endHoliday(self, holidayId):
if holidayId in self.holidayIdList:
self.notify.info('setHolidayId: Ending Holiday %s' % holidayId)
self.holidayIdList.remove(holidayId)
if holidayId in self.decorationHolidayIds:
self.decorationHolidayIds.remove(holidayId)
if holidayId == ToontownGlobals.HALLOWEEN_PROPS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu()
self.setHalloweenPropsHolidayEnd()
elif holidayId == ToontownGlobals.SPOOKY_PROPS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeHalloweenMenu()
self.setSpookyPropsHolidayEnd()
elif holidayId == ToontownGlobals.WINTER_DECORATIONS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu()
self.setWinterDecorationsEnd()
elif holidayId == ToontownGlobals.WACKY_WINTER_DECORATIONS:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeWinterMenu()
if hasattr(base.cr.playGame, 'dnaStore') and hasattr(base.cr.playGame, 'hood') and hasattr(base.cr.playGame.hood, 'loader'):
if holidayId == ToontownGlobals.HALLOWEEN_COSTUMES or holidayId == ToontownGlobals.SPOOKY_COSTUMES:
self.holidayDecorator = HalloweenHolidayDecorator.HalloweenHolidayDecorator()
else:
self.holidayDecorator = HolidayDecorator.HolidayDecorator()
self.holidayDecorator.undecorate()
messenger.send('decorator-holiday-%d-ending' % holidayId)
elif holidayId == ToontownGlobals.SILLY_SATURDAY_BINGO:
self.setBingoEnd()
elif holidayId == ToontownGlobals.MORE_XP_HOLIDAY:
self.setMoreXpHolidayEnd()
elif holidayId == ToontownGlobals.JELLYBEAN_DAY:
pass
elif holidayId == ToontownGlobals.CIRCUIT_RACING_EVENT:
self.setGrandPrixWeekendEnd()
elif holidayId == ToontownGlobals.APRIL_FOOLS_COSTUMES:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeAprilToonsMenu()
elif holidayId == ToontownGlobals.VALENTINES_DAY:
messenger.send('ValentinesDayStop')
base.localAvatar.setSystemMessage(0, TTLocalizer.ValentinesDayEnd)
elif holidayId == ToontownGlobals.SILLY_CHATTER_ONE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseOneMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_TWO:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseTwoMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_THREE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseThreeMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_FOUR:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseFourMenu()
elif holidayId == ToontownGlobals.SILLY_CHATTER_FIVE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSillyPhaseFiveMenu()
elif holidayId == ToontownGlobals.VICTORY_PARTY_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeVictoryPartiesMenu()
elif holidayId == ToontownGlobals.WINTER_CAROLING:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeCarolMenu()
elif holidayId == ToontownGlobals.WACKY_WINTER_CAROLING:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeCarolMenu()
elif holidayId == ToontownGlobals.SELLBOT_NERF_HOLIDAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSellbotNerfHolidayEnd()
base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotNerfMenu()
elif holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu()
elif holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_FISHING_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu()
elif holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY or holidayId == ToontownGlobals.JELLYBEAN_PARTIES_HOLIDAY_MONTH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setJellybeanPartiesHolidayEnd()
base.localAvatar.chatMgr.chatInputSpeedChat.removeJellybeanJamMenu()
elif holidayId == ToontownGlobals.BLACK_CAT_DAY:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setBlackCatHolidayEnd()
elif holidayId == ToontownGlobals.SPOOKY_BLACK_CAT:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setSpookyBlackCatHolidayEnd()
elif holidayId == ToontownGlobals.LAUGHING_MAN:
if hasattr(base, 'localAvatar') and base.localAvatar:
self.setLaughingManHolidayEnd()
elif holidayId == ToontownGlobals.TOP_TOONS_MARATHON:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
self.setTopToonsMarathonEnd()
elif holidayId == ToontownGlobals.SELLBOT_INVASION:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotInvasionMenu()
elif holidayId == ToontownGlobals.SELLBOT_FIELD_OFFICE:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeSellbotFieldOfficeMenu()
elif holidayId == ToontownGlobals.IDES_OF_MARCH:
if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr:
base.localAvatar.chatMgr.chatInputSpeedChat.removeIdesOfMarchMenu()
return True
return False
def setHolidayIdList(self, holidayIdList):
def isEnding(id):
return id not in holidayIdList
def isStarting(id):
return id not in self.holidayIdList
toEnd = filter(isEnding, self.holidayIdList)
for endingHolidayId in toEnd:
self.endHoliday(endingHolidayId)
toStart = filter(isStarting, holidayIdList)
for startingHolidayId in toStart:
self.startHoliday(startingHolidayId)
messenger.send('setHolidayIdList', [holidayIdList])
def getDecorationHolidayId(self):
return self.decorationHolidayIds
def getHolidayIdList(self):
return self.holidayIdList
def setBingoWin(self, zoneId):
base.localAvatar.setSystemMessage(0, 'Bingo congrats!')
def setBingoStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoStart)
def setBingoOngoing(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoOngoing)
def setBingoEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.FishBingoEnd)
def setCircuitRaceStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceStart)
def setCircuitRaceOngoing(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceOngoing)
def setCircuitRaceEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.CircuitRaceEnd)
def setMoreXpHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayStart)
def setMoreXpHolidayOngoing(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayOngoing)
def setMoreXpHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.MoreXpHolidayEnd)
def setJellybeanDayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanDayHolidayStart)
def setJellybeanDayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanDayHolidayEnd)
def setGrandPrixWeekendStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.GrandPrixWeekendHolidayStart)
def setGrandPrixWeekendEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.GrandPrixWeekendHolidayEnd)
def setSellbotNerfHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SellbotNerfHolidayStart)
def setSellbotNerfHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SellbotNerfHolidayEnd)
def setJellybeanTrolleyHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanTrolleyHolidayStart)
def setJellybeanTrolleyHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanTrolleyHolidayEnd)
def setJellybeanFishingHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanFishingHolidayStart)
def setJellybeanFishingHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanFishingHolidayEnd)
def setJellybeanPartiesHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanPartiesHolidayStart)
def setJellybeanMonthHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanMonthHolidayStart)
def setJellybeanPartiesHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.JellybeanPartiesHolidayEnd)
def setHalloweenPropsHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.HalloweenPropsHolidayStart)
def setHalloweenPropsHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.HalloweenPropsHolidayEnd)
def setSpookyPropsHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyPropsHolidayStart)
def setSpookyPropsHolidayEnd(self):
pass
def setBlackCatHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.BlackCatHolidayStart)
def setBlackCatHolidayEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.BlackCatHolidayEnd)
def setSpookyBlackCatHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyBlackCatHolidayStart)
for currToon in base.cr.toons.values():
currToon.setDNA(currToon.style.clone())
def setSpookyBlackCatHolidayEnd(self):
for currToon in base.cr.toons.values():
currToon.setDNA(currToon.style.clone())
def setLaughingManHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.LaughingManHolidayStart)
for currToon in base.cr.toons.values():
currToon.generateLaughingMan()
def setLaughingManHolidayEnd(self):
for currToon in base.cr.toons.values():
currToon.swapToonHead(laughingMan=currToon.getWantLaughingMan())
def setTopToonsMarathonStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonStart)
def setTopToonsMarathonEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.TopToonsMarathonEnd)
def setWinterDecorationsStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.WinterDecorationsStart)
def setWinterDecorationsEnd(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.WinterDecorationsEnd)
def setWackyWinterDecorationsStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.WackyWinterDecorationsStart)
def setWinterCarolingStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.WinterCarolingStart)
def setExpandedClosetsStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.ExpandedClosetsStart)
def setKartingTicketsHolidayStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.KartingTicketsHolidayStart)
def setIdesOfMarchStart(self):
base.localAvatar.setSystemMessage(0, TTLocalizer.IdesOfMarchStart)
def holidayNotify(self):
for id in self.holidayIdList:
if id == 20:
self.setCircuitRaceOngoing()
def setWeeklyCalendarHolidays(self, weeklyCalendarHolidays):
self.weeklyCalendarHolidays = weeklyCalendarHolidays
def getHolidaysForWeekday(self, day):
result = []
for item in self.weeklyCalendarHolidays:
if item[1] == day:
result.append(item[0])
return result
def setYearlyCalendarHolidays(self, yearlyCalendarHolidays):
self.yearlyCalendarHolidays = yearlyCalendarHolidays
def getYearlyHolidaysForDate(self, theDate):
result = []
for item in self.yearlyCalendarHolidays:
if item[1][0] == theDate.month and item[1][1] == theDate.day:
newItem = [self.YearlyHolidayType] + list(item)
result.append(tuple(newItem))
continue
if item[2][0] == theDate.month and item[2][1] == theDate.day:
newItem = [self.YearlyHolidayType] + list(item)
result.append(tuple(newItem))
return result
def setMultipleStartHolidays(self, multipleStartHolidays):
self.multipleStartHolidays = multipleStartHolidays
def getMultipleStartHolidaysForDate(self, theDate):
result = []
for theHoliday in self.multipleStartHolidays:
times = theHoliday[1:]
tempTimes = times[0]
for startAndStopTimes in tempTimes:
startTime = startAndStopTimes[0]
endTime = startAndStopTimes[1]
if startTime[0] == theDate.year and startTime[1] == theDate.month and startTime[2] == theDate.day:
fakeOncelyHoliday = [theHoliday[0], startTime, endTime]
newItem = [self.OncelyMultipleStartHolidayType] + fakeOncelyHoliday
result.append(tuple(newItem))
continue
if endTime[0] == theDate.year and endTime[1] == theDate.month and endTime[2] == theDate.day:
fakeOncelyHoliday = [theHoliday[0], startTime, endTime]
newItem = [self.OncelyMultipleStartHolidayType] + fakeOncelyHoliday
result.append(tuple(newItem))
return result
def setOncelyCalendarHolidays(self, oncelyCalendarHolidays):
self.oncelyCalendarHolidays = oncelyCalendarHolidays
def getOncelyHolidaysForDate(self, theDate):
result = []
for item in self.oncelyCalendarHolidays:
if item[1][0] == theDate.year and item[1][1] == theDate.month and item[1][2] == theDate.day:
newItem = [self.OncelyHolidayType] + list(item)
result.append(tuple(newItem))
continue
if item[2][0] == theDate.year and item[2][1] == theDate.month and item[2][2] == theDate.day:
newItem = [self.OncelyHolidayType] + list(item)
result.append(tuple(newItem))
return result
def setRelativelyCalendarHolidays(self, relativelyCalendarHolidays):
self.relativelyCalendarHolidays = relativelyCalendarHolidays
def getRelativelyHolidaysForDate(self, theDate):
result = []
self.weekDaysInMonth = []
self.numDaysCorMatrix = [(28, 0), (29, 1), (30, 2), (31, 3)]
for i in xrange(7):
self.weekDaysInMonth.append((i, 4))
for holidayItem in self.relativelyCalendarHolidays:
item = deepcopy(holidayItem)
newItem = []
newItem.append(item[0])
i = 1
while i < len(item):
sRepNum = item[i][1]
sWeekday = item[i][2]
eWeekday = item[i+1][2]
while 1:
eRepNum = item[i+1][1]
self.initRepMatrix(theDate.year, item[i][0])
while self.weekDaysInMonth[sWeekday][1] < sRepNum:
sRepNum -= 1
sDay = self.dayForWeekday(theDate.year, item[i][0], sWeekday, sRepNum)
self.initRepMatrix(theDate.year, item[i+1][0])
while self.weekDaysInMonth[eWeekday][1] < eRepNum:
eRepNum -= 1
nDay = self.dayForWeekday(theDate.year, item[i+1][0], eWeekday, eRepNum)
if ((nDay > sDay and
item[i+1][0] == item[i][0] and
(item[i+1][1] - item[i][1]) <= (nDay - sDay + abs(eWeekday - sWeekday))/7) or
item[i+1][0] != item[i][0]):
break
if self.weekDaysInMonth[eWeekday][1] > eRepNum:
eRepNum += 1
else:
item[i+1][0] += 1
item[i+1][1] = 1
newItem.append([item[i][0], sDay, item[i][3], item[i][4], item[i][5]])
newItem.append([item[i+1][0], nDay, item[i+1][3], item[i+1][4], item[i+1][5]])
i += 2
if item[1][0] == theDate.month and newItem[1][1] == theDate.day:
nItem = [self.RelativelyHolidayType] + list(newItem)
result.append(tuple(nItem))
continue
if item[2][0] == theDate.month and newItem[2][1] == theDate.day:
nItem = [self.RelativelyHolidayType] + list(newItem)
result.append(tuple(nItem))
return result
def dayForWeekday(self, year, month, weekday, repNum):
monthDays = calendar.monthcalendar(year, month)
if monthDays[0][weekday] == 0:
repNum += 1
return monthDays[repNum - 1][weekday]
def initRepMatrix(self, year, month):
for i in xrange(7):
self.weekDaysInMonth[i] = (i, 4)
startingWeekDay, numDays = calendar.monthrange(year, month)
for i in xrange(4):
if numDays == self.numDaysCorMatrix[i][0]:
break
for j in xrange(self.numDaysCorMatrix[i][1]):
self.weekDaysInMonth[startingWeekDay] = (self.weekDaysInMonth[startingWeekDay][0], self.weekDaysInMonth[startingWeekDay][1] + 1)
startingWeekDay = (startingWeekDay + 1) % 7
def isHolidayRunning(self, holidayId):
return holidayId in self.holidayIdList
def getHoliday(id):
if id.isdigit():
return int(id)
elif hasattr(ToontownGlobals, id):
return getattr(ToontownGlobals, id)
return -1
@magicWord(category=CATEGORY_PROGRAMMER, types=[str])
def startHoliday(id):
"""
Start a holiday.
"""
holiday = getHoliday(id.upper())
if holiday < 0:
return "Couldn't find holiday " + id + '!'
if base.cr.newsManager.startHoliday(holiday):
return 'Successfully started holiday ' + id + '!'
else:
return id + ' is already running!'
@magicWord(category=CATEGORY_PROGRAMMER, types=[str])
def endHoliday(id):
"""
End a holiday.
"""
holiday = getHoliday(id.upper())
if holiday < 0:
return "Couldn't find holiday " + id + '!'
if base.cr.newsManager.endHoliday(holiday):
return 'Successfully stopped holiday ' + id + '!'
else:
return id + ' is not running!'

View file

@ -1,77 +1,110 @@
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import globalClockDelta
from direct.task import Task
from toontown.effects.DistributedFireworkShowAI import DistributedFireworkShowAI
from toontown.effects import FireworkShows
from toontown.toonbase import ToontownGlobals
from toontown.parties import PartyGlobals
import HolidayGlobals
import datetime, random
class NewsManagerAI(DistributedObjectAI):
notify = directNotify.newCategory('NewsManagerAI')
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.activeHolidays = []
self.fireworkTask = None
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
self.__checkHolidays()
self.checkTask = taskMgr.doMethodLater(15, self.__checkHolidays, 'holidayCheckTask')
self.accept('avatarEntered', self.__handleAvatarEntered)
def __handleAvatarEntered(self, avatar):
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()
if self.air.suitInvasionManager.getInvading():
self.air.suitInvasionManager.notifyInvasionBulletin(avatar.getDoId())
self.air.suitInvasionManager.notifyInvasionBulletin(avId)
def isHolidayRunning(self, holidayId):
return False
self.sendUpdateToAvatarId(avId, 'setActiveHolidays', [self.activeHolidays])
def setPopulation(self, todo0):
pass
def getActiveHolidays(self):
return self.activeHolidays
def setBingoWin(self, todo0):
pass
def __checkHolidays(self, task=None):
date = datetime.datetime.utcnow().replace(tzinfo=HolidayGlobals.TIME_ZONE)
def setBingoStart(self):
pass
for id in HolidayGlobals.Holidays:
holiday = HolidayGlobals.Holidays[id]
running = self.isHolidayRunning(id)
def setBingoEnd(self):
pass
if self.isHolidayInRange(holiday, date):
if not running:
self.startHoliday(id)
elif running:
self.endHoliday(id)
def setCircuitRaceStart(self):
pass
return Task.again
def setCircuitRaceEnd(self):
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 setInvasionStatus(self, msgType, cogType, numRemaining, skeleton):
self.sendUpdate('setInvasionStatus', args=[msgType, cogType, numRemaining, skeleton])
def isHolidayRunning(self, id):
return id in self.activeHolidays
def setHolidayIdList(self, holidays):
self.sendUpdate('setHolidayIdList', holidays)
def startHoliday(self, id):
if id in self.activeHolidays or id not in HolidayGlobals.Holidays:
return
def holidayNotify(self):
pass
self.activeHolidays.append(id)
self.startSpecialHoliday(id)
self.sendUpdate('startHoliday', [id])
def setWeeklyCalendarHolidays(self, todo0):
pass
def endHoliday(self, id):
if id not in self.activeHolidays or id not in HolidayGlobals.Holidays:
return
def getWeeklyCalendarHolidays(self):
return []
self.activeHolidays.remove(id)
self.endSpecialHoliday(id)
self.sendUpdate('endHoliday', [id])
def setYearlyCalendarHolidays(self, todo0):
pass
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 getYearlyCalendarHolidays(self):
return []
def endSpecialHoliday(self, id):
if id == ToontownGlobals.FISH_BINGO or id == ToontownGlobals.SILLY_SATURDAY:
messenger.send('checkBingoState')
elif id in [ToontownGlobals.SUMMER_FIREWORKS, ToontownGlobals.NEW_YEAR_FIREWORKS]:
self.deleteFireworkTask()
def setOncelyCalendarHolidays(self, todo0):
pass
def startFireworks(self, type, again, task=None):
maxShow = len(FireworkShows.shows.get(type, [])) - 1
def getOncelyCalendarHolidays(self):
return []
for hood in self.air.hoods:
if hood.zoneId == ToontownGlobals.GolfZone:
continue
def setRelativelyCalendarHolidays(self, todo0):
pass
fireworkShow = DistributedFireworkShowAI(self.air)
fireworkShow.generateWithRequired(hood.zoneId)
fireworkShow.b_startShow(type, random.randint(0, maxShow), globalClockDelta.getRealNetworkTime())
def getRelativelyCalendarHolidays(self):
return []
def setMultipleStartHolidays(self, todo0):
pass
def getMultipleStartHolidays(self):
return []
def sendSystemMessage(self, todo0, todo1):
pass
return again

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -90,7 +90,11 @@ class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp)
pos = doorNP.getBounds().getCenter()
self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2))
d = duration * 0.125
track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChatText, TTLocalizer.DoorKnockKnock), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[0]), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[1]), Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4)), Func(self.cleanupTrack))
track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChatText, TTLocalizer.DoorKnockKnock), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[0]), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChatText, joke[1]))
if avatar == base.localAvatar:
track.append(Func(self.sendUpdate, 'requestToonup'))
track.append(Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4)))
track.append(Func(self.cleanupTrack))
track.delayDelete = DelayDelete.DelayDelete(avatar, 'knockKnockTrack')
return track

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 otp.ai.AIBaseGlobal import *
from toontown.toonbase import ToontownGlobals
import DistributedAnimatedPropAI
import time
class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedPropAI):
def __init__(self, air, propId):
@ -38,3 +35,12 @@ class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedP
DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitPlaying(self)
taskMgr.remove(self.doLaterTask)
self.doLaterTask = None
def requestToonup(self):
av = self.air.doId2do.get(self.air.getAvatarIdFromSender())
if (not av) or av.getHp() == av.getMaxHp() or av.getNextKnockHeal() > time.time():
return
av.toonUp(ToontownGlobals.KnockKnockHeal)
av.b_setNextKnockHeal(int(time.time() + ToontownGlobals.KnockKnockCooldown))

View file

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

View file

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

View file

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

View file

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

View file

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

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 toontown.toonbase import ToontownGlobals
from toontown.coghq import MoleFieldBase
@ -35,7 +35,7 @@ class MoleHill(NodePath):
self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm')
self.moleHead.reparentTo(self.mole)
moleColName = 'moleCol-%d-%s' % (self.moleField.doId, self.index)
moleSphere = CollisionSphere(0, 0, 0, 1.0)
moleSphere = CollisionTube(0, 0, 0, 0, 0, 1, 1)
collNode = CollisionNode(moleColName)
collNode.setIntoCollideMask(ToontownGlobals.WallBitmask)
collNode.addSolid(moleSphere)

View file

@ -393,9 +393,6 @@ class PlayGame(StateData.StateData):
base.localAvatar.chatMgr.obscure(1, 1)
base.localAvatar.obscureFriendsListButton(1)
requestStatus['how'] = 'tutorial'
if base.config.GetString('language', 'english') == 'japanese':
musicVolume = base.config.GetFloat('tutorial-music-volume', 0.5)
requestStatus['musicVolume'] = musicVolume
self.hood.enter(requestStatus)
def exitTutorialHood(self):
@ -557,8 +554,4 @@ class PlayGame(StateData.StateData):
return self.place
def getPlaceId(self):
if self.hood:
return self.hood.hoodId
else:
return None
return None
return self.hood.hoodId if self.hood else None

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,7 @@
from panda3d.core import *
from direct.interval.IntervalGlobal import *
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from direct.gui.DirectFrame import DirectFrame
from direct.gui.DirectLabel import DirectLabel
from toontown.toonbase import ToontownGlobals, TTLocalizer
class ScavengerHuntEffect:
images = None
@ -11,7 +9,9 @@ class ScavengerHuntEffect:
def __init__(self, beanAmount):
if not ScavengerHuntEffect.images:
ScavengerHuntEffect.images = loader.loadModel('phase_4/models/props/tot_jar')
self.npRoot = DirectFrame(parent=aspect2d, relief=None, scale=0.75, pos=(0, 0, 0.6))
if beanAmount > 0:
self.npRoot.setColorScale(VBase4(1, 1, 1, 0))
self.jar = DirectFrame(parent=self.npRoot, relief=None, image=ScavengerHuntEffect.images.find('**/tot_jar'))
@ -32,29 +32,19 @@ class ScavengerHuntEffect:
self.npRoot.setColorScale(VBase4(1, 1, 1, 0))
self.attemptFailedMsg()
self.track = Sequence(LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 1), startColorScale=VBase4(1, 1, 1, 0)), Wait(5), LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1)), Func(self.destroy))
return
def play(self):
if self.npRoot:
self.track.start()
def stop(self):
if self.track != None:
if self.track.isPlaying():
self.track.finish()
return
def cleanupIntervals(self, interval):
while len(interval) > 0:
if isinstance(interval[0], Sequence) or isinstance(interval[0], Parallel):
self.cleanupIntervals(interval[0])
interval.pop(0)
else:
interval.pop(0)
if self.track != None and self.track.isPlaying():
self.track.finish()
def destroy(self):
self.stop()
self.track = None
if hasattr(self, 'eventImage') and self.eventImage:
self.eventImage.detachNode()
del self.eventImage
@ -67,53 +57,38 @@ class ScavengerHuntEffect:
if hasattr(self, 'npRoot') and self.npRoot:
self.npRoot.destroy()
del self.npRoot
return
class TrickOrTreatTargetEffect(ScavengerHuntEffect):
def __init__(self, beanAmount):
ScavengerHuntEffect.__init__(self, beanAmount)
if beanAmount > 0:
self.pumpkin = DirectFrame(parent=self.eventImage, relief=None, image=ScavengerHuntEffect.images.find('**/tot_pumpkin_tall'))
return
def attemptFailedMsg(self):
pLabel = DirectLabel(parent=self.npRoot, relief=None, pos=(0.0, 0.0, -0.15), text=TTLocalizer.TrickOrTreatMsg, text_fg=(0.95, 0.5, 0.0, 1.0), text_scale=0.12, text_font=ToontownGlobals.getSignFont())
return
def destroy(self):
if hasattr(self, 'pumpkin') and self.pumpkin:
self.pumpkin.destroy()
ScavengerHuntEffect.destroy(self)
ScavengerHuntEffect.destroy(self)
class WinterCarolingEffect(ScavengerHuntEffect):
def __init__(self, beanAmount):
ScavengerHuntEffect.__init__(self, beanAmount)
if beanAmount > 0:
sm = loader.loadModel('phase_5.5/models/estate/tt_m_prp_ext_snowman_icon')
self.snowman = DirectFrame(parent=self.eventImage, relief=None, image=sm, scale=20.0)
return
def attemptFailedMsg(self):
pLabel = DirectLabel(parent=self.npRoot, relief=None, pos=(0.0, 0.0, -0.15), text=TTLocalizer.WinterCarolingMsg, text_fg=(0.9, 0.9, 1.0, 1.0), text_scale=0.12, text_font=ToontownGlobals.getSignFont())
return
def destroy(self):
if hasattr(self, 'snowman') and self.snowman:
self.snowman.destroy()
ScavengerHuntEffect.destroy(self)
class TrickOrTreatMilestoneEffect:
def __init__(self):
pass
def play(self):
pass
def stop(self):
pass

View file

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

View file

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

View file

@ -68,11 +68,3 @@ class EstateManager(DistributedObject.DistributedObject):
def removeFriend(self, ownerId, avId):
self.notify.debug('removeFriend ownerId = %s, avId = %s' % (ownerId, avId))
self.sendUpdate('removeFriend', [ownerId, avId])
def startAprilFools(self):
if isinstance(base.cr.playGame.getPlace(), Estate.Estate):
base.cr.playGame.getPlace().startAprilFoolsControls()
def stopAprilFools(self):
if isinstance(base.cr.playGame.getPlace(), Estate.Estate):
base.cr.playGame.getPlace().stopAprilFoolsControls()

View file

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

View file

@ -720,12 +720,3 @@ class PhysicsWorldBase:
someNodePathGeom = None
self.bodyList.append((None, body))
return (someNodePathGeom, body)
def attachMarker(self, body):
if self.canRender:
testMarker = render.attachNewNode('Joint Marker')
ballmodel = loader.loadModel('models/misc/sphere')
ballmodel.reparentTo(testMarker)
ballmodel.setScale(0.25)
testMarker.setPos(0.0, 0.0, -100.0)
self.odePandaRelationList.append((testMarker, body))

View file

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

View file

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

View file

@ -15,14 +15,10 @@ class DDHood(ToonHood):
SPOOKY_SKY_FILE = 'phase_3.5/models/props/BR_sky'
TITLE_COLOR = (0.8, 0.6, 0.5, 1.0)
underwaterColor = Vec4(0.0, 0.0, 0.6, 1.0)
HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ['phase_6/dna/winter_storage_DD.pdna'],
ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_6/dna/winter_storage_DD.pdna'],
ToontownGlobals.HALLOWEEN_PROPS: ['phase_6/dna/halloween_props_storage_DD.pdna'],
ToontownGlobals.SPOOKY_PROPS: ['phase_6/dna/halloween_props_storage_DD.pdna']}
def __init__(self, parentFSM, doneEvent, dnaStore, hoodId):
ToonHood.__init__(self, parentFSM, doneEvent, dnaStore, hoodId)
HOLIDAY_DNA = {
ToontownGlobals.CHRISTMAS: ['phase_6/dna/winter_storage_DD.pdna'],
ToontownGlobals.HALLOWEEN: ['phase_6/dna/halloween_props_storage_DD.pdna']}
def load(self):
ToonHood.load(self)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -30,10 +30,8 @@ class EstateHood(Hood):
self.storageDNAFile = 'phase_5.5/dna/storage_estate.pdna'
self.holidayStorageDNADict = {
WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'],
WACKY_WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'],
HALLOWEEN_PROPS: ['phase_5.5/dna/halloween_props_storage_estate.pdna'],
SPOOKY_PROPS: ['phase_5.5/dna/halloween_props_storage_estate.pdna']}
CHRISTMAS: ['phase_5.5/dna/winter_storage_estate.pdna'],
HALLOWEEN: ['phase_5.5/dna/halloween_props_storage_estate.pdna']}
self.skyFile = 'phase_3.5/models/props/TT_sky'
self.spookySkyFile = 'phase_3.5/models/props/BR_sky'

View file

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

View file

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

View file

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

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

View file

@ -16,7 +16,5 @@ class MMHood(ToonHood):
TITLE_COLOR = (1.0, 0.5, 0.5, 1.0)
HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ['phase_6/dna/winter_storage_MM.pdna'],
ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_6/dna/winter_storage_MM.pdna'],
ToontownGlobals.HALLOWEEN_PROPS: ['phase_6/dna/halloween_props_storage_MM.pdna'],
ToontownGlobals.SPOOKY_PROPS: ['phase_6/dna/halloween_props_storage_MM.pdna']}
ToontownGlobals.CHRISTMAS: ['phase_6/dna/winter_storage_MM.pdna'],
ToontownGlobals.HALLOWEEN: ['phase_6/dna/halloween_props_storage_MM.pdna']}

View file

@ -2,7 +2,7 @@ from toontown.hood import HoodAI
from toontown.safezone import DistributedTrolleyAI
from toontown.safezone import DistributedMMPianoAI
from toontown.toonbase import ToontownGlobals
from toontown.ai import DistributedTrickOrTreatTargetAI
from toontown.ai import DistributedEffectMgrAI
class MMHoodAI(HoodAI.HoodAI):
def __init__(self, air):
@ -24,9 +24,11 @@ class MMHoodAI(HoodAI.HoodAI):
self.piano = DistributedMMPianoAI.DistributedMMPianoAI(self.air)
self.piano.generateWithRequired(self.zoneId)
if simbase.air.wantHalloween:
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air)
self.TrickOrTreatTargetManager.generateWithRequired(4835)
self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12)
self.trickOrTreatMgr.generateWithRequired(4835) # Ursatz for Really Kool Katz, Tenor Terrace
self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14)
self.winterCarolingMgr.generateWithRequired(4614) # Shave and a Haircut for a Song, Alto Avenue
def createTrolley(self):
self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air)

View file

@ -69,9 +69,6 @@ class MailboxInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0)
def __init__(self, node):
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node)
def setupActor(self, node):
self.pieActor = Actor.Actor('phase_5/models/char/tt_r_prp_ext_piePackage', {'fightBoost': 'phase_5/models/char/tt_a_prp_ext_piePackage_fightBoost'})
self.pieActor.reparentTo(self.node)

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.partyActivityDoneEvent = 'partyActivityDone'
self.storageDNAFile = 'phase_13/dna/storage_party_sz.pdna'
self.holidayStorageDNADict = {WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna'],
WACKY_WINTER_DECORATIONS: ['phase_5.5/dna/winter_storage_estate.pdna']}
self.holidayStorageDNADict = {CHRISTMAS: ['phase_5.5/dna/winter_storage_estate.pdna']}
self.skyFile = 'phase_3.5/models/props/TT_sky'
self.popupInfo = None
return

View file

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

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.town.TTTownLoader import TTTownLoader
from toontown.toonbase import ToontownGlobals
from toontown.hood.ToonHood import ToonHood
from otp.ai.MagicWordGlobal import *
class TTHood(ToonHood):
notify = directNotify.newCategory('TTHood')
@ -18,11 +16,8 @@ class TTHood(ToonHood):
TITLE_COLOR = (1.0, 0.5, 0.4, 1.0)
HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ['phase_4/dna/winter_storage_TT.pdna', 'phase_4/dna/winter_storage_TT_sz.pdna'],
ToontownGlobals.WACKY_WINTER_DECORATIONS: ['phase_4/dna/winter_storage_TT.pdna', 'phase_4/dna/winter_storage_TT_sz.pdna'],
ToontownGlobals.HALLOWEEN_PROPS: ['phase_4/dna/halloween_props_storage_TT.pdna', 'phase_4/dna/halloween_props_storage_TT_sz.pdna'],
ToontownGlobals.SPOOKY_PROPS: ['phase_4/dna/halloween_props_storage_TT.pdna', 'phase_4/dna/halloween_props_storage_TT_sz.pdna']}
ToontownGlobals.CHRISTMAS: ['phase_4/dna/winter_storage_TT.pdna', 'phase_4/dna/winter_storage_TT_sz.pdna'],
ToontownGlobals.HALLOWEEN: ['phase_4/dna/halloween_props_storage_TT.pdna', 'phase_4/dna/halloween_props_storage_TT_sz.pdna']}
@magicWord(category=CATEGORY_CREATIVE)
def spooky():

View file

@ -5,9 +5,7 @@ from toontown.safezone import DistributedTrolleyAI
from toontown.toon import NPCToons
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from toontown.ai import DistributedTrickOrTreatTargetAI
from toontown.ai import DistributedWinterCarolingTargetAI
from toontown.ai import DistributedEffectMgrAI
class TTHoodAI(HoodAI.HoodAI):
def __init__(self, air):
@ -32,13 +30,11 @@ class TTHoodAI(HoodAI.HoodAI):
(ToontownGlobals.ToontownCentral, TTLocalizer.NPCToonNames[2021], ('dss', 'ls', 's', 'm', 13, 41, 13, 13, 1, 6, 1, 6, 0, 18, 0), 'm', 1, NPCToons.NPC_GLOVE),
ToontownGlobals.ToontownCentral, posIndex=0)
if simbase.air.wantHalloween:
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air)
self.TrickOrTreatTargetManager.generateWithRequired(2649)
self.trickOrTreatMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.HALLOWEEN, 12)
self.trickOrTreatMgr.generateWithRequired(2649) # All Fun and Games Shop, Silly Street
if simbase.air.wantChristmas:
self.WinterCarolingTargetManager = DistributedWinterCarolingTargetAI.DistributedWinterCarolingTargetAI(self.air)
self.WinterCarolingTargetManager.generateWithRequired(2649)
self.winterCarolingMgr = DistributedEffectMgrAI.DistributedEffectMgrAI(self.air, ToontownGlobals.CHRISTMAS, 14)
self.winterCarolingMgr.generateWithRequired(2659) # Joy Buzzers to the World, Silly Street
def shutdown(self):
HoodAI.HoodAI.shutdown(self)
@ -52,6 +48,7 @@ class TTHoodAI(HoodAI.HoodAI):
def createButterflies(self):
playground = ButterflyGlobals.TTC
ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.TTC)
for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.TTC]):
for _ in xrange(0, ButterflyGlobals.NUM_BUTTERFLIES[ButterflyGlobals.TTC]):
butterfly = DistributedButterflyAI.DistributedButterflyAI(self.air, playground, i, self.zoneId)

View file

@ -67,6 +67,3 @@ class TrashcanInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_trashcan_fightBoost', 'tt_a_ara_ddl_trashcan_fightCheer', 'tt_a_ara_ddl_trashcan_fightIdle')}
IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0)
def __init__(self, node):
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node)

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)
else:
self.notify.error('WHOA!! treasureIndex %s is out of range; numTreasures = %s' % (treasureIndex, numTreasures))
base.localAvatar.sendLogMessage('treasureIndex %s is out of range; numTreasures = %s' % (treasureIndex, numTreasures))
else:
self.notify.error('WHOA!! sectionIndex %s is out of range; numSections = %s' % (sectionIndex, numSections))
base.localAvatar.sendLogMessage('sectionIndex %s is out of range; numSections = %s' % (sectionIndex, numSections))
def __enemyShot(self, sectionIndex, enemyIndex):
self.sectionMgr.sections[sectionIndex].enemyMgr.enemies[enemyIndex].doShotTrack()

View file

@ -1,14 +1,11 @@
import datetime
import time
from pandac.PandaModules import TextNode, Vec3, Vec4, PlaneNode, Plane, Point3
from pandac.PandaModules import TextNode, PlaneNode, Plane
from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG
from direct.directnotify import DirectNotifyGlobal
from direct.gui import DirectGuiGlobals
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from toontown.ai import HolidayGlobals
from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.parties.PartyInfo import PartyInfo
from toontown.parties import PartyGlobals
from toontown.ai.NewsManager import NewsManager
import datetime
def myStrftime(myTime):
result = ''
@ -18,9 +15,7 @@ def myStrftime(myTime):
result += myTime.strftime(':%M %p')
return result
class CalendarGuiDay(DirectFrame):
notify = directNotify.newCategory('CalendarGuiDay')
ScrollListTextSize = 0.03
def __init__(self, parent, myDate, startDate, dayClickCallback = None, onlyFutureDaysClickable = False):
@ -30,27 +25,11 @@ class CalendarGuiDay(DirectFrame):
self.dayClickCallback = dayClickCallback
self.onlyFutureDaysClickable = onlyFutureDaysClickable
DirectFrame.__init__(self, parent=parent)
self.timedEvents = []
self.partiesInvitedToToday = []
self.hostedPartiesToday = []
self.yearlyHolidaysToday = []
self.showMarkers = base.config.GetBool('show-calendar-markers', 0)
self.filter = ToontownGlobals.CalendarFilterShowAll
self.load()
self.createGuiObjects()
self.update()
def createDummyLocators(self):
self.dayButtonLocator = self.attachNewNode('dayButtonLocator')
self.dayButtonLocator.setX(0.1)
self.dayButtonLocator.setZ(-0.05)
self.numberLocator = self.attachNewNode('numberLocator')
self.numberLocator.setX(0.09)
self.scrollLocator = self.attachNewNode('scrollLocator')
self.selectedLocator = self.attachNewNode('selectedLocator')
self.selectedLocator.setX(0.11)
self.selectedLocator.setZ(-0.06)
def load(self):
dayAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar_box')
dayAsset.reparentTo(self)
@ -65,21 +44,11 @@ class CalendarGuiDay(DirectFrame):
self.defaultBox = self.find('**/boxBlank')
self.scrollBottomRightLocator = self.find('**/loc_bottomRightList')
self.scrollDownLocator = self.find('**/loc_scrollDown')
self.attachMarker(self.scrollDownLocator)
self.scrollUpLocator = self.find('**/loc_scrollUp')
self.attachMarker(self.scrollUpLocator)
def attachMarker(self, parent, scale = 0.005, color = (1, 0, 0)):
if self.showMarkers:
marker = loader.loadModel('phase_3/models/misc/sphere')
marker.reparentTo(parent)
marker.setScale(scale)
marker.setColor(*color)
def createGuiObjects(self):
self.dayButton = DirectButton(parent=self.dayButtonLocator, image=self.selectedFrame, relief=None, command=self.__clickedOnDay, pressEffect=1, rolloverSound=None, clickSound=None)
self.numberWidget = DirectLabel(parent=self.numberLocator, relief=None, text=str(self.myDate.day), text_scale=0.04, text_align=TextNode.ACenter, text_font=ToontownGlobals.getInterfaceFont(), text_fg=Vec4(110 / 255.0, 126 / 255.0, 255 / 255.0, 1))
self.attachMarker(self.numberLocator)
self.numberWidget = DirectLabel(parent=self.numberLocator, relief=None, text=str(self.myDate.day), text_scale=0.04, text_align=TextNode.ACenter, text_font=ToontownGlobals.getInterfaceFont(), text_fg=(110 / 255.0, 126 / 255.0, 255 / 255.0, 1))
self.listXorigin = 0
self.listFrameSizeX = self.scrollBottomRightLocator.getX() - self.scrollLocator.getX()
self.scrollHeight = self.scrollLocator.getZ() - self.scrollBottomRightLocator.getZ()
@ -102,10 +71,10 @@ class CalendarGuiDay(DirectFrame):
self.scrollList = DirectScrolledList(parent=self.scrollLocator, relief=None, pos=(0, 0, 0), incButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), incButton_relief=None, incButton_scale=(self.arrowButtonXScale, 1, self.arrowButtonZScale), incButton_pos=incButtonPos, incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(arrowUp,
arrowUp), incButton_relief=None, incButton_scale=(self.arrowButtonXScale, 1, self.arrowButtonZScale), incButton_pos=incButtonPos, incButton_image3_color=(1, 1, 1, 0.2), decButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), decButton_relief=None, decButton_scale=(self.arrowButtonXScale, 1, -self.arrowButtonZScale), decButton_pos=decButtonPos, decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, -0.03), numItemsVisible=4, incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed)
arrowUp), decButton_relief=None, decButton_scale=(self.arrowButtonXScale, 1, -self.arrowButtonZScale), decButton_pos=decButtonPos, decButton_image3_color=(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, -0.03), numItemsVisible=4, incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed)
itemFrameParent = self.scrollList.itemFrame.getParent()
self.scrollList.incButton.reparentTo(self.scrollDownLocator)
self.scrollList.decButton.reparentTo(self.scrollUpLocator)
@ -113,10 +82,9 @@ class CalendarGuiDay(DirectFrame):
arrowDown.removeNode()
arrowHover.removeNode()
clipper = PlaneNode('clipper')
clipper.setPlane(Plane(Vec3(-1, 0, 0), Point3(0.23, 0, 0)))
clipper.setPlane(Plane((-1, 0, 0), (0.23, 0, 0)))
clipNP = self.scrollList.component('itemFrame').attachNewNode(clipper)
self.scrollList.component('itemFrame').setClipPlane(clipNP)
return
def scrollButtonPressed(self):
self.__clickedOnDay()
@ -141,59 +109,25 @@ class CalendarGuiDay(DirectFrame):
else:
self.defaultBox.show()
self.todayBox.hide()
return
def destroy(self):
if self.dayClickCallback is not None:
self.numberWidget.destroy()
self.dayClickCallback = None
self.notify.debug('desroying %s' % self.myDate)
try:
for item in self.scrollList['items']:
if hasattr(item, 'description') and item.description and hasattr(item.description, 'destroy'):
self.notify.debug('desroying description of item %s' % item)
item.unbind(DGG.ENTER)
item.unbind(DGG.EXIT)
item.description.destroy()
except e:
self.notify.debug('pass %s' % self.myDate)
pass
self.scrollList.removeAndDestroyAllItems()
self.scrollList.destroy()
self.dayButton.destroy()
DirectFrame.destroy(self)
return
def addWeeklyHolidays(self):
if not self.filter == ToontownGlobals.CalendarFilterShowAll and not self.filter == ToontownGlobals.CalendarFilterShowOnlyHolidays:
return
if base.cr.newsManager:
holidays = base.cr.newsManager.getHolidaysForWeekday(self.myDate.weekday())
holidayName = ''
holidayDesc = ''
for holidayId in holidays:
if holidayId in TTLocalizer.HolidayNamesInCalendar:
holidayName = TTLocalizer.HolidayNamesInCalendar[holidayId][0]
holidayDesc = TTLocalizer.HolidayNamesInCalendar[holidayId][1]
else:
holidayName = TTLocalizer.UnknownHoliday % holidayId
self.addTitleAndDescToScrollList(holidayName, holidayDesc)
self.scrollList.refresh()
if base.config.GetBool('calendar-test-items', 0):
if self.myDate.date() + datetime.timedelta(days=-1) == base.cr.toontownTimeManager.getCurServerDateTime().date():
testItems = ('1:00 AM Party', '2:00 AM CEO', '11:15 AM Party', '5:30 PM CJ', '11:00 PM Party', 'Really Really Long String')
for text in testItems:
newItem = DirectLabel(relief=None, text=text, text_scale=self.ScrollListTextSize, text_align=TextNode.ALeft)
self.scrollList.addItem(newItem)
if self.myDate.date() + datetime.timedelta(days=-2) == base.cr.toontownTimeManager.getCurServerDateTime().date():
testItems = ('1:00 AM Party', '3:00 AM CFO', '11:00 AM Party')
textSize = self.ScrollListTextSize
for text in testItems:
newItem = DirectLabel(relief=None, text=text, text_scale=textSize, text_align=TextNode.ALeft)
self.scrollList.addItem(newItem)
def updateArrowButtons(self):
numItems = 0
@ -210,208 +144,41 @@ class CalendarGuiDay(DirectFrame):
self.scrollList.decButton.show()
def collectTimedEvents(self):
self.timedEvents = []
if self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyParties:
for party in localAvatar.partiesInvitedTo:
if party.startTime.date() == self.myDate.date():
self.partiesInvitedToToday.append(party)
self.timedEvents.append((party.startTime.time(), party))
self.addPartyToScrollList(party)
for party in localAvatar.hostedParties:
if party.startTime.date() == self.myDate.date():
self.hostedPartiesToday.append(party)
self.timedEvents.append((party.startTime.time(), party))
self.addPartyToScrollList(party)
if base.cr.newsManager and (self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyHolidays):
base.cr.newsManager.setYearlyCalendarHolidays([(13, (10, 5, 0, 0), (10, 6, 12, 0)), (26, (10, 1, 0, 0), (11, 1, 0, 0))])
yearlyHolidays = base.cr.newsManager.getYearlyHolidaysForDate(self.myDate)
for holiday in yearlyHolidays:
holidayId = holiday[1]
holidayStart = holiday[2]
holidayEnd = holiday[3]
holidayType = holiday[0]
if holidayStart[0] == self.myDate.month and holidayStart[1] == self.myDate.day:
myTime = datetime.time(holidayStart[2], holidayStart[3])
elif holidayEnd[0] == self.myDate.month and holidayEnd[1] == self.myDate.day:
myTime = datetime.time(holidayEnd[2], holidayEnd[3])
else:
self.notify.error('holiday is not today %s' % holiday)
self.timedEvents.append((myTime, holiday))
if self.filter == ToontownGlobals.CalendarFilterShowAll or self.filter == ToontownGlobals.CalendarFilterShowOnlyHolidays:
for id, holiday in HolidayGlobals.Holidays.iteritems():
title, description = TTLocalizer.HolidayNamesInCalendar[id]
oncelyHolidays = base.cr.newsManager.getOncelyHolidaysForDate(self.myDate)
for holiday in oncelyHolidays:
holidayId = holiday[1]
holidayStart = holiday[2]
holidayEnd = holiday[3]
holidayType = holiday[0]
if holidayStart[0] == self.myDate.year and holidayStart[1] == self.myDate.month and holidayStart[2] == self.myDate.day:
myTime = datetime.time(holidayStart[3], holidayStart[4])
elif holidayEnd[0] == self.myDate.year and holidayEnd[1] == self.myDate.month and holidayEnd[2] == self.myDate.day:
myTime = datetime.time(holidayEnd[3], holidayEnd[4])
else:
self.notify.error('holiday is not today %s' % holiday)
self.timedEvents.append((myTime, holiday))
if 'weekDay' in holiday:
if self.myDate.weekday() == holiday['weekDay']:
self.addTitleAndDescToScrollList(title, description)
elif 'startMonth' in holiday or 'startDay' in holiday:
startDate = HolidayGlobals.getStartDate(holiday, self.myDate)
endDate = HolidayGlobals.getEndDate(holiday, self.myDate)
multipleStartHolidays = base.cr.newsManager.getMultipleStartHolidaysForDate(self.myDate)
for holiday in multipleStartHolidays:
holidayId = holiday[1]
holidayStart = holiday[2]
holidayEnd = holiday[3]
holidayType = holiday[0]
if holidayStart[0] == self.myDate.year and holidayStart[1] == self.myDate.month and holidayStart[2] == self.myDate.day:
myTime = datetime.time(holidayStart[3], holidayStart[4])
elif holidayEnd[0] == self.myDate.year and holidayEnd[1] == self.myDate.month and holidayEnd[2] == self.myDate.day:
myTime = datetime.time(holidayEnd[3], holidayEnd[4])
else:
self.notify.error('holiday is not today %s' % holiday)
self.timedEvents.append((myTime, holiday))
if self.isDateMatch(self.myDate, startDate):
if self.isDateMatch(startDate, endDate):
description = '%s. %s' % (title, description)
else:
description = '%s. %s %s %s' % (title, description, TTLocalizer.CalendarEndsAt, endDate.strftime('%b %d'))
relativelyHolidays = base.cr.newsManager.getRelativelyHolidaysForDate(self.myDate)
for holiday in relativelyHolidays:
holidayId = holiday[1]
holidayStart = holiday[2]
holidayEnd = holiday[3]
holidayType = holiday[0]
if holidayStart[0] == self.myDate.month and holidayStart[1] == self.myDate.day:
myTime = datetime.time(holidayStart[2], holidayStart[3])
elif holidayEnd[0] == self.myDate.month and holidayEnd[1] == self.myDate.day:
myTime = datetime.time(holidayEnd[2], holidayEnd[3])
else:
self.notify.error('holiday is not today %s' % holiday)
self.timedEvents.append((myTime, holiday))
self.addTitleAndDescToScrollList(title, description)
elif self.isDateMatch(self.myDate, endDate):
title = '%s %s' % (TTLocalizer.CalendarEndOf, title)
description = '%s. %s %s' % (title, TTLocalizer.CalendarStartedOn, startDate.strftime('%b %d'))
def timedEventCompare(te1, te2):
if te1[0] < te2[0]:
return -1
elif te1[0] == te2[0]:
return 0
else:
return 1
self.addTitleAndDescToScrollList(title, description)
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):
textSize = self.ScrollListTextSize
@ -429,7 +196,6 @@ class CalendarGuiDay(DirectFrame):
newItem.bind(DGG.ENTER, self.enteredTextItem, extraArgs=[newItem, desc, descUnderItemZAdjust])
newItem.bind(DGG.EXIT, self.exitedTextItem, extraArgs=[newItem])
self.scrollList.addItem(newItem)
return
def exitedTextItem(self, newItem, mousepos):
newItem.description.hide()
@ -473,7 +239,6 @@ class CalendarGuiDay(DirectFrame):
newItem.description.hide()
newItem.bind(DGG.ENTER, self.enteredTextItem, extraArgs=[newItem, newItem.description, descUnderItemZAdjust])
newItem.bind(DGG.EXIT, self.exitedTextItem, extraArgs=[newItem])
return
def __clickedOnScrollItem(self):
self.__clickedOnDay()
@ -488,7 +253,6 @@ class CalendarGuiDay(DirectFrame):
return
if self.dayClickCallback:
self.dayClickCallback(self)
self.notify.debug('we got clicked on %s' % self.myDate.date())
messenger.send('clickedOnDay', [self.myDate.date()])
def updateSelected(self, selected):
@ -513,7 +277,6 @@ class CalendarGuiDay(DirectFrame):
def update(self):
self.numberWidget['text'] = str(self.myDate.day)
self.adjustForMonth()
self.addWeeklyHolidays()
self.collectTimedEvents()
self.updateArrowButtons()
@ -524,7 +287,6 @@ class CalendarGuiDay(DirectFrame):
self.scrollList.removeAndDestroyAllItems()
self.update()
class MiniInviteVisual(DirectFrame):
def __init__(self, parent, partyInfo):
@ -544,7 +306,6 @@ class MiniInviteVisual(DirectFrame):
self.whosePartyLabel = DirectLabel(parent=self, relief=None, pos=(0.07, 0.0, -0.04), text=' ', text_scale=0.04, text_wordwrap=8, textMayChange=True)
self.whenTextLabel = DirectLabel(parent=self, relief=None, text=' ', pos=(0.07, 0.0, -0.13), text_scale=0.04, textMayChange=True)
self.partyStatusLabel = DirectLabel(parent=self, relief=None, text=' ', pos=(0.07, 0.0, -0.175), text_scale=0.04, textMayChange=True)
return
def show(self):
self.reparentTo(self.parent)

View file

@ -1,10 +1,8 @@
import calendar
from datetime import timedelta, datetime
from pandac.PandaModules import Vec4, TextNode
from pandac.PandaModules import TextNode
from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.parties.CalendarGuiDay import CalendarGuiDay
from datetime import timedelta, datetime
class CalendarGuiMonth(DirectFrame):
notify = directNotify.newCategory('CalendarGuiMonth')
@ -18,57 +16,19 @@ class CalendarGuiMonth(DirectFrame):
if self.onlyFutureDaysClickable:
self.onlyFutureMonthsClickable = True
DirectFrame.__init__(self, parent=parent, scale=scale, pos=pos)
self.showMarkers = base.config.GetBool('show-calendar-markers', 0)
self.load()
self.createGuiObjects()
self.lastSelectedDate = None
self.accept('clickedOnDay', self.clickedOnDay)
return
def createDummyLocators(self):
self.monthLocator = self.attachNewNode('monthLocator')
self.monthLocator.setZ(0.6)
self.weekDayLocators = []
for i in xrange(7):
self.weekDayLocators.append(self.attachNewNode('weekDayLocator-%d' % i))
self.weekDayLocators[i].setZ(0.5)
self.weekDayLocators[i].setX(i * 0.24 + -0.75)
dayTopLeftX = -0.8
dayTopLeftZ = 0.4
self.dayLocators = []
for row in xrange(6):
oneWeek = []
for col in xrange(7):
newDayLoc = self.attachNewNode('dayLocator-row-%d-col-%d' % (row, col))
newDayLoc.setX(col * 0.24 + dayTopLeftX)
newDayLoc.setZ(row * -0.18 + dayTopLeftZ)
oneWeek.append(newDayLoc)
self.dayLocators.append(oneWeek)
self.monthLeftLocator = self.attachNewNode('monthLeft')
self.monthLeftLocator.setPos(-0.3, 0, 0.65)
self.monthRightLocator = self.attachNewNode('monthRight')
self.monthRightLocator.setPos(0.3, 0, 0.65)
def attachMarker(self, parent, scale = 0.01, color = (1, 0, 0)):
if self.showMarkers:
marker = loader.loadModel('phase_3/models/misc/sphere')
marker.reparentTo(parent)
marker.setScale(scale)
marker.setColor(*color)
def load(self):
monthAsset = loader.loadModel('phase_4/models/parties/tt_m_gui_sbk_calendar')
monthAsset.reparentTo(self)
self.monthLocator = self.find('**/locator_month/locator_month')
self.attachMarker(self.monthLocator)
self.weekDayLocators = []
for weekday in ('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'):
weekDayLoc = self.find('**/loc_%s' % weekday)
self.weekDayLocators.append(weekDayLoc)
self.attachMarker(weekDayLoc)
self.dayLocators = []
for row in xrange(6):
@ -111,13 +71,13 @@ class CalendarGuiMonth(DirectFrame):
self.monthLeftArrow = DirectButton(parent=self.monthLeftLocator, relief=None, image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), image3_color=Vec4(1, 1, 1, 0.5), scale=(-1.0, 1.0, 1.0), command=self.__doMonthLeft)
arrowUp), image3_color=(1, 1, 1, 0.5), scale=(-1.0, 1.0, 1.0), command=self.__doMonthLeft)
if self.onlyFutureMonthsClickable:
self.monthLeftArrow.hide()
self.monthRightArrow = DirectButton(parent=self.monthRightLocator, relief=None, image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), image3_color=Vec4(1, 1, 1, 0.5), command=self.__doMonthRight)
arrowUp), image3_color=(1, 1, 1, 0.5), command=self.__doMonthRight)
def makeLabel(itemName, itemNum, *extraArgs):
return DirectLabel(text=itemName, frameColor=(0, 0, 0, 0), text_scale=0.04)
@ -131,12 +91,11 @@ class CalendarGuiMonth(DirectFrame):
self.filterList = DirectScrolledList(parent=self.filterLocator, relief=None, pos=(0, 0, 0), image=None, text_scale=0.025, incButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), incButton_relief=None, incButton_pos=filterLocatorDownPos, incButton_image3_color=Vec4(1, 1, 1, 0.2), incButtonCallback=self.filterChanged, decButton_image=(arrowUp,
arrowUp), incButton_relief=None, incButton_pos=filterLocatorDownPos, incButton_image3_color=(1, 1, 1, 0.2), incButtonCallback=self.filterChanged, decButton_image=(arrowUp,
arrowDown,
arrowHover,
arrowUp), decButton_relief=None, decButton_pos=filterLocatorUpPos, decButton_scale=(1, 1, -1), decButton_image3_color=Vec4(1, 1, 1, 0.2), decButtonCallback=self.filterChanged, numItemsVisible=1, itemMakeFunction=makeLabel, items=[TTLocalizer.CalendarShowAll, TTLocalizer.CalendarShowOnlyHolidays, TTLocalizer.CalendarShowOnlyParties], itemFrame_frameSize=(-.2, 0.2, -.02, 0.05), itemFrame_frameColor=(0, 0, 0, 0))
arrowUp), decButton_relief=None, decButton_pos=filterLocatorUpPos, decButton_scale=(1, 1, -1), decButton_image3_color=(1, 1, 1, 0.2), decButtonCallback=self.filterChanged, numItemsVisible=1, itemMakeFunction=makeLabel, items=[TTLocalizer.CalendarShowAll, TTLocalizer.CalendarShowOnlyHolidays, TTLocalizer.CalendarShowOnlyParties], itemFrame_frameSize=(-.2, 0.2, -.02, 0.05), itemFrame_frameColor=(0, 0, 0, 0))
gui.removeNode()
return
def getTopLeftDate(self):
firstOfTheMonth = self.curDate.replace(day=1)
@ -169,7 +128,7 @@ class CalendarGuiMonth(DirectFrame):
newMonth -= 12
while newMonth < 1:
if newYear - 1 > 1899:
if newYear - 1 > 2002:
newMonth += 12
newYear -= 1
else:
@ -206,7 +165,6 @@ class CalendarGuiMonth(DirectFrame):
self.filterList.destroy()
DirectFrame.destroy(self)
return
def clickedOnDay(self, dayDate):
self.lastSelectedDate = dayDate
@ -215,10 +173,7 @@ class CalendarGuiMonth(DirectFrame):
def updateSelectedDate(self):
if self.lastSelectedDate:
for oneGuiDay in self.guiDays:
if oneGuiDay.myDate.date() == self.lastSelectedDate:
oneGuiDay.updateSelected(True)
else:
oneGuiDay.updateSelected(False)
oneGuiDay.updateSelected(oneGuiDay.myDate.date() == self.lastSelectedDate)
def clearSelectedDay(self):
for oneGuiDay in self.guiDays:

View file

@ -22,7 +22,7 @@ class GlobalPartyManagerUD(DistributedObjectGlobalUD):
PARTY_TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
startTime = datetime.strptime('2014-01-20 11:50:00', PARTY_TIME_FORMAT)
endTime = datetime.strptime('2014-01-20 12:20:00', PARTY_TIME_FORMAT)
self.partyAllocator = UniqueIdAllocator(0, 100000000)
self.nextId = 0
#self.host2Party[100000001] = {'hostId': 100000001, 'start': startTime, 'end': endTime, 'partyId': 1717986918400000, 'decorations': [[3,5,7,6]], 'activities': [[10,13,6,18],[7,8,7,0]],'inviteTheme':1,'isPrivate':0,'inviteeIds':[]}
config = getConfigShowbase()
self.wantInstantParties = config.GetBool('want-instant-parties', 0)
@ -247,5 +247,6 @@ class GlobalPartyManagerUD(DistributedObjectGlobalUD):
def allocIds(self, numIds):
ids = []
while len(ids) < numIds:
ids.append(self.partyAllocator.allocate())
ids.append(self.nextId)
self.nextId += 1
self.sendToAI('receiveId', ids)

View file

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

View file

@ -46,10 +46,9 @@ class PartyEditor(DirectObject, FSM):
self.partyPlanner.gui.find('**/activitiesButtonDown_down'),
self.partyPlanner.gui.find('**/activitiesButtonDown_rollover'),
self.partyPlanner.gui.find('**/activitiesButtonDown_inactive')), incButton_relief=None, incButton_pos=(-0.05, 0.0, -0.94), itemFrame_pos=(pos[0], pos[1], pos[2] + 0.04), itemFrame_relief=None, numItemsVisible=1, items=[])
holidayIds = base.cr.newsManager.getHolidayIdList()
isWinter = ToontownGlobals.WINTER_DECORATIONS in holidayIds or ToontownGlobals.WACKY_WINTER_DECORATIONS in holidayIds
isVictory = ToontownGlobals.VICTORY_PARTY_HOLIDAY in holidayIds
isValentine = ToontownGlobals.VALENTINES_DAY in holidayIds
isWinter = base.cr.newsManager.isHolidayRunning(ToontownGlobals.CHRISTMAS)
isVictory = base.cr.newsManager.isHolidayRunning(ToontownGlobals.VICTORY_PARTY_HOLIDAY)
isValentine = base.cr.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY)
for activityId in PartyGlobals.PartyEditorActivityOrder:
if not isVictory and activityId in PartyGlobals.VictoryPartyActivityIds or not isWinter and activityId in PartyGlobals.WinterPartyActivityIds or not isValentine and activityId in PartyGlobals.ValentinePartyActivityIds:
pass

View file

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

View file

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

View file

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

View file

@ -293,7 +293,7 @@ class RaceWinningsPanel(DirectFrame):
else:
self.circuitTotalLabel.stash()
self.raceTotalLabel.unstash()
if ToontownGlobals.KARTING_TICKETS_HOLIDAY not in base.cr.newsManager.getHolidayIdList() or self.race.raceType != RaceGlobals.Practice:
if (not base.cr.newsManager.isHolidayRunning(ToontownGlobals.KARTING_TICKETS_HOLIDAY)) or self.race.raceType != RaceGlobals.Practice:
self.doubleTicketsLabel.stash()
if ticBonus:
ticketSeq.append(Sequence(Func(self.ticketFrame.hide), Func(self.bonusFrame.show), Func(self.trophyFrame.hide), Func(self.bonusComponents[0].configure, text=wrapStr(TTLocalizer.KartRace_RecordString % (TTLocalizer.KartRecordStrings[bonusType], TTLocalizer.KartRace_TrackNames[track], str(ticBonus)))), Wait(3)))

View file

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

View file

@ -59,6 +59,9 @@ class DistributedTreasure(DistributedObject.DistributedObject):
def loadModel(self):
modelPath, grabSoundPath = TreasureGlobals.TreasureModels[self.treasureType]
if base.cr.newsManager.isHolidayRunning(VALENTOONS_DAY):
modelPath = TreasureGlobals.ValentineTreasureModel
self.grabSound = base.loadSfx(grabSoundPath)
self.rejectSound = base.loadSfx(self.rejectSoundPath)
if self.nodePath == None:

View file

@ -65,7 +65,6 @@ class OZPlayground(Playground.Playground):
self.loader.hood.setUnderwaterFog()
base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8)
self.cameraSubmerged = 1
self.walkStateData.setSwimSoundAudible(1)
def __emergeCamera(self):
if self.cameraSubmerged == 0:
@ -73,7 +72,6 @@ class OZPlayground(Playground.Playground):
self.loader.hood.setNoFog()
self.loader.underwaterSound.stop()
self.cameraSubmerged = 0
self.walkStateData.setSwimSoundAudible(0)
def __submergeToon(self):
if self.toonSubmerged == 1:

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