X on order + mailbox sync + grammar

This commit is contained in:
John 2015-07-17 15:29:08 +03:00
parent 5a4dc305d1
commit 0d3f31971e
4 changed files with 34 additions and 54 deletions

View file

@ -404,7 +404,7 @@ class CatalogItemPanel(DirectFrame):
else:
message = TTLocalizer.CatalogVerifyGift % {'item': self['item'].getName(),
'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.show()
self.accept('verifyGiftDone', self.__handleVerifyGift)
@ -436,44 +436,38 @@ class CatalogItemPanel(DirectFrame):
def updateGiftButton(self, giftUpdate = 0):
if not self.loaded:
return
self.giftButton.show()
if giftUpdate == 0:
return
self.auxText['text'] = ' '
numFriends = len(base.localAvatar.friendsList) + len(base.cr.avList) - 1
if numFriends > 0:
self.giftButton['state'] = DGG.DISABLED
self.giftButton.show()
auxText = ' '
if self['item'].isGift() <= 0:
self.giftButton.show()
self.giftButton['state'] = DGG.DISABLED
auxText = TTLocalizer.CatalogNotAGift
self.auxText['text'] = auxText
return
elif 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':
self.giftButton.show()
self.giftButton['state'] = DGG.DISABLED
auxText = TTLocalizer.CatalogNoFit
self.auxText['text'] = auxText
return
elif self['item'].reachedPurchaseLimit(avatar):
self.giftButton.show()
self.giftButton['state'] = DGG.DISABLED
auxText = TTLocalizer.CatalogPurchasedGiftText
self.auxText['text'] = auxText
return
elif len(avatar.mailboxContents) + len(avatar.onGiftOrder) >= ToontownGlobals.MaxMailboxContents:
self.giftButton.show()
self.giftButton['state'] = DGG.DISABLED
auxText = TTLocalizer.CatalogMailboxFull
self.auxText['text'] = auxText
return
elif self['item'].getPrice(self['type']) <= base.localAvatar.getMoney() + base.localAvatar.getBankMoney():
self.giftButton['state'] = DGG.NORMAL
self.giftButton.show()
self.auxText['text'] = ''
self.giftButton['state'] = DGG.DISABLED
self.giftButton.show()
if self['item'].isGift() <= 0:
self.auxText['text'] = TTLocalizer.CatalogNotAGift
return
if not self.parentCatalogScreen.friend:
return
avatar = self.parentCatalogScreen.friend
if self['item'].forBoysOnly() and avatar.getStyle().getGender() == 'f' or self['item'].forGirlsOnly() and avatar.getStyle().getGender() == 'm':
self.auxText['text'] = TTLocalizer.CatalogNoFit
elif self['item'].reachedPurchaseLimit(avatar):
self.auxText['text'] = TTLocalizer.CatalogPurchasedGiftText
elif len(avatar.mailboxContents) + len(avatar.onOrder) + len(avatar.onGiftOrder) + 1 >= ToontownGlobals.MaxMailboxContents:
self.auxText['text'] = TTLocalizer.CatalogMailboxFull
else:
orderCount = avatar.onGiftOrder.count(self['item'])
if orderCount:
self.auxText['text'] = TTLocalizer.CatalogOnOrderText if orderCount == 1 else '%d %s' % (orderCount, TTLocalizer.CatalogOnOrderText)
if self['item'].getPrice(self['type']) <= base.localAvatar.getMoney() + base.localAvatar.getBankMoney():
self.giftButton['state'] = DGG.NORMAL
def handleSoundOnButton(self):
item = self.items[self.itemIndex]

View file

@ -75,15 +75,6 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI):
def 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):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
@ -121,7 +112,7 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI):
def requestCodeRedeem(self, avId, av, 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])
return

View file

@ -12,9 +12,6 @@ import base64
import json
import time
MAX_MAILBOX = 10
MAX_ON_ORDER = 10
class LoadGiftAvatar:
def __init__(self, phone, avId, targetId, optional, callback):
@ -135,13 +132,11 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
return av
def checkPurchaseLimit(self, recipient, item):
if len(recipient.onOrder) >= MAX_ON_ORDER:
return ToontownGlobals.P_ReachedPurchaseLimit
elif len(recipient.mailboxContents) >= MAX_MAILBOX:
if len(recipient.mailboxContents) + len(recipient.onOrder) + len(recipient.onGiftOrder) + 1 >= ToontownGlobals.MaxMailboxContents:
return ToontownGlobals.P_MailboxFull
elif item.reachedPurchaseLimit(recipient):
return ToontownGlobals.P_ReachedPurchaseLimit
return ToontownGlobals.P_ItemOnOrder
def chargeAvatar(self, av, money, emblems):

View file

@ -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.'
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."
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."
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."