2015-07-17 06:55:14 -05:00
|
|
|
from toontown.toon import ToonDNA
|
|
|
|
import CatalogItem, CatalogItemList
|
2015-07-17 11:48:30 -05:00
|
|
|
import json
|
2015-07-17 06:55:14 -05:00
|
|
|
|
|
|
|
def createFromJson(jsonData):
|
|
|
|
return createFromFields(json.loads(jsonData))
|
|
|
|
|
|
|
|
def createFromFields(fields):
|
|
|
|
avatar = GiftAvatar()
|
|
|
|
|
|
|
|
for key, value in fields.iteritems():
|
|
|
|
getattr(avatar, key)(value)
|
|
|
|
|
|
|
|
return avatar
|
|
|
|
|
|
|
|
class GiftAvatar:
|
|
|
|
|
|
|
|
def getStyle(self):
|
|
|
|
return self.style
|
|
|
|
|
|
|
|
def getHat(self):
|
|
|
|
return self.hat
|
|
|
|
|
|
|
|
def getGlasses(self):
|
|
|
|
return self.glasses
|
|
|
|
|
|
|
|
def getBackpack(self):
|
|
|
|
return self.backpack
|
|
|
|
|
|
|
|
def getShoes(self):
|
|
|
|
return self.shoes
|
|
|
|
|
|
|
|
def getGiftScheduleBlob(self):
|
|
|
|
return self.onGiftOrder.getBlob(store=CatalogItem.Customization | CatalogItem.DeliveryDate)
|
|
|
|
|
|
|
|
def setDNAString(self, dnaString):
|
|
|
|
self.style = ToonDNA.ToonDNA()
|
2015-07-17 11:48:30 -05:00
|
|
|
self.style.makeFromNetString(dnaString.decode('base64'))
|
2015-07-17 06:55:14 -05:00
|
|
|
|
|
|
|
def setMailboxContents(self, contents):
|
2015-07-17 11:48:30 -05:00
|
|
|
self.mailboxContents = CatalogItemList.CatalogItemList(contents.decode('base64'), store=CatalogItem.Customization)
|
2015-07-17 06:55:14 -05:00
|
|
|
|
|
|
|
def setGiftSchedule(self, onOrder):
|
2015-07-17 11:48:30 -05:00
|
|
|
self.onGiftOrder = CatalogItemList.CatalogItemList(onOrder.decode('base64'), store=CatalogItem.Customization | CatalogItem.DeliveryDate)
|
2015-07-17 06:55:14 -05:00
|
|
|
|
|
|
|
def setDeliverySchedule(self, onOrder):
|
2015-07-17 11:48:30 -05:00
|
|
|
self.onOrder = CatalogItemList.CatalogItemList(onOrder.decode('base64'), store=CatalogItem.Customization | CatalogItem.DeliveryDate)
|
2015-07-17 06:55:14 -05:00
|
|
|
|
|
|
|
def setHat(self, hat):
|
|
|
|
self.hat = hat
|
|
|
|
|
|
|
|
def setGlasses(self, glasses):
|
|
|
|
self.glasses = glasses
|
|
|
|
|
|
|
|
def setBackpack(self, backpack):
|
|
|
|
self.backpack = backpack
|
|
|
|
|
|
|
|
def setShoes(self, shoes):
|
|
|
|
self.shoes = shoes
|
|
|
|
|
|
|
|
def setHatList(self, list):
|
|
|
|
self.hatList = list[0]
|
|
|
|
|
|
|
|
def setGlassesList(self, list):
|
|
|
|
self.glassesList = list[0]
|
|
|
|
|
|
|
|
def setBackpackList(self, list):
|
|
|
|
self.backpackList = list[0]
|
|
|
|
|
|
|
|
def setShoesList(self, list):
|
|
|
|
self.shoesList = list[0]
|
|
|
|
|
|
|
|
def setCustomMessages(self, customMessages):
|
|
|
|
self.customMessages = customMessages[0]
|
|
|
|
|
|
|
|
def setClothesTopsList(self, clothesList):
|
|
|
|
self.clothesTopsList = clothesList[0]
|
|
|
|
|
|
|
|
def setClothesBottomsList(self, clothesList):
|
|
|
|
self.clothesBottomsList = clothesList[0]
|
|
|
|
|
|
|
|
def setEmoteAccess(self, emoteAccess):
|
|
|
|
self.emoteAccess = emoteAccess[0]
|
|
|
|
|
|
|
|
def setPetTrickPhrases(self, tricks):
|
2015-07-17 16:39:11 -05:00
|
|
|
self.petTrickPhrases = tricks[0]
|
|
|
|
|
|
|
|
def setNametagStyles(self, nametagStyles):
|
|
|
|
self.nametagStyles = nametagStyles[0]
|