mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 12:12:36 -06:00
X on order + mailbox sync + grammar
This commit is contained in:
parent
5a4dc305d1
commit
0d3f31971e
4 changed files with 34 additions and 54 deletions
|
@ -404,7 +404,7 @@ class CatalogItemPanel(DirectFrame):
|
||||||
else:
|
else:
|
||||||
message = TTLocalizer.CatalogVerifyGift % {'item': self['item'].getName(),
|
message = TTLocalizer.CatalogVerifyGift % {'item': self['item'].getName(),
|
||||||
'price': self['item'].getPrice(self['type']),
|
'price': self['item'].getPrice(self['type']),
|
||||||
'friend': TTLocalizer.CatalogGiftError if not self.parentCatalogScreen.friendName else self.parentCatalogScreen.friendName}
|
'friend': self.parentCatalogScreen.friendName if self.parentCatalogScreen.friendName else TTLocalizer.CatalogGiftError}
|
||||||
self.verify = TTDialog.TTGlobalDialog(doneEvent='verifyGiftDone', message=message, style=TTDialog.TwoChoice)
|
self.verify = TTDialog.TTGlobalDialog(doneEvent='verifyGiftDone', message=message, style=TTDialog.TwoChoice)
|
||||||
self.verify.show()
|
self.verify.show()
|
||||||
self.accept('verifyGiftDone', self.__handleVerifyGift)
|
self.accept('verifyGiftDone', self.__handleVerifyGift)
|
||||||
|
@ -436,44 +436,38 @@ class CatalogItemPanel(DirectFrame):
|
||||||
def updateGiftButton(self, giftUpdate = 0):
|
def updateGiftButton(self, giftUpdate = 0):
|
||||||
if not self.loaded:
|
if not self.loaded:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.giftButton.show()
|
self.giftButton.show()
|
||||||
|
|
||||||
if giftUpdate == 0:
|
if giftUpdate == 0:
|
||||||
return
|
return
|
||||||
self.auxText['text'] = ' '
|
|
||||||
numFriends = len(base.localAvatar.friendsList) + len(base.cr.avList) - 1
|
self.auxText['text'] = ''
|
||||||
if numFriends > 0:
|
|
||||||
self.giftButton['state'] = DGG.DISABLED
|
self.giftButton['state'] = DGG.DISABLED
|
||||||
self.giftButton.show()
|
self.giftButton.show()
|
||||||
auxText = ' '
|
|
||||||
if self['item'].isGift() <= 0:
|
if self['item'].isGift() <= 0:
|
||||||
self.giftButton.show()
|
self.auxText['text'] = TTLocalizer.CatalogNotAGift
|
||||||
self.giftButton['state'] = DGG.DISABLED
|
|
||||||
auxText = TTLocalizer.CatalogNotAGift
|
|
||||||
self.auxText['text'] = auxText
|
|
||||||
return
|
return
|
||||||
elif self.parentCatalogScreen.friend:
|
|
||||||
|
if not self.parentCatalogScreen.friend:
|
||||||
|
return
|
||||||
|
|
||||||
avatar = self.parentCatalogScreen.friend
|
avatar = self.parentCatalogScreen.friend
|
||||||
|
|
||||||
if self['item'].forBoysOnly() and avatar.getStyle().getGender() == 'f' or self['item'].forGirlsOnly() and avatar.getStyle().getGender() == 'm':
|
if self['item'].forBoysOnly() and avatar.getStyle().getGender() == 'f' or self['item'].forGirlsOnly() and avatar.getStyle().getGender() == 'm':
|
||||||
self.giftButton.show()
|
self.auxText['text'] = TTLocalizer.CatalogNoFit
|
||||||
self.giftButton['state'] = DGG.DISABLED
|
|
||||||
auxText = TTLocalizer.CatalogNoFit
|
|
||||||
self.auxText['text'] = auxText
|
|
||||||
return
|
|
||||||
elif self['item'].reachedPurchaseLimit(avatar):
|
elif self['item'].reachedPurchaseLimit(avatar):
|
||||||
self.giftButton.show()
|
self.auxText['text'] = TTLocalizer.CatalogPurchasedGiftText
|
||||||
self.giftButton['state'] = DGG.DISABLED
|
elif len(avatar.mailboxContents) + len(avatar.onOrder) + len(avatar.onGiftOrder) + 1 >= ToontownGlobals.MaxMailboxContents:
|
||||||
auxText = TTLocalizer.CatalogPurchasedGiftText
|
self.auxText['text'] = TTLocalizer.CatalogMailboxFull
|
||||||
self.auxText['text'] = auxText
|
else:
|
||||||
return
|
orderCount = avatar.onGiftOrder.count(self['item'])
|
||||||
elif len(avatar.mailboxContents) + len(avatar.onGiftOrder) >= ToontownGlobals.MaxMailboxContents:
|
|
||||||
self.giftButton.show()
|
if orderCount:
|
||||||
self.giftButton['state'] = DGG.DISABLED
|
self.auxText['text'] = TTLocalizer.CatalogOnOrderText if orderCount == 1 else '%d %s' % (orderCount, TTLocalizer.CatalogOnOrderText)
|
||||||
auxText = TTLocalizer.CatalogMailboxFull
|
if self['item'].getPrice(self['type']) <= base.localAvatar.getMoney() + base.localAvatar.getBankMoney():
|
||||||
self.auxText['text'] = auxText
|
|
||||||
return
|
|
||||||
elif self['item'].getPrice(self['type']) <= base.localAvatar.getMoney() + base.localAvatar.getBankMoney():
|
|
||||||
self.giftButton['state'] = DGG.NORMAL
|
self.giftButton['state'] = DGG.NORMAL
|
||||||
self.giftButton.show()
|
|
||||||
|
|
||||||
def handleSoundOnButton(self):
|
def handleSoundOnButton(self):
|
||||||
item = self.items[self.itemIndex]
|
item = self.items[self.itemIndex]
|
||||||
|
|
|
@ -75,15 +75,6 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI):
|
||||||
def announceGenerate(self):
|
def announceGenerate(self):
|
||||||
DistributedObjectAI.announceGenerate(self)
|
DistributedObjectAI.announceGenerate(self)
|
||||||
|
|
||||||
def getMailboxCount(self, items):
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
for item in items:
|
|
||||||
if item.getDeliveryTime() > 0:
|
|
||||||
count += 1
|
|
||||||
|
|
||||||
return count
|
|
||||||
|
|
||||||
def redeemCode(self, code):
|
def redeemCode(self, code):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
|
@ -121,7 +112,7 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI):
|
||||||
def requestCodeRedeem(self, avId, av, items):
|
def requestCodeRedeem(self, avId, av, items):
|
||||||
count = self.getMailboxCount(items)
|
count = self.getMailboxCount(items)
|
||||||
|
|
||||||
if len(av.onOrder) + count > 5 or len(av.mailboxContents) + len(av.onOrder) + count >= ToontownGlobals.MaxMailboxContents:
|
if len(av.mailboxContents) + len(av.onOrder) + len(av.onGiftOrder) + len(items) >= ToontownGlobals.MaxMailboxContents:
|
||||||
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [3])
|
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [3])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,6 @@ import base64
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|
||||||
MAX_MAILBOX = 10
|
|
||||||
MAX_ON_ORDER = 10
|
|
||||||
|
|
||||||
class LoadGiftAvatar:
|
class LoadGiftAvatar:
|
||||||
|
|
||||||
def __init__(self, phone, avId, targetId, optional, callback):
|
def __init__(self, phone, avId, targetId, optional, callback):
|
||||||
|
@ -135,9 +132,7 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
|
||||||
return av
|
return av
|
||||||
|
|
||||||
def checkPurchaseLimit(self, recipient, item):
|
def checkPurchaseLimit(self, recipient, item):
|
||||||
if len(recipient.onOrder) >= MAX_ON_ORDER:
|
if len(recipient.mailboxContents) + len(recipient.onOrder) + len(recipient.onGiftOrder) + 1 >= ToontownGlobals.MaxMailboxContents:
|
||||||
return ToontownGlobals.P_ReachedPurchaseLimit
|
|
||||||
elif len(recipient.mailboxContents) >= MAX_MAILBOX:
|
|
||||||
return ToontownGlobals.P_MailboxFull
|
return ToontownGlobals.P_MailboxFull
|
||||||
elif item.reachedPurchaseLimit(recipient):
|
elif item.reachedPurchaseLimit(recipient):
|
||||||
return ToontownGlobals.P_ReachedPurchaseLimit
|
return ToontownGlobals.P_ReachedPurchaseLimit
|
||||||
|
|
|
@ -5511,7 +5511,7 @@ CatalogPurchaseGeneralError = 'The item could not be purchased because of some i
|
||||||
CatalogPurchaseGiftGeneralError = 'The item could not be gifted to %(friend)s because of some internal game error: error code %(error)s.'
|
CatalogPurchaseGiftGeneralError = 'The item could not be gifted to %(friend)s because of some internal game error: error code %(error)s.'
|
||||||
CatalogPurchaseGiftNotAGift = 'This item could not be sent to %s because it would be an unfair advantage.'
|
CatalogPurchaseGiftNotAGift = 'This item could not be sent to %s because it would be an unfair advantage.'
|
||||||
CatalogPurchaseGiftWillNotFit = "This item could not be sent to %s because it doesn't fit them."
|
CatalogPurchaseGiftWillNotFit = "This item could not be sent to %s because it doesn't fit them."
|
||||||
CatalogPurchaseGiftLimitReached = "This item could not be sent to %s because they've already have it."
|
CatalogPurchaseGiftLimitReached = "This item could not be sent to %s because they already have it."
|
||||||
CatalogPurchaseGiftNotEnoughMoney = "This item could not be sent to %s because you can't afford it."
|
CatalogPurchaseGiftNotEnoughMoney = "This item could not be sent to %s because you can't afford it."
|
||||||
CatalogAcceptGeneralError = 'The item could not be removed from your mailbox because of some internal game error: error code %s.'
|
CatalogAcceptGeneralError = 'The item could not be removed from your mailbox because of some internal game error: error code %s.'
|
||||||
CatalogAcceptRoomError = "You don't have any place to put this. You'll have to get rid of something."
|
CatalogAcceptRoomError = "You don't have any place to put this. You'll have to get rid of something."
|
||||||
|
|
Loading…
Reference in a new issue