From 03df90b3e298dd2f2e4e79d87f8c5bb6ec299205 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 2 Jan 2020 13:15:44 -0500 Subject: [PATCH] racing: you can now purchase karts --- toontown/racing/RaceGlobals.py | 2 +- toontown/shtiker/KartPage.py | 20 ++++++++++---------- toontown/toon/DistributedNPCKartClerk.py | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/toontown/racing/RaceGlobals.py b/toontown/racing/RaceGlobals.py index 051c53c..51b046e 100644 --- a/toontown/racing/RaceGlobals.py +++ b/toontown/racing/RaceGlobals.py @@ -455,7 +455,7 @@ CircuitSweepsList = [CircuitSweeps1, CircuitSweeps2, CircuitSweeps3] CircuitQualList = [CircuitQuals1, CircuitQuals2, CircuitQuals3] AllQualsList = [SpeedwayQualsList, RuralQualsList, UrbanQualsList] AllWinsList = [SpeedwayWinsList, RuralWinsList, UrbanWinsList] -TrophiesPerCup = NumTrophies / NumCups +TrophiesPerCup = NumTrophies // NumCups QualifiedRaces = [1, 10, 100] TotalQualifiedRaces = 100 WonRaces = [1, 10, 100] diff --git a/toontown/shtiker/KartPage.py b/toontown/shtiker/KartPage.py index a5bc99f..15b473d 100644 --- a/toontown/shtiker/KartPage.py +++ b/toontown/shtiker/KartPage.py @@ -308,7 +308,7 @@ class ItemSelector(DirectFrame): def __init__(self, avatar, parent = aspect2d): self.currItem = None self.itemList = None - self.parent = parent + self._parent = parent self.avatar = avatar self.currAccessoryType = None self.texCount = 1 @@ -322,7 +322,7 @@ class ItemSelector(DirectFrame): self.leftArrowButton.destroy() self.rightArrowButton.destroy() del self.avatar - del self.parent + del self._parent del self.currItem del self.itemList del self.uiBgFrame @@ -516,7 +516,7 @@ class ItemSelector(DirectFrame): self.__updateViewerUI() self.notify.debug('__handleItemChange: currItem %s' % self.currItem) self.updatedDNA[self.currAccessoryType] = self.currItem - kart = self.parent.parent.getKartViewer().getKart() + kart = self._parent._parent.getKartViewer().getKart() kart.updateDNAField(self.currAccessoryType, self.currItem) def __handleShowItem(self): @@ -540,7 +540,7 @@ class ItemSelector(DirectFrame): else: self.uiImagePlane.component('geom0').setColorScale(getAccessory(self.currItem)) elif self.currAccessoryType == KartDNA.decalType: - kart = self.parent.parent.getKartViewer().getKart() + kart = self._parent._parent.getKartViewer().getKart() kartDecal = getDecalId(kart.kartDNA[KartDNA.bodyType]) texNodePath = getTexCardNode(self.currItem) tex = loader.loadTexture('phase_6/maps/%s.jpg' % texNodePath % kartDecal, 'phase_6/maps/%s_a.rgb' % texNodePath % kartDecal) @@ -583,13 +583,13 @@ class ItemSelector(DirectFrame): if self.updatedDNA[KartDNA.accColor] == deletedItem: self.avatar.requestKartDNAFieldUpdate(KartDNA.accColor, self.currItem) self.updatedDNA[KartDNA.accColor] = self.currItem - kart = self.parent.parent.getKartViewer().getKart() + kart = self._parent._parent.getKartViewer().getKart() kart.updateDNAField(KartDNA.accColor, self.currItem) elif self.currAccessoryType == KartDNA.accColor: if self.updatedDNA[KartDNA.bodyColor] == deletedItem: self.avatar.requestKartDNAFieldUpdate(KartDNA.bodyColor, self.currItem) self.updatedDNA[KartDNA.bodyColor] = self.currItem - kart = self.parent.parent.getKartViewer().getKart() + kart = self._parent._parent.getKartViewer().getKart() kart.updateDNAField(KartDNA.bodyColor, self.currItem) self.notify.debug('__handleItemDelete: Delete request on accessory %s' % self.currItem) @@ -602,7 +602,7 @@ class ItemSelector(DirectFrame): self.currItem = InvalidEntry self.__updateViewerUI() self.updatedDNA[self.currAccessoryType] = self.currItem - kart = self.parent.parent.getKartViewer().getKart() + kart = self._parent._parent.getKartViewer().getKart() kart.updateDNAField(self.currAccessoryType, self.currItem) if self.avatar.getAccessoryByType(self.currAccessoryType) == deletedItem: self.avatar.requestKartDNAFieldUpdate(self.currAccessoryType, self.currItem) @@ -617,7 +617,7 @@ class ItemSelector(DirectFrame): self.avatar = avatar self.itemViewers = {} self.buttonDict = {} - self.parent = parent + self._parent = parent DirectFrame.__init__(self, parent=parent, relief=None, pos=(0, 0, 0), scale=(1.0, 1.0, 1.0)) return @@ -755,7 +755,7 @@ class KartViewer(DirectFrame): def __init__(self, dna, parent): self.kart = None self.dna = dna - self.parent = parent + self._parent = parent self.kartFrame = None self.bounds = None self.colors = None @@ -787,7 +787,7 @@ class KartViewer(DirectFrame): if hasattr(self, 'dna'): del self.dna if hasattr(self, 'parent'): - del self.parent + del self._parent DirectFrame.destroy(self) return diff --git a/toontown/toon/DistributedNPCKartClerk.py b/toontown/toon/DistributedNPCKartClerk.py index f86b5a5..26f3323 100644 --- a/toontown/toon/DistributedNPCKartClerk.py +++ b/toontown/toon/DistributedNPCKartClerk.py @@ -16,12 +16,15 @@ class DistributedNPCKartClerk(DistributedNPCToonBase): self.button = None self.popupInfo = None self.kartShopGui = None + self.lerpCameraSeq = None return def disable(self): self.ignoreAll() taskMgr.remove(self.uniqueName('popupKartShopGUI')) - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None if self.popupInfo: self.popupInfo.destroy() self.popupInfo = None @@ -52,7 +55,9 @@ class DistributedNPCKartClerk(DistributedNPCToonBase): def resetKartShopClerk(self): self.ignoreAll() taskMgr.remove(self.uniqueName('popupKartShopGUI')) - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None if self.kartShopGui: self.kartShopGui.destroy() self.kartShopGui = None @@ -76,7 +81,9 @@ class DistributedNPCKartClerk(DistributedNPCToonBase): if mode == NPCToons.SELL_MOVIE_CLEAR: return if mode == NPCToons.SELL_MOVIE_TIMEOUT: - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None if self.isLocalToon: self.ignoreEventDict() if self.popupInfo: @@ -96,7 +103,8 @@ class DistributedNPCKartClerk(DistributedNPCToonBase): self.setupAvatars(self.av) if self.isLocalToon: camera.wrtReparentTo(render) - camera.lerpPosHpr(-5, 9, base.localAvatar.getHeight() - 0.5, -150, -2, 0, 1, other=self, blendType='easeOut', task=self.uniqueName('lerpCamera')) + self.lerpCameraSeq = camera.posQuatInterval(1, Point3(-5, 9, base.localAvatar.getHeight() - 0.5), Point3(-150, -2, 0), other=self, blendType='easeOut', name=self.uniqueName('lerpCamera')) + self.lerpCameraSeq.start() if self.isLocalToon: taskMgr.doMethodLater(1.0, self.popupKartShopGUI, self.uniqueName('popupKartShopGUI')) elif mode == NPCToons.SELL_MOVIE_COMPLETE: