def requestPurchase(self, phone, callback): from toontown.toontowngui import TTDialog avatar = base.localAvatar clothesOnOrder = 0 for item in avatar.onOrder + avatar.mailboxContents: if item.storedInCloset(): clothesOnOrder += 1 if avatar.isClosetFull(clothesOnOrder): self.requestPurchaseCleanup() buttonCallback = PythonUtil.Functor(self.__handleFullPurchaseDialog, phone, callback) self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.CatalogPurchaseClosetFull, text_wordwrap=15, command=buttonCallback) self.dialog.show() else: CatalogItem.CatalogItem.requestPurchase(self, phone, callback)
def requestPurchase(self, phone, callback): from toontown.toontowngui import TTDialog avatar = base.localAvatar itemsOnOrder = 0 for item in avatar.onOrder + avatar.mailboxContents: if item.storedInAttic() and not item.replacesExisting(): itemsOnOrder += 1 numHouseItems = phone.numHouseItems + itemsOnOrder if numHouseItems >= ToontownGlobals.MaxHouseItems and not self.replacesExisting(): self.requestPurchaseCleanup() buttonCallback = PythonUtil.Functor(self.__handleFullPurchaseDialog, phone, callback) self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.CatalogPurchaseHouseFull, text_wordwrap=15, command=buttonCallback) self.dialog.show() else: CatalogItem.CatalogItem.requestPurchase(self, phone, callback)
def fillSlot(self, index, avId): self.notify.debug('%s.fillSlot(%s, %s, ...)' % (self.doId, index, avId)) request = self.toonRequests.get(index) if request: self.cr.relatedObjectMgr.abortRequest(request) del self.toonRequests[index] if avId == 0: pass elif not self.cr.doId2do.has_key(avId): func = PythonUtil.Functor(self.gotToon, index, avId) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects( [avId], allCallback=func) elif not self.isSetup: self.deferredSlots.append((index, avId)) else: if avId == base.localAvatar.getDoId(): self.localToonOnBoard = 1 elevator = self.getPlaceElevator() elevator.fsm.request('boarding', [self.getElevatorModel()]) elevator.fsm.request('boarded') toon = self.cr.doId2do[avId] toon.stopSmooth() toon.setZ(self.getElevatorModel(), self.getScaledPoint(index)[2]) toon.setShadowHeight(0) if toon.isDisguised: toon.suit.loop('walk') animFunc = Func(toon.suit.loop, 'neutral') else: toon.setAnimState('run', 1.0) animFunc = Func(toon.setAnimState, 'neutral', 1.0) toon.headsUp(self.getElevatorModel(), apply(Point3, self.getScaledPoint(index))) track = Sequence(LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, apply(Point3, self.getScaledPoint(index)), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1) track.start() self.boardedAvIds[avId] = index
def requestPurchase(self, phone, callback): from toontown.toontowngui import TTDialog avatar = base.localAvatar accessoriesOnOrder = 0 for item in avatar.onOrder + avatar.mailboxContents: if item.storedInTrunk(): accessoriesOnOrder += 1 if avatar.isTrunkFull(accessoriesOnOrder): self.requestPurchaseCleanup() buttonCallback = PythonUtil.Functor( self.__handleFullPurchaseDialog, phone, callback) if avatar.getMaxAccessories() == 0: text = TTLocalizer.CatalogPurchaseNoTrunk else: text = TTLocalizer.CatalogPurchaseTrunkFull self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=text, text_wordwrap=15, command=buttonCallback) self.dialog.show() else: CatalogItem.CatalogItem.requestPurchase(self, phone, callback)
def fillSlot(self, index, avId): self.notify.debug('%s.fillSlot(%s, %s, ...)' % (self.doId, index, avId)) request = self.toonRequests.get(index) if request: self.cr.relatedObjectMgr.abortRequest(request) del self.toonRequests[index] if avId == 0: pass elif not self.cr.doId2do.has_key(avId): func = PythonUtil.Functor(self.gotToon, index, avId) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects( [avId], allCallback=func) elif not self.isSetup: self.deferredSlots.append((index, avId)) else: if avId == base.localAvatar.getDoId(): self.localToonOnBoard = 1 elevator = self.getPlaceElevator() elevator.fsm.request('boarding', [self.getElevatorModel()]) elevator.fsm.request('boarded') toon = self.cr.doId2do[avId] toon.stopSmooth() toon.wrtReparentTo(self.golfKart) sitStartDuration = toon.getDuration('sit-start') jumpTrack = self.generateToonJumpTrack(toon, index) track = Sequence(jumpTrack, Func(toon.setAnimState, 'Sit', 1.0), Func(self.clearToonTrack, avId), name=toon.uniqueName('fillElevator'), autoPause=1) track.delayDelete = DelayDelete.DelayDelete(toon, 'fillSlot') self.storeToonTrack(avId, track) track.start() self.boardedAvIds[avId] = None return
def fillSlot(self, index, avId, wantBoardingShow=0): self.notify.debug('%s.fillSlot(%s, %s, ... %s)' % (self.doId, index, avId, globalClock.getRealTime())) request = self.toonRequests.get(index) if request: self.cr.relatedObjectMgr.abortRequest(request) del self.toonRequests[index] if avId == 0: pass elif not self.cr.doId2do.has_key(avId): func = PythonUtil.Functor(self.gotToon, index, avId) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects( [avId], allCallback=func) elif not self.isSetup: self.deferredSlots.append((index, avId, wantBoardingShow)) else: if avId == base.localAvatar.getDoId(): place = base.cr.playGame.getPlace() if not place: return elevator = self.getPlaceElevator() if elevator == None: place.fsm.request('elevator') elevator = self.getPlaceElevator() if not elevator: return self.localToonOnBoard = 1 if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty: localAvatar.boardingParty.forceCleanupInviteePanel() localAvatar.boardingParty.forceCleanupInviterPanels() if hasattr(base.localAvatar, 'elevatorNotifier'): base.localAvatar.elevatorNotifier.cleanup() cameraTrack = Sequence() cameraTrack.append( Func(elevator.fsm.request, 'boarding', [self.getElevatorModel()])) cameraTrack.append(Func(elevator.fsm.request, 'boarded')) toon = self.cr.doId2do[avId] toon.stopSmooth() toon.wrtReparentTo(self.golfKart) sitStartDuration = toon.getDuration('sit-start') jumpTrack = self.generateToonJumpTrack(toon, index) track = Sequence(jumpTrack, Func(toon.setAnimState, 'Sit', 1.0), Func(self.clearToonTrack, avId), name=toon.uniqueName('fillElevator'), autoPause=1) if wantBoardingShow: boardingTrack, boardingTrackType = self.getBoardingTrack( toon, index, True) track = Sequence(boardingTrack, track) if avId == base.localAvatar.getDoId(): cameraWaitTime = 2.5 if boardingTrackType == BoardingGroupShow.TRACK_TYPE_RUN: cameraWaitTime = 0.5 cameraTrack = Sequence(Wait(cameraWaitTime), cameraTrack) if self.canHideBoardingQuitBtn(avId): track = Sequence( Func(localAvatar.boardingParty.groupPanel.disableQuitButton ), track) if avId == base.localAvatar.getDoId(): track = Parallel(cameraTrack, track) track.delayDelete = DelayDelete.DelayDelete( toon, 'CogKart.fillSlot') self.storeToonTrack(avId, track) track.start() self.fillSlotTrack = track self.boardedAvIds[avId] = None return
def fillSlot(self, index, avId, wantBoardingShow=0): self.notify.debug('%s.fillSlot(%s, %s, ...)' % (self.doId, index, avId)) request = self.toonRequests.get(index) if request: self.cr.relatedObjectMgr.abortRequest(request) del self.toonRequests[index] if avId == 0: pass elif not self.cr.doId2do.has_key(avId): func = PythonUtil.Functor(self.gotToon, index, avId) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects( [avId], allCallback=func) elif not self.isSetup: self.deferredSlots.append((index, avId, wantBoardingShow)) else: if avId == base.localAvatar.getDoId(): place = base.cr.playGame.getPlace() if not place: return place.detectedElevatorCollision(self) elevator = self.getPlaceElevator() if elevator == None: if place.fsm.hasStateNamed('elevator'): place.fsm.request('elevator') elif place.fsm.hasStateNamed('Elevator'): place.fsm.request('Elevator') elevator = self.getPlaceElevator() if not elevator: return self.localToonOnBoard = 1 if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty: localAvatar.boardingParty.forceCleanupInviteePanel() localAvatar.boardingParty.forceCleanupInviterPanels() if hasattr(base.localAvatar, 'elevatorNotifier'): base.localAvatar.elevatorNotifier.cleanup() cameraTrack = Sequence() cameraTrack.append( Func(elevator.fsm.request, 'boarding', [self.getElevatorModel()])) cameraTrack.append(Func(elevator.fsm.request, 'boarded')) toon = self.cr.doId2do[avId] toon.stopSmooth() if not wantBoardingShow: toon.setZ(self.getElevatorModel(), self.elevatorPoints[index][2]) toon.setShadowHeight(0) if toon.isDisguised: animInFunc = Sequence(Func(toon.suit.loop, 'walk')) animFunc = Sequence(Func(toon.setAnimState, 'neutral', 1.0), Func(toon.suit.loop, 'neutral')) else: animInFunc = Sequence(Func(toon.setAnimState, 'run', 1.0)) animFunc = Func(toon.setAnimState, 'neutral', 1.0) toon.headsUp(self.getElevatorModel(), apply(Point3, self.elevatorPoints[index])) track = Sequence(animInFunc, LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, apply(Point3, self.elevatorPoints[index]), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), Func(self.clearToonTrack, avId), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1) if wantBoardingShow: boardingTrack, boardingTrackType = self.getBoardingTrack( toon, index, False) track = Sequence(boardingTrack, track) if avId == base.localAvatar.getDoId(): cameraWaitTime = 2.5 if boardingTrackType == BoardingGroupShow.TRACK_TYPE_RUN: cameraWaitTime = 0.5 elif boardingTrackType == BoardingGroupShow.TRACK_TYPE_POOF: cameraWaitTime = 1 cameraTrack = Sequence(Wait(cameraWaitTime), cameraTrack) if self.canHideBoardingQuitBtn(avId): track = Sequence( Func(localAvatar.boardingParty.groupPanel.disableQuitButton ), track) if avId == base.localAvatar.getDoId(): track = Parallel(cameraTrack, track) track.delayDelete = DelayDelete.DelayDelete( toon, 'Elevator.fillSlot') self.storeToonTrack(avId, track) track.start() self.fillSlotTrack = track self.boardedAvIds[avId] = None return