diff --git a/toontown/parties/CalendarGuiDay.py b/toontown/parties/CalendarGuiDay.py index 05dae26..0013df3 100644 --- a/toontown/parties/CalendarGuiDay.py +++ b/toontown/parties/CalendarGuiDay.py @@ -531,7 +531,7 @@ class MiniInviteVisual(DirectFrame): DirectFrame.__init__(self, parent, pos=(0.1, 0, -0.018)) self.checkedHeight = True self.partyInfo = partyInfo - self.parent = parent + self._parent = parent self.inviteBackgrounds = loader.loadModel('phase_4/models/parties/partyStickerbook') backgrounds = ['calendar_popup_birthday', 'calendar_popup_fun', @@ -547,9 +547,9 @@ class MiniInviteVisual(DirectFrame): return def show(self): - self.reparentTo(self.parent) + self.reparentTo(self._parent) self.setPos(0.1, 0, -0.018) - newParent = self.parent.getParent().getParent() + newParent = self._parent.getParent().getParent() self.wrtReparentTo(newParent) if self.whosePartyLabel['text'] == ' ': host = base.cr.identifyAvatar(self.partyInfo.hostId) @@ -575,7 +575,7 @@ class MiniInviteVisual(DirectFrame): def destroy(self): del self.checkedHeight del self.partyInfo - del self.parent + del self._parent del self.background del self.whosePartyLabel del self.whenTextLabel diff --git a/toontown/parties/DistributedParty.py b/toontown/parties/DistributedParty.py index f896260..b525471 100644 --- a/toontown/parties/DistributedParty.py +++ b/toontown/parties/DistributedParty.py @@ -1,11 +1,11 @@ import random import time import datetime -from pandac.PandaModules import Vec4, TextNode, CardMaker, NodePath +from panda3d.core import Vec4, TextNode, CardMaker, NodePath from direct.distributed import DistributedObject -from direct.task.Task import Task from direct.gui.DirectGui import DirectLabel from direct.gui import OnscreenText +from direct.interval.IntervalGlobal import * from toontown.toonbase import ToontownGlobals from toontown.parties.PartyInfo import PartyInfo from toontown.toonbase import TTLocalizer @@ -321,8 +321,8 @@ class DistributedParty(DistributedObject.DistributedObject): False]] def fillGrid(x, y, size): - for i in range(-size[1] / 2 + 1, size[1] / 2 + 1): - for j in range(-size[0] / 2 + 1, size[0] / 2 + 1): + for i in range(-size[1] // 2 + 1, size[1] // 2 + 1): + for j in range(-size[0] // 2 + 1, size[0] // 2 + 1): self.grid[i + y][j + x] = False for activityBase in self.partyInfo.activityList: @@ -572,12 +572,8 @@ class DistributedParty(DistributedObject.DistributedObject): self.titleText.setColor(Vec4(*self.titleColor)) self.titleText.clearColorScale() self.titleText.setFg(self.titleColor) - seq = Task.sequence(Task.pause(0.1), Task.pause(6.0), self.titleText.lerpColorScale(Vec4(1.0, 1.0, 1.0, 1.0), Vec4(1.0, 1.0, 1.0, 0.0), 0.5), Task(self.hideTitleTextTask)) - taskMgr.add(seq, 'titleText') - - def hideTitleTextTask(self, task): - self.titleText.hide() - return Task.done + seq = Sequence(Wait(0.1), Wait(6.0), self.titleText.colorScaleInterval(0.5, Vec4(1.0, 1.0, 1.0, 0.0)), Func(self.hideTitleText)) + seq.start() def hideTitleText(self): if self.titleText: diff --git a/toontown/parties/PartyCogActivity.py b/toontown/parties/PartyCogActivity.py index e08dd23..1c67d9b 100644 --- a/toontown/parties/PartyCogActivity.py +++ b/toontown/parties/PartyCogActivity.py @@ -262,7 +262,7 @@ class PartyCogActivity(DirectObject): if not opening: pos = self._doorStartPos[team] else: - pos = (self._doorStartPos[team] + Point3(0, 0, -7.0),) + pos = (self._doorStartPos[team] + Point3(0, 0, -7.0)) ival = self._arenaDoors[team].posInterval(0.75, pos, blendType='easeIn') self._arenaDoorIvals[team] = ival ival.start() diff --git a/toontown/parties/PartyEditorGridElement.py b/toontown/parties/PartyEditorGridElement.py index 1f2c9ea..51a87df 100644 --- a/toontown/parties/PartyEditorGridElement.py +++ b/toontown/parties/PartyEditorGridElement.py @@ -19,14 +19,14 @@ class PartyEditorGridElement(DirectButton): self.isDecoration = isDecoration self.checkSoldOutAndPaidStatusAndAffordability = checkSoldOutAndPaidStatusAndAffordability if self.isDecoration: - self.name = TTLocalizer.PartyDecorationNameDict[self.id]['editor'] + self._name = TTLocalizer.PartyDecorationNameDict[self.id]['editor'] colorList = ((1.0, 1.0, 1.0, 1.0), (0.0, 0.0, 1.0, 1.0), (0.0, 1.0, 1.0, 1.0), (0.5, 0.5, 0.5, 1.0)) self.geom = self.partyEditor.partyPlanner.gui.find('**/%s' % PartyGlobals.DecorationInformationDict[self.id]['gridAsset']) else: - self.name = TTLocalizer.PartyActivityNameDict[self.id]['editor'] + self._name = TTLocalizer.PartyActivityNameDict[self.id]['editor'] colorList = ((1.0, 1.0, 1.0, 1.0), (0.0, 1.0, 0.0, 1.0), (1.0, 1.0, 0.0, 1.0), @@ -42,15 +42,15 @@ class PartyEditorGridElement(DirectButton): self.defineoptions(kw, optiondefs) DirectButton.__init__(self, self.partyEditor.parent) self.initialiseoptions(PartyEditorGridElement) - self.setName('%sGridElement' % self.name) + self.setName('%sGridElement' % self._name) self.bind(DirectGuiGlobals.B1PRESS, self.clicked) self.bind(DirectGuiGlobals.B1RELEASE, self.released) self.bind(DirectGuiGlobals.ENTER, self.mouseEnter) self.bind(DirectGuiGlobals.EXIT, self.mouseExit) - self.uprightNodePath = NodePath('%sUpright' % self.name) + self.uprightNodePath = NodePath('%sUpright' % self._name) self.uprightNodePath.reparentTo(self) rollOverZOffset = self.getGridSize()[1] / 30.0 - self.rolloverTitle = DirectLabel(relief=None, parent=self.uprightNodePath, pos=Point3(0.0, 0.0, rollOverZOffset), text=self.name, text_fg=(1.0, 1.0, 1.0, 1.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_scale=0.075) + self.rolloverTitle = DirectLabel(relief=None, parent=self.uprightNodePath, pos=Point3(0.0, 0.0, rollOverZOffset), text=self._name, text_fg=(1.0, 1.0, 1.0, 1.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_scale=0.075) self.rolloverTitle.stash() self.stash() self.overValidSquare = False @@ -84,11 +84,11 @@ class PartyEditorGridElement(DirectButton): self.getCorrectRotation()) def attach(self, mouseEvent): - PartyEditorGridElement.notify.debug('attached grid element %s' % self.name) - taskMgr.remove('gridElementDragTask%s' % self.name) + PartyEditorGridElement.notify.debug('attached grid element %s' % self._name) + taskMgr.remove('gridElementDragTask%s' % self._name) vWidget2render2d = self.getPos(render2d) vMouse2render2d = Point3(mouseEvent.getMouse()[0], 0, mouseEvent.getMouse()[1]) - taskMgr.add(self.elementDragTask, 'gridElementDragTask%s' % self.name) + taskMgr.add(self.elementDragTask, 'gridElementDragTask%s' % self._name) self.unstash() self.rolloverTitle.unstash() self.uprightNodePath.reparentTo(self) @@ -198,7 +198,7 @@ class PartyEditorGridElement(DirectButton): return self.partyEditor.partyEditorGrid.getGridSquare(x, y) def detach(self, mouseEvent): - taskMgr.remove('gridElementDragTask%s' % self.name) + taskMgr.remove('gridElementDragTask%s' % self._name) self.rolloverTitle.stash() if self.overValidSquare: self.partyEditor.partyEditorGrid.registerNewElement(self, self.centerGridSquare, self.getGridSize()) @@ -237,14 +237,14 @@ class PartyEditorGridElement(DirectButton): return def clicked(self, mouseEvent): - PartyEditorGridElement.notify.debug('clicked grid element %s' % self.name) + PartyEditorGridElement.notify.debug('clicked grid element %s' % self._name) if self.centerGridSquare is not None: self.attach(mouseEvent) self.partyEditor.partyEditorGrid.removeElement(self.centerGridSquare, self.getGridSize()) return def released(self, mouseEvent): - PartyEditorGridElement.notify.debug('released grid element %s' % self.name) + PartyEditorGridElement.notify.debug('released grid element %s' % self._name) self.detach(mouseEvent) def mouseEnter(self, mouseEvent): diff --git a/toontown/parties/PartyEditorListElement.py b/toontown/parties/PartyEditorListElement.py index df99cbb..491c563 100644 --- a/toontown/parties/PartyEditorListElement.py +++ b/toontown/parties/PartyEditorListElement.py @@ -16,7 +16,7 @@ class PartyEditorListElement(DirectButton): self.unreleased = self.calcUnreleased(id) self.comingSoonTextScale = 1.0 if self.isDecoration: - self.name = TTLocalizer.PartyDecorationNameDict[self.id]['editor'] + self._name = TTLocalizer.PartyDecorationNameDict[self.id]['editor'] colorList = ((1.0, 0.0, 1.0, 1.0), (0.0, 0.0, 1.0, 1.0), (0.0, 1.0, 1.0, 1.0), @@ -44,7 +44,7 @@ class PartyEditorListElement(DirectButton): geom_pos = (0.0, 0.0, -3.9) scale = Vec3(0.05, 0.0001, 0.05) else: - self.name = TTLocalizer.PartyActivityNameDict[self.id]['editor'] + self._name = TTLocalizer.PartyActivityNameDict[self.id]['editor'] colorList = ((0.0, 0.0, 0.0, 1.0), (0.0, 1.0, 0.0, 1.0), (1.0, 1.0, 0.0, 1.0), @@ -66,7 +66,7 @@ class PartyEditorListElement(DirectButton): self.defineoptions(kw, optiondefs) DirectButton.__init__(self, self.partyEditor.elementList) self.initialiseoptions(PartyEditorListElement) - self.setName('%sListElement' % self.name) + self.setName('%sListElement' % self._name) self.setScale(scale) self.bind(DirectGuiGlobals.B1PRESS, self.clicked) self.bind(DirectGuiGlobals.B1RELEASE, self.released) @@ -104,15 +104,15 @@ class PartyEditorListElement(DirectButton): gridElement.removeFromGrid() def elementSelectedFromList(self): - PartyEditorListElement.notify.debug('Element %s clicked' % self.name) + PartyEditorListElement.notify.debug('Element %s clicked' % self._name) if self.isDecoration: self.partyEditor.partyPlanner.elementDescriptionNode.setText(TTLocalizer.PartyDecorationNameDict[self.id]['description']) self.partyEditor.partyPlanner.elementPriceNode.setText('%d %s' % (PartyGlobals.DecorationInformationDict[self.id]['cost'], TTLocalizer.PartyPlannerBeans)) - self.partyEditor.partyPlanner.elementTitleLabel['text'] = self.name + self.partyEditor.partyPlanner.elementTitleLabel['text'] = self._name else: self.partyEditor.partyPlanner.elementDescriptionNode.setText(TTLocalizer.PartyActivityNameDict[self.id]['description']) self.partyEditor.partyPlanner.elementPriceNode.setText('%d %s' % (PartyGlobals.ActivityInformationDict[self.id]['cost'], TTLocalizer.PartyPlannerBeans)) - self.partyEditor.partyPlanner.elementTitleLabel['text'] = self.name + self.partyEditor.partyPlanner.elementTitleLabel['text'] = self._name self.checkSoldOutAndPaidStatusAndAffordability() def checkSoldOutAndPaidStatusAndAffordability(self): @@ -172,7 +172,7 @@ class PartyEditorListElement(DirectButton): self.partyEditor.partyPlanner.elementBuyButton['state'] = DirectGuiGlobals.DISABLED def clicked(self, mouseEvent): - PartyEditorListElement.notify.debug("Element %s's icon was clicked" % self.name) + PartyEditorListElement.notify.debug("Element %s's icon was clicked" % self._name) self.partyEditor.listElementClicked() for i in range(len(self.partyEditorGridElements)): if not self.partyEditorGridElements[i].overValidSquare: @@ -191,7 +191,7 @@ class PartyEditorListElement(DirectButton): return False def released(self, mouseEvent): - PartyEditorListElement.notify.debug("Element %s's icon was released" % self.name) + PartyEditorListElement.notify.debug("Element %s's icon was released" % self._name) self.partyEditor.listElementReleased() if self.activeGridElementIndex != -1: self.partyEditorGridElements[self.activeGridElementIndex].detach(mouseEvent) diff --git a/toontown/parties/PublicPartyGui.py b/toontown/parties/PublicPartyGui.py index f5ba382..8f881b7 100644 --- a/toontown/parties/PublicPartyGui.py +++ b/toontown/parties/PublicPartyGui.py @@ -8,6 +8,7 @@ from toontown.toonbase import TTLocalizer from toontown.toontowngui import TTDialog from toontown.parties import PartyGlobals from toontown.parties import PartyUtils +import functools class PublicPartyGui(DirectFrame): notify = directNotify.newCategory('PublicPartyGui') @@ -80,7 +81,7 @@ class PublicPartyGui(DirectFrame): else: return 1 - sortedList.sort(cmp, reverse=True) + sortedList.sort(key=functools.cmp_to_key(cmp), reverse=True) indexToCut = -1 for index, partyTuple in enumerate(sortedList): numberOfGuests = partyTuple[2] diff --git a/toontown/parties/ScrolledFriendList.py b/toontown/parties/ScrolledFriendList.py index fd3f9e0..e1f4e71 100644 --- a/toontown/parties/ScrolledFriendList.py +++ b/toontown/parties/ScrolledFriendList.py @@ -10,12 +10,12 @@ class ScrolledFriendList(DirectScrolledList): def __init__(self, parent, gui, clickCallback = None, makeItemsCheckBoxes = False): self.makeItemsCheckBoxes = makeItemsCheckBoxes self.clickCallback = clickCallback - self.parent = parent + self._parent = parent self.gui = gui self.scrollSpeed = 1 DirectScrolledList.__init__(self, parent=parent, relief=None, incButton_image=(self.gui.find('**/inviteButtonDown_up'), self.gui.find('**/inviteButtonDown_down'), self.gui.find('**/inviteButtonDown_rollover')), incButton_relief=None, incButton_pos=(0.0, 0.0, -0.03), incButton_image3_color=Vec4(0.6, 0.6, 0.6, 0.6), decButton_image=(self.gui.find('**/inviteButtonUp_up'), self.gui.find('**/inviteButtonUp_down'), self.gui.find('**/inviteButtonUp_rollover')), decButton_relief=None, decButton_pos=(0.0, 0.0, 0.02), decButton_image3_color=Vec4(0.6, 0.6, 0.6, 0.6), itemFrame_relief=None, forceHeight=0.084, numItemsVisible=8, items=[], incButtonCallback=self.scrollButtonPressed, decButtonCallback=self.scrollButtonPressed, itemFrame_pos=(0.0, 0.0, -0.01)) - self.incButtonCallback = None - self.decButtonCallback = None + self._DirectScrolledList__incButtonCallback = None + self._DirectScrolledList__decButtonCallback = None self.setForceHeight() return diff --git a/toontown/toon/DistributedNPCPartyPerson.py b/toontown/toon/DistributedNPCPartyPerson.py index efcda55..a0d95cb 100644 --- a/toontown/toon/DistributedNPCPartyPerson.py +++ b/toontown/toon/DistributedNPCPartyPerson.py @@ -4,7 +4,7 @@ from toontown.toon import NPCToons from toontown.toonbase import TTLocalizer from direct.task.Task import Task from direct.distributed import ClockDelta -from pandac.PandaModules import Point3 +from panda3d.core import Point3, Quat from panda3d.otp import CFSpeech, CFTimeout from toontown.toontowngui import TTDialog from otp.otpbase import OTPLocalizer @@ -21,12 +21,15 @@ class DistributedNPCPartyPerson(DistributedNPCToonBase): self.button = None self.askGui = None self.teaserDialog = None + self.lerpCameraSeq = None return def disable(self): self.ignoreAll() taskMgr.remove(self.uniqueName('popupAskGUI')) - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None self.av = None if self.isInteractingWithLocalToon: base.localAvatar.posCamera(0, 0) @@ -85,7 +88,9 @@ class DistributedNPCPartyPerson(DistributedNPCToonBase): def resetPartyPerson(self): self.ignoreAll() taskMgr.remove(self.uniqueName('popupAskGUI')) - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None if self.askGui: self.askGui.hide() self.show() @@ -105,7 +110,9 @@ class DistributedNPCPartyPerson(DistributedNPCToonBase): if mode == NPCToons.PARTY_MOVIE_CLEAR: return if mode == NPCToons.PARTY_MOVIE_TIMEOUT: - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None if self.isInteractingWithLocalToon: self.ignore(self.planPartyQuestionGuiDoneEvent) if self.askGui: @@ -123,7 +130,10 @@ class DistributedNPCPartyPerson(DistributedNPCToonBase): self.setupAvatars(self.av) if self.isInteractingWithLocalToon: camera.wrtReparentTo(render) - camera.lerpPosHpr(-5, 9, base.localAvatar.getHeight() - 0.5, -150, -2, 0, 1, other=self, blendType='easeOut', task=self.uniqueName('lerpCamera')) + quat = Quat() + quat.setHpr((-150, -2, 0)) + self.lerpCameraSeq = camera.posQuatInterval(1, Point3(-5, 9, base.localAvatar.getHeight() - 0.5), quat, other=self, blendType='easeOut', name=self.uniqueName('lerpCamera')) + self.lerpCameraSeq.start() taskMgr.doMethodLater(1.0, self.popupAskGUI, self.uniqueName('popupAskGUI')) else: self.setChatAbsolute(TTLocalizer.PartyDoYouWantToPlan, CFSpeech | CFTimeout) @@ -134,7 +144,7 @@ class DistributedNPCPartyPerson(DistributedNPCToonBase): if self.isInteractingWithLocalToon: base.localAvatar.aboutToPlanParty = True base.cr.partyManager.setPartyPlannerStyle(self.style) - base.cr.partyManager.setPartyPlannerName(self.name) + base.cr.partyManager.setPartyPlannerName(self._name) base.localAvatar.creatingNewPartyWithMagicWord = False loaderId = 'safeZoneLoader' whereId = 'party'