diff --git a/astron/dclass/united.dc b/astron/dclass/united.dc index d3a2b0e2..26d9e01b 100644 --- a/astron/dclass/united.dc +++ b/astron/dclass/united.dc @@ -873,6 +873,7 @@ dclass DistributedToon : DistributedPlayer { takeDamage(uint16) broadcast ownrecv; setBattleId(uint32 = 0) required broadcast ram; setExperience(blob = [0*14]) required broadcast db; + setTrueFriends(uint32[]) required ownrecv db; setMaxCarry(uint8 = 20) required ownrecv db; setTrackAccess(uint16[] = [0,0,0,0,1,1,0]) required broadcast ownrecv db; setTrackProgress(int8 = -1, uint32 = 0) required ownrecv db; diff --git a/otp/chat/ChatInputTyped.py b/otp/chat/ChatInputTyped.py index 2bceeff5..e3051863 100644 --- a/otp/chat/ChatInputTyped.py +++ b/otp/chat/ChatInputTyped.py @@ -90,9 +90,6 @@ class ChatInputTyped(DirectObject.DirectObject): elif not base.talkAssistant.checkWhisperTypedChatAvatar(self.whisperId): messenger.send('Chat-Failed avatar typed chat test') self.deactivate() - elif not base.talkAssistant.checkOpenTypedChat(): - messenger.send('Chat-Failed open typed chat test') - self.deactivate() def deactivate(self): self.chatEntry.set('') diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 588fd82b..a323e8ba 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -32,7 +32,6 @@ from otp.distributed import OtpDoGlobals from otp.distributed.OtpDoGlobals import * from otp.distributed.TelemetryLimiter import TelemetryLimiter from otp.login import HTTPUtil -from otp.login import LoginTTUAccount from otp.otpbase import OTPGlobals from otp.otpbase import OTPLocalizer from otp.otpgui import OTPDialog @@ -46,7 +45,6 @@ class OTPClientRepository(ClientRepositoryBase): 'PendingApproval', 'Approved', 'Rejected']) - whiteListChatEnabled = 1 # TODO: Have server set this on localAvatar on login. def __init__(self, serverVersion, launcher = None, playGame = None): ClientRepositoryBase.__init__(self) @@ -71,9 +69,6 @@ class OTPClientRepository(ClientRepositoryBase): else: self.http = HTTPClient() - self.loginInterface = LoginTTUAccount.LoginTTUAccount(self) - self.secretChatAllowed = base.config.GetBool('allow-secret-chat', True) - self.openChatAllowed = base.config.GetBool('allow-open-chat', True) self.userSignature = base.config.GetString('signature', 'none') self.__isPaid = 1 self.parentMgr.registerParent(OTPGlobals.SPRender, base.render) @@ -1359,19 +1354,6 @@ class OTPClientRepository(ClientRepositoryBase): def allowFreeNames(self): return base.config.GetInt('allow-free-names', 1) - # TODO: Login Server for all those - def allowSecretChat(self): - return self.secretChatAllowed - - def allowWhiteListChat(self): - return hasattr(self, 'whiteListChatEnabled') and self.whiteListChatEnabled - - def allowAnyTypedChat(self): - return self.allowSecretChat() or self.allowWhiteListChat() or self.allowOpenChat() - - def allowOpenChat(self): - return self.openChatAllowed - def getStartingDistrict(self): district = None if len(self.activeDistrictMap.keys()) == 0: diff --git a/otp/friends/AvatarFriendInfo.py b/otp/friends/AvatarFriendInfo.py index e52e2fd6..0bb704e6 100644 --- a/otp/friends/AvatarFriendInfo.py +++ b/otp/friends/AvatarFriendInfo.py @@ -30,7 +30,7 @@ class AvatarFriendInfo(AvatarHandle): result = True elif self.openChatEnabledYesNo and base.cr.openChatEnabled: result = True - elif self.wlChatEnabledYesNo and base.cr.whiteListChatEnabled: + elif self.wlChatEnabledYesNo and settings['speedchatPlus']: result = True except: pass diff --git a/otp/friends/FriendInfo.py b/otp/friends/FriendInfo.py index 5d605623..44ca7a29 100644 --- a/otp/friends/FriendInfo.py +++ b/otp/friends/FriendInfo.py @@ -35,7 +35,7 @@ class FriendInfo(AvatarHandle): result = True elif self.openChatEnabledYesNo and base.cr.openChatEnabled: result = True - elif self.wlChatEnabledYesNo and base.cr.whiteListChatEnabled: + elif self.wlChatEnabledYesNo and settings['speedchatPlus']: result = True except: pass diff --git a/otp/friends/FriendSecret.py b/otp/friends/FriendSecret.py index 88e6160d..d52d1b02 100644 --- a/otp/friends/FriendSecret.py +++ b/otp/friends/FriendSecret.py @@ -14,7 +14,7 @@ BothSecrets = 2 def showFriendSecret(secretType = AvatarSecret): global globalFriendSecret - if not base.cr.allowSecretChat(): + if not settings['trueFriends']: chatMgr = base.localAvatar.chatMgr chatMgr.fsm.request('noSecretChatAtAll') else: diff --git a/otp/login/LoginBase.py b/otp/login/LoginBase.py deleted file mode 100644 index c273fec6..00000000 --- a/otp/login/LoginBase.py +++ /dev/null @@ -1,12 +0,0 @@ - - -class LoginBase: - - def __init__(self, cr): - self.cr = cr - - def sendLoginMsg(self, loginName, password, createFlag): - pass - - def getErrorCode(self): - return 0 \ No newline at end of file diff --git a/otp/login/LoginTTUAccount.py b/otp/login/LoginTTUAccount.py deleted file mode 100644 index 6aac34ef..00000000 --- a/otp/login/LoginTTUAccount.py +++ /dev/null @@ -1,24 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -import LoginBase - -class LoginTTUAccount(LoginBase.LoginBase): - notify = DirectNotifyGlobal.directNotify.newCategory('LoginTTUAccount') - - def __init__(self, cr): - LoginBase.LoginBase.__init__(self, cr) - - def supportsRelogin(self): - return 1 - - def authorize(self, username, password): - return 0 # No error! - - def sendLoginMsg(self): - cr = self.cr - # TODO - - def getErrorCode(self): - return 0 - - def authenticateDelete(self, loginName, password): - return 1 diff --git a/toontown/chat/TTChatInputNormal.py b/toontown/chat/TTChatInputNormal.py deleted file mode 100644 index 07e4a61e..00000000 --- a/toontown/chat/TTChatInputNormal.py +++ /dev/null @@ -1,43 +0,0 @@ -from direct.gui.DirectGui import * -from pandac.PandaModules import * -from otp.chat import ChatInputNormal -from otp.otpbase import OTPLocalizer -from otp.otpbase import OTPGlobals - -class TTChatInputNormal(ChatInputNormal.ChatInputNormal): - - def __init__(self, chatMgr): - ChatInputNormal.ChatInputNormal.__init__(self, chatMgr) - gui = loader.loadModel('phase_3.5/models/gui/chat_input_gui') - self.chatFrame = DirectFrame(parent=aspect2dp, image=gui.find('**/Chat_Bx_FNL'), relief=None, pos=(-1.083, 0, 0.804), state=DGG.NORMAL, sortOrder=DGG.FOREGROUND_SORT_INDEX) - self.chatFrame.hide() - self.chatButton = DirectButton(parent=self.chatFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(0.182, 0, -0.088), relief=None, text=('', OTPLocalizer.ChatInputNormalSayIt, OTPLocalizer.ChatInputNormalSayIt), text_scale=0.06, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.chatButtonPressed) - self.cancelButton = DirectButton(parent=self.chatFrame, image=(gui.find('**/CloseBtn_UP'), gui.find('**/CloseBtn_DN'), gui.find('**/CloseBtn_Rllvr')), pos=(-0.151, 0, -0.088), relief=None, text=('', OTPLocalizer.ChatInputNormalCancel, OTPLocalizer.ChatInputNormalCancel), text_scale=0.06, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.cancelButtonPressed) - self.whisperLabel = DirectLabel(parent=self.chatFrame, pos=(0.02, 0, 0.23), relief=DGG.FLAT, frameColor=(1, 1, 0.5, 1), frameSize=(-0.23, - 0.23, - -0.07, - 0.05), text=OTPLocalizer.ChatInputNormalWhisper, text_scale=0.04, text_fg=Vec4(0, 0, 0, 1), text_wordwrap=9.5, textMayChange=1) - self.whisperLabel.hide() - self.chatEntry = DirectEntry(parent=self.chatFrame, relief=None, scale=0.05, pos=(-0.2, 0, 0.11), entryFont=OTPGlobals.getInterfaceFont(), width=8.6, numLines=3, cursorKeys=0, backgroundFocus=0, command=self.sendChat) - self.chatEntry.bind(DGG.OVERFLOW, self.chatOverflow) - self.chatEntry.bind(DGG.TYPE, self.typeCallback) - return - - def delete(self): - self.chatEntry.destroy() - self.chatButton.destroy() - self.cancelButton.destroy() - ChatInputNormal.ChatInputNormal.delete(self) - loader.unloadModel('phase_3.5/models/gui/chat_input_gui') - - def typeCallback(self, extraArgs): - if localAvatar.chatMgr.chatInputWhiteList and localAvatar.chatMgr.chatInputWhiteList.isActive(): - return - else: - messenger.send('enterNormalChat') - - def checkForOverRide(self): - return False - if localAvatar.chatMgr.chatInputWhiteList and localAvatar.chatMgr.chatInputWhiteList.isActive(): - return True - return False diff --git a/toontown/chat/TTChatInputWhiteList.py b/toontown/chat/TTChatInputWhiteList.py index ecd91b93..60a9a3ca 100644 --- a/toontown/chat/TTChatInputWhiteList.py +++ b/toontown/chat/TTChatInputWhiteList.py @@ -189,7 +189,7 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame): flag = 1 for word in words: - if word == '' or self.whiteList.isWord(word) or not base.cr.whiteListChatEnabled: + if word == '' or self.whiteList.isWord(word) or not settings['speedchatPlus']: newwords.append(word) else: if self.checkBeforeSend: @@ -204,7 +204,7 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame): if not strict: lastword = words[-1] try: - if lastword == '' or self.whiteList.isPrefix(lastword) or not base.cr.whiteListChatEnabled: + if lastword == '' or self.whiteList.isPrefix(lastword) or not settings['speedchatPlus']: newwords[-1] = lastword elif flag: newwords[-1] = '\x01WLDisplay\x01' + lastword + '\x02' diff --git a/toontown/chat/ToontownChatManager.py b/toontown/chat/ToontownChatManager.py index 52d7a005..e1d2a42e 100644 --- a/toontown/chat/ToontownChatManager.py +++ b/toontown/chat/ToontownChatManager.py @@ -7,7 +7,6 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from otp.chat import ChatManager from TTChatInputSpeedChat import TTChatInputSpeedChat -from TTChatInputNormal import TTChatInputNormal from TTChatInputWhiteList import TTChatInputWhiteList class ToontownChatManager(ChatManager.ChatManager): @@ -34,19 +33,15 @@ class ToontownChatManager(ChatManager.ChatManager): self.whisperCancelButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/CloseBtn_UP'), gui.find('**/CloseBtn_DN'), gui.find('**/CloseBtn_Rllvr')), pos=(0.125, 0, -0.1), scale=1.179, relief=None, text=('', OTPLocalizer.ChatManagerCancel, OTPLocalizer.ChatManagerCancel), text_scale=0.05, text_fg=(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, command=self.__whisperCancelPressed) gui.removeNode() ChatManager.ChatManager.__init__(self, cr, localAvatar) - self.defaultToWhiteList = base.config.GetBool('white-list-is-default', 1) self.chatInputSpeedChat = TTChatInputSpeedChat(self) self.normalPos = Vec3(0.25, 0, -0.196) self.whisperPos = Vec3(0, 0, -0.296) self.speedChatPlusPos = Vec3(-0.35, 0, 0.71) self.SCWhisperPos = Vec3(0, 0, 0) self.chatInputWhiteList = TTChatInputWhiteList() - if self.defaultToWhiteList: - self.chatInputNormal = self.chatInputWhiteList - self.chatInputNormal.setPos(self.normalPos) - self.chatInputNormal.desc = 'chatInputNormal' - else: - self.chatInputNormal = TTChatInputNormal(self) + self.chatInputNormal = self.chatInputWhiteList + self.chatInputNormal.setPos(self.normalPos) + self.chatInputNormal.desc = 'chatInputNormal' self.chatInputWhiteList.setPos(self.speedChatPlusPos) self.chatInputWhiteList.reparentTo(base.a2dTopLeft) self.chatInputWhiteList.desc = 'chatInputWhiteList' @@ -129,8 +124,6 @@ class ToontownChatManager(ChatManager.ChatManager): self.fsm.request('normalChat') def __scButtonPressed(self): - if base.config.GetBool('want-qa-regression', 0): - self.notify.info('QA-REGRESSION: CHAT: Speedchat') messenger.send('wakeup') if self.fsm.getCurrentState().getName() == 'speedChat': self.fsm.request('mainMenu') @@ -185,8 +178,6 @@ class ToontownChatManager(ChatManager.ChatManager): self.noSecretChatAtAllAndNoWhitelist.hide() def __whisperScButtonPressed(self, avatarName, avatarId, playerId): - if base.config.GetBool('want-qa-regression', 0): - self.notify.info('QA-REGRESSION: CHAT: Whisper') messenger.send('wakeup') hasManager = hasattr(base.cr, 'playerFriendsManager') transientFriend = 0 diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 0c56bd11..2b70066a 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -195,6 +195,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.promotionStatus = [0, 0, 0, 0] self.buffs = [] self.redeemedCodes = [] + self.trueFriends = [] def generate(self): DistributedPlayerAI.DistributedPlayerAI.generate(self) @@ -446,6 +447,22 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getExperience(self): return self.experience.makeNetString() + + def b_setTrueFriends(self, trueFriends): + self.d_setTrueFriends(trueFriends) + self.setTrueFriends(trueFriends) + + def d_setTrueFriends(self, trueFriends): + self.sendUpdate('setTrueFriends', [trueFriends]) + + def setTrueFriends(self, trueFriends): + self.trueFriends = trueFriends + + def getTrueFriends(self): + return self.trueFriends + + def isTrueFriend(self, doId): + return doId in self.trueFriends def b_setInventory(self, inventory): self.setInventory(inventory) diff --git a/toontown/toon/DistributedToonUD.py b/toontown/toon/DistributedToonUD.py index 007e1600..22ab2e66 100644 --- a/toontown/toon/DistributedToonUD.py +++ b/toontown/toon/DistributedToonUD.py @@ -546,3 +546,6 @@ class DistributedToonUD(DistributedObjectUD): def setRedeemedCodes(self, redeemedCodes): pass + + def setTrueFriends(self, trueFriends): + pass \ No newline at end of file diff --git a/toontown/toonbase/ClientStart.py b/toontown/toonbase/ClientStart.py index f0d3fbab..0636b1b8 100644 --- a/toontown/toonbase/ClientStart.py +++ b/toontown/toonbase/ClientStart.py @@ -85,6 +85,10 @@ if 'language' not in settings: settings['language'] = 'English' if 'cogLevel' not in settings: settings['cogLevel'] = True +if 'speedchatPlus' not in settings: + settings['speedchatPlus'] = True +if 'trueFriends' not in settings: + settings['trueFriends'] = True loadPrcFileData('Settings: res', 'win-size %d %d' % tuple(settings.get('res', (800, 600)))) loadPrcFileData('Settings: fullscreen', 'fullscreen %s' % settings['fullscreen']) loadPrcFileData('Settings: music', 'audio-music-active %s' % settings['music']) @@ -92,9 +96,6 @@ loadPrcFileData('Settings: sfx', 'audio-sfx-active %s' % settings['sfx']) loadPrcFileData('Settings: musicVol', 'audio-master-music-volume %s' % settings['musicVol']) loadPrcFileData('Settings: sfxVol', 'audio-master-sfx-volume %s' % settings['sfxVol']) loadPrcFileData('Settings: loadDisplay', 'load-display %s' % settings['loadDisplay']) -loadPrcFileData('Settings: toonChatSounds', 'toon-chat-sounds %s' % settings['toonChatSounds']) -loadPrcFileData('Settings: language', 'language %s' % settings['language']) -loadPrcFileData('Settings: cogLevel', 'cogLevel %s' % settings['cogLevel']) import os