From b8ef66621fb5f4cab87e1a384dfd26c6cf164df5 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 14 Aug 2015 00:31:23 +0300 Subject: [PATCH] CHAT_SETTINGS Account dc field --- dependencies/astron/dclass/stride.dc | 3 +- dependencies/config/release/dev.prc | 3 +- otp/avatar/Avatar.py | 6 +-- otp/chat/WhiteList.py | 6 ++- otp/distributed/OTPClientRepository.py | 12 +++++ otp/nametag/NametagConstants.py | 2 +- toontown/chat/ToontownChatManager.py | 8 +-- toontown/friends/FriendHandle.py | 4 +- toontown/friends/ToontownFriendSecret.py | 2 +- toontown/shtiker/OptionsPage.py | 54 +++++---------------- toontown/toon/DistributedToon.py | 10 +++- toontown/toonbase/TTLocalizerEnglish.py | 4 -- toontown/toonbase/ToontownStart.py | 4 -- toontown/uberdog/ClientServicesManager.py | 3 +- toontown/uberdog/ClientServicesManagerUD.py | 5 +- 15 files changed, 56 insertions(+), 70 deletions(-) diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index c52391d7..bc053e3c 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -32,6 +32,7 @@ dclass Account { string ACCOUNT_ID db; uint16 ACCESS_LEVEL db; uint32 LAST_LOGIN_TS db; + uint8[] CHAT_SETTINGS db; }; struct BarrierData { @@ -3154,7 +3155,7 @@ dclass ClientServicesManager : DistributedObjectGlobal { acceptLogin(uint32 timestamp); requestAvatars() clsend; - setAvatars(PotentialToon[]); + setAvatars(uint8[], PotentialToon[]); createAvatar(blob dna, uint8 index) clsend; createAvatarResp(uint32 avId); diff --git a/dependencies/config/release/dev.prc b/dependencies/config/release/dev.prc index a3d97d2a..8aa75ff8 100644 --- a/dependencies/config/release/dev.prc +++ b/dependencies/config/release/dev.prc @@ -33,7 +33,8 @@ want-gifting #t want-top-toons #f # Chat: -want-whitelist #t +want-whitelist #f +want-sequence-list #f # Developer options: show-population #t diff --git a/otp/avatar/Avatar.py b/otp/avatar/Avatar.py index 2b708a8c..d9db1a27 100755 --- a/otp/avatar/Avatar.py +++ b/otp/avatar/Avatar.py @@ -116,16 +116,16 @@ class Avatar(Actor, ShadowCaster): elif self.playerType not in (NametagGroup.CCNormal, NametagGroup.CCSpeedChat): self.understandable = 1 self.setPlayerType(NametagGroup.CCNonPlayer) - elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId): + elif base.localAvatar.isTrueFriends(self.doId): self.understandable = 2 self.setPlayerType(NametagGroup.CCNormal) - elif settings['speedchatPlus']: + elif base.cr.wantSpeedchatPlus(): self.understandable = 1 self.setPlayerType(NametagGroup.CCSpeedChat) else: self.understandable = 0 self.setPlayerType(NametagGroup.CCSpeedChat) - if hasattr(self, 'adminAccess') and self.isAdmin(): + if base.cr.wantSpeedchatPlus() and hasattr(self, 'adminAccess') and self.isAdmin() and self != base.localAvatar: self.understandable = 2 if not hasattr(self, 'nametag'): self.notify.warning('no nametag attributed, but would have been used') diff --git a/otp/chat/WhiteList.py b/otp/chat/WhiteList.py index 6538ce77..4a513f89 100755 --- a/otp/chat/WhiteList.py +++ b/otp/chat/WhiteList.py @@ -29,7 +29,11 @@ class WhiteList: return i != self.numWords and self.words[i].startswith(text) def getReplacement(self, text, av=None, garbler=None): - return '\x01WLRed\x01%s\x02' % text if not garbler else garbler.garble(av, len(text.split(' '))) + if av and av == base.localAvatar: + return '\x01WLDisplay\x01%s\x02' % text + elif not garbler: + return '\x01WLRed\x01%s\x02' % text + return garbler.garble(av, len(text.split(' '))) def processText(self, text, av=None, garbler=None): if not self.words: diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 1dd5c298..8bce5800 100755 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -693,6 +693,18 @@ class OTPClientRepository(ClientRepositoryBase): def handleAvatarsList(self, avatars): self.avList = avatars self.loginFSM.request('chooseAvatar', [self.avList]) + + def handleChatSettings(self, chatSettings): + self.chatSettings = chatSettings + + def wantSpeedchatPlus(self): + return self.chatSettings[0] + + def wantTrueFriends(self): + return self.chatSettings[1] + + def wantTypedChat(self): + return self.wantSpeedchatPlus() or self.wantTrueFriends() @report(types=['args', 'deltaStamp'], dConfigParam='teleport') def enterChooseAvatar(self, avList): diff --git a/otp/nametag/NametagConstants.py b/otp/nametag/NametagConstants.py index 21585963..38307453 100644 --- a/otp/nametag/NametagConstants.py +++ b/otp/nametag/NametagConstants.py @@ -202,4 +202,4 @@ WHISPER_COLORS = { } def getFriendColor(handle): - return CCNormal if settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat \ No newline at end of file + return CCNormal if base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat \ No newline at end of file diff --git a/toontown/chat/ToontownChatManager.py b/toontown/chat/ToontownChatManager.py index 8899697a..9140244c 100755 --- a/toontown/chat/ToontownChatManager.py +++ b/toontown/chat/ToontownChatManager.py @@ -110,7 +110,7 @@ class ToontownChatManager(ChatManager.ChatManager): if base.config.GetBool('want-qa-regression', 0): self.notify.info('QA-REGRESSION: CHAT: Speedchat Plus') messenger.send('wakeup') - if not settings['trueFriends'] and not settings['speedchatPlus']: + if not base.cr.wantTypedChat(): self.fsm.request('noSpeedchatPlus') return self.fsm.request('normalChat') @@ -124,7 +124,7 @@ class ToontownChatManager(ChatManager.ChatManager): def __whisperButtonPressed(self, avatarName, avatarId): messenger.send('wakeup') - if not settings['trueFriends'] and not settings['speedchatPlus']: + if not base.cr.wantTypedChat(): self.fsm.request('noSpeedchatPlus') return if avatarId: @@ -133,7 +133,7 @@ class ToontownChatManager(ChatManager.ChatManager): return def enterNormalChat(self): - if not settings['trueFriends'] and not settings['speedchatPlus']: + if not base.cr.wantTypedChat(): self.fsm.request('mainMenu') return result = ChatManager.ChatManager.enterNormalChat(self) @@ -142,7 +142,7 @@ class ToontownChatManager(ChatManager.ChatManager): self.fsm.request('mainMenu') def enterWhisperChat(self, avatarName, avatarId): - if not settings['trueFriends'] and not settings['speedchatPlus']: + if not base.cr.wantTypedChat(): self.fsm.request('mainMenu') return result = ChatManager.ChatManager.enterWhisperChat(self, avatarName, avatarId) diff --git a/toontown/friends/FriendHandle.py b/toontown/friends/FriendHandle.py index 18d6261f..69c2c760 100755 --- a/toontown/friends/FriendHandle.py +++ b/toontown/friends/FriendHandle.py @@ -66,8 +66,8 @@ class FriendHandle: base.cr.ttsFriendsManager.d_teleportGiveup(self.doId) def isUnderstandable(self): - if settings['speedchatPlus']: + if base.cr.wantTypedChat(): return 1 - elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId): + elif base.localAvatar.isTrueFriends(self.doId): return 1 return 0 diff --git a/toontown/friends/ToontownFriendSecret.py b/toontown/friends/ToontownFriendSecret.py index 1635a3c5..eb7abff1 100644 --- a/toontown/friends/ToontownFriendSecret.py +++ b/toontown/friends/ToontownFriendSecret.py @@ -8,7 +8,7 @@ globalFriendSecret = None def showFriendSecret(): global globalFriendSecret - if not settings['trueFriends']: + if not base.cr.wantTrueFriends(): chatMgr = base.localAvatar.chatMgr chatMgr.fsm.request('noTrueFriends') else: diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index 6da309cb..311767fb 100755 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -729,31 +729,25 @@ class ExtraOptionsTabPage(DirectFrame): button_image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')) 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.tpTransition_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 4 * 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 - textRowHeight)) + self.tpTransition_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.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) self.fov_slider.setScale(0.25) - 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.tpTransition_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 - 4 * textRowHeight), command=self.__doToggleTpTransition) + 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 - textRowHeight), command=self.__doToggleCogInterface) + self.tpTransition_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.__doToggleTpTransition) 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() - self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 5, self.__updateFishingPole, [False], self.__applyFishingPole) - self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 6, self.__updateNametagStyle, [False], self.__applyNametagStyle) + self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 3, self.__updateFishingPole, [False], self.__applyFishingPole) + self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 4, self.__updateNametagStyle, [False], self.__applyNametagStyle) def enter(self): self.show() self.settingsChanged = 0 - self.__setSpeedchatPlusButton() - self.__setTrueFriendsButton() self.__setCogInterfaceButton() self.__setTpTransitionButton() self.__updateNametagStyle() @@ -774,18 +768,14 @@ class ExtraOptionsTabPage(DirectFrame): del self.fov_label self.fov_slider.destroy() del self.fov_slider - self.speedchatPlus_label.destroy() - del self.speedchatPlus_label - self.trueFriends_label.destroy() - del self.trueFriends_label self.cogInterface_label.destroy() del self.cogInterface_label - self.speedchatPlus_toggleButton.destroy() - del speedchatPlus_toggleButton - self.trueFriends_toggleButton.destroy() - del self.trueFriends_toggleButton self.cogInterface_toggleButton.destroy() - del self.cogInterface_toggleButton + del self.cogInterface_label + self.tpTransition_label.destroy() + del self.tpTransition_label + self.tpTransition_toggleButton.destroy() + del self.tpTransition_toggleButton self.bugReportButton.destroy() del self.bugReportButton self.destroyReportNotice() @@ -808,28 +798,6 @@ class ExtraOptionsTabPage(DirectFrame): self.cogInterface_label['text'] = TTLocalizer.CogInterfaceLabelOn if settings['cogInterface'] else TTLocalizer.CogInterfaceLabelOff self.cogInterface_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogInterface'] else TTLocalizer.OptionsPageToggleOn - def __doToggleSpeedchatPlus(self): - messenger.send('wakeup') - settings['speedchatPlus'] = not settings['speedchatPlus'] - Toon.reconsiderAllToonsUnderstandable() - self.settingsChanged = 1 - self.__setSpeedchatPlusButton() - - def __setSpeedchatPlusButton(self): - self.speedchatPlus_label['text'] = TTLocalizer.SpeedchatPlusLabelOn if settings['speedchatPlus'] else TTLocalizer.SpeedchatPlusLabelOff - self.speedchatPlus_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['speedchatPlus'] else TTLocalizer.OptionsPageToggleOn - - def __doToggleTrueFriends(self): - messenger.send('wakeup') - settings['trueFriends'] = not settings['trueFriends'] - Toon.reconsiderAllToonsUnderstandable() - self.settingsChanged = 1 - self.__setTrueFriendsButton() - - def __setTrueFriendsButton(self): - 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 __doToggleTpTransition(self): messenger.send('wakeup') settings['tpTransition'] = not settings['tpTransition'] diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 560b8354..8769d196 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -2382,13 +2382,19 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def addReport(self, doId): if not self.isReported(doId): self.reported.append(doId) + + def setFriendsList(self, friendsList): + DistributedPlayer.DistributedPlayer.setFriendsList(self, friendsList) + messenger.send('friendsListChanged') + Toon.reconsiderAllToonsUnderstandable() def setTrueFriends(self, trueFriends): - Toon.reconsiderAllToonsUnderstandable() self.trueFriends = trueFriends + Toon.reconsiderAllToonsUnderstandable() + messenger.send('friendsListChanged') def isTrueFriends(self, doId): - return doId in self.trueFriends + return base.cr.wantTrueFriends() and doId in self.trueFriends def applyBuffs(self): for id, timestamp in enumerate(self.buffs): diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 8e997196..841a4d16 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8534,10 +8534,6 @@ BugReportNotice = 'Attention!\n\nThis button will open a browser which will send CodeRedemptionWarning = 'NOTICE: All codes can only be entered once!' CogInterfaceLabelOn = 'The cog battle interface is on.' CogInterfaceLabelOff = 'The cog battle interface is off.' -SpeedchatPlusLabelOn = 'Speedchat Plus is on.' -SpeedchatPlusLabelOff = 'Speedchat Plus is off.' -TrueFriendsLabelOn = 'True Friends is on.' -TrueFriendsLabelOff = 'True Friends is off.' TpTransitionLabelOn = 'The teleport transition is on.' TpTransitionLabelOff = 'The teleport transition is off.' FieldOfViewLabel = 'Field of View:' diff --git a/toontown/toonbase/ToontownStart.py b/toontown/toonbase/ToontownStart.py index ba86dacf..af820b4a 100644 --- a/toontown/toonbase/ToontownStart.py +++ b/toontown/toonbase/ToontownStart.py @@ -98,10 +98,6 @@ if 'language' not in settings: settings['language'] = 'English' if 'cogInterface' not in settings: settings['cogInterface'] = True -if 'speedchatPlus' not in settings: - settings['speedchatPlus'] = True -if 'trueFriends' not in settings: - settings['trueFriends'] = True if 'tpTransition' not in settings: settings['tpTransition'] = True if 'fov' not in settings: diff --git a/toontown/uberdog/ClientServicesManager.py b/toontown/uberdog/ClientServicesManager.py index eaec83bc..2e74d11e 100755 --- a/toontown/uberdog/ClientServicesManager.py +++ b/toontown/uberdog/ClientServicesManager.py @@ -35,7 +35,7 @@ class ClientServicesManager(DistributedObjectGlobal): def requestAvatars(self): self.sendUpdate('requestAvatars') - def setAvatars(self, avatars): + def setAvatars(self, chatSettings, avatars): avList = [] for avNum, avName, avDNA, avPosition, nameState in avatars: nameOpen = int(nameState == 1) @@ -48,6 +48,7 @@ class ClientServicesManager(DistributedObjectGlobal): names[3] = avName avList.append(PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen)) + self.cr.handleChatSettings(chatSettings) self.cr.handleAvatarsList(avList) # --- AVATAR CREATION/DELETION --- diff --git a/toontown/uberdog/ClientServicesManagerUD.py b/toontown/uberdog/ClientServicesManagerUD.py index 462b59d2..a4702faf 100755 --- a/toontown/uberdog/ClientServicesManagerUD.py +++ b/toontown/uberdog/ClientServicesManagerUD.py @@ -333,7 +333,8 @@ class LoginAccountFSM(OperationFSM): 'LAST_LOGIN': time.ctime(), 'LAST_LOGIN_TS': time.time(), 'ACCOUNT_ID': str(self.userId), - 'ACCESS_LEVEL': self.accessLevel + 'ACCESS_LEVEL': self.accessLevel, + 'CHAT_SETTINGS': [1, 1] } self.csm.air.dbInterface.createObject( self.csm.air.dbId, @@ -645,7 +646,7 @@ class GetAvatarsFSM(AvatarOperationFSM): potentialAvs.append([avId, name, fields['setDNAString'][0], index, nameState]) - self.csm.sendUpdateToAccountId(self.target, 'setAvatars', [potentialAvs]) + self.csm.sendUpdateToAccountId(self.target, 'setAvatars', [self.account['CHAT_SETTINGS'], potentialAvs]) self.demand('Off') def enterQueryNameState(self):