From 81728b339a76f493d4dae44490ccbb5061a6246f Mon Sep 17 00:00:00 2001 From: John Date: Mon, 25 May 2015 14:29:48 +0300 Subject: [PATCH] DANIEL: Better glove NPC --- dependencies/astron/dclass/stride.dc | 4 +- toontown/ai/DistributedBlackCatMgr.py | 21 +-- toontown/toon/DistributedNPCGlove.py | 230 ++++++------------------ toontown/toon/DistributedNPCGloveAI.py | 24 +-- toontown/toon/GloveNPCGlobals.py | 21 +++ toontown/toon/GloveShopGui.py | 143 +++++++++++++++ toontown/toon/NPCToons.py | 1 + toontown/toon/Toon.py | 49 +++-- toontown/toonbase/TTLocalizerEnglish.py | 7 +- 9 files changed, 262 insertions(+), 238 deletions(-) create mode 100644 toontown/toon/GloveNPCGlobals.py create mode 100644 toontown/toon/GloveShopGui.py diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 16de6948..d9f34dc1 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -1973,8 +1973,8 @@ dclass DistributedNPCLaffRestock : DistributedNPCToonBase { }; dclass DistributedNPCGlove : DistributedNPCToonBase { - doTransformation(uint32 avId, uint32) broadcast; - requestTransformation(uint32) airecv clsend; + changeGlove(uint8) airecv clsend; + changeGloveResult(uint32 avId, uint8) broadcast; }; dclass DistributedKnockKnockDoor : DistributedAnimatedProp { diff --git a/toontown/ai/DistributedBlackCatMgr.py b/toontown/ai/DistributedBlackCatMgr.py index 134f48f1..f1f50717 100755 --- a/toontown/ai/DistributedBlackCatMgr.py +++ b/toontown/ai/DistributedBlackCatMgr.py @@ -1,24 +1,5 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed import DistributedObject -from direct.interval.IntervalGlobal import * -from toontown.effects import DustCloud - -def getDustCloudIval(toon): - dustCloud = DustCloud.DustCloud(fBillboard=0) - dustCloud.setBillboardAxis(2.0) - dustCloud.setZ(3) - dustCloud.setScale(0.4) - dustCloud.createTrack() - - if hasattr(toon, 'laffMeter'): - toon.laffMeter.color = toon.style.getBlackColor() - - sequence = Sequence(Wait(0.5), Func(dustCloud.reparentTo, toon), dustCloud.track, Func(dustCloud.destroy)) - - if hasattr(toon, 'laffMeter'): - sequence.append(Func(toon.laffMeter.adjustFace, toon.hp, toon.maxHp)) - - return sequence class DistributedBlackCatMgr(DistributedObject.DistributedObject): neverDisable = 1 @@ -36,4 +17,4 @@ class DistributedBlackCatMgr(DistributedObject.DistributedObject): self.sendUpdate('requestBlackCatTransformation') def doBlackCatTransformation(self): - getDustCloudIval(base.localAvatar).start() + getDustCloudIval(base.localAvatar, color=base.localAvatar.style.getBlackColor()).start() \ No newline at end of file diff --git a/toontown/toon/DistributedNPCGlove.py b/toontown/toon/DistributedNPCGlove.py index db58323e..e20f0fc4 100755 --- a/toontown/toon/DistributedNPCGlove.py +++ b/toontown/toon/DistributedNPCGlove.py @@ -1,191 +1,77 @@ -from direct.fsm import ClassicFSM, State -from direct.gui.DirectGui import * -from direct.task.Task import Task -from pandac.PandaModules import * -import time - -from DistributedNPCToonBase import * -from toontown.chat.ChatGlobals import * -from toontown.effects import DustCloud -from toontown.nametag.NametagGlobals import * +from toontown.chat.ChatGlobals import CFSpeech, CFTimeout from toontown.toonbase import TTLocalizer, ToontownGlobals -from toontown.toon.ToonDNA import allColorsList - -def getDustCloud(toon): - dustCloud = DustCloud.DustCloud(fBillboard=0) - - dustCloud.setBillboardAxis(2.0) - dustCloud.setZ(3) - dustCloud.setScale(0.4) - dustCloud.createTrack() - return Sequence(Wait(0.5), Func(dustCloud.reparentTo, toon), dustCloud.track, Func(dustCloud.destroy)) +from toontown.toon import NPCToons +from DistributedNPCToonBase import DistributedNPCToonBase +import GloveNPCGlobals, GloveShopGui, time class DistributedNPCGlove(DistributedNPCToonBase): + def __init__(self, cr): DistributedNPCToonBase.__init__(self, cr) - self.nextCollision = 0 - - self.fsm = ClassicFSM.ClassicFSM( - 'NPCGlove', - [ - State.State('off', self.enterOff, self.exitOff, ['pickColor']), - State.State('pickColor', self.enterPickColor, self.exitPickColor, ['off']) - ], 'off', 'off') - self.fsm.enterInitialState() - - self.title = None - self.notice = None - self.color = None - self.buyButton = None - self.cancelButton = None - self.leftButton = None - self.rightButton = None - self.index = 0 - - self.gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui') - self.shuffleArrowUp = self.gui.find('**/tt_t_gui_mat_shuffleArrowUp') - self.shuffleArrowDown = self.gui.find('**/tt_t_gui_mat_shuffleArrowDown') - self.shuffleUp = self.gui.find('**/tt_t_gui_mat_shuffleUp') - self.shuffleDown = self.gui.find('**/tt_t_gui_mat_shuffleDown') + self.lastCollision = 0 + self.gloveDialog = None def disable(self): self.ignoreAll() - self.destroyGui() - self.nextCollision = 0 + self.destroyDialog() DistributedNPCToonBase.disable(self) - def destroyGui(self): - for element in [self.title, self.notice, self.color, self.buyButton, self.cancelButton, self.leftButton, self.rightButton]: - if element: - element.destroy() - element = None - - self.index = 0 - - def createGui(self): - self.title = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiTitle, - text_fg=(0, 1, 0, 1), text_scale=0.15, text_font=ToontownGlobals.getSignFont(), - pos=(0, 0, -0.30), text_shadow=(1, 1, 1, 1)) - - self.notice = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiNotice % ToontownGlobals.GloveCost, - text_fg=(1, 0, 0, 1), text_scale=0.11, text_font=ToontownGlobals.getSignFont(), - pos=(0, 0, -0.45), text_shadow=(1, 1, 1, 1)) - - self.color = DirectLabel(aspect2d, relief=None, text='', - text_scale=0.11, text_font=ToontownGlobals.getSignFont(), - pos=(0, 0, -0.70), text_shadow=(1, 1, 1, 1)) - - self.buyButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown), - text=TTLocalizer.GloveGuiBuy, text_font=ToontownGlobals.getInterfaceFont(), - text_scale=0.11, text_pos=(0, -0.02), pos=(-0.60, 0, -0.90), text_fg=(1, 1, 1, 1), - text_shadow=(0, 0, 0, 1), command=self.handleBuy) - - self.cancelButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown), - text=TTLocalizer.GloveGuiCancel, text_font=ToontownGlobals.getInterfaceFont(), - text_scale=0.11, text_pos=(0, -0.02), pos=(0.60, 0, -0.90), text_fg=(1, 1, 1, 1), - text_shadow=(0, 0, 0, 1), command=self.leave) - - self.leftButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown), - pos=(-0.60, 0, -0.66), command=self.handleSetIndex, extraArgs=[-1]) - - self.rightButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown), - pos=(0.60, 0, -0.66), scale=-1, command=self.handleSetIndex, extraArgs=[1]) - - self.updateGuiByIndex() - - def handleSetIndex(self, offset): - newIndex = self.index + offset - - if newIndex > -1 and newIndex < len(TTLocalizer.NumToColor): - self.index = newIndex - self.updateGuiByIndex() - - def updateGuiByIndex(self): - self.color['text'] = TTLocalizer.NumToColor[self.index] - self.color['text_fg'] = allColorsList[self.index] - - def handleBuy(self): - self.d_requestTransformation(self.index) + def destroyDialog(self): + self.clearChat() + if self.gloveDialog: + self.gloveDialog.destroy() + self.gloveDialog = None + def initToonState(self): - self.setAnimState('neutral', 1.05, None, None) - self.setPosHpr(101, -14, 4, -305, 0, 0) + self.setAnimState('neutral', 0.9, None, None) + + if self.name in NPCToons.GlovePositions: + pos = NPCToons.GlovePositions[self.name] + self.setPos(*pos[0]) + self.setH(pos[1]) def getCollSphereRadius(self): - return 1.0 + return 1.25 def handleCollisionSphereEnter(self, collEntry): - self.currentTime = time.time() - - if self.nextCollision <= self.currentTime: - self.fsm.request('pickColor') - - self.nextCollision = self.currentTime + 2 - - def enterOff(self): - pass - - def exitOff(self): - pass - - def enterPickColor(self): - base.cr.playGame.getPlace().setState('stopped') - taskMgr.doMethodLater(45, self.leave, 'npcSleepTask-%s' % self.doId) - self.setChatAbsolute('', CFSpeech) - - if base.localAvatar.getTotalMoney() < ToontownGlobals.GloveCost: - self.setChatAbsolute(self.getMessageById(2), CFSpeech|CFTimeout) - self.reset() - else: - self.popupPickColorGUI() - - def exitPickColor(self, task=None): - taskMgr.remove('npcSleepTask-%s' % self.doId) - taskMgr.doMethodLater(0.5, self.reset, 'avatarRecover-%s-%s' % (self.doId, base.localAvatar.doId)) - - if task is not None: - return task.done - - def popupPickColorGUI(self): - self.setChatAbsolute('', CFSpeech) - self.setChatAbsolute(TTLocalizer.GlovePickColorMessage, CFSpeech|CFTimeout) - base.setCellsActive(base.bottomCells, 0) - self.createGui() - - def getMessageById(self, response): - if response == 1: - return TTLocalizer.GloveSameColorMessage - elif response == 2: - return TTLocalizer.GloveNoMoneyMessage - else: - return TTLocalizer.GloveSuccessMessage - - def doTransformation(self, avId, response): - av = self.cr.doId2do.get(avId) - - if not av: + if self.lastCollision > time.time(): return - - if response == 3: - getDustCloud(av).start() - - self.setChatAbsolute('', CFSpeech) - self.setChatAbsolute(self.getMessageById(response), CFSpeech|CFTimeout) - - def d_requestTransformation(self, color): - self.sendUpdate('requestTransformation', [color]) - self.reset() - - def leave(self, task=None): - self.setChatAbsolute('', CFSpeech) - self.setChatAbsolute(TTLocalizer.GloveByeMessage, CFSpeech|CFTimeout) - self.reset(task) - - def reset(self, task=None): - self.fsm.request('off') - base.cr.playGame.getPlace().setState('walk') + + self.lastCollision = time.time() + ToontownGlobals.NPCCollisionDelay + + if base.localAvatar.getTotalMoney() < ToontownGlobals.GloveCost: + self.setChatAbsolute(TTLocalizer.GloveMoreMoneyMessage % ToontownGlobals.GloveCost, CFSpeech|CFTimeout) + return + + base.cr.playGame.getPlace().fsm.request('stopped') + base.setCellsActive(base.bottomCells, 0) + self.setChatAbsolute(TTLocalizer.GlovePickColorMessage, CFSpeech|CFTimeout) + self.acceptOnce('gloveShopDone', self.__gloveShopDone) + self.gloveDialog = GloveShopGui.GloveShopGui() + + def freeAvatar(self): + base.cr.playGame.getPlace().fsm.request('walk') base.setCellsActive(base.bottomCells, 1) - self.destroyGui() + + def __gloveShopDone(self, state, glove): + self.freeAvatar() - if task is not None: - return task.done + if state == GloveNPCGlobals.TIMER_END: + self.setChatAbsolute(TTLocalizer.STOREOWNER_TOOKTOOLONG, CFSpeech|CFTimeout) + return + elif state == GloveNPCGlobals.USER_CANCEL: + self.setChatAbsolute(TTLocalizer.STOREOWNER_GOODBYE, CFSpeech|CFTimeout) + return + elif state == GloveNPCGlobals.CHANGE: + self.sendUpdate('changeGlove', [glove]) + + def changeGloveResult(self, avId, state): + if state in GloveNPCGlobals.ChangeMessages: + self.setChatAbsolute(GloveNPCGlobals.ChangeMessages[state], CFSpeech|CFTimeout) + + if state == GloveNPCGlobals.CHANGE_SUCCESSFUL: + av = self.cr.doId2do.get(avId) + + if av: + av.getDustCloud().start() \ No newline at end of file diff --git a/toontown/toon/DistributedNPCGloveAI.py b/toontown/toon/DistributedNPCGloveAI.py index d644a8bc..8ec86fb3 100755 --- a/toontown/toon/DistributedNPCGloveAI.py +++ b/toontown/toon/DistributedNPCGloveAI.py @@ -1,27 +1,27 @@ -from DistributedNPCToonBaseAI import DistributedNPCToonBaseAI -from ToonDNA import ToonDNA from toontown.toonbase import ToontownGlobals +import DistributedNPCToonBaseAI, GloveNPCGlobals, ToonDNA -class DistributedNPCGloveAI(DistributedNPCToonBaseAI): +class DistributedNPCGloveAI(DistributedNPCToonBaseAI.DistributedNPCToonBaseAI): - def requestTransformation(self, color): + def changeGlove(self, color): avId = self.air.getAvatarIdFromSender() av = self.air.doId2do.get(avId) if av is None or not hasattr(av, 'dna'): return - - if av.dna.gloveColor == color: - self.sendUpdate('doTransformation', [avId, 1]) + elif len(ToonDNA.allColorsList) <= color: + self.sendUpdate('changeGloveResult', [avId, GloveNPCGlobals.INVALID_COLOR]) return - - if av.getTotalMoney() < ToontownGlobals.GloveCost: - self.sendUpdate('doTransformation', [avId, 2]) + elif av.dna.gloveColor == color: + self.sendUpdate('changeGloveResult', [avId, GloveNPCGlobals.SAME_COLOR]) + return + elif av.getTotalMoney() < ToontownGlobals.GloveCost: + self.sendUpdate('changeGloveResult', [avId, GloveNPCGlobals.NOT_ENOUGH_MONEY]) return av.takeMoney(ToontownGlobals.GloveCost) - newDNA = ToonDNA() + newDNA = ToonDNA.ToonDNA() newDNA.makeFromNetString(av.getDNAString()) newDNA.gloveColor = color taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId) - self.sendUpdate('doTransformation', [avId, 3]) + self.sendUpdate('changeGloveResult', [avId, GloveNPCGlobals.CHANGE_SUCCESSFUL]) \ No newline at end of file diff --git a/toontown/toon/GloveNPCGlobals.py b/toontown/toon/GloveNPCGlobals.py new file mode 100644 index 00000000..8635b892 --- /dev/null +++ b/toontown/toon/GloveNPCGlobals.py @@ -0,0 +1,21 @@ +from toontown.toonbase import TTLocalizer + +TIMER_SECONDS = 60 + +# Glove Shop GUI +TIMER_END = 0 +USER_CANCEL = 1 +CHANGE = 2 + +# Glove Results +INVALID_COLOR = 0 +SAME_COLOR = 1 +NOT_ENOUGH_MONEY = 2 +CHANGE_SUCCESSFUL = 3 + +ChangeMessages = { + INVALID_COLOR: TTLocalizer.GloveInvalidColorMessage, + SAME_COLOR: TTLocalizer.GloveSameColorMessage, + NOT_ENOUGH_MONEY: TTLocalizer.GloveNoMoneyMessage, + CHANGE_SUCCESSFUL: TTLocalizer.GloveSuccessMessage +} \ No newline at end of file diff --git a/toontown/toon/GloveShopGui.py b/toontown/toon/GloveShopGui.py new file mode 100644 index 00000000..f7a243b9 --- /dev/null +++ b/toontown/toon/GloveShopGui.py @@ -0,0 +1,143 @@ +from direct.gui.DirectGui import DirectButton, DirectLabel, DGG +from direct.task.Task import Task +from toontown.toon import ToonDNA +from toontown.toonbase import ToontownGlobals, TTLocalizer, ToontownTimer +import GloveNPCGlobals, time + +class GloveShopGui: + + def __init__(self): + self.index = 0 + self.id = time.time() + self.lastGlove = base.localAvatar.style.gloveColor + self.timer = ToontownTimer.ToontownTimer() + self.timer.reparentTo(aspect2d) + self.timer.posInTopRightCorner() + self.timer.countdown(GloveNPCGlobals.TIMER_SECONDS, self.__exit, [GloveNPCGlobals.TIMER_END]) + self.setupButtons() + self.bindButtons() + self.__updateIndex(0) + + def setupButtons(self): + gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui') + arrowImage = (gui.find('**/tt_t_gui_mat_shuffleArrowUp'), gui.find('**/tt_t_gui_mat_shuffleArrowDown')) + buttonImage = (gui.find('**/tt_t_gui_mat_shuffleUp'), gui.find('**/tt_t_gui_mat_shuffleDown')) + + self.title = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiTitle, + text_fg=(0, 1, 0, 1), text_scale=0.15, text_font=ToontownGlobals.getSignFont(), + pos=(0, 0, -0.30), text_shadow=(1, 1, 1, 1)) + + self.notice = DirectLabel(aspect2d, relief=None, text='', text_fg=(1, 0, 0, 1), text_scale=0.11, + text_font=ToontownGlobals.getSignFont(), pos=(0, 0, -0.45), text_shadow=(1, 1, 1, 1)) + + self.color = DirectLabel(aspect2d, relief=None, text='', text_scale=0.11, text_font=ToontownGlobals.getSignFont(), + pos=(0, 0, -0.70), text_shadow=(1, 1, 1, 1)) + + self.buyButton = DirectButton(aspect2d, relief=None, image=buttonImage, text=TTLocalizer.GloveGuiBuy, + text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.11, text_pos=(0, -0.02), + pos=(-0.60, 0, -0.90), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), command=self.__exit, extraArgs=[GloveNPCGlobals.CHANGE]) + + self.cancelButton = DirectButton(aspect2d, relief=None, image=buttonImage, text=TTLocalizer.lCancel, + text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.11, text_pos=(0, -0.02), + pos=(0.60, 0, -0.90), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), command=self.__exit, extraArgs=[GloveNPCGlobals.USER_CANCEL]) + + self.downArrow = DirectButton(aspect2d, relief=None, image=arrowImage, pos=(-0.60, 0, -0.66)) + self.upArrow = DirectButton(aspect2d, relief=None, image=arrowImage, pos=(0.60, 0, -0.66), scale=-1) + + gui.removeNode() + + def bindButtons(self): + self.downArrow.bind(DGG.B1PRESS, self.__taskUpdate, extraArgs=[-1]) + self.downArrow.bind(DGG.B1RELEASE, self.__taskDone) + self.upArrow.bind(DGG.B1PRESS, self.__taskUpdate, extraArgs=[1]) + self.upArrow.bind(DGG.B1RELEASE, self.__taskDone) + + def destroy(self): + if self.timer: + self.timer.destroy() + + if not hasattr(self, 'title'): + return + + # TODO: DirectDialog-ify + self.title.destroy() + self.notice.destroy() + self.color.destroy() + self.buyButton.destroy() + self.cancelButton.destroy() + self.downArrow.destroy() + self.upArrow.destroy() + del self.title + del self.notice + del self.color + del self.buyButton + del self.cancelButton + del self.downArrow + del self.upArrow + + taskMgr.remove('runGloveCounter-%s' % self.id) + + def setClientGlove(self, color): + dna = base.localAvatar.style + + dna.gloveColor = color + base.localAvatar.setDNA(dna) + + def __exit(self, state): + self.destroy() + self.setClientGlove(self.lastGlove) + messenger.send('gloveShopDone', [state, self.index if state == GloveNPCGlobals.CHANGE else 0]) + + def __updateIndex(self, offset): + self.index += offset + hitLimit = 0 + + if self.index <= 0: + self.downArrow['state'] = DGG.DISABLED + hitLimit = 1 + else: + self.downArrow['state'] = DGG.NORMAL + + if (self.index + 1) >= len(TTLocalizer.NumToColor): + self.upArrow['state'] = DGG.DISABLED + hitLimit = 1 + else: + self.upArrow['state'] = DGG.NORMAL + + if self.lastGlove == self.index: + self.buyButton['state'] = DGG.DISABLED + self.notice['text'] = TTLocalizer.GloveGuiSameColor + else: + self.buyButton['state'] = DGG.NORMAL + self.notice['text'] = TTLocalizer.GloveGuiNotice % ToontownGlobals.GloveCost + + self.color['text'] = TTLocalizer.NumToColor[self.index] + self.color['text_fg'] = ToonDNA.allColorsList[self.index] + self.setClientGlove(self.index) + return hitLimit + + def __runTask(self, task): + if task.time - task.prevTime < task.delayTime: + return Task.cont + else: + task.delayTime = max(0.05, task.delayTime * 0.75) + task.prevTime = task.time + hitLimit = self.__updateIndex(task.delta) + + return Task.done if hitLimit else Task.cont + + def __taskDone(self, event): + messenger.send('wakeup') + taskMgr.remove('runGloveCounter-%s' % self.id) + + def __taskUpdate(self, delta, event): + messenger.send('wakeup') + + task = Task(self.__runTask) + task.delayTime = 0.4 + task.prevTime = 0.0 + task.delta = delta + hitLimit = self.__updateIndex(delta) + + if not hitLimit: + taskMgr.add(task, 'runGloveCounter-%s' % self.id) \ No newline at end of file diff --git a/toontown/toon/NPCToons.py b/toontown/toon/NPCToons.py index 07d4b4ab..c0f33427 100755 --- a/toontown/toon/NPCToons.py +++ b/toontown/toon/NPCToons.py @@ -11699,6 +11699,7 @@ LaffRestockPositions = {lnames[11001]: ((-27.0, -170.0, -19.6), 215.0), lnames[12001]: ((361.9, -394.4, -23.5), 113.5), lnames[13001]: ((143.7, -381.4, -68.4), 0.0), lnames[10001]: ((135.0, 128.8, 0.025), -212.8)} +GlovePositions = {lnames[2021]: ((101, -14, 4), -305)} del lnames zone2NpcDict = {} diff --git a/toontown/toon/Toon.py b/toontown/toon/Toon.py index ea6cb43f..a5f5efe7 100755 --- a/toontown/toon/Toon.py +++ b/toontown/toon/Toon.py @@ -2258,17 +2258,9 @@ class Toon(Avatar.Avatar, ToonHead): def __doPumpkinHeadSwitch(self, lerpTime, toPumpkin): node = self.getGeomNode() - - def getDustCloudIval(): - dustCloud = DustCloud.DustCloud(fBillboard=0, wantSound=1) - dustCloud.setBillboardAxis(2.0) - dustCloud.setZ(3) - dustCloud.setScale(0.4) - dustCloud.createTrack() - return Sequence(Func(dustCloud.reparentTo, self), dustCloud.track, Func(dustCloud.destroy), name='dustCloadIval') - - dust = getDustCloudIval() + dust = self.getDustCloud(0.0) track = Sequence() + if toPumpkin: track.append(Func(self.stopBlink)) track.append(Func(self.closeEyes)) @@ -2310,17 +2302,9 @@ class Toon(Avatar.Avatar, ToonHead): def __doSnowManHeadSwitch(self, lerpTime, toSnowMan): node = self.getGeomNode() - - def getDustCloudIval(): - dustCloud = DustCloud.DustCloud(fBillboard=0, wantSound=0) - dustCloud.setBillboardAxis(2.0) - dustCloud.setZ(3) - dustCloud.setScale(0.4) - dustCloud.createTrack() - return Sequence(Func(dustCloud.reparentTo, self), dustCloud.track, Func(dustCloud.destroy), name='dustCloadIval') - - dust = getDustCloudIval() + dust = self.getDustCloud(0.0) track = Sequence() + if toSnowMan: track.append(Func(self.stopBlink)) track.append(Func(self.closeEyes)) @@ -2370,16 +2354,8 @@ class Toon(Avatar.Avatar, ToonHead): track = Sequence() greenTrack = Parallel() - def getDustCloudIval(): - dustCloud = DustCloud.DustCloud(fBillboard=0, wantSound=1) - dustCloud.setBillboardAxis(2.0) - dustCloud.setZ(3) - dustCloud.setScale(0.4) - dustCloud.createTrack() - return Sequence(Func(dustCloud.reparentTo, self), dustCloud.track, Func(dustCloud.destroy), name='dustCloadIval') - if lerpTime > 0.0: - dust = getDustCloudIval() + dust = self.getDustCloud(0.0) track.append(Func(dust.start)) track.append(Wait(0.5)) if toGreen: @@ -3017,5 +2993,20 @@ class Toon(Avatar.Avatar, ToonHead): return sequence + def getDustCloud(self, delay=0.5, color=False): + dustCloud = DustCloud.DustCloud(fBillboard=0, wantSound=1) + + dustCloud.setBillboardAxis(2.0) + dustCloud.setZ(3) + dustCloud.setScale(0.4) + dustCloud.createTrack() + sequence = Sequence(Wait(delay), Func(dustCloud.reparentTo, self), dustCloud.track, Func(dustCloud.destroy), name='dustCloudIval') + + if color is not None and hasattr(self, 'laffMeter'): + self.laffMeter.color = color + sequence.append(Func(self.laffMeter.adjustFace, self.hp, self.maxHp)) + + return sequence + loadModels() compileGlobalAnimList() diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index da778b39..6099ab5e 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8355,15 +8355,16 @@ InteractivePropTrackBonusTerms = {0: 'Super Toon-Up!', 4: 'Super Throw!', 5: 'Super Squirt!', 6: ''} -GloveSameColorMessage = 'You already have those gloves!' +GloveInvalidColorMessage = "That's an unpainted color." +GloveSameColorMessage = "You're already wearing those gloves!" GloveNoMoneyMessage = "You don't have enough jellybeans!" +GloveMoreMoneyMessage = 'You need %s jellybeans to buy new gloves!' GloveSuccessMessage = 'Have fun with your new gloves!' -GloveByeMessage = 'See you later!' GlovePickColorMessage = 'Feel free to choose!' GloveGuiTitle = 'Choose a glove color!' GloveGuiNotice = 'Costs %s jellybeans.' GloveGuiBuy = 'Buy' -GloveGuiCancel = 'Cancel' +GloveGuiSameColor = 'You already have these!' LanguageButtonText = 'Language' LanguageSelectorTitle = 'Choose your language!' LanguageSelectorCurrent = 'Current language: %s'