mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00: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 direct.fsm import State
|
||||||
from toontown.battle import BattleBase
|
from toontown.battle import BattleBase
|
||||||
from toontown.hood import ZoneUtil
|
from toontown.hood import ZoneUtil
|
||||||
|
from toontown.suit import SuitDNA
|
||||||
|
|
||||||
class DistributedSuitInterior(DistributedObject.DistributedObject):
|
class DistributedSuitInterior(DistributedObject.DistributedObject):
|
||||||
id = 0
|
id = 0
|
||||||
|
@ -249,10 +250,11 @@ class DistributedSuitInterior(DistributedObject.DistributedObject):
|
||||||
def __playElevator(self, ts, name, callback):
|
def __playElevator(self, ts, name, callback):
|
||||||
SuitHs = []
|
SuitHs = []
|
||||||
SuitPositions = []
|
SuitPositions = []
|
||||||
|
DeptName = SuitDNA.suitDeptFilenames[self.suits[0].style.dept]
|
||||||
if self.floorModel:
|
if self.floorModel:
|
||||||
self.floorModel.removeNode()
|
self.floorModel.removeNode()
|
||||||
if self.currentFloor == 0:
|
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
|
SuitHs = self.BottomFloor_SuitHs
|
||||||
SuitPositions = self.BottomFloor_SuitPositions
|
SuitPositions = self.BottomFloor_SuitPositions
|
||||||
elif self.currentFloor == self.numFloors - 1:
|
elif self.currentFloor == self.numFloors - 1:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from toontown.toon import ToonDNA
|
from toontown.toon import ToonDNA
|
||||||
import CatalogItem, CatalogItemList
|
import CatalogItem, CatalogItemList
|
||||||
import json
|
import json, time
|
||||||
|
|
||||||
def createFromJson(jsonData):
|
def createFromJson(jsonData):
|
||||||
return createFromFields(json.loads(jsonData))
|
return createFromFields(json.loads(jsonData))
|
||||||
|
@ -86,4 +86,13 @@ class GiftAvatar:
|
||||||
self.petTrickPhrases = tricks[0]
|
self.petTrickPhrases = tricks[0]
|
||||||
|
|
||||||
def setNametagStyles(self, nametagStyles):
|
def setNametagStyles(self, nametagStyles):
|
||||||
self.nametagStyles = nametagStyles[0]
|
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:
|
if item in av.onOrder:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
item.deliveryDate = int(time.time() / 60) + 0.01
|
av.addToDeliverySchedule(item)
|
||||||
av.onOrder.append(item)
|
|
||||||
|
|
||||||
av.b_setDeliverySchedule(av.onOrder)
|
av.b_setDeliverySchedule(av.onOrder)
|
||||||
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [0])
|
self.sendUpdateToAvatarId(avId, 'redeemCodeResult', [0])
|
||||||
|
|
|
@ -9,7 +9,6 @@ from toontown.catalog.CatalogItemList import CatalogItemList
|
||||||
from toontown.uberdog import TopToonsGlobals
|
from toontown.uberdog import TopToonsGlobals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import time
|
|
||||||
|
|
||||||
class LoadGiftAvatar:
|
class LoadGiftAvatar:
|
||||||
|
|
||||||
|
@ -165,10 +164,6 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
|
||||||
if price > av.getTotalMoney() or (item.hasEmblemPrices() and not av.isEnoughEmblemsToBuy(item.getEmblemPrices())):
|
if price > av.getTotalMoney() or (item.hasEmblemPrices() and not av.isEnoughEmblemsToBuy(item.getEmblemPrices())):
|
||||||
return ToontownGlobals.P_NotEnoughMoney
|
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:
|
if gifting:
|
||||||
return self.requestGiftAvatarOperation(avId, gifting, [context, item, price], self.attemptGiftPurchase)
|
return self.requestGiftAvatarOperation(avId, gifting, [context, item, price], self.attemptGiftPurchase)
|
||||||
else:
|
else:
|
||||||
|
@ -179,8 +174,7 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
|
||||||
|
|
||||||
if item.getDeliveryTime():
|
if item.getDeliveryTime():
|
||||||
self.chargeAvatar(av, price, item.getEmblemPrices())
|
self.chargeAvatar(av, price, item.getEmblemPrices())
|
||||||
av.onOrder.append(item)
|
av.addToDeliverySchedule(item, item.getDeliveryTime())
|
||||||
av.b_setDeliverySchedule(av.onOrder)
|
|
||||||
av.addStat(ToontownGlobals.STAT_ITEMS)
|
av.addStat(ToontownGlobals.STAT_ITEMS)
|
||||||
else:
|
else:
|
||||||
returnCode = item.recordPurchase(av, optional)
|
returnCode = item.recordPurchase(av, optional)
|
||||||
|
@ -208,13 +202,10 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
|
||||||
self.sendGiftPurchaseResponse(context, avId, returnCode)
|
self.sendGiftPurchaseResponse(context, avId, returnCode)
|
||||||
return
|
return
|
||||||
|
|
||||||
item.giftTag = avId
|
|
||||||
self.chargeAvatar(av, optional[2], item.getEmblemPrices())
|
self.chargeAvatar(av, optional[2], item.getEmblemPrices())
|
||||||
recipient.onGiftOrder.append(item)
|
recipient.addToGiftSchedule(avId, targetId, item, item.getDeliveryTime())
|
||||||
av.addStat(ToontownGlobals.STAT_ITEMS)
|
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)
|
self.sendGiftPurchaseResponse(context, avId, ToontownGlobals.P_ItemOnOrder)
|
||||||
|
|
||||||
def sendGiftPurchaseResponse(self, context, avId, returnCode):
|
def sendGiftPurchaseResponse(self, context, avId, returnCode):
|
||||||
|
|
|
@ -60,7 +60,7 @@ class DistributedRewardCrateAI(DistributedFurnitureItemAI):
|
||||||
if item.reachedPurchaseLimit(av):
|
if item.reachedPurchaseLimit(av):
|
||||||
return
|
return
|
||||||
|
|
||||||
self.addToOrder(av, item)
|
av.addToDeliverySchedule(item)
|
||||||
self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_NAMETAGS, 0])
|
self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_NAMETAGS, 0])
|
||||||
elif prizeType == ToontownGlobals.CRATE_EMOTES:
|
elif prizeType == ToontownGlobals.CRATE_EMOTES:
|
||||||
playerEmotes = av.emoteAccess
|
playerEmotes = av.emoteAccess
|
||||||
|
@ -77,7 +77,7 @@ class DistributedRewardCrateAI(DistributedFurnitureItemAI):
|
||||||
self.choosePrize(av, tryNumber + 1)
|
self.choosePrize(av, tryNumber + 1)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.addToOrder(av, item)
|
av.addToDeliverySchedule(item)
|
||||||
self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_EMOTES, 0])
|
self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_EMOTES, 0])
|
||||||
elif prizeType == ToontownGlobals.CRATE_CLOTHING:
|
elif prizeType == ToontownGlobals.CRATE_CLOTHING:
|
||||||
clothing = CatalogClothingItem.ClothingTypes.keys()
|
clothing = CatalogClothingItem.ClothingTypes.keys()
|
||||||
|
@ -87,7 +87,7 @@ class DistributedRewardCrateAI(DistributedFurnitureItemAI):
|
||||||
item = CatalogClothingItem.CatalogClothingItem(id, 0)
|
item = CatalogClothingItem.CatalogClothingItem(id, 0)
|
||||||
|
|
||||||
if not item.notOfferedTo(av) and not item.reachedPurchaseLimit(av):
|
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])
|
self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_CLOTHING, 0])
|
||||||
return
|
return
|
||||||
elif prizeType == ToontownGlobals.CRATE_ACCESSORIES:
|
elif prizeType == ToontownGlobals.CRATE_ACCESSORIES:
|
||||||
|
@ -98,14 +98,9 @@ class DistributedRewardCrateAI(DistributedFurnitureItemAI):
|
||||||
item = CatalogAccessoryItem.CatalogAccessoryItem(id, 0)
|
item = CatalogAccessoryItem.CatalogAccessoryItem(id, 0)
|
||||||
|
|
||||||
if not item.reachedPurchaseLimit(av):
|
if not item.reachedPurchaseLimit(av):
|
||||||
self.addToOrder(av, item)
|
av.addToDeliverySchedule(item)
|
||||||
self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_ACCESSORIES, 0])
|
self.sendUpdateToAvatarId(av.doId, 'useKeyResponse', [ToontownGlobals.CRATE_ACCESSORIES, 0])
|
||||||
return
|
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):
|
def giveBeans(self, av):
|
||||||
beans = random.randint(1, 15) * 100
|
beans = random.randint(1, 15) * 100
|
||||||
|
|
|
@ -86,6 +86,11 @@ suitDeptFullnamesP = {'c': TTLocalizer.BossbotP,
|
||||||
'l': TTLocalizer.LawbotP,
|
'l': TTLocalizer.LawbotP,
|
||||||
'm': TTLocalizer.CashbotP,
|
'm': TTLocalizer.CashbotP,
|
||||||
's': TTLocalizer.SellbotP}
|
's': TTLocalizer.SellbotP}
|
||||||
|
suitDeptFilenames = {'c': 'boss',
|
||||||
|
'l': 'law',
|
||||||
|
'm': 'cash',
|
||||||
|
's': 'sell'
|
||||||
|
}
|
||||||
suitDeptModelPaths = {'c': '**/CorpIcon',
|
suitDeptModelPaths = {'c': '**/CorpIcon',
|
||||||
0: '**/CorpIcon',
|
0: '**/CorpIcon',
|
||||||
'l': '**/LegalIcon',
|
'l': '**/LegalIcon',
|
||||||
|
|
|
@ -2098,6 +2098,14 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
|
||||||
|
|
||||||
def getCatalogNotify(self):
|
def getCatalogNotify(self):
|
||||||
return (self.catalogNotify, self.mailboxNotify)
|
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):
|
def b_setDeliverySchedule(self, onOrder, doUpdateLater = True):
|
||||||
self.setDeliverySchedule(onOrder, doUpdateLater)
|
self.setDeliverySchedule(onOrder, doUpdateLater)
|
||||||
|
|
Loading…
Reference in a new issue