From dca35c221b769908559efdf3113342f134d3ae64 Mon Sep 17 00:00:00 2001 From: DenialMC Date: Fri, 24 Apr 2015 01:18:16 +0300 Subject: [PATCH] Stuff --- otp/avatar/DistributedPlayer.py | 17 ++++++++++++++++- otp/chat/TalkAssistant.py | 6 +++--- toontown/chat/WhisperPopup.py | 6 ++---- toontown/friends/FriendsListPanel.py | 27 +++++++-------------------- toontown/suit/DistributedBossCog.py | 5 +---- toontown/toon/DistributedToon.py | 4 ++-- toontown/toon/LocalToon.py | 4 ++-- toontown/toon/ToonAvatarPanel.py | 3 +-- 8 files changed, 34 insertions(+), 38 deletions(-) diff --git a/otp/avatar/DistributedPlayer.py b/otp/avatar/DistributedPlayer.py index bba5985d..721185be 100644 --- a/otp/avatar/DistributedPlayer.py +++ b/otp/avatar/DistributedPlayer.py @@ -305,7 +305,22 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa base.cr.ttuFriendsManager.d_teleportQuery(sendToId) def teleportQuery(self, requesterId): - pass + avatar = base.cr.identifyFriend(requesterId) + + if avatar is None: + self.d_teleportResponse(self.doId, 0, 0, 0, 0, sendToId=requesterId) + elif base.localAvatar.isIgnored(requesterId): + self.d_teleportResponse(self.doId, 2, 0, 0, 0, sendToId=requesterId) + elif hasattr(base, 'distributedParty') and ((base.distributedParty.partyInfo.isPrivate and requesterId not in base.distributedParty.inviteeIds) or base.distributedParty.isPartyEnding): + self.d_teleportResponse(self.doId, 0, 0, 0, 0, sendToId=requesterId) + elif self.__teleportAvailable and not self.ghostMode: + self.setSystemMessage(requesterId, OTPLocalizer.WhisperComingToVisit % avatar.getName()) + messenger.send('teleportQuery', [avatar, self]) + else: + if self.failedTeleportMessageOk(requesterId): + self.setSystemMessage(requesterId, OTPLocalizer.WhisperFailedVisit % avatar.getName()) + + self.d_teleportResponse(self.doId, 0, 0, 0, 0, sendToId=requesterId) def failedTeleportMessageOk(self, fromId): now = globalClock.getFrameTime() diff --git a/otp/chat/TalkAssistant.py b/otp/chat/TalkAssistant.py index f851d4ff..7e027196 100644 --- a/otp/chat/TalkAssistant.py +++ b/otp/chat/TalkAssistant.py @@ -439,13 +439,13 @@ class TalkAssistant(DirectObject.DirectObject): def sendAvatarWhisperSpeedChat(self, type, messageIndex, receiverId): error = None if type == SPEEDCHAT_NORMAL: - base.localAvatar.whisperSCTo(messageIndex, receiverId, 0) + base.localAvatar.whisperSCTo(messageIndex, receiverId) message = self.SCDecoder.decodeSCStaticTextMsg(messageIndex) elif type == SPEEDCHAT_EMOTE: - base.localAvatar.whisperSCEmoteTo(messageIndex, receiverId, 0) + base.localAvatar.whisperSCEmoteTo(messageIndex, receiverId) message = self.SCDecoder.decodeSCEmoteWhisperMsg(messageIndex, localAvatar.getName()) elif type == SPEEDCHAT_CUSTOM: - base.localAvatar.whisperSCCustomTo(messageIndex, receiverId, 0) + base.localAvatar.whisperSCCustomTo(messageIndex, receiverId) message = self.SCDecoder.decodeSCCustomMsg(messageIndex) if self.logWhispers: avatarName = None diff --git a/toontown/chat/WhisperPopup.py b/toontown/chat/WhisperPopup.py index 7d0f8c40..a584d98e 100644 --- a/toontown/chat/WhisperPopup.py +++ b/toontown/chat/WhisperPopup.py @@ -113,7 +113,6 @@ class WhisperPopup(Clickable2d, MarginVisible): self.senderName = '' self.fromId = 0 - self.isPlayer = 0 self.contents.setScale(self.CONTENTS_SCALE) @@ -234,11 +233,10 @@ class WhisperPopup(Clickable2d, MarginVisible): self.destroy() - def setClickable(self, senderName, fromId, isPlayer=0): + def setClickable(self, senderName, fromId): self.senderName = senderName self.fromId = fromId - self.isPlayer = isPlayer - self.setClickEvent('clickedWhisper', extraArgs=[fromId, isPlayer]) + self.setClickEvent('clickedWhisper', extraArgs=[fromId]) self.setActive(True) def applyClickState(self, clickState): diff --git a/toontown/friends/FriendsListPanel.py b/toontown/friends/FriendsListPanel.py index 58f08750..b897ce04 100644 --- a/toontown/friends/FriendsListPanel.py +++ b/toontown/friends/FriendsListPanel.py @@ -162,17 +162,14 @@ class FriendsListPanel(DirectFrame, StateData.StateData): return None def makeFriendButton(self, friendTuple, colorChoice = None, bold = 0): - toonName = None - if len(friendTuple) == 2: - avId, flags = friendTuple + avId, flags = friendTuple command = self.__choseFriend handle = base.cr.identifyFriend(avId) if handle: toonName = handle.getName() - if not toonName: + else: base.cr.fillUpFriendsMap() return - thing = avId fg = ToontownGlobals.ColorNoChat if flags & ToontownGlobals.FriendChat: fg = ToontownGlobals.ColorAvatar @@ -277,33 +274,23 @@ class FriendsListPanel(DirectFrame, StateData.StateData): if base.cr.isFriendOnline(friendPair[0]): if friendPair[1] & ToontownGlobals.FriendChat: freeChatOneRef.insert(0, (friendPair[0], - friendPair[1], - 0, - 0)) + friendPair[1])) else: speedChatOneRef.insert(0, (friendPair[0], - friendPair[1], - 0, - 0)) + friendPair[1])) elif friendPair[1] & ToontownGlobals.FriendChat: freeChatOneRef.insert(0, (friendPair[0], - friendPair[1], - 0, - 0)) + friendPair[1])) else: speedChatOneRef.insert(0, (friendPair[0], - friendPair[1], - 0, - 0)) + friendPair[1])) if self.panelType == FLPOnline: if True: for friendPair in base.localAvatar.friendsList: if base.cr.isFriendOnline(friendPair[0]): offlineFriends.append((friendPair[0], - friendPair[1], - 0, - 0)) + friendPair[1])) if self.panelType == FLPPets: for objId, obj in base.cr.doId2do.items(): diff --git a/toontown/suit/DistributedBossCog.py b/toontown/suit/DistributedBossCog.py index d9be5adf..68181848 100644 --- a/toontown/suit/DistributedBossCog.py +++ b/toontown/suit/DistributedBossCog.py @@ -1038,10 +1038,7 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): return if not self.allowClickedNameTag: return - if self.cr: - place = self.cr.playGame.getPlace() - if place and hasattr(place, 'fsm'): - FriendsListManager.FriendsListManager._FriendsListManager__handleClickedNametag(place, avatar) + FriendsListManager.FriendsListManager._FriendsListManager__handleClickedNametag(avatar) def __handleFriendAvatar(self, avId, avName, avDisableName): self.notify.debug('__handleFriendAvatar') diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index bb577313..ee86b6fc 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -2407,9 +2407,9 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute if base.cr.isFriend(toonId): if base.cr.isFriendOnline(toonId): if singleReply.status == InviteStatus.Accepted: - self.whisperSCTo(5302, toonId, 0) + self.whisperSCTo(5302, toonId) else: - self.whisperSCTo(5302, toonId, 0) + self.whisperSCTo(5302, toonId) def updateInvite(self, inviteKey, newStatus): DistributedToon.partyNotify.debug('updateInvite( inviteKey=%d, newStatus=%s )' % (inviteKey, InviteStatus.getString(newStatus))) diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 9969dc84..627f0841 100644 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -869,9 +869,9 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): base.playSfx(sfx) return - def clickedWhisper(self, doId, isPlayer = None): + def clickedWhisper(self, doId): if doId > 0: - LocalAvatar.LocalAvatar.clickedWhisper(self, doId, isPlayer) + LocalAvatar.LocalAvatar.clickedWhisper(self, doId) else: foundCanStart = False for partyInfo in self.hostedParties: diff --git a/toontown/toon/ToonAvatarPanel.py b/toontown/toon/ToonAvatarPanel.py index 007cc3e3..43bf5a09 100644 --- a/toontown/toon/ToonAvatarPanel.py +++ b/toontown/toon/ToonAvatarPanel.py @@ -365,8 +365,7 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase): messenger.send('clickedNametag', [avatar]) def __handleWhisper(self): - base.localAvatar.chatMgr.whisperTo(self.avName, self.avId, None) - return + base.localAvatar.chatMgr.whisperTo(self.avName, self.avId) def __handleSecrets(self): base.localAvatar.chatMgr.noWhisper()