Ability to switch poles in shticker book + poles appear in every catalog

This commit is contained in:
John 2015-07-27 10:46:14 +03:00
parent 1739b7eb4f
commit 26de40ce8c
10 changed files with 180 additions and 113 deletions

View file

@ -661,6 +661,7 @@ dclass DistributedToon : DistributedPlayer {
setMaxFishTank(uint8 = 20) required ownrecv db; setMaxFishTank(uint8 = 20) required ownrecv db;
setFishTank(uint8[] = [], uint8[] = [], uint16[] = []) required ownrecv db; setFishTank(uint8[] = [], uint8[] = [], uint16[] = []) required ownrecv db;
setFishingRod(uint8 = 0) required broadcast ownrecv db; setFishingRod(uint8 = 0) required broadcast ownrecv db;
setMaxFishingRod(uint8 = 0) required broadcast ownrecv db;
setFishingTrophies(uint8[] = []) required ownrecv db; setFishingTrophies(uint8[] = []) required ownrecv db;
setFlowerCollection(uint8[] = [], uint8[] = []) required ownrecv db; setFlowerCollection(uint8[] = [], uint8[] = []) required ownrecv db;
setFlowerBasket(uint8[] = [], uint8[] = []) required ownrecv db; setFlowerBasket(uint8[] = [], uint8[] = []) required ownrecv db;
@ -743,6 +744,7 @@ dclass DistributedToon : DistributedPlayer {
setNextKnockHeal(uint32) ram airecv; setNextKnockHeal(uint32) ram airecv;
setEPP(uint8[] = []) required ownrecv db; setEPP(uint8[] = []) required ownrecv db;
requestNametagStyle(uint8) airecv ownsend; requestNametagStyle(uint8) airecv ownsend;
requestFishingRod(uint8) airecv ownsend;
}; };
dclass DistributedPartyGate : DistributedObject { dclass DistributedPartyGate : DistributedObject {

View file

@ -838,11 +838,7 @@ WeeklySchedule = ((100,
4000, 4000,
4500, 4500,
CatalogFurnitureItem(110), CatalogFurnitureItem(110),
CatalogFurnitureItem(100), CatalogFurnitureItem(100)),
nextAvailablePole,
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
(100, (100,
(5, 2000), (5, 2000),
CatalogFurnitureItem(1420), CatalogFurnitureItem(1420),
@ -863,8 +859,7 @@ WeeklySchedule = ((100,
CatalogAnimatedFurnitureItem(490), CatalogAnimatedFurnitureItem(490),
CatalogFurnitureItem(1000), CatalogFurnitureItem(1000),
CatalogClothingItem(117, 0), CatalogClothingItem(117, 0),
CatalogClothingItem(217, 0), CatalogClothingItem(217, 0)),
nextAvailableCloset),
(100, (100,
(5, 2000), (5, 2000),
CatalogFurnitureItem(1430), CatalogFurnitureItem(1430),
@ -884,11 +879,7 @@ WeeklySchedule = ((100,
4000, 4000,
4500, 4500,
CatalogFurnitureItem(1210), CatalogFurnitureItem(1210),
CatalogClothingItem(409, 0), CatalogClothingItem(409, 0)),
nextAvailablePole,
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
(300, (300,
(5, 2000), (5, 2000),
CatalogEmoteItem(13), CatalogEmoteItem(13),
@ -907,10 +898,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(910), CatalogFurnitureItem(910),
CatalogFurnitureItem(1600), CatalogFurnitureItem(1600),
CatalogClothingItem(118, 0), CatalogClothingItem(118, 0),
CatalogClothingItem(218, 0), CatalogClothingItem(218, 0)),
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
(100, (100,
(5, 2000), (5, 2000),
3000, 3000,
@ -927,11 +915,7 @@ WeeklySchedule = ((100,
3500, 3500,
4000, 4000,
4500, 4500,
CatalogFurnitureItem(620), CatalogFurnitureItem(620)),
nextAvailablePole,
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
(300, (300,
(5, 2000), (5, 2000),
3000, 3000,
@ -951,10 +935,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(630), CatalogFurnitureItem(630),
CatalogFurnitureItem(1630), CatalogFurnitureItem(1630),
CatalogEmoteItem(11), CatalogEmoteItem(11),
CatalogNametagItem(11), CatalogNametagItem(11)),
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
(100, (100,
(2, 2000), (2, 2000),
(3, 2010), (3, 2010),
@ -977,11 +958,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(120), CatalogFurnitureItem(120),
CatalogClothingItem(120, 0), CatalogClothingItem(120, 0),
CatalogClothingItem(220, 0), CatalogClothingItem(220, 0),
nextAvailablePole, 5000),
5000,
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
(100, (100,
(2, 2000), (2, 2000),
(3, 2010), (3, 2010),
@ -1002,10 +979,7 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(1120), CatalogFurnitureItem(1120),
CatalogFurnitureItem(930), CatalogFurnitureItem(930),
CatalogFurnitureItem(1500), CatalogFurnitureItem(1500),
CatalogEmoteItem(6), CatalogEmoteItem(6)),
nextAvailableCloset,
nextAvailableBank,
nextAvailableTank),
(300, (300,
(2, 2000), (2, 2000),
(3, 2010), (3, 2010),
@ -1028,7 +1002,6 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(940), CatalogFurnitureItem(940),
CatalogClothingItem(121, 0), CatalogClothingItem(121, 0),
CatalogClothingItem(221, 0), CatalogClothingItem(221, 0),
nextAvailablePole,
5000), 5000),
(100, (100,
(2, 2000), (2, 2000),
@ -1069,7 +1042,6 @@ WeeklySchedule = ((100,
4510, 4510,
CatalogFurnitureItem(300), CatalogFurnitureItem(300),
CatalogFurnitureItem(1220), CatalogFurnitureItem(1220),
nextAvailablePole,
5000), 5000),
(300, (300,
(2, 2000), (2, 2000),
@ -1127,7 +1099,6 @@ WeeklySchedule = ((100,
CatalogFurnitureItem(145), CatalogFurnitureItem(145),
CatalogClothingItem(123, 0), CatalogClothingItem(123, 0),
CatalogClothingItem(224, 0), CatalogClothingItem(224, 0),
nextAvailablePole,
5000), 5000),
(100, (100,
(1, 2000), (1, 2000),
@ -1168,8 +1139,7 @@ WeeklySchedule = ((100,
4520, 4520,
CatalogWindowItem(90), CatalogWindowItem(90),
CatalogClothingItem(124, 0), CatalogClothingItem(124, 0),
CatalogClothingItem(411, 0), CatalogClothingItem(411, 0)),
nextAvailablePole),
(100, (100,
(1, 2000), (1, 2000),
(2, 2010), (2, 2010),
@ -1215,7 +1185,6 @@ WeeklySchedule = ((100,
4020, 4020,
4520, 4520,
CatalogFurnitureItem(1910), CatalogFurnitureItem(1910),
nextAvailablePole,
CatalogFurnitureItem(1000)), CatalogFurnitureItem(1000)),
(300, (300,
(1, 2000), (1, 2000),
@ -1267,7 +1236,6 @@ WeeklySchedule = ((100,
3530, 3530,
4020, 4020,
4520, 4520,
nextAvailablePole,
CatalogWallpaperItem(3900), CatalogWallpaperItem(3900),
CatalogFurnitureItem(980), CatalogFurnitureItem(980),
CatalogNametagItem(13)), CatalogNametagItem(13)),
@ -1313,7 +1281,6 @@ WeeklySchedule = ((100,
3530, 3530,
4020, 4020,
4520, 4520,
nextAvailablePole,
CatalogFurnitureItem(1930), CatalogFurnitureItem(1930),
CatalogFurnitureItem(670)), CatalogFurnitureItem(670)),
(300, (300,
@ -1356,7 +1323,6 @@ WeeklySchedule = ((100,
3530, 3530,
4020, 4020,
4520, 4520,
nextAvailablePole,
CatalogFurnitureItem(1940), CatalogFurnitureItem(1940),
CatalogWindowItem(130)), CatalogWindowItem(130)),
(300, (300,
@ -1379,8 +1345,7 @@ WeeklySchedule = ((100,
4020, 4020,
4520, 4520,
CatalogFurnitureItem(250), CatalogFurnitureItem(250),
CatalogFurnitureItem(1960), CatalogFurnitureItem(1960)),
nextAvailablePole),
Sale(CatalogFurnitureItem(210, 0), CatalogFurnitureItem(220, 0), CatalogFurnitureItem(1100), CatalogFurnitureItem(110), CatalogFurnitureItem(100), CatalogFurnitureItem(700), CatalogFurnitureItem(710), CatalogFurnitureItem(410), CatalogAnimatedFurnitureItem(490), CatalogFurnitureItem(1210), CatalogFurnitureItem(1200), CatalogFurnitureItem(800), CatalogFurnitureItem(1110), CatalogFurnitureItem(230), CatalogFurnitureItem(420), CatalogAnimatedFurnitureItem(480), CatalogFurnitureItem(120), CatalogFurnitureItem(1700), CatalogFurnitureItem(1120), CatalogFurnitureItem(430), CatalogAnimatedFurnitureItem(491), CatalogFurnitureItem(1130), CatalogFurnitureItem(130), CatalogFurnitureItem(300), CatalogFurnitureItem(1220), CatalogFurnitureItem(810), CatalogFurnitureItem(1230), CatalogFurnitureItem(310), CatalogFurnitureItem(1240), CatalogFurnitureItem(240), CatalogFurnitureItem(145), CatalogFurnitureItem(1725), CatalogFurnitureItem(140), CatalogFurnitureItem(950), CatalogFurnitureItem(1720)), Sale(CatalogFurnitureItem(210, 0), CatalogFurnitureItem(220, 0), CatalogFurnitureItem(1100), CatalogFurnitureItem(110), CatalogFurnitureItem(100), CatalogFurnitureItem(700), CatalogFurnitureItem(710), CatalogFurnitureItem(410), CatalogAnimatedFurnitureItem(490), CatalogFurnitureItem(1210), CatalogFurnitureItem(1200), CatalogFurnitureItem(800), CatalogFurnitureItem(1110), CatalogFurnitureItem(230), CatalogFurnitureItem(420), CatalogAnimatedFurnitureItem(480), CatalogFurnitureItem(120), CatalogFurnitureItem(1700), CatalogFurnitureItem(1120), CatalogFurnitureItem(430), CatalogAnimatedFurnitureItem(491), CatalogFurnitureItem(1130), CatalogFurnitureItem(130), CatalogFurnitureItem(300), CatalogFurnitureItem(1220), CatalogFurnitureItem(810), CatalogFurnitureItem(1230), CatalogFurnitureItem(310), CatalogFurnitureItem(1240), CatalogFurnitureItem(240), CatalogFurnitureItem(145), CatalogFurnitureItem(1725), CatalogFurnitureItem(140), CatalogFurnitureItem(950), CatalogFurnitureItem(1720)),
Sale(CatalogClothingItem(116, 0), CatalogClothingItem(216, 0), CatalogClothingItem(408, 0), CatalogClothingItem(117, 0), CatalogClothingItem(217, 0), CatalogClothingItem(409, 0), CatalogClothingItem(118, 0), CatalogClothingItem(218, 0), CatalogClothingItem(410, 0), CatalogClothingItem(119, 0), CatalogClothingItem(219, 0), CatalogClothingItem(120, 0), CatalogClothingItem(220, 0), CatalogClothingItem(121, 0), CatalogClothingItem(221, 0), CatalogClothingItem(222, 0), CatalogClothingItem(123, 0), CatalogClothingItem(224, 0), CatalogClothingItem(411, 0), CatalogClothingItem(311, 0), CatalogClothingItem(310, 0)), Sale(CatalogClothingItem(116, 0), CatalogClothingItem(216, 0), CatalogClothingItem(408, 0), CatalogClothingItem(117, 0), CatalogClothingItem(217, 0), CatalogClothingItem(409, 0), CatalogClothingItem(118, 0), CatalogClothingItem(218, 0), CatalogClothingItem(410, 0), CatalogClothingItem(119, 0), CatalogClothingItem(219, 0), CatalogClothingItem(120, 0), CatalogClothingItem(220, 0), CatalogClothingItem(121, 0), CatalogClothingItem(221, 0), CatalogClothingItem(222, 0), CatalogClothingItem(123, 0), CatalogClothingItem(224, 0), CatalogClothingItem(411, 0), CatalogClothingItem(311, 0), CatalogClothingItem(310, 0)),
Sale(CatalogWindowItem(40), CatalogWindowItem(70), CatalogWindowItem(50), CatalogWindowItem(60), CatalogWindowItem(80), CatalogWindowItem(100), CatalogWindowItem(90), CatalogWindowItem(110)), Sale(CatalogWindowItem(40), CatalogWindowItem(70), CatalogWindowItem(50), CatalogWindowItem(60), CatalogWindowItem(80), CatalogWindowItem(100), CatalogWindowItem(90), CatalogWindowItem(110)),
@ -1390,8 +1355,7 @@ WeeklySchedule = ((100,
(1, 2020), (1, 2020),
(2, 2030), (2, 2030),
(3, 2040), (3, 2040),
CatalogFurnitureItem(730), CatalogFurnitureItem(730)),
nextAvailablePole),
(100, (100,
(1, 2020), (1, 2020),
(2, 2030), (2, 2030),
@ -1414,8 +1378,7 @@ WeeklySchedule = ((100,
(1, 2020), (1, 2020),
(2, 2030), (2, 2030),
(3, 2040), (3, 2040),
CatalogFurnitureItem(1140), CatalogFurnitureItem(1140)),
nextAvailablePole),
(100, (100,
(1, 2020), (1, 2020),
(2, 2030), (2, 2030),
@ -1438,8 +1401,7 @@ WeeklySchedule = ((100,
(2, 2040), (2, 2040),
(3, 2050), (3, 2050),
CatalogClothingItem(131, 0), CatalogClothingItem(131, 0),
CatalogClothingItem(225, 0), CatalogClothingItem(225, 0)),
nextAvailablePole),
(300, (300,
(1, 2030), (1, 2030),
(2, 2040), (2, 2040),
@ -1459,7 +1421,6 @@ WeeklySchedule = ((100,
(1, 2030), (1, 2030),
(2, 2040), (2, 2040),
(3, 2050), (3, 2050),
nextAvailablePole,
CatalogEmoteItem(12), CatalogEmoteItem(12),
CatalogNametagItem(5)), CatalogNametagItem(5)),
(300, (300,
@ -1483,8 +1444,7 @@ WeeklySchedule = ((100,
(1, 2030), (1, 2030),
(2, 2040), (2, 2040),
(3, 2050), (3, 2050),
CatalogFurnitureItem(1215), CatalogFurnitureItem(1215)),
nextAvailablePole),
(300, (300,
(1, 2030), (1, 2030),
(2, 2040), (2, 2040),
@ -1504,8 +1464,7 @@ WeeklySchedule = ((100,
(300, (300,
(1, 2030), (1, 2030),
(2, 2040), (2, 2040),
(3, 2050), (3, 2050)))
nextAvailablePole))
class CatalogGenerator: class CatalogGenerator:
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogGenerator') notify = DirectNotifyGlobal.directNotify.newCategory('CatalogGenerator')
@ -1547,23 +1506,24 @@ class CatalogGenerator:
if nextAvailableCloset not in schedule: if nextAvailableCloset not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableCloset, monthlyCatalog, saleItem=0) weeklyCatalog += self.__selectItem(avatar, nextAvailableCloset, monthlyCatalog, saleItem=0)
if nextAvailableBank not in schedule: if nextAvailableBank not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableBank, monthlyCatalog, saleItem = 0) weeklyCatalog += self.__selectItem(avatar, nextAvailableBank, monthlyCatalog, saleItem = 0)
if nextAvailableTank not in schedule: if nextAvailableTank not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailableTank, monthlyCatalog, saleItem = 0) weeklyCatalog += self.__selectItem(avatar, nextAvailableTank, monthlyCatalog, saleItem = 0)
if time.time() < 1096617600.0: if nextAvailablePole not in schedule:
weeklyCatalog += self.__selectItem(avatar, nextAvailablePole, monthlyCatalog, saleItem = 0)
def hasPetTrick(catalog): def hasPetTrick(catalog):
for item in catalog: for item in catalog:
if isinstance(item, CatalogPetTrickItem): if isinstance(item, CatalogPetTrickItem):
return 1 return 1
return 0 return 0
if not hasPetTrick(weeklyCatalog) and not hasPetTrick(avatar.weeklyCatalog) and not hasPetTrick(avatar.backCatalog):
self.notify.debug('Artificially adding pet trick to catalog')
weeklyCatalog += self.__selectItem(avatar, 5000, monthlyCatalog, saleItem=saleItem)
if not hasPetTrick(weeklyCatalog) and not hasPetTrick(avatar.weeklyCatalog) and not hasPetTrick(avatar.backCatalog):
self.notify.debug('Artificially adding pet trick to catalog')
weeklyCatalog += self.__selectItem(avatar, 5000, monthlyCatalog, saleItem=saleItem)
self.notify.debug('Generated catalog: %s' % weeklyCatalog) self.notify.debug('Generated catalog: %s' % weeklyCatalog)
return weeklyCatalog return weeklyCatalog

View file

@ -40,9 +40,8 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
def recordPurchase(self, avatar, optional): def recordPurchase(self, avatar, optional):
if avatar: if avatar:
avatar.nametagStyles.append(self.nametagStyle)
avatar.b_setNametagStyles(avatar.nametagStyles)
avatar.b_setNametagStyle(self.nametagStyle) avatar.b_setNametagStyle(self.nametagStyle)
avatar.addNametagStyle(self.nametagStyle)
return ToontownGlobals.P_ItemAvailable return ToontownGlobals.P_ItemAvailable
def getDeliveryTime(self): def getDeliveryTime(self):

View file

@ -16,7 +16,7 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
return 1 return 1
def reachedPurchaseLimit(self, avatar): def reachedPurchaseLimit(self, avatar):
return avatar.getFishingRod() >= self.rodId or self in avatar.onOrder or self in avatar.mailboxContents return avatar.getMaxFishingRod() >= self.rodId or self in avatar.onOrder or self in avatar.mailboxContents
def saveHistory(self): def saveHistory(self):
return 1 return 1
@ -31,10 +31,11 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
if self.rodId < 0 or self.rodId > FishGlobals.MaxRodId: if self.rodId < 0 or self.rodId > FishGlobals.MaxRodId:
self.notify.warning('Invalid fishing pole: %s for avatar %s' % (self.rodId, avatar.doId)) self.notify.warning('Invalid fishing pole: %s for avatar %s' % (self.rodId, avatar.doId))
return ToontownGlobals.P_InvalidIndex return ToontownGlobals.P_InvalidIndex
if self.rodId < avatar.getFishingRod(): if self.rodId < avatar.getMaxFishingRod():
self.notify.warning('Avatar already has pole: %s for avatar %s' % (self.rodId, avatar.doId)) self.notify.warning('Avatar already has pole: %s for avatar %s' % (self.rodId, avatar.doId))
return ToontownGlobals.P_ItemUnneeded return ToontownGlobals.P_ItemUnneeded
avatar.b_setFishingRod(self.rodId) avatar.b_setFishingRod(self.rodId)
avatar.b_setMaxFishingRod(self.rodId)
return ToontownGlobals.P_ItemAvailable return ToontownGlobals.P_ItemAvailable
def isGift(self): def isGift(self):
@ -83,7 +84,6 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
def decodeDatagram(self, di, versionNumber, store): def decodeDatagram(self, di, versionNumber, store):
CatalogItem.CatalogItem.decodeDatagram(self, di, versionNumber, store) CatalogItem.CatalogItem.decodeDatagram(self, di, versionNumber, store)
self.rodId = di.getUint8() self.rodId = di.getUint8()
price = FishGlobals.RodPriceDict[self.rodId]
def encodeDatagram(self, dg, store): def encodeDatagram(self, dg, store):
CatalogItem.CatalogItem.encodeDatagram(self, dg, store) CatalogItem.CatalogItem.encodeDatagram(self, dg, store)
@ -91,7 +91,7 @@ class CatalogPoleItem(CatalogItem.CatalogItem):
def nextAvailablePole(avatar, duplicateItems): def nextAvailablePole(avatar, duplicateItems):
rodId = avatar.getFishingRod() + 1 rodId = avatar.getMaxFishingRod() + 1
if rodId > FishGlobals.MaxRodId: if rodId > FishGlobals.MaxRodId:
return None return None
item = CatalogPoleItem(rodId) item = CatalogPoleItem(rodId)

View file

@ -0,0 +1,57 @@
from direct.gui.DirectGui import *
class OptionChooser:
def __init__(self, book, labelText, row, indexCommand, extraArgs, exitCommand):
options_text_scale = 0.052
leftMargin = -0.72
buttonbase_xcoord = 0.35
textStartHeight = 0.45
textRowHeight = 0.145
y = textStartHeight - row * textRowHeight
matGui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
arrow_image = (matGui.find('**/tt_t_gui_mat_shuffleArrowUp'), matGui.find('**/tt_t_gui_mat_shuffleArrowDown'))
self.indexCommand = indexCommand
self.extraArgs = extraArgs
self.exit = exitCommand
self.label = DirectLabel(book, relief=None, text=labelText, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, y))
self.display = DirectLabel(book, relief=None, scale=0.06, text_wordwrap=9, pos=(buttonbase_xcoord, 0, y))
self.leftButton = DirectButton(book, relief=None, image=arrow_image, scale=0.45, pos=(textStartHeight - 0.4, 0, y), command=self.offsetIndex, extraArgs=[-1])
self.rightButton = DirectButton(book, relief=None, image=arrow_image, scale=-0.45, pos=(textStartHeight + 0.2, 0, y), command=self.offsetIndex, extraArgs=[1])
self.index = -1
matGui.removeNode()
def unload(self):
self.label.destroy()
del self.label
self.display.destroy()
del self.display
self.leftButton.destroy()
del self.leftButton
self.rightButton.destroy()
del self.rightButton
def offsetIndex(self, offset):
self.index += offset
self.indexCommand(*self.extraArgs)
def setIndex(self, index):
self.index = index
def setDisplayText(self, text):
self.display['text'] = text
def setDisplayFont(self, font):
self.display['text_font'] = font
def decideButtons(self, minCount, maxCount):
if self.index <= minCount:
self.leftButton.hide()
else:
self.leftButton.show()
if self.index >= maxCount:
self.rightButton.hide()
else:
self.rightButton.show()

View file

@ -6,6 +6,7 @@ from panda3d.core import *
import DisplaySettingsDialog import DisplaySettingsDialog
import ShtikerPage import ShtikerPage
import OptionChooser
from otp.speedchat import SCColorScheme from otp.speedchat import SCColorScheme
from otp.speedchat import SCStaticTextTerminal from otp.speedchat import SCStaticTextTerminal
from otp.speedchat import SpeedChat from otp.speedchat import SpeedChat
@ -701,6 +702,7 @@ class ExtraOptionsTabPage(DirectFrame):
def __init__(self, parent = aspect2d): def __init__(self, parent = aspect2d):
self.parent = parent self.parent = parent
self.currentSizeIndex = None self.currentSizeIndex = None
self.optionChoosers = {}
DirectFrame.__init__(self, parent=self.parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0)) DirectFrame.__init__(self, parent=self.parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0))
@ -711,9 +713,9 @@ class ExtraOptionsTabPage(DirectFrame):
DirectFrame.destroy(self) DirectFrame.destroy(self)
def load(self): def load(self):
self.optionChoosers = {}
guiButton = loader.loadModel('phase_3/models/gui/quit_button') guiButton = loader.loadModel('phase_3/models/gui/quit_button')
circleModel = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_nameShop') circleModel = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_nameShop')
matGui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
titleHeight = 0.61 titleHeight = 0.61
textStartHeight = 0.45 textStartHeight = 0.45
textRowHeight = 0.145 textRowHeight = 0.145
@ -725,13 +727,11 @@ class ExtraOptionsTabPage(DirectFrame):
options_text_scale = 0.052 options_text_scale = 0.052
disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0) disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
button_image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')) button_image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR'))
arrow_image = (matGui.find('**/tt_t_gui_mat_shuffleArrowUp'), matGui.find('**/tt_t_gui_mat_shuffleArrowDown'))
self.speed_chat_scale = 0.055 self.speed_chat_scale = 0.055
self.fov_label = DirectLabel(parent=self, relief=None, text=TTLocalizer.FieldOfViewLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight)) self.fov_label = DirectLabel(parent=self, relief=None, text=TTLocalizer.FieldOfViewLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight))
self.speedchatPlus_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight)) self.speedchatPlus_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
self.trueFriends_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight)) self.trueFriends_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight))
self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 3 * textRowHeight)) self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 3 * textRowHeight))
self.nametagStyle_label = DirectLabel(parent=self, relief=None, text=TTLocalizer.NametagStyleLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 4 * textRowHeight))
self.fov_slider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord), self.fov_slider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord),
value=settings['fov'], pageSize=5, range=(ToontownGlobals.DefaultCameraFov, ToontownGlobals.MaxCameraFov), command=self.__doFov, value=settings['fov'], pageSize=5, range=(ToontownGlobals.DefaultCameraFov, ToontownGlobals.MaxCameraFov), command=self.__doFov,
thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2) thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2)
@ -739,15 +739,13 @@ class ExtraOptionsTabPage(DirectFrame):
self.speedchatPlus_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleSpeedchatPlus) self.speedchatPlus_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleSpeedchatPlus)
self.trueFriends_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleTrueFriends) self.trueFriends_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleTrueFriends)
self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 3 * textRowHeight), command=self.__doToggleCogInterface) self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 3 * textRowHeight), command=self.__doToggleCogInterface)
self.nametagStyle_name = DirectLabel(self, relief=None, text='', scale=0.06, text_wordwrap=9, pos=(buttonbase_xcoord, 0, textStartHeight - 4 * textRowHeight))
self.nametagStyle_leftButton = DirectButton(self, relief=None, image=arrow_image, scale=0.45, pos=(0.05, 0, textStartHeight - 4 * textRowHeight), command=self.__updateNametagIndex, extraArgs=[-1])
self.nametagStyle_rightButton = DirectButton(self, relief=None, image=arrow_image, scale=-0.45, pos=(0.65, 0, textStartHeight - 4 * textRowHeight), command=self.__updateNametagIndex, extraArgs=[1])
self.nametagStyle_index = -1
self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=button_image, image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1), self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=button_image, image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1),
command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045)) command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045))
guiButton.removeNode() guiButton.removeNode()
circleModel.removeNode() circleModel.removeNode()
matGui.removeNode()
self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 4, self.__updateFishingPole, [False], self.__applyFishingPole)
self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 5, self.__updateNametagStyle, [False], self.__applyNametagStyle)
def enter(self): def enter(self):
self.show() self.show()
@ -756,15 +754,17 @@ class ExtraOptionsTabPage(DirectFrame):
self.__setTrueFriendsButton() self.__setTrueFriendsButton()
self.__setCogInterfaceButton() self.__setCogInterfaceButton()
self.__updateNametagStyle() self.__updateNametagStyle()
self.__updateFishingPole()
self.accept('refreshNametagStyle', self.__updateNametagStyle) self.accept('refreshNametagStyle', self.__updateNametagStyle)
self.accept('refreshFishingRod', self.__updateFishingPole)
def exit(self): def exit(self):
self.ignoreAll() self.ignoreAll()
self.destroyReportNotice() self.destroyReportNotice()
self.hide() self.hide()
if self.nametagStyle_index != -1 and self.nametagStyle_index != base.localAvatar.nametagStyles.index(base.localAvatar.getNametagStyle()): for chooser in self.optionChoosers.values():
base.localAvatar.requestNametagStyle(base.localAvatar.nametagStyles[self.nametagStyle_index]) chooser.exit(chooser.index)
def unload(self): def unload(self):
self.fov_label.destroy() self.fov_label.destroy()
@ -777,8 +777,6 @@ class ExtraOptionsTabPage(DirectFrame):
del self.trueFriends_label del self.trueFriends_label
self.cogInterface_label.destroy() self.cogInterface_label.destroy()
del self.cogInterface_label del self.cogInterface_label
self.nametagStyle_label.destroy()
del self.nametagStyle_label
self.speedchatPlus_toggleButton.destroy() self.speedchatPlus_toggleButton.destroy()
del speedchatPlus_toggleButton del speedchatPlus_toggleButton
self.trueFriends_toggleButton.destroy() self.trueFriends_toggleButton.destroy()
@ -787,14 +785,11 @@ class ExtraOptionsTabPage(DirectFrame):
del self.cogInterface_toggleButton del self.cogInterface_toggleButton
self.bugReportButton.destroy() self.bugReportButton.destroy()
del self.bugReportButton del self.bugReportButton
self.nametagStyle_name.destroy()
del self.nametagStyle_name
self.nametagStyle_leftButton.destroy()
del self.nametagStyle_leftButton
self.nametagStyle_rightButton.destroy()
del self.nametagStyle_rightButton
self.destroyReportNotice() self.destroyReportNotice()
for chooser in self.optionChoosers.values():
optionChooser.unload()
def __doFov(self): def __doFov(self):
fov = self.fov_slider['value'] fov = self.fov_slider['value']
settings['fov'] = fov settings['fov'] = fov
@ -833,27 +828,33 @@ class ExtraOptionsTabPage(DirectFrame):
self.trueFriends_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['trueFriends'] else TTLocalizer.OptionsPageToggleOn self.trueFriends_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['trueFriends'] else TTLocalizer.OptionsPageToggleOn
def __updateNametagStyle(self, resetIndex=True): def __updateNametagStyle(self, resetIndex=True):
chooser = self.optionChoosers['nametag_style']
if resetIndex: if resetIndex:
self.nametagStyle_index = base.localAvatar.nametagStyles.index(base.localAvatar.getNametagStyle()) chooser.setIndex(base.localAvatar.nametagStyles.index(base.localAvatar.getNametagStyle()))
nametagId = base.localAvatar.nametagStyles[self.nametagStyle_index] nametagId = base.localAvatar.nametagStyles[chooser.index]
self.nametagStyle_name['text'] = base.localAvatar.getName() + '\n' + TTLocalizer.NametagFontNames[nametagId] chooser.setDisplayText('%s\n%s' % (base.localAvatar.getName(), TTLocalizer.NametagFontNames[nametagId]))
self.nametagStyle_name['text_font'] = ToontownGlobals.getNametagFont(nametagId) chooser.setDisplayFont(ToontownGlobals.getNametagFont(nametagId))
nametagCount = len(base.localAvatar.nametagStyles) chooser.decideButtons(0, len(base.localAvatar.nametagStyles) - 1)
if self.nametagStyle_index >= (nametagCount - 1): def __applyNametagStyle(self, index):
self.nametagStyle_rightButton.hide() if index != -1 and index != base.localAvatar.nametagStyles.index(base.localAvatar.getNametagStyle()):
else: base.localAvatar.requestNametagStyle(base.localAvatar.nametagStyles[index])
self.nametagStyle_rightButton.show()
if self.nametagStyle_index <= 0: def __updateFishingPole(self, resetIndex=True):
self.nametagStyle_leftButton.hide() chooser = self.optionChoosers['pole']
else:
self.nametagStyle_leftButton.show()
def __updateNametagIndex(self, offset): if resetIndex:
self.nametagStyle_index += offset print 'resetting index'
self.__updateNametagStyle(False) chooser.setIndex(base.localAvatar.getFishingRod())
chooser.setDisplayText(TTLocalizer.FishingRodNameDict[chooser.index])
chooser.decideButtons(0, base.localAvatar.maxFishingRod)
def __applyFishingPole(self, index):
if index != -1 and index != base.localAvatar.getFishingRod():
base.localAvatar.requestFishingRod(index)
def destroyReportNotice(self): def destroyReportNotice(self):
if hasattr(self, 'dialog'): if hasattr(self, 'dialog'):

View file

@ -867,10 +867,26 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
def setFishingRod(self, rodId): def setFishingRod(self, rodId):
self.fishingRod = rodId self.fishingRod = rodId
if self == base.localAvatar:
messenger.send('refreshFishingRod')
def getFishingRod(self): def getFishingRod(self):
return self.fishingRod return self.fishingRod
def setMaxFishingRod(self, rodId):
self.maxFishingRod = rodId
if self == base.localAvatar:
messenger.send('refreshFishingRod')
def getMaxFishingRod(self):
return self.maxFishingRod
def requestFishingRod(self, rodId):
if not 0 <= rodId <= self.maxFishingRod:
return
self.sendUpdate('requestFishingRod', [rodId])
def setFishingTrophies(self, trophyList): def setFishingTrophies(self, trophyList):
self.fishingTrophies = trophyList self.fishingTrophies = trophyList

View file

@ -1420,6 +1420,28 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def getFishingRod(self): def getFishingRod(self):
return self.fishingRod return self.fishingRod
def b_setMaxFishingRod(self, rodId):
if (not 0 <= rodId <= 4) or rodId <= self.maxFishingRod:
return
self.d_setMaxFishingRod(rodId)
self.setMaxFishingRod(rodId)
def d_setMaxFishingRod(self, rodId):
self.sendUpdate('setMaxFishingRod', [rodId])
def setMaxFishingRod(self, rodId):
self.maxFishingRod = rodId
def getMaxFishingRod(self):
return self.maxFishingRod
def requestFishingRod(self, rodId):
if not 0 <= rodId <= self.maxFishingRod:
return
self.b_setFishingRod(rodId)
def b_setFishingTrophies(self, trophyList): def b_setFishingTrophies(self, trophyList):
self.setFishingTrophies(trophyList) self.setFishingTrophies(trophyList)
self.d_setFishingTrophies(trophyList) self.d_setFishingTrophies(trophyList)
@ -3685,6 +3707,13 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def setNametagStyles(self, nametagStyles): def setNametagStyles(self, nametagStyles):
self.nametagStyles = nametagStyles self.nametagStyles = nametagStyles
def addNametagStyle(self, nametagStyle):
if nametagStyle in self.nametagStyles:
return
self.nametagStyles.append(nametagStyle)
self.b_setNametagStyles(self.nametagStyles)
def getNametagStyles(self): def getNametagStyles(self):
return self.nametagStyles return self.nametagStyles
@ -4378,6 +4407,7 @@ def fishingRod(rod):
return 'Rod value must be in xrange (0-4).' return 'Rod value must be in xrange (0-4).'
target = spellbook.getTarget() target = spellbook.getTarget()
target.b_setFishingRod(rod) target.b_setFishingRod(rod)
target.b_setMaxFishingRod(rod)
return "Set %s's fishing rod to %d!" % (target.getName(), rod) return "Set %s's fishing rod to %d!" % (target.getName(), rod)
@magicWord(category=CATEGORY_PROGRAMMER, types=[int]) @magicWord(category=CATEGORY_PROGRAMMER, types=[int])
@ -4863,10 +4893,8 @@ def nametagStyle(nametagStyle):
if nametagStyle >= len(TTLocalizer.NametagFontNames): if nametagStyle >= len(TTLocalizer.NametagFontNames):
return 'Invalid nametag style.' return 'Invalid nametag style.'
target = spellbook.getTarget() target = spellbook.getTarget()
if nametagStyle not in target.nametagStyles:
target.nametagStyles.append(nametagStyle)
target.b_setNametagStyles(target.nametagStyles)
target.b_setNametagStyle(nametagStyle) target.b_setNametagStyle(nametagStyle)
target.addNametagStyle(nametagStyle)
return 'Nametag style set to: %s.' % TTLocalizer.NametagFontNames[nametagStyle] return 'Nametag style set to: %s.' % TTLocalizer.NametagFontNames[nametagStyle]
@magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int]) @magicWord(category=CATEGORY_PROGRAMMER, types=[str, int, int])

View file

@ -283,6 +283,9 @@ class DistributedToonUD(DistributedObjectUD):
def setFishingRod(self, todo0): def setFishingRod(self, todo0):
pass pass
def setMaxFishingRod(self, todo0):
pass
def setFishingTrophies(self, todo0): def setFishingTrophies(self, todo0):
pass pass

View file

@ -8512,6 +8512,7 @@ TrueFriendsLabelOn = 'True Friends is on.'
TrueFriendsLabelOff = 'True Friends is off.' TrueFriendsLabelOff = 'True Friends is off.'
FieldOfViewLabel = 'Field of View:' FieldOfViewLabel = 'Field of View:'
NametagStyleLabel = 'Nametag Style:' NametagStyleLabel = 'Nametag Style:'
FishingPoleLabel = 'Fishing Rod:'
BossLocations = { BossLocations = {
'c': 'Bossbot Clubhouse\nBanquet', 'c': 'Bossbot Clubhouse\nBanquet',
'l': "Lawbot Courthouse\nBumpy Bumblebehr's Trial", 'l': "Lawbot Courthouse\nBumpy Bumblebehr's Trial",