diff --git a/dependencies/astron/databases/astrondb/.gitignore b/dependencies/astron/databases/astrondb/.gitignore old mode 100644 new mode 100755 index d6b7ef32..c96a04f0 --- a/dependencies/astron/databases/astrondb/.gitignore +++ b/dependencies/astron/databases/astrondb/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore +!.gitignore \ No newline at end of file diff --git a/otp/ai/BanManagerAI.py b/otp/ai/BanManagerAI.py index 26754fa5..a008615e 100755 --- a/otp/ai/BanManagerAI.py +++ b/otp/ai/BanManagerAI.py @@ -137,4 +137,4 @@ def ban(reason, duration): if reason not in ('hacking', 'language', 'other'): return "'%s' is not a valid reason." % reason simbase.air.banManager.ban(target.doId, duration, reason) - return "Banned %s from the game server!" % target.getName() \ No newline at end of file + return "Banned %s from the game server!" % target.getName() diff --git a/otp/avatar/LocalAvatar.py b/otp/avatar/LocalAvatar.py index 6b4d393d..36a4a29b 100755 --- a/otp/avatar/LocalAvatar.py +++ b/otp/avatar/LocalAvatar.py @@ -14,12 +14,14 @@ from direct.task import Task import math from panda3d.core import * import random - +import webbrowser +import numbers import DistributedAvatar from otp.ai.MagicWordGlobal import * from otp.otpbase import OTPGlobals from otp.otpbase import OTPLocalizer from otp.nametag.NametagConstants import * +from otp.margins.WhisperPopup import * from toontown.toonbase import ToontownGlobals @@ -893,16 +895,20 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis def displayWhisper(self, fromId, chatString, whisperType): sender = None - sfx = self.soundWhisper - if whisperType == WTNormal: - if sender == None: - return - chatString = sender.getName() + ': ' + chatString + + if isinstance(fromId, numbers.Number): + sender = base.cr.identifyAvatar(fromId) + + if whisperType == WTNormal: + chatString = '%s: %s' % (sender.getName(), chatString) + whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), whisperType) - if sender != None: - whisper.setClickable(sender.getName(), fromId) + + if sender or isinstance(fromId, basestring): + whisper.setClickable(fromId) + whisper.manage(base.marginManager) - base.playSfx(sfx) + base.playSfx(self.soundSystemMessage if whisperType == WTSystem else self.soundWhisper) def setAnimMultiplier(self, value): self.animMultiplier = value @@ -1069,7 +1075,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis def stopChat(self): self.chatMgr.stop() - self.ignore(OTPGlobals.WhisperIncomingEvent) self.ignore(OTPGlobals.ThinkPosHotkey) if self.__enableMarkerPlacement: self.ignore(OTPGlobals.PlaceMarkerHotkey) @@ -1107,6 +1112,10 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis self.setSystemMessage(0, OTPLocalizer.WhisperFriendLoggedOut % friend.getName()) def clickedWhisper(self, doId): + if isinstance(doId, basestring): + webbrowser.open(doId, new=2, autoraise=True) + return + friend = base.cr.identifyFriend(doId) if friend != None: diff --git a/otp/chat/ChatAgentUD.py b/otp/chat/ChatAgentUD.py index 1ece070f..5c1973f6 100755 --- a/otp/chat/ChatAgentUD.py +++ b/otp/chat/ChatAgentUD.py @@ -11,7 +11,7 @@ OFFENSE_MSGS = ('-- DEV CHAT -- word blocked: %s', 'Watch your language! This is class ChatAgentUD(DistributedObjectGlobalUD): notify = DirectNotifyGlobal.directNotify.newCategory('ChatAgentUD') - WantWhitelist = config.GetBool('want-whitelist', True) + wantWhitelist = config.GetBool('want-whitelist', True) chatMode2channel = { 1 : OtpDoGlobals.OTP_MOD_CHANNEL, @@ -36,7 +36,7 @@ class ChatAgentUD(DistributedObjectGlobalUD): 'Account sent chat without an avatar', message) return - if chatMode == 0: + if chatMode == 0 and self.wantWhitelist: if self.detectBadWords(self.air.getMsgSender(), message): return diff --git a/otp/margins/WhisperPopup.py b/otp/margins/WhisperPopup.py index 4b2bd260..8542fd94 100644 --- a/otp/margins/WhisperPopup.py +++ b/otp/margins/WhisperPopup.py @@ -65,7 +65,7 @@ class WhisperPopup(MarginPopup, ClickablePopup): if self.active and self.fromId: self.setClickRegionEvent('clickedWhisper', clickArgs=[self.fromId]) - def setClickable(self, senderName, fromId, todo=0): + def setClickable(self, fromId): self.active = True self.fromId = fromId diff --git a/otp/otpbase/OTPGlobals.py b/otp/otpbase/OTPGlobals.py index bcf25c28..8c989807 100755 --- a/otp/otpbase/OTPGlobals.py +++ b/otp/otpbase/OTPGlobals.py @@ -288,13 +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.' NoNumbersInTheMiddle = 'Numeric digits may not appear in the middle of a word.' ThreeWordsOrLess = 'Your name must be three words or fewer.' -AvatarFriendAddEvent = 'avatarFriendAddEvent' -AvatarNewFriendAddEvent = 'avatarNewFriendAddEvent' -AvatarFriendUpdateEvent = 'avatarFriendUpdateEvent' -AvatarFriendRemoveEvent = 'avatarFriendRemoveEvent' -AvatarFriendConsideringEvent = 'avatarFriendConsideringEvent' -AvatarFriendInvitationEvent = 'avatarFriendInvitationEvent' -AvatarFriendRejectInviteEvent = 'avatarFriendRejectInviteEvent' -AvatarFriendRetractInviteEvent = 'avatarFriendRetractInviteEvent' -AvatarFriendRejectRemoveEvent = 'avatarFriendRejectRemoveEvent' -WhisperIncomingEvent = 'whisperIncomingEvent' + +TeleportFailCooldown = 2.0 \ No newline at end of file diff --git a/otp/otpbase/OTPLocalizerEnglish.py b/otp/otpbase/OTPLocalizerEnglish.py index bf709ccf..71a80095 100755 --- a/otp/otpbase/OTPLocalizerEnglish.py +++ b/otp/otpbase/OTPLocalizerEnglish.py @@ -222,7 +222,6 @@ SCMenuIdesOfMarch = 'GREEN' ScMenuBugs = 'Bugs' FriendInviteeTooManyFriends = '%s would like to be your friend, but you already have too many friends on your list!' FriendInviteeInvitation = '%s would like to be your friend.' -FriendNotifictation = '%s is now your friend.' FriendInviteeOK = lOK FriendInviteeNo = lNo FriendOnline = 'has come online.' diff --git a/toontown/ai/ServiceStart.py b/toontown/ai/ServiceStart.py index 9854b017..d606d6f5 100755 --- a/toontown/ai/ServiceStart.py +++ b/toontown/ai/ServiceStart.py @@ -62,6 +62,8 @@ if ':' in host: port = int(port) simbase.air.connect(host, port) +isServer = config.GetBool('is-server', False) + try: run() gc.enable() @@ -69,5 +71,12 @@ except SystemExit: raise except Exception: info = describeException() + simbase.air.writeServerEvent('ai-exception', avId=simbase.air.getAvatarIdFromSender(), accId=simbase.air.getAccountIdFromSender(), exception=info) + + if isServer: + import datetime + with open(config.GetString('ai-crash-log-name', '/opt/var/log/%s-ai-crash-%s.txt' % (config.GetString('district-name', 'Devhaven'), datetime.datetime.now())), 'w+') as file: + file.write(info + "\n") + raise diff --git a/toontown/chat/ToontownChatManager.py b/toontown/chat/ToontownChatManager.py index 9140244c..80301e3f 100755 --- a/toontown/chat/ToontownChatManager.py +++ b/toontown/chat/ToontownChatManager.py @@ -20,7 +20,7 @@ class ToontownChatManager(ChatManager.ChatManager): 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.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.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, diff --git a/toontown/coghq/DistributedCashbotBossTreasureAI.py b/toontown/coghq/DistributedCashbotBossTreasureAI.py index a9a4995b..238b19ce 100755 --- a/toontown/coghq/DistributedCashbotBossTreasureAI.py +++ b/toontown/coghq/DistributedCashbotBossTreasureAI.py @@ -1,15 +1,22 @@ -class DistributedCashbotBossTreasureAI: - pass -'''from toontown.safezone import DistributedSZTreasureAI +from toontown.safezone import DistributedTreasureAI +from toontown.safezone import TreasureGlobals -class DistributedCashbotBossTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): +class DistributedCashbotBossTreasureAI(DistributedTreasureAI.DistributedTreasureAI): def __init__(self, air, boss, goon, style, fx, fy, fz): pos = goon.getPos() - DistributedSZTreasureAI.DistributedSZTreasureAI.__init__(self, air, boss, pos[0], pos[1], 0) + type = TreasureGlobals.SafeZoneTreasureSpawns[style][0] + DistributedTreasureAI.DistributedTreasureAI.__init__(self, air, boss, type, pos[0], pos[1], 0) self.goonId = goon.doId self.style = style self.finalPosition = (fx, fy, fz) + + def validAvatar(self, av): + if av.getHp() < av.getMaxHp() and av.getHp() > 0: + av.toonUp(self.healAmount) + return True + else: + return False def getGoonId(self): return self.goonId @@ -48,4 +55,4 @@ class DistributedCashbotBossTreasureAI(DistributedSZTreasureAI.DistributedSZTrea self.d_setFinalPosition(x, y, z) def d_setFinalPosition(self, x, y, z): - self.sendUpdate('setFinalPosition', [x, y, z])''' + self.sendUpdate('setFinalPosition', [x, y, z]) diff --git a/toontown/estate/Estate.py b/toontown/estate/Estate.py index 7087b9e6..160ab258 100755 --- a/toontown/estate/Estate.py +++ b/toontown/estate/Estate.py @@ -12,9 +12,9 @@ from toontown.toonbase import TTLocalizer import random from direct.showbase import PythonUtil from toontown.hood import Place -from toontown.hood import SkyUtil from toontown.pets import PetTutorial from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs, TLNull +from toontown.safezone import SZUtil import HouseGlobals class Estate(Place.Place): @@ -356,10 +356,10 @@ class Estate(Place.Place): def __setUnderwaterFog(self): if base.wantFog: - self.fog.setColor(0.245, 0.322, 0.5) self.fog.setLinearRange(0.1, 100.0) render.setFog(self.fog) self.loader.hood.sky.setFog(self.fog) + SZUtil.startUnderwaterFog() def __setWhiteFog(self): if base.wantFog: @@ -367,9 +367,11 @@ class Estate(Place.Place): self.fog.setLinearRange(0.0, 400.0) render.setFog(self.fog) self.loader.hood.sky.setFog(self.fog) + SZUtil.stopUnderwaterFog() def __setFaintFog(self): if base.wantFog: self.fog.setColor(Vec4(0.8, 0.8, 0.8, 1.0)) self.fog.setLinearRange(0.0, 700.0) render.setFog(self.fog) + SZUtil.stopUnderwaterFog() diff --git a/toontown/friends/FriendNotifier.py b/toontown/friends/FriendNotifier.py deleted file mode 100755 index 1dea79ce..00000000 --- a/toontown/friends/FriendNotifier.py +++ /dev/null @@ -1,59 +0,0 @@ -from panda3d.core import * -from toontown.toonbase.ToontownGlobals import * -from direct.showbase import DirectObject -from direct.directnotify import DirectNotifyGlobal -from toontown.toontowngui import TTDialog -from otp.otpbase import OTPLocalizer -from toontown.toontowngui import ToonHeadDialog -from direct.gui.DirectGui import DGG -from otp.otpbase import OTPGlobals - -class FriendNotifier(ToonHeadDialog.ToonHeadDialog): - notify = DirectNotifyGlobal.directNotify.newCategory('FriendNotifier') - - def __init__(self, avId, avName, avDNA, context, **kw): - self.avId = avId - self.avName = avName - self.avDNA = avDNA - self.context = context - text = OTPLocalizer.FriendNotifictation % self.avName - style = TTDialog.Acknowledge - buttonText = [OTPLocalizer.FriendInviteeOK, OTPLocalizer.FriendInviteeOK] - command = self.__handleButton - optiondefs = (('dialogName', 'FriendInvitee', None), - ('text', text, None), - ('style', style, None), - ('buttonText', buttonText, None), - ('command', command, None), - ('image_color', (1.0, 0.89, 0.77, 1.0), None), - ('geom_scale', 0.2, None), - ('geom_pos', (-0.1, 0, -0.025), None), - ('pad', (0.075, 0.075), None), - ('topPad', 0, None), - ('midPad', 0, None), - ('pos', (0.45, 0, 0.75), None), - ('scale', 0.75, None)) - self.defineoptions(kw, optiondefs) - ToonHeadDialog.ToonHeadDialog.__init__(self, self.avDNA) - self.initialiseoptions(FriendNotifier) - self.show() - return - - def cleanup(self): - ToonHeadDialog.ToonHeadDialog.cleanup(self) - - def __handleButton(self, value): - if value == DGG.DIALOG_OK: - pass - self.context = None - self.cleanup() - return - - def __handleOhWell(self, value): - self.cleanup() - - def __handleCancelFromAbove(self, context = None): - if context == None or context == self.context: - self.context = None - self.cleanup() - return diff --git a/toontown/friends/FriendsListManager.py b/toontown/friends/FriendsListManager.py index 257d7eb3..a4b4cab3 100755 --- a/toontown/friends/FriendsListManager.py +++ b/toontown/friends/FriendsListManager.py @@ -2,7 +2,6 @@ from panda3d.core import * import FriendsListPanel import FriendInviter import FriendInvitee -import FriendNotifier from direct.directnotify import DirectNotifyGlobal from toontown.toon import ToonTeleportPanel from toontown.friends import ToontownFriendSecret @@ -25,10 +24,9 @@ class FriendsListManager: self._preserveFriendsList = False self._entered = False self.friendsRequestQueue = [] - return def load(self): - self.accept(OTPGlobals.AvatarNewFriendAddEvent, self.__friendAdded) + pass def unload(self): self.exitFLM() @@ -135,13 +133,3 @@ class FriendsListManager: def preserveFriendsList(self): self.notify.debug('Preserving Friends List') self._preserveFriendsList = True - - def __friendAdded(self, avId): - if FriendInviter.globalFriendInviter != None: - messenger.send('FriendsListManagerAddEvent', [avId]) - else: - friendToon = base.cr.doId2do.get(avId) - if friendToon: - dna = friendToon.getStyle() - FriendNotifier.FriendNotifier(avId, friendToon.getName(), dna, None) - return diff --git a/toontown/friends/TTSFriendsManager.py b/toontown/friends/TTSFriendsManager.py index 566c0a2f..0366fec4 100755 --- a/toontown/friends/TTSFriendsManager.py +++ b/toontown/friends/TTSFriendsManager.py @@ -1,8 +1,14 @@ from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal -from otp.otpbase import OTPLocalizer +from otp.otpbase import OTPLocalizer, OTPGlobals from toontown.hood import ZoneUtil +import time class TTSFriendsManager(DistributedObjectGlobal): + + def __init__(self, cr): + DistributedObjectGlobal.__init__(self, cr) + self.nextTeleportFail = 0 + def d_removeFriend(self, friendId): self.sendUpdate('removeFriend', [friendId]) @@ -69,7 +75,8 @@ class TTSFriendsManager(DistributedObjectGlobal): friend = base.cr.identifyFriend(fromId) 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()) self.sendUpdate('teleportResponse', [ fromId, 0, 0, 0, 0 ]) return diff --git a/toontown/hood/EstateHood.py b/toontown/hood/EstateHood.py index 7ebd888d..3fdde689 100755 --- a/toontown/hood/EstateHood.py +++ b/toontown/hood/EstateHood.py @@ -5,13 +5,12 @@ from toontown.distributed.ToontownMsgTypes import * from direct.fsm import ClassicFSM, State from toontown.minigame import Purchase from otp.avatar import DistributedAvatar -from toontown.hood import SkyUtil from direct.task.Task import Task from toontown.hood.Hood import Hood from toontown.estate.EstateLoader import EstateLoader from toontown.estate import HouseGlobals from toontown.hood import ZoneUtil - +from toontown.safezone import SZUtil class EstateHood(Hood): notify = directNotify.newCategory('EstateHood') @@ -113,12 +112,12 @@ class EstateHood(Hood): self.popupInfo.reparentTo(hidden) def skyTrack(self, task): - return SkyUtil.cloudSkyTrack(task) + return SZUtil.cloudSkyTrack(task) def startSky(self): if not self.sky.getTag('sky') == 'Regular': self.endSpookySky() - SkyUtil.startCloudSky(self) + SZUtil.startCloudSky(self) if base.cloudPlatformsEnabled: self.loader.startCloudPlatforms() diff --git a/toontown/hood/PartyHood.py b/toontown/hood/PartyHood.py index b46c9bc3..669644b1 100755 --- a/toontown/hood/PartyHood.py +++ b/toontown/hood/PartyHood.py @@ -7,11 +7,9 @@ from toontown.toonbase.ToonBaseGlobal import * from toontown.toonbase.ToontownGlobals import * from toontown.distributed.ToontownMsgTypes import * from toontown.minigame import Purchase -from toontown.parties import PartyLoader -from toontown.parties import PartyGlobals -from toontown.hood import SkyUtil -from toontown.hood import Hood -from toontown.hood import ZoneUtil +from toontown.parties import PartyLoader, PartyGlobals +from toontown.hood import Hood, ZoneUtil +from toontown.safezone import SZUtil class PartyHood(Hood.Hood): notify = DirectNotifyGlobal.directNotify.newCategory('PartyHood') @@ -30,7 +28,6 @@ class PartyHood(Hood.Hood): self.holidayStorageDNADict = {CHRISTMAS: ['phase_5.5/dna/winter_storage_estate.pdna']} self.skyFile = 'phase_3.5/models/props/TT_sky' self.popupInfo = None - return def load(self): Hood.Hood.load(self) @@ -107,10 +104,10 @@ class PartyHood(Hood.Hood): pass def skyTrack(self, task): - return SkyUtil.cloudSkyTrack(task) + return SZUtil.cloudSkyTrack(task) def startSky(self): - SkyUtil.startCloudSky(self) + SZUtil.startCloudSky(self) if base.cloudPlatformsEnabled: self.loader.startCloudPlatforms() diff --git a/toontown/hood/SkyUtil.py b/toontown/hood/SkyUtil.py deleted file mode 100755 index 012fc4ef..00000000 --- a/toontown/hood/SkyUtil.py +++ /dev/null @@ -1,37 +0,0 @@ -from pandac.PandaModules import CompassEffect, NodePath -from direct.task.Task import Task - - -notify = directNotify.newCategory('SkyUtil') - - -def cloudSkyTrack(task): - task.h += globalClock.getDt() * 0.25 - if task.cloud1.isEmpty() or task.cloud2.isEmpty(): - notify.warning("Couldn't find clouds!") - return Task.done - - task.cloud1.setH(task.h) - task.cloud2.setH(-task.h * 0.8) - return Task.cont - - -def startCloudSky(hood, parent=camera, effects=CompassEffect.PRot | CompassEffect.PZ): - hood.sky.reparentTo(parent) - hood.sky.setDepthTest(0) - hood.sky.setDepthWrite(0) - hood.sky.setBin('background', 100) - hood.sky.find('**/Sky').reparentTo(hood.sky, -1) - hood.sky.reparentTo(parent) - hood.sky.setZ(0.0) - hood.sky.setHpr(0.0, 0.0, 0.0) - ce = CompassEffect.make(NodePath(), effects) - hood.sky.node().setEffect(ce) - skyTrackTask = Task(hood.skyTrack) - skyTrackTask.h = 0 - skyTrackTask.cloud1 = hood.sky.find('**/cloud1') - skyTrackTask.cloud2 = hood.sky.find('**/cloud2') - if not skyTrackTask.cloud1.isEmpty() and not skyTrackTask.cloud2.isEmpty(): - taskMgr.add(skyTrackTask, 'skyTrack') - else: - notify.warning("Couldn't find clouds!") diff --git a/toontown/hood/ToonHood.py b/toontown/hood/ToonHood.py index 6c43b495..c8c5c81a 100755 --- a/toontown/hood/ToonHood.py +++ b/toontown/hood/ToonHood.py @@ -9,7 +9,7 @@ from toontown.hood.Hood import Hood from toontown.building import SuitInterior from toontown.cogdominium import CogdoInterior from toontown.toon.Toon import teleportDebug -from toontown.hood import SkyUtil +from toontown.safezone import SZUtil class ToonHood(Hood): notify = directNotify.newCategory('ToonHood') @@ -208,12 +208,12 @@ class ToonHood(Hood): pass def skyTrack(self, task): - return SkyUtil.cloudSkyTrack(task) + return SZUtil.cloudSkyTrack(task) def startSky(self): if not self.sky.getTag('sky') == 'Regular': self.endSpookySky() - SkyUtil.startCloudSky(self) + SZUtil.startCloudSky(self) def startSpookySky(self): if hasattr(self, 'sky') and self.sky: @@ -237,10 +237,10 @@ class ToonHood(Hood): def setUnderwaterFog(self): if base.wantFog: - self.fog.setColor(0.245, 0.322, 0.5) self.fog.setLinearRange(0.1, 100.0) render.setFog(self.fog) self.sky.setFog(self.fog) + SZUtil.startUnderwaterFog() def setWhiteFog(self): if base.wantFog: @@ -250,8 +250,10 @@ class ToonHood(Hood): render.setFog(self.fog) self.sky.clearFog() self.sky.setFog(self.fog) + SZUtil.stopUnderwaterFog() def setNoFog(self): if base.wantFog: render.clearFog() self.sky.clearFog() + SZUtil.stopUnderwaterFog() diff --git a/toontown/makeatoon/ColorShop.py b/toontown/makeatoon/ColorShop.py index f000a3ac..9ed310cb 100755 --- a/toontown/makeatoon/ColorShop.py +++ b/toontown/makeatoon/ColorShop.py @@ -18,19 +18,18 @@ class ColorShop(StateData.StateData): self.colorAll = 1 def getColorList(self): - return ToonDNA.allColorsList + return ToonDNA.matColorsList def enter(self, toon, shopsVisited = []): base.disableMouse() self.toon = toon self.dna = toon.getStyle() colorList = self.getColorList() - self.allParts = (TTLocalizer.ColorAll, TTLocalizer.ColorShopHead, TTLocalizer.ColorShopBody, TTLocalizer.ColorShopGloves, TTLocalizer.ColorShopLegs) + self.allParts = (TTLocalizer.ColorAll, TTLocalizer.ColorShopHead, TTLocalizer.ColorShopBody, TTLocalizer.ColorShopLegs) if not hasattr(self, 'headChoice'): self.headChoice = colorList.index(self.dna.headColor) self.allChoice = self.headChoice self.armChoice = colorList.index(self.dna.armColor) - self.gloveChoice = colorList.index(self.dna.gloveColor) self.legChoice = colorList.index(self.dna.legColor) self.partChoice = 0 @@ -74,19 +73,16 @@ class ColorShop(StateData.StateData): shuffleImage = (self.gui.find('**/tt_t_gui_mat_shuffleArrowUp'), self.gui.find('**/tt_t_gui_mat_shuffleArrowDown'), self.gui.find('**/tt_t_gui_mat_shuffleArrowUp'), self.gui.find('**/tt_t_gui_mat_shuffleArrowDisabled')) self.parentFrame = self.getNewFrame() self.advancedFrame = self.getNewFrame() - self.toonFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, 0.1), hpr=(0, 0, 0), scale=1.3, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopToon, text_scale=TTLocalizer.CStoonFrame, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) + self.toonFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.073), hpr=(0, 0, 0), scale=1.3, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopToon, text_scale=TTLocalizer.CStoonFrame, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) self.allLButton = DirectButton(parent=self.toonFrame, relief=None, image=shuffleImage, image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-0.2, 0, 0), command=self.__swapAllColor, extraArgs=[-1]) self.allRButton = DirectButton(parent=self.toonFrame, relief=None, image=shuffleImage, image_scale=halfButtonInvertScale, image1_scale=halfButtonInvertHoverScale, image2_scale=halfButtonInvertHoverScale, pos=(0.2, 0, 0), command=self.__swapAllColor, extraArgs=[1]) - self.headFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.15), hpr=(0, 0, 2), scale=0.9, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopHead, text_scale=0.0625, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) + self.headFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.3), hpr=(0, 0, 2), scale=0.9, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopHead, text_scale=0.0625, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) self.headLButton = DirectButton(parent=self.headFrame, relief=None, image=shuffleImage, image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-0.2, 0, 0), command=self.__swapHeadColor, extraArgs=[-1]) self.headRButton = DirectButton(parent=self.headFrame, relief=None, image=shuffleImage, image_scale=halfButtonInvertScale, image1_scale=halfButtonInvertHoverScale, image2_scale=halfButtonInvertHoverScale, pos=(0.2, 0, 0), command=self.__swapHeadColor, extraArgs=[1]) - self.bodyFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonScale, relief=None, pos=(0, 0, -0.35), hpr=(0, 0, -2), scale=0.9, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopBody, text_scale=0.0625, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) + self.bodyFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonScale, relief=None, pos=(0, 0, -0.5), hpr=(0, 0, -2), scale=0.9, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopBody, text_scale=0.0625, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) self.armLButton = DirectButton(parent=self.bodyFrame, relief=None, image=shuffleImage, image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-0.2, 0, 0), command=self.__swapArmColor, extraArgs=[-1]) self.armRButton = DirectButton(parent=self.bodyFrame, relief=None, image=shuffleImage, image_scale=halfButtonInvertScale, image1_scale=halfButtonInvertHoverScale, image2_scale=halfButtonInvertHoverScale, pos=(0.2, 0, 0), command=self.__swapArmColor, extraArgs=[1]) - self.gloveFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.55), hpr=(0, 0, 2), scale=0.9, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopGloves, text_scale=0.0625, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) - self.gloveLButton = DirectButton(parent=self.gloveFrame, relief=None, image=shuffleImage, image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-0.2, 0, 0), command=self.__swapGloveColor, extraArgs=[-1]) - self.gloveRButton = DirectButton(parent=self.gloveFrame, relief=None, image=shuffleImage, image_scale=halfButtonInvertScale, image1_scale=halfButtonInvertHoverScale, image2_scale=halfButtonInvertHoverScale, pos=(0.2, 0, 0), command=self.__swapGloveColor, extraArgs=[1]) - self.legsFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.75), hpr=(0, 0, -2), scale=0.9, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopLegs, text_scale=0.0625, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) + self.legsFrame = DirectFrame(parent=self.parentFrame, image=shuffleFrame, image_scale=halfButtonInvertScale, relief=None, pos=(0, 0, -0.7), hpr=(0, 0, 3), scale=0.9, frameColor=(1, 1, 1, 1), text=TTLocalizer.ColorShopLegs, text_scale=0.0625, text_pos=(-0.001, -0.015), text_fg=(1, 1, 1, 1)) self.legLButton = DirectButton(parent=self.legsFrame, relief=None, image=shuffleImage, image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-0.2, 0, 0), command=self.__swapLegColor, extraArgs=[-1]) self.legRButton = DirectButton(parent=self.legsFrame, relief=None, image=shuffleImage, image_scale=halfButtonInvertScale, image1_scale=halfButtonInvertHoverScale, image2_scale=halfButtonInvertHoverScale, pos=(0.2, 0, 0), command=self.__swapLegColor, extraArgs=[1]) self.advancedButton = DirectButton(parent=self.parentFrame, relief=None, image=(shuffleUp, shuffleDown, shuffleUp), image_scale=(-0.8, 0.6, 0.6), image1_scale=(-0.83, 0.6, 0.6), image2_scale=(-0.83, 0.6, 0.6), text=TTLocalizer.ColorAdvanced, text_font=ToontownGlobals.getInterfaceFont(), text_scale=TTLocalizer.SBshuffleBtn, text_pos=(0, -0.02), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), pos=(0, 0, -1.15), command=self.popupAdvancedMenu) @@ -119,8 +115,6 @@ class ColorShop(StateData.StateData): self.headRButton.destroy() self.armLButton.destroy() self.armRButton.destroy() - self.gloveLButton.destroy() - self.gloveRButton.destroy() self.legLButton.destroy() self.legRButton.destroy() self.allLButton.destroy() @@ -143,8 +137,6 @@ class ColorShop(StateData.StateData): del self.headRButton del self.armLButton del self.armRButton - del self.gloveLButton - del self.gloveRButton del self.legLButton del self.legRButton del self.allLButton @@ -215,8 +207,6 @@ class ColorShop(StateData.StateData): if self.partChoice in (0, 2): self.dna.armColor = rgb if self.partChoice in (0, 3): - self.dna.gloveColor = rgb - if self.partChoice in (0, 4): self.dna.legColor = rgb self.toon.swapToonColor(self.dna) @@ -242,12 +232,10 @@ class ColorShop(StateData.StateData): self.__updateScrollButtons(self.allChoice, length, self.allLButton, self.allRButton) self.__updateScrollButtons(self.allChoice, length, self.headLButton, self.headRButton) self.__updateScrollButtons(self.allChoice, length, self.armLButton, self.armRButton) - self.__updateScrollButtons(self.allChoice, length, self.gloveLButton, self.gloveRButton) self.__updateScrollButtons(self.allChoice, length, self.legLButton, self.legRButton) newColor = colorList[self.allChoice] self.dna.headColor = newColor self.dna.armColor = newColor - self.dna.gloveColor = newColor self.dna.legColor = newColor self.toon.swapToonColor(self.dna) @@ -269,15 +257,6 @@ class ColorShop(StateData.StateData): self.dna.armColor = newColor self.toon.swapToonColor(self.dna) - def __swapGloveColor(self, offset): - colorList = self.getColorList() - length = len(colorList) - self.gloveChoice = (self.gloveChoice + offset) % length - self.__updateScrollButtons(self.gloveChoice, length, self.gloveLButton, self.gloveRButton) - newColor = colorList[self.gloveChoice] - self.dna.gloveColor = newColor - self.toon.swapToonColor(self.dna) - def __swapLegColor(self, offset): colorList = self.getColorList() length = len(colorList) @@ -311,16 +290,13 @@ class ColorShop(StateData.StateData): newChoice = self.shuffleButton.getCurrChoice() newHeadColorIndex = self.indexOf(colorList, newChoice[0], 25) newArmColorIndex = self.indexOf(colorList, newChoice[1], 25) - newGloveColorIndex = self.indexOf(colorList, newChoice[2], 0) - newLegColorIndex = self.indexOf(colorList, newChoice[3], 25) + newLegColorIndex = self.indexOf(colorList, newChoice[2], 25) self.__swapHeadColor(newHeadColorIndex - self.headChoice) if self.colorAll: self.__swapArmColor(newHeadColorIndex - self.armChoice) - self.__swapGloveColor(newHeadColorIndex - self.gloveChoice) self.__swapLegColor(newHeadColorIndex - self.legChoice) else: self.__swapArmColor(newArmColorIndex - self.armChoice) - self.__swapGloveColor(newGloveColorIndex - self.gloveChoice) self.__swapLegColor(newLegColorIndex - self.legChoice) def indexOf(self, list, item, default): @@ -330,4 +306,4 @@ class ColorShop(StateData.StateData): return default def getCurrToonSetting(self): - return [self.dna.headColor, self.dna.armColor, self.dna.gloveColor, self.dna.legColor] + return [self.dna.headColor, self.dna.armColor, self.dna.legColor] diff --git a/toontown/minigame/DistributedTagGame.py b/toontown/minigame/DistributedTagGame.py index b9dd7197..83495aa1 100755 --- a/toontown/minigame/DistributedTagGame.py +++ b/toontown/minigame/DistributedTagGame.py @@ -4,7 +4,7 @@ from DistributedMinigame import * from direct.interval.IntervalGlobal import * from direct.fsm import ClassicFSM, State from direct.fsm import State -from toontown.safezone import Walk, SnowUtil +from toontown.safezone import Walk, SZUtil from toontown.toonbase import ToontownTimer from direct.gui import OnscreenText import MinigameAvatarScorePanel @@ -54,7 +54,7 @@ class DistributedTagGame(DistributedMinigame): self.IT = None if TagGameGlobals.isSnowHood(safezoneId): - self.snow, self.snowRender = SnowUtil.createSnow(self.ground) + self.snow, self.snowRender = SZUtil.createSnow(self.ground) return diff --git a/toontown/parties/Party.py b/toontown/parties/Party.py index 0a898b45..69d15adc 100755 --- a/toontown/parties/Party.py +++ b/toontown/parties/Party.py @@ -12,7 +12,6 @@ import random from direct.showbase import PythonUtil from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs, TLNull from toontown.hood import Place -from toontown.hood import SkyUtil from toontown.parties import PartyPlanner from toontown.parties.DistributedParty import DistributedParty diff --git a/toontown/racing/DistributedRace.py b/toontown/racing/DistributedRace.py index 7293057e..8a55d038 100755 --- a/toontown/racing/DistributedRace.py +++ b/toontown/racing/DistributedRace.py @@ -19,7 +19,6 @@ from math import sqrt from RaceGUI import RaceGUI import RaceGlobals from direct.task.Task import Task -from toontown.hood import SkyUtil from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.battle.BattleProps import * @@ -29,6 +28,7 @@ from toontown.racing import EffectManager from toontown.racing import PiejectileManager from toontown.dna.DNAParser import * from otp.ai.MagicWordGlobal import * +from toontown.safezone import SZUtil class DistributedRace(DistributedObject.DistributedObject): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedRace') @@ -1095,13 +1095,13 @@ class DistributedRace(DistributedObject.DistributedObject): self.gui.racerLeft(avId, unexpected=False) def skyTrack(self, task): - return SkyUtil.cloudSkyTrack(task) + return SZUtil.cloudSkyTrack(task) def startSky(self): if self.hasFog: - SkyUtil.startCloudSky(self, parent=self.dummyNode, effects=CompassEffect.PRot) + SZUtil.startCloudSky(self, parent=self.dummyNode, effects=CompassEffect.PRot) else: - SkyUtil.startCloudSky(self, parent=render) + SZUtil.startCloudSky(self, parent=render) def stopSky(self): taskMgr.remove('skyTrack') diff --git a/toontown/safezone/BRSafeZoneLoader.py b/toontown/safezone/BRSafeZoneLoader.py index 01e8007f..ccff4642 100755 --- a/toontown/safezone/BRSafeZoneLoader.py +++ b/toontown/safezone/BRSafeZoneLoader.py @@ -1,6 +1,6 @@ from toontown.safezone import BRPlayground from toontown.safezone import SafeZoneLoader -import SnowUtil +import SZUtil class BRSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): def __init__(self, hood, parentFSM, doneEvent): @@ -16,7 +16,7 @@ class BRSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): self.windSound = map(base.loadSfx, ['phase_8/audio/sfx/SZ_TB_wind_1.ogg', 'phase_8/audio/sfx/SZ_TB_wind_2.ogg', 'phase_8/audio/sfx/SZ_TB_wind_3.ogg']) - self.snow, self.snowRender = SnowUtil.createSnow(self.geom) + self.snow, self.snowRender = SZUtil.createSnow(self.geom) def unload(self): SafeZoneLoader.SafeZoneLoader.unload(self) diff --git a/toontown/safezone/SZUtil.py b/toontown/safezone/SZUtil.py new file mode 100644 index 00000000..3a63ad86 --- /dev/null +++ b/toontown/safezone/SZUtil.py @@ -0,0 +1,60 @@ +from panda3d.core import * +from direct.task.Task import Task +from toontown.battle import BattleParticles +import colorsys + +def createSnow(geom): + snow = BattleParticles.loadParticleFile('snowdisk.ptf') + snow.setPos(0, 0, 5) + snowRender = geom.attachNewNode('snowRender') + snowRender.setDepthWrite(0) + snowRender.setBin('fixed', 1) + + return snow, snowRender + +def startUnderwaterFog(): + if not base.wantFog: + return + + stopUnderwaterFog() + taskMgr.add(__updateUnderwaterFog, 'underwaterFog') + +def stopUnderwaterFog(): + taskMgr.remove('underwaterFog') + +def __updateUnderwaterFog(task): + fog = base.cr.playGame.hood.fog if hasattr(base.cr.playGame.hood, 'fog') else base.cr.playGame.place.fog + saturation = min(max((base.localAvatar.getZ() / -12.3), 0.51), 1) + fog.setColor(*colorsys.hsv_to_rgb(0.616, saturation, 0.5)) + return task.cont + +def cloudSkyTrack(task): + task.h += globalClock.getDt() * 0.25 + + if task.cloud1.isEmpty() or task.cloud2.isEmpty(): + return + + task.cloud1.setH(task.h) + task.cloud2.setH(-task.h * 0.8) + return task.cont + +def startCloudSky(hood, parent=camera, effects=CompassEffect.PRot | CompassEffect.PZ): + hood.sky.reparentTo(parent) + hood.sky.setDepthTest(0) + hood.sky.setDepthWrite(0) + hood.sky.setBin('background', 100) + hood.sky.find('**/Sky').reparentTo(hood.sky, -1) + hood.sky.reparentTo(parent) + hood.sky.setZ(0.0) + hood.sky.setHpr(0.0, 0.0, 0.0) + + ce = CompassEffect.make(NodePath(), effects) + + hood.sky.node().setEffect(ce) + skyTrackTask = Task(hood.skyTrack) + skyTrackTask.h = 0 + skyTrackTask.cloud1 = hood.sky.find('**/cloud1') + skyTrackTask.cloud2 = hood.sky.find('**/cloud2') + + if not skyTrackTask.cloud1.isEmpty() and not skyTrackTask.cloud2.isEmpty(): + taskMgr.add(skyTrackTask, 'skyTrack') \ No newline at end of file diff --git a/toontown/safezone/SnowUtil.py b/toontown/safezone/SnowUtil.py deleted file mode 100644 index 6b73eee2..00000000 --- a/toontown/safezone/SnowUtil.py +++ /dev/null @@ -1,10 +0,0 @@ -from toontown.battle import BattleParticles - -def createSnow(geom): - snow = BattleParticles.loadParticleFile('snowdisk.ptf') - snow.setPos(0, 0, 5) - snowRender = geom.attachNewNode('snowRender') - snowRender.setDepthWrite(0) - snowRender.setBin('fixed', 1) - - return snow, snowRender diff --git a/toontown/safezone/Walk.py b/toontown/safezone/Walk.py index bbd4c0aa..d61fcc18 100755 --- a/toontown/safezone/Walk.py +++ b/toontown/safezone/Walk.py @@ -1,9 +1,6 @@ from panda3d.core import * -from direct.task.Task import Task from direct.directnotify import DirectNotifyGlobal -from direct.fsm import StateData -from direct.fsm import ClassicFSM, State -import colorsys +from direct.fsm import ClassicFSM, StateData, State class Walk(StateData.StateData): notify = DirectNotifyGlobal.directNotify.newCategory('Walk') @@ -91,13 +88,7 @@ class Walk(StateData.StateData): self.swimSoundPlaying = 0 self.swimSound.stop() - saturation = min(max((base.localAvatar.getZ() / -12.3), 0.51), 1) - self.getFog().setColor(*colorsys.hsv_to_rgb(0.616, saturation, 0.5)) - - return Task.cont - - def getFog(self): - return base.cr.playGame.hood.fog if hasattr(base.cr.playGame.hood, 'fog') else base.cr.playGame.place.fog + return task.cont def enterSlowWalking(self): self.accept(base.localAvatar.uniqueName('positiveHP'), self.__handlePositiveHP) diff --git a/toontown/shtiker/DisplaySettingsDialog.py b/toontown/shtiker/DisplaySettingsDialog.py index 745f138b..c979192c 100755 --- a/toontown/shtiker/DisplaySettingsDialog.py +++ b/toontown/shtiker/DisplaySettingsDialog.py @@ -45,16 +45,16 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData): self.anyChanged = 0 self.apiChanged = 0 - if len(base.resDict[base.nativeRatio]) > 1: - # We have resolutions that match our native ratio and fit it: - self.screenSizes = sorted(base.resDict[base.nativeRatio]) - else: - # Okay, we don't have any resolutions that match our native ratio - # and fit it (besides the native resolution itself, of course). - # Let's just use the second largest ratio's resolutions: - ratios = sorted(base.resDict.keys(), reverse=False) - nativeIndex = ratios.index(base.nativeRatio) - self.screenSizes = sorted(base.resDict[ratios[nativeIndex - 1]]) + self.screenSizes = ((640, 480), + (800, 600), + (1024, 768), + (1280, 720), + (1280, 1024), + (1440, 900), + (1600, 900), + (1600, 1200), + (1920, 1080), + (2560, 1440)) guiButton = loader.loadModel('phase_3/models/gui/quit_button.bam') gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui.bam') @@ -298,26 +298,12 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData): self.current_pipe = base.pipe self.current_properties = WindowProperties(base.win.getProperties()) properties = self.current_properties - if self.current_pipe == pipe and self.current_properties.getFullscreen() == fullscreen and self.current_properties.getXSize() == width and self.current_properties.getYSize() == height: + + if self.current_pipe == pipe and self.current_properties.getFullscreen() == fullscreen and self.current_properties.getXSize() == width and self.current_properties.getYSize() == height: self.notify.info('DISPLAY NO CHANGE REQUIRED') state = True else: properties = WindowProperties() - if fullscreen: - width, height = (base.nativeWidth, base.nativeHeight) - elif self.current_properties.getFullscreen(): - if len(base.resDict[base.nativeRatio]) > 1: - # We have resolutions that match our native ratio and fit - # it! Let's use one: - width, height = sorted(base.resDict[base.nativeRatio])[0] - else: - # Okay, we don't have any resolutions that match our native - # ratio and fit it (besides the native resolution itself, - # of course). Let's just use one of the second largest - # ratio's resolutions: - ratios = sorted(base.resDict.keys(), reverse=False) - nativeIndex = ratios.index(base.nativeRatio) - width, height = sorted(base.resDict[ratios[nativeIndex - 1]])[0] properties.setSize(width, height) properties.setFullscreen(fullscreen) properties.setParentWindow(0) diff --git a/toontown/shtiker/MapPage.py b/toontown/shtiker/MapPage.py index cc5f4c0e..835e55c2 100755 --- a/toontown/shtiker/MapPage.py +++ b/toontown/shtiker/MapPage.py @@ -75,7 +75,6 @@ class MapPage(ShtikerPage.ShtikerPage): text=TTLocalizer.MapPageBackToPlayground, text_scale=TTLocalizer.MPsafeZoneButton, text_pos=(0, -0.02), - textMayChange=0, command=self.backToSafeZone) self.goHomeButton = DirectButton( parent=self.map, @@ -86,7 +85,6 @@ class MapPage(ShtikerPage.ShtikerPage): text=TTLocalizer.MapPageGoHome, text_scale=TTLocalizer.MPgoHomeButton, text_pos=(0, -0.02), - textMayChange=0, command=self.goHome) self.goHomeButton.hide() guiButton.removeNode() diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index 311767fb..c7f92c29 100755 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -827,7 +827,6 @@ class ExtraOptionsTabPage(DirectFrame): chooser = self.optionChoosers['pole'] if resetIndex: - print 'resetting index' chooser.setIndex(base.localAvatar.getFishingRod()) chooser.setDisplayText(TTLocalizer.FishingRodNameDict[chooser.index]) diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 8769d196..3401332d 100755 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -2211,10 +2211,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute from toontown.shtiker import EventsPage if hasattr(self, 'eventsPage') and base.localAvatar.book.entered and base.localAvatar.book.isOnPage(self.eventsPage) and self.eventsPage.getMode() == EventsPage.EventsPage_Host: base.localAvatar.eventsPage.loadHostedPartyInfo() - if hasattr(self, 'displaySystemClickableWhisper'): - self.displaySystemClickableWhisper(0, TTLocalizer.PartyCanStart, whisperType=WTSystem) - else: - self.setSystemMessage(0, TTLocalizer.PartyCanStart) + self.setSystemMessage(0, TTLocalizer.PartyCanStart, WTSystem) def setPartyStatus(self, partyId, newStatus): DistributedToon.partyNotify.debug('setPartyCanStatus called passing in partyId=%s status=%s' % (partyId, newStatus)) @@ -2232,7 +2229,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute from toontown.shtiker import EventsPage if hasattr(self, 'eventsPage') and base.localAvatar.book.entered and base.localAvatar.book.isOnPage(self.eventsPage) and self.eventsPage.getMode() == EventsPage.EventsPage_Invited: base.localAvatar.eventsPage.loadInvitations() - if newStatus == PartyStatus.Started and hasattr(self, 'displaySystemClickableWhisper'): + if newStatus == PartyStatus.Started and hasattr(self, 'setSystemMessage'): invite = self.getInviteForPartyId(partyId) if invite: name = ' ' @@ -2241,10 +2238,9 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute name = host.getName() if invite.status == InviteStatus.Accepted: displayStr = TTLocalizer.PartyHasStartedAcceptedInvite % TTLocalizer.GetPossesive(name) - self.displaySystemClickableWhisper(-1, displayStr, whisperType=WTSystem) else: displayStr = TTLocalizer.PartyHasStartedNotAcceptedInvite % TTLocalizer.GetPossesive(name) - self.setSystemMessage(partyInfo.hostId, displayStr, whisperType=WTSystem) + self.setSystemMessage(partyInfo.hostId, displayStr, WTSystem) break if not found: diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 580159a4..6a54f2fe 100755 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -11,8 +11,6 @@ from panda3d.core import * import random import re import time -import zlib - import DistributedToon import LaffMeter import Toon @@ -144,9 +142,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.guiConflict = 0 self.lastElevatorLeft = 0 self.elevatorNotifier = ElevatorNotifier.ElevatorNotifier() - self.accept(OTPGlobals.AvatarFriendAddEvent, self.sbFriendAdd) - self.accept(OTPGlobals.AvatarFriendUpdateEvent, self.sbFriendUpdate) - self.accept(OTPGlobals.AvatarFriendRemoveEvent, self.sbFriendRemove) self._zoneId = None self.accept('system message aknowledge', self.systemWarning) self.systemMsgAckGuiDoneEvent = 'systemMsgAckGuiDoneEvent' @@ -416,12 +411,11 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): return if base.whiteList: - chat = base.whiteList.processThroughAll(chat, sender, self.chatGarbler) + chat = base.whiteList.processThroughAll(chat, sender, sender.chatGarbler) - name = sender.getName() - chatString = '%s: %s' % (name, chat) + chatString = '%s: %s' % (sender.getName(), chat) whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), WTNormal) - whisper.setClickable(name, avId) + whisper.setClickable(avId) whisper.manage(base.marginManager) base.playSfx(self.soundWhisper) @@ -778,73 +772,9 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): else: self.__pieButton['text'] = str(self.numPies) self.__pieButtonCount = self.numPies - return - + def displayWhisper(self, fromId, chatString, whisperType): - sender = None - sfx = self.soundWhisper - if fromId == TTLocalizer.Clarabelle: - chatString = TTLocalizer.Clarabelle + ': ' + chatString - sfx = self.soundPhoneRing - elif fromId != 0: - sender = base.cr.identifyAvatar(fromId) - if whisperType == WTNormal: - if sender == None: - return - chatString = sender.getName() + ': ' + chatString - elif whisperType == WTSystem: - sfx = self.soundSystemMessage - whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), whisperType) - if sender != None: - whisper.setClickable(sender.getName(), fromId) - whisper.manage(base.marginManager) - base.playSfx(sfx) - return - - def displaySystemClickableWhisper(self, fromId, chatString, whisperType): - sender = None - sfx = self.soundWhisper - if fromId == TTLocalizer.Clarabelle: - chatString = TTLocalizer.Clarabelle + ': ' + chatString - sfx = self.soundPhoneRing - elif fromId != 0: - sender = base.cr.identifyAvatar(fromId) - if whisperType == WTNormal: - if sender == None: - return - chatString = sender.getName() + ': ' + chatString - elif whisperType == WTSystem: - sfx = self.soundSystemMessage - whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), whisperType) - whisper.setClickable('', fromId) - whisper.manage(base.marginManager) - base.playSfx(sfx) - return - - def clickedWhisper(self, doId): - if doId > 0: - LocalAvatar.LocalAvatar.clickedWhisper(self, doId) - else: - foundCanStart = False - for partyInfo in self.hostedParties: - if partyInfo.status == PartyGlobals.PartyStatus.CanStart: - foundCanStart = True - break - - if base.cr and base.cr.playGame and base.cr.playGame.getPlace() and base.cr.playGame.getPlace().fsm: - fsm = base.cr.playGame.getPlace().fsm - curState = fsm.getCurrentState().getName() - if curState == 'walk': - if hasattr(self, 'eventsPage'): - desiredMode = -1 - if doId == -1: - desiredMode = EventsPage.EventsPage_Invited - elif foundCanStart: - desiredMode = EventsPage.EventsPage_Host - if desiredMode >= 0: - self.book.setPage(self.eventsPage) - self.eventsPage.setMode(desiredMode) - fsm.request('stickerBook') + LocalAvatar.LocalAvatar.displayWhisper(self, fromId, chatString, whisperType) def loadFurnitureGui(self): if self.__furnitureGui: @@ -861,7 +791,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): bMoveStartUp], text=['', TTLocalizer.HDMoveFurnitureButton, TTLocalizer.HDMoveFurnitureButton], text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_font=ToontownGlobals.getInterfaceFont(), pos=(-0.3, 0, 9.4), command=self.__startMoveFurniture) self.__furnitureGui.hide() guiModels.removeNode() - return def showFurnitureGui(self): self.loadFurnitureGui() @@ -1630,15 +1559,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.notify.info('closing shard...') base.cr.gameFSM.request('closeShard', ['afkTimeout']) - def sbFriendAdd(self, id, info): - print 'sbFriendAdd' - - def sbFriendUpdate(self, id, info): - print 'sbFriendUpdate' - - def sbFriendRemove(self, id): - print 'sbFriendRemove' - def addGolfPage(self): if self.hasPlayedGolf(): if hasattr(self, 'golfPage') and self.golfPage != None: diff --git a/toontown/toon/ToonDNA.py b/toontown/toon/ToonDNA.py index cdf58fdd..38798263 100755 --- a/toontown/toon/ToonDNA.py +++ b/toontown/toon/ToonDNA.py @@ -1932,6 +1932,12 @@ allColorsList = [(1.0, 1.0, 1.0, 1.0), (0.86, 0.07, 0.23, 1.0), (0.0, 0.63, 0.51, 1.0), (0.8, 0.49, 0.19, 1.0)] +disallowedColorsList = [(1.0, 1.0, 1.0, 1.0), + (0.7, 0.7, 0.8, 1.0), + (0.3, 0.3, 0.35, 1.0), + (0.47, 0.44, 0.44, 1.0), + (0.74, 0.75, 0.76, 1.0)] +matColorsList = [x for x in allColorsList if x not in disallowedColorsList] defaultColorList = [0, 1, 32, @@ -2662,7 +2668,7 @@ class ToonDNA: self.head = generator.choice(toonHeadTypes[:22]) top, topColor, sleeve, sleeveColor = getRandomTop(gender, generator=generator) bottom, bottomColor = getRandomBottom(gender, generator=generator) - color = generator.choice(allColorsList) + color = generator.choice(matColorsList) if gender == 'm': self.torso = generator.choice(toonTorsoTypes[:3]) self.topTex = top diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 841a4d16..5e4ad456 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -3303,7 +3303,7 @@ PartyTimeFormat = '%d:%.2d %s' PartyTimeFormatMeridiemAM = 'am' PartyTimeFormatMeridiemPM = 'pm' PartyCanStart = "It's Party Time, click Start Party in your Shticker Book Hosting page!" -PartyHasStartedAcceptedInvite = '%s party has started! Click the host then "Go To Party" in the Shticker Book Invites page.' +PartyHasStartedAcceptedInvite = '%s party has started! Teleport to the host!' PartyHasStartedNotAcceptedInvite = '%s party has started! You can still go to it by teleporting to the host.' EventsPageName = 'Events' EventsPageCalendarTabName = 'Calendar' @@ -4427,7 +4427,6 @@ BodyShopLegs = 'Legs' ColorShopToon = 'Toon Color' ColorShopHead = 'Head' ColorShopBody = 'Body' -ColorShopGloves = 'Gloves' ColorShopLegs = 'Legs' ColorShopParts = 'Multi Color' ColorShopAll = 'Single Color'