CHAT_SETTINGS Account dc field

This commit is contained in:
John 2015-08-14 00:31:23 +03:00
parent be54eb19df
commit b8ef66621f
15 changed files with 56 additions and 70 deletions

View file

@ -32,6 +32,7 @@ dclass Account {
string ACCOUNT_ID db; string ACCOUNT_ID db;
uint16 ACCESS_LEVEL db; uint16 ACCESS_LEVEL db;
uint32 LAST_LOGIN_TS db; uint32 LAST_LOGIN_TS db;
uint8[] CHAT_SETTINGS db;
}; };
struct BarrierData { struct BarrierData {
@ -3154,7 +3155,7 @@ dclass ClientServicesManager : DistributedObjectGlobal {
acceptLogin(uint32 timestamp); acceptLogin(uint32 timestamp);
requestAvatars() clsend; requestAvatars() clsend;
setAvatars(PotentialToon[]); setAvatars(uint8[], PotentialToon[]);
createAvatar(blob dna, uint8 index) clsend; createAvatar(blob dna, uint8 index) clsend;
createAvatarResp(uint32 avId); createAvatarResp(uint32 avId);

View file

@ -33,7 +33,8 @@ want-gifting #t
want-top-toons #f want-top-toons #f
# Chat: # Chat:
want-whitelist #t want-whitelist #f
want-sequence-list #f
# Developer options: # Developer options:
show-population #t show-population #t

View file

@ -116,16 +116,16 @@ class Avatar(Actor, ShadowCaster):
elif self.playerType not in (NametagGroup.CCNormal, NametagGroup.CCSpeedChat): elif self.playerType not in (NametagGroup.CCNormal, NametagGroup.CCSpeedChat):
self.understandable = 1 self.understandable = 1
self.setPlayerType(NametagGroup.CCNonPlayer) self.setPlayerType(NametagGroup.CCNonPlayer)
elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId): elif base.localAvatar.isTrueFriends(self.doId):
self.understandable = 2 self.understandable = 2
self.setPlayerType(NametagGroup.CCNormal) self.setPlayerType(NametagGroup.CCNormal)
elif settings['speedchatPlus']: elif base.cr.wantSpeedchatPlus():
self.understandable = 1 self.understandable = 1
self.setPlayerType(NametagGroup.CCSpeedChat) self.setPlayerType(NametagGroup.CCSpeedChat)
else: else:
self.understandable = 0 self.understandable = 0
self.setPlayerType(NametagGroup.CCSpeedChat) 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 self.understandable = 2
if not hasattr(self, 'nametag'): if not hasattr(self, 'nametag'):
self.notify.warning('no nametag attributed, but would have been used') self.notify.warning('no nametag attributed, but would have been used')

View file

@ -29,7 +29,11 @@ class WhiteList:
return i != self.numWords and self.words[i].startswith(text) return i != self.numWords and self.words[i].startswith(text)
def getReplacement(self, text, av=None, garbler=None): 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): def processText(self, text, av=None, garbler=None):
if not self.words: if not self.words:

View file

@ -694,6 +694,18 @@ class OTPClientRepository(ClientRepositoryBase):
self.avList = avatars self.avList = avatars
self.loginFSM.request('chooseAvatar', [self.avList]) 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') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterChooseAvatar(self, avList): def enterChooseAvatar(self, avList):
pass pass

View file

@ -202,4 +202,4 @@ WHISPER_COLORS = {
} }
def getFriendColor(handle): def getFriendColor(handle):
return CCNormal if settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat return CCNormal if base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat

View file

@ -110,7 +110,7 @@ class ToontownChatManager(ChatManager.ChatManager):
if base.config.GetBool('want-qa-regression', 0): if base.config.GetBool('want-qa-regression', 0):
self.notify.info('QA-REGRESSION: CHAT: Speedchat Plus') self.notify.info('QA-REGRESSION: CHAT: Speedchat Plus')
messenger.send('wakeup') messenger.send('wakeup')
if not settings['trueFriends'] and not settings['speedchatPlus']: if not base.cr.wantTypedChat():
self.fsm.request('noSpeedchatPlus') self.fsm.request('noSpeedchatPlus')
return return
self.fsm.request('normalChat') self.fsm.request('normalChat')
@ -124,7 +124,7 @@ class ToontownChatManager(ChatManager.ChatManager):
def __whisperButtonPressed(self, avatarName, avatarId): def __whisperButtonPressed(self, avatarName, avatarId):
messenger.send('wakeup') messenger.send('wakeup')
if not settings['trueFriends'] and not settings['speedchatPlus']: if not base.cr.wantTypedChat():
self.fsm.request('noSpeedchatPlus') self.fsm.request('noSpeedchatPlus')
return return
if avatarId: if avatarId:
@ -133,7 +133,7 @@ class ToontownChatManager(ChatManager.ChatManager):
return return
def enterNormalChat(self): def enterNormalChat(self):
if not settings['trueFriends'] and not settings['speedchatPlus']: if not base.cr.wantTypedChat():
self.fsm.request('mainMenu') self.fsm.request('mainMenu')
return return
result = ChatManager.ChatManager.enterNormalChat(self) result = ChatManager.ChatManager.enterNormalChat(self)
@ -142,7 +142,7 @@ class ToontownChatManager(ChatManager.ChatManager):
self.fsm.request('mainMenu') self.fsm.request('mainMenu')
def enterWhisperChat(self, avatarName, avatarId): def enterWhisperChat(self, avatarName, avatarId):
if not settings['trueFriends'] and not settings['speedchatPlus']: if not base.cr.wantTypedChat():
self.fsm.request('mainMenu') self.fsm.request('mainMenu')
return return
result = ChatManager.ChatManager.enterWhisperChat(self, avatarName, avatarId) result = ChatManager.ChatManager.enterWhisperChat(self, avatarName, avatarId)

View file

@ -66,8 +66,8 @@ class FriendHandle:
base.cr.ttsFriendsManager.d_teleportGiveup(self.doId) base.cr.ttsFriendsManager.d_teleportGiveup(self.doId)
def isUnderstandable(self): def isUnderstandable(self):
if settings['speedchatPlus']: if base.cr.wantTypedChat():
return 1 return 1
elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId): elif base.localAvatar.isTrueFriends(self.doId):
return 1 return 1
return 0 return 0

View file

@ -8,7 +8,7 @@ globalFriendSecret = None
def showFriendSecret(): def showFriendSecret():
global globalFriendSecret global globalFriendSecret
if not settings['trueFriends']: if not base.cr.wantTrueFriends():
chatMgr = base.localAvatar.chatMgr chatMgr = base.localAvatar.chatMgr
chatMgr.fsm.request('noTrueFriends') chatMgr.fsm.request('noTrueFriends')
else: else:

View file

@ -729,31 +729,25 @@ class ExtraOptionsTabPage(DirectFrame):
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'))
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.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.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.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.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.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)
self.fov_slider.setScale(0.25) 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.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.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.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.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.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()
self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 5, self.__updateFishingPole, [False], self.__applyFishingPole) self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 3, self.__updateFishingPole, [False], self.__applyFishingPole)
self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 6, self.__updateNametagStyle, [False], self.__applyNametagStyle) self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 4, self.__updateNametagStyle, [False], self.__applyNametagStyle)
def enter(self): def enter(self):
self.show() self.show()
self.settingsChanged = 0 self.settingsChanged = 0
self.__setSpeedchatPlusButton()
self.__setTrueFriendsButton()
self.__setCogInterfaceButton() self.__setCogInterfaceButton()
self.__setTpTransitionButton() self.__setTpTransitionButton()
self.__updateNametagStyle() self.__updateNametagStyle()
@ -774,18 +768,14 @@ class ExtraOptionsTabPage(DirectFrame):
del self.fov_label del self.fov_label
self.fov_slider.destroy() self.fov_slider.destroy()
del self.fov_slider del self.fov_slider
self.speedchatPlus_label.destroy()
del self.speedchatPlus_label
self.trueFriends_label.destroy()
del self.trueFriends_label
self.cogInterface_label.destroy() self.cogInterface_label.destroy()
del self.cogInterface_label del self.cogInterface_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_label
self.tpTransition_label.destroy()
del self.tpTransition_label
self.tpTransition_toggleButton.destroy()
del self.tpTransition_toggleButton
self.bugReportButton.destroy() self.bugReportButton.destroy()
del self.bugReportButton del self.bugReportButton
self.destroyReportNotice() self.destroyReportNotice()
@ -808,28 +798,6 @@ class ExtraOptionsTabPage(DirectFrame):
self.cogInterface_label['text'] = TTLocalizer.CogInterfaceLabelOn if settings['cogInterface'] else TTLocalizer.CogInterfaceLabelOff self.cogInterface_label['text'] = TTLocalizer.CogInterfaceLabelOn if settings['cogInterface'] else TTLocalizer.CogInterfaceLabelOff
self.cogInterface_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogInterface'] else TTLocalizer.OptionsPageToggleOn 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): def __doToggleTpTransition(self):
messenger.send('wakeup') messenger.send('wakeup')
settings['tpTransition'] = not settings['tpTransition'] settings['tpTransition'] = not settings['tpTransition']

View file

@ -2383,12 +2383,18 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
if not self.isReported(doId): if not self.isReported(doId):
self.reported.append(doId) self.reported.append(doId)
def setTrueFriends(self, trueFriends): def setFriendsList(self, friendsList):
DistributedPlayer.DistributedPlayer.setFriendsList(self, friendsList)
messenger.send('friendsListChanged')
Toon.reconsiderAllToonsUnderstandable() Toon.reconsiderAllToonsUnderstandable()
def setTrueFriends(self, trueFriends):
self.trueFriends = trueFriends self.trueFriends = trueFriends
Toon.reconsiderAllToonsUnderstandable()
messenger.send('friendsListChanged')
def isTrueFriends(self, doId): def isTrueFriends(self, doId):
return doId in self.trueFriends return base.cr.wantTrueFriends() and doId in self.trueFriends
def applyBuffs(self): def applyBuffs(self):
for id, timestamp in enumerate(self.buffs): for id, timestamp in enumerate(self.buffs):

View file

@ -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!' CodeRedemptionWarning = 'NOTICE: All codes can only be entered once!'
CogInterfaceLabelOn = 'The cog battle interface is on.' CogInterfaceLabelOn = 'The cog battle interface is on.'
CogInterfaceLabelOff = 'The cog battle interface is off.' 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.' TpTransitionLabelOn = 'The teleport transition is on.'
TpTransitionLabelOff = 'The teleport transition is off.' TpTransitionLabelOff = 'The teleport transition is off.'
FieldOfViewLabel = 'Field of View:' FieldOfViewLabel = 'Field of View:'

View file

@ -98,10 +98,6 @@ if 'language' not in settings:
settings['language'] = 'English' settings['language'] = 'English'
if 'cogInterface' not in settings: if 'cogInterface' not in settings:
settings['cogInterface'] = True settings['cogInterface'] = True
if 'speedchatPlus' not in settings:
settings['speedchatPlus'] = True
if 'trueFriends' not in settings:
settings['trueFriends'] = True
if 'tpTransition' not in settings: if 'tpTransition' not in settings:
settings['tpTransition'] = True settings['tpTransition'] = True
if 'fov' not in settings: if 'fov' not in settings:

View file

@ -35,7 +35,7 @@ class ClientServicesManager(DistributedObjectGlobal):
def requestAvatars(self): def requestAvatars(self):
self.sendUpdate('requestAvatars') self.sendUpdate('requestAvatars')
def setAvatars(self, avatars): def setAvatars(self, chatSettings, avatars):
avList = [] avList = []
for avNum, avName, avDNA, avPosition, nameState in avatars: for avNum, avName, avDNA, avPosition, nameState in avatars:
nameOpen = int(nameState == 1) nameOpen = int(nameState == 1)
@ -48,6 +48,7 @@ class ClientServicesManager(DistributedObjectGlobal):
names[3] = avName names[3] = avName
avList.append(PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen)) avList.append(PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen))
self.cr.handleChatSettings(chatSettings)
self.cr.handleAvatarsList(avList) self.cr.handleAvatarsList(avList)
# --- AVATAR CREATION/DELETION --- # --- AVATAR CREATION/DELETION ---

View file

@ -333,7 +333,8 @@ class LoginAccountFSM(OperationFSM):
'LAST_LOGIN': time.ctime(), 'LAST_LOGIN': time.ctime(),
'LAST_LOGIN_TS': time.time(), 'LAST_LOGIN_TS': time.time(),
'ACCOUNT_ID': str(self.userId), '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.dbInterface.createObject(
self.csm.air.dbId, self.csm.air.dbId,
@ -645,7 +646,7 @@ class GetAvatarsFSM(AvatarOperationFSM):
potentialAvs.append([avId, name, fields['setDNAString'][0], potentialAvs.append([avId, name, fields['setDNAString'][0],
index, nameState]) index, nameState])
self.csm.sendUpdateToAccountId(self.target, 'setAvatars', [potentialAvs]) self.csm.sendUpdateToAccountId(self.target, 'setAvatars', [self.account['CHAT_SETTINGS'], potentialAvs])
self.demand('Off') self.demand('Off')
def enterQueryNameState(self): def enterQueryNameState(self):