diff --git a/toontown/catalog/CatalogItemPanel.py b/toontown/catalog/CatalogItemPanel.py index 6c7d2a7a..65f0c400 100755 --- a/toontown/catalog/CatalogItemPanel.py +++ b/toontown/catalog/CatalogItemPanel.py @@ -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] diff --git a/toontown/coderedemption/TTCodeRedemptionMgrAI.py b/toontown/coderedemption/TTCodeRedemptionMgrAI.py index d4f7fe9f..9722c418 100755 --- a/toontown/coderedemption/TTCodeRedemptionMgrAI.py +++ b/toontown/coderedemption/TTCodeRedemptionMgrAI.py @@ -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 diff --git a/toontown/estate/DistributedPhoneAI.py b/toontown/estate/DistributedPhoneAI.py index 38e80db8..dd50c845 100755 --- a/toontown/estate/DistributedPhoneAI.py +++ b/toontown/estate/DistributedPhoneAI.py @@ -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): diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 88583b0c..7baf7d84 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -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."