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:
John Cote 2019-11-27 20:14:30 -05:00
parent 92dab51d3e
commit 827445d8fa
No known key found for this signature in database
GPG key ID: 56236C6A25456549
15 changed files with 77 additions and 44 deletions

View file

@ -1,17 +1,32 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import globalClockDelta
import time 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): class TimeManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('TimeManagerAI') notify = DirectNotifyGlobal.directNotify.newCategory('TimeManagerAI')
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.avId2disconnectcode = {}
def requestServerTime(self, context): def requestServerTime(self, context):
avId = self.air.getAvatarIdFromSender() avId = self.air.getAvatarIdFromSender()
if not avId: if not avId:
return 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): def setDisconnectReason(self, disconnectCode):
pass 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'))

View file

@ -32,6 +32,7 @@ class DistributedAvatar(DistributedActor, Avatar):
self.hpText = None self.hpText = None
self.hp = None self.hp = None
self.maxHp = None self.maxHp = None
self.hpTextSeq = None
return return
def disable(self): def disable(self):
@ -203,8 +204,8 @@ class DistributedAvatar(DistributedActor, Avatar):
self.hpText.setBillboardPointEye() self.hpText.setBillboardPointEye()
self.hpText.setBin('fixed', 100) self.hpText.setBin('fixed', 100)
self.hpText.setPos(0, 0, self.height / 2) 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)) 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))
taskMgr.add(seq, self.uniqueName('hpText')) self.hpTextSeq.start()
def showHpString(self, text, duration = 0.85, scale = 0.7): def showHpString(self, text, duration = 0.85, scale = 0.7):
if self.HpTextEnabled and not self.ghostMode: if self.HpTextEnabled and not self.ghostMode:
@ -223,16 +224,14 @@ class DistributedAvatar(DistributedActor, Avatar):
self.hpText.setScale(scale) self.hpText.setScale(scale)
self.hpText.setBillboardAxis() self.hpText.setBillboardAxis()
self.hpText.setPos(0, 0, self.height / 2) 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)) 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))
taskMgr.add(seq, self.uniqueName('hpText')) self.hpTextSeq.start()
def hideHpTextTask(self, task):
self.hideHpText()
return Task.done
def hideHpText(self): def hideHpText(self):
if self.hpText: if self.hpText:
taskMgr.remove(self.uniqueName('hpText')) if self.hpTextSeq:
self.hpTextSeq.finish()
self.hpTextSeq = None
self.hpText.removeNode() self.hpText.removeNode()
self.hpText = None self.hpText = None
return return

View file

@ -1,7 +1,16 @@
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
class HolidayManagerAI: class HolidayManagerAI:
notify = DirectNotifyGlobal.directNotify.newCategory('HolidayManagerAI')
def __init__(self, air): def __init__(self, air):
self.air = air self.air = air
self.currentHolidays = {} self.currentHolidays = {}
def isHolidayRunning(self, holidayId): def isHolidayRunning(self, holidayId):
return False # NO return holidayId in self.currentHolidays
def isMoreXpHolidayRunning(self):
return ToontownGlobals.MORE_XP_HOLIDAY in self.currentHolidays

View file

@ -212,6 +212,9 @@ class ToontownAIRepository(ToontownInternalRepository):
def getAvatarExitEvent(self, avId): def getAvatarExitEvent(self, avId):
return 'distObjDelete-%d' % avId return 'distObjDelete-%d' % avId
def getAvatarDisconnectReason(self, avId):
return self.timeManager.avId2disconnectcode.get(avId, ToontownGlobals.DisconnectUnknown)
def getZoneDataStore(self): def getZoneDataStore(self):
return self.zoneDataStore return self.zoneDataStore

View file

@ -1,7 +1,6 @@
from direct.particles.ParticleEffect import * from direct.particles.ParticleEffect import *
import os import os
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.showbase import AppRunnerGlobal
notify = DirectNotifyGlobal.directNotify.newCategory('BattleParticles') notify = DirectNotifyGlobal.directNotify.newCategory('BattleParticles')
TutorialParticleEffects = ('gearExplosionBig.ptf', 'gearExplosionSmall.ptf', 'gearExplosion.ptf') 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') 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 global particleSearchPath
if particleSearchPath == None: if particleSearchPath == None:
particleSearchPath = DSearchPath() particleSearchPath = DSearchPath()
if AppRunnerGlobal.appRunner: if __debug__:
particleSearchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/etc')) particleSearchPath.appendDirectory(Filename('resources/phase_3.5/etc'))
else: particleSearchPath.appendDirectory(Filename('resources/phase_4/etc'))
basePath = os.path.expandvars('$TOONTOWN') or './toontown' particleSearchPath.appendDirectory(Filename('resources/phase_5/etc'))
particleSearchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/src/battle')) particleSearchPath.appendDirectory(Filename('resources/phase_8/etc'))
particleSearchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/src/safezone')) particleSearchPath.appendDirectory(Filename('resources/phase_9/etc'))
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('.'))
pfile = Filename(name) pfile = Filename(name)
found = vfs.resolveFilename(pfile, particleSearchPath) found = vfs.resolveFilename(pfile, particleSearchPath)

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from BattleBase import * from BattleBase import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals

View file

@ -1,7 +1,7 @@
from otp.ai.AIBase import * from otp.ai.AIBase import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from BattleBase import * from BattleBase import *
from BattleCalculatorAI import * import BattleCalculatorAI
from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownBattleGlobals import *
from SuitBattleGlobals import * from SuitBattleGlobals import *
from pandac.PandaModules import * from pandac.PandaModules import *
@ -47,7 +47,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
self.toonOrigMerits = {} self.toonOrigMerits = {}
self.toonMerits = {} self.toonMerits = {}
self.toonParts = {} self.toonParts = {}
self.battleCalc = BattleCalculatorAI(self, tutorialFlag) self.battleCalc = BattleCalculatorAI.BattleCalculatorAI(self, tutorialFlag)
if self.air.suitInvasionManager.getInvading(): if self.air.suitInvasionManager.getInvading():
mult = getInvasionMultiplier() mult = getInvasionMultiplier()
self.battleCalc.setSkillCreditMultiplier(mult) self.battleCalc.setSkillCreditMultiplier(mult)
@ -263,7 +263,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
for s in self.suits: for s in self.suits:
if s.battleTrap == NO_TRAP: if s.battleTrap == NO_TRAP:
suitTraps += '9' suitTraps += '9'
elif s.battleTrap == BattleCalculatorAI.TRAP_CONFLICT: elif s.battleTrap == BattleCalculatorAI.BattleCalculatorAI.TRAP_CONFLICT:
suitTraps += '9' suitTraps += '9'
else: else:
suitTraps += str(s.battleTrap) suitTraps += str(s.battleTrap)

View file

@ -1,3 +1,4 @@
from libotp import *
from toontown.toonbase.ToontownGlobals import * from toontown.toonbase.ToontownGlobals import *
from SuitBattleGlobals import * from SuitBattleGlobals import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *

View file

@ -1,4 +1,6 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import *
from libtoontown import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.directtools.DirectGeometry import CLAMP from direct.directtools.DirectGeometry import CLAMP

View file

@ -71,12 +71,12 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
if num > self.maxSkeleRevives: if num > self.maxSkeleRevives:
self.maxSkeleRevives = num self.maxSkeleRevives = num
if self.getSkeleRevives() > 0: if self.getSkeleRevives() > 0:
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self.name, nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self._name,
'dept': self.getStyleDept(), 'dept': self.getStyleDept(),
'level': '%s%s' % (self.getActualLevel(), TTLocalizer.SkeleRevivePostFix)} 'level': '%s%s' % (self.getActualLevel(), TTLocalizer.SkeleRevivePostFix)}
self.setDisplayName(nameInfo) self.setDisplayName(nameInfo)
else: else:
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self.name, nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self._name,
'dept': self.getStyleDept(), 'dept': self.getStyleDept(),
'level': self.getActualLevel()} 'level': self.getActualLevel()}
self.setDisplayName(nameInfo) self.setDisplayName(nameInfo)
@ -431,16 +431,15 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.nametag3d.setDepthTest(0) self.nametag3d.setDepthTest(0)
self.nametag3d.setBin('fixed', 99) self.nametag3d.setBin('fixed', 99)
self.hpText.setPos(0, 0, self.height / 2) 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)) 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))
taskMgr.add(seq, self.uniqueName('hpText')) self.hpTextSeq.start()
def hideHpTextTask(self, task): def hideHpText(self):
self.hideHpText() DistributedAvatar.DistributedAvatar.hideHpText(self)
if self.sillySurgeText: if self.sillySurgeText:
self.nametag3d.clearDepthTest() self.nametag3d.clearDepthTest()
self.nametag3d.clearBin() self.nametag3d.clearBin()
self.sillySurgeText = False self.sillySurgeText = False
return Task.done
def getAvIdName(self): def getAvIdName(self):
try: try:

View file

@ -972,7 +972,7 @@ class Suit(Avatar.Avatar):
bb.setTwoSided(1) bb.setTwoSided(1)
self.setName(TTLocalizer.Skeleton) self.setName(TTLocalizer.Skeleton)
nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self.name, nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': self._name,
'dept': self.getStyleDept(), 'dept': self.getStyleDept(),
'level': self.getActualLevel()} 'level': self.getActualLevel()}
self.setDisplayName(nameInfo) self.setDisplayName(nameInfo)

View file

@ -46,7 +46,7 @@ class SuitBase:
def setLevel(self, level): def setLevel(self, level):
self.level = level self.level = level
nameWLevel = TTLocalizer.SuitBaseNameWithLevel % {'name': self.name, nameWLevel = TTLocalizer.SuitBaseNameWithLevel % {'name': self._name,
'dept': self.getStyleDept(), 'dept': self.getStyleDept(),
'level': self.getActualLevel()} 'level': self.getActualLevel()}
self.setDisplayName(nameWLevel) self.setDisplayName(nameWLevel)

View file

@ -2522,8 +2522,8 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
self.hpText.setBillboardPointEye() self.hpText.setBillboardPointEye()
self.hpText.setBin('fixed', 100) self.hpText.setBin('fixed', 100)
self.hpText.setPos(0, 0, self.height / 2) 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)) 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))
taskMgr.add(seq, self.uniqueName('hpText')) self.hpTextSeq.start()
def setName(self, name = 'unknownDistributedAvatar'): def setName(self, name = 'unknownDistributedAvatar'):
DistributedPlayer.DistributedPlayer.setName(self, name) DistributedPlayer.DistributedPlayer.setName(self, name)

View file

@ -355,7 +355,12 @@ class Street(BattlePlace.BattlePlace):
if newZoneId != None: if newZoneId != None:
self.loader.zoneDict[newZoneId].setColor(0, 0, 1, 1, 100) self.loader.zoneDict[newZoneId].setColor(0, 0, 1, 1, 100)
if newZoneId != None: 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.notify.debug('Entering Zone %d' % newZoneId)
self.zoneId = newZoneId self.zoneId = newZoneId
geom = base.cr.playGame.getPlace().loader.geom geom = base.cr.playGame.getPlace().loader.geom

View file

@ -73,6 +73,8 @@ class TownLoader(StateData.StateData):
del self.hood del self.hood
del self.nodeDict del self.nodeDict
del self.zoneDict del self.zoneDict
if base.cr.astronSupport:
del self.node2zone
del self.fadeInDict del self.fadeInDict
del self.fadeOutDict del self.fadeOutDict
del self.nodeList del self.nodeList
@ -227,6 +229,8 @@ class TownLoader(StateData.StateData):
def makeDictionaries(self, dnaStore): def makeDictionaries(self, dnaStore):
self.nodeDict = {} self.nodeDict = {}
self.zoneDict = {} self.zoneDict = {}
if base.cr.astronSupport:
self.node2zone = {}
self.nodeList = [] self.nodeList = []
self.fadeInDict = {} self.fadeInDict = {}
self.fadeOutDict = {} self.fadeOutDict = {}
@ -250,6 +254,8 @@ class TownLoader(StateData.StateData):
self.nodeDict[zoneId] = [] self.nodeDict[zoneId] = []
self.nodeList.append(groupNode) self.nodeList.append(groupNode)
self.zoneDict[zoneId] = groupNode self.zoneDict[zoneId] = groupNode
if base.cr.astronSupport:
self.node2zone[groupNode] = zoneId
fadeDuration = 0.5 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.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) 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)