Fix ~ whitelist exploit, add True Friends and Speedchat Plus warnings.

This commit is contained in:
John 2015-06-03 22:00:42 +03:00 committed by Loudrob
parent a3905882f7
commit 898d57dc1f
7 changed files with 52 additions and 51 deletions

View file

@ -1,10 +0,0 @@
from direct.directnotify import DirectNotifyGlobal
class ChatAgentAI:
notify = DirectNotifyGlobal.directNotify.newCategory("ChatAgentAI")
def announceGenerate(self):
pass
def chatMessage(self, todo0):
pass

View file

@ -48,6 +48,7 @@ class ChatAgentUD(DistributedObjectGlobalUD):
return
self.air.writeServerEvent('whisper-said', avId=sender, reciever=receiverAvId, msg=message)
DistributedAvatar = self.air.dclassesByName['DistributedAvatarUD']
dg = DistributedAvatar.aiFormatUpdate('setTalkWhisper', receiverAvId, receiverAvId, self.air.ourChannel, [sender, message])
self.air.send(dg)

View file

@ -26,8 +26,8 @@ class ChatManager(DirectObject.DirectObject):
self.wantBackgroundFocus = 1
self.__scObscured = 0
self.__normalObscured = 0
self.noTrueFriendsAtAll = None
self.noTrueFriendsAtAllAndNoWhitelist = None
self.noTrueFriends = None
self.noSpeedchatPlus = None
self.fsm = ClassicFSM.ClassicFSM('chatManager', [State.State('off', self.enterOff, self.exitOff),
State.State('mainMenu', self.enterMainMenu, self.exitMainMenu),
State.State('speedChat', self.enterSpeedChat, self.exitSpeedChat),
@ -35,8 +35,8 @@ class ChatManager(DirectObject.DirectObject):
State.State('whisper', self.enterWhisper, self.exitWhisper),
State.State('whisperChat', self.enterWhisperChat, self.exitWhisperChat),
State.State('whisperSpeedChat', self.enterWhisperSpeedChat, self.exitWhisperSpeedChat),
State.State('noTrueFriendsAtAll', self.enterNoTrueFriendsAtAll, self.exitNoTrueFriendsAtAll),
State.State('noTrueFriendsAtAllAndNoWhitelist', self.enterNoTrueFriendsAtAllAndNoWhitelist, self.exitNoTrueFriendsAtAllAndNoWhitelist),
State.State('noTrueFriends', self.enterNoTrueFriends, self.exitNoTrueFriends),
State.State('noSpeedchatPlus', self.enterNoSpeedchatPlus, self.exitNoSpeedchatPlus),
State.State('otherDialog', self.enterOtherDialog, self.exitOtherDialog),
State.State('whiteListOpenChat', self.enterWhiteListOpenChat, self.exitWhiteListOpenChat),
State.State('whiteListAvatarChat', self.enterWhiteListAvatarChat, self.exitWhiteListAvatarChat)], 'off', 'off')
@ -52,12 +52,12 @@ class ChatManager(DirectObject.DirectObject):
del self.chatInputNormal
self.chatInputSpeedChat.delete()
del self.chatInputSpeedChat
if self.noTrueFriendsAtAll:
self.noTrueFriendsAtAll.destroy()
self.noTrueFriendsAtAll = None
if self.noTrueFriendsAtAllAndNoWhitelist:
self.noTrueFriendsAtAllAndNoWhitelist.destroy()
self.noTrueFriendsAtAllAndNoWhitelist = None
if self.noTrueFriends:
self.noTrueFriends.destroy()
self.noTrueFriends = None
if self.noSpeedchatPlus:
self.noSpeedchatPlus.destroy()
self.noSpeedchatPlus = None
del self.localAvatar
del self.cr
return
@ -263,17 +263,17 @@ class ChatManager(DirectObject.DirectObject):
def exitNormalChat(self):
self.chatInputNormal.deactivate()
def enterNoTrueFriendsAtAll(self):
self.notify.error('called enterNoTrueFriendsAtAll() on parent class')
def enterNoTrueFriends(self):
self.notify.error('called enterNoTrueFriends() on parent class')
def exitNoTrueFriendsAtAll(self):
self.notify.error('called exitNoTrueFriendsAtAll() on parent class')
def exitNoTrueFriends(self):
self.notify.error('called exitNoTrueFriends() on parent class')
def enterNoTrueFriendsAtAllAndNoWhitelist(self):
self.notify.error('called enterNoTrueFriendsAtAllAndNoWhitelist() on parent class')
def enterNoSpeedchatPlus(self):
self.notify.error('called enterNoSpeedchatPlus() on parent class')
def exitNoTrueFriendsAtAllAndNoWhitelist(self):
self.notify.error('called exitNoTrueFriendsAtAllAndNoWhitelist() on parent class')
def exitNoSpeedchatPlus(self):
self.notify.error('called exitNoSpeedchatPlus() on parent class')
def enterOtherDialog(self):
pass

View file

@ -22,7 +22,7 @@ class WhiteList:
return '\x01WLRed\x01%s\x02' % text if not garbler else garbler.garble(av, text)
def processText(self, text, av=None, garbler=None):
if (not self.words) or text.startswith('~'):
if (not self.words) or (text.startswith('~') and not garbler):
return text
words = text.split(' ')

View file

@ -48,12 +48,12 @@ ChatManagerWhisperToName = 'Whisper To:\n%s'
ChatManagerCancel = lCancel
ChatManagerWhisperOffline = '%s is offline.'
# True Friends
NoTrueFriendsAtAllTitle = 'Open Chat With True Friends'
NoTrueFriendsAtAll = 'Open Chat with True Friends allows real-life friends to chat openly with each other by means of a True Friend Code that must be shared outside of the game.\n\nTo activate these features or to learn more, exit Toontown and then click on Membership and select Manage Account. Log in to edit your "Community Settings."'
NoTrueFriendsTitle = 'Open Chat With True Friends'
NoTrueFriends = 'Open Chat with True Friends allows real-life friends to chat openly with each other by means of a True Friend Code that must be shared outside of the game.\n\nTo activate these features or to learn more, exit Toontown and then click on Membership and select Manage Account. Log in to edit your "Community Settings."'
# Speedchat Plus
NoTrueFriendsAtAllAndNoWhitelistTitle = 'Chat Button'
NoTrueFriendsAtAllAndNoWhitelist = 'You can use the blue Chat button to communicate with other Toons by using Speechat Plus or Open Chat with True Friends.\n\nSpeedchat Plus is a form of type chat that allows users to communicate by using the SpeedChat Plus dictionary.\n\nOpen Chat with True Friends allows real-life friends to chat openly with each other by means of a True Friend Code that must be shared outside of the game.\n\nTo activate these features or to learn more, exit Toontown and then click on Membership and select Manage Account. Log in to edit your "Community Settings."'
NoTrueFriendsAtAllOK = lOK
NoSpeedchatPlusTitle = 'Chat Button'
NoSpeedchatPlus = 'You can use the blue Chat button to communicate with other Toons by using Speechat Plus or Open Chat with True Friends.\n\nSpeedchat Plus is a form of type chat that allows users to communicate by using the SpeedChat Plus dictionary.\n\nOpen Chat with True Friends allows real-life friends to chat openly with each other by means of a True Friend Code that must be shared outside of the game.\n\nTo activate these features or to learn more, exit Toontown and then click on Membership and select Manage Account. Log in to edit your "Community Settings."'
NoTrueFriendsOK = lOK
WhisperToFormat = 'To %s %s'
WhisperToFormatName = 'To %s'
WhisperFromFormatName = '%s whispers'

View file

@ -93,24 +93,27 @@ class ToontownChatManager(ChatManager.ChatManager):
else:
ChatManager.ChatManager.enterMainMenu(self)
def enterNoTrueFriendsAtAll(self):
if self.noTrueFriendsAtAll == None:
def enterNoTrueFriends(self):
if self.noTrueFriends == None:
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
self.noTrueFriendsAtAll = DirectFrame(parent=aspect2dp, pos=(0.0, 0.1, 0.2), relief=None, image=DGG.getDefaultDialogGeom(), image_color=OTPGlobals.GlobalDialogColor, image_scale=(1.4, 1.0, 1.1), text=OTPLocalizer.NoTrueFriendsAtAll, text_wordwrap=20, textMayChange=0, text_scale=0.06, text_pos=(0, 0.3))
DirectLabel(parent=self.noTrueFriendsAtAll, relief=None, pos=(0, 0, 0.4), text=OTPLocalizer.NoTrueFriendsAtAllTitle, textMayChange=0, text_scale=0.08)
DirectButton(self.noTrueFriendsAtAll, image=okButtonImage, relief=None, text=OTPLocalizer.NoTrueFriendsAtAllOK, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(0.0, 0.0, -0.4), command=self.__handleNoTrueFriendsAtAllOK)
self.noTrueFriends = DirectFrame(parent=aspect2dp, pos=(0.0, 0.1, 0.2), relief=None, image=DGG.getDefaultDialogGeom(), image_color=OTPGlobals.GlobalDialogColor, image_scale=(1.4, 1.0, 1.1), text=OTPLocalizer.NoTrueFriends, text_wordwrap=20, textMayChange=0, text_scale=0.06, text_pos=(0, 0.3))
DirectLabel(parent=self.noTrueFriends, relief=None, pos=(0, 0, 0.4), text=OTPLocalizer.NoTrueFriendsTitle, textMayChange=0, text_scale=0.08)
DirectButton(self.noTrueFriends, image=okButtonImage, relief=None, text=OTPLocalizer.NoTrueFriendsOK, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(0.0, 0.0, -0.4), command=self.__handleNoTrueFriendsOK)
buttons.removeNode()
self.noTrueFriendsAtAll.show()
self.noTrueFriends.show()
return
def exitNoTrueFriendsAtAll(self):
self.noTrueFriendsAtAll.hide()
def exitNoTrueFriends(self):
self.noTrueFriends.hide()
def __normalButtonPressed(self):
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']:
self.fsm.request('noSpeedchatPlus')
return
self.fsm.request('normalChat')
def __scButtonPressed(self):
@ -122,6 +125,9 @@ class ToontownChatManager(ChatManager.ChatManager):
def __whisperButtonPressed(self, avatarName, avatarId):
messenger.send('wakeup')
if not settings['trueFriends'] and not settings['speedchatPlus']:
self.fsm.request('noSpeedchatPlus')
return
if avatarId:
self.enterWhisperChat(avatarName, avatarId)
self.whisperFrame.hide()
@ -143,19 +149,19 @@ class ToontownChatManager(ChatManager.ChatManager):
self.fsm.request('mainMenu')
return
def enterNoTrueFriendsAtAllAndNoWhitelist(self):
if self.noTrueFriendsAtAllAndNoWhitelist == None:
def enterNoSpeedchatPlus(self):
if self.noSpeedchatPlus == None:
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
self.noTrueFriendsAtAllAndNoWhitelist = DirectFrame(parent=aspect2dp, pos=(0.0, 0.1, 0.05), relief=None, image=DGG.getDefaultDialogGeom(), image_color=OTPGlobals.GlobalDialogColor, image_scale=(1.4, 1.0, 1.58), text=OTPLocalizer.NoTrueFriendsAtAllAndNoWhitelist, text_wordwrap=20, textMayChange=0, text_scale=0.06, text_pos=(0, 0.55))
DirectLabel(parent=self.noTrueFriendsAtAllAndNoWhitelist, relief=None, pos=(0, 0, 0.67), text=OTPLocalizer.NoTrueFriendsAtAllAndNoWhitelistTitle, textMayChange=0, text_scale=0.08)
DirectButton(self.noTrueFriendsAtAllAndNoWhitelist, image=okButtonImage, relief=None, text=OTPLocalizer.NoTrueFriendsAtAllOK, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(0.0, 0.0, -0.64), command=self.__handleNoTrueFriendsAtAllOK)
self.noSpeedchatPlus = DirectFrame(parent=aspect2dp, pos=(0.0, 0.1, 0.05), relief=None, image=DGG.getDefaultDialogGeom(), image_color=OTPGlobals.GlobalDialogColor, image_scale=(1.4, 1.0, 1.58), text=OTPLocalizer.NoSpeedchatPlus, text_wordwrap=20, textMayChange=0, text_scale=0.06, text_pos=(0, 0.55))
DirectLabel(parent=self.noSpeedchatPlus, relief=None, pos=(0, 0, 0.67), text=OTPLocalizer.NoSpeedchatPlusTitle, textMayChange=0, text_scale=0.08)
DirectButton(self.noSpeedchatPlus, image=okButtonImage, relief=None, text=OTPLocalizer.NoTrueFriendsOK, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(0.0, 0.0, -0.64), command=self.__handleNoTrueFriendsOK)
buttons.removeNode()
self.noTrueFriendsAtAllAndNoWhitelist.show()
self.noSpeedchatPlus.show()
return
def exitNoTrueFriendsAtAllAndNoWhitelist(self):
self.noTrueFriendsAtAllAndNoWhitelist.hide()
def exitNoSpeedchatPlus(self):
self.noSpeedchatPlus.hide()
def __whisperScButtonPressed(self, avatarName, avatarId):
messenger.send('wakeup')
@ -168,7 +174,7 @@ class ToontownChatManager(ChatManager.ChatManager):
def __whisperCancelPressed(self):
self.fsm.request('mainMenu')
def __handleNoTrueFriendsAtAllOK(self):
def __handleNoTrueFriendsOK(self):
self.fsm.request('mainMenu')
def messageSent(self):

View file

@ -555,6 +555,10 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase):
return
def __handleTrueFriends(self):
if not settings['trueFriends']:
base.localAvatar.chatMgr.fsm.request('noTrueFriends')
return
self.cleanupDialog()
base.cr.playGame.getPlace().fsm.request('stopped')