diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 1e739ad1..3899febc 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -722,6 +722,7 @@ dclass DistributedToon : DistributedPlayer { forceLogoutWithNotify() ownrecv; setPinkSlips(uint8 = 0) required ownrecv db; setNametagStyle(uint8 = 0) required broadcast ownrecv db; + setNametagStyles(uint8[] = [0]) required broadcast ownrecv db; setMail(simpleMail []) ownrecv; setNumMailItems(uint32) airecv; setSimpleMailNotify(uint8) ownrecv airecv; @@ -742,6 +743,7 @@ dclass DistributedToon : DistributedPlayer { setTrueFriends(uint32[] = []) required clsend ownrecv db; setNextKnockHeal(uint32) ram airecv; setEPP(uint8[] = []) required ownrecv db; + requestNametagStyle(uint8) airecv ownsend; }; dclass DistributedPartyGate : DistributedObject { diff --git a/toontown/catalog/CatalogNametagItem.py b/toontown/catalog/CatalogNametagItem.py index f0796b66..0b07af99 100755 --- a/toontown/catalog/CatalogNametagItem.py +++ b/toontown/catalog/CatalogNametagItem.py @@ -17,11 +17,7 @@ class CatalogNametagItem(CatalogItem.CatalogItem): return 1 def reachedPurchaseLimit(self, avatar): - if self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder: - return 1 - if avatar.nametagStyle == self.nametagStyle: - return 1 - return 0 + return self in avatar.onOrder or self in avatar.mailboxContents or self in avatar.onGiftOrder or self.nametagStyle in avatar.nametagStyles def getAcceptItemErrorText(self, retcode): if retcode == ToontownGlobals.P_ItemAvailable: @@ -44,6 +40,8 @@ class CatalogNametagItem(CatalogItem.CatalogItem): def recordPurchase(self, avatar, optional): if avatar: + avatar.nametagStyles.append(self.nametagStyle) + avatar.b_setNametagStyles(avatar.nametagStyles) avatar.b_setNametagStyle(self.nametagStyle) return ToontownGlobals.P_ItemAvailable @@ -52,10 +50,7 @@ class CatalogNametagItem(CatalogItem.CatalogItem): def getPicture(self, avatar): 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) self.hasPicture = True return (frame, None) @@ -71,16 +66,6 @@ class CatalogNametagItem(CatalogItem.CatalogItem): def getBasePrice(self): 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): CatalogItem.CatalogItem.decodeDatagram(self, di, versionNumber, store) @@ -92,9 +77,6 @@ class CatalogNametagItem(CatalogItem.CatalogItem): dg.addUint16(self.nametagStyle) dg.addBool(self.isSpecial) - def isGift(self): - return 0 - def getBackSticky(self): itemType = 1 numSticky = 4 diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index ebe40404..1bfce8a9 100755 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -713,6 +713,7 @@ class ExtraOptionsTabPage(DirectFrame): def load(self): guiButton = loader.loadModel('phase_3/models/gui/quit_button') 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 textStartHeight = 0.45 textRowHeight = 0.145 @@ -724,11 +725,13 @@ class ExtraOptionsTabPage(DirectFrame): options_text_scale = 0.052 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')) + arrow_image = (matGui.find('**/tt_t_gui_mat_shuffleArrowUp'), matGui.find('**/tt_t_gui_mat_shuffleArrowDown')) 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.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.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), 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) @@ -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.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.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), command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045)) guiButton.removeNode() circleModel.removeNode() + matGui.removeNode() def enter(self): self.show() @@ -747,12 +755,17 @@ class ExtraOptionsTabPage(DirectFrame): self.__setSpeedchatPlusButton() self.__setTrueFriendsButton() self.__setCogInterfaceButton() + self.__updateNametagStyle() + self.accept('refreshNametagStyle', self.__updateNametagStyle) def exit(self): - self.ignore('confirmDone') + self.ignoreAll() self.destroyReportNotice() 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): self.fov_label.destroy() del self.fov_label @@ -764,8 +777,22 @@ class ExtraOptionsTabPage(DirectFrame): del self.trueFriends_label self.cogInterface_label.destroy() 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() 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() def __doFov(self): @@ -805,6 +832,28 @@ class ExtraOptionsTabPage(DirectFrame): self.trueFriends_label['text'] = TTLocalizer.TrueFriendsLabelOn if settings['trueFriends'] else TTLocalizer.TrueFriendsLabelOff 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): if hasattr(self, 'dialog'): self.dialog.destroy() diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 4ba1c770..f76edb17 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -1960,6 +1960,20 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute nametagStyle = 0 self.nametagStyle = nametagStyle 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): return '%s\n%s' % (self.getName(), self.doId) diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index f19a16ca..9e071657 100755 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -3672,6 +3672,25 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getNametagStyle(self): 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): self.d_setMail(mail) @@ -4837,10 +4856,12 @@ def getZone(): @magicWord(category=CATEGORY_MODERATOR, types=[int]) def nametagStyle(nametagStyle): - currentAccess = spellbook.getInvokerAccess() if nametagStyle >= len(TTLocalizer.NametagFontNames): return 'Invalid nametag style.' target = spellbook.getTarget() + if nametagStyle not in target.nametagStyles: + target.nametagStyles.append(nametagStyle) + target.b_setNametagStyles(target.nametagStyles) target.b_setNametagStyle(nametagStyle) return 'Nametag style set to: %s.' % TTLocalizer.NametagFontNames[nametagStyle] diff --git a/toontown/toon/DistributedToonUD.py b/toontown/toon/DistributedToonUD.py index 4bd6cb29..0ad3ff62 100755 --- a/toontown/toon/DistributedToonUD.py +++ b/toontown/toon/DistributedToonUD.py @@ -462,6 +462,9 @@ class DistributedToonUD(DistributedObjectUD): def setNametagStyle(self, todo0): pass + + def setNametagStyles(self, todo0): + return def setMail(self, todo0): pass diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 204215c2..80f05bfd 100755 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -168,6 +168,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): def setName(self, name): base.localAvatarName = name DistributedToon.DistributedToon.setName(self, name) + messenger.send('refreshNametagStyle') def wantLegacyLifter(self): return True diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index b4023062..0acfa56c 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8506,6 +8506,7 @@ SpeedchatPlusLabelOff = 'Speedchat Plus is off.' TrueFriendsLabelOn = 'True Friends is on.' TrueFriendsLabelOff = 'True Friends is off.' FieldOfViewLabel = 'Field of View:' +NametagStyleLabel = 'Nametag Style:' BossLocations = { 'c': 'Bossbot Clubhouse\nBanquet', 'l': "Lawbot Courthouse\nBumpy Bumblebehr's Trial",