You can now buy any nametag style, the game will store it. Changeable in the shticker book!

This commit is contained in:
John 2015-07-18 00:25:20 +03:00
parent 72e4dc11ad
commit a17151ef96
8 changed files with 97 additions and 24 deletions

View file

@ -722,6 +722,7 @@ dclass DistributedToon : DistributedPlayer {
forceLogoutWithNotify() ownrecv; forceLogoutWithNotify() ownrecv;
setPinkSlips(uint8 = 0) required ownrecv db; setPinkSlips(uint8 = 0) required ownrecv db;
setNametagStyle(uint8 = 0) required broadcast ownrecv db; setNametagStyle(uint8 = 0) required broadcast ownrecv db;
setNametagStyles(uint8[] = [0]) required broadcast ownrecv db;
setMail(simpleMail []) ownrecv; setMail(simpleMail []) ownrecv;
setNumMailItems(uint32) airecv; setNumMailItems(uint32) airecv;
setSimpleMailNotify(uint8) ownrecv airecv; setSimpleMailNotify(uint8) ownrecv airecv;
@ -742,6 +743,7 @@ dclass DistributedToon : DistributedPlayer {
setTrueFriends(uint32[] = []) required clsend ownrecv db; setTrueFriends(uint32[] = []) required clsend ownrecv db;
setNextKnockHeal(uint32) ram airecv; setNextKnockHeal(uint32) ram airecv;
setEPP(uint8[] = []) required ownrecv db; setEPP(uint8[] = []) required ownrecv db;
requestNametagStyle(uint8) airecv ownsend;
}; };
dclass DistributedPartyGate : DistributedObject { dclass DistributedPartyGate : DistributedObject {

View file

@ -17,11 +17,7 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
return 1 return 1
def reachedPurchaseLimit(self, avatar): def reachedPurchaseLimit(self, avatar):
if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder: return self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self.nametagStyle in avatar.nametagStyles
return 1
if avatar.nametagStyle == self.nametagStyle:
return 1
return 0
def getAcceptItemErrorText(self, retcode): def getAcceptItemErrorText(self, retcode):
if retcode == ToontownGlobals.P_ItemAvailable: if retcode == ToontownGlobals.P_ItemAvailable:
@ -44,6 +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)
return ToontownGlobals.P_ItemAvailable return ToontownGlobals.P_ItemAvailable
@ -52,9 +50,6 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
def getPicture(self, avatar): def getPicture(self, avatar):
frame = self.makeFrame() frame = self.makeFrame()
if self.nametagStyle == 100:
inFont = ToontownGlobals.getToonFont()
else:
inFont = ToontownGlobals.getNametagFont(self.nametagStyle) inFont = ToontownGlobals.getNametagFont(self.nametagStyle)
nameTagDemo = DirectLabel(parent=frame, relief=None, pos=(0, 0, 0.24), scale=0.5, text=base.localAvatar.getName(), text_fg=(1.0, 1.0, 1.0, 1), text_shadow=(0, 0, 0, 1), text_font=inFont, text_wordwrap=9) nameTagDemo = DirectLabel(parent=frame, relief=None, pos=(0, 0, 0.24), scale=0.5, text=base.localAvatar.getName(), text_fg=(1.0, 1.0, 1.0, 1), text_shadow=(0, 0, 0, 1), text_font=inFont, text_wordwrap=9)
self.hasPicture = True self.hasPicture = True
@ -71,16 +66,6 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
def getBasePrice(self): def getBasePrice(self):
return 500 return 500
cost = 500
if self.nametagStyle == 0:
cost = 600
elif self.nametagStyle == 1:
cost = 600
elif self.nametagStyle == 2:
cost = 600
elif self.nametagStyle == 100:
cost = 50
return cost
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)
@ -92,9 +77,6 @@ class CatalogNametagItem(CatalogItem.CatalogItem):
dg.addUint16(self.nametagStyle) dg.addUint16(self.nametagStyle)
dg.addBool(self.isSpecial) dg.addBool(self.isSpecial)
def isGift(self):
return 0
def getBackSticky(self): def getBackSticky(self):
itemType = 1 itemType = 1
numSticky = 4 numSticky = 4

View file

@ -713,6 +713,7 @@ class ExtraOptionsTabPage(DirectFrame):
def load(self): def load(self):
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
@ -724,11 +725,13 @@ 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)
@ -736,10 +739,15 @@ 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()
def enter(self): def enter(self):
self.show() self.show()
@ -747,12 +755,17 @@ class ExtraOptionsTabPage(DirectFrame):
self.__setSpeedchatPlusButton() self.__setSpeedchatPlusButton()
self.__setTrueFriendsButton() self.__setTrueFriendsButton()
self.__setCogInterfaceButton() self.__setCogInterfaceButton()
self.__updateNametagStyle()
self.accept('refreshNametagStyle', self.__updateNametagStyle)
def exit(self): def exit(self):
self.ignore('confirmDone') 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()):
base.localAvatar.requestNametagStyle(base.localAvatar.nametagStyles[self.nametagStyle_index])
def unload(self): def unload(self):
self.fov_label.destroy() self.fov_label.destroy()
del self.fov_label del self.fov_label
@ -764,8 +777,22 @@ 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()
del speedchatPlus_toggleButton
self.trueFriends_toggleButton.destroy()
del self.trueFriends_toggleButton
self.cogInterface_toggleButton.destroy() self.cogInterface_toggleButton.destroy()
del self.cogInterface_toggleButton del self.cogInterface_toggleButton
self.bugReportButton.destroy()
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()
def __doFov(self): def __doFov(self):
@ -805,6 +832,28 @@ class ExtraOptionsTabPage(DirectFrame):
self.trueFriends_label['text'] = TTLocalizer.TrueFriendsLabelOn if settings['trueFriends'] else TTLocalizer.TrueFriendsLabelOff self.trueFriends_label['text'] = TTLocalizer.TrueFriendsLabelOn if settings['trueFriends'] else TTLocalizer.TrueFriendsLabelOff
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):
if resetIndex:
self.nametagStyle_index = base.localAvatar.nametagStyles.index(base.localAvatar.getNametagStyle())
self.nametagStyle_name['text'] = base.localAvatar.getName()
self.nametagStyle_name['text_font'] = ToontownGlobals.getNametagFont(base.localAvatar.nametagStyles[self.nametagStyle_index])
nametagCount = len(base.localAvatar.nametagStyles)
if self.nametagStyle_index >= (nametagCount - 1):
self.nametagStyle_rightButton.hide()
else:
self.nametagStyle_rightButton.show()
if self.nametagStyle_index <= 0:
self.nametagStyle_leftButton.hide()
else:
self.nametagStyle_leftButton.show()
def __updateNametagIndex(self, offset):
self.nametagStyle_index += offset
self.__updateNametagStyle(False)
def destroyReportNotice(self): def destroyReportNotice(self):
if hasattr(self, 'dialog'): if hasattr(self, 'dialog'):
self.dialog.destroy() self.dialog.destroy()

View file

@ -1961,6 +1961,20 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
self.nametagStyle = nametagStyle self.nametagStyle = nametagStyle
self.setDisplayName(self.getName()) self.setDisplayName(self.getName())
def getNametagStyles(self):
return self.nametagStyles
def setNametagStyles(self, nametagStyles):
self.nametagStyles = nametagStyles
if self == base.localAvatar:
messenger.send('refreshNametagStyle')
def requestNametagStyle(self, nametagStyle):
if nametagStyle not in self.nametagStyles:
return
self.sendUpdate('requestNametagStyle', [nametagStyle])
def getAvIdName(self): def getAvIdName(self):
return '%s\n%s' % (self.getName(), self.doId) return '%s\n%s' % (self.getName(), self.doId)

View file

@ -3673,6 +3673,25 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def getNametagStyle(self): def getNametagStyle(self):
return self.nametagStyle return self.nametagStyle
def b_setNametagStyles(self, nametagStyles):
self.d_setNametagStyles(nametagStyles)
self.setNametagStyles(nametagStyles)
def d_setNametagStyles(self, nametagStyles):
self.sendUpdate('setNametagStyles', [nametagStyles])
def setNametagStyles(self, nametagStyles):
self.nametagStyles = nametagStyles
def getNametagStyles(self):
return self.nametagStyles
def requestNametagStyle(self, nametagStyle):
if nametagStyle not in self.nametagStyles:
return
self.b_setNametagStyle(nametagStyle)
def b_setMail(self, mail): def b_setMail(self, mail):
self.d_setMail(mail) self.d_setMail(mail)
self.setMail(mail) self.setMail(mail)
@ -4837,10 +4856,12 @@ def getZone():
@magicWord(category=CATEGORY_MODERATOR, types=[int]) @magicWord(category=CATEGORY_MODERATOR, types=[int])
def nametagStyle(nametagStyle): def nametagStyle(nametagStyle):
currentAccess = spellbook.getInvokerAccess()
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)
return 'Nametag style set to: %s.' % TTLocalizer.NametagFontNames[nametagStyle] return 'Nametag style set to: %s.' % TTLocalizer.NametagFontNames[nametagStyle]

View file

@ -463,6 +463,9 @@ class DistributedToonUD(DistributedObjectUD):
def setNametagStyle(self, todo0): def setNametagStyle(self, todo0):
pass pass
def setNametagStyles(self, todo0):
return
def setMail(self, todo0): def setMail(self, todo0):
pass pass

View file

@ -168,6 +168,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
def setName(self, name): def setName(self, name):
base.localAvatarName = name base.localAvatarName = name
DistributedToon.DistributedToon.setName(self, name) DistributedToon.DistributedToon.setName(self, name)
messenger.send('refreshNametagStyle')
def wantLegacyLifter(self): def wantLegacyLifter(self):
return True return True

View file

@ -8506,6 +8506,7 @@ SpeedchatPlusLabelOff = 'Speedchat Plus is off.'
TrueFriendsLabelOn = 'True Friends is on.' 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:'
BossLocations = { BossLocations = {
'c': 'Bossbot Clubhouse\nBanquet', 'c': 'Bossbot Clubhouse\nBanquet',
'l': "Lawbot Courthouse\nBumpy Bumblebehr's Trial", 'l': "Lawbot Courthouse\nBumpy Bumblebehr's Trial",