mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-10-31 08:47:54 +00:00
Implement TTR's catalog
This commit is contained in:
parent
25bb468501
commit
1256f21e0b
33 changed files with 418 additions and 888 deletions
|
@ -1527,8 +1527,6 @@ dclass TutorialManager : DistributedObject {
|
||||||
|
|
||||||
dclass CatalogManager : DistributedObject {
|
dclass CatalogManager : DistributedObject {
|
||||||
startCatalog() airecv clsend;
|
startCatalog() airecv clsend;
|
||||||
fetchPopularItems() airecv clsend;
|
|
||||||
setPopularItems(blob);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dclass DistributedMyTest : DistributedObject {
|
dclass DistributedMyTest : DistributedObject {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
|
||||||
|
|
||||||
hashVal = 315047669
|
hashVal = 2495436342L
|
||||||
|
|
||||||
|
|
||||||
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot
|
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot
|
||||||
|
|
|
@ -19,7 +19,6 @@ from toontown.ai import BankManagerAI
|
||||||
from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI
|
from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI
|
||||||
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
|
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
|
||||||
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
|
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
|
||||||
from toontown.catalog.PopularItemManagerAI import PopularItemManagerAI
|
|
||||||
from toontown.coghq import CountryClubManagerAI
|
from toontown.coghq import CountryClubManagerAI
|
||||||
from toontown.coghq import FactoryManagerAI
|
from toontown.coghq import FactoryManagerAI
|
||||||
from toontown.coghq import LawOfficeManagerAI
|
from toontown.coghq import LawOfficeManagerAI
|
||||||
|
@ -130,7 +129,6 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
self.estateManager.generateWithRequired(2)
|
self.estateManager.generateWithRequired(2)
|
||||||
self.catalogManager = CatalogManagerAI(self)
|
self.catalogManager = CatalogManagerAI(self)
|
||||||
self.catalogManager.generateWithRequired(2)
|
self.catalogManager.generateWithRequired(2)
|
||||||
self.popularItemManager = PopularItemManagerAI(self)
|
|
||||||
self.deliveryManager = self.generateGlobalObject(
|
self.deliveryManager = self.generateGlobalObject(
|
||||||
OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager')
|
OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager')
|
||||||
if self.wantPets:
|
if self.wantPets:
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
from pandac.PandaModules import NodePath
|
|
||||||
from direct.gui.DirectButton import DirectButton
|
|
||||||
from toontown.catalog import CatalogGlobals
|
|
||||||
|
|
||||||
|
|
||||||
class CatalogArrowButton(NodePath):
|
|
||||||
def __init__(self, parent, nodeName, clickEvent):
|
|
||||||
NodePath.__init__(self, parent.attachNewNode(nodeName))
|
|
||||||
|
|
||||||
self.clickEvent = clickEvent
|
|
||||||
|
|
||||||
self.normalNode = CatalogGlobals.CatalogNodePath.find('**/arrow_UP_'+nodeName).copyTo(self)
|
|
||||||
self.clickedNode = CatalogGlobals.CatalogNodePath.find('**/arrow_DN_'+nodeName).copyTo(self)
|
|
||||||
self.hoverNode = CatalogGlobals.CatalogNodePath.find('**/arrow_OVR_'+nodeName).copyTo(self)
|
|
||||||
|
|
||||||
self.arrowButton = DirectButton(parent=self, relief=None, image=(self.normalNode, self.clickedNode, self.hoverNode), command=self.clickEvent)
|
|
||||||
|
|
||||||
def cleanup(self):
|
|
||||||
self.arrowButton.destroy()
|
|
||||||
|
|
||||||
NodePath.removeNode(self)
|
|
93
toontown/catalog/CatalogChatBalloon.py
Normal file
93
toontown/catalog/CatalogChatBalloon.py
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
from pandac.PandaModules import *
|
||||||
|
|
||||||
|
class CatalogChatBalloon:
|
||||||
|
TEXT_SHIFT = (0.1, -0.05, 1.1)
|
||||||
|
TEXT_SHIFT_REVERSED = -0.05
|
||||||
|
TEXT_SHIFT_PROP = 0.08
|
||||||
|
NATIVE_WIDTH = 10.0
|
||||||
|
MIN_WIDTH = 2.5
|
||||||
|
MIN_HEIGHT = 1
|
||||||
|
BUBBLE_PADDING = 0.3
|
||||||
|
BUBBLE_PADDING_PROP = 0.05
|
||||||
|
BUTTON_SCALE = 6
|
||||||
|
BUTTON_SHIFT = (-0.2, 0, 0.6)
|
||||||
|
FRAME_SHIFT = (0.2, 1.4)
|
||||||
|
|
||||||
|
def __init__(self, model):
|
||||||
|
self.model = model
|
||||||
|
|
||||||
|
def generate(self, text, font, textColor=(0,0,0,1), balloonColor=(1,1,1,1),
|
||||||
|
wordWrap = 10.0, button=None, reversed=False):
|
||||||
|
root = NodePath('balloon')
|
||||||
|
|
||||||
|
# Add balloon geometry:
|
||||||
|
balloon = self.model.copyTo(root)
|
||||||
|
top = balloon.find('**/top')
|
||||||
|
middle = balloon.find('**/middle')
|
||||||
|
bottom = balloon.find('**/bottom')
|
||||||
|
|
||||||
|
balloon.setColor(balloonColor)
|
||||||
|
if balloonColor[3] < 1.0:
|
||||||
|
balloon.setTransparency(1)
|
||||||
|
|
||||||
|
# Render the text into a TextNode, using the font:
|
||||||
|
t = root.attachNewNode(TextNode('text'))
|
||||||
|
t.node().setFont(font)
|
||||||
|
t.node().setWordwrap(wordWrap)
|
||||||
|
t.node().setText(text)
|
||||||
|
t.node().setTextColor(textColor)
|
||||||
|
|
||||||
|
width, height = t.node().getWidth(), t.node().getHeight()
|
||||||
|
|
||||||
|
# Turn off depth write for the text: The place in the depth buffer is
|
||||||
|
# held by the chat bubble anyway, and the text renders after the bubble
|
||||||
|
# so there's no risk of the bubble overwriting the text's pixels.
|
||||||
|
t.setAttrib(DepthWriteAttrib.make(0))
|
||||||
|
t.setPos(self.TEXT_SHIFT)
|
||||||
|
t.setX(t, self.TEXT_SHIFT_PROP*width)
|
||||||
|
t.setZ(t, height)
|
||||||
|
|
||||||
|
if reversed:
|
||||||
|
# The nametag code wants the text on the left side of the axis,
|
||||||
|
# rather than on the right side. Therefore, we move the text to the
|
||||||
|
# opposite side:
|
||||||
|
t.setX(self.TEXT_SHIFT_REVERSED - self.TEXT_SHIFT_PROP*width - width)
|
||||||
|
|
||||||
|
# Give the chat bubble a button, if one is requested:
|
||||||
|
if button:
|
||||||
|
np = button.copyTo(root)
|
||||||
|
np.setPos(t, width, 0, -height)
|
||||||
|
np.setPos(np, self.BUTTON_SHIFT)
|
||||||
|
np.setScale(self.BUTTON_SCALE)
|
||||||
|
|
||||||
|
# Set a minimum width and height for short or empty messages
|
||||||
|
if width < self.MIN_WIDTH:
|
||||||
|
width = self.MIN_WIDTH
|
||||||
|
if reversed:
|
||||||
|
t.setX(t, -width/2.0)
|
||||||
|
else:
|
||||||
|
t.setX(t, width/2.0)
|
||||||
|
t.node().setAlign(TextNode.ACenter)
|
||||||
|
|
||||||
|
if height < self.MIN_HEIGHT:
|
||||||
|
height = self.MIN_HEIGHT
|
||||||
|
t.setX(t, height/2.0)
|
||||||
|
t.node().setAlign(TextNode.ACenter)
|
||||||
|
|
||||||
|
# Set the balloon's size:
|
||||||
|
width *= 1+self.BUBBLE_PADDING_PROP
|
||||||
|
width += self.BUBBLE_PADDING
|
||||||
|
balloon.setSx(width/self.NATIVE_WIDTH)
|
||||||
|
if reversed:
|
||||||
|
balloon.setSx(-balloon.getSx())
|
||||||
|
balloon.setTwoSided(True) # Render the backface of the balloon
|
||||||
|
middle.setSz(height)
|
||||||
|
top.setZ(top, height-1)
|
||||||
|
|
||||||
|
# Calculate the frame occupied by the balloon:
|
||||||
|
left, bottom = self.FRAME_SHIFT
|
||||||
|
if reversed:
|
||||||
|
left = -left - width
|
||||||
|
frame = (left, left+width, bottom, bottom+height+1)
|
||||||
|
|
||||||
|
return root, frame
|
|
@ -28,9 +28,6 @@ class CatalogChatItem(CatalogItem.CatalogItem):
|
||||||
def getDisplayName(self):
|
def getDisplayName(self):
|
||||||
return OTPLocalizer.CustomSCStrings[self.customIndex]
|
return OTPLocalizer.CustomSCStrings[self.customIndex]
|
||||||
|
|
||||||
def getDeliveryTime(self):
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def recordPurchase(self, avatar, optional):
|
def recordPurchase(self, avatar, optional):
|
||||||
if avatar.customMessages.count(self.customIndex) != 0:
|
if avatar.customMessages.count(self.customIndex) != 0:
|
||||||
return ToontownGlobals.P_ReachedPurchaseLimit
|
return ToontownGlobals.P_ReachedPurchaseLimit
|
||||||
|
@ -103,6 +100,7 @@ class CatalogChatItem(CatalogItem.CatalogItem):
|
||||||
if status == 'pick':
|
if status == 'pick':
|
||||||
self.mailbox.acceptItem(self, self.index, self.callback, pickedMessage)
|
self.mailbox.acceptItem(self, self.index, self.callback, pickedMessage)
|
||||||
else:
|
else:
|
||||||
|
print 'picker canceled'
|
||||||
self.callback(ToontownGlobals.P_UserCancelled, None, self.index)
|
self.callback(ToontownGlobals.P_UserCancelled, None, self.index)
|
||||||
self.messagePicker.hide()
|
self.messagePicker.hide()
|
||||||
self.messagePicker.destroy()
|
self.messagePicker.destroy()
|
||||||
|
@ -121,7 +119,7 @@ class CatalogChatItem(CatalogItem.CatalogItem):
|
||||||
del self.phone
|
del self.phone
|
||||||
|
|
||||||
def getPicture(self, avatar):
|
def getPicture(self, avatar):
|
||||||
chatBalloon = loader.loadModel('phase_3/models/props/chatbox.bam')
|
chatBalloon = loader.loadModel('phase_3/models/props/chatbox')
|
||||||
chatBalloon.find('**/top').setPos(1, 0, 5)
|
chatBalloon.find('**/top').setPos(1, 0, 5)
|
||||||
chatBalloon.find('**/middle').setScale(1, 1, 3)
|
chatBalloon.find('**/middle').setScale(1, 1, 3)
|
||||||
frame = self.makeFrame()
|
frame = self.makeFrame()
|
||||||
|
|
|
@ -356,7 +356,7 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
|
||||||
if dna.topTex == defn[0] and dna.topTexColor == defn[2][self.colorIndex][0] and dna.sleeveTex == defn[1] and dna.sleeveTexColor == defn[2][self.colorIndex][1]:
|
if dna.topTex == defn[0] and dna.topTexColor == defn[2][self.colorIndex][0] and dna.sleeveTex == defn[1] and dna.sleeveTexColor == defn[2][self.colorIndex][1]:
|
||||||
return 1
|
return 1
|
||||||
l = avatar.clothesTopsList
|
l = avatar.clothesTopsList
|
||||||
for i in xrange(0, len(l), 4):
|
for i in range(0, len(l), 4):
|
||||||
if l[i] == defn[0] and l[i + 1] == defn[2][self.colorIndex][0] and l[i + 2] == defn[1] and l[i + 3] == defn[2][self.colorIndex][1]:
|
if l[i] == defn[0] and l[i + 1] == defn[2][self.colorIndex][0] and l[i + 2] == defn[1] and l[i + 3] == defn[2][self.colorIndex][1]:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
|
||||||
if dna.botTex == defn[0] and dna.botTexColor == defn[1][self.colorIndex]:
|
if dna.botTex == defn[0] and dna.botTexColor == defn[1][self.colorIndex]:
|
||||||
return 1
|
return 1
|
||||||
l = avatar.clothesBottomsList
|
l = avatar.clothesBottomsList
|
||||||
for i in xrange(0, len(l), 2):
|
for i in range(0, len(l), 2):
|
||||||
if l[i] == defn[0] and l[i + 1] == defn[1][self.colorIndex]:
|
if l[i] == defn[0] and l[i + 1] == defn[1][self.colorIndex]:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
@ -427,6 +427,9 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
|
||||||
avatar.d_catalogGenClothes()
|
avatar.d_catalogGenClothes()
|
||||||
return ToontownGlobals.P_ItemAvailable
|
return ToontownGlobals.P_ItemAvailable
|
||||||
|
|
||||||
|
def getDeliveryTime(self):
|
||||||
|
return 1
|
||||||
|
|
||||||
def getPicture(self, avatar):
|
def getPicture(self, avatar):
|
||||||
from toontown.toon import Toon
|
from toontown.toon import Toon
|
||||||
self.hasPicture = True
|
self.hasPicture = True
|
||||||
|
@ -594,7 +597,7 @@ def getAllClothes(*clothingTypes):
|
||||||
for clothingType in clothingTypes:
|
for clothingType in clothingTypes:
|
||||||
base = CatalogClothingItem(clothingType, 0)
|
base = CatalogClothingItem(clothingType, 0)
|
||||||
list.append(base)
|
list.append(base)
|
||||||
for n in xrange(1, len(base.getColorChoices())):
|
for n in range(1, len(base.getColorChoices())):
|
||||||
list.append(CatalogClothingItem(clothingType, n))
|
list.append(CatalogClothingItem(clothingType, n))
|
||||||
|
|
||||||
return list
|
return list
|
||||||
|
|
|
@ -115,7 +115,7 @@ class CatalogFlooringItem(CatalogSurfaceItem):
|
||||||
if versionNumber < 4 or store & CatalogItem.Customization:
|
if versionNumber < 4 or store & CatalogItem.Customization:
|
||||||
self.colorIndex = di.getUint8()
|
self.colorIndex = di.getUint8()
|
||||||
else:
|
else:
|
||||||
self.colorIndex = None
|
self.colorIndex = 0
|
||||||
wtype = FlooringTypes[self.patternIndex]
|
wtype = FlooringTypes[self.patternIndex]
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -123,10 +123,7 @@ class CatalogFlooringItem(CatalogSurfaceItem):
|
||||||
CatalogAtticItem.CatalogAtticItem.encodeDatagram(self, dg, store)
|
CatalogAtticItem.CatalogAtticItem.encodeDatagram(self, dg, store)
|
||||||
dg.addUint16(self.patternIndex)
|
dg.addUint16(self.patternIndex)
|
||||||
if store & CatalogItem.Customization:
|
if store & CatalogItem.Customization:
|
||||||
colorIndex = self.colorIndex
|
dg.addUint8(self.colorIndex)
|
||||||
if self.colorIndex is None:
|
|
||||||
colorIndex = 0
|
|
||||||
dg.addUint8(colorIndex)
|
|
||||||
|
|
||||||
|
|
||||||
def getFloorings(*indexList):
|
def getFloorings(*indexList):
|
||||||
|
@ -142,7 +139,7 @@ def getAllFloorings(*indexList):
|
||||||
for index in indexList:
|
for index in indexList:
|
||||||
colors = FlooringTypes[index][FTColor]
|
colors = FlooringTypes[index][FTColor]
|
||||||
if colors:
|
if colors:
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogFlooringItem(index, n))
|
list.append(CatalogFlooringItem(index, n))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -166,7 +163,7 @@ def getFlooringRange(fromIndex, toIndex, *otherRanges):
|
||||||
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
||||||
colors = FlooringTypes[patternIndex][FTColor]
|
colors = FlooringTypes[patternIndex][FTColor]
|
||||||
if colors:
|
if colors:
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogFlooringItem(patternIndex, n))
|
list.append(CatalogFlooringItem(patternIndex, n))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -3,7 +3,6 @@ import CatalogItem
|
||||||
import random
|
import random
|
||||||
from toontown.toonbase import TTLocalizer
|
from toontown.toonbase import TTLocalizer
|
||||||
from toontown.toonbase import ToontownGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
|
||||||
FTModelName = 0
|
FTModelName = 0
|
||||||
FTColor = 1
|
FTColor = 1
|
||||||
FTColorOptions = 2
|
FTColorOptions = 2
|
||||||
|
@ -19,67 +18,39 @@ FLIsTable = 32
|
||||||
FLPhone = 64
|
FLPhone = 64
|
||||||
FLBillboard = 128
|
FLBillboard = 128
|
||||||
FLTrunk = 256
|
FLTrunk = 256
|
||||||
|
FLBoysOnly = 512
|
||||||
furnitureColors = [(0.792,
|
FLGirlsOnly = 1024
|
||||||
0.353,
|
furnitureColors = [
|
||||||
0.29,
|
(0.792, 0.353, 0.29, 1.0),
|
||||||
1.0),
|
(0.176, 0.592, 0.439, 1.0),
|
||||||
(0.176,
|
(0.439, 0.424, 0.682, 1.0),
|
||||||
0.592,
|
(0.325, 0.58, 0.835, 1.0),
|
||||||
0.439,
|
(0.753, 0.345, 0.557, 1.0),
|
||||||
1.0),
|
(0.992, 0.843, 0.392, 1.0)
|
||||||
(0.439,
|
]
|
||||||
0.424,
|
woodColors = [
|
||||||
0.682,
|
(0.933, 0.773, 0.569, 1.0),
|
||||||
1.0),
|
(0.9333, 0.6785, 0.055, 1.0),
|
||||||
(0.325,
|
(0.545, 0.451, 0.333, 1.0),
|
||||||
0.58,
|
(0.541, 0.0, 0.0, 1.0),
|
||||||
0.835,
|
(0.5451, 0.2706, 0.0745, 1.0),
|
||||||
1.0),
|
(0.5451, 0.4118, 0.4118, 1.0)
|
||||||
(0.753,
|
]
|
||||||
0.345,
|
BankToMoney = {
|
||||||
0.557,
|
1300: 15000,
|
||||||
1.0),
|
1310: 15000,
|
||||||
(0.992,
|
1320: 15000,
|
||||||
0.843,
|
1330: 15000,
|
||||||
0.392,
|
1340: 15000,
|
||||||
1.0)]
|
1350: 15000
|
||||||
woodColors = [(0.933,
|
}
|
||||||
0.773,
|
|
||||||
0.569,
|
|
||||||
1.0),
|
|
||||||
(0.9333,
|
|
||||||
0.6785,
|
|
||||||
0.055,
|
|
||||||
1.0),
|
|
||||||
(0.545,
|
|
||||||
0.451,
|
|
||||||
0.333,
|
|
||||||
1.0),
|
|
||||||
(0.541,
|
|
||||||
0.0,
|
|
||||||
0.0,
|
|
||||||
1.0),
|
|
||||||
(0.5451,
|
|
||||||
0.2706,
|
|
||||||
0.0745,
|
|
||||||
1.0),
|
|
||||||
(0.5451,
|
|
||||||
0.4118,
|
|
||||||
0.4118,
|
|
||||||
1.0)]
|
|
||||||
BankToMoney = {1300: 12000,
|
|
||||||
1310: 12000,
|
|
||||||
1320: 12000,
|
|
||||||
1330: 12000,
|
|
||||||
1340: 12000,
|
|
||||||
1350: 12000}
|
|
||||||
MoneyToBank = {}
|
MoneyToBank = {}
|
||||||
for bankId, maxMoney in BankToMoney.items():
|
for bankId, maxMoney in BankToMoney.items():
|
||||||
MoneyToBank[maxMoney] = bankId
|
MoneyToBank[maxMoney] = bankId
|
||||||
|
|
||||||
MaxBankId = 1350
|
MaxBankId = 1350
|
||||||
ClosetToClothes = {500: 10,
|
ClosetToClothes = {
|
||||||
|
500: 10,
|
||||||
502: 15,
|
502: 15,
|
||||||
504: 20,
|
504: 20,
|
||||||
506: 25,
|
506: 25,
|
||||||
|
@ -88,20 +59,24 @@ ClosetToClothes = {500: 10,
|
||||||
512: 15,
|
512: 15,
|
||||||
514: 20,
|
514: 20,
|
||||||
516: 25,
|
516: 25,
|
||||||
518: 50}
|
518: 50
|
||||||
|
}
|
||||||
ClothesToCloset = {}
|
ClothesToCloset = {}
|
||||||
for closetId, maxClothes in ClosetToClothes.items():
|
for closetId, maxClothes in ClosetToClothes.items():
|
||||||
if maxClothes not in ClothesToCloset:
|
if not ClothesToCloset.has_key(maxClothes):
|
||||||
ClothesToCloset[maxClothes] = (closetId,)
|
ClothesToCloset[maxClothes] = (closetId,)
|
||||||
else:
|
else:
|
||||||
ClothesToCloset[maxClothes] += (closetId,)
|
ClothesToCloset[maxClothes] += (closetId,)
|
||||||
|
|
||||||
MaxClosetIds = (508, 518)
|
MaxClosetIds = (508, 518)
|
||||||
MaxTrunkIds = (4000, 4010)
|
MaxTrunkIds = (4000, 4010)
|
||||||
FurnitureTypes = {100: ('phase_5.5/models/estate/chairA',
|
FurnitureTypes = {
|
||||||
None,
|
100: ('phase_5.5/models/estate/chairA', # Model
|
||||||
None,
|
None, # Color
|
||||||
80),
|
None, # Color Options
|
||||||
|
80), # Base Price
|
||||||
|
# Flags
|
||||||
|
# Scale
|
||||||
105: ('phase_5.5/models/estate/chairAdesat',
|
105: ('phase_5.5/models/estate/chairAdesat',
|
||||||
None,
|
None,
|
||||||
{0: (('**/cushion*', furnitureColors[0]), ('**/arm*', furnitureColors[0])),
|
{0: (('**/cushion*', furnitureColors[0]), ('**/arm*', furnitureColors[0])),
|
||||||
|
@ -189,7 +164,8 @@ FurnitureTypes = {100: ('phase_5.5/models/estate/chairA',
|
||||||
210: ('phase_5.5/models/estate/girly_bed',
|
210: ('phase_5.5/models/estate/girly_bed',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
450),
|
450,
|
||||||
|
FLGirlsOnly),
|
||||||
220: ('phase_5.5/models/estate/bathtub_bed',
|
220: ('phase_5.5/models/estate/bathtub_bed',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
@ -233,7 +209,8 @@ FurnitureTypes = {100: ('phase_5.5/models/estate/chairA',
|
||||||
410: ('phase_5.5/models/estate/FireplaceGirlee',
|
410: ('phase_5.5/models/estate/FireplaceGirlee',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
800),
|
800,
|
||||||
|
FLGirlsOnly),
|
||||||
420: ('phase_5.5/models/estate/FireplaceRound',
|
420: ('phase_5.5/models/estate/FireplaceRound',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
@ -275,7 +252,7 @@ FurnitureTypes = {100: ('phase_5.5/models/estate/chairA',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
1100,
|
1100,
|
||||||
None,
|
FLGirlsOnly,
|
||||||
None,
|
None,
|
||||||
0.5),
|
0.5),
|
||||||
491: ('phase_5.5/models/estate/tt_m_prp_int_fireplace_bugRoom',
|
491: ('phase_5.5/models/estate/tt_m_prp_int_fireplace_bugRoom',
|
||||||
|
@ -875,13 +852,13 @@ FurnitureTypes = {100: ('phase_5.5/models/estate/chairA',
|
||||||
4000: ('phase_5.5/models/estate/tt_m_ara_est_accessoryTrunkBoy',
|
4000: ('phase_5.5/models/estate/tt_m_ara_est_accessoryTrunkBoy',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
5,
|
0,
|
||||||
FLTrunk,
|
FLTrunk,
|
||||||
0.9),
|
0.9),
|
||||||
4010: ('phase_5.5/models/estate/tt_m_ara_est_accessoryTrunkGirl',
|
4010: ('phase_5.5/models/estate/tt_m_ara_est_accessoryTrunkGirl',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
5,
|
0,
|
||||||
FLTrunk,
|
FLTrunk,
|
||||||
0.9),
|
0.9),
|
||||||
10000: ('phase_4/models/estate/pumpkin_short',
|
10000: ('phase_4/models/estate/pumpkin_short',
|
||||||
|
@ -905,7 +882,8 @@ FurnitureTypes = {100: ('phase_5.5/models/estate/chairA',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
200,
|
200,
|
||||||
FLPainting)}
|
FLPainting)
|
||||||
|
}
|
||||||
|
|
||||||
class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
|
class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
|
||||||
|
|
||||||
|
@ -934,6 +912,8 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
|
||||||
return TTLocalizer.FurnitureYourOldBank
|
return TTLocalizer.FurnitureYourOldBank
|
||||||
elif self.getFlags() & FLTrunk:
|
elif self.getFlags() & FLTrunk:
|
||||||
return TTLocalizer.FurnitureYourOldTrunk
|
return TTLocalizer.FurnitureYourOldTrunk
|
||||||
|
else:
|
||||||
|
return None
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def notOfferedTo(self, avatar):
|
def notOfferedTo(self, avatar):
|
||||||
|
@ -944,8 +924,24 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
|
||||||
return not forBoys
|
return not forBoys
|
||||||
else:
|
else:
|
||||||
return forBoys
|
return forBoys
|
||||||
|
if self.forBoysOnly():
|
||||||
|
if avatar.getStyle().getGender() == 'm':
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
|
elif self.forGirlsOnly():
|
||||||
|
if avatar.getStyle().getGender() == 'f':
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def forBoysOnly(self):
|
||||||
|
return self.getFlags() & FLBoysOnly > 0
|
||||||
|
|
||||||
|
def forGirlsOnly(self):
|
||||||
|
return self.getFlags() & FLGirlsOnly > 0
|
||||||
|
|
||||||
def isDeletable(self):
|
def isDeletable(self):
|
||||||
return self.getFlags() & (FLBank | FLCloset | FLPhone | FLTrunk) == 0
|
return self.getFlags() & (FLBank | FLCloset | FLPhone | FLTrunk) == 0
|
||||||
|
|
||||||
|
@ -1034,6 +1030,9 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
|
||||||
avatar.b_setMaxBankMoney(self.getMaxBankMoney())
|
avatar.b_setMaxBankMoney(self.getMaxBankMoney())
|
||||||
return retcode
|
return retcode
|
||||||
|
|
||||||
|
def getDeliveryTime(self):
|
||||||
|
return 1
|
||||||
|
|
||||||
def getPicture(self, avatar):
|
def getPicture(self, avatar):
|
||||||
model = self.loadModel()
|
model = self.loadModel()
|
||||||
spin = 1
|
spin = 1
|
||||||
|
@ -1104,10 +1103,7 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem):
|
||||||
dg.addInt16(self.furnitureType)
|
dg.addInt16(self.furnitureType)
|
||||||
if FurnitureTypes[self.furnitureType][FTColorOptions]:
|
if FurnitureTypes[self.furnitureType][FTColorOptions]:
|
||||||
if store & CatalogItem.Customization:
|
if store & CatalogItem.Customization:
|
||||||
if self.colorOption == None:
|
dg.addUint8(self.colorOption)
|
||||||
dg.addUint8(0)
|
|
||||||
else:
|
|
||||||
dg.addUint8(self.colorOption)
|
|
||||||
|
|
||||||
def getAcceptItemErrorText(self, retcode):
|
def getAcceptItemErrorText(self, retcode):
|
||||||
if retcode == ToontownGlobals.P_AlreadyOwnBiggerCloset:
|
if retcode == ToontownGlobals.P_AlreadyOwnBiggerCloset:
|
||||||
|
@ -1168,15 +1164,18 @@ def getAllClosets():
|
||||||
|
|
||||||
|
|
||||||
def get50ItemTrunk(avatar, duplicateItems):
|
def get50ItemTrunk(avatar, duplicateItems):
|
||||||
if avatar.getStyle().getGender() == 'm':
|
if config.GetBool('want-accessories', 1):
|
||||||
index = 0
|
if avatar.getStyle().getGender() == 'm':
|
||||||
else:
|
index = 0
|
||||||
index = 1
|
else:
|
||||||
trunkId = MaxTrunkIds[index]
|
index = 1
|
||||||
item = CatalogFurnitureItem(trunkId)
|
trunkId = MaxTrunkIds[index]
|
||||||
if item in avatar.onOrder or item in avatar.mailboxContents:
|
item = CatalogFurnitureItem(trunkId)
|
||||||
return None
|
if item in avatar.onOrder or item in avatar.mailboxContents:
|
||||||
return item
|
return None
|
||||||
|
return item
|
||||||
|
# If we get here, we probably don't want accessories yet.
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def getMaxTrunks():
|
def getMaxTrunks():
|
||||||
|
@ -1190,7 +1189,7 @@ def getMaxTrunks():
|
||||||
def getAllFurnitures(index):
|
def getAllFurnitures(index):
|
||||||
list = []
|
list = []
|
||||||
colors = FurnitureTypes[index][FTColorOptions]
|
colors = FurnitureTypes[index][FTColorOptions]
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogFurnitureItem(index, n))
|
list.append(CatalogFurnitureItem(index, n))
|
||||||
|
|
||||||
return list
|
return list
|
||||||
|
|
|
@ -1,206 +0,0 @@
|
||||||
from pandac.PandaModules import NodePath, Vec4
|
|
||||||
from direct.showbase.DirectObject import DirectObject
|
|
||||||
from direct.gui.DirectButton import DirectButton
|
|
||||||
from toontown.catalog.CatalogTabButton import CatalogTabButton
|
|
||||||
from toontown.catalog.CatalogArrowButton import CatalogArrowButton
|
|
||||||
from toontown.catalog.CatalogRadioButton import CatalogRadioButton
|
|
||||||
from toontown.catalog import CatalogGlobals
|
|
||||||
from toontown.toonbase import ToontownGlobals
|
|
||||||
from toontown.toonbase import TTLocalizer
|
|
||||||
|
|
||||||
|
|
||||||
class CatalogGUI(NodePath, DirectObject):
|
|
||||||
def __init__(self, phone, doneEvent=None):
|
|
||||||
NodePath.__init__(self, aspect2d.attachNewNode('CatalogGUI'))
|
|
||||||
DirectObject.__init__(self)
|
|
||||||
|
|
||||||
CatalogGlobals.CatalogNodePath.find('**/CATALOG_GUI_BKGD').copyTo(self)
|
|
||||||
self.setScale(CatalogGlobals.CatalogBKGDScale)
|
|
||||||
|
|
||||||
self.phone = phone
|
|
||||||
self.doneEvent = doneEvent
|
|
||||||
|
|
||||||
self.arrowButtons = {}
|
|
||||||
self.createArrowButtons()
|
|
||||||
|
|
||||||
self.currentTab = None
|
|
||||||
self.tabButtons = {}
|
|
||||||
self.createTabButtons()
|
|
||||||
|
|
||||||
self.radioButtons = []
|
|
||||||
# self.createRadioButtons()
|
|
||||||
|
|
||||||
self.activePage = 0
|
|
||||||
self.gifting = -1
|
|
||||||
|
|
||||||
guiItems = loader.loadModel('phase_5.5/models/gui/catalog_gui')
|
|
||||||
hangupGui = guiItems.find('**/hangup')
|
|
||||||
hangupRolloverGui = guiItems.find('**/hangup_rollover')
|
|
||||||
self.hangup = DirectButton(self,
|
|
||||||
relief=None,
|
|
||||||
pos=(-0.158, 0, 0.17),
|
|
||||||
image=[hangupGui, hangupRolloverGui, hangupRolloverGui, hangupGui],
|
|
||||||
text=['', TTLocalizer.CatalogHangUp, TTLocalizer.CatalogHangUp],
|
|
||||||
text_fg=Vec4(1),
|
|
||||||
text_scale=0.07,
|
|
||||||
text_pos=(0.0, 0.14),
|
|
||||||
command=self.hangUp
|
|
||||||
)
|
|
||||||
self.hangup.reparentTo(base.a2dBottomRight)
|
|
||||||
guiItems.removeNode()
|
|
||||||
|
|
||||||
def setCurrentTab(self, tab):
|
|
||||||
self.currentTab = tab
|
|
||||||
|
|
||||||
def getCurrentTab(self):
|
|
||||||
return self.currentTab
|
|
||||||
|
|
||||||
def setActivePage(self, activePage):
|
|
||||||
self.activePage = activePage
|
|
||||||
|
|
||||||
def getActivePage(self):
|
|
||||||
return self.activePage
|
|
||||||
|
|
||||||
def createTabButtons(self):
|
|
||||||
# We need to create the tabs in reverse order...
|
|
||||||
self.tabButtons['SPECIAL_TAB'] = CatalogTabButton(self, 'BTN7',
|
|
||||||
self.specialTabClicked)
|
|
||||||
self.tabButtons['NAMETAG_TAB'] = CatalogTabButton(self, 'BTN6',
|
|
||||||
self.nametagTabClicked)
|
|
||||||
self.tabButtons['CLOTHING_TAB'] = CatalogTabButton(self, 'BTN5',
|
|
||||||
self.clothingTabClicked)
|
|
||||||
self.tabButtons['PHRASES_TAB'] = CatalogTabButton(self, 'BTN4',
|
|
||||||
self.phrasesTabClicked)
|
|
||||||
self.tabButtons['EMOTE_TAB'] = CatalogTabButton(self, 'BTN3',
|
|
||||||
self.emoteTabClicked)
|
|
||||||
self.tabButtons['FURNITURE_TAB'] = CatalogTabButton(self, 'BTN2',
|
|
||||||
self.furnitureTabClicked)
|
|
||||||
self.tabButtons['POPULAR_TAB'] = CatalogTabButton(self, 'BTN1',
|
|
||||||
self.popularTabClicked)
|
|
||||||
tabList = []
|
|
||||||
for tab in self.tabButtons:
|
|
||||||
tabList.append(self.tabButtons[tab])
|
|
||||||
|
|
||||||
for tab in self.tabButtons:
|
|
||||||
self.tabButtons[tab].setOtherTabs(tabList)
|
|
||||||
|
|
||||||
def popularTabClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
|
|
||||||
def furnitureTabClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
|
|
||||||
def emoteTabClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
|
|
||||||
def phrasesTabClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
|
|
||||||
def clothingTabClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
|
|
||||||
def nametagTabClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
|
|
||||||
def specialTabClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
|
|
||||||
def createArrowButtons(self):
|
|
||||||
self.arrowButtons['LEFT_ARROW'] = CatalogArrowButton(self, 'LT',
|
|
||||||
self.leftArrowClicked)
|
|
||||||
self.arrowButtons['RIGHT_ARROW'] = CatalogArrowButton(self, 'RT',
|
|
||||||
self.rightArrowClicked)
|
|
||||||
|
|
||||||
def leftArrowClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
if self.currentTab:
|
|
||||||
self.currentTab.moveLeft()
|
|
||||||
|
|
||||||
def rightArrowClicked(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
if self.currentTab:
|
|
||||||
self.currentTab.moveRight()
|
|
||||||
|
|
||||||
def createRadioButtons(self):
|
|
||||||
byNameRadioButton = CatalogRadioButton(self, 'ByName',
|
|
||||||
self.byNameRadioButtonClicked)
|
|
||||||
byCostRadioButton = CatalogRadioButton(self, 'ByCost',
|
|
||||||
self.byCostRadioButtonClicked)
|
|
||||||
|
|
||||||
self.radioButtons.append(byNameRadioButton)
|
|
||||||
self.radioButtons.append(byCostRadioButton)
|
|
||||||
|
|
||||||
for radioButton in self.radioButtons:
|
|
||||||
radioButton.setOthers(self.radioButtons)
|
|
||||||
|
|
||||||
byNameRadioButton.enable()
|
|
||||||
|
|
||||||
def byNameRadioButtonClicked(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def byCostRadioButtonClicked(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def enableBothArrows(self):
|
|
||||||
for arrow in self.arrowButtons:
|
|
||||||
self.arrowButtons[arrow].show()
|
|
||||||
|
|
||||||
def disableBothArrows(self):
|
|
||||||
for arrow in self.arrowButtons:
|
|
||||||
self.arrowButtons[arrow].hide()
|
|
||||||
|
|
||||||
def disableLeftArrow(self):
|
|
||||||
self.arrowButtons['LEFT_ARROW'].hide()
|
|
||||||
|
|
||||||
def disableRightArrow(self):
|
|
||||||
self.arrowButtons['RIGHT_ARROW'].hide()
|
|
||||||
|
|
||||||
def show(self):
|
|
||||||
self.accept('CatalogItemPurchaseRequest', self.__handlePurchaseRequest)
|
|
||||||
base.setBackgroundColor(Vec4(0.570312, 0.449219, 0.164062, 1.0))
|
|
||||||
NodePath.show(self)
|
|
||||||
render.hide()
|
|
||||||
|
|
||||||
def hide(self):
|
|
||||||
self.ignore('CatalogItemPurchaseRequest')
|
|
||||||
base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
|
|
||||||
NodePath.hide(self)
|
|
||||||
render.show()
|
|
||||||
|
|
||||||
def unload(self):
|
|
||||||
self.hide()
|
|
||||||
|
|
||||||
for arrow in self.arrowButtons:
|
|
||||||
self.arrowButtons[arrow].cleanup()
|
|
||||||
|
|
||||||
for tab in self.tabButtons:
|
|
||||||
self.tabButtons[tab].cleanup()
|
|
||||||
|
|
||||||
for radio in self.radioButtons:
|
|
||||||
radio.cleanup()
|
|
||||||
|
|
||||||
self.hangup.destroy()
|
|
||||||
|
|
||||||
self.destroy()
|
|
||||||
|
|
||||||
def destroy(self):
|
|
||||||
NodePath.removeNode(self)
|
|
||||||
|
|
||||||
def hangUp(self):
|
|
||||||
self.unload()
|
|
||||||
print self.doneEvent
|
|
||||||
messenger.send(self.doneEvent)
|
|
||||||
|
|
||||||
def __handlePurchaseRequest(self, item):
|
|
||||||
item.requestPurchase(self.phone, self.__handlePurchaseResponse)
|
|
||||||
|
|
||||||
def __handlePurchaseResponse(self, retCode, item):
|
|
||||||
self.lockItems()
|
|
||||||
|
|
||||||
def lockItems(self):
|
|
||||||
for tab in self.tabButtons:
|
|
||||||
self.tabButtons[tab].lockItems()
|
|
||||||
|
|
||||||
def updateItems(self):
|
|
||||||
for tab in self.tabButtons:
|
|
||||||
self.tabButtons[tab].updateItems(self.gifting)
|
|
|
@ -45,11 +45,12 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
|
||||||
def recordPurchase(self, avatar, optional):
|
def recordPurchase(self, avatar, optional):
|
||||||
if avatar:
|
if avatar:
|
||||||
avatar.addGardenItem(self.gardenIndex, self.numItems)
|
avatar.addGardenItem(self.gardenIndex, self.numItems)
|
||||||
return ToontownGlobals.P_ItemAvailable
|
if 1:
|
||||||
|
return ToontownGlobals.P_ItemAvailable
|
||||||
|
|
||||||
def getPicture(self, avatar):
|
def getPicture(self, avatar):
|
||||||
photoModel = GardenGlobals.Specials[self.gardenIndex]['photoModel']
|
photoModel = GardenGlobals.Specials[self.gardenIndex]['photoModel']
|
||||||
if 'photoAnimation' in GardenGlobals.Specials[self.gardenIndex]:
|
if GardenGlobals.Specials[self.gardenIndex].has_key('photoAnimation'):
|
||||||
modelPath = photoModel + GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][0]
|
modelPath = photoModel + GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][0]
|
||||||
animationName = GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][1]
|
animationName = GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][1]
|
||||||
animationPath = photoModel + animationName
|
animationPath = photoModel + animationName
|
||||||
|
@ -122,6 +123,12 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
|
||||||
def getRequestPurchaseErrorTextTimeout(self):
|
def getRequestPurchaseErrorTextTimeout(self):
|
||||||
return 20
|
return 20
|
||||||
|
|
||||||
|
def getDeliveryTime(self):
|
||||||
|
if self.gardenIndex == GardenGlobals.GardenAcceleratorSpecial:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def getPurchaseLimit(self):
|
def getPurchaseLimit(self):
|
||||||
if self.gardenIndex == GardenGlobals.GardenAcceleratorSpecial:
|
if self.gardenIndex == GardenGlobals.GardenAcceleratorSpecial:
|
||||||
return 1
|
return 1
|
||||||
|
@ -153,7 +160,7 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
|
||||||
result = False
|
result = False
|
||||||
if canPlant < numBeansRequired:
|
if canPlant < numBeansRequired:
|
||||||
result = True
|
result = True
|
||||||
if not result and self.gardenIndex in GardenGlobals.Specials and 'minSkill' in GardenGlobals.Specials[self.gardenIndex]:
|
if not result and GardenGlobals.Specials.has_key(self.gardenIndex) and GardenGlobals.Specials[self.gardenIndex].has_key('minSkill'):
|
||||||
minSkill = GardenGlobals.Specials[self.gardenIndex]['minSkill']
|
minSkill = GardenGlobals.Specials[self.gardenIndex]['minSkill']
|
||||||
if avatar.shovelSkill < minSkill:
|
if avatar.shovelSkill < minSkill:
|
||||||
result = True
|
result = True
|
||||||
|
|
|
@ -30,10 +30,13 @@ class CatalogGardenStarterItem(CatalogItem.CatalogItem):
|
||||||
return TTLocalizer.GardenStarterTypeName
|
return TTLocalizer.GardenStarterTypeName
|
||||||
|
|
||||||
def recordPurchase(self, avatar, optional):
|
def recordPurchase(self, avatar, optional):
|
||||||
|
print 'rental-- record purchase'
|
||||||
if avatar:
|
if avatar:
|
||||||
estate = simbase.air.estateManager._lookupEstate(avatar.doId)
|
print 'starter garden-- has avater'
|
||||||
|
estate = simbase.air.estateManager.toon2estate.get(avatar)
|
||||||
if estate:
|
if estate:
|
||||||
estate.placeStarterGarden(avatar.doId)
|
print 'starter garden-- has estate'
|
||||||
|
estate.placeStarterGarden(avatar)
|
||||||
else:
|
else:
|
||||||
print 'starter garden-- something not there'
|
print 'starter garden-- something not there'
|
||||||
return ToontownGlobals.P_ItemAvailable
|
return ToontownGlobals.P_ItemAvailable
|
||||||
|
@ -70,6 +73,9 @@ class CatalogGardenStarterItem(CatalogItem.CatalogItem):
|
||||||
def encodeDatagram(self, dg, store):
|
def encodeDatagram(self, dg, store):
|
||||||
CatalogItem.CatalogItem.encodeDatagram(self, dg, store)
|
CatalogItem.CatalogItem.encodeDatagram(self, dg, store)
|
||||||
|
|
||||||
|
def getDeliveryTime(self):
|
||||||
|
return 1
|
||||||
|
|
||||||
def isRental(self):
|
def isRental(self):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
import CatalogItem
|
import CatalogItem
|
||||||
import CatalogItemList
|
import CatalogItemList
|
||||||
from CatalogFurnitureItem import CatalogFurnitureItem, nextAvailableCloset, getAllClosets, get50ItemCloset, getMaxClosets, get50ItemTrunk
|
from CatalogFurnitureItem import CatalogFurnitureItem, nextAvailableCloset, getAllClosets, get50ItemCloset, getMaxClosets, get50ItemTrunk
|
||||||
|
@ -39,20 +40,25 @@ MetaItems = {100: getAllClothes(101, 102, 103, 104, 105, 106, 107, 108, 109, 109
|
||||||
2921: getChatRange(12050, 12099),
|
2921: getChatRange(12050, 12099),
|
||||||
2930: getChatRange(13000, 13099),
|
2930: getChatRange(13000, 13099),
|
||||||
2940: getChatRange(14000, 14099),
|
2940: getChatRange(14000, 14099),
|
||||||
|
|
||||||
3000: getWallpapers(1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100),
|
3000: getWallpapers(1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100),
|
||||||
3010: getWallpapers(2200, 2300, 2400, 2500, 2600, 2700, 2800),
|
3010: getWallpapers(2200, 2300, 2400, 2500, 2600, 2700, 2800),
|
||||||
3020: getWallpapers(2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600),
|
3020: getWallpapers(2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600),
|
||||||
3030: getWallpapers(3700, 3800, 3900),
|
3030: getWallpapers(3700, 3800, 3900),
|
||||||
|
|
||||||
3500: getAllWainscotings(1000, 1010),
|
3500: getAllWainscotings(1000, 1010),
|
||||||
3510: getAllWainscotings(1020),
|
3510: getAllWainscotings(1020),
|
||||||
3520: getAllWainscotings(1030),
|
3520: getAllWainscotings(1030),
|
||||||
3530: getAllWainscotings(1040),
|
3530: getAllWainscotings(1040),
|
||||||
|
|
||||||
4000: getFloorings(1000, 1010, 1020, 1030, 1040, 1050, 1060, 1070, 1080, 1090, 1100),
|
4000: getFloorings(1000, 1010, 1020, 1030, 1040, 1050, 1060, 1070, 1080, 1090, 1100),
|
||||||
4010: getFloorings(1110, 1120, 1130),
|
4010: getFloorings(1110, 1120, 1130),
|
||||||
4020: getFloorings(1140, 1150, 1160, 1170, 1180, 1190),
|
4020: getFloorings(1140, 1150, 1160, 1170, 1180, 1190),
|
||||||
|
|
||||||
4500: getAllMouldings(1000, 1010),
|
4500: getAllMouldings(1000, 1010),
|
||||||
4510: getAllMouldings(1020, 1030, 1040),
|
4510: getAllMouldings(1020, 1030, 1040),
|
||||||
4520: getAllMouldings(1070),
|
4520: getAllMouldings(1070),
|
||||||
|
|
||||||
5000: getAllPetTricks()}
|
5000: getAllPetTricks()}
|
||||||
MetaItemChatKeysSold = (2000,
|
MetaItemChatKeysSold = (2000,
|
||||||
2010,
|
2010,
|
||||||
|
@ -396,22 +402,34 @@ MonthlySchedule = ((7,
|
||||||
1,
|
1,
|
||||||
9,
|
9,
|
||||||
30,
|
30,
|
||||||
(CatalogGardenItem(135, 1),)),
|
(
|
||||||
|
# CatalogGardenItem(135, 1)
|
||||||
|
)
|
||||||
|
),
|
||||||
(1,
|
(1,
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
31,
|
31,
|
||||||
(CatalogGardenItem(135, 1),)),
|
(
|
||||||
|
# CatalogGardenItem(135, 1)
|
||||||
|
)
|
||||||
|
),
|
||||||
(4,
|
(4,
|
||||||
1,
|
1,
|
||||||
4,
|
4,
|
||||||
30,
|
30,
|
||||||
(CatalogGardenItem(135, 1),)),
|
(
|
||||||
|
# CatalogGardenItem(135, 1)
|
||||||
|
)
|
||||||
|
),
|
||||||
(6,
|
(6,
|
||||||
1,
|
1,
|
||||||
6,
|
6,
|
||||||
30,
|
30,
|
||||||
(CatalogGardenItem(135, 1),)),
|
(
|
||||||
|
# CatalogGardenItem(135, 1)
|
||||||
|
)
|
||||||
|
),
|
||||||
(6,
|
(6,
|
||||||
26,
|
26,
|
||||||
7,
|
7,
|
||||||
|
@ -431,8 +449,8 @@ MonthlySchedule = ((7,
|
||||||
4,
|
4,
|
||||||
(CatalogFurnitureItem(680),
|
(CatalogFurnitureItem(680),
|
||||||
CatalogFurnitureItem(681),
|
CatalogFurnitureItem(681),
|
||||||
CatalogGardenItem(130, 1),
|
# CatalogGardenItem(130, 1),
|
||||||
CatalogGardenItem(131, 1),
|
# CatalogGardenItem(131, 1),
|
||||||
CatalogAnimatedFurnitureItem(10020),
|
CatalogAnimatedFurnitureItem(10020),
|
||||||
CatalogFurnitureItem(10030, 0))),
|
CatalogFurnitureItem(10030, 0))),
|
||||||
(12,
|
(12,
|
||||||
|
@ -506,29 +524,30 @@ MonthlySchedule = ((7,
|
||||||
1,
|
1,
|
||||||
12,
|
12,
|
||||||
31,
|
31,
|
||||||
(CatalogGardenItem(100, 1),
|
(
|
||||||
CatalogGardenItem(101, 1),
|
#CatalogGardenItem(100, 1), #GARDENS
|
||||||
CatalogGardenItem(103, 1),
|
#CatalogGardenItem(101, 1),
|
||||||
CatalogGardenItem(104, 1),
|
#CatalogGardenItem(103, 1),
|
||||||
|
#CatalogGardenItem(104, 1),
|
||||||
CatalogToonStatueItem(105, endPoseIndex=108),
|
CatalogToonStatueItem(105, endPoseIndex=108),
|
||||||
#CatalogRentalItem(1, 2880, 1000), # TODO
|
CatalogRentalItem(1, 2880, 1000),
|
||||||
CatalogGardenStarterItem(), # TODO
|
#CatalogGardenStarterItem(), # We don't want Gardens yet.
|
||||||
CatalogNametagItem(100),
|
CatalogNametagItem(100),
|
||||||
CatalogNametagItem(0),
|
CatalogNametagItem(0),
|
||||||
CatalogClothingItem(1608, 0, 0),
|
CatalogClothingItem(1608, 0, 90),
|
||||||
CatalogClothingItem(1605, 0, 0),
|
CatalogClothingItem(1605, 0, 90),
|
||||||
CatalogClothingItem(1602, 0, 0),
|
CatalogClothingItem(1602, 0, 90),
|
||||||
CatalogClothingItem(1607, 0, 0),
|
CatalogClothingItem(1607, 0, 60),
|
||||||
CatalogClothingItem(1604, 0, 0),
|
CatalogClothingItem(1604, 0, 60),
|
||||||
CatalogClothingItem(1601, 0, 0),
|
CatalogClothingItem(1601, 0, 60),
|
||||||
CatalogClothingItem(1606, 0, 0),
|
CatalogClothingItem(1606, 0, 30),
|
||||||
CatalogClothingItem(1603, 0, 0),
|
CatalogClothingItem(1603, 0, 30),
|
||||||
CatalogClothingItem(1600, 0, 0),
|
CatalogClothingItem(1600, 0, 30),
|
||||||
CatalogEmoteItem(20, 0),
|
CatalogEmoteItem(20, 30),
|
||||||
CatalogEmoteItem(21, 0),
|
CatalogEmoteItem(21, 45),
|
||||||
CatalogEmoteItem(22, 0),
|
CatalogEmoteItem(22, 60),
|
||||||
CatalogEmoteItem(23, 0),
|
CatalogEmoteItem(23, 75),
|
||||||
CatalogEmoteItem(24, 0))),
|
CatalogEmoteItem(24, 90))),
|
||||||
(5,
|
(5,
|
||||||
26,
|
26,
|
||||||
6,
|
6,
|
||||||
|
@ -596,8 +615,8 @@ MonthlySchedule = ((7,
|
||||||
((3, 2910),
|
((3, 2910),
|
||||||
CatalogFurnitureItem(680),
|
CatalogFurnitureItem(680),
|
||||||
CatalogFurnitureItem(681),
|
CatalogFurnitureItem(681),
|
||||||
CatalogGardenItem(130, 1),
|
#CatalogGardenItem(130, 1), #MORE GARDEN STUFF
|
||||||
CatalogGardenItem(131, 1),
|
#CatalogGardenItem(131, 1),
|
||||||
CatalogAnimatedFurnitureItem(10020),
|
CatalogAnimatedFurnitureItem(10020),
|
||||||
CatalogFurnitureItem(10030, 0),
|
CatalogFurnitureItem(10030, 0),
|
||||||
CatalogWallpaperItem(11000),
|
CatalogWallpaperItem(11000),
|
||||||
|
@ -1481,7 +1500,7 @@ WeeklySchedule = ((100,
|
||||||
nextAvailablePole))
|
nextAvailablePole))
|
||||||
|
|
||||||
class CatalogGenerator:
|
class CatalogGenerator:
|
||||||
notify = directNotify.newCategory('CatalogGenerator')
|
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogGenerator')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__itemLists = {}
|
self.__itemLists = {}
|
||||||
|
@ -1541,7 +1560,7 @@ class CatalogGenerator:
|
||||||
lastBackCatalog = avatar.backCatalog[:]
|
lastBackCatalog = avatar.backCatalog[:]
|
||||||
thisWeek = min(len(WeeklySchedule), week - 1)
|
thisWeek = min(len(WeeklySchedule), week - 1)
|
||||||
lastWeek = min(len(WeeklySchedule), previousWeek)
|
lastWeek = min(len(WeeklySchedule), previousWeek)
|
||||||
for week in xrange(thisWeek, lastWeek, -1):
|
for week in range(thisWeek, lastWeek, -1):
|
||||||
self.notify.debug('Adding items from week %s to back catalog' % week)
|
self.notify.debug('Adding items from week %s to back catalog' % week)
|
||||||
schedule = WeeklySchedule[week - 1]
|
schedule = WeeklySchedule[week - 1]
|
||||||
if not isinstance(schedule, Sale):
|
if not isinstance(schedule, Sale):
|
||||||
|
@ -1567,7 +1586,7 @@ class CatalogGenerator:
|
||||||
return itemLists
|
return itemLists
|
||||||
else:
|
else:
|
||||||
self.__releasedItemLists.clear()
|
self.__releasedItemLists.clear()
|
||||||
testDaysAhead = simbase.config.GetInt('test-server-holiday-days-ahead', 0)
|
testDaysAhead = config.GetInt('test-server-holiday-days-ahead', 0)
|
||||||
nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60)
|
nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60)
|
||||||
year = nowtuple[0]
|
year = nowtuple[0]
|
||||||
month = nowtuple[1]
|
month = nowtuple[1]
|
||||||
|
@ -1597,7 +1616,7 @@ class CatalogGenerator:
|
||||||
itemLists = self.__itemLists.get(dayNumber)
|
itemLists = self.__itemLists.get(dayNumber)
|
||||||
if itemLists != None:
|
if itemLists != None:
|
||||||
return itemLists
|
return itemLists
|
||||||
testDaysAhead = simbase.config.GetInt('test-server-holiday-days-ahead', 0)
|
testDaysAhead = config.GetInt('test-server-holiday-days-ahead', 0)
|
||||||
nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60)
|
nowtuple = time.localtime(weekStart * 60 + testDaysAhead * 24 * 60 * 60)
|
||||||
year = nowtuple[0]
|
year = nowtuple[0]
|
||||||
month = nowtuple[1]
|
month = nowtuple[1]
|
||||||
|
@ -1646,7 +1665,7 @@ class CatalogGenerator:
|
||||||
selection.append(item)
|
selection.append(item)
|
||||||
elif item != None:
|
elif item != None:
|
||||||
list = item[:]
|
list = item[:]
|
||||||
for i in xrange(chooseCount):
|
for i in range(chooseCount):
|
||||||
if len(list) == 0:
|
if len(list) == 0:
|
||||||
return selection
|
return selection
|
||||||
item = self.__chooseFromList(avatar, list, duplicateItems)
|
item = self.__chooseFromList(avatar, list, duplicateItems)
|
||||||
|
@ -1722,7 +1741,7 @@ class CatalogGenerator:
|
||||||
|
|
||||||
def generateScheduleDictionary(self):
|
def generateScheduleDictionary(self):
|
||||||
sched = {}
|
sched = {}
|
||||||
for index in xrange(len(WeeklySchedule)):
|
for index in range(len(WeeklySchedule)):
|
||||||
week = index + 1
|
week = index + 1
|
||||||
schedule = WeeklySchedule[index]
|
schedule = WeeklySchedule[index]
|
||||||
if isinstance(schedule, Sale):
|
if isinstance(schedule, Sale):
|
||||||
|
@ -1775,7 +1794,7 @@ class CatalogGenerator:
|
||||||
return
|
return
|
||||||
|
|
||||||
def __recordScheduleItem(self, sched, weekCode, maybeWeekCode, item):
|
def __recordScheduleItem(self, sched, weekCode, maybeWeekCode, item):
|
||||||
if item not in sched:
|
if not sched.has_key(item):
|
||||||
sched[item] = [[], []]
|
sched[item] = [[], []]
|
||||||
if weekCode != None:
|
if weekCode != None:
|
||||||
sched[item][0].append(weekCode)
|
sched[item][0].append(weekCode)
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
CatalogNodePath = loader.loadModel('phase_3/models/gui/catalog_gui')
|
|
||||||
CatalogBKGDScale = 0.60
|
|
||||||
ItemPageTextLoc = (-1.7, 0.0, 1.36)
|
|
||||||
ItemPageTextScale = 0.1
|
|
||||||
|
|
||||||
CatalogPropPos = [
|
|
||||||
(-1.3, 0.0, 0.8),
|
|
||||||
(-0.6, 0.0, 0.8),
|
|
||||||
(-1.3, 0.0, 0.1),
|
|
||||||
(-0.6, 0.0, 0.1),
|
|
||||||
(-1.3, 0.0, -0.6),
|
|
||||||
(-0.6, 0.0, -0.6),
|
|
||||||
(0.45, 0.0, 0.8),
|
|
||||||
(1.15, 0.0, 0.8),
|
|
||||||
(0.45, 0.0, 0.1),
|
|
||||||
(1.15, 0.0, 0.1),
|
|
||||||
(0.45, 0.0, -0.6),
|
|
||||||
(1.15, 0.0, -0.6)
|
|
||||||
]
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
from toontown.toonbase import TTLocalizer
|
from toontown.toonbase import TTLocalizer
|
||||||
from toontown.toonbase import ToontownGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
@ -6,8 +7,6 @@ from direct.distributed.PyDatagram import PyDatagram
|
||||||
from direct.distributed.PyDatagramIterator import PyDatagramIterator
|
from direct.distributed.PyDatagramIterator import PyDatagramIterator
|
||||||
import types
|
import types
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
CatalogReverseType = None
|
CatalogReverseType = None
|
||||||
CatalogItemVersion = 8
|
CatalogItemVersion = 8
|
||||||
CatalogBackorderMarkup = 1.2
|
CatalogBackorderMarkup = 1.2
|
||||||
|
@ -23,9 +22,8 @@ CatalogTypeBackorder = 2
|
||||||
CatalogTypeMonthly = 3
|
CatalogTypeMonthly = 3
|
||||||
CatalogTypeLoyalty = 4
|
CatalogTypeLoyalty = 4
|
||||||
|
|
||||||
|
|
||||||
class CatalogItem:
|
class CatalogItem:
|
||||||
notify = directNotify.newCategory('CatalogItem')
|
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogItem')
|
||||||
|
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
self.saleItem = 0
|
self.saleItem = 0
|
||||||
|
@ -130,10 +128,13 @@ class CatalogItem:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def setLoyaltyRequirement(self, days):
|
def setLoyaltyRequirement(self, days):
|
||||||
self.loyaltyDays = 0
|
self.loyaltyDays = days
|
||||||
|
|
||||||
def loyaltyRequirement(self):
|
def loyaltyRequirement(self):
|
||||||
return 0
|
if not hasattr(self, 'loyaltyDays'):
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return self.loyaltyDays
|
||||||
|
|
||||||
def getPrice(self, catalogType):
|
def getPrice(self, catalogType):
|
||||||
if catalogType == CatalogTypeBackorder:
|
if catalogType == CatalogTypeBackorder:
|
||||||
|
@ -153,7 +154,7 @@ class CatalogItem:
|
||||||
return int(self.getBasePrice() * CatalogSaleMarkdown)
|
return int(self.getBasePrice() * CatalogSaleMarkdown)
|
||||||
|
|
||||||
def getDeliveryTime(self):
|
def getDeliveryTime(self):
|
||||||
return 1
|
return 0
|
||||||
|
|
||||||
def getPicture(self, avatar):
|
def getPicture(self, avatar):
|
||||||
self.hasPicture = True
|
self.hasPicture = True
|
||||||
|
@ -208,6 +209,7 @@ class CatalogItem:
|
||||||
mailbox.acceptItem(self, index, callback)
|
mailbox.acceptItem(self, index, callback)
|
||||||
|
|
||||||
def discardItem(self, mailbox, index, callback):
|
def discardItem(self, mailbox, index, callback):
|
||||||
|
print 'Item discardItem'
|
||||||
mailbox.discardItem(self, index, callback)
|
mailbox.discardItem(self, index, callback)
|
||||||
|
|
||||||
def acceptItemCleanup(self):
|
def acceptItemCleanup(self):
|
||||||
|
@ -335,13 +337,13 @@ class CatalogItem:
|
||||||
tex = loader.loadTexture(color)
|
tex = loader.loadTexture(color)
|
||||||
tex.setMinfilter(Texture.FTLinearMipmapLinear)
|
tex.setMinfilter(Texture.FTLinearMipmapLinear)
|
||||||
tex.setMagfilter(Texture.FTLinear)
|
tex.setMagfilter(Texture.FTLinear)
|
||||||
for i in xrange(matches.getNumPaths()):
|
for i in range(matches.getNumPaths()):
|
||||||
matches.getPath(i).setTexture(tex, 1)
|
matches.getPath(i).setTexture(tex, 1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
needsAlpha = color[3] != 1
|
needsAlpha = color[3] != 1
|
||||||
color = VBase4(color[0], color[1], color[2], color[3])
|
color = VBase4(color[0], color[1], color[2], color[3])
|
||||||
for i in xrange(matches.getNumPaths()):
|
for i in range(matches.getNumPaths()):
|
||||||
matches.getPath(i).setColorScale(color, 1)
|
matches.getPath(i).setColorScale(color, 1)
|
||||||
if needsAlpha:
|
if needsAlpha:
|
||||||
matches.getPath(i).setTransparency(1)
|
matches.getPath(i).setTransparency(1)
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
from toontown.catalog.CatalogItemPage import CatalogItemPage
|
|
||||||
|
|
||||||
|
|
||||||
class CatalogItemListGUI:
|
|
||||||
def __init__(self, catalogGui):
|
|
||||||
self.catalogGui = catalogGui
|
|
||||||
self.items = {}
|
|
||||||
self.pages = []
|
|
||||||
|
|
||||||
def getPages(self):
|
|
||||||
return self.pages
|
|
||||||
|
|
||||||
def addItem(self, item, category):
|
|
||||||
if category not in self.items:
|
|
||||||
self.items[category] = []
|
|
||||||
if not item in self.items[category]:
|
|
||||||
self.items[category].append(item)
|
|
||||||
|
|
||||||
def generatePages(self):
|
|
||||||
for category in self.items.keys():
|
|
||||||
pageNum = 1
|
|
||||||
currPage = CatalogItemPage(self.catalogGui, category, pageNum)
|
|
||||||
for (x, item) in enumerate(self.items[category]):
|
|
||||||
if x % 12 == 0 and x != 0:
|
|
||||||
self.pages.append(currPage)
|
|
||||||
pageNum += 1
|
|
||||||
currPage = CatalogItemPage(self.catalogGui, category, pageNum)
|
|
||||||
currPage.addCatalogItem(item)
|
|
||||||
if not currPage in self.pages:
|
|
||||||
self.pages.append(currPage)
|
|
||||||
for page in self.pages:
|
|
||||||
page.generatePage()
|
|
||||||
return self.pages
|
|
|
@ -1,56 +0,0 @@
|
||||||
from pandac.PandaModules import NodePath, TextNode
|
|
||||||
from toontown.catalog import CatalogGlobals
|
|
||||||
from toontown.catalog.CatalogItemPanel import CatalogItemPanel
|
|
||||||
from toontown.toonbase import ToontownGlobals
|
|
||||||
|
|
||||||
|
|
||||||
class CatalogItemPage(NodePath):
|
|
||||||
def __init__(self, parent, category, pageNum):
|
|
||||||
NodePath.__init__(self, parent.attachNewNode(category))
|
|
||||||
|
|
||||||
self.parent = parent
|
|
||||||
self.pageNum = pageNum
|
|
||||||
self.category = category
|
|
||||||
self.catalogItems = []
|
|
||||||
self.itemFrames = []
|
|
||||||
self.textNode = None
|
|
||||||
|
|
||||||
def addCatalogItem(self, item):
|
|
||||||
if not item in self.catalogItems:
|
|
||||||
self.catalogItems.append(item)
|
|
||||||
|
|
||||||
def setCatalogItems(self, catalogItems):
|
|
||||||
self.catalogItems = catalogItems
|
|
||||||
|
|
||||||
def generatePage(self):
|
|
||||||
pageText = '%s - %s' % (self.category, self.pageNum)
|
|
||||||
self.textNode = TextNode(pageText)
|
|
||||||
self.textNode.setText(pageText)
|
|
||||||
self.textNode.setFont(ToontownGlobals.getInterfaceFont())
|
|
||||||
self.textNode = self.attachNewNode(self.textNode)
|
|
||||||
self.textNode.setPos(*CatalogGlobals.ItemPageTextLoc)
|
|
||||||
self.textNode.setScale(CatalogGlobals.ItemPageTextScale)
|
|
||||||
self.textNode.setColor(0, 0, 0, 1)
|
|
||||||
for (x, item) in enumerate(self.catalogItems):
|
|
||||||
itemFrame = CatalogItemPanel(parent=self, parentCatalogScreen=self.parent, item=item)
|
|
||||||
itemFrame.load()
|
|
||||||
itemFrame.setPos(*CatalogGlobals.CatalogPropPos[x])
|
|
||||||
self.itemFrames.append(itemFrame)
|
|
||||||
|
|
||||||
def lockItems(self):
|
|
||||||
for itemFrame in self.itemFrames:
|
|
||||||
itemFrame.lockItem()
|
|
||||||
|
|
||||||
def updateItems(self, gifting):
|
|
||||||
for itemFrame in self.itemFrames:
|
|
||||||
itemFrame.updateButtons(gifting)
|
|
||||||
|
|
||||||
def cleanup(self):
|
|
||||||
for item in self.catalogItems:
|
|
||||||
if hasattr(item, 'destroy'):
|
|
||||||
item.destroy()
|
|
||||||
|
|
||||||
for itemFrame in self.itemFrames:
|
|
||||||
itemFrame.destroy()
|
|
||||||
|
|
||||||
NodePath.removeNode(self)
|
|
|
@ -1,80 +0,0 @@
|
||||||
from CatalogFurnitureItem import CatalogFurnitureItem # Furniture
|
|
||||||
from CatalogChatItem import CatalogChatItem # Phrase
|
|
||||||
from CatalogClothingItem import CatalogClothingItem # Clothing
|
|
||||||
from CatalogEmoteItem import CatalogEmoteItem # Emotion
|
|
||||||
from CatalogWallpaperItem import CatalogWallpaperItem # Furniture
|
|
||||||
from CatalogWindowItem import CatalogWindowItem # Furniture
|
|
||||||
from CatalogFlooringItem import CatalogFlooringItem # Furniture
|
|
||||||
from CatalogMouldingItem import CatalogMouldingItem # Furniture
|
|
||||||
from CatalogWainscotingItem import CatalogWainscotingItem # Furniture
|
|
||||||
from CatalogPoleItem import CatalogPoleItem # Special
|
|
||||||
from CatalogPetTrickItem import CatalogPetTrickItem # Special
|
|
||||||
from CatalogBeanItem import CatalogBeanItem # Furniture
|
|
||||||
from CatalogGardenItem import CatalogGardenItem # Special
|
|
||||||
from CatalogRentalItem import CatalogRentalItem # Special
|
|
||||||
from CatalogGardenStarterItem import CatalogGardenStarterItem # Special
|
|
||||||
from CatalogNametagItem import CatalogNametagItem # Nametag
|
|
||||||
from CatalogToonStatueItem import CatalogToonStatueItem # Special
|
|
||||||
from CatalogAnimatedFurnitureItem import CatalogAnimatedFurnitureItem # Furniture
|
|
||||||
from CatalogAccessoryItem import CatalogAccessoryItem # Clothing
|
|
||||||
|
|
||||||
|
|
||||||
class CatalogItemSorter:
|
|
||||||
SPECIAL_ITEMS = (CatalogToonStatueItem, CatalogPoleItem, CatalogGardenStarterItem,
|
|
||||||
CatalogGardenItem, CatalogRentalItem, CatalogPetTrickItem)
|
|
||||||
NAMETAG_ITEMS = (CatalogNametagItem,)
|
|
||||||
PHRASE_ITEMS = (CatalogChatItem,)
|
|
||||||
CLOTHING_ITEMS = (CatalogAccessoryItem, CatalogClothingItem)
|
|
||||||
EMOTION_ITEMS = (CatalogEmoteItem,)
|
|
||||||
FURNITURE_ITEMS = (CatalogFurnitureItem, CatalogWallpaperItem, CatalogWindowItem,
|
|
||||||
CatalogFlooringItem, CatalogMouldingItem, CatalogWainscotingItem,
|
|
||||||
CatalogBeanItem, CatalogAnimatedFurnitureItem)
|
|
||||||
|
|
||||||
def __init__(self, itemList):
|
|
||||||
self.itemList = itemList
|
|
||||||
|
|
||||||
self.sortedItems = {
|
|
||||||
'UNSORTED': [],
|
|
||||||
'SPECIAL': [],
|
|
||||||
'CLOTHING': [],
|
|
||||||
'PHRASES': [],
|
|
||||||
'EMOTIONS': [],
|
|
||||||
'FURNITURE': [],
|
|
||||||
'NAMETAG': []
|
|
||||||
}
|
|
||||||
|
|
||||||
def sortItems(self):
|
|
||||||
for item in self.itemList:
|
|
||||||
if self.__isSpecial(item):
|
|
||||||
self.sortedItems['SPECIAL'].append(item)
|
|
||||||
elif self.__isNametag(item):
|
|
||||||
self.sortedItems['NAMETAG'].append(item)
|
|
||||||
elif self.__isClothing(item):
|
|
||||||
self.sortedItems['CLOTHING'].append(item)
|
|
||||||
elif self.__isPhrase(item):
|
|
||||||
self.sortedItems['PHRASES'].append(item)
|
|
||||||
elif self.__isEmotion(item):
|
|
||||||
self.sortedItems['EMOTIONS'].append(item)
|
|
||||||
elif self.__isFurniture(item):
|
|
||||||
self.sortedItems['FURNITURE'].append(item)
|
|
||||||
else:
|
|
||||||
self.sortedItems['UNSORTED'].append(item)
|
|
||||||
return self.sortedItems
|
|
||||||
|
|
||||||
def __isSpecial(self, item):
|
|
||||||
return isinstance(item, CatalogItemSorter.SPECIAL_ITEMS)
|
|
||||||
|
|
||||||
def __isClothing(self, item):
|
|
||||||
return isinstance(item, CatalogItemSorter.CLOTHING_ITEMS)
|
|
||||||
|
|
||||||
def __isPhrase(self, item):
|
|
||||||
return isinstance(item, CatalogItemSorter.PHRASE_ITEMS)
|
|
||||||
|
|
||||||
def __isNametag(self, item):
|
|
||||||
return isinstance(item, CatalogItemSorter.NAMETAG_ITEMS)
|
|
||||||
|
|
||||||
def __isEmotion(self, item):
|
|
||||||
return isinstance(item, CatalogItemSorter.EMOTION_ITEMS)
|
|
||||||
|
|
||||||
def __isFurniture(self, item):
|
|
||||||
return isinstance(item, CatalogItemSorter.FURNITURE_ITEMS)
|
|
|
@ -1,39 +1,31 @@
|
||||||
from direct.distributed.DistributedObject import DistributedObject
|
from direct.distributed import DistributedObject
|
||||||
from toontown.catalog.CatalogItemList import CatalogItemList
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
import time
|
|
||||||
|
|
||||||
|
class CatalogManager(DistributedObject.DistributedObject):
|
||||||
class CatalogManager(DistributedObject):
|
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogManager')
|
||||||
notify = directNotify.newCategory('CatalogManager')
|
|
||||||
neverDisable = 1
|
neverDisable = 1
|
||||||
|
|
||||||
def __init__(self, cr):
|
def __init__(self, cr):
|
||||||
DistributedObject.__init__(self, cr)
|
DistributedObject.DistributedObject.__init__(self, cr)
|
||||||
|
|
||||||
self.popularItems = None
|
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
if base.cr.catalogManager != None:
|
if base.cr.catalogManager != None:
|
||||||
base.cr.catalogManager.delete()
|
base.cr.catalogManager.delete()
|
||||||
base.cr.catalogManager = self
|
base.cr.catalogManager = self
|
||||||
DistributedObject.generate(self)
|
DistributedObject.DistributedObject.generate(self)
|
||||||
if hasattr(base.localAvatar, 'catalogScheduleNextTime') and base.localAvatar.catalogScheduleNextTime == 0:
|
if hasattr(base.localAvatar, 'catalogScheduleNextTime') and base.localAvatar.catalogScheduleNextTime == 0:
|
||||||
self.d_startCatalog()
|
self.d_startCatalog()
|
||||||
|
return
|
||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
base.cr.catalogManager = None
|
base.cr.catalogManager = None
|
||||||
DistributedObject.disable(self)
|
DistributedObject.DistributedObject.disable(self)
|
||||||
|
return
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
base.cr.catalogManager = None
|
base.cr.catalogManager = None
|
||||||
DistributedObject.delete(self)
|
DistributedObject.DistributedObject.delete(self)
|
||||||
|
return
|
||||||
|
|
||||||
def d_startCatalog(self):
|
def d_startCatalog(self):
|
||||||
self.sendUpdate('startCatalog')
|
self.sendUpdate('startCatalog', [])
|
||||||
|
|
||||||
def fetchPopularItems(self):
|
|
||||||
self.sendUpdate('fetchPopularItems')
|
|
||||||
|
|
||||||
def setPopularItems(self, popularItems):
|
|
||||||
self.popularItems = CatalogItemList(popularItems)
|
|
||||||
messenger.send('PopularItemsSet')
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
from CatalogGenerator import CatalogGenerator
|
from CatalogGenerator import CatalogGenerator
|
||||||
from toontown.toonbase import ToontownGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
class CatalogManagerAI(DistributedObjectAI):
|
class CatalogManagerAI(DistributedObjectAI):
|
||||||
notify = directNotify.newCategory('CatalogManagerAI')
|
notify = DirectNotifyGlobal.directNotify.newCategory("CatalogManagerAI")
|
||||||
|
|
||||||
def __init__(self, air):
|
def __init__(self, air):
|
||||||
DistributedObjectAI.__init__(self, air)
|
DistributedObjectAI.__init__(self, air)
|
||||||
|
@ -13,9 +13,6 @@ class CatalogManagerAI(DistributedObjectAI):
|
||||||
|
|
||||||
def startCatalog(self):
|
def startCatalog(self):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
avId = self.air.getAvatarIdFromSender()
|
||||||
self.acceptOnce('generate-%s' % avId, self.deliverCatalog)
|
|
||||||
|
|
||||||
def deliverCatalog(self, avId):
|
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
if av:
|
if av:
|
||||||
self.deliverCatalogFor(av)
|
self.deliverCatalogFor(av)
|
||||||
|
@ -29,7 +26,6 @@ class CatalogManagerAI(DistributedObjectAI):
|
||||||
av.b_setCatalogSchedule(newWeek, int((time.time() + 604800)/60))
|
av.b_setCatalogSchedule(newWeek, int((time.time() + 604800)/60))
|
||||||
av.b_setCatalogNotify(ToontownGlobals.NewItems, av.mailboxNotify)
|
av.b_setCatalogNotify(ToontownGlobals.NewItems, av.mailboxNotify)
|
||||||
|
|
||||||
def fetchPopularItems(self):
|
def isItemReleased(self, accessory):
|
||||||
avId = self.air.getAvatarIdFromSender()
|
return 1
|
||||||
popularItems = self.air.popularItemManager.requestPopularItems()
|
|
||||||
self.sendUpdateToAvatarId(avId, 'setPopularItems', [popularItems])
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ def getAllMouldings(*indexList):
|
||||||
for index in indexList:
|
for index in indexList:
|
||||||
colors = MouldingTypes[index][MTColor]
|
colors = MouldingTypes[index][MTColor]
|
||||||
if colors:
|
if colors:
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogMouldingItem(index, n))
|
list.append(CatalogMouldingItem(index, n))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -143,7 +143,7 @@ def getMouldingRange(fromIndex, toIndex, *otherRanges):
|
||||||
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
||||||
colors = MouldingTypes[patternIndex][MTColor]
|
colors = MouldingTypes[patternIndex][MTColor]
|
||||||
if colors:
|
if colors:
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogMouldingItem(patternIndex, n))
|
list.append(CatalogMouldingItem(patternIndex, n))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -40,6 +40,9 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
|
||||||
def isGift(self):
|
def isGift(self):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def getDeliveryTime(self):
|
||||||
|
return 1
|
||||||
|
|
||||||
def getPicture(self, avatar):
|
def getPicture(self, avatar):
|
||||||
rodPath = FishGlobals.RodFileDict.get(self.rodId)
|
rodPath = FishGlobals.RodFileDict.get(self.rodId)
|
||||||
pole = Actor.Actor(rodPath, {'cast': 'phase_4/models/props/fishing-pole-chan'})
|
pole = Actor.Actor(rodPath, {'cast': 'phase_4/models/props/fishing-pole-chan'})
|
||||||
|
@ -103,7 +106,7 @@ def nextAvailablePole(avatar, duplicateItems):
|
||||||
|
|
||||||
def getAllPoles():
|
def getAllPoles():
|
||||||
list = []
|
list = []
|
||||||
for rodId in xrange(0, FishGlobals.MaxRodId + 1):
|
for rodId in range(0, FishGlobals.MaxRodId + 1):
|
||||||
list.append(CatalogPoleItem(rodId))
|
list.append(CatalogPoleItem(rodId))
|
||||||
|
|
||||||
return list
|
return list
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
from pandac.PandaModules import NodePath
|
|
||||||
from direct.gui.DirectButton import DirectButton
|
|
||||||
from toontown.catalog import CatalogGlobals
|
|
||||||
|
|
||||||
|
|
||||||
class CatalogRadioButton(NodePath):
|
|
||||||
def __init__(self, parent, nodeName, clickEvent):
|
|
||||||
NodePath.__init__(self, parent.attachNewNode(nodeName))
|
|
||||||
|
|
||||||
self.radioButtons = []
|
|
||||||
self.clickEvent = clickEvent
|
|
||||||
|
|
||||||
self.normalNode = CatalogGlobals.CatalogNodePath.find('**/'+nodeName+'_UP').copyTo(self)
|
|
||||||
self.clickedNode = CatalogGlobals.CatalogNodePath.find('**/'+nodeName+'_DN').copyTo(self)
|
|
||||||
self.hoverNode = CatalogGlobals.CatalogNodePath.find('**/'+nodeName+'_OVR').copyTo(self)
|
|
||||||
|
|
||||||
self.statusIndicator = CatalogGlobals.CatalogNodePath.find('**/'+nodeName+'Radio_ON').copyTo(self)
|
|
||||||
self.statusIndicator.hide()
|
|
||||||
|
|
||||||
self.radioButton = DirectButton(parent=self, relief=None, image=(self.normalNode, self.clickedNode, self.hoverNode), command=self.enable)
|
|
||||||
|
|
||||||
def setOthers(self, radioButtons):
|
|
||||||
self.radioButtons = radioButtons
|
|
||||||
|
|
||||||
def enable(self):
|
|
||||||
for radioButton in self.radioButtons:
|
|
||||||
radioButton.disable()
|
|
||||||
|
|
||||||
self.statusIndicator.show()
|
|
||||||
self.clickEvent()
|
|
||||||
|
|
||||||
def disable(self):
|
|
||||||
self.statusIndicator.hide()
|
|
||||||
|
|
||||||
def cleanup(self):
|
|
||||||
self.radioButton.destroy()
|
|
||||||
|
|
||||||
NodePath.removeNode(self)
|
|
|
@ -1,23 +1,21 @@
|
||||||
from direct.actor import Actor
|
from pandac.PandaModules import *
|
||||||
from direct.gui.DirectGui import *
|
from direct.gui.DirectGui import *
|
||||||
|
from pandac.PandaModules import *
|
||||||
from direct.gui.DirectScrolledList import *
|
from direct.gui.DirectScrolledList import *
|
||||||
from pandac.PandaModules import *
|
|
||||||
from pandac.PandaModules import *
|
|
||||||
import random
|
|
||||||
|
|
||||||
import CatalogFurnitureItem
|
|
||||||
import CatalogInvalidItem
|
|
||||||
import CatalogItem
|
|
||||||
import CatalogItemPanel
|
|
||||||
import CatalogItemTypes
|
|
||||||
from toontown.chat.ChatBalloon import ChatBalloon
|
|
||||||
from toontown.nametag import NametagGlobals
|
|
||||||
from toontown.nametag import NametagGroup
|
|
||||||
from toontown.toon import DistributedToon
|
|
||||||
from toontown.toonbase import TTLocalizer
|
|
||||||
from toontown.toonbase import ToontownGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
from toontown.toontowngui import TTDialog
|
from toontown.toontowngui import TTDialog
|
||||||
|
import CatalogItem
|
||||||
|
import CatalogInvalidItem
|
||||||
|
import CatalogFurnitureItem
|
||||||
|
from toontown.toonbase import TTLocalizer
|
||||||
|
import CatalogItemPanel
|
||||||
|
import CatalogItemTypes
|
||||||
|
from direct.actor import Actor
|
||||||
|
import random
|
||||||
|
from toontown.toon import DistributedToon
|
||||||
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
from toontown.nametag import NametagGlobals
|
||||||
|
import CatalogChatBalloon
|
||||||
|
|
||||||
NUM_CATALOG_ROWS = 3
|
NUM_CATALOG_ROWS = 3
|
||||||
NUM_CATALOG_COLS = 2
|
NUM_CATALOG_COLS = 2
|
||||||
|
@ -30,7 +28,7 @@ CatalogPanelColors = {CatalogItemTypes.FURNITURE_ITEM: Vec4(0.733, 0.78, 0.933,
|
||||||
CatalogItemTypes.WINDOW_ITEM: Vec4(0.827, 0.91, 0.659, 1.0)}
|
CatalogItemTypes.WINDOW_ITEM: Vec4(0.827, 0.91, 0.659, 1.0)}
|
||||||
|
|
||||||
class CatalogScreen(DirectFrame):
|
class CatalogScreen(DirectFrame):
|
||||||
notify = directNotify.newCategory('CatalogScreen')
|
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogScreen')
|
||||||
|
|
||||||
def __init__(self, parent = aspect2d, **kw):
|
def __init__(self, parent = aspect2d, **kw):
|
||||||
guiItems = loader.loadModel('phase_5.5/models/gui/catalog_gui')
|
guiItems = loader.loadModel('phase_5.5/models/gui/catalog_gui')
|
||||||
|
@ -80,11 +78,12 @@ class CatalogScreen(DirectFrame):
|
||||||
self.accept(localAvatar.uniqueName('emblemsChange'), self.__emblemChange)
|
self.accept(localAvatar.uniqueName('emblemsChange'), self.__emblemChange)
|
||||||
deliveryText = 'setDeliverySchedule-%s' % base.localAvatar.doId
|
deliveryText = 'setDeliverySchedule-%s' % base.localAvatar.doId
|
||||||
self.accept(deliveryText, self.remoteUpdate)
|
self.accept(deliveryText, self.remoteUpdate)
|
||||||
|
base.setBackgroundColor(Vec4(0.529, 0.290, 0.286, 1))
|
||||||
render.hide()
|
render.hide()
|
||||||
DirectFrame.show(self)
|
DirectFrame.show(self)
|
||||||
|
|
||||||
def clarabelleGreeting(task):
|
def clarabelleGreeting(task):
|
||||||
self.setClarabelleChat(TTLocalizer.CatalogGreeting)
|
self.setClarabelleChat(TTLocalizer.CatalogGreeting, type='greeting')
|
||||||
|
|
||||||
def clarabelleHelpText1(task):
|
def clarabelleHelpText1(task):
|
||||||
self.setClarabelleChat(TTLocalizer.CatalogHelpText1)
|
self.setClarabelleChat(TTLocalizer.CatalogHelpText1)
|
||||||
|
@ -108,6 +107,7 @@ class CatalogScreen(DirectFrame):
|
||||||
self.ignore(localAvatar.uniqueName('emblemsChange'))
|
self.ignore(localAvatar.uniqueName('emblemsChange'))
|
||||||
deliveryText = 'setDeliverySchedule-%s' % base.localAvatar.doId
|
deliveryText = 'setDeliverySchedule-%s' % base.localAvatar.doId
|
||||||
self.ignore(deliveryText)
|
self.ignore(deliveryText)
|
||||||
|
base.setBackgroundColor(ToontownGlobals.DefaultBackgroundColor)
|
||||||
render.show()
|
render.show()
|
||||||
DirectFrame.hide(self)
|
DirectFrame.hide(self)
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class CatalogScreen(DirectFrame):
|
||||||
self.emblemCatalogButton['state'] = DGG.DISABLED
|
self.emblemCatalogButton['state'] = DGG.DISABLED
|
||||||
|
|
||||||
def showNewItems(self, index = None):
|
def showNewItems(self, index = None):
|
||||||
if base.config.GetBool('want-qa-regression', 0):
|
if config.GetBool('want-qa-regression', 0):
|
||||||
self.notify.info('QA-REGRESSION: CATALOG: New item')
|
self.notify.info('QA-REGRESSION: CATALOG: New item')
|
||||||
taskMgr.remove('clarabelleHelpText1')
|
taskMgr.remove('clarabelleHelpText1')
|
||||||
messenger.send('wakeup')
|
messenger.send('wakeup')
|
||||||
|
@ -195,7 +195,7 @@ class CatalogScreen(DirectFrame):
|
||||||
return
|
return
|
||||||
|
|
||||||
def showBackorderItems(self, index = None):
|
def showBackorderItems(self, index = None):
|
||||||
if base.config.GetBool('want-qa-regression', 0):
|
if config.GetBool('want-qa-regression', 0):
|
||||||
self.notify.info('QA-REGRESSION: CATALOG: Backorder item')
|
self.notify.info('QA-REGRESSION: CATALOG: Backorder item')
|
||||||
taskMgr.remove('clarabelleHelpText1')
|
taskMgr.remove('clarabelleHelpText1')
|
||||||
messenger.send('wakeup')
|
messenger.send('wakeup')
|
||||||
|
@ -212,7 +212,7 @@ class CatalogScreen(DirectFrame):
|
||||||
return
|
return
|
||||||
|
|
||||||
def showLoyaltyItems(self, index = None):
|
def showLoyaltyItems(self, index = None):
|
||||||
if base.config.GetBool('want-qa-regression', 0):
|
if config.GetBool('want-qa-regression', 0):
|
||||||
self.notify.info('QA-REGRESSION: CATALOG: Special item')
|
self.notify.info('QA-REGRESSION: CATALOG: Special item')
|
||||||
taskMgr.remove('clarabelleHelpText1')
|
taskMgr.remove('clarabelleHelpText1')
|
||||||
messenger.send('wakeup')
|
messenger.send('wakeup')
|
||||||
|
@ -229,7 +229,7 @@ class CatalogScreen(DirectFrame):
|
||||||
return
|
return
|
||||||
|
|
||||||
def showEmblemItems(self, index = None):
|
def showEmblemItems(self, index = None):
|
||||||
if base.config.GetBool('want-qa-regression', 0):
|
if config.GetBool('want-qa-regression', 0):
|
||||||
self.notify.info('QA-REGRESSION: CATALOG: Emblem item')
|
self.notify.info('QA-REGRESSION: CATALOG: Emblem item')
|
||||||
taskMgr.remove('clarabelleHelpText1')
|
taskMgr.remove('clarabelleHelpText1')
|
||||||
messenger.send('wakeup')
|
messenger.send('wakeup')
|
||||||
|
@ -310,8 +310,8 @@ class CatalogScreen(DirectFrame):
|
||||||
pIndex = 0
|
pIndex = 0
|
||||||
randGen = random.Random()
|
randGen = random.Random()
|
||||||
randGen.seed(base.localAvatar.catalogScheduleCurrentWeek + (self.pageIndex << 8) + (newOrBackOrLoyalty << 16))
|
randGen.seed(base.localAvatar.catalogScheduleCurrentWeek + (self.pageIndex << 8) + (newOrBackOrLoyalty << 16))
|
||||||
for i in xrange(NUM_CATALOG_ROWS):
|
for i in range(NUM_CATALOG_ROWS):
|
||||||
for j in xrange(NUM_CATALOG_COLS):
|
for j in range(NUM_CATALOG_COLS):
|
||||||
if pIndex < len(self.visiblePanels):
|
if pIndex < len(self.visiblePanels):
|
||||||
type = self.visiblePanels[pIndex]['item'].getTypeCode()
|
type = self.visiblePanels[pIndex]['item'].getTypeCode()
|
||||||
self.squares[i][j].setColor(CatalogPanelColors.values()[randGen.randint(0, len(CatalogPanelColors) - 1)])
|
self.squares[i][j].setColor(CatalogPanelColors.values()[randGen.randint(0, len(CatalogPanelColors) - 1)])
|
||||||
|
@ -549,8 +549,9 @@ class CatalogScreen(DirectFrame):
|
||||||
self.emblemCatalogButton2.hide()
|
self.emblemCatalogButton2.hide()
|
||||||
self.__makeFFlist()
|
self.__makeFFlist()
|
||||||
if len(self.ffList) > 0:
|
if len(self.ffList) > 0:
|
||||||
self.giftToggle = DirectButton(self.base, relief=None, pressEffect=0, image=(giftToggleUp, giftToggleDown, giftToggleUp), image_scale=(1.0, 1, 0.7), command=self.__giftToggle, text=TTLocalizer.CatalogGiftToggleOff, text_font=ToontownGlobals.getSignFont(), text_pos=TTLocalizer.CSgiftTogglePos, text_scale=TTLocalizer.CSgiftToggle, text_fg=(0.353, 0.627, 0.627, 1.0), text3_fg=(0.15, 0.3, 0.3, 1.0), text2_fg=(0.353, 0.427, 0.427, 1.0), image_color=Vec4(1.0, 1.0, 0.2, 1.0), image1_color=Vec4(0.9, 0.85, 0.2, 1.0), image2_color=Vec4(0.9, 0.85, 0.2, 1.0), image3_color=Vec4(0.5, 0.45, 0.2, 1.0))
|
if config.GetBool('want-gifting', True):
|
||||||
self.giftToggle.setPos(0.0, 0, -0.035)
|
self.giftToggle = DirectButton(self.base, relief=None, pressEffect=0, image=(giftToggleUp, giftToggleDown, giftToggleUp), image_scale=(1.0, 1, 0.7), command=self.__giftToggle, text=TTLocalizer.CatalogGiftToggleOff, text_font=ToontownGlobals.getSignFont(), text_pos=TTLocalizer.CSgiftTogglePos, text_scale=TTLocalizer.CSgiftToggle, text_fg=(0.353, 0.627, 0.627, 1.0), text3_fg=(0.15, 0.3, 0.3, 1.0), text2_fg=(0.353, 0.427, 0.427, 1.0), image_color=Vec4(1.0, 1.0, 0.2, 1.0), image1_color=Vec4(0.9, 0.85, 0.2, 1.0), image2_color=Vec4(0.9, 0.85, 0.2, 1.0), image3_color=Vec4(0.5, 0.45, 0.2, 1.0))
|
||||||
|
self.giftToggle.setPos(0.0, 0, -0.035)
|
||||||
self.giftLabel = DirectLabel(self.base, relief=None, image=giftFriends, image_scale=(1.15, 1, 1.14), text=' ', text_font=ToontownGlobals.getSignFont(), text_pos=(1.2, -0.97), text_scale=0.07, text_fg=(0.392, 0.549, 0.627, 1.0), sortOrder=100, textMayChange=1)
|
self.giftLabel = DirectLabel(self.base, relief=None, image=giftFriends, image_scale=(1.15, 1, 1.14), text=' ', text_font=ToontownGlobals.getSignFont(), text_pos=(1.2, -0.97), text_scale=0.07, text_fg=(0.392, 0.549, 0.627, 1.0), sortOrder=100, textMayChange=1)
|
||||||
self.giftLabel.setPos(-0.15, 0, 0.08)
|
self.giftLabel.setPos(-0.15, 0, 0.08)
|
||||||
self.giftLabel.hide()
|
self.giftLabel.hide()
|
||||||
|
@ -577,7 +578,7 @@ class CatalogScreen(DirectFrame):
|
||||||
self.__chooseFriend(self.ffList[0][0], self.ffList[0][1])
|
self.__chooseFriend(self.ffList[0][0], self.ffList[0][1])
|
||||||
self.update()
|
self.update()
|
||||||
self.createdGiftGui = 1
|
self.createdGiftGui = 1
|
||||||
for i in xrange(4):
|
for i in range(4):
|
||||||
self.newCatalogButton.component('text%d' % i).setR(90)
|
self.newCatalogButton.component('text%d' % i).setR(90)
|
||||||
self.newCatalogButton2.component('text%d' % i).setR(90)
|
self.newCatalogButton2.component('text%d' % i).setR(90)
|
||||||
self.backCatalogButton.component('text%d' % i).setR(90)
|
self.backCatalogButton.component('text%d' % i).setR(90)
|
||||||
|
@ -591,8 +592,8 @@ class CatalogScreen(DirectFrame):
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
[]]
|
[]]
|
||||||
for i in xrange(NUM_CATALOG_ROWS):
|
for i in range(NUM_CATALOG_ROWS):
|
||||||
for j in xrange(NUM_CATALOG_COLS):
|
for j in range(NUM_CATALOG_COLS):
|
||||||
square = guiItems.find('**/square%d%db' % (i + 1, j + 1))
|
square = guiItems.find('**/square%d%db' % (i + 1, j + 1))
|
||||||
label = DirectLabel(self.base, image=square, relief=None, state='normal')
|
label = DirectLabel(self.base, image=square, relief=None, state='normal')
|
||||||
self.squares[i].append(label)
|
self.squares[i].append(label)
|
||||||
|
@ -688,7 +689,7 @@ class CatalogScreen(DirectFrame):
|
||||||
self.clarabelleFrame = DirectLabel(self, relief=None, image=guiItems.find('**/clarabelle_frame'))
|
self.clarabelleFrame = DirectLabel(self, relief=None, image=guiItems.find('**/clarabelle_frame'))
|
||||||
hangupGui = guiItems.find('**/hangup')
|
hangupGui = guiItems.find('**/hangup')
|
||||||
hangupRolloverGui = guiItems.find('**/hangup_rollover')
|
hangupRolloverGui = guiItems.find('**/hangup_rollover')
|
||||||
self.hangup = DirectButton(self, relief=None, pos=(1.78, 0, -1.3), image=[hangupGui,
|
self.hangup = DirectButton(base.a2dBottomRight, relief=None, pos=(-0.158, 0, 0.14), scale=(0.7, 0.7, 0.7), image=[hangupGui,
|
||||||
hangupRolloverGui,
|
hangupRolloverGui,
|
||||||
hangupRolloverGui,
|
hangupRolloverGui,
|
||||||
hangupGui], text=['', TTLocalizer.CatalogHangUp, TTLocalizer.CatalogHangUp], text_fg=Vec4(1), text_scale=0.07, text_pos=(0.0, 0.14), command=self.hangUp)
|
hangupGui], text=['', TTLocalizer.CatalogHangUp, TTLocalizer.CatalogHangUp], text_fg=Vec4(1), text_scale=0.07, text_pos=(0.0, 0.14), command=self.hangUp)
|
||||||
|
@ -723,7 +724,7 @@ class CatalogScreen(DirectFrame):
|
||||||
self.cCamNode.setLens(self.cLens)
|
self.cCamNode.setLens(self.cLens)
|
||||||
self.cCamNode.setScene(self.cRender)
|
self.cCamNode.setScene(self.cRender)
|
||||||
self.cCam = self.cCamera.attachNewNode(self.cCamNode)
|
self.cCam = self.cCamera.attachNewNode(self.cCamNode)
|
||||||
self.cDr = base.win.makeDisplayRegion(0.58, 0.82, 0.53, 0.85)
|
self.cDr = base.win.makeDisplayRegion(0.56, 0.81, 0.52, 0.85)
|
||||||
self.cDr.setSort(1)
|
self.cDr.setSort(1)
|
||||||
self.cDr.setClearDepthActive(1)
|
self.cDr.setClearDepthActive(1)
|
||||||
self.cDr.setClearColorActive(1)
|
self.cDr.setClearColorActive(1)
|
||||||
|
@ -738,10 +739,24 @@ class CatalogScreen(DirectFrame):
|
||||||
self.clarabelle.find('**/glassR').setBin('fixed', 2)
|
self.clarabelle.find('**/glassR').setBin('fixed', 2)
|
||||||
switchboard = loader.loadModel('phase_5.5/models/estate/switchboard')
|
switchboard = loader.loadModel('phase_5.5/models/estate/switchboard')
|
||||||
switchboard.reparentTo(self.clarabelle)
|
switchboard.reparentTo(self.clarabelle)
|
||||||
switchboard.setPos(0, -2, 0)
|
switchboard.setPos(1, -1.6, 0)
|
||||||
|
switchboard.setH(30)
|
||||||
|
room = loader.loadModel('phase_3/models/makeatoon/tt_m_ara_mat_room.bam')
|
||||||
|
room.reparentTo(self.clarabelle)
|
||||||
|
room.find('**/genderProps').removeNode()
|
||||||
|
room.find('**/bodyWalls').removeNode()
|
||||||
|
room.find('**/bodyProps').removeNode()
|
||||||
|
room.find('**/colorWalls').removeNode()
|
||||||
|
room.find('**/colorProps').removeNode()
|
||||||
|
room.find('**/clothWalls').removeNode()
|
||||||
|
room.find('**/nameWalls').removeNode()
|
||||||
|
room.find('**/nameProps').removeNode()
|
||||||
|
room.find('**/spotlight').removeNode()
|
||||||
|
room.setPos(5.5, 1.25, 0)
|
||||||
|
room.setH(330)
|
||||||
self.clarabelle.reparentTo(self.cRender)
|
self.clarabelle.reparentTo(self.cRender)
|
||||||
self.clarabelle.setPosHprScale(-0.56, 6.43, -3.81, 121.61, 0.0, 0.0, 1.0, 1.0, 1.0)
|
self.clarabelle.setPosHprScale(-0.52, 6.13, -3.81, 85, 0.0, 0.0, 1.0, 1.0, 1.0)
|
||||||
self.clarabelleFrame.setPosHprScale(-0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0)
|
self.clarabelleFrame.setPosHprScale(-0.01, 0.0, -0.01, 0.0, 0.0, 0.0, 1.02, 1.0, 1.02)
|
||||||
|
|
||||||
def reload(self):
|
def reload(self):
|
||||||
for panel in self.panelList + self.backPanelList + self.loyaltyPanelList + self.emblemPanelList:
|
for panel in self.panelList + self.backPanelList + self.loyaltyPanelList + self.emblemPanelList:
|
||||||
|
@ -809,6 +824,7 @@ class CatalogScreen(DirectFrame):
|
||||||
if self.giftAvatar:
|
if self.giftAvatar:
|
||||||
base.cr.cancelAvatarDetailsRequest(self.giftAvatar)
|
base.cr.cancelAvatarDetailsRequest(self.giftAvatar)
|
||||||
self.hide()
|
self.hide()
|
||||||
|
self.hangup.hide()
|
||||||
self.destroy()
|
self.destroy()
|
||||||
del self.base
|
del self.base
|
||||||
del self.squares
|
del self.squares
|
||||||
|
@ -860,10 +876,14 @@ class CatalogScreen(DirectFrame):
|
||||||
self.clarabelle.cleanup()
|
self.clarabelle.cleanup()
|
||||||
del self.clarabelle
|
del self.clarabelle
|
||||||
|
|
||||||
|
if self.clarabelleChatBalloon:
|
||||||
|
self.clarabelleChatBalloon.removeNode()
|
||||||
|
del self.clarabelleChatBalloon
|
||||||
|
|
||||||
def hangUp(self):
|
def hangUp(self):
|
||||||
if hasattr(self, 'giftAvatar') and self.giftAvatar:
|
if hasattr(self, 'giftAvatar') and self.giftAvatar:
|
||||||
self.giftAvatar.disable()
|
self.giftAvatar.disable()
|
||||||
self.setClarabelleChat(random.choice(TTLocalizer.CatalogGoodbyeList))
|
self.setClarabelleChat(random.choice(TTLocalizer.CatalogGoodbyeList), type='goodbye')
|
||||||
self.setPageIndex(-1)
|
self.setPageIndex(-1)
|
||||||
self.showPageItems()
|
self.showPageItems()
|
||||||
self.nextPageButton.hide()
|
self.nextPageButton.hide()
|
||||||
|
@ -934,15 +954,18 @@ class CatalogScreen(DirectFrame):
|
||||||
self.responseDialog = None
|
self.responseDialog = None
|
||||||
return
|
return
|
||||||
|
|
||||||
def setClarabelleChat(self, str, timeout = 6):
|
def setClarabelleChat(self, str, timeout = 6, type = None):
|
||||||
self.clearClarabelleChat()
|
self.clearClarabelleChat()
|
||||||
|
|
||||||
if not self.clarabelleChatBalloon:
|
if not self.clarabelleChatBalloon:
|
||||||
self.clarabelleChatBalloon = loader.loadModel('phase_3/models/props/chatbox.bam')
|
self.clarabelleChatBalloon = loader.loadModel('phase_3/models/props/chatbox')
|
||||||
self.clarabelleChat = ChatBalloon(self.clarabelleChatBalloon)
|
|
||||||
chatNode = self.clarabelleChat.generate(str, ToontownGlobals.getInterfaceFont())
|
self.clarabelleChat = CatalogChatBalloon.CatalogChatBalloon(self.clarabelleChatBalloon)
|
||||||
self.clarabelleChatNP = chatNode
|
chatNode = self.clarabelleChat.generate(str, ToontownGlobals.getInterfaceFont())[0]
|
||||||
|
self.clarabelleChatNP = self.attachNewNode(chatNode.node(), 1000)
|
||||||
self.clarabelleChatNP.setScale(0.08)
|
self.clarabelleChatNP.setScale(0.08)
|
||||||
self.clarabelleChatNP.setPos(0.7, 0, 0.6)
|
self.clarabelleChatNP.setPos(0.7, 0, 0.6)
|
||||||
|
|
||||||
if timeout:
|
if timeout:
|
||||||
taskMgr.doMethodLater(timeout, self.clearClarabelleChat, 'clearClarabelleChat')
|
taskMgr.doMethodLater(timeout, self.clearClarabelleChat, 'clearClarabelleChat')
|
||||||
|
|
||||||
|
@ -988,7 +1011,6 @@ class CatalogScreen(DirectFrame):
|
||||||
return test
|
return test
|
||||||
|
|
||||||
def __makeFFlist(self):
|
def __makeFFlist(self):
|
||||||
from toontown.nametag import NametagGroup
|
|
||||||
for familyMember in base.cr.avList:
|
for familyMember in base.cr.avList:
|
||||||
if familyMember.id != base.localAvatar.doId:
|
if familyMember.id != base.localAvatar.doId:
|
||||||
newFF = (familyMember.id, familyMember.name, NametagGlobals.CCNonPlayer)
|
newFF = (familyMember.id, familyMember.name, NametagGlobals.CCNonPlayer)
|
||||||
|
@ -1034,9 +1056,20 @@ class CatalogScreen(DirectFrame):
|
||||||
self.scrollList.refresh()
|
self.scrollList.refresh()
|
||||||
|
|
||||||
def makeFamilyButton(self, familyId, familyName, colorCode):
|
def makeFamilyButton(self, familyId, familyName, colorCode):
|
||||||
from toontown.nametag import NametagGlobals
|
# fg = NametagGlobals.getNameFg(colorCode, PGButton.SInactive)
|
||||||
fg = NametagGlobals.NametagColors.get(colorCode)[3][0]
|
return DirectButton(
|
||||||
return DirectButton(relief=None, text=familyName, text_scale=0.04, text_align=TextNode.ALeft, text_fg=fg, text1_bg=self.textDownColor, text2_bg=self.textRolloverColor, text3_fg=self.textDisabledColor, textMayChange=0, command=self.__chooseFriend, extraArgs=[familyId, familyName])
|
relief=None,
|
||||||
|
text=familyName,
|
||||||
|
text_scale=0.04,
|
||||||
|
text_align=TextNode.ALeft,
|
||||||
|
# text_fg=fg,
|
||||||
|
text1_bg=self.textDownColor,
|
||||||
|
text2_bg=self.textRolloverColor,
|
||||||
|
text3_fg=self.textDisabledColor,
|
||||||
|
textMayChange=0,
|
||||||
|
command=self.__chooseFriend,
|
||||||
|
extraArgs=[familyId, familyName]
|
||||||
|
)
|
||||||
|
|
||||||
def __chooseFriend(self, friendId, friendName):
|
def __chooseFriend(self, friendId, friendName):
|
||||||
messenger.send('wakeup')
|
messenger.send('wakeup')
|
||||||
|
|
|
@ -3,16 +3,17 @@ import CatalogAtticItem
|
||||||
from toontown.toonbase import ToontownGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
from toontown.toonbase import TTLocalizer
|
from toontown.toonbase import TTLocalizer
|
||||||
from CatalogSurfaceColors import *
|
from CatalogSurfaceColors import *
|
||||||
|
|
||||||
|
|
||||||
STWallpaper = 0
|
STWallpaper = 0
|
||||||
STMoulding = 1
|
STMoulding = 1
|
||||||
STFlooring = 2
|
STFlooring = 2
|
||||||
STWainscoting = 3
|
STWainscoting = 3
|
||||||
NUM_ST_TYPES = 4
|
NUM_ST_TYPES = 4
|
||||||
|
|
||||||
|
|
||||||
class CatalogSurfaceItem(CatalogAtticItem.CatalogAtticItem):
|
class CatalogSurfaceItem(CatalogAtticItem.CatalogAtticItem):
|
||||||
|
|
||||||
|
def makeNewItem(self):
|
||||||
|
CatalogAtticItem.CatalogAtticItem.makeNewItem(self)
|
||||||
|
|
||||||
def setPatternIndex(self, patternIndex):
|
def setPatternIndex(self, patternIndex):
|
||||||
self.patternIndex = patternIndex
|
self.patternIndex = patternIndex
|
||||||
|
|
||||||
|
@ -28,3 +29,7 @@ class CatalogSurfaceItem(CatalogAtticItem.CatalogAtticItem):
|
||||||
if retcode >= 0:
|
if retcode >= 0:
|
||||||
house.addWallpaper(self)
|
house.addWallpaper(self)
|
||||||
return retcode
|
return retcode
|
||||||
|
|
||||||
|
def getDeliveryTime(self):
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
from pandac.PandaModules import NodePath
|
|
||||||
from direct.gui.DirectButton import DirectButton
|
|
||||||
from toontown.catalog import CatalogGlobals
|
|
||||||
|
|
||||||
|
|
||||||
class CatalogTabButton(NodePath):
|
|
||||||
def __init__(self, catalogGui, nodeName, clickEvent):
|
|
||||||
NodePath.__init__(self, catalogGui.attachNewNode(nodeName))
|
|
||||||
|
|
||||||
self.active = False
|
|
||||||
self.activePage = 0
|
|
||||||
self.catalogGui = catalogGui
|
|
||||||
self.catalogItemPages = []
|
|
||||||
self.otherTabs = []
|
|
||||||
self.clickEvent = clickEvent
|
|
||||||
|
|
||||||
self.clickedNode = CatalogGlobals.CatalogNodePath.find('**/'+nodeName+'_DN').copyTo(self)
|
|
||||||
self.hoverNode = CatalogGlobals.CatalogNodePath.find('**/'+nodeName+'_OVR').copyTo(self)
|
|
||||||
|
|
||||||
self.tabButton = DirectButton(parent=self, relief=None, image=(self.clickedNode, self.clickedNode, self.hoverNode), command=self.tabClicked)
|
|
||||||
|
|
||||||
def tabClicked(self):
|
|
||||||
if self.active:
|
|
||||||
return
|
|
||||||
for tab in self.otherTabs:
|
|
||||||
tab.disableTab()
|
|
||||||
self.active = True
|
|
||||||
self.catalogGui.setCurrentTab(self)
|
|
||||||
self.showPages()
|
|
||||||
self.updateArrows()
|
|
||||||
self.clickEvent()
|
|
||||||
|
|
||||||
def setOtherTabs(self, otherTabs):
|
|
||||||
self.otherTabs = otherTabs
|
|
||||||
|
|
||||||
def setCatalogItemPages(self, catalogItemPages):
|
|
||||||
self.catalogItemPages = catalogItemPages
|
|
||||||
|
|
||||||
def showPages(self):
|
|
||||||
self.hidePages()
|
|
||||||
if self.catalogItemPages:
|
|
||||||
self.catalogItemPages[self.activePage].show()
|
|
||||||
self.catalogGui.setActivePage(self.activePage)
|
|
||||||
|
|
||||||
def hidePages(self):
|
|
||||||
for page in self.catalogItemPages:
|
|
||||||
page.hide()
|
|
||||||
|
|
||||||
def disableTab(self):
|
|
||||||
if not self.active:
|
|
||||||
return
|
|
||||||
self.active = False
|
|
||||||
self.hidePages()
|
|
||||||
self.activePage = 0
|
|
||||||
|
|
||||||
def updateArrows(self):
|
|
||||||
self.catalogGui.enableBothArrows()
|
|
||||||
if self.activePage == 0:
|
|
||||||
self.catalogGui.disableLeftArrow()
|
|
||||||
if self.activePage == len(self.catalogItemPages) - 1:
|
|
||||||
self.catalogGui.disableRightArrow()
|
|
||||||
|
|
||||||
def moveLeft(self):
|
|
||||||
self.activePage -= 1
|
|
||||||
self.showPages()
|
|
||||||
self.updateArrows()
|
|
||||||
|
|
||||||
def moveRight(self):
|
|
||||||
self.activePage += 1
|
|
||||||
self.showPages()
|
|
||||||
self.updateArrows()
|
|
||||||
|
|
||||||
def lockItems(self):
|
|
||||||
for page in self.catalogItemPages:
|
|
||||||
page.lockItems()
|
|
||||||
|
|
||||||
def updateItems(self, gifting):
|
|
||||||
for page in self.catalogItemPages:
|
|
||||||
page.updateItems(gifting)
|
|
||||||
|
|
||||||
def cleanup(self):
|
|
||||||
for page in self.catalogItemPages:
|
|
||||||
page.cleanup()
|
|
||||||
|
|
||||||
self.tabButton.destroy()
|
|
||||||
|
|
||||||
NodePath.removeNode(self)
|
|
|
@ -50,7 +50,7 @@ class CatalogToonStatueItem(CatalogGardenItem.CatalogGardenItem):
|
||||||
|
|
||||||
def getAllToonStatues(self):
|
def getAllToonStatues(self):
|
||||||
self.statueList = []
|
self.statueList = []
|
||||||
for index in xrange(self.startPoseIndex, self.endPoseIndex + 1):
|
for index in range(self.startPoseIndex, self.endPoseIndex + 1):
|
||||||
self.statueList.append(CatalogToonStatueItem(index, 1, endPoseIndex=index))
|
self.statueList.append(CatalogToonStatueItem(index, 1, endPoseIndex=index))
|
||||||
|
|
||||||
return self.statueList
|
return self.statueList
|
||||||
|
|
|
@ -110,7 +110,7 @@ def getAllWainscotings(*indexList):
|
||||||
for index in indexList:
|
for index in indexList:
|
||||||
colors = WainscotingTypes[index][WSTColor]
|
colors = WainscotingTypes[index][WSTColor]
|
||||||
if colors:
|
if colors:
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogWainscotingItem(index, n))
|
list.append(CatalogWainscotingItem(index, n))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -134,7 +134,7 @@ def getWainscotingRange(fromIndex, toIndex, *otherRanges):
|
||||||
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
||||||
colors = WainscotingTypes[patternIndex][WSTColor]
|
colors = WainscotingTypes[patternIndex][WSTColor]
|
||||||
if colors:
|
if colors:
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogWainscotingItem(patternIndex, n))
|
list.append(CatalogWainscotingItem(patternIndex, n))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,25 +1,19 @@
|
||||||
from CatalogSurfaceItem import *
|
from CatalogSurfaceItem import *
|
||||||
|
|
||||||
WTTextureName = 0
|
WTTextureName = 0
|
||||||
WTColor = 1
|
WTColor = 1
|
||||||
WTBorderList = 2
|
WTBorderList = 2
|
||||||
WTBasePrice = 3
|
WTBasePrice = 3
|
||||||
BDTextureName = 0
|
BDTextureName = 0
|
||||||
BDColor = 1
|
BDColor = 1
|
||||||
|
All = (1000,
|
||||||
All = (
|
|
||||||
1000,
|
|
||||||
1010,
|
1010,
|
||||||
1020,
|
1020,
|
||||||
1030,
|
1030,
|
||||||
1040,
|
1040,
|
||||||
1050,
|
1050,
|
||||||
1060,
|
1060,
|
||||||
1070
|
1070)
|
||||||
)
|
WallpaperTypes = {1000: ('phase_5.5/maps/flat_wallpaper1.jpg',
|
||||||
|
|
||||||
WallpaperTypes = {
|
|
||||||
1000: ('phase_5.5/maps/flat_wallpaper1.jpg',
|
|
||||||
CTFlatColor,
|
CTFlatColor,
|
||||||
(0, 1000),
|
(0, 1000),
|
||||||
180),
|
180),
|
||||||
|
@ -465,11 +459,8 @@ WallpaperTypes = {
|
||||||
13300: ('phase_5.5/maps/StPatWallpaper4.jpg',
|
13300: ('phase_5.5/maps/StPatWallpaper4.jpg',
|
||||||
CTWhite,
|
CTWhite,
|
||||||
(0, 13000),
|
(0, 13000),
|
||||||
400)
|
400)}
|
||||||
}
|
WallpaperGroups = {1100: (1100,
|
||||||
|
|
||||||
WallpaperGroups = {
|
|
||||||
1100: (1100,
|
|
||||||
1110,
|
1110,
|
||||||
1120,
|
1120,
|
||||||
1130,
|
1130,
|
||||||
|
@ -533,9 +524,7 @@ WallpaperGroups = {
|
||||||
2700: (2700, 2710),
|
2700: (2700, 2710),
|
||||||
2800: (2800, 2810),
|
2800: (2800, 2810),
|
||||||
2900: (2900, 2910)}
|
2900: (2900, 2910)}
|
||||||
|
BorderTypes = {1000: ('phase_5.5/maps/bd_grey_border1.jpg', CTFlatColorDark),
|
||||||
BorderTypes = {
|
|
||||||
1000: ('phase_5.5/maps/bd_grey_border1.jpg', CTFlatColorDark),
|
|
||||||
1010: ('phase_5.5/maps/diamonds_border2.jpg', CTWhite),
|
1010: ('phase_5.5/maps/diamonds_border2.jpg', CTWhite),
|
||||||
1020: ('phase_5.5/maps/diamonds_border2ch.jpg', CTWhite),
|
1020: ('phase_5.5/maps/diamonds_border2ch.jpg', CTWhite),
|
||||||
1030: ('phase_5.5/maps/diamonds_border3ch.jpg', CTWhite),
|
1030: ('phase_5.5/maps/diamonds_border3ch.jpg', CTWhite),
|
||||||
|
@ -561,17 +550,15 @@ BorderTypes = {
|
||||||
12000: ('phase_5.5/maps/Vborder1a.jpg', CTWhite),
|
12000: ('phase_5.5/maps/Vborder1a.jpg', CTWhite),
|
||||||
12010: ('phase_5.5/maps/Vborder1b.jpg', CTWhite),
|
12010: ('phase_5.5/maps/Vborder1b.jpg', CTWhite),
|
||||||
12020: ('phase_5.5/maps/Vborder2b.jpg', CTWhite),
|
12020: ('phase_5.5/maps/Vborder2b.jpg', CTWhite),
|
||||||
13000: ('phase_5.5/maps/StPatBorder1.jpg', CTWhite)
|
13000: ('phase_5.5/maps/StPatBorder1.jpg', CTWhite)}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class CatalogWallpaperItem(CatalogSurfaceItem):
|
class CatalogWallpaperItem(CatalogSurfaceItem):
|
||||||
|
|
||||||
def makeNewItem(self, patternIndex, colorIndex = None, borderIndex = 0, borderColorIndex = 0):
|
def makeNewItem(self, patternIndex, colorIndex = None, borderIndex = 0, borderColorIndex = 0):
|
||||||
self.patternIndex = patternIndex
|
self.patternIndex = patternIndex
|
||||||
self.colorIndex = colorIndex
|
self.colorIndex = colorIndex
|
||||||
self.borderIndex = borderIndex
|
self.borderIndex = borderIndex
|
||||||
self.borderColorIndex = borderColorIndex
|
self.borderColorIndex = borderColorIndex
|
||||||
|
|
||||||
CatalogSurfaceItem.makeNewItem(self)
|
CatalogSurfaceItem.makeNewItem(self)
|
||||||
|
|
||||||
def needsCustomize(self):
|
def needsCustomize(self):
|
||||||
|
@ -582,7 +569,7 @@ class CatalogWallpaperItem(CatalogSurfaceItem):
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
name = TTLocalizer.WallpaperNames.get(self.patternIndex)
|
name = TTLocalizer.WallpaperNames.get(self.patternIndex)
|
||||||
if name is None:
|
if name == None:
|
||||||
century = self.patternIndex - self.patternIndex % 100
|
century = self.patternIndex - self.patternIndex % 100
|
||||||
name = TTLocalizer.WallpaperNames.get(century)
|
name = TTLocalizer.WallpaperNames.get(century)
|
||||||
if name:
|
if name:
|
||||||
|
@ -610,10 +597,10 @@ class CatalogWallpaperItem(CatalogSurfaceItem):
|
||||||
|
|
||||||
def output(self, store = -1):
|
def output(self, store = -1):
|
||||||
return 'CatalogWallpaperItem(%s, %s, %s, %s%s)' % (self.patternIndex,
|
return 'CatalogWallpaperItem(%s, %s, %s, %s%s)' % (self.patternIndex,
|
||||||
self.colorIndex,
|
self.colorIndex,
|
||||||
self.borderIndex,
|
self.borderIndex,
|
||||||
self.borderColorIndex,
|
self.borderColorIndex,
|
||||||
self.formatOptionalData(store))
|
self.formatOptionalData(store))
|
||||||
|
|
||||||
def getFilename(self):
|
def getFilename(self):
|
||||||
return WallpaperTypes[self.patternIndex][WTTextureName]
|
return WallpaperTypes[self.patternIndex][WTTextureName]
|
||||||
|
@ -626,7 +613,8 @@ class CatalogWallpaperItem(CatalogSurfaceItem):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def getHashContents(self):
|
def getHashContents(self):
|
||||||
return self.patternIndex - self.patternIndex % 100
|
century = self.patternIndex - self.patternIndex % 100
|
||||||
|
return century
|
||||||
|
|
||||||
def getBasePrice(self):
|
def getBasePrice(self):
|
||||||
return WallpaperTypes[self.patternIndex][WTBasePrice]
|
return WallpaperTypes[self.patternIndex][WTBasePrice]
|
||||||
|
@ -640,7 +628,7 @@ class CatalogWallpaperItem(CatalogSurfaceItem):
|
||||||
return texture
|
return texture
|
||||||
|
|
||||||
def getColor(self):
|
def getColor(self):
|
||||||
if self.colorIndex is None:
|
if self.colorIndex == None:
|
||||||
colorIndex = 0
|
colorIndex = 0
|
||||||
else:
|
else:
|
||||||
colorIndex = self.colorIndex
|
colorIndex = self.colorIndex
|
||||||
|
@ -648,7 +636,9 @@ class CatalogWallpaperItem(CatalogSurfaceItem):
|
||||||
if colorIndex < len(colors):
|
if colorIndex < len(colors):
|
||||||
return colors[colorIndex]
|
return colors[colorIndex]
|
||||||
else:
|
else:
|
||||||
|
print 'Warning: colorIndex > len(colors). Returning white.'
|
||||||
return CT_WHITE
|
return CT_WHITE
|
||||||
|
return
|
||||||
|
|
||||||
def loadBorderTexture(self):
|
def loadBorderTexture(self):
|
||||||
from pandac.PandaModules import Texture
|
from pandac.PandaModules import Texture
|
||||||
|
@ -670,10 +660,10 @@ class CatalogWallpaperItem(CatalogSurfaceItem):
|
||||||
return colors[self.borderColorIndex]
|
return colors[self.borderColorIndex]
|
||||||
else:
|
else:
|
||||||
return CT_WHITE
|
return CT_WHITE
|
||||||
|
return
|
||||||
|
|
||||||
def decodeDatagram(self, di, versionNumber, store):
|
def decodeDatagram(self, di, versionNumber, store):
|
||||||
CatalogAtticItem.CatalogAtticItem.decodeDatagram(self, di, versionNumber, store)
|
CatalogAtticItem.CatalogAtticItem.decodeDatagram(self, di, versionNumber, store)
|
||||||
|
|
||||||
self.colorIndex = 0
|
self.colorIndex = 0
|
||||||
if store & CatalogItem.Customization:
|
if store & CatalogItem.Customization:
|
||||||
self.borderIndex = 0
|
self.borderIndex = 0
|
||||||
|
@ -693,10 +683,10 @@ class CatalogWallpaperItem(CatalogSurfaceItem):
|
||||||
self.borderIndex = di.getUint16()
|
self.borderIndex = di.getUint16()
|
||||||
self.borderColorIndex = di.getUint8()
|
self.borderColorIndex = di.getUint8()
|
||||||
wtype = WallpaperTypes[self.patternIndex]
|
wtype = WallpaperTypes[self.patternIndex]
|
||||||
|
return
|
||||||
|
|
||||||
def encodeDatagram(self, dg, store):
|
def encodeDatagram(self, dg, store):
|
||||||
CatalogAtticItem.CatalogAtticItem.encodeDatagram(self, dg, store)
|
CatalogAtticItem.CatalogAtticItem.encodeDatagram(self, dg, store)
|
||||||
|
|
||||||
dg.addUint16(self.patternIndex)
|
dg.addUint16(self.patternIndex)
|
||||||
if store & CatalogItem.Customization:
|
if store & CatalogItem.Customization:
|
||||||
dg.addUint8(self.colorIndex)
|
dg.addUint8(self.colorIndex)
|
||||||
|
@ -708,8 +698,10 @@ def getWallpapers(*typeList):
|
||||||
list = []
|
list = []
|
||||||
for type in typeList:
|
for type in typeList:
|
||||||
list.append(CatalogWallpaperItem(type))
|
list.append(CatalogWallpaperItem(type))
|
||||||
|
|
||||||
return list
|
return list
|
||||||
|
|
||||||
|
|
||||||
def getAllWallpapers(*typeList):
|
def getAllWallpapers(*typeList):
|
||||||
list = []
|
list = []
|
||||||
for type in typeList:
|
for type in typeList:
|
||||||
|
@ -722,12 +714,14 @@ def getAllWallpapers(*typeList):
|
||||||
numBorderColors = len(borderData[BDColor])
|
numBorderColors = len(borderData[BDColor])
|
||||||
else:
|
else:
|
||||||
numBorderColors = 1
|
numBorderColors = 1
|
||||||
for borderColorIndex in xrange(numBorderColors):
|
for borderColorIndex in range(numBorderColors):
|
||||||
colors = WallpaperTypes[index][WTColor]
|
colors = WallpaperTypes[index][WTColor]
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogWallpaperItem(index, n, borderKey, borderColorIndex))
|
list.append(CatalogWallpaperItem(index, n, borderKey, borderColorIndex))
|
||||||
|
|
||||||
return list
|
return list
|
||||||
|
|
||||||
|
|
||||||
def getWallpaperRange(fromIndex, toIndex, *otherRanges):
|
def getWallpaperRange(fromIndex, toIndex, *otherRanges):
|
||||||
list = []
|
list = []
|
||||||
froms = [fromIndex]
|
froms = [fromIndex]
|
||||||
|
@ -737,6 +731,7 @@ def getWallpaperRange(fromIndex, toIndex, *otherRanges):
|
||||||
froms.append(otherRanges[i])
|
froms.append(otherRanges[i])
|
||||||
tos.append(otherRanges[i + 1])
|
tos.append(otherRanges[i + 1])
|
||||||
i += 2
|
i += 2
|
||||||
|
|
||||||
for patternIndex in WallpaperTypes.keys():
|
for patternIndex in WallpaperTypes.keys():
|
||||||
for fromIndex, toIndex in zip(froms, tos):
|
for fromIndex, toIndex in zip(froms, tos):
|
||||||
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
||||||
|
@ -747,8 +742,9 @@ def getWallpaperRange(fromIndex, toIndex, *otherRanges):
|
||||||
numBorderColors = len(borderData[BDColor])
|
numBorderColors = len(borderData[BDColor])
|
||||||
else:
|
else:
|
||||||
numBorderColors = 1
|
numBorderColors = 1
|
||||||
for borderColorIndex in xrange(numBorderColors):
|
for borderColorIndex in range(numBorderColors):
|
||||||
colors = WallpaperTypes[patternIndex][WTColor]
|
colors = WallpaperTypes[patternIndex][WTColor]
|
||||||
for n in xrange(len(colors)):
|
for n in range(len(colors)):
|
||||||
list.append(CatalogWallpaperItem(patternIndex, n, borderKey, borderColorIndex))
|
list.append(CatalogWallpaperItem(patternIndex, n, borderKey, borderColorIndex))
|
||||||
|
|
||||||
return list
|
return list
|
||||||
|
|
|
@ -43,6 +43,9 @@ class CatalogWindowItem(CatalogAtticItem.CatalogAtticItem):
|
||||||
house.addWindow(self)
|
house.addWindow(self)
|
||||||
return retcode
|
return retcode
|
||||||
|
|
||||||
|
def getDeliveryTime(self):
|
||||||
|
return 1
|
||||||
|
|
||||||
def getPicture(self, avatar):
|
def getPicture(self, avatar):
|
||||||
frame = self.makeFrame()
|
frame = self.makeFrame()
|
||||||
model = self.loadModel()
|
model = self.loadModel()
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
from CatalogItemList import CatalogItemList
|
|
||||||
from CatalogInvalidItem import CatalogInvalidItem
|
|
||||||
from CatalogFurnitureItem import CatalogFurnitureItem
|
|
||||||
from CatalogChatItem import CatalogChatItem
|
|
||||||
from CatalogClothingItem import CatalogClothingItem
|
|
||||||
from CatalogEmoteItem import CatalogEmoteItem
|
|
||||||
from CatalogWallpaperItem import CatalogWallpaperItem
|
|
||||||
from CatalogWindowItem import CatalogWindowItem
|
|
||||||
from CatalogFlooringItem import CatalogFlooringItem
|
|
||||||
from CatalogMouldingItem import CatalogMouldingItem
|
|
||||||
from CatalogWainscotingItem import CatalogWainscotingItem
|
|
||||||
from CatalogPoleItem import CatalogPoleItem
|
|
||||||
from CatalogPetTrickItem import CatalogPetTrickItem
|
|
||||||
from CatalogBeanItem import CatalogBeanItem
|
|
||||||
from CatalogGardenItem import CatalogGardenItem
|
|
||||||
from CatalogRentalItem import CatalogRentalItem
|
|
||||||
from CatalogGardenStarterItem import CatalogGardenStarterItem
|
|
||||||
from CatalogNametagItem import CatalogNametagItem
|
|
||||||
from CatalogToonStatueItem import CatalogToonStatueItem
|
|
||||||
from CatalogAnimatedFurnitureItem import CatalogAnimatedFurnitureItem
|
|
||||||
from CatalogAccessoryItem import CatalogAccessoryItem
|
|
||||||
|
|
||||||
|
|
||||||
class PopularItemManagerAI:
|
|
||||||
def __init__(self, air):
|
|
||||||
self.air = air
|
|
||||||
|
|
||||||
self.popularItemDict = {}
|
|
||||||
|
|
||||||
def avBoughtItem(self, item):
|
|
||||||
# Load the current popularItems
|
|
||||||
try:
|
|
||||||
popularItems = simbase.backups.load('catalog', ('popular-items',), default=({}))
|
|
||||||
except ValueError:
|
|
||||||
return
|
|
||||||
|
|
||||||
itemOutput = item.output()
|
|
||||||
|
|
||||||
# Don't allow rental items!
|
|
||||||
if 'CatalogRentalItem' in itemOutput:
|
|
||||||
return
|
|
||||||
|
|
||||||
if not itemOutput in popularItems:
|
|
||||||
popularItems[itemOutput] = 1
|
|
||||||
else:
|
|
||||||
popularItems[itemOutput] += 1
|
|
||||||
|
|
||||||
# Save it.
|
|
||||||
try:
|
|
||||||
simbase.backups.save('catalog', ('popular-items',), (popularItems))
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def requestPopularItems(self):
|
|
||||||
# Load the current popularItems
|
|
||||||
try:
|
|
||||||
self.popularItemDict = simbase.backups.load('catalog', ('popular-items',), default=({}))
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
sortedItems = [(x,y) for y,x in sorted([(y,x) for x,y in self.popularItemDict.items()],reverse=True)]
|
|
||||||
|
|
||||||
finalItems = []
|
|
||||||
if len(sortedItems) <= 12:
|
|
||||||
for item in sortedItems:
|
|
||||||
item = eval(item[0])
|
|
||||||
finalItems.append(item)
|
|
||||||
else:
|
|
||||||
for i in xrange(12):
|
|
||||||
item = eval(sortedItems[i][0])
|
|
||||||
finalItems.append(item)
|
|
||||||
|
|
||||||
catalog = CatalogItemList(finalItems)
|
|
||||||
return catalog.getBlob()
|
|
||||||
|
|
|
@ -122,7 +122,6 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
|
||||||
item.deliveryDate = int(time.time()/60) + item.getDeliveryTime()
|
item.deliveryDate = int(time.time()/60) + item.getDeliveryTime()
|
||||||
av.onOrder.append(item)
|
av.onOrder.append(item)
|
||||||
av.b_setDeliverySchedule(av.onOrder)
|
av.b_setDeliverySchedule(av.onOrder)
|
||||||
self.air.popularItemManager.avBoughtItem(item)
|
|
||||||
self.sendUpdateToAvatarId(avId, 'requestPurchaseResponse', [context, ToontownGlobals.P_ItemOnOrder])
|
self.sendUpdateToAvatarId(avId, 'requestPurchaseResponse', [context, ToontownGlobals.P_ItemOnOrder])
|
||||||
taskMgr.doMethodLater(0.2, self.sendUpdateToAvatarId, 'purchaseItemComplete-%d' % self.getDoId(), extraArgs=[avId, 'purchaseItemComplete', []])
|
taskMgr.doMethodLater(0.2, self.sendUpdateToAvatarId, 'purchaseItemComplete-%d' % self.getDoId(), extraArgs=[avId, 'purchaseItemComplete', []])
|
||||||
else:
|
else:
|
||||||
|
@ -132,8 +131,6 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
|
||||||
resp = item.recordPurchase(av, optional)
|
resp = item.recordPurchase(av, optional)
|
||||||
if resp < 0:
|
if resp < 0:
|
||||||
av.addMoney(price)
|
av.addMoney(price)
|
||||||
else:
|
|
||||||
self.air.popularItemManager.avBoughtItem(item)
|
|
||||||
|
|
||||||
self.sendUpdateToAvatarId(avId, 'requestPurchaseResponse', [context, resp])
|
self.sendUpdateToAvatarId(avId, 'requestPurchaseResponse', [context, resp])
|
||||||
taskMgr.doMethodLater(0.2, self.sendUpdateToAvatarId, 'purchaseItemComplete-%d' % self.getDoId(), extraArgs=[avId, 'purchaseItemComplete', []])
|
taskMgr.doMethodLater(0.2, self.sendUpdateToAvatarId, 'purchaseItemComplete-%d' % self.getDoId(), extraArgs=[avId, 'purchaseItemComplete', []])
|
||||||
|
|
Loading…
Reference in a new issue