class KartGlobals: ENTER_MOVIE = 1 EXIT_MOVIE = 2 COUNTDOWN_TIME = 30 BOARDING_TIME = 10.0 ENTER_RACE_TIME = 6.0 ERROR_CODE = PythonUtil.Enum( 'success, eGeneric, eTickets, eBoardOver, eNoKart, eOccupied, eTrackClosed, eTooLate, eUnpaid' ) FRONT_LEFT_SPOT = 0 FRONT_RIGHT_SPOT = 1 REAR_LEFT_SPOT = 2 REAR_RIGHT_SPOT = 3 PAD_GROUP_NUM = 4 def getPadLocation(padId): return padId % KartGlobals.PAD_GROUP_NUM getPadLocation = staticmethod(getPadLocation)
from direct.directnotify import DirectNotifyGlobal from otp.otpbase import PythonUtil from toontown.toonbase import TTLocalizer from panda3d.core import * from KartShopGlobals import * import types, copy KartDNA = PythonUtil.Enum( 'bodyType, bodyColor, accColor, ebType, spType, fwwType, bwwType, rimsType, decalType' ) InvalidEntry = -1 KartInfo = PythonUtil.Enum( 'name, model, cost, viewDist, decalId, LODmodel1, LODmodel2') AccInfo = PythonUtil.Enum('name, model, cost, texCard, attach') kNames = TTLocalizer.KartDNA_KartNames KartDict = { 0: (kNames[0], 'phase_6/models/karting/Kart1_Final', 100, 7.0, 'kart1', 'phase_6/models/karting/Kart1_LOD_Final', 'phase_6/models/karting/Kart1_LOD_Final', (Point3(1.5, 8.0, -0.5), Point3(1.5, 0.0, 2.0))), 1: (kNames[1], 'phase_6/models/karting/Kart2_Final', 7500, 7.0, 'kart2', 'phase_6/models/karting/Kart2_LOD2_Final', 'phase_6/models/karting/Kart2_LOD3_Final', (Point3(0.25, 7, -2), Point3(1.25, -3, 0))), 2: (kNames[2], 'phase_6/models/karting/Kart3_Final', 2500, 8.5, 'kart3', 'phase_6/models/karting/Kart3_Final_LOD2', 'phase_6/models/karting/Kart3_Final_LOD3', (Point3(1.25, 4.0, 1.0), Point3(1.25, -3.0, 2.5))) } aNames = TTLocalizer.KartDNA_AccNames AccessoryDict = { 0: (aNames[1000], 'phase_6/models/karting/accessory_frontMiddle_0', 200,
class CogdoFlyingObstacle(DirectObject): EnterEventName = 'CogdoFlyingObstacle_Enter' ExitEventName = 'CogdoFlyingObstacle_Exit' MotionTypes = PythonUtil.Enum(('BackForth', 'Loop')) def __init__(self, type, index, model, collSolid, motionPath=None, motionPattern=None, blendMotion=True, instanceModel=True): self.type = type self.index = index name = 'CogdoFlyingObstacle-%s-%i' % (self.type, self.index) if instanceModel: self.model = NodePath(name) model.instanceTo(self.model) else: self.model = model self.model.setName(name) self.currentT = 0.0 self.direction = 1.0 self.collNode = None self._initCollisions(name, collSolid) self.motionPath = motionPath self.motionPattern = motionPattern self.motionSequence = None if blendMotion: blendType = 'easeInOut' else: blendType = 'noBlend' if motionPath is not None: def moveObstacle(value): self.motionPath.goTo(self.model, value) self.motionPath = Mopath.Mopath(name='obstacle-%i' % self.index) self.motionPath.loadNodePath(motionPath) dur = self.motionPath.getMaxT() self.motionSequence = Sequence( name='%s.obstacle-%i-motionSequence' % (self.__class__.__name__, self.index)) movePart1 = LerpFunc(moveObstacle, fromData=0.0, toData=self.motionPath.getMaxT(), duration=dur, blendType=blendType) self.motionSequence.append(movePart1) if self.motionPattern == CogdoFlyingObstacle.MotionTypes.BackForth: movePart2 = LerpFunc(moveObstacle, fromData=self.motionPath.getMaxT(), toData=0.0, duration=dur, blendType=blendType) self.motionSequence.append(movePart2) return def _initCollisions(self, name, collSolid): self.collName = name self.collSolid = collSolid self.collSolid.setTangible(0) self.collNode = CollisionNode(self.collName) self.collNode.setIntoCollideMask(ToontownGlobals.WallBitmask) self.collNode.addSolid(self.collSolid) self.collNodePath = self.model.attachNewNode(self.collNode) self.collNodePath.hide() self.accept('enter' + self.collName, self._handleEnterCollision) self.accept('exit' + self.collName, self._handleExitCollision) def disable(self): if self.collNode is not None: self.collNode.setIntoCollideMask(BitMask32(0)) return def enable(self): if self.collNode is not None: self.collNode.setIntoCollideMask(ToontownGlobals.WallBitmask) return def startMoving(self, elapsedTime=0.0): if self.motionSequence is not None: self.motionSequence.loop() self.motionSequence.setT(elapsedTime % self.motionSequence.getDuration()) return def stopMoving(self): if self.motionSequence is not None: self.motionSequence.pause() return def destroy(self): self.ignoreAll() if self.motionSequence is not None: self.motionSequence.clearToInitial() del self.motionSequence del self.collSolid self.collNodePath.removeNode() del self.collNodePath del self.collNode self.model.removeNode() del self.model del self.motionPath return def update(self, dt): pass def hide(self): self.ignoreAll() self.model.hide() self.collNode.setIntoCollideMask(BitMask32(0)) def _handleEnterCollision(self, collEntry): messenger.send(CogdoFlyingObstacle.EnterEventName, [self, collEntry]) def _handleExitCollision(self, collEntry): messenger.send(CogdoFlyingObstacle.ExitEventName, [self, collEntry])
JellybeanJamMenu = [ ( OTPLocalizer.JellybeanJamMenuSections[0], [30180, 30181, 30182, 30183, 30184, 30185]), (OTPLocalizer.JellybeanJamMenuSections[1], [30186, 30187, 30188, 30189, 30190])] JellybeanJamPhases = PythonUtil.Enum('TROLLEY, FISHING, PARTIES') PhaseSpecifPhrases = [30180, 30181, 30182] class TTSCJellybeanJamMenu(SCMenu): def __init__(self, phase): SCMenu.__init__(self) if phase in JellybeanJamPhases: self.__messagesChanged(phase) else: print 'warning: tried to add Jellybean Jam phase %s which does not seem to exist' % phase def destroy(self): SCMenu.destroy(self) def clearMenu(self):
from otp.otpbase import PythonUtil from panda3d.core import VBase4 GameActions = PythonUtil.Enum( ('EnterDoor', 'RevealDoor', 'OpenDoor', 'Countdown', 'TimeAlert')) SecondsUntilTimeout = 240.0 SecondsUntilGameEnds = 60.0 SecondsForTimeAlert = 60.0 MaxPlayers = 4 IntroDurationSeconds = 24.0 FinishDurationSeconds = 5.0 PlayerCollisionName = 'CogdoMazePlayer_Collision' LocalPlayerCollisionName = 'CogdoMazeLocalPlayer_Collision' PlayerCollisionRadius = 1.0 HitCooldownTime = 2.0 HintTimeout = 6.0 NumQuadrants = (3, 3) FrameWallThickness = 1 QuadrantUnitGap = 3 TotalBarriers = 12 NumBarriers = 3 MazeBarriers = ([(7, 34), (8, 34), (9, 34), (10, 34)], [(24, 34), (25, 34), (26, 34), (27, 34)], [(41, 34), (42, 34), (43, 34), (44, 34)], [(7, 17), (8, 17), (9, 17), (10, 17)], [(24, 17), (25, 17), (26, 17), (27, 17)], [(41, 17), (42, 17), (43, 17), (44, 17)], [(17, 41), (17, 42), (17, 43), (17, 44)], [(17, 24), (17, 25), (17, 26),
import json, urllib2, webbrowser from collections import OrderedDict from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from direct.task.Task import Task from panda3d.core import * import ShtikerPage from otp.otpbase import PythonUtil from toontown.distributed import ToontownDistrictStats from toontown.toonbase import TTLocalizer from toontown.toontowngui import TTDialog POP_COLORS_NTT = ( Vec4(0.0, 1.0, 0.0, 1.0), Vec4(1.0, 1.0, 0.0, 1.0), Vec4(1.0, 0.0, 0.0, 1.0)) POP_COLORS = (Vec4(0.4, 0.4, 1.0, 1.0), Vec4(0.4, 1.0, 0.4, 1.0), Vec4(1.0, 0.4, 0.4, 1.0)) PageMode = PythonUtil.Enum('Current, List') class ServerPage(ShtikerPage.ShtikerPage): notify = DirectNotifyGlobal.directNotify.newCategory('ServerPage') def __init__(self): ShtikerPage.ShtikerPage.__init__(self) def load(self): ShtikerPage.ShtikerPage.load(self) self.currentTabPage = CurrentTabPage(self, _parent=self) self.currentTabPage.hide() self.serverTabPage = ServerTabPage(self, _parent=self) self.serverTabPage.hide() titleHeight = 0.61 self.serverTitle = '' self.title = DirectLabel(parent=self, relief=None, text=TTLocalizer.ServerPageTitle, text_scale=0.12, pos=(
class Pet(Avatar.Avatar): notify = DirectNotifyGlobal.directNotify.newCategory('Pet') SerialNum = 0 Interactions = PythonUtil.Enum('SCRATCH, BEG, EAT, NEUTRAL') InteractAnims = {Interactions.SCRATCH: ('toPet', 'pet', 'fromPet'), Interactions.BEG: ('toBeg', 'beg', 'fromBeg'), Interactions.EAT: ('eat', 'swallow', 'neutral'), Interactions.NEUTRAL: 'neutral'} def __init__(self, forGui=0): Avatar.Avatar.__init__(self) self.serialNum = Pet.SerialNum Pet.SerialNum += 1 self.lockedDown = 0 self.setPickable(1) self.setPlayerType(NametagGroup.CCNonPlayer) self.animFSM = ClassicFSM('petAnimFSM', [State('off', self.enterOff, self.exitOff), State('neutral', self.enterNeutral, self.exitNeutral), State('neutralHappy', self.enterNeutralHappy, self.exitNeutralHappy), State('neutralSad', self.enterNeutralSad, self.exitNeutralSad), State('run', self.enterRun, self.exitRun), State('swim', self.enterSwim, self.exitSwim), State('teleportIn', self.enterTeleportIn, self.exitTeleportOut), State('teleportOut', self.enterTeleportOut, self.exitTeleportOut), State('walk', self.enterWalk, self.exitWalk), State('walkHappy', self.enterWalkHappy, self.exitWalkHappy), State('walkSad', self.enterWalkSad, self.exitWalkSad)], 'off', 'off') self.animFSM.enterInitialState() self.forGui = forGui self.moodModel = None self.__blinkName = 'petblink-' + str(self.this) self.track = None self.soundBackflip = None self.soundRollover = None self.soundPlaydead = None self.soundTeleportIn = None self.soundTeleportOut = None self.teleportHole = None self.isBecomePet = 0 self.setBlend(frameBlend=config.GetBool('interpolate-animations', True)) return def isPet(self): return True def stopAnimations(self): if self.track: self.track.pause() self.stopBlink() self.animFSM.request('off') def delete(self): self.stopAnimations() self.track = None self.soundBackflip = None self.soundRollover = None self.soundPlaydead = None self.soundTeleportIn = None self.soundTeleportOut = None if self.teleportHole: self.teleportHole.cleanup() self.teleportHole = None self.eyesOpenTexture = None self.eyesClosedTexture = None self.animFSM = None self.eyes = None self.rightPupil = None self.rightHighlight = None self.rightBrow = None self.leftPupil = None self.leftHighlight = None self.leftBrow = None self.color = None Avatar.Avatar.delete(self) return def getDNA(self): return self.style def setDNA(self, dna): if self.style: pass else: self.style = dna self.generatePet() self.generateMoods() self.initializeDropShadow() self.initializeNametag3d() self.dropShadow.setScale(0.75) def generatePet(self): self.loadModel('phase_4/models/char/TT_pets-mod') self.loadAnims({'toBeg': 'phase_5/models/char/TT_pets-intoBeg', 'beg': 'phase_5/models/char/TT_pets-beg', 'fromBeg': 'phase_5/models/char/TT_pets-begOut', 'backflip': 'phase_5/models/char/TT_pets-backflip', 'dance': 'phase_5/models/char/TT_pets-heal', 'toDig': 'phase_5/models/char/TT_pets-intoDig', 'dig': 'phase_5/models/char/TT_pets-dig', 'fromDig': 'phase_5/models/char/TT_pets-digToNeutral', 'disappear': 'phase_5/models/char/TT_pets-disappear', 'eat': 'phase_5.5/models/char/TT_pets-eat', 'jump': 'phase_5/models/char/TT_pets-jump', 'neutral': 'phase_4/models/char/TT_pets-neutral', 'neutralHappy': 'phase_4/models/char/TT_pets-neutralHappy', 'neutralSad': 'phase_4/models/char/TT_pets-neutral_sad', 'sad-neutral': 'phase_4/models/char/TT_pets-neutral_sad', 'toPet': 'phase_5.5/models/char/TT_pets-petin', 'pet': 'phase_5.5/models/char/TT_pets-petloop', 'fromPet': 'phase_5.5/models/char/TT_pets-petend', 'playDead': 'phase_5/models/char/TT_pets-playdead', 'fromPlayDead': 'phase_5/models/char/TT_pets-deadend', 'reappear': 'phase_5/models/char/TT_pets-reappear', 'run': 'phase_5.5/models/char/TT_pets-run', 'rollover': 'phase_5/models/char/TT_pets-rollover', 'walkSad': 'phase_5.5/models/char/TT_pets-sadwalk', 'sad-walk': 'phase_5.5/models/char/TT_pets-sadwalk', 'speak': 'phase_5/models/char/TT_pets-speak', 'swallow': 'phase_5.5/models/char/TT_pets-swallow', 'swim': 'phase_5.5/models/char/TT_pets-swim', 'toBall': 'phase_5.5/models/char/TT_pets-toBall', 'walk': 'phase_5.5/models/char/TT_pets-walk', 'walkHappy': 'phase_5.5/models/char/TT_pets-walkHappy'}) self.setHeight(2) color = None colorIndex = self.style[5] color = AllPetColors[colorIndex] self.color = color bodyType = self.style[4] body = self.find('**/body') tex = loader.loadTexture(BodyTextures[BodyTypes[bodyType]]) tex.setMinfilter(Texture.FTLinear) tex.setMagfilter(Texture.FTLinear) body.setTexture(tex, 1) body.setColor(color) leftFoot = self.find('**/leftFoot') rightFoot = self.find('**/rightFoot') texName = getFootTexture(bodyType) tex = loader.loadTexture(texName) tex.setMinfilter(Texture.FTLinear) tex.setMagfilter(Texture.FTLinear) leftFoot.setTexture(tex, 1) rightFoot.setTexture(tex, 1) leftFoot.setColor(color) rightFoot.setColor(color) for part in HeadParts + EarParts + NoseParts + TailParts: self.find('**/' + part).stash() colorScale = ColorScales[self.style[6]] partColor = self.amplifyColor(color, colorScale) headIndex = self.style[0] if headIndex != -1: head = self.find('**/@@' + HeadParts[headIndex]) head.setColor(partColor) head.unstash() earsIndex = self.style[1] if earsIndex != -1: ears = self.find('**/@@' + EarParts[earsIndex]) ears.setColor(partColor) texName = getEarTexture(bodyType, EarParts[earsIndex]) if texName: tex = loader.loadTexture(texName) tex.setMinfilter(Texture.FTLinear) tex.setMagfilter(Texture.FTLinear) ears.setTexture(tex, 1) ears.unstash() noseIndex = self.style[2] if noseIndex != -1: nose = self.find('**/@@' + NoseParts[noseIndex]) nose.setColor(partColor) nose.unstash() tailIndex = self.style[3] if tailIndex != -1: tail = self.find('**/@@' + TailParts[tailIndex]) tail.setColor(partColor) texName = TailTextures[TailParts[tailIndex]] if texName: if BodyTypes[bodyType] == 'giraffe': texName = GiraffeTail else: if BodyTypes[bodyType] == 'leopard': texName = LeopardTail tex = loader.loadTexture(texName) tex.setMinfilter(Texture.FTLinear) tex.setMagfilter(Texture.FTLinear) tail.setTexture(tex, 1) tail.unstash() if not self.forGui: self.drawInFront('eyeWhites', 'body', 1) self.drawInFront('rightPupil', 'eyeWhites', 2) self.drawInFront('leftPupil', 'eyeWhites', 2) self.drawInFront('rightHighlight', 'rightPupil', 3) self.drawInFront('leftHighlight', 'leftPupil', 3) else: self.drawInFront('eyeWhites', 'body', -2) self.drawInFront('rightPupil', 'eyeWhites', -2) self.drawInFront('leftPupil', 'eyeWhites', -2) self.find('**/rightPupil').adjustAllPriorities(1) self.find('**/leftPupil').adjustAllPriorities(1) eyes = self.style[7] eyeColor = PetEyeColors[eyes] self.eyes = self.find('**/eyeWhites') self.rightPupil = self.find('**/rightPupil') self.leftPupil = self.find('**/leftPupil') self.rightHighlight = self.find('**/rightHighlight') self.leftHighlight = self.find('**/leftHighlight') self.rightBrow = self.find('**/rightBrow') self.leftBrow = self.find('**/leftBrow') self.eyes.setColor(1, 1, 1, 1) self.rightPupil.setColor(eyeColor, 2) self.leftPupil.setColor(eyeColor, 2) self.rightHighlight.setColor(1, 1, 1, 1) self.leftHighlight.setColor(1, 1, 1, 1) self.rightBrow.setColor(0, 0, 0, 1) self.leftBrow.setColor(0, 0, 0, 1) self.eyes.setTwoSided(1, 1) self.rightPupil.setTwoSided(1, 1) self.leftPupil.setTwoSided(1, 1) self.rightHighlight.setTwoSided(1, 1) self.leftHighlight.setTwoSided(1, 1) self.rightBrow.setTwoSided(1, 1) self.leftBrow.setTwoSided(1, 1) if self.forGui: self.rightHighlight.hide() self.leftHighlight.hide() if self.style[8]: self.eyesOpenTexture = loader.loadTexture('phase_4/maps/BeanEyeBoys2.jpg', 'phase_4/maps/BeanEyeBoys2_a.rgb') self.eyesClosedTexture = loader.loadTexture('phase_4/maps/BeanEyeBoysBlink.jpg', 'phase_4/maps/BeanEyeBoysBlink_a.rgb') else: self.eyesOpenTexture = loader.loadTexture('phase_4/maps/BeanEyeGirlsNew.jpg', 'phase_4/maps/BeanEyeGirlsNew_a.rgb') self.eyesClosedTexture = loader.loadTexture('phase_4/maps/BeanEyeGirlsBlinkNew.jpg', 'phase_4/maps/BeanEyeGirlsBlinkNew_a.rgb') self.eyesOpenTexture.setMinfilter(Texture.FTLinear) self.eyesOpenTexture.setMagfilter(Texture.FTLinear) self.eyesClosedTexture.setMinfilter(Texture.FTLinear) self.eyesClosedTexture.setMagfilter(Texture.FTLinear) self.eyesOpen() self.setBlend(frameBlend=config.GetBool('interpolate-animations', True)) return def initializeBodyCollisions(self, collIdStr): Avatar.Avatar.initializeBodyCollisions(self, collIdStr) if not self.ghostMode: self.collNode.setCollideMask(self.collNode.getIntoCollideMask() | ToontownGlobals.PieBitmask) def amplifyColor(self, color, scale): color = color * scale for i in (0, 1, 2): if color[i] > 1.0: color.setCell(i, 1.0) return color def generateMoods(self): moodIcons = loader.loadModel('phase_4/models/char/petEmotes') self.moodIcons = self.attachNewNode('moodIcons') self.moodIcons.setScale(2.0) self.moodIcons.setZ(3.65) moods = moodIcons.findAllMatches('**/+GeomNode') for moodNum in range(0, moods.getNumPaths()): mood = moods.getPath(moodNum) mood.reparentTo(self.moodIcons) mood.setBillboardPointEye() mood.hide() def clearMood(self): if self.moodModel: self.moodModel.hide() self.moodModel = None 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 self.clearChat() else: self.clearChat() mood = Component2IconDict[mood] if mood is None: moodModel = None else: moodModel = self.moodIcons.find('**/*' + mood + '*') if moodModel.isEmpty(): self.notify.warning('No such mood!: %s' % mood) return if self.moodModel == moodModel: return if self.moodModel: self.moodModel.hide() self.moodModel = moodModel if self.moodModel: self.moodModel.show() 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) def getGenderString(self): if self.style: if self.style[8]: return TTLocalizer.GenderShopBoyButtonText return TTLocalizer.GenderShopGirlButtonText def getShadowJoint(self): if hasattr(self, 'shadowJoint'): return self.shadowJoint shadowJoint = self.find('**/attachShadow') if shadowJoint.isEmpty(): self.shadowJoint = self else: self.shadowJoint = shadowJoint return self.shadowJoint def getNametagJoints(self): joints = [] bundle = self.getPartBundle('modelRoot') joint = bundle.findChild('attachNametag') if joint: joints.append(joint) return joints def fitAndCenterHead(self, maxDim, forGui=0): p1 = Point3() p2 = Point3() self.calcTightBounds(p1, p2) if forGui: h = 180 t = p1[0] p1.setX(-p2[0]) p2.setX(-t) self.getGeomNode().setDepthWrite(1) self.getGeomNode().setDepthTest(1) else: h = 0 d = p2 - p1 biggest = max(d[0], d[2]) s = (maxDim + 0.0) / biggest mid = (p1 + d / 2.0) * s self.setPosHprScale(-mid[0], -mid[1] + 1, -mid[2], h, 0, 0, s, s, s) def makeRandomPet(self): dna = PetDNA.getRandomPetDNA() self.setDNA(dna) def enterOff(self): self.stop() def exitOff(self): pass def enterBall(self): self.setPlayRate(1, 'toBall') self.play('toBall') def exitBall(self): self.setPlayRate(-1, 'toBall') self.play('toBall') def enterBackflip(self): self.play('backflip') def exitBackflip(self): self.stop('backflip') def enterBeg(self): delay = self.getDuration('toBeg') self.track = Sequence(Func(self.play, 'toBeg'), Wait(delay), Func(self.loop, 'beg')) self.track.start() def exitBeg(self): self.track.pause() self.play('fromBeg') def enterEat(self): self.loop('eat') def exitEat(self): self.stop('swallow') def enterDance(self): self.loop('dance') def exitDance(self): self.stop('dance') def enterNeutral(self): anim = 'neutral' self.pose(anim, random.choice(range(0, self.getNumFrames(anim)))) self.loop(anim, restart=0) def exitNeutral(self): self.stop('neutral') def enterNeutralHappy(self): anim = 'neutralHappy' self.pose(anim, random.choice(range(0, self.getNumFrames(anim)))) self.loop(anim, restart=0) def exitNeutralHappy(self): self.stop('neutralHappy') def enterNeutralSad(self): anim = 'neutralSad' self.pose(anim, random.choice(range(0, self.getNumFrames(anim)))) self.loop(anim, restart=0) def exitNeutralSad(self): self.stop('neutralSad') def enterRun(self): self.loop('run') def exitRun(self): self.stop('run') def enterSwim(self): self.loop('swim') def exitSwim(self): self.stop('swim') def getTeleportInTrack(self): if not self.teleportHole: self.teleportHole = Actor.Actor('phase_3.5/models/props/portal-mod', {'hole': 'phase_3.5/models/props/portal-chan'}) if config.GetBool('want-retro-mode', False): self.teleportHole.setTexture(loader.loadTexture('phase_3/maps/avatar_palette_2tmla_1_retro.jpg', 'phase_3/maps/avatar_palette_2tmla_1_retro_a.rgb'), 1) self.teleportHole.setBlend(frameBlend=config.GetBool('interpolate-animations', True)) track = Sequence(Wait(1.0), Parallel(self.getTeleportInSoundInterval(), Sequence(Func(self.showHole), ActorInterval(self.teleportHole, 'hole', startFrame=81, endFrame=71), ActorInterval(self, 'reappear'), ActorInterval(self.teleportHole, 'hole', startFrame=71, endFrame=81), Func(self.cleanupHole), Func(self.loop, 'neutral')), Sequence(Func(self.dropShadow.hide), Wait(1.0), Func(self.dropShadow.show)))) return track def enterTeleportIn(self, timestamp): self.track = self.getTeleportInTrack() self.track.start(globalClockDelta.localElapsedTime(timestamp)) def exitTeleportIn(self): self.track.pause() def getTeleportOutTrack(self): if not self.teleportHole: self.teleportHole = Actor.Actor('phase_3.5/models/props/portal-mod', {'hole': 'phase_3.5/models/props/portal-chan'}) if config.GetBool('want-retro-mode', False): self.teleportHole.setTexture(loader.loadTexture('phase_3/maps/avatar_palette_2tmla_1_retro.jpg', 'phase_3/maps/avatar_palette_2tmla_1_retro_a.rgb'), 1) self.teleportHole.setBlend(frameBlend=config.GetBool('interpolate-animations', True)) track = Sequence(Wait(1.0), Parallel(self.getTeleportOutSoundInterval(), Sequence(ActorInterval(self, 'toDig'), Parallel(ActorInterval(self, 'dig'), Func(self.showHole), ActorInterval(self.teleportHole, 'hole', startFrame=81, endFrame=71)), ActorInterval(self, 'disappear'), ActorInterval(self.teleportHole, 'hole', startFrame=71, endFrame=81), Func(self.cleanupHole)), Sequence(Wait(1.0), Func(self.dropShadow.hide)))) return track def enterTeleportOut(self, timestamp): self.track = self.getTeleportOutTrack() self.track.start(globalClockDelta.localElapsedTime(timestamp)) def exitTeleportOut(self): self.track.pause() def showHole(self): if self.teleportHole: self.teleportHole.setBin('shadow', 0) self.teleportHole.setDepthTest(0) self.teleportHole.setDepthWrite(0) self.teleportHole.reparentTo(self) self.teleportHole.setScale(0.75) self.teleportHole.setPos(0, -1, 0) def cleanupHole(self): if self.teleportHole: self.teleportHole.reparentTo(hidden) self.teleportHole.clearBin() self.teleportHole.clearDepthTest() self.teleportHole.clearDepthWrite() def getTeleportInSoundInterval(self): if not self.soundTeleportIn: self.soundTeleportIn = loader.loadSfx('phase_5/audio/sfx/teleport_reappear.ogg') return SoundInterval(self.soundTeleportIn) def getTeleportOutSoundInterval(self): if not self.soundTeleportOut: self.soundTeleportOut = loader.loadSfx('phase_5/audio/sfx/teleport_disappear.ogg') return SoundInterval(self.soundTeleportOut) def enterWalk(self): self.loop('walk') def exitWalk(self): self.stop('walk') def enterWalkHappy(self): self.loop('walkHappy') def exitWalkHappy(self): self.stop('walkHappy') def enterWalkSad(self): self.loop('walkSad') def exitWalkSad(self): self.stop('walkSad') def trackAnimToSpeed(self, forwardVel, rotVel, inWater=0): action = 'neutral' if self.isInWater(): action = 'swim' else: if forwardVel > 0.1 or abs(rotVel) > 0.1: action = 'walk' self.setAnimWithMood(action) def setAnimWithMood(self, action): how = '' if self.isExcited(): how = 'Happy' else: if self.isSad(): how = 'Sad' if action == 'swim': anim = action else: anim = '%s%s' % (action, how) if anim != self.animFSM.getCurrentState().getName(): self.animFSM.request(anim) def isInWater(self): return 0 def isExcited(self): return 0 def isSad(self): return 0 def startTrackAnimToSpeed(self): self.lastPos = self.getPos(render) self.lastH = self.getH(render) taskMgr.add(self._trackAnimTask, self.getTrackAnimTaskName()) def stopTrackAnimToSpeed(self): taskMgr.remove(self.getTrackAnimTaskName()) del self.lastPos del self.lastH def getTrackAnimTaskName(self): return 'trackPetAnim-%s' % self.serialNum def _trackAnimTask(self, task): curPos = self.getPos(render) curH = self.getH(render) self.trackAnimToSpeed(curPos - self.lastPos, curH - self.lastH) self.lastPos = curPos self.lastH = curH return Task.cont def __blinkOpen(self, task): self.eyesOpen() r = random.random() if r < 0.1: t = 0.2 else: t = r * 4.0 + 1 taskMgr.doMethodLater(t, self.__blinkClosed, self.__blinkName) return Task.done def __blinkClosed(self, task): self.eyesClose() taskMgr.doMethodLater(0.125, self.__blinkOpen, self.__blinkName) return Task.done def startBlink(self): taskMgr.remove(self.__blinkName) self.eyesOpen() t = random.random() * 4.0 + 1 taskMgr.doMethodLater(t, self.__blinkClosed, self.__blinkName) def stopBlink(self): taskMgr.remove(self.__blinkName) self.eyesOpen() def eyesOpen(self): self.eyes.setColor(1, 1, 1, 1) self.eyes.setTexture(self.eyesOpenTexture, 1) self.rightPupil.show() self.leftPupil.show() if not self.forGui: self.rightHighlight.show() self.leftHighlight.show() def eyesClose(self): self.eyes.setColor(self.color) self.eyes.setTexture(self.eyesClosedTexture, 1) self.rightPupil.hide() self.leftPupil.hide() if not self.forGui: self.rightHighlight.hide() self.leftHighlight.hide() def lockPet(self): if not self.lockedDown: self.prevAnimState = self.animFSM.getCurrentState().getName() self.animFSM.request('neutral') self.lockedDown += 1 def isLockedDown(self): return self.lockedDown != 0 def unlockPet(self): self.lockedDown -= 1 if not self.lockedDown: self.animFSM.request(self.prevAnimState) self.prevAnimState = None return def getInteractIval(self, interactId): anims = self.InteractAnims[interactId] if type(anims) == types.StringType: animIval = ActorInterval(self, anims) else: animIval = Sequence() for anim in anims: animIval.append(ActorInterval(self, anim)) return animIval
from otp.otpbase import PythonUtil from panda3d.core import VBase4, Vec3, Point3 from CogdoUtil import VariableContainer, DevVariableContainer AI = VariableContainer() AI.GameActions = PythonUtil.Enum( ('LandOnWinPlatform', 'WinStateFinished', 'GotoWinState', 'HitWhirlwind', 'HitLegalEagle', 'HitMinion', 'DebuffInvul', 'RequestEnterEagleInterest', 'RequestExitEagleInterest', 'RanOutOfTimePenalty', 'Died', 'Spawn', 'SetBlades', 'BladeLost')) AI.BroadcastPeriod = 0.3 AI.SafezoneId2DeathDamage = { 2000: 1, 1000: 2, 5000: 4, 4000: 8, 3000: 12, 9000: 16 } AI.SafezoneId2WhirlwindDamage = { 2000: 1, 1000: 2, 5000: 4, 4000: 8, 3000: 12, 9000: 16 } AI.SafezoneId2LegalEagleDamage = { 2000: 2, 1000: 4, 5000: 8, 4000: 16,
8: PartNameStrings[3], 16: PartNameStrings[4], 32: PartNameStrings[4], 64: SimplePartNameStrings[0], 128: SimplePartNameStrings[0], 256: SimplePartNameStrings[0], 512: SimplePartNameStrings[0], 1024: PartNameStrings[10], 2048: PartNameStrings[11], 4096: PartNameStrings[12], 8192: PartNameStrings[12], 16384: PartNameStrings[14], 32768: PartNameStrings[15], 65536: PartNameStrings[15] }) suitTypes = PythonUtil.Enum(('NoSuit', 'NoMerits', 'FullSuit')) def getNextPart(parts, partIndex, dept): dept = dept2deptIndex(dept) needMask = PartsPerSuitBitmasks[dept] & PartsQueryMasks[partIndex] haveMask = parts[dept] & PartsQueryMasks[partIndex] nextPart = ~needMask | haveMask nextPart = nextPart ^ nextPart + 1 nextPart = nextPart + 1 >> 1 return nextPart def getPartName(partArray): index = 0 for part in partArray:
2008, ( 255 / 255.0, 153 / 255.0, 193 / 255.0), ( 240 / 255.0, 157 / 255.0, 192 / 255.0), ( 255 / 255.0, 215 / 255.0, 238 / 255.0)), ( 2009, ( 170 / 255.0, 120 / 255.0, 20 / 255.0), ( 165 / 255.0, 120 / 255.0, 50 / 255.0), ( 210 / 255.0, 200 / 255.0, 180 / 255.0))) PageMode = PythonUtil.Enum('Options, Codes') class OptionsPage(ShtikerPage.ShtikerPage): notify = DirectNotifyGlobal.directNotify.newCategory('OptionsPage') def __init__(self): ShtikerPage.ShtikerPage.__init__(self) def load(self): ShtikerPage.ShtikerPage.load(self) self.optionsTabPage = OptionsTabPage(self) self.optionsTabPage.hide() self.codesTabPage = CodesTabPage(self) self.codesTabPage.hide() titleHeight = 0.61 self.title = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageTitle, text_scale=0.12, pos=(0, 0, titleHeight))
from panda3d.core import * from direct.interval.IntervalGlobal import * from otp.otpbase import PythonUtil from toontown.battle.BattleProps import globalPropPool from direct.directnotify import DirectNotifyGlobal SFX = PythonUtil.Enum('poof, magic') SFXPATHS = { SFX.poof: 'phase_4/audio/sfx/firework_distance_02.ogg', SFX.magic: 'phase_4/audio/sfx/SZ_DD_treasure.ogg' } class DustCloud(NodePath): dustCloudCount = 0 sounds = {} notify = DirectNotifyGlobal.directNotify.newCategory('DustCloud') def __init__(self, parent=hidden, fBillboard=1, wantSound=0): NodePath.__init__(self) self.assign(globalPropPool.getProp('suit_explosion_dust')) if fBillboard: self.setBillboardAxis() self.reparentTo(parent) self.seqNode = self.find('**/+SequenceNode').node() self.seqNode.setFrameRate(0) self.wantSound = wantSound if self.wantSound and not DustCloud.sounds: DustCloud.sounds[SFX.poof] = loader.loadSfx(SFXPATHS[SFX.poof]) self.track = None self.trackId = DustCloud.dustCloudCount
from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from panda3d.core import * from otp.otpbase import PythonUtil from direct.task import Task from toontown.fishing.FishPhoto import DirectRegion from toontown.shtiker.ShtikerPage import ShtikerPage from toontown.toonbase import ToontownGlobals, TTLocalizer from FishPage import FishingTrophy from toontown.golf import GolfGlobals PageMode = PythonUtil.Enum('Records, Trophy') class GolfPage(ShtikerPage): notify = DirectNotifyGlobal.directNotify.newCategory('GolfPage') def __init__(self): ShtikerPage.__init__(self) self.avatar = None self.mode = PageMode.Trophy return def enter(self): if not hasattr(self, 'title'): self.load() self.setMode(self.mode, 1) ShtikerPage.enter(self) def exit(self): self.golfTrophies.hide() self.golfRecords.hide()