From f1f38cdae80fb04c4b7dacb2f27c5718a28f092d Mon Sep 17 00:00:00 2001 From: John Date: Sat, 1 Aug 2015 02:37:41 +0300 Subject: [PATCH] Holocaust admin nametags + do Loudrob's pro stuff --- otp/avatar/Avatar.py | 5 ++--- otp/friends/FriendManagerAI.py | 20 ++++++++++++++++-- otp/nametag/NametagConstants.py | 26 +++--------------------- otp/nametag/NametagGroup.py | 1 - toontown/friends/FriendsListPanel.py | 1 - toontown/friends/ToontownFriendSecret.py | 5 +++-- toontown/toonbase/TTLocalizerEnglish.py | 4 ++-- 7 files changed, 28 insertions(+), 34 deletions(-) diff --git a/otp/avatar/Avatar.py b/otp/avatar/Avatar.py index 8190ad90..258d3478 100755 --- a/otp/avatar/Avatar.py +++ b/otp/avatar/Avatar.py @@ -111,9 +111,6 @@ class Avatar(Actor, ShadowCaster): if hasattr(base, 'localAvatar') and (self == base.localAvatar): self.understandable = 1 self.setPlayerType(NametagGroup.CCNormal) - elif hasattr(self, 'adminAccess') and self.isAdmin(): - self.understandable = 2 - self.setPlayerType(NametagGroup.CCAdmin) elif self.playerType == NametagGroup.CCSuit: self.understandable = 1 self.setPlayerType(NametagGroup.CCSuit) @@ -129,6 +126,8 @@ class Avatar(Actor, ShadowCaster): else: self.understandable = 0 self.setPlayerType(NametagGroup.CCSpeedChat) + if hasattr(self, 'adminAccess') and self.isAdmin(): + self.understandable = 2 if not hasattr(self, 'nametag'): self.notify.warning('no nametag attributed, but would have been used') else: diff --git a/otp/friends/FriendManagerAI.py b/otp/friends/FriendManagerAI.py index 279a28ca..b089526a 100755 --- a/otp/friends/FriendManagerAI.py +++ b/otp/friends/FriendManagerAI.py @@ -2,7 +2,9 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed.DistributedObjectAI import DistributedObjectAI from otp.otpbase import OTPGlobals from toontown.toonbase import ToontownGlobals -import datetime, uuid, time +import datetime, uuid, time, string, random + +AVAILABLE_CHARS = string.ascii_lowercase + string.digits class AddTrueFriend: @@ -179,6 +181,20 @@ class FriendManagerAI(DistributedObjectAI): del self.requests[context] + def getRandomCharSequence(self, count): + return ''.join(random.choice(AVAILABLE_CHARS) for i in xrange(count)) + + def getTFCode(self, tryNumber): + if tryNumber == ToontownGlobals.MAX_TF_TRIES: + return str(uuid.uuid4()) + + code = 'TT %s %s' % (self.getRandomCharSequence(3), self.getRandomCharSequence(3)) + + if (hasattr(self, 'data') and code in self.data) or (self.air.dbConn and self.air.dbGlobalCursor.tfCodes.find({'_id': code}).count() > 0): + return self.getTFCode(tryNumber + 1) + + return code + def requestTFCode(self): avId = self.air.getAvatarIdFromSender() av = self.air.doId2do.get(avId) @@ -192,7 +208,7 @@ class FriendManagerAI(DistributedObjectAI): self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_COOLDOWN, '']) return - code = str(uuid.uuid4()) + code = self.getTFCode(0) if hasattr(self, 'data'): self.data[code] = avId diff --git a/otp/nametag/NametagConstants.py b/otp/nametag/NametagConstants.py index b702f90b..21585963 100644 --- a/otp/nametag/NametagConstants.py +++ b/otp/nametag/NametagConstants.py @@ -15,7 +15,6 @@ CCToonBuilding = 3 CCSuitBuilding = 4 CCHouseBuilding = 5 CCSpeedChat = 6 -CCAdmin = 7 NAMETAG_COLORS = { CCNormal: ( @@ -115,21 +114,7 @@ NAMETAG_COLORS = { # Disable FG BG ((0.0, 0.6, 0.2, 1.0), (0.8, 0.8, 0.8, 0.5), # Name (0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat - ), - CCAdmin: ( - # Normal FG BG - ((1.0, 0.35, 0.25, 1.0), (0.8, 0.8, 0.8, 0.5), # Name - (0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat - # Click FG BG - ((1.0, 0.35, 0.25, 1.0), (0.2, 0.2, 0.2, 0.6), # Name - (1.0, 0.5, 0.5, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat - # Hover FG BG - ((1.0, 0.5, 0.56, 1.0), (1.0, 1.0, 1.0, 1.0), # Name - (0.0, 0.6, 0.6, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat - # Disable FG BG - ((1.0, 0.35, 0.25, 1.0), (0.8, 0.8, 0.8, 0.5), # Name - (0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)), # Chat - ), + ) } ARROW_COLORS = { @@ -143,8 +128,7 @@ DEFAULT_WORDWRAPS = { CCToonBuilding: 8.5, CCSuitBuilding: 8.5, CCHouseBuilding: 10.0, - CCSpeedChat: 7.5, - CCAdmin: 7.5 + CCSpeedChat: 7.5 } WTNormal = 0 @@ -218,8 +202,4 @@ WHISPER_COLORS = { } def getFriendColor(handle): - if handle.isAdmin(): - return CCAdmin - elif settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId): - return CCNormal - return CCSpeedChat \ No newline at end of file + return CCNormal if settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat \ No newline at end of file diff --git a/otp/nametag/NametagGroup.py b/otp/nametag/NametagGroup.py index 357d459b..566a4f7b 100644 --- a/otp/nametag/NametagGroup.py +++ b/otp/nametag/NametagGroup.py @@ -11,7 +11,6 @@ class NametagGroup: CCSuitBuilding = CCSuitBuilding CCHouseBuilding = CCHouseBuilding CCSpeedChat = CCSpeedChat - CCAdmin = CCAdmin CHAT_TIMEOUT_MAX = 12.0 CHAT_TIMEOUT_MIN = 4.0 diff --git a/toontown/friends/FriendsListPanel.py b/toontown/friends/FriendsListPanel.py index 27d5da25..af2ff4e6 100755 --- a/toontown/friends/FriendsListPanel.py +++ b/toontown/friends/FriendsListPanel.py @@ -276,7 +276,6 @@ class FriendsListPanel(DirectFrame, StateData.StateData): del self.friends[friendId] self.createButtons(petFriends, NAMETAG_COLORS[CCNonPlayer][0][0]) - self.createButtons(admins, NAMETAG_COLORS[CCAdmin][0][0]) self.createButtons(trueFriends, NAMETAG_COLORS[CCNormal][0][0]) self.createButtons(friends, NAMETAG_COLORS[CCSpeedChat][0][0]) diff --git a/toontown/friends/ToontownFriendSecret.py b/toontown/friends/ToontownFriendSecret.py index f4e041f7..1635a3c5 100644 --- a/toontown/friends/ToontownFriendSecret.py +++ b/toontown/friends/ToontownFriendSecret.py @@ -131,9 +131,10 @@ class ToontownFriendSecret(DirectFrame): self.ok2.show() def successGetSecret(self, code): - self.nextText['text'] = TTLocalizer.FriendSecretGotSecret % code + self.nextText['text'] = TTLocalizer.FriendSecretGotSecret self.nextText.setPos(*TTLocalizer.FSgotSecretPos) - self.secretText['text'] = secret + self.secretText['text'] = code + self.secretText.setScale(0.1 if code.startswith('TT') else 0.08) self.nextText.show() self.secretText.show() self.cancel.hide() diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index deeff719..fa672743 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8128,7 +8128,7 @@ ElevatorBossBotBoss = 'Bossbot Clubhouse' ElevatorBossBotCourse0 = 'The Front Three' ElevatorBossBotCourse1 = 'The Middle Six' ElevatorBossBotCourse2 = 'The Back Nine' -ElevatorCashBotBoss = 'Cashbot Treasury Vault' +ElevatorCashBotBoss = 'Cashbot Vault' ElevatorCashBotMint0 = 'Coin Mint' ElevatorCashBotMint1 = 'Dollar Mint' ElevatorCashBotMint2 = 'Bullion Mint' @@ -8663,7 +8663,7 @@ FriendSecretOK = lOK FriendSecretEnter = 'Enter True Friend Code' FriendSecretCancel = lCancel FriendSecretGettingSecret = 'Getting True Friend Code. . .' -FriendSecretGotSecret = "Here is your new True Friend Code. Be sure to write it down!\n\nYou may give this True Friend Code to one person only. Once someone types in your True Friend Code, it will not work for anyone else. If you want to give a True Friend Code to more than one person, get another True Friend Code.\n\nThe True Friend Code will only work for the next three days. Your friend will have to type it in before it goes away, or it won't work.\n\nYour True Friend Code is: %s" +FriendSecretGotSecret = "Here is your new True Friend Code. Be sure to write it down!\n\nYou may give this True Friend Code to one person only. Once someone types in your True Friend Code, it will not work for anyone else. If you want to give a True Friend Code to more than one person, get another True Friend Code.\n\nThe True Friend Code will only work for the next three days. Your friend will have to type it in before it goes away, or it won't work.\n\nYour True Friend Code is:" FriendSecretTooMany = "Sorry, you can't have any more True Friend Codes today. You've already had more than your fair share!\n\nTry again tomorrow." FriendSecretTryingSecret = 'Trying True Friend Code. . .' FriendSecretEnteredSecretUnknown = "That's not anyone's True Friend Code. Are you sure you spelled it correctly?\n\nIf you did type it correctly, it may have expired. Ask your friend to get a new True Friend Code for you (or get a new one yourself and give it to your friend)."