Teleport fail cooldown + whisper frame text fix

This commit is contained in:
John 2015-08-14 19:47:48 +03:00
parent 2689789ab1
commit b4afca2fce
3 changed files with 13 additions and 4 deletions

View file

@ -288,3 +288,5 @@ PeriodOnlyAfterLetter = 'You can use a period in your name, but only after a let
ApostropheOnlyAfterLetter = 'You can use an apostrophe in your name, but only after a letter.' ApostropheOnlyAfterLetter = 'You can use an apostrophe in your name, but only after a letter.'
NoNumbersInTheMiddle = 'Numeric digits may not appear in the middle of a word.' NoNumbersInTheMiddle = 'Numeric digits may not appear in the middle of a word.'
ThreeWordsOrLess = 'Your name must be three words or fewer.' ThreeWordsOrLess = 'Your name must be three words or fewer.'
TeleportFailCooldown = 2.0

View file

@ -20,7 +20,7 @@ class ToontownChatManager(ChatManager.ChatManager):
self.openScSfx.setVolume(0.6) self.openScSfx.setVolume(0.6)
self.scButton = DirectButton(image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=TTLocalizer.TCMscButtonPos, parent=base.a2dTopLeft, scale=1.179, relief=None, image_color=Vec4(0.75, 1, 0.6, 1), text=('', OTPLocalizer.GlobalSpeedChatName, OTPLocalizer.GlobalSpeedChatName), text_scale=TTLocalizer.TCMscButton, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, sortOrder=DGG.FOREGROUND_SORT_INDEX, command=self.__scButtonPressed, clickSound=self.openScSfx) self.scButton = DirectButton(image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=TTLocalizer.TCMscButtonPos, parent=base.a2dTopLeft, scale=1.179, relief=None, image_color=Vec4(0.75, 1, 0.6, 1), text=('', OTPLocalizer.GlobalSpeedChatName, OTPLocalizer.GlobalSpeedChatName), text_scale=TTLocalizer.TCMscButton, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0, -0.09), textMayChange=0, sortOrder=DGG.FOREGROUND_SORT_INDEX, command=self.__scButtonPressed, clickSound=self.openScSfx)
self.scButton.hide() self.scButton.hide()
self.whisperFrame = DirectFrame(parent=base.a2dTopLeft, relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(0.77, 0.70, 0.20), image_color=OTPGlobals.GlobalDialogColor, pos=(0.40, 0, -0.105), text=OTPLocalizer.ChatManagerWhisperTo, text_wordwrap=6.5, text_scale=TTLocalizer.TCMwhisperFrame, text_fg=Vec4(0, 0, 0, 1), text_pos=(0.18, 0.01), textMayChange=1, sortOrder=DGG.FOREGROUND_SORT_INDEX) self.whisperFrame = DirectFrame(parent=base.a2dTopLeft, relief=None, image=DGG.getDefaultDialogGeom(), image_scale=(0.77, 0.70, 0.20), image_color=OTPGlobals.GlobalDialogColor, pos=(0.40, 0, -0.105), text=OTPLocalizer.ChatManagerWhisperTo, text_wordwrap=6.5, text_scale=TTLocalizer.TCMwhisperFrame, text_fg=Vec4(0, 0, 0, 1), text_pos=(0.18, 0.04), textMayChange=1, sortOrder=DGG.FOREGROUND_SORT_INDEX)
self.whisperFrame.hide() self.whisperFrame.hide()
self.whisperButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(-0.33, 0, 0.033), scale=1.179, relief=None, image_color=Vec4(1, 1, 1, 1), text=('', self.whisperButton = DirectButton(parent=self.whisperFrame, image=(gui.find('**/ChtBx_ChtBtn_UP'), gui.find('**/ChtBx_ChtBtn_DN'), gui.find('**/ChtBx_ChtBtn_RLVR')), pos=(-0.33, 0, 0.033), scale=1.179, relief=None, image_color=Vec4(1, 1, 1, 1), text=('',
OTPLocalizer.ChatManagerChat, OTPLocalizer.ChatManagerChat,

View file

@ -1,8 +1,14 @@
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
from otp.otpbase import OTPLocalizer from otp.otpbase import OTPLocalizer, OTPGlobals
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
import time
class TTSFriendsManager(DistributedObjectGlobal): class TTSFriendsManager(DistributedObjectGlobal):
def __init__(self, cr):
DistributedObjectGlobal.__init__(self, cr)
self.nextTeleportFail = 0
def d_removeFriend(self, friendId): def d_removeFriend(self, friendId):
self.sendUpdate('removeFriend', [friendId]) self.sendUpdate('removeFriend', [friendId])
@ -69,7 +75,8 @@ class TTSFriendsManager(DistributedObjectGlobal):
friend = base.cr.identifyFriend(fromId) friend = base.cr.identifyFriend(fromId)
if not base.localAvatar.getTeleportAvailable() or base.localAvatar.ghostMode: if not base.localAvatar.getTeleportAvailable() or base.localAvatar.ghostMode:
if hasattr(friend, 'getName'): if hasattr(friend, 'getName') and self.nextTeleportFail < time.time():
self.nextTeleportFail = time.time() + OTPGlobals.TeleportFailCooldown
base.localAvatar.setSystemMessage(fromId, OTPLocalizer.WhisperFailedVisit % friend.getName()) base.localAvatar.setSystemMessage(fromId, OTPLocalizer.WhisperFailedVisit % friend.getName())
self.sendUpdate('teleportResponse', [ fromId, 0, 0, 0, 0 ]) self.sendUpdate('teleportResponse', [ fromId, 0, 0, 0, 0 ])
return return