mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
John L's pro stuff (Buildings) + cleanup
This commit is contained in:
parent
369f038b63
commit
e64d1583a4
7 changed files with 35 additions and 26 deletions
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
@ -87,3 +87,12 @@ class GiftAvatar:
|
|||
|
||||
def setNametagStyles(self, nametagStyles):
|
||||
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()]))
|
|
@ -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])
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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,15 +98,10 @@ 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
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -2099,6 +2099,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)
|
||||
self.d_setDeliverySchedule(onOrder)
|
||||
|
|
Loading…
Reference in a new issue