Holocaust admin nametags + do Loudrob's pro stuff

This commit is contained in:
John 2015-08-01 02:37:41 +03:00
parent 2687adb691
commit f1f38cdae8
7 changed files with 28 additions and 34 deletions

View file

@ -111,9 +111,6 @@ class Avatar(Actor, ShadowCaster):
if hasattr(base, 'localAvatar') and (self == base.localAvatar): if hasattr(base, 'localAvatar') and (self == base.localAvatar):
self.understandable = 1 self.understandable = 1
self.setPlayerType(NametagGroup.CCNormal) self.setPlayerType(NametagGroup.CCNormal)
elif hasattr(self, 'adminAccess') and self.isAdmin():
self.understandable = 2
self.setPlayerType(NametagGroup.CCAdmin)
elif self.playerType == NametagGroup.CCSuit: elif self.playerType == NametagGroup.CCSuit:
self.understandable = 1 self.understandable = 1
self.setPlayerType(NametagGroup.CCSuit) self.setPlayerType(NametagGroup.CCSuit)
@ -129,6 +126,8 @@ class Avatar(Actor, ShadowCaster):
else: else:
self.understandable = 0 self.understandable = 0
self.setPlayerType(NametagGroup.CCSpeedChat) self.setPlayerType(NametagGroup.CCSpeedChat)
if hasattr(self, 'adminAccess') and self.isAdmin():
self.understandable = 2
if not hasattr(self, 'nametag'): if not hasattr(self, 'nametag'):
self.notify.warning('no nametag attributed, but would have been used') self.notify.warning('no nametag attributed, but would have been used')
else: else:

View file

@ -2,7 +2,9 @@ from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
import datetime, uuid, time import datetime, uuid, time, string, random
AVAILABLE_CHARS = string.ascii_lowercase + string.digits
class AddTrueFriend: class AddTrueFriend:
@ -179,6 +181,20 @@ class FriendManagerAI(DistributedObjectAI):
del self.requests[context] 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): def requestTFCode(self):
avId = self.air.getAvatarIdFromSender() avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId) av = self.air.doId2do.get(avId)
@ -192,7 +208,7 @@ class FriendManagerAI(DistributedObjectAI):
self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_COOLDOWN, '']) self.sendUpdateToAvatarId(avId, 'tfResponse', [ToontownGlobals.TF_COOLDOWN, ''])
return return
code = str(uuid.uuid4()) code = self.getTFCode(0)
if hasattr(self, 'data'): if hasattr(self, 'data'):
self.data[code] = avId self.data[code] = avId

View file

@ -15,7 +15,6 @@ CCToonBuilding = 3
CCSuitBuilding = 4 CCSuitBuilding = 4
CCHouseBuilding = 5 CCHouseBuilding = 5
CCSpeedChat = 6 CCSpeedChat = 6
CCAdmin = 7
NAMETAG_COLORS = { NAMETAG_COLORS = {
CCNormal: ( CCNormal: (
@ -115,21 +114,7 @@ NAMETAG_COLORS = {
# Disable FG BG # Disable FG BG
((0.0, 0.6, 0.2, 1.0), (0.8, 0.8, 0.8, 0.5), # Name ((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 (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 = { ARROW_COLORS = {
@ -143,8 +128,7 @@ DEFAULT_WORDWRAPS = {
CCToonBuilding: 8.5, CCToonBuilding: 8.5,
CCSuitBuilding: 8.5, CCSuitBuilding: 8.5,
CCHouseBuilding: 10.0, CCHouseBuilding: 10.0,
CCSpeedChat: 7.5, CCSpeedChat: 7.5
CCAdmin: 7.5
} }
WTNormal = 0 WTNormal = 0
@ -218,8 +202,4 @@ WHISPER_COLORS = {
} }
def getFriendColor(handle): def getFriendColor(handle):
if handle.isAdmin(): return CCNormal if settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId) else CCSpeedChat
return CCAdmin
elif settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId):
return CCNormal
return CCSpeedChat

View file

@ -11,7 +11,6 @@ class NametagGroup:
CCSuitBuilding = CCSuitBuilding CCSuitBuilding = CCSuitBuilding
CCHouseBuilding = CCHouseBuilding CCHouseBuilding = CCHouseBuilding
CCSpeedChat = CCSpeedChat CCSpeedChat = CCSpeedChat
CCAdmin = CCAdmin
CHAT_TIMEOUT_MAX = 12.0 CHAT_TIMEOUT_MAX = 12.0
CHAT_TIMEOUT_MIN = 4.0 CHAT_TIMEOUT_MIN = 4.0

View file

@ -276,7 +276,6 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
del self.friends[friendId] del self.friends[friendId]
self.createButtons(petFriends, NAMETAG_COLORS[CCNonPlayer][0][0]) 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(trueFriends, NAMETAG_COLORS[CCNormal][0][0])
self.createButtons(friends, NAMETAG_COLORS[CCSpeedChat][0][0]) self.createButtons(friends, NAMETAG_COLORS[CCSpeedChat][0][0])

View file

@ -131,9 +131,10 @@ class ToontownFriendSecret(DirectFrame):
self.ok2.show() self.ok2.show()
def successGetSecret(self, code): def successGetSecret(self, code):
self.nextText['text'] = TTLocalizer.FriendSecretGotSecret % code self.nextText['text'] = TTLocalizer.FriendSecretGotSecret
self.nextText.setPos(*TTLocalizer.FSgotSecretPos) 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.nextText.show()
self.secretText.show() self.secretText.show()
self.cancel.hide() self.cancel.hide()

View file

@ -8128,7 +8128,7 @@ ElevatorBossBotBoss = 'Bossbot Clubhouse'
ElevatorBossBotCourse0 = 'The Front Three' ElevatorBossBotCourse0 = 'The Front Three'
ElevatorBossBotCourse1 = 'The Middle Six' ElevatorBossBotCourse1 = 'The Middle Six'
ElevatorBossBotCourse2 = 'The Back Nine' ElevatorBossBotCourse2 = 'The Back Nine'
ElevatorCashBotBoss = 'Cashbot Treasury Vault' ElevatorCashBotBoss = 'Cashbot Vault'
ElevatorCashBotMint0 = 'Coin Mint' ElevatorCashBotMint0 = 'Coin Mint'
ElevatorCashBotMint1 = 'Dollar Mint' ElevatorCashBotMint1 = 'Dollar Mint'
ElevatorCashBotMint2 = 'Bullion Mint' ElevatorCashBotMint2 = 'Bullion Mint'
@ -8663,7 +8663,7 @@ FriendSecretOK = lOK
FriendSecretEnter = 'Enter True Friend Code' FriendSecretEnter = 'Enter True Friend Code'
FriendSecretCancel = lCancel FriendSecretCancel = lCancel
FriendSecretGettingSecret = 'Getting True Friend Code. . .' 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." 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. . .' 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)." 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)."