diff --git a/toontown/building/DistributedSuitInterior.py b/toontown/building/DistributedSuitInterior.py index 3eab5c17..bcbe1855 100755 --- a/toontown/building/DistributedSuitInterior.py +++ b/toontown/building/DistributedSuitInterior.py @@ -10,6 +10,7 @@ from direct.distributed import DistributedObject from direct.fsm import State from toontown.battle import BattleBase from toontown.hood import ZoneUtil +from toontown.suit import SuitDNA class DistributedSuitInterior(DistributedObject.DistributedObject): id = 0 @@ -249,10 +250,11 @@ class DistributedSuitInterior(DistributedObject.DistributedObject): def __playElevator(self, ts, name, callback): SuitHs = [] SuitPositions = [] + DeptName = SuitDNA.suitDeptFilenames[self.suits[0].style.dept] if self.floorModel: self.floorModel.removeNode() if self.currentFloor == 0: - self.floorModel = loader.loadModel('phase_7/models/modules/suit_interior') + self.floorModel = loader.loadModel('phase_7/models/modules/suit_interior_%s' % DeptName) SuitHs = self.BottomFloor_SuitHs SuitPositions = self.BottomFloor_SuitPositions elif self.currentFloor == self.numFloors - 1: diff --git a/toontown/catalog/GiftAvatar.py b/toontown/catalog/GiftAvatar.py index 4303b2fd..9905726f 100644 --- a/toontown/catalog/GiftAvatar.py +++ b/toontown/catalog/GiftAvatar.py @@ -1,6 +1,6 @@ from toontown.toon import ToonDNA import CatalogItem, CatalogItemList -import json +import json, time def createFromJson(jsonData): return createFromFields(json.loads(jsonData)) @@ -86,4 +86,13 @@ class GiftAvatar: self.petTrickPhrases = tricks[0] def setNametagStyles(self, nametagStyles): - self.nametagStyles = nametagStyles[0] \ No newline at end of file + self.nametagStyles = nametagStyles[0] + + def addToGiftSchedule(self, avId, targetId, item, minutes=0): + if config.GetBool('want-instant-delivery', False): + minutes = 0 + + item.giftTag = avId + item.deliveryDate = int(time.time() / 60. + minutes + .5) + self.onGiftOrder.append(item) + simbase.air.send(simbase.air.dclassesByName['DistributedToonAI'].aiFormatUpdate('setGiftSchedule', targetId, targetId, simbase.air.ourChannel, [self.getGiftScheduleBlob()])) \ No newline at end of file diff --git a/toontown/coderedemption/TTCodeRedemptionMgrAI.py b/toontown/coderedemption/TTCodeRedemptionMgrAI.py index 518f49b6..6a0befa8 100755 --- a/toontown/coderedemption/TTCodeRedemptionMgrAI.py +++ b/toontown/coderedemption/TTCodeRedemptionMgrAI.py @@ -111,8 +111,7 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI): if item in av.onOrder: continue - item.deliveryDate = int(time.time() / 60) + 0.01 - av.onOrder.append(item) + av.addToDeliverySchedule(item) av.b_setDeliverySchedule(av.onOrder) self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [0]) diff --git a/toontown/estate/DistributedPhoneAI.py b/toontown/estate/DistributedPhoneAI.py index 6c3af351..041c62ce 100755 --- a/toontown/estate/DistributedPhoneAI.py +++ b/toontown/estate/DistributedPhoneAI.py @@ -9,7 +9,6 @@ from toontown.catalog.CatalogItemList import CatalogItemList from toontown.uberdog import TopToonsGlobals import json -import time class LoadGiftAvatar: @@ -165,10 +164,6 @@ class DistributedPhoneAI(DistributedFurnitureItemAI): if price > av.getTotalMoney() or (item.hasEmblemPrices() and not av.isEnoughEmblemsToBuy(item.getEmblemPrices())): return ToontownGlobals.P_NotEnoughMoney - if item.getDeliveryTime() or gifting: - deliveryTime = 0 if config.GetBool('want-instant-delivery', False) else item.getDeliveryTime() - item.deliveryDate = int(time.time() / 60. + deliveryTime + .5) - if gifting: return self.requestGiftAvatarOperation(avId, gifting, [context, item, price], self.attemptGiftPurchase) else: @@ -179,8 +174,7 @@ class DistributedPhoneAI(DistributedFurnitureItemAI): if item.getDeliveryTime(): self.chargeAvatar(av, price, item.getEmblemPrices()) - av.onOrder.append(item) - av.b_setDeliverySchedule(av.onOrder) + av.addToDeliverySchedule(item, item.getDeliveryTime()) av.addStat(ToontownGlobals.STAT_ITEMS) else: returnCode = item.recordPurchase(av, optional) @@ -208,13 +202,10 @@ class DistributedPhoneAI(DistributedFurnitureItemAI): self.sendGiftPurchaseResponse(context, avId, returnCode) return - item.giftTag = avId self.chargeAvatar(av, optional[2], item.getEmblemPrices()) - recipient.onGiftOrder.append(item) + recipient.addToGiftSchedule(avId, targetId, item, item.getDeliveryTime()) av.addStat(ToontownGlobals.STAT_ITEMS) - - dg = self.air.dclassesByName['DistributedToonAI'].aiFormatUpdate('setGiftSchedule', targetId, targetId, self.air.ourChannel, [recipient.getGiftScheduleBlob()]) - self.air.send(dg) + self.sendGiftPurchaseResponse(context, avId, ToontownGlobals.P_ItemOnOrder) def sendGiftPurchaseResponse(self, context, avId, returnCode): diff --git a/toontown/estate/DistributedRewardCrateAI.py b/toontown/estate/DistributedRewardCrateAI.py index e865c943..8a173612 100644 --- a/toontown/estate/DistributedRewardCrateAI.py +++ b/toontown/estate/DistributedRewardCrateAI.py @@ -60,7 +60,7 @@ class DistributedRewardCrateAI(DistributedFurnitureItemAI): if item.reachedPurchaseLimit(av): return - self.addToOrder(av, item) + av.addToDeliverySchedule(item) self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_NAMETAGS, 0]) elif prizeType == ToontownGlobals.CRATE_EMOTES: playerEmotes = av.emoteAccess @@ -77,7 +77,7 @@ class DistributedRewardCrateAI(DistributedFurnitureItemAI): self.choosePrize(av, tryNumber + 1) return - self.addToOrder(av, item) + av.addToDeliverySchedule(item) self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_EMOTES, 0]) elif prizeType == ToontownGlobals.CRATE_CLOTHING: clothing = CatalogClothingItem.ClothingTypes.keys() @@ -87,7 +87,7 @@ class DistributedRewardCrateAI(DistributedFurnitureItemAI): item = CatalogClothingItem.CatalogClothingItem(id, 0) if not item.notOfferedTo(av) and not item.reachedPurchaseLimit(av): - self.addToOrder(av, item) + av.addToDeliverySchedule(item) self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_CLOTHING, 0]) return elif prizeType == ToontownGlobals.CRATE_ACCESSORIES: @@ -98,14 +98,9 @@ class DistributedRewardCrateAI(DistributedFurnitureItemAI): item = CatalogAccessoryItem.CatalogAccessoryItem(id, 0) if not item.reachedPurchaseLimit(av): - self.addToOrder(av, item) + av.addToDeliverySchedule(item) self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_ACCESSORIES, 0]) return - - def addToOrder(self, av, item): - item.deliveryDate = int(time.time() / 60. + .5) - av.onOrder.append(item) - av.b_setDeliverySchedule(av.onOrder) def giveBeans(self, av): beans = random.randint(1, 15) * 100 diff --git a/toontown/suit/SuitDNA.py b/toontown/suit/SuitDNA.py index f2ebf1e3..62b039b1 100755 --- a/toontown/suit/SuitDNA.py +++ b/toontown/suit/SuitDNA.py @@ -86,6 +86,11 @@ suitDeptFullnamesP = {'c': TTLocalizer.BossbotP, 'l': TTLocalizer.LawbotP, 'm': TTLocalizer.CashbotP, 's': TTLocalizer.SellbotP} +suitDeptFilenames = {'c': 'boss', + 'l': 'law', + 'm': 'cash', + 's': 'sell' +} suitDeptModelPaths = {'c': '**/CorpIcon', 0: '**/CorpIcon', 'l': '**/LegalIcon', diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 565d97c9..d7077fd5 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -2098,6 +2098,14 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getCatalogNotify(self): return (self.catalogNotify, self.mailboxNotify) + + def addToDeliverySchedule(self, item, minutes=0): + if config.GetBool('want-instant-delivery', False): + minutes = 0 + + item.deliveryDate = int(time.time() / 60. + minutes + .5) + self.onOrder.append(item) + self.b_setDeliverySchedule(self.onOrder) def b_setDeliverySchedule(self, onOrder, doUpdateLater = True): self.setDeliverySchedule(onOrder, doUpdateLater)