DANIEL: True friends

This commit is contained in:
John 2015-05-31 16:50:03 +03:00 committed by Loudrob
parent 7b8e48df78
commit 0c56b7c78d
4 changed files with 56 additions and 7 deletions

View file

@ -192,13 +192,12 @@ class AvatarPanelBase(AvatarPanel.AvatarPanel):
self.cleanupDialog()
self.requestWalk()
def cleanupDialog(self):
def cleanupDialog(self, state=None):
if self.dialog:
base.cr.openAvatarPanels.discard(self)
self.dialog.ignore('exitingStoppedState')
self.dialog.cleanup()
self.dialog = None
return
def requestStopped(self):
base.cr.openAvatarPanels.add(self)
@ -221,4 +220,4 @@ class AvatarPanelBase(AvatarPanel.AvatarPanel):
def __acceptStoppedStateMsg(self):
self.dialog.ignore('exitingStoppedState')
self.dialog.accept('exitingStoppedState', self.cleanupDialog)
self.dialog.accept('exitingStoppedState', self.cleanupDialog)

View file

@ -2526,6 +2526,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
self.d_setTrueFriends(trueFriends)
def setTrueFriends(self, trueFriends):
Avatar.reconsiderAllUnderstandable()
self.trueFriends = trueFriends
def d_setTrueFriends(self, trueFriends):
@ -2533,6 +2534,16 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
def isTrueFriends(self, doId):
return doId in self.trueFriends
def addTrueFriends(self, doId):
if not self.isTrueFriends(doId):
self.trueFriends.append(doId)
self.b_setTrueFriends(self.trueFriends)
def removeTrueFriends(self, doId):
if self.isTrueFriends(doId):
self.trueFriends.remove(doId)
self.b_setTrueFriends(self.trueFriends)
def applyBuffs(self):
for id, timestamp in enumerate(self.buffs):

View file

@ -364,10 +364,6 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase):
def __handleWhisper(self):
base.localAvatar.chatMgr.whisperTo(self.avName, self.avId)
def __handleTrueFriends(self):
base.localAvatar.chatMgr.noWhisper()
# TODO
def __handleFriend(self):
base.localAvatar.chatMgr.noWhisper()
messenger.send('friendAvatar', [self.avId, self.avName, self.avDisableName])
@ -552,3 +548,41 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase):
groupAvatarBgGui.removeNode()
helpGui.removeNode()
return
def __handleTrueFriends(self):
self.cleanupDialog()
base.cr.playGame.getPlace().fsm.request('stopped')
if base.localAvatar.isTrueFriends(self.avatar.doId):
self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.TrueFriendsRemoveNotice % self.avatar.getName(), text_wordwrap=20, command=self.confirmTrueFriendsRemove)
self.dialog.show()
elif not base.cr.isFriend(self.avatar.doId):
self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.TrueFriendsNotFriends % self.avatar.getName(), text_wordwrap=20, command=self.cleanupDialogAndWalk)
self.dialog.show()
else:
self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.TrueFriendsAddNotice % self.avatar.getName(), text_wordwrap=20, command=self.confirmTrueFriendsAdd)
self.dialog.show()
def confirmTrueFriendsAdd(self, state):
self.cleanupDialog()
if state > 0:
base.localAvatar.addTrueFriends(self.avatar.doId)
self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.TrueFriendsAdded.replace('%s', self.avatar.getName()), text_wordwrap=20, command=self.cleanupDialogAndWalk)
self.dialog.show()
else:
base.cr.playGame.getPlace().fsm.request('walk')
def confirmTrueFriendsRemove(self, state):
self.cleanupDialog()
if state > 0:
base.localAvatar.removeTrueFriends(self.avatar.doId)
self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.TrueFriendsRemoved % self.avatar.getName(), text_wordwrap=20, command=self.cleanupDialogAndWalk)
self.dialog.show()
else:
base.cr.playGame.getPlace().fsm.request('walk')
def cleanupDialogAndWalk(self, state=None):
self.cleanupDialog()
base.cr.playGame.getPlace().fsm.request('walk')

View file

@ -8461,3 +8461,8 @@ CogPanelSkeleton = 'Skeleton'
CogPanelVirtual = 'Virtual'
CogPanelRevives = 'v%s.0'
CogPanelWaiter = 'Waiter'
TrueFriendsRemoveNotice = 'Are you sure you want to remove %s as your True Friend?\n\nYou will no longer be able to chat without limits.'
TrueFriendsNotFriends = 'You cannot be True Friends with %s until you are regular friends first.'
TrueFriendsAddNotice = 'If you are playing Toontown with someone you trust, you can become True Friends.\n\nYou can chat using the keyboard with your True Friends.\n\nOther Toons won\'t understand what you\'re saying.\n\n\x01WLRed\x01However, this chat is completely unfiltered.\x02\n\nAre you sure you want to be True Friends with %s?'
TrueFriendsAdded = 'You are now True Friends with %s!\n\nYou can now understand everything %s says.\n\nHowever, chances are %s hasn\'t added you as a True Friend yet.\n\nIf this is the case, he cannot understand you yet. Please ask %s to add you as a True Friend aswell!'
TrueFriendsRemoved = 'You are no longer True Friends with %s.'