general: current progress
progress includes: - cogs appear on streets now - additionally, street interests are setup for astron clients. - cog battles are mostly working - updated some sequences to work with newer panda3d - fixed particle effects search paths so that they load now - handled disconnect reasons for clients that disconnect during cog battles etc. - fleshed out the holiday manager a bit more
This commit is contained in:
parent
92dab51d3e
commit
827445d8fa
15 changed files with 77 additions and 44 deletions
|
@ -1,17 +1,32 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
from direct.distributed.ClockDelta import globalClockDelta
|
||||
import time
|
||||
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed.ClockDelta import globalClockDelta
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
|
||||
from otp.otpbase import OTPGlobals
|
||||
|
||||
|
||||
class TimeManagerAI(DistributedObjectAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('TimeManagerAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedObjectAI.__init__(self, air)
|
||||
self.avId2disconnectcode = {}
|
||||
|
||||
def requestServerTime(self, context):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
if not avId:
|
||||
return
|
||||
|
||||
self.sendUpdateToAvatarId(avId, 'serverTime', [context, globalClockDelta.getRealNetworkTime(bits=32), int(time.time())])
|
||||
self.sendUpdateToAvatarId(avId, 'serverTime',
|
||||
[context, globalClockDelta.getRealNetworkTime(bits=32), int(time.time())])
|
||||
|
||||
def setSignature(self, todo0, todo1, todo2):
|
||||
pass
|
||||
def setDisconnectReason(self, disconnectCode):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
if not avId:
|
||||
return
|
||||
|
||||
self.avId2disconnectcode[avId] = disconnectCode
|
||||
self.air.writeServerEvent('disconnect-reason', avId=avId,
|
||||
reason=OTPGlobals.DisconnectReasons.get(disconnectCode, 'unknown'))
|
||||
|
|
|
@ -32,6 +32,7 @@ class DistributedAvatar(DistributedActor, Avatar):
|
|||
self.hpText = None
|
||||
self.hp = None
|
||||
self.maxHp = None
|
||||
self.hpTextSeq = None
|
||||
return
|
||||
|
||||
def disable(self):
|
||||
|
@ -203,8 +204,8 @@ class DistributedAvatar(DistributedActor, Avatar):
|
|||
self.hpText.setBillboardPointEye()
|
||||
self.hpText.setBin('fixed', 100)
|
||||
self.hpText.setPos(0, 0, self.height / 2)
|
||||
seq = Task.sequence(self.hpText.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType='easeOut'), Task.pause(0.85), self.hpText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.1), Task.Task(self.hideHpTextTask))
|
||||
taskMgr.add(seq, self.uniqueName('hpText'))
|
||||
self.hpTextSeq = Sequence(self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(0.85), self.hpText.colorInterval(0.1, Vec4(r, g, b, 0)), Func(self.hideHpText))
|
||||
self.hpTextSeq.start()
|
||||
|
||||
def showHpString(self, text, duration = 0.85, scale = 0.7):
|
||||
if self.HpTextEnabled and not self.ghostMode:
|
||||
|
@ -223,16 +224,14 @@ class DistributedAvatar(DistributedActor, Avatar):
|
|||
self.hpText.setScale(scale)
|
||||
self.hpText.setBillboardAxis()
|
||||
self.hpText.setPos(0, 0, self.height / 2)
|
||||
seq = Task.sequence(self.hpText.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType='easeOut'), Task.pause(duration), self.hpText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.1), Task.Task(self.hideHpTextTask))
|
||||
taskMgr.add(seq, self.uniqueName('hpText'))
|
||||
|
||||
def hideHpTextTask(self, task):
|
||||
self.hideHpText()
|
||||
return Task.done
|
||||
self.hpTextSeq = Sequence(self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(duration), self.hpText.colorInterval(0.1, Vec4(r, g, b, 0)), Func(self.hideHpText))
|
||||
self.hpTextSeq.start()
|
||||
|
||||
def hideHpText(self):
|
||||
if self.hpText:
|
||||
taskMgr.remove(self.uniqueName('hpText'))
|
||||
if self.hpTextSeq:
|
||||
self.hpTextSeq.finish()
|
||||
self.hpTextSeq = None
|
||||
self.hpText.removeNode()
|
||||
self.hpText = None
|
||||
return
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
||||
|
||||
class HolidayManagerAI:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('HolidayManagerAI')
|
||||
|
||||
def __init__(self, air):
|
||||
self.air = air
|
||||
self.currentHolidays = {}
|
||||
|
||||
def isHolidayRunning(self, holidayId):
|
||||
return False # NO
|
||||
return holidayId in self.currentHolidays
|
||||
|
||||
def isMoreXpHolidayRunning(self):
|
||||
return ToontownGlobals.MORE_XP_HOLIDAY in self.currentHolidays
|
||||
|
|
|
@ -212,6 +212,9 @@ class ToontownAIRepository(ToontownInternalRepository):
|
|||
def getAvatarExitEvent(self, avId):
|
||||
return 'distObjDelete-%d' % avId
|
||||
|
||||
def getAvatarDisconnectReason(self, avId):
|
||||
return self.timeManager.avId2disconnectcode.get(avId, ToontownGlobals.DisconnectUnknown)
|
||||
|
||||
def getZoneDataStore(self):
|
||||
return self.zoneDataStore
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from direct.particles.ParticleEffect import *
|
||||
import os
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.showbase import AppRunnerGlobal
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('BattleParticles')
|
||||
TutorialParticleEffects = ('gearExplosionBig.ptf', 'gearExplosionSmall.ptf', 'gearExplosion.ptf')
|
||||
ParticleNames = ('audit-div', 'audit-five', 'audit-four', 'audit-minus', 'audit-mult', 'audit-one', 'audit-plus', 'audit-six', 'audit-three', 'audit-two', 'blah', 'brainstorm-box', 'brainstorm-env', 'brainstorm-track', 'buzzwords-crash', 'buzzwords-inc', 'buzzwords-main', 'buzzwords-over', 'buzzwords-syn', 'confetti', 'doubletalk-double', 'doubletalk-dup', 'doubletalk-good', 'filibuster-cut', 'filibuster-fiscal', 'filibuster-impeach', 'filibuster-inc', 'jargon-brow', 'jargon-deep', 'jargon-hoop', 'jargon-ipo', 'legalese-hc', 'legalese-qpq', 'legalese-vd', 'mumbojumbo-boiler', 'mumbojumbo-creative', 'mumbojumbo-deben', 'mumbojumbo-high', 'mumbojumbo-iron', 'poundsign', 'schmooze-genius', 'schmooze-instant', 'schmooze-master', 'schmooze-viz', 'roll-o-dex', 'rollodex-card', 'dagger', 'fire', 'snow-particle', 'raindrop', 'gear', 'checkmark', 'dollar-sign', 'spark')
|
||||
|
@ -38,18 +37,12 @@ def loadParticleFile(name):
|
|||
global particleSearchPath
|
||||
if particleSearchPath == None:
|
||||
particleSearchPath = DSearchPath()
|
||||
if AppRunnerGlobal.appRunner:
|
||||
particleSearchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/etc'))
|
||||
else:
|
||||
basePath = os.path.expandvars('$TOONTOWN') or './toontown'
|
||||
particleSearchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/src/battle'))
|
||||
particleSearchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/src/safezone'))
|
||||
particleSearchPath.appendDirectory(Filename('phase_3.5/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('phase_4/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('phase_5/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('phase_8/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('phase_9/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('.'))
|
||||
if __debug__:
|
||||
particleSearchPath.appendDirectory(Filename('resources/phase_3.5/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('resources/phase_4/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('resources/phase_5/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('resources/phase_8/etc'))
|
||||
particleSearchPath.appendDirectory(Filename('resources/phase_9/etc'))
|
||||
|
||||
pfile = Filename(name)
|
||||
found = vfs.resolveFilename(pfile, particleSearchPath)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from pandac.PandaModules import *
|
||||
from libotp import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
from BattleBase import *
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from otp.ai.AIBase import *
|
||||
from direct.distributed.ClockDelta import *
|
||||
from BattleBase import *
|
||||
from BattleCalculatorAI import *
|
||||
import BattleCalculatorAI
|
||||
from toontown.toonbase.ToontownBattleGlobals import *
|
||||
from SuitBattleGlobals import *
|
||||
from pandac.PandaModules import *
|
||||
|
@ -47,7 +47,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
|||
self.toonOrigMerits = {}
|
||||
self.toonMerits = {}
|
||||
self.toonParts = {}
|
||||
self.battleCalc = BattleCalculatorAI(self, tutorialFlag)
|
||||
self.battleCalc = BattleCalculatorAI.BattleCalculatorAI(self, tutorialFlag)
|
||||
if self.air.suitInvasionManager.getInvading():
|
||||
mult = getInvasionMultiplier()
|
||||
self.battleCalc.setSkillCreditMultiplier(mult)
|
||||
|
@ -263,7 +263,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
|||
for s in self.suits:
|
||||
if s.battleTrap == NO_TRAP:
|
||||
suitTraps += '9'
|
||||
elif s.battleTrap == BattleCalculatorAI.TRAP_CONFLICT:
|
||||
elif s.battleTrap == BattleCalculatorAI.BattleCalculatorAI.TRAP_CONFLICT:
|
||||
suitTraps += '9'
|
||||
else:
|
||||
suitTraps += str(s.battleTrap)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from libotp import *
|
||||
from toontown.toonbase.ToontownGlobals import *
|
||||
from SuitBattleGlobals import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
from pandac.PandaModules import *
|
||||
from libotp import *
|
||||
from libtoontown import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
from direct.distributed.ClockDelta import *
|
||||
from direct.directtools.DirectGeometry import CLAMP
|
||||
|
|
|
@ -71,12 +71,12 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
|
|||
if num > self.maxSkeleRevives:
|
||||
self.maxSkeleRevives = num
|
||||
if self.getSkeleRevives() > 0:
|
||||
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self.name,
|
||||
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self._name,
|
||||
'dept': self.getStyleDept(),
|
||||
'level': '%s%s' % (self.getActualLevel(), TTLocalizer.SkeleRevivePostFix)}
|
||||
self.setDisplayName(nameInfo)
|
||||
else:
|
||||
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self.name,
|
||||
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self._name,
|
||||
'dept': self.getStyleDept(),
|
||||
'level': self.getActualLevel()}
|
||||
self.setDisplayName(nameInfo)
|
||||
|
@ -431,16 +431,15 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
|
|||
self.nametag3d.setDepthTest(0)
|
||||
self.nametag3d.setBin('fixed', 99)
|
||||
self.hpText.setPos(0, 0, self.height / 2)
|
||||
seq = Task.sequence(self.hpText.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType='easeOut'), Task.pause(0.85), self.hpText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.1), Task.Task(self.hideHpTextTask))
|
||||
taskMgr.add(seq, self.uniqueName('hpText'))
|
||||
self.hpTextSeq = Sequence(self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(0.85), self.hpText.colorInterval(0.1, Vec4(r, g, b, 0)), Func(self.hideHpText))
|
||||
self.hpTextSeq.start()
|
||||
|
||||
def hideHpTextTask(self, task):
|
||||
self.hideHpText()
|
||||
def hideHpText(self):
|
||||
DistributedAvatar.DistributedAvatar.hideHpText(self)
|
||||
if self.sillySurgeText:
|
||||
self.nametag3d.clearDepthTest()
|
||||
self.nametag3d.clearBin()
|
||||
self.sillySurgeText = False
|
||||
return Task.done
|
||||
|
||||
def getAvIdName(self):
|
||||
try:
|
||||
|
|
|
@ -972,7 +972,7 @@ class Suit(Avatar.Avatar):
|
|||
bb.setTwoSided(1)
|
||||
|
||||
self.setName(TTLocalizer.Skeleton)
|
||||
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self.name,
|
||||
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self._name,
|
||||
'dept': self.getStyleDept(),
|
||||
'level': self.getActualLevel()}
|
||||
self.setDisplayName(nameInfo)
|
||||
|
|
|
@ -46,7 +46,7 @@ class SuitBase:
|
|||
|
||||
def setLevel(self, level):
|
||||
self.level = level
|
||||
nameWLevel = TTLocalizer.SuitBaseNameWithLevel % {'name': self.name,
|
||||
nameWLevel = TTLocalizer.SuitBaseNameWithLevel % {'name': self._name,
|
||||
'dept': self.getStyleDept(),
|
||||
'level': self.getActualLevel()}
|
||||
self.setDisplayName(nameWLevel)
|
||||
|
|
|
@ -2522,8 +2522,8 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
|
|||
self.hpText.setBillboardPointEye()
|
||||
self.hpText.setBin('fixed', 100)
|
||||
self.hpText.setPos(0, 0, self.height / 2)
|
||||
seq = Task.sequence(self.hpText.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType='easeOut'), Task.pause(0.85), self.hpText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.1), Task(self.hideHpTextTask))
|
||||
taskMgr.add(seq, self.uniqueName('hpText'))
|
||||
self.hpTextSeq = Sequence(self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(0.85), self.hpText.colorInterval(0.1, Vec4(r, g, b, 0)), Func(self.hideHpText))
|
||||
self.hpTextSeq.start()
|
||||
|
||||
def setName(self, name = 'unknownDistributedAvatar'):
|
||||
DistributedPlayer.DistributedPlayer.setName(self, name)
|
||||
|
|
|
@ -355,7 +355,12 @@ class Street(BattlePlace.BattlePlace):
|
|||
if newZoneId != None:
|
||||
self.loader.zoneDict[newZoneId].setColor(0, 0, 1, 1, 100)
|
||||
if newZoneId != None:
|
||||
base.cr.sendSetZoneMsg(newZoneId)
|
||||
if not base.cr.astronSupport:
|
||||
base.cr.sendSetZoneMsg(newZoneId)
|
||||
else:
|
||||
visZones = [self.loader.node2zone[x] for x in self.loader.nodeDict[newZoneId]]
|
||||
visZones.append(ZoneUtil.getBranchZone(newZoneId))
|
||||
base.cr.sendSetZoneMsg(newZoneId, visZones)
|
||||
self.notify.debug('Entering Zone %d' % newZoneId)
|
||||
self.zoneId = newZoneId
|
||||
geom = base.cr.playGame.getPlace().loader.geom
|
||||
|
|
|
@ -73,6 +73,8 @@ class TownLoader(StateData.StateData):
|
|||
del self.hood
|
||||
del self.nodeDict
|
||||
del self.zoneDict
|
||||
if base.cr.astronSupport:
|
||||
del self.node2zone
|
||||
del self.fadeInDict
|
||||
del self.fadeOutDict
|
||||
del self.nodeList
|
||||
|
@ -227,6 +229,8 @@ class TownLoader(StateData.StateData):
|
|||
def makeDictionaries(self, dnaStore):
|
||||
self.nodeDict = {}
|
||||
self.zoneDict = {}
|
||||
if base.cr.astronSupport:
|
||||
self.node2zone = {}
|
||||
self.nodeList = []
|
||||
self.fadeInDict = {}
|
||||
self.fadeOutDict = {}
|
||||
|
@ -250,6 +254,8 @@ class TownLoader(StateData.StateData):
|
|||
self.nodeDict[zoneId] = []
|
||||
self.nodeList.append(groupNode)
|
||||
self.zoneDict[zoneId] = groupNode
|
||||
if base.cr.astronSupport:
|
||||
self.node2zone[groupNode] = zoneId
|
||||
fadeDuration = 0.5
|
||||
self.fadeOutDict[groupNode] = Sequence(Func(groupNode.setTransparency, 1), LerpColorScaleInterval(groupNode, fadeDuration, a0, startColorScale=a1), Func(groupNode.clearColorScale), Func(groupNode.clearTransparency), Func(groupNode.stash), name='fadeZone-' + str(zoneId), autoPause=1)
|
||||
self.fadeInDict[groupNode] = Sequence(Func(groupNode.unstash), Func(groupNode.setTransparency, 1), LerpColorScaleInterval(groupNode, fadeDuration, a1, startColorScale=a0), Func(groupNode.clearColorScale), Func(groupNode.clearTransparency), name='fadeZone-' + str(zoneId), autoPause=1)
|
||||
|
|
Loading…
Reference in a new issue