They don't need more work

This commit is contained in:
John 2015-06-21 22:33:39 +03:00
parent 539afab9fe
commit 39b42edbda
19 changed files with 306 additions and 960 deletions

View file

@ -103,7 +103,6 @@ want-talkative-tyler #f
estate-day-night #t
want-garden-game #f
want-language-selection #t
active-holidays 64, 65, 66
# Developer options:
want-dev #f

View file

@ -260,10 +260,7 @@ class BattleCalculatorAI:
return
def __checkPropBonus(self, track):
result = False
if self.battle.getInteractivePropTrackBonus() == track:
result = True
return result
return self.battle.getInteractivePropTrackBonus() == track
def __targetDefense(self, suit, atkTrack):
if atkTrack == HEAL:

View file

@ -39,25 +39,6 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase):
self.ignore(self.PlayGameSetPlaceEvent)
self.removeCollisionData()
def setInteractivePropTrackBonus(self, trackBonus):
DistributedBattleBase.DistributedBattleBase.setInteractivePropTrackBonus(self, trackBonus)
if self.interactivePropTrackBonus >= 0:
if base.cr.playGame.hood:
self.calcInteractiveProp()
else:
self.acceptOnce(self.PlayGameSetPlaceEvent, self.calcInteractiveProp)
def calcInteractiveProp(self):
if base.cr.playGame.hood:
loader = base.cr.playGame.hood.loader
if hasattr(loader, 'getInteractiveProp'):
self.interactiveProp = loader.getInteractiveProp(self.zoneId)
self.notify.debug('self.interactiveProp = %s' % self.interactiveProp)
else:
self.notify.warning('no loader.getInteractiveProp self.interactiveProp is None')
else:
self.notify.warning('no hood self.interactiveProp is None')
def setMembers(self, suits, suitsJoining, suitsPending, suitsActive, suitsLured, suitTraps, toons, toonsJoining, toonsPending, toonsActive, toonsRunning, timestamp):
if self.battleCleanedUp():
return
@ -152,8 +133,10 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase):
if len(self.toons) > 0 and base.localAvatar == self.toons[0]:
Emote.globalEmote.disableAll(self.toons[0], 'dbattle, enterFaceOff')
self.__faceOff(ts, self.faceOffName, self.__handleFaceOffDone)
if self.interactiveProp:
self.interactiveProp.gotoFaceoff()
prop = self.getInteractiveProp()
if prop:
prop.gotoBattleCheer()
def __handleFaceOffDone(self):
self.notify.debug('FaceOff done')
@ -181,8 +164,10 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase):
toon.startSmooth()
self.accept('resumeAfterReward', self.handleResumeAfterReward)
if self.interactiveProp:
self.interactiveProp.gotoVictory()
prop = self.getInteractiveProp()
if prop:
prop.gotoVictory()
self.playReward(ts)
def playReward(self, ts):
@ -210,8 +195,10 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase):
self.notify.debug('enterResume()')
if self.hasLocalToon():
self.removeLocalToon()
if self.interactiveProp:
self.interactiveProp.requestIdleOrSad()
prop = self.getInteractiveProp()
if prop:
prop.requestIdleOrSad()
def exitResume(self):
pass

View file

@ -318,11 +318,25 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
def setBattleCellId(self, battleCellId):
pass
def setInteractivePropTrackBonus(self, trackBonus):
self.interactivePropTrackBonus = trackBonus
def getInteractiveProp(self):
if config.GetBool('want-anim-props', True):
if self.interactiveProp:
return self.interactiveProp
elif base.cr.playGame.hood and hasattr(base.cr.playGame.hood, 'loader'):
loader = base.cr.playGame.hood.loader
if hasattr(loader, 'getInteractiveProp'):
self.interactiveProp = base.cr.playGame.hood.loader.getInteractiveProp(self.zoneId)
return self.interactiveProp
return None
else:
return None
def getInteractivePropTrackBonus(self):
return self.interactivePropTrackBonus
prop = self.getInteractiveProp()
return prop.BattleTrack if prop else -1
def setPosition(self, x, y, z):
self.notify.debug('setPosition() - %d %d %d' % (x, y, z))
@ -363,12 +377,17 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
oldsuits = self.suits
self.suits = []
suitGone = 0
prop = self.getInteractiveProp()
for s in suits:
if s in self.cr.doId2do:
suit = self.cr.doId2do[s]
suit.setState('Battle')
self.suits.append(suit)
suit.interactivePropTrackBonus = self.interactivePropTrackBonus
if prop:
suit.interactivePropTrackBonus = prop.BattleTrack
try:
suit.battleTrap
except:
@ -1048,9 +1067,10 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
return Task.done
def enterWaitForInput(self, ts = 0):
self.notify.debug('enterWaitForInput()')
if self.interactiveProp:
self.interactiveProp.gotoBattleCheer()
prop = self.getInteractiveProp()
if prop:
prop.gotoBattleCheer()
self.choseAttackAlready = 0
if self.localToonActive():
self.__enterLocalToonWaitForInput()
@ -1242,7 +1262,10 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
if base.cr.playGame.getPlace() != None:
base.cr.playGame.getPlace().setState('battle', self.localToonBattleEvent)
if localAvatar and hasattr(localAvatar, 'inventory') and localAvatar.inventory:
localAvatar.inventory.setInteractivePropTrackBonus(self.interactivePropTrackBonus)
prop = self.getInteractiveProp()
if prop:
localAvatar.inventory.setInteractivePropTrackBonus(prop.BattleTrack)
camera.wrtReparentTo(self)
base.camLens.setMinFov(self.camFov/(4./3.))
return

View file

@ -400,8 +400,7 @@ class Movie(DirectObject.DirectObject):
if ival:
track.append(ival)
camTrack.append(camIval)
hasHealBonus = self.battle.getInteractivePropTrackBonus() == HEAL
ival, camIval = MovieHeal.doHeals(self.__findToonAttack(HEAL), hasHealBonus)
ival, camIval = MovieHeal.doHeals(self.__findToonAttack(HEAL), self.battle.getInteractivePropTrackBonus() == HEAL)
if ival:
track.append(ival)
camTrack.append(camIval)

View file

@ -1,44 +1,4 @@
from DistributedToonInteriorAI import *
from toontown.toonbase import ToontownGlobals
class DistributedToonHallInteriorAI(DistributedToonInteriorAI):
def __init__(self, block, air, zoneId, building):
DistributedToonInteriorAI.__init__(self, block, air, zoneId, building)
self.accept('ToonEnteredZone', self.logToonEntered)
self.accept('ToonLeftZone', self.logToonLeft)
def logToonEntered(self, avId, zoneId):
result = self.getCurPhase()
if result == -1:
phase = 'not available'
else:
phase = str(result)
self.air.writeServerEvent('sillyMeter', avId, 'enter|%s' % phase)
def logToonLeft(self, avId, zoneId):
result = self.getCurPhase()
if result == -1:
phase = 'not available'
else:
phase = str(result)
self.air.writeServerEvent('sillyMeter', avId, 'exit|%s' % phase)
def getCurPhase(self):
result = -1
enoughInfoToRun = False
if ToontownGlobals.SILLYMETER_HOLIDAY in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.SILLYMETER_HOLIDAY] != None and simbase.air.holidayManager.currentHolidays[ToontownGlobals.SILLYMETER_HOLIDAY].getRunningState():
if hasattr(simbase.air, 'SillyMeterMgr'):
enoughInfoToRun = True
else:
self.notify.debug('simbase.air does not have SillyMeterMgr')
else:
self.notify.debug('holiday is not running')
self.notify.debug('enoughInfoToRun = %s' % enoughInfoToRun)
if enoughInfoToRun and simbase.air.SillyMeterMgr.getIsRunning():
result = simbase.air.SillyMeterMgr.getCurPhase()
return result
def delete(self):
self.ignoreAll()
DistributedToonInteriorAI.delete(self)
pass

View file

@ -44,7 +44,6 @@ from toontown.toon import Toon, DistributedToon
from ToontownMsgTypes import *
import HoodMgr
import PlayGame
from toontown.hood import StreetSign
import random
@ -74,7 +73,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.catalogManager = None
self.tutorialManager = None
self.newsManager = None
self.streetSign = None
self.distributedDistrict = None
self.partyManager = None
self.lobbyManager = None
@ -84,7 +82,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.csm = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_CLIENT_SERVICES_MANAGER, 'ClientServicesManager')
self.ttsFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TTS_FRIENDS_MANAGER, 'TTSFriendsManager')
self.streetSign = None
self.furnitureManager = None
self.objectManager = None
self.openAvatarPanels = set()
@ -406,9 +403,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
base.localAvatar.defaultZone,
-1])
self._userLoggingOut = False
if not self.streetSign:
self.streetSign = StreetSign.StreetSign()
return
def exitPlayingGame(self):
ivalMgr.interrupt()

View file

@ -46,18 +46,6 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp):
def enter(self):
self.node.postFlatten()
AnimatedProp.AnimatedProp.enter(self)
doAnimLoop = True
try:
if type(self).__name__ == 'instance':
if self.__class__.__name__ == 'GenericAnimatedProp':
if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HYDRANTS_BUFF_BATTLES):
doAnimLoop = True
else:
doAnimLoop = False
except:
pass
if doAnimLoop:
self.node.loop('anim')
def exit(self):

View file

@ -2,235 +2,94 @@ from direct.actor import Actor
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import Sequence, Func
from toontown.hood import InteractiveAnimatedProp
from toontown.hood import GenericAnimatedProp
from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer
class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
notify = DirectNotifyGlobal.directNotify.newCategory('HydrantInteractiveProp')
BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.SQUIRT_TRACK]
ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_hydrant_idle0',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idle2',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idle1',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.FunnyFarm: (('tt_a_ara_ttc_hydrant_idle0',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idle2',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idle1',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DonaldsDock: (('tt_a_ara_ttc_hydrant_idle0',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idle2',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idle1',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_hydrant_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_hydrant_idle0',
3,
10,
'tt_a_ara_dga_hydrant_idle0settle',
3,
10),
('tt_a_ara_dga_hydrant_idleLook1',
1,
1,
None,
3,
10),
('tt_a_ara_dga_hydrant_idleSneeze2',
1,
1,
None,
3,
10),
('tt_a_ara_dga_hydrant_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_hydrant_idle0',
3,
10,
'tt_a_ara_mml_hydrant_idle0settle',
3,
10),
('tt_a_ara_mml_hydrant_idle2',
3,
10,
'tt_a_ara_mml_hydrant_idle2settle',
3,
10),
('tt_a_ara_mml_hydrant_idle1',
3,
10,
'tt_a_ara_mml_hydrant_idle1settle',
3,
10),
('tt_a_ara_mml_hydrant_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_hydrant_idleShiver1',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_hydrant_idleRubNose0',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_hydrant_idleSneeze2',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_hydrant_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_hydrant_idle0',
3,
10,
None,
0,
0),
('tt_a_ara_ddl_hydrant_idle1',
1,
1,
None,
0,
0),
('tt_a_ara_ddl_hydrant_idle2',
1,
1,
None,
0,
0),
('tt_a_ara_ddl_hydrant_idleAwesome3',
1,
1,
None,
0,
0))}
ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_idleIntoFight',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ddl_hydrant_idleIntoFight',
BattleTrack = ToontownBattleGlobals.SQUIRT_TRACK
BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack]
ZoneToIdles = {
ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_hydrant_idle0', 1, 1, None, 3, 10),
('tt_a_ara_ttc_hydrant_idle2', 1, 1, None, 3, 10),
('tt_a_ara_ttc_hydrant_idle1', 1, 1, None, 3, 10),
('tt_a_ara_ttc_hydrant_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DonaldsDock: (('tt_a_ara_ttc_hydrant_idle0', 1, 1, None, 3, 10),
('tt_a_ara_ttc_hydrant_idle2', 1, 1, None, 3, 10),
('tt_a_ara_ttc_hydrant_idle1', 1, 1, None, 3, 10),
('tt_a_ara_ttc_hydrant_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_hydrant_idle0', 3, 10, 'tt_a_ara_dga_hydrant_idle0settle', 3, 10),
('tt_a_ara_dga_hydrant_idleLook1', 1, 1, None, 3, 10),
('tt_a_ara_dga_hydrant_idleSneeze2', 1, 1, None, 3, 10),
('tt_a_ara_dga_hydrant_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_hydrant_idle0', 3, 10, 'tt_a_ara_mml_hydrant_idle0settle', 3, 10),
('tt_a_ara_mml_hydrant_idle2', 3, 10, 'tt_a_ara_mml_hydrant_idle2settle', 3, 10),
('tt_a_ara_mml_hydrant_idle1', 3, 10, 'tt_a_ara_mml_hydrant_idle1settle', 3, 10),
('tt_a_ara_mml_hydrant_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_hydrant_idleShiver1', 1, 1, None, 3, 10),
('tt_a_ara_tbr_hydrant_idleRubNose0', 1, 1, None, 3, 10),
('tt_a_ara_tbr_hydrant_idleSneeze2', 1, 1, None, 3, 10),
('tt_a_ara_tbr_hydrant_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_hydrant_idle0', 3, 10, None, 0, 0),
('tt_a_ara_ddl_hydrant_idle1', 1, 1, None, 0, 0),
('tt_a_ara_ddl_hydrant_idle2', 1, 1, None, 0, 0),
('tt_a_ara_ddl_hydrant_idleAwesome3', 1, 1, None, 0, 0))}
ZoneToIdleIntoFightAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_idleIntoFight',
ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_idleIntoFight',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_idleIntoFight',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_idleIntoFight',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_idleIntoFight',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_idleIntoFight'}
ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_victoryDance',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_hydrant_victoryDance',
ZoneToVictoryAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_victoryDance',
ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_victoryDance',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_victoryDance',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_victoryDance',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_victoryDance',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_victoryDance'}
ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_fightSad',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_hydrant_fightSad',
ZoneToSadAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_fightSad',
ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_fightSad',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_fightSad',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_fightSad',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_fightSad',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_fightSad'}
ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'),
ToontownGlobals.FunnyFarm: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'),
ZoneToFightAnims = {
ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'),
ToontownGlobals.DonaldsDock: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'),
ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_hydrant_fightBoost', 'tt_a_ara_dga_hydrant_fightCheer', 'tt_a_ara_dga_hydrant_fightIdle'),
ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_hydrant_fightBoost', 'tt_a_ara_mml_hydrant_fightCheer', 'tt_a_ara_mml_hydrant_fightIdle'),
ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_hydrant_fightBoost', 'tt_a_ara_tbr_hydrant_fightCheer', 'tt_a_ara_tbr_hydrant_fightIdle'),
ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_hydrant_fightBoost', 'tt_a_ara_ddl_hydrant_fightCheer', 'tt_a_ara_ddl_hydrant_fightIdle')}
IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0)
def __init__(self, node):
self.leftWater = None
self.rightWater = None
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.HYDRANTS_BUFF_BATTLES)
return
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node)
def setupActor(self, node):
InteractiveAnimatedProp.InteractiveAnimatedProp.setupActor(self, node)
if not self.hoodId == ToontownGlobals.TheBrrrgh:
water = loader.loadModel('phase_5/models/char/tt_m_efx_hydrantSquirt')
self.leftWater = water.find('**/efx_hydrantSquirtLeft')
self.rightWater = water.find('**/efx_hydrantSquirtRight')
dx_left_water = self.node.find('**/dx_left_water')
if self.leftWater:
self.leftWater.reparentTo(dx_left_water)
self.leftWater.reparentTo(self.node.find('**/dx_left_water'))
base.leftWater = self.leftWater
self.leftWater.hide()
else:
self.notify.warning('couldnt find %s in rig for hood %d' % ('dx_left_water', self.hoodId))
dx_right_water = self.node.find('**/dx_right_water')
if self.rightWater:
self.rightWater.reparentTo(dx_right_water)
self.rightWater.reparentTo(self.node.find('**/dx_right_water'))
self.rightWater.hide()
else:
self.notify.warning('couldnt find %s in rig for hood %d' % ('dx_left_water', self.hoodId))
def hideWater(self):
if self.leftWater:
@ -245,20 +104,15 @@ class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
self.rightWater.show()
def hasOverrideIval(self, origAnimName):
result = False
if ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh:
result = True
return result
return ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh
def getOverrideIval(self, origAnimName):
result = Sequence()
if ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh:
if self.hasOverrideIval(origAnimName):
result.append(Func(self.showWater))
if 'fightBoost' in origAnimName:
animKey = 'fight0'
else:
animKey = 'fight1'
animAndSound = self.createAnimAndSoundIval(animKey)
result.append(animAndSound)
anim = self.createAnimIval('fight0' if 'fightBoost' in origAnimName else 'fight1')
result.append(anim)
result.append(Func(self.hideWater))
return result

View file

@ -2,7 +2,7 @@ import math
import random
import GenericAnimatedProp
from direct.actor import Actor
from direct.interval.IntervalGlobal import Sequence, ActorInterval, Wait, Func, SoundInterval, Parallel
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
@ -30,9 +30,8 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
HpTextGenerator = TextNode('HpTextGenerator')
BattleCheerText = '+'
def __init__(self, node, holidayId = -1):
def __init__(self, node):
FSM.FSM.__init__(self, 'InteractiveProp-%s' % str(node))
self.holidayId = holidayId
self.numIdles = 0
self.numFightAnims = 0
self.idleInterval = None
@ -45,11 +44,9 @@ 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)
return
def delete(self):
self.exit()
@ -58,7 +55,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
self.battleCheerInterval = None
self.sadInterval = None
self.victoryInterval = None
return
def getCellIndex(self):
return self.cellIndex
@ -114,7 +110,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
self.battleCheerInterval = self.createBattleCheerInterval()
self.victoryInterval = self.createVictoryInterval()
self.sadInterval = self.createSadInterval()
return
def createIdleInterval(self):
result = Sequence()
@ -159,14 +154,14 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
result = Sequence()
for i in xrange(self.numFightAnims):
animKey = 'fight%d' % i
animAndSoundIval = self.createAnimAndSoundIval(animKey)
animIval = self.createAnimIval(animKey)
origAnimName = self.node.getAnimFilename(animKey).split('/')[-1]
if self.hasOverrideIval(origAnimName):
result.append(self.getOverrideIval(origAnimName))
elif self.hasSpecialIval(origAnimName):
result.append(Parallel(animAndSoundIval, self.getSpecialIval(origAnimName)))
result.append(Parallel(animIval, self.getSpecialIval(origAnimName)))
else:
result.append(animAndSoundIval)
result.append(animIval)
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))
@ -176,7 +171,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def createSadInterval(self):
result = Sequence()
if self.hoodId in self.ZoneToSadAnims:
result = self.createAnimAndSoundIval('sad')
result = self.createAnimIval('sad')
return result
def hasSpecialIval(self, origAnimName):
@ -194,26 +189,17 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def createVictoryInterval(self):
result = Sequence()
if self.hoodId in self.ZoneToVictoryAnims:
animAndSoundIval = self.createAnimAndSoundIval('victory')
result.append(animAndSoundIval)
animIval = self.createAnimIval('victory')
result.append(animIval)
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')
if base.cr.newsManager.isHolidayRunning(self.holidayId):
self.notify.debug('holiday is running, doing idle interval')
self.node.stop()
self.node.pose('idle0', 0)
if base.config.GetBool('interactive-prop-random-idles', 1):
self.requestIdleOrSad()
else:
self.idleInterval.loop()
else:
self.notify.debug('holiday is NOT running, doing nothing')
self.node.stop()
self.node.pose('idle0', 0)
else:
self.notify.debug('props do not buff battles')
self.node.stop()
@ -288,8 +274,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
whichAnim = self.chooseIdleAnimToRun()
if self.visId == localAvatar.zoneId:
self.notify.debug('whichAnim=%s' % whichAnim)
if __dev__:
self.notify.info('whichAnim=%s %s' % (whichAnim, self.getOrigIdleAnimName(whichAnim)))
self.lastPlayingAnimPhase = whichAnim
self.curIval = self.createIdleAnimSequence(whichAnim)
self.notify.debug('starting curIval of length %s' % self.curIval.getDuration())
@ -299,28 +283,25 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
self.notify.debug('false self.okToStartNextAnim=%s' % self.okToStartNextAnim)
return
def createIdleAnimAndSoundInterval(self, whichIdleAnim, startingTime = 0):
def createIdleAnimInterval(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)
idleAnimAndSound = Parallel(animIval, soundIval, specialIval)
return Parallel(animIval, specialIval)
else:
idleAnimAndSound = Parallel(animIval, soundIval)
return idleAnimAndSound
return animIval
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
idleAnimAndSound = self.createIdleAnimAndSoundInterval(whichIdleAnim)
result = Sequence(idleAnimAndSound, Wait(self.IdlePauseTime), Func(self.startNextIdleAnim))
idleAnim = self.createIdleAnimInterval(whichIdleAnim)
result = Sequence(idleAnim, 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]
@ -333,7 +314,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
pauseTime = random.randrange(minPauseTime, maxPauseTime + 1)
result = Sequence()
for i in xrange(numberOfLoops):
result.append(idleAnimAndSound)
result.append(idleAnim)
if self.getSettleName(whichIdleAnim):
result.append(self.node.actorInterval('settle%d' % whichIdleAnim))
@ -343,39 +324,24 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
def gotoFaceoff(self):
self.notify.debugStateCall(self)
if base.cr.newsManager.isHolidayRunning(self.holidayId):
self.request('Faceoff')
else:
self.notify.debug('not going to faceoff because holiday %d is not running' % self.holidayId)
def gotoBattleCheer(self):
self.notify.debugStateCall(self)
if base.cr.newsManager.isHolidayRunning(self.holidayId):
self.request('BattleCheer')
else:
self.notify.debug('not going to battleCheer because holiday %d is not running' % self.holidayId)
def gotoIdle(self):
self.notify.debugStateCall(self)
if base.cr.newsManager.isHolidayRunning(self.holidayId):
self.request('DoIdleAnim')
else:
self.notify.debug('not going to idle because holiday %d is not running' % self.holidayId)
def gotoVictory(self):
self.notify.debugStateCall(self)
if base.cr.newsManager.isHolidayRunning(self.holidayId):
self.request('Victory')
else:
self.notify.debug('not going to victory because holiday %d is not running' % self.holidayId)
def gotoSad(self, buildingDoId):
self.notify.debugStateCall(self)
self.buildingsMakingMeSad.add(buildingDoId)
if base.cr.newsManager.isHolidayRunning(self.holidayId):
self.request('Sad')
else:
self.notify.debug('not going to sad because holiday %d is not running' % self.holidayId)
def buildingLiberated(self, buildingDoId):
self.buildingsMakingMeSad.discard(buildingDoId)
@ -391,7 +357,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
self.notify.debugStateCall(self)
self.curIval.pause()
self.curIval = None
return
def calcWhichIdleAnim(self, animName):
result = 0
@ -412,9 +377,9 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
result = Sequence()
if self.lastIdleAnimName:
whichIdleAnim = self.calcWhichIdleAnim(self.lastIdleAnimName)
animAndSound = self.createIdleAnimAndSoundInterval(whichIdleAnim, self.lastIdleTime)
result.append(animAndSound)
idleIntoFightIval = self.createAnimAndSoundIval('idleIntoFight')
anim = self.createIdleAnimInterval(whichIdleAnim, self.lastIdleTime)
result.append(anim)
idleIntoFightIval = self.createAnimIval('idleIntoFight')
result.append(idleIntoFightIval)
result.append(Func(self.gotoBattleCheer))
return result
@ -472,37 +437,18 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
result = self.ZoneToIdles[self.hoodId][whichIdleAnim]
return result
def createAnimAndSoundIval(self, animKey):
def createAnimIval(self, animKey):
animIval = self.node.actorInterval(animKey)
animIvalDuration = animIval.getDuration()
origAnimName = self.node.getAnimFilename(animKey)
soundIval = self.createSoundInterval(origAnimName, animIvalDuration)
soundIvalDuration = soundIval.getDuration()
printFunc = Func(self.printAnimIfClose, animKey)
if self.hasSpecialIval(origAnimName):
specialIval = self.getSpecialIval(origAnimName)
idleAnimAndSound = Parallel(animIval, soundIval, specialIval)
if base.config.GetBool('interactive-prop-info', False):
idleAnimAndSound.append(printFunc)
return Parallel(animIval, specialIval)
else:
idleAnimAndSound = Parallel(animIval, soundIval)
if base.config.GetBool('interactive-prop-info', False):
idleAnimAndSound.append(printFunc)
return idleAnimAndSound
def printAnimIfClose(self, animKey):
if base.config.GetBool('interactive-prop-info', False):
try:
animName = self.node.getAnimFilename(animKey)
baseAnimName = animName.split('/')[-1]
if localAvatar.zoneId == self.visId:
self.notify.info('playing %s' % baseAnimName)
except Exception, e:
self.notify.warning('Unknown error in printAnimIfClose, giving up:\n%s' % str(e))
return animIval
def clearCurIval(self):
if self.curIval:
self.curIval.finish()
clearPythonIvals(self.curIval)
self.curIval = None
return

View file

@ -2,229 +2,92 @@ from direct.actor import Actor
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import Sequence, Func
from toontown.hood import InteractiveAnimatedProp
from toontown.hood import GenericAnimatedProp
from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer
class MailboxInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
notify = DirectNotifyGlobal.directNotify.newCategory('MailboxInteractiveProp')
BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.THROW_TRACK]
ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_mailbox_idle0',
3,
10,
'tt_a_ara_ttc_mailbox_idle0settle',
3,
10),
('tt_a_ara_ttc_mailbox_idleTake2',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_mailbox_idleLook1',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_mailbox_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.FunnyFarm: (('tt_a_ara_ttc_mailbox_idle0',
3,
10,
'tt_a_ara_ttc_mailbox_idle0settle',
3,
10),
('tt_a_ara_ttc_mailbox_idleTake2',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_mailbox_idleLook1',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_mailbox_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_mailbox_idle0',
3,
10,
'tt_a_ara_dod_mailbox_idle0settle',
3,
10),
('tt_a_ara_dod_mailbox_idle2',
1,
1,
None,
3,
10),
('tt_a_ara_dod_mailbox_idle1',
1,
1,
None,
3,
10),
('tt_a_ara_dod_mailbox_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_mailbox_idle0',
3,
10,
'tt_a_ara_dga_mailbox_idle0settle',
3,
10),
('tt_a_ara_dga_mailbox_idleTake1',
1,
1,
None,
3,
10),
('tt_a_ara_dga_mailbox_idleLook2',
1,
1,
None,
3,
10),
('tt_a_ara_dga_mailbox_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_mailbox_idle0',
3,
10,
'tt_a_ara_mml_mailbox_idle0settle',
3,
10),
('tt_a_ara_mml_mailbox_idleTake1',
1,
1,
None,
3,
10),
('tt_a_ara_mml_mailbox_idleLook2',
1,
1,
None,
3,
10),
('tt_a_ara_mml_mailbox_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_mailbox_idleShiver1',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_mailbox_idleSneeze2',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_mailbox_idleSpin0',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_mailbox_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_mailbox_idleSleep0',
3,
10,
None,
0,
0),
('tt_a_ara_ddl_mailbox_idleShake2',
1,
1,
None,
0,
0),
('tt_a_ara_ddl_mailbox_idleSnore1',
1,
1,
None,
0,
0),
('tt_a_ara_ddl_mailbox_idleAwesome3',
1,
1,
None,
0,
0))}
ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_idleIntoFight',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_mailbox_idleIntoFight',
BattleTrack = ToontownBattleGlobals.THROW_TRACK
BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack]
ZoneToIdles = {
ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_mailbox_idle0', 3, 10, 'tt_a_ara_ttc_mailbox_idle0settle', 3, 10),
('tt_a_ara_ttc_mailbox_idleTake2', 1, 1, None, 3, 10),
('tt_a_ara_ttc_mailbox_idleLook1', 1, 1, None, 3, 10),
('tt_a_ara_ttc_mailbox_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_mailbox_idle0', 3, 10, 'tt_a_ara_dod_mailbox_idle0settle', 3, 10),
('tt_a_ara_dod_mailbox_idle2', 1, 1, None, 3, 10),
('tt_a_ara_dod_mailbox_idle1', 1, 1, None, 3, 10),
('tt_a_ara_dod_mailbox_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_mailbox_idle0', 3, 10, 'tt_a_ara_dga_mailbox_idle0settle', 3, 10),
('tt_a_ara_dga_mailbox_idleTake1', 1, 1, None, 3, 10),
('tt_a_ara_dga_mailbox_idleLook2', 1, 1, None, 3, 10),
('tt_a_ara_dga_mailbox_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_mailbox_idle0', 3, 10, 'tt_a_ara_mml_mailbox_idle0settle', 3, 10),
('tt_a_ara_mml_mailbox_idleTake1', 1, 1, None, 3, 10),
('tt_a_ara_mml_mailbox_idleLook2', 1, 1, None, 3, 10),
('tt_a_ara_mml_mailbox_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_mailbox_idleShiver1', 1, 1, None, 3, 10),
('tt_a_ara_tbr_mailbox_idleSneeze2', 1, 1, None, 3, 10),
('tt_a_ara_tbr_mailbox_idleSpin0', 1, 1, None, 3, 10),
('tt_a_ara_tbr_mailbox_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_mailbox_idleSleep0', 3, 10, None, 0, 0),
('tt_a_ara_ddl_mailbox_idleShake2', 1, 1, None, 0, 0),
('tt_a_ara_ddl_mailbox_idleSnore1', 1, 1, None, 0, 0),
('tt_a_ara_ddl_mailbox_idleAwesome3', 1, 1, None, 0, 0))}
ZoneToIdleIntoFightAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_idleIntoFight',
ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_idleIntoFight',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_idleIntoFight',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_idleIntoFight',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_idleIntoFight',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_idleIntoFight'}
ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_victoryDance',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_mailbox_victoryDance',
ZoneToVictoryAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_victoryDance',
ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_victoryDance',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_victoryDance',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_victoryDance',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_victoryDance',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_victoryDance'}
ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_fightSad',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_mailbox_fightSad',
ZoneToSadAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_fightSad',
ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_fightSad',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_fightSad',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_fightSad',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_fightSad',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_fightSad'}
ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_mailbox_fightBoost', 'tt_a_ara_ttc_mailbox_fightCheer', 'tt_a_ara_ttc_mailbox_fightIdle'),
ToontownGlobals.FunnyFarm: ('tt_a_ara_ttc_mailbox_fightBoost', 'tt_a_ara_ttc_mailbox_fightCheer', 'tt_a_ara_ttc_mailbox_fightIdle'),
ZoneToFightAnims = {
ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_mailbox_fightBoost', 'tt_a_ara_ttc_mailbox_fightCheer', 'tt_a_ara_ttc_mailbox_fightIdle'),
ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_mailbox_fightBoost', 'tt_a_ara_dod_mailbox_fightCheer', 'tt_a_ara_dod_mailbox_fightIdle'),
ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_mailbox_fightBoost', 'tt_a_ara_dga_mailbox_fightCheer', 'tt_a_ara_dga_mailbox_fightIdle'),
ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_mailbox_fightBoost', 'tt_a_ara_mml_mailbox_fightCheer', 'tt_a_ara_mml_mailbox_fightIdle'),
ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_mailbox_fightBoost', 'tt_a_ara_tbr_mailbox_fightCheer', 'tt_a_ara_tbr_mailbox_fightIdle'),
ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_mailbox_fightBoost', 'tt_a_ara_ddl_mailbox_fightCheer', 'tt_a_ara_ddl_mailbox_fightIdle')}
IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0)
def __init__(self, node):
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.MAILBOXES_BUFF_BATTLES)
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)
self.pieActor.hide()
InteractiveAnimatedProp.InteractiveAnimatedProp.setupActor(self, node)
def hasSpecialIval(self, origAnimName):
result = False
if 'fightBoost' in origAnimName:
result = True
return result
return 'fightBoost' in origAnimName
def getSpecialIval(self, origAnimName):
result = Sequence()
if 'fightBoost' in origAnimName:
if self.hasSpecialIval(origAnimName):
result.append(Func(self.pieActor.show))
result.append(self.pieActor.actorInterval('fightBoost'))
result.append(Func(self.pieActor.hide))
return result

View file

@ -1,66 +0,0 @@
import os
import shutil
import datetime
from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject
from direct.showbase import AppRunnerGlobal
from toontown.toonbase import TTLocalizer
class StreetSign(DistributedObject.DistributedObject):
RedownloadTaskName = 'RedownloadStreetSign'
StreetSignFileName = config.GetString('street-sign-filename', 'texture.jpg')
StreetSignBaseDir = config.GetString('street-sign-base-dir', 'sign')
StreetSignUrl = base.config.GetString('street-sign-url', 'http://cdn.toontown.disney.go.com/toontown/en/street-signs/img/')
notify = DirectNotifyGlobal.directNotify.newCategory('StreetSign')
def __init__(self):
self.downloadingStreetSign = False
self.percentDownloaded = 0.0
self.startDownload = datetime.datetime.now()
self.endDownload = datetime.datetime.now()
self.notify.info('Street sign url is %s' % self.StreetSignUrl)
#self.redownloadStreetSign()
def replaceTexture(self):
searchPath = DSearchPath()
searchPath.appendDirectory(self.directory)
def redownloadStreetSign(self):
self.precentDownload = 0.0
self.startRedownload = datetime.datetime.now()
self.downloadingStreetSign = True
Filename(self.StreetSignBaseDir + '/.').makeDir()
http = HTTPClient.getGlobalPtr()
self.url = self.StreetSignUrl + self.StreetSignFileName
self.ch = http.makeChannel(True)
localFilename = Filename(self.StreetSignBaseDir, self.StreetSignFileName)
self.ch.getHeader(DocumentSpec(self.url))
size = self.ch.getFileSize()
doc = self.ch.getDocumentSpec()
localSize = localFilename.getFileSize()
outOfDate = True
if size == localSize:
if doc.hasDate():
date = doc.getDate()
localDate = HTTPDate(localFilename.getTimestamp())
if localDate.compareTo(date) > 0:
outOfDate = False
self.notify.info('Street Sign is up to date')
if outOfDate and self.ch.isValid():
self.ch.beginGetDocument(doc)
self.ch.downloadToFile(localFilename)
taskMgr.add(self.downloadStreetSignTask, self.RedownloadTaskName)
def downloadStreetSignTask(self, task):
if self.ch.run():
return task.cont
doc = self.ch.getDocumentSpec()
date = ''
if doc.hasDate():
date = doc.getDate().getString()
if not self.ch.isValid():
self.redownloadingStreetSign = False
return task.done
self.notify.info('Down downloading street sign')
return task.done

View file

@ -1,212 +1,72 @@
from direct.actor import Actor
from direct.directnotify import DirectNotifyGlobal
from toontown.hood import InteractiveAnimatedProp
from toontown.hood import GenericAnimatedProp
from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer
class TrashcanInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp):
notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanInteractiveProp')
BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.HEAL_TRACK]
ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_trashcan_idleTake2',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_trashcan_idleHiccup0',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_trashcan_idleLook1',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_trashcan_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.FunnyFarm: (('tt_a_ara_ttc_trashcan_idleTake2',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_trashcan_idleHiccup0',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_trashcan_idleLook1',
1,
1,
None,
3,
10),
('tt_a_ara_ttc_trashcan_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_trashcan_idleBounce2',
3,
10,
'tt_a_ara_dod_trashcan_idle0settle',
3,
10),
('tt_a_ara_dod_trashcan_idle0',
1,
1,
None,
3,
10),
('tt_a_ara_dod_trashcan_idle1',
1,
1,
None,
3,
10),
('tt_a_ara_dod_trashcan_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_trashcan_idleTake2',
1,
1,
None,
3,
10),
('tt_a_ara_dga_trashcan_idleHiccup0',
1,
1,
None,
3,
10),
('tt_a_ara_dga_trashcan_idleLook1',
1,
1,
None,
3,
10),
('tt_a_ara_dga_trashcan_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_trashcan_idleBounce0',
3,
10,
'tt_a_ara_mml_trashcan_idle0settle',
3,
10),
('tt_a_ara_mml_trashcan_idleLook1',
1,
1,
None,
3,
10),
('tt_a_ara_mml_trashcan_idleHelicopter2',
1,
1,
None,
3,
10),
('tt_a_ara_mml_trashcan_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_trashcan_idleShiver1',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_trashcan_idleSneeze2',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_trashcan_idle0',
1,
1,
None,
3,
10),
('tt_a_ara_tbr_trashcan_idleAwesome3',
1,
1,
None,
3,
10)),
ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_trashcan_idleSleep0',
3,
10,
None,
0,
0),
('tt_a_ara_ddl_trashcan_idleShake2',
1,
1,
None,
0,
0),
('tt_a_ara_ddl_trashcan_idleSnore1',
1,
1,
None,
0,
0),
('tt_a_ara_ddl_trashcan_idleAwesome3',
1,
1,
None,
0,
0))}
ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_idleIntoFight',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_trashcan_idleIntoFight',
BattleTrack = ToontownBattleGlobals.HEAL_TRACK
BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack]
ZoneToIdles = {
ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_trashcan_idleTake2', 1, 1, None, 3, 10),
('tt_a_ara_ttc_trashcan_idleHiccup0', 1, 1, None, 3, 10),
('tt_a_ara_ttc_trashcan_idleLook1', 1, 1, None, 3, 10),
('tt_a_ara_ttc_trashcan_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_trashcan_idleBounce2', 3, 10, 'tt_a_ara_dod_trashcan_idle0settle', 3, 10),
('tt_a_ara_dod_trashcan_idle0', 1, 1, None, 3, 10),
('tt_a_ara_dod_trashcan_idle1', 1, 1, None, 3, 10),
('tt_a_ara_dod_trashcan_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_trashcan_idleTake2', 1, 1, None, 3, 10),
('tt_a_ara_dga_trashcan_idleHiccup0', 1, 1, None, 3, 10),
('tt_a_ara_dga_trashcan_idleLook1', 1, 1, None, 3, 10),
('tt_a_ara_dga_trashcan_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_trashcan_idleBounce0', 3, 10, 'tt_a_ara_mml_trashcan_idle0settle', 3, 10),
('tt_a_ara_mml_trashcan_idleLook1', 1, 1, None, 3, 10),
('tt_a_ara_mml_trashcan_idleHelicopter2', 1, 1, None, 3, 10),
('tt_a_ara_mml_trashcan_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_trashcan_idleShiver1', 1, 1, None, 3, 10),
('tt_a_ara_tbr_trashcan_idleSneeze2', 1, 1, None, 3, 10),
('tt_a_ara_tbr_trashcan_idle0', 1, 1, None, 3, 10),
('tt_a_ara_tbr_trashcan_idleAwesome3', 1, 1, None, 3, 10)),
ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_trashcan_idleSleep0', 3, 10, None, 0, 0),
('tt_a_ara_ddl_trashcan_idleShake2', 1, 1, None, 0, 0),
('tt_a_ara_ddl_trashcan_idleSnore1', 1, 1, None, 0, 0),
('tt_a_ara_ddl_trashcan_idleAwesome3', 1, 1, None, 0, 0))}
ZoneToIdleIntoFightAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_idleIntoFight',
ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_idleIntoFight',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_idleIntoFight',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_idleIntoFight',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_idleIntoFight',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_idleIntoFight'}
ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_victoryDance',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_trashcan_victoryDance',
ZoneToVictoryAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_victoryDance',
ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_victoryDance',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_victoryDance',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_victoryDance',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_victoryDance',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_victoryDance'}
ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_fightSad',
ToontownGlobals.FunnyFarm: 'tt_a_ara_ttc_trashcan_fightSad',
ZoneToSadAnims = {
ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_fightSad',
ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_fightSad',
ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_fightSad',
ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_fightSad',
ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_fightSad',
ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_fightSad'}
ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_trashcan_fightBoost', 'tt_a_ara_ttc_trashcan_fightCheer', 'tt_a_ara_ttc_trashcan_fightIdle'),
ToontownGlobals.FunnyFarm: ('tt_a_ara_ttc_trashcan_fightBoost', 'tt_a_ara_ttc_trashcan_fightCheer', 'tt_a_ara_ttc_trashcan_fightIdle'),
ZoneToFightAnims = {
ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_trashcan_fightBoost', 'tt_a_ara_ttc_trashcan_fightCheer', 'tt_a_ara_ttc_trashcan_fightIdle'),
ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_trashcan_fightBoost', 'tt_a_ara_dod_trashcan_fightCheer', 'tt_a_ara_dod_trashcan_fightIdle'),
ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_trashcan_fightBoost', 'tt_a_ara_dga_trashcan_fightCheer', 'tt_a_ara_dga_trashcan_fightIdle'),
ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_trashcan_fightBoost',
'tt_a_ara_mml_trashcan_fightCheer0',
'tt_a_ara_mml_trashcan_fightCheer1',
'tt_a_ara_mml_trashcan_fightIdle'),
ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_trashcan_fightBoost', 'tt_a_ara_mml_trashcan_fightCheer0', 'tt_a_ara_mml_trashcan_fightCheer1', 'tt_a_ara_mml_trashcan_fightIdle'),
ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_trashcan_fightBoost', 'tt_a_ara_tbr_trashcan_fightCheer', 'tt_a_ara_tbr_trashcan_fightIdle'),
ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_trashcan_fightBoost', 'tt_a_ara_ddl_trashcan_fightCheer', 'tt_a_ara_ddl_trashcan_fightIdle')}
IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0)
def __init__(self, node):
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.TRASHCANS_BUFF_BATTLES)
InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node)

View file

@ -222,22 +222,6 @@ class SafeZoneLoader(StateData.StateData):
animPropList = self.animPropDict.setdefault(i, [])
animPropList.append(animPropObj)
interactivePropNodes = i.findAllMatches('**/interactive_prop_*')
numInteractivePropNodes = interactivePropNodes.getNumPaths()
for j in xrange(numInteractivePropNodes):
interactivePropNode = interactivePropNodes.getPath(j)
className = 'GenericAnimatedProp'
symbols = {}
base.cr.importModule(symbols, 'toontown.hood', [className])
classObj = getattr(symbols[className], className)
interactivePropObj = classObj(interactivePropNode)
animPropList = self.animPropDict.get(i)
if animPropList is None:
animPropList = self.animPropDict.setdefault(i, [])
animPropList.append(interactivePropObj)
return
def deleteAnimatedProps(self):
for zoneNode, animPropList in self.animPropDict.items():
for animProp in animPropList:

View file

@ -46,7 +46,9 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.maxSkeleRevives = 0
self.sillySurgeText = False
self.interactivePropTrackBonus = -1
return
def setInteractivePropTrackBonus(self, trackBonus):
self.interactivePropTrackBonus = trackBonus
def setVirtual(self, virtual):
pass

View file

@ -1177,10 +1177,7 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame):
messenger.send('exitTrackFrame', [track])
def checkPropBonus(self, track):
result = False
if track == self.interactivePropTrackBonus:
result = True
return result
return track == self.interactivePropTrackBonus
def stopAndClearPropBonusIval(self):
if self.propBonusIval and self.propBonusIval.isPlaying():

View file

@ -883,9 +883,6 @@ SILLYMETER_HOLIDAY = 60
MAILBOX_ZERO_HOLIDAY = 61
TRASHCAN_ZERO_HOLIDAY = 62
SILLY_SURGE_HOLIDAY = 63
HYDRANTS_BUFF_BATTLES = 64
MAILBOXES_BUFF_BATTLES = 65
TRASHCANS_BUFF_BATTLES = 66
SILLY_CHATTER_ONE = 67
SILLY_CHATTER_TWO = 68
SILLY_CHATTER_THREE = 69

View file

@ -134,8 +134,6 @@ class Street(BattlePlace.BattlePlace):
self.enterZone(requestStatus['zoneId'])
self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList)
self.fsm.request(requestStatus['how'], [requestStatus])
self.replaceStreetSignTextures()
return
def exit(self, visibilityFlag = 1):
if visibilityFlag:
@ -369,32 +367,3 @@ class Street(BattlePlace.BattlePlace):
self.halloweenLights += geom.findAllMatches('**/prop_snow_tree*')
for light in self.halloweenLights:
light.setColorScaleOff(1)
return
def replaceStreetSignTextures(self):
if not hasattr(base.cr, 'playGame'):
return
place = base.cr.playGame.getPlace()
if place is None:
return
geom = base.cr.playGame.getPlace().loader.geom
signs = geom.findAllMatches('**/*tunnelAheadSign*;+s')
if signs.getNumPaths() > 0:
streetSign = base.cr.streetSign
signTexturePath = streetSign.StreetSignBaseDir + '/' + streetSign.StreetSignFileName
loaderTexturePath = Filename(str(signTexturePath))
alphaPath = 'phase_4/maps/tt_t_ara_gen_tunnelAheadSign_a.rgb'
inDreamland = False
if place.zoneId and ZoneUtil.getCanonicalHoodId(place.zoneId) == ToontownGlobals.DonaldsDreamland:
inDreamland = True
alphaPath = 'phase_4/maps/tt_t_ara_gen_tunnelAheadSign_a.rgb'
if Filename(signTexturePath).exists():
signTexture = loader.loadTexture(loaderTexturePath, alphaPath)
for sign in signs:
if Filename(signTexturePath).exists():
sign.setTexture(signTexture, 1)
if inDreamland:
sign.setColorScale(0.525, 0.525, 0.525, 1)
return

View file

@ -17,8 +17,7 @@ from toontown.toon.Toon import teleportDebug
from toontown.battle import BattleParticles
from direct.fsm import StateData
from toontown.building import ToonInterior
from toontown.hood import QuietZoneState
from toontown.hood import ZoneUtil
from toontown.hood import QuietZoneState, ZoneUtil, HydrantInteractiveProp, MailboxInteractiveProp, TrashcanInteractiveProp
from direct.interval.IntervalGlobal import *
from toontown.dna.DNAParser import DNABulkLoader
@ -284,6 +283,7 @@ class TownLoader(StateData.StateData):
def createAnimatedProps(self, nodeList):
self.animPropDict = {}
self.zoneIdToInteractivePropDict = {}
for i in nodeList:
animPropNodes = i.findAllMatches('**/animated_prop_*')
numAnimPropNodes = animPropNodes.getNumPaths()
@ -305,32 +305,26 @@ class TownLoader(StateData.StateData):
animPropList.append(animPropObj)
interactivePropNodes = i.findAllMatches('**/interactive_prop_*')
numInteractivePropNodes = interactivePropNodes.getNumPaths()
for j in range(numInteractivePropNodes):
interactivePropNode = interactivePropNodes.getPath(j)
className = 'InteractiveAnimatedProp'
if 'hydrant' in interactivePropNode.getName():
className = 'HydrantInteractiveProp'
elif 'trashcan' in interactivePropNode.getName():
className = 'TrashcanInteractiveProp'
elif 'mailbox' in interactivePropNode.getName():
className = 'MailboxInteractiveProp'
symbols = {}
base.cr.importModule(symbols, 'toontown.hood', [className])
classObj = getattr(symbols[className], className)
interactivePropObj = classObj(interactivePropNode)
animPropList = self.animPropDict.get(i)
if animPropList is None:
animPropList = self.animPropDict.setdefault(i, [])
animPropList.append(interactivePropObj)
if interactivePropObj.getCellIndex() == 0:
zoneId = int(i.getName())
if zoneId not in self.zoneIdToInteractivePropDict:
self.zoneIdToInteractivePropDict[zoneId] = interactivePropObj
else:
self.notify.error('already have interactive prop %s in zone %s' % (self.zoneIdToInteractivePropDict, zoneId))
return
for j in xrange(interactivePropNodes.getNumPaths()):
propNode = interactivePropNodes.getPath(j)
propName = propNode.getName()
if 'hydrant' in propName:
prop = HydrantInteractiveProp.HydrantInteractiveProp(propNode)
elif 'trashcan' in propName:
prop = TrashcanInteractiveProp.TrashcanInteractiveProp(propNode)
elif 'mailbox' in propName:
prop = MailboxInteractiveProp.MailboxInteractiveProp(propNode)
else:
continue
if i in self.animPropDict:
self.animPropDict[i].append(prop)
else:
self.animPropDict[i] = [prop]
self.zoneIdToInteractivePropDict[int(i.getName())] = prop
def deleteAnimatedProps(self):
for zoneNode, animPropList in self.animPropDict.items():
@ -348,7 +342,6 @@ class TownLoader(StateData.StateData):
animProp.exit()
def getInteractiveProp(self, zoneId):
result = None
if zoneId in self.zoneIdToInteractivePropDict:
result = self.zoneIdToInteractivePropDict[zoneId]
return result
return self.zoneIdToInteractivePropDict[zoneId]
return None