Parties will work now k

This commit is contained in:
John Cote 2015-05-25 13:42:55 -04:00
parent 85b8923d35
commit 0d8319be38
5 changed files with 27 additions and 12 deletions

View file

@ -120,7 +120,7 @@ class PartyEditor(DirectObject, FSM):
self.initPartyClock()
if self.currentElement:
self.currentElement.checkSoldOutAndPaidStatusAndAffordability()
self.currentElement.checkSoldOutAndAffordability()
def buyCurrentElement(self):
if self.currentElement:
@ -151,7 +151,7 @@ class PartyEditor(DirectObject, FSM):
self.elementList.scrollTo(0)
self.elementList['items'][0].elementSelectedFromList()
self.currentElement = self.elementList['items'][self.elementList.getSelectedIndex()]
self.currentElement.checkSoldOutAndPaidStatusAndAffordability()
self.currentElement.checkSoldOutAndAffordability()
self.partyPlanner.instructionLabel['text'] = TTLocalizer.PartyPlannerEditorInstructionsIdle
self.updateCostsAndBank()
self.handleMutuallyExclusiveActivities()

View file

@ -13,11 +13,11 @@ from toontown.parties import PartyUtils
class PartyEditorGridElement(DirectButton):
notify = directNotify.newCategory('PartyEditorGridElement')
def __init__(self, partyEditor, id, isDecoration, checkSoldOutAndPaidStatusAndAffordability, **kw):
def __init__(self, partyEditor, id, isDecoration, checkSoldOutAndAffordability, **kw):
self.partyEditor = partyEditor
self.id = id
self.isDecoration = isDecoration
self.checkSoldOutAndPaidStatusAndAffordability = checkSoldOutAndPaidStatusAndAffordability
self.checkSoldOutAndAffordability = checkSoldOutAndAffordability
if self.isDecoration:
self.name = TTLocalizer.PartyDecorationNameDict[self.id]['editor']
colorList = ((1.0, 1.0, 1.0, 1.0),
@ -218,7 +218,7 @@ class PartyEditorGridElement(DirectButton):
self.partyEditor.handleMutuallyExclusiveActivities()
else:
self.stash()
self.checkSoldOutAndPaidStatusAndAffordability()
self.checkSoldOutAndAffordability()
return
def placeInPartyGrounds(self, desiredXY = None):
@ -230,7 +230,7 @@ class PartyEditorGridElement(DirectButton):
self.partyEditor.partyEditorGrid.registerNewElement(self, self.centerGridSquare, self.getGridSize())
self.partyEditor.updateCostsAndBank()
self.partyEditor.partyPlanner.instructionLabel['text'] = TTLocalizer.PartyPlannerEditorInstructionsPartyGrounds
self.checkSoldOutAndPaidStatusAndAffordability()
self.checkSoldOutAndAffordability()
return True
else:
return False

View file

@ -73,11 +73,11 @@ class PartyEditorListElement(DirectButton):
self.partyEditorGridElements = []
if self.isDecoration:
for i in xrange(PartyGlobals.DecorationInformationDict[self.id]['limitPerParty']):
self.partyEditorGridElements.append(PartyEditorGridElement(self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndPaidStatusAndAffordability))
self.partyEditorGridElements.append(PartyEditorGridElement(self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndAffordability))
else:
for i in xrange(PartyGlobals.ActivityInformationDict[self.id]['limitPerParty']):
self.partyEditorGridElements.append(PartyEditorGridElement(self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndPaidStatusAndAffordability))
self.partyEditorGridElements.append(PartyEditorGridElement(self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndAffordability))
self.activeGridElementIndex = -1
self.adjustForUnreleased()
@ -113,12 +113,12 @@ class PartyEditorListElement(DirectButton):
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.checkSoldOutAndPaidStatusAndAffordability()
self.checkSoldOutAndAffordability()
def checkSoldOutAndPaidStatusAndAffordability(self):
def checkSoldOutAndAffordability(self):
if self.partyEditor.currentElement != self:
if self.partyEditor.currentElement is not None:
self.partyEditor.currentElement.checkSoldOutAndPaidStatusAndAffordability()
self.partyEditor.currentElement.checkSoldOutAndAffordability()
return
if self.isDecoration:
infoDict = PartyGlobals.DecorationInformationDict
@ -178,7 +178,7 @@ class PartyEditorListElement(DirectButton):
self.activeGridElementIndex = i
return True
else:
self.checkSoldOutAndPaidStatusAndAffordability()
self.checkSoldOutAndAffordability()
return False
def released(self, mouseEvent):

View file

@ -16,6 +16,7 @@ class DistributedPartyManager(DistributedObject):
def __init__(self, cr):
DistributedObject.__init__(self, cr)
base.cr.partyManager = self
self.allowUnreleased = False
self.partyPlannerStyle = None
self.partyPlannerName = None
self.showDoid = False
@ -41,6 +42,16 @@ class DistributedPartyManager(DistributedObject):
def deallocateZoneIdFromPlannedParty(self, zoneId):
self.sendUpdate('freeZoneIdFromPlannedParty', [base.localAvatar.doId, zoneId])
def allowUnreleasedClient(self):
return self.allowUnreleased
def setAllowUnreleaseClient(self, newValue):
self.allowUnreleased = newValue
def toggleAllowUnreleasedClient(self):
self.allowUnreleased = not self.allowUnreleased
return self.allowUnreleased
def sendAddParty(self, hostId, startTime, endTime, isPrivate, inviteTheme, activities, decorations, inviteeIds):
self.sendUpdate('addPartyRequest', [hostId,
startTime,

View file

@ -57,6 +57,10 @@ class DistributedPartyManagerAI(DistributedObjectAI):
# well fuck. ud died.
self.notify.warning("uberdog lost!")
def canBuyParties(self):
return True
def addPartyRequest(self, hostId, startTime, endTime, isPrivate, inviteTheme, activities, decorations, inviteeIds):
if hostId != simbase.air.getAvatarIdFromSender():
self.air.writeServerEvent('suspicious',simbase.air.getAvatarIdFromSender(),'Toon tried to create a party as someone else!')