Merge branch 'features/dan' into 'master'

Features/dan



See merge request !3
This commit is contained in:
Alexander Behrhof 2015-08-16 16:19:07 -04:00
commit 029bd08e1f
29 changed files with 170 additions and 344 deletions

View file

@ -14,12 +14,14 @@ from direct.task import Task
import math import math
from panda3d.core import * from panda3d.core import *
import random import random
import webbrowser
import numbers
import DistributedAvatar import DistributedAvatar
from otp.ai.MagicWordGlobal import * from otp.ai.MagicWordGlobal import *
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
from otp.otpbase import OTPLocalizer from otp.otpbase import OTPLocalizer
from otp.nametag.NametagConstants import * from otp.nametag.NametagConstants import *
from otp.margins.WhisperPopup import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
@ -893,16 +895,20 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
def displayWhisper(self, fromId, chatString, whisperType): def displayWhisper(self, fromId, chatString, whisperType):
sender = None sender = None
sfx = self.soundWhisper
if whisperType == WTNormal: if isinstance(fromId, numbers.Number):
if sender == None: sender = base.cr.identifyAvatar(fromId)
return
chatString = sender.getName() + ': ' + chatString if whisperType == WTNormal:
chatString = '%s: %s' % (sender.getName(), chatString)
whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), whisperType) 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) whisper.manage(base.marginManager)
base.playSfx(sfx) base.playSfx(self.soundSystemMessage if whisperType == WTSystem else self.soundWhisper)
def setAnimMultiplier(self, value): def setAnimMultiplier(self, value):
self.animMultiplier = value self.animMultiplier = value
@ -1069,7 +1075,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
def stopChat(self): def stopChat(self):
self.chatMgr.stop() self.chatMgr.stop()
self.ignore(OTPGlobals.WhisperIncomingEvent)
self.ignore(OTPGlobals.ThinkPosHotkey) self.ignore(OTPGlobals.ThinkPosHotkey)
if self.__enableMarkerPlacement: if self.__enableMarkerPlacement:
self.ignore(OTPGlobals.PlaceMarkerHotkey) self.ignore(OTPGlobals.PlaceMarkerHotkey)
@ -1107,6 +1112,10 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.setSystemMessage(0, OTPLocalizer.WhisperFriendLoggedOut % friend.getName()) self.setSystemMessage(0, OTPLocalizer.WhisperFriendLoggedOut % friend.getName())
def clickedWhisper(self, doId): def clickedWhisper(self, doId):
if isinstance(doId, basestring):
webbrowser.open(doId, new=2, autoraise=True)
return
friend = base.cr.identifyFriend(doId) friend = base.cr.identifyFriend(doId)
if friend != None: if friend != None:

View file

@ -65,7 +65,7 @@ class WhisperPopup(MarginPopup, ClickablePopup):
if self.active and self.fromId: if self.active and self.fromId:
self.setClickRegionEvent('clickedWhisper', clickArgs=[self.fromId]) self.setClickRegionEvent('clickedWhisper', clickArgs=[self.fromId])
def setClickable(self, senderName, fromId, todo=0): def setClickable(self, fromId):
self.active = True self.active = True
self.fromId = fromId self.fromId = fromId

View file

@ -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.' 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.'
AvatarFriendAddEvent = 'avatarFriendAddEvent'
AvatarNewFriendAddEvent = 'avatarNewFriendAddEvent' TeleportFailCooldown = 2.0
AvatarFriendUpdateEvent = 'avatarFriendUpdateEvent'
AvatarFriendRemoveEvent = 'avatarFriendRemoveEvent'
AvatarFriendConsideringEvent = 'avatarFriendConsideringEvent'
AvatarFriendInvitationEvent = 'avatarFriendInvitationEvent'
AvatarFriendRejectInviteEvent = 'avatarFriendRejectInviteEvent'
AvatarFriendRetractInviteEvent = 'avatarFriendRetractInviteEvent'
AvatarFriendRejectRemoveEvent = 'avatarFriendRejectRemoveEvent'
WhisperIncomingEvent = 'whisperIncomingEvent'

View file

@ -222,7 +222,6 @@ SCMenuIdesOfMarch = 'GREEN'
ScMenuBugs = 'Bugs' ScMenuBugs = 'Bugs'
FriendInviteeTooManyFriends = '%s would like to be your friend, but you already have too many friends on your list!' 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.' FriendInviteeInvitation = '%s would like to be your friend.'
FriendNotifictation = '%s is now your friend.'
FriendInviteeOK = lOK FriendInviteeOK = lOK
FriendInviteeNo = lNo FriendInviteeNo = lNo
FriendOnline = 'has come online.' FriendOnline = 'has come online.'

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,16 +1,23 @@
class DistributedCashbotBossTreasureAI: from toontown.safezone import DistributedTreasureAI
pass from toontown.safezone import TreasureGlobals
'''from toontown.safezone import DistributedSZTreasureAI
class DistributedCashbotBossTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): class DistributedCashbotBossTreasureAI(DistributedTreasureAI.DistributedTreasureAI):
def __init__(self, air, boss, goon, style, fx, fy, fz): def __init__(self, air, boss, goon, style, fx, fy, fz):
pos = goon.getPos() 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.goonId = goon.doId
self.style = style self.style = style
self.finalPosition = (fx, fy, fz) 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): def getGoonId(self):
return self.goonId return self.goonId
@ -48,4 +55,4 @@ class DistributedCashbotBossTreasureAI(DistributedSZTreasureAI.DistributedSZTrea
self.d_setFinalPosition(x, y, z) self.d_setFinalPosition(x, y, z)
def d_setFinalPosition(self, x, y, z): def d_setFinalPosition(self, x, y, z):
self.sendUpdate('setFinalPosition', [x, y, z])''' self.sendUpdate('setFinalPosition', [x, y, z])

View file

@ -12,9 +12,9 @@ from toontown.toonbase import TTLocalizer
import random import random
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from toontown.hood import Place from toontown.hood import Place
from toontown.hood import SkyUtil
from toontown.pets import PetTutorial from toontown.pets import PetTutorial
from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs, TLNull from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs, TLNull
from toontown.safezone import SZUtil
import HouseGlobals import HouseGlobals
class Estate(Place.Place): class Estate(Place.Place):
@ -356,10 +356,10 @@ class Estate(Place.Place):
def __setUnderwaterFog(self): def __setUnderwaterFog(self):
if base.wantFog: if base.wantFog:
self.fog.setColor(0.245, 0.322, 0.5)
self.fog.setLinearRange(0.1, 100.0) self.fog.setLinearRange(0.1, 100.0)
render.setFog(self.fog) render.setFog(self.fog)
self.loader.hood.sky.setFog(self.fog) self.loader.hood.sky.setFog(self.fog)
SZUtil.startUnderwaterFog()
def __setWhiteFog(self): def __setWhiteFog(self):
if base.wantFog: if base.wantFog:
@ -367,9 +367,11 @@ class Estate(Place.Place):
self.fog.setLinearRange(0.0, 400.0) self.fog.setLinearRange(0.0, 400.0)
render.setFog(self.fog) render.setFog(self.fog)
self.loader.hood.sky.setFog(self.fog) self.loader.hood.sky.setFog(self.fog)
SZUtil.stopUnderwaterFog()
def __setFaintFog(self): def __setFaintFog(self):
if base.wantFog: if base.wantFog:
self.fog.setColor(Vec4(0.8, 0.8, 0.8, 1.0)) self.fog.setColor(Vec4(0.8, 0.8, 0.8, 1.0))
self.fog.setLinearRange(0.0, 700.0) self.fog.setLinearRange(0.0, 700.0)
render.setFog(self.fog) render.setFog(self.fog)
SZUtil.stopUnderwaterFog()

View file

@ -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

View file

@ -2,7 +2,6 @@ from panda3d.core import *
import FriendsListPanel import FriendsListPanel
import FriendInviter import FriendInviter
import FriendInvitee import FriendInvitee
import FriendNotifier
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.toon import ToonTeleportPanel from toontown.toon import ToonTeleportPanel
from toontown.friends import ToontownFriendSecret from toontown.friends import ToontownFriendSecret
@ -25,10 +24,9 @@ class FriendsListManager:
self._preserveFriendsList = False self._preserveFriendsList = False
self._entered = False self._entered = False
self.friendsRequestQueue = [] self.friendsRequestQueue = []
return
def load(self): def load(self):
self.accept(OTPGlobals.AvatarNewFriendAddEvent, self.__friendAdded) pass
def unload(self): def unload(self):
self.exitFLM() self.exitFLM()
@ -135,13 +133,3 @@ class FriendsListManager:
def preserveFriendsList(self): def preserveFriendsList(self):
self.notify.debug('Preserving Friends List') self.notify.debug('Preserving Friends List')
self._preserveFriendsList = True 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

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

View file

@ -5,13 +5,12 @@ from toontown.distributed.ToontownMsgTypes import *
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from toontown.minigame import Purchase from toontown.minigame import Purchase
from otp.avatar import DistributedAvatar from otp.avatar import DistributedAvatar
from toontown.hood import SkyUtil
from direct.task.Task import Task from direct.task.Task import Task
from toontown.hood.Hood import Hood from toontown.hood.Hood import Hood
from toontown.estate.EstateLoader import EstateLoader from toontown.estate.EstateLoader import EstateLoader
from toontown.estate import HouseGlobals from toontown.estate import HouseGlobals
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.safezone import SZUtil
class EstateHood(Hood): class EstateHood(Hood):
notify = directNotify.newCategory('EstateHood') notify = directNotify.newCategory('EstateHood')
@ -113,12 +112,12 @@ class EstateHood(Hood):
self.popupInfo.reparentTo(hidden) self.popupInfo.reparentTo(hidden)
def skyTrack(self, task): def skyTrack(self, task):
return SkyUtil.cloudSkyTrack(task) return SZUtil.cloudSkyTrack(task)
def startSky(self): def startSky(self):
if not self.sky.getTag('sky') == 'Regular': if not self.sky.getTag('sky') == 'Regular':
self.endSpookySky() self.endSpookySky()
SkyUtil.startCloudSky(self) SZUtil.startCloudSky(self)
if base.cloudPlatformsEnabled: if base.cloudPlatformsEnabled:
self.loader.startCloudPlatforms() self.loader.startCloudPlatforms()

View file

@ -7,11 +7,9 @@ from toontown.toonbase.ToonBaseGlobal import *
from toontown.toonbase.ToontownGlobals import * from toontown.toonbase.ToontownGlobals import *
from toontown.distributed.ToontownMsgTypes import * from toontown.distributed.ToontownMsgTypes import *
from toontown.minigame import Purchase from toontown.minigame import Purchase
from toontown.parties import PartyLoader from toontown.parties import PartyLoader, PartyGlobals
from toontown.parties import PartyGlobals from toontown.hood import Hood, ZoneUtil
from toontown.hood import SkyUtil from toontown.safezone import SZUtil
from toontown.hood import Hood
from toontown.hood import ZoneUtil
class PartyHood(Hood.Hood): class PartyHood(Hood.Hood):
notify = DirectNotifyGlobal.directNotify.newCategory('PartyHood') 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.holidayStorageDNADict = {CHRISTMAS: ['phase_5.5/dna/winter_storage_estate.pdna']}
self.skyFile = 'phase_3.5/models/props/TT_sky' self.skyFile = 'phase_3.5/models/props/TT_sky'
self.popupInfo = None self.popupInfo = None
return
def load(self): def load(self):
Hood.Hood.load(self) Hood.Hood.load(self)
@ -107,10 +104,10 @@ class PartyHood(Hood.Hood):
pass pass
def skyTrack(self, task): def skyTrack(self, task):
return SkyUtil.cloudSkyTrack(task) return SZUtil.cloudSkyTrack(task)
def startSky(self): def startSky(self):
SkyUtil.startCloudSky(self) SZUtil.startCloudSky(self)
if base.cloudPlatformsEnabled: if base.cloudPlatformsEnabled:
self.loader.startCloudPlatforms() self.loader.startCloudPlatforms()

View file

@ -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!")

View file

@ -9,7 +9,7 @@ from toontown.hood.Hood import Hood
from toontown.building import SuitInterior from toontown.building import SuitInterior
from toontown.cogdominium import CogdoInterior from toontown.cogdominium import CogdoInterior
from toontown.toon.Toon import teleportDebug from toontown.toon.Toon import teleportDebug
from toontown.hood import SkyUtil from toontown.safezone import SZUtil
class ToonHood(Hood): class ToonHood(Hood):
notify = directNotify.newCategory('ToonHood') notify = directNotify.newCategory('ToonHood')
@ -208,12 +208,12 @@ class ToonHood(Hood):
pass pass
def skyTrack(self, task): def skyTrack(self, task):
return SkyUtil.cloudSkyTrack(task) return SZUtil.cloudSkyTrack(task)
def startSky(self): def startSky(self):
if not self.sky.getTag('sky') == 'Regular': if not self.sky.getTag('sky') == 'Regular':
self.endSpookySky() self.endSpookySky()
SkyUtil.startCloudSky(self) SZUtil.startCloudSky(self)
def startSpookySky(self): def startSpookySky(self):
if hasattr(self, 'sky') and self.sky: if hasattr(self, 'sky') and self.sky:
@ -237,10 +237,10 @@ class ToonHood(Hood):
def setUnderwaterFog(self): def setUnderwaterFog(self):
if base.wantFog: if base.wantFog:
self.fog.setColor(0.245, 0.322, 0.5)
self.fog.setLinearRange(0.1, 100.0) self.fog.setLinearRange(0.1, 100.0)
render.setFog(self.fog) render.setFog(self.fog)
self.sky.setFog(self.fog) self.sky.setFog(self.fog)
SZUtil.startUnderwaterFog()
def setWhiteFog(self): def setWhiteFog(self):
if base.wantFog: if base.wantFog:
@ -250,8 +250,10 @@ class ToonHood(Hood):
render.setFog(self.fog) render.setFog(self.fog)
self.sky.clearFog() self.sky.clearFog()
self.sky.setFog(self.fog) self.sky.setFog(self.fog)
SZUtil.stopUnderwaterFog()
def setNoFog(self): def setNoFog(self):
if base.wantFog: if base.wantFog:
render.clearFog() render.clearFog()
self.sky.clearFog() self.sky.clearFog()
SZUtil.stopUnderwaterFog()

View file

@ -18,19 +18,18 @@ class ColorShop(StateData.StateData):
self.colorAll = 1 self.colorAll = 1
def getColorList(self): def getColorList(self):
return ToonDNA.allColorsList return ToonDNA.matColorsList
def enter(self, toon, shopsVisited = []): def enter(self, toon, shopsVisited = []):
base.disableMouse() base.disableMouse()
self.toon = toon self.toon = toon
self.dna = toon.getStyle() self.dna = toon.getStyle()
colorList = self.getColorList() 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'): if not hasattr(self, 'headChoice'):
self.headChoice = colorList.index(self.dna.headColor) self.headChoice = colorList.index(self.dna.headColor)
self.allChoice = self.headChoice self.allChoice = self.headChoice
self.armChoice = colorList.index(self.dna.armColor) self.armChoice = colorList.index(self.dna.armColor)
self.gloveChoice = colorList.index(self.dna.gloveColor)
self.legChoice = colorList.index(self.dna.legColor) self.legChoice = colorList.index(self.dna.legColor)
self.partChoice = 0 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')) 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.parentFrame = self.getNewFrame()
self.advancedFrame = 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.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.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.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.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.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.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.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.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.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.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.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) 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.headRButton.destroy()
self.armLButton.destroy() self.armLButton.destroy()
self.armRButton.destroy() self.armRButton.destroy()
self.gloveLButton.destroy()
self.gloveRButton.destroy()
self.legLButton.destroy() self.legLButton.destroy()
self.legRButton.destroy() self.legRButton.destroy()
self.allLButton.destroy() self.allLButton.destroy()
@ -143,8 +137,6 @@ class ColorShop(StateData.StateData):
del self.headRButton del self.headRButton
del self.armLButton del self.armLButton
del self.armRButton del self.armRButton
del self.gloveLButton
del self.gloveRButton
del self.legLButton del self.legLButton
del self.legRButton del self.legRButton
del self.allLButton del self.allLButton
@ -215,8 +207,6 @@ class ColorShop(StateData.StateData):
if self.partChoice in (0, 2): if self.partChoice in (0, 2):
self.dna.armColor = rgb self.dna.armColor = rgb
if self.partChoice in (0, 3): if self.partChoice in (0, 3):
self.dna.gloveColor = rgb
if self.partChoice in (0, 4):
self.dna.legColor = rgb self.dna.legColor = rgb
self.toon.swapToonColor(self.dna) 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.allLButton, self.allRButton)
self.__updateScrollButtons(self.allChoice, length, self.headLButton, self.headRButton) self.__updateScrollButtons(self.allChoice, length, self.headLButton, self.headRButton)
self.__updateScrollButtons(self.allChoice, length, self.armLButton, self.armRButton) 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) self.__updateScrollButtons(self.allChoice, length, self.legLButton, self.legRButton)
newColor = colorList[self.allChoice] newColor = colorList[self.allChoice]
self.dna.headColor = newColor self.dna.headColor = newColor
self.dna.armColor = newColor self.dna.armColor = newColor
self.dna.gloveColor = newColor
self.dna.legColor = newColor self.dna.legColor = newColor
self.toon.swapToonColor(self.dna) self.toon.swapToonColor(self.dna)
@ -269,15 +257,6 @@ class ColorShop(StateData.StateData):
self.dna.armColor = newColor self.dna.armColor = newColor
self.toon.swapToonColor(self.dna) 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): def __swapLegColor(self, offset):
colorList = self.getColorList() colorList = self.getColorList()
length = len(colorList) length = len(colorList)
@ -311,16 +290,13 @@ class ColorShop(StateData.StateData):
newChoice = self.shuffleButton.getCurrChoice() newChoice = self.shuffleButton.getCurrChoice()
newHeadColorIndex = self.indexOf(colorList, newChoice[0], 25) newHeadColorIndex = self.indexOf(colorList, newChoice[0], 25)
newArmColorIndex = self.indexOf(colorList, newChoice[1], 25) newArmColorIndex = self.indexOf(colorList, newChoice[1], 25)
newGloveColorIndex = self.indexOf(colorList, newChoice[2], 0) newLegColorIndex = self.indexOf(colorList, newChoice[2], 25)
newLegColorIndex = self.indexOf(colorList, newChoice[3], 25)
self.__swapHeadColor(newHeadColorIndex - self.headChoice) self.__swapHeadColor(newHeadColorIndex - self.headChoice)
if self.colorAll: if self.colorAll:
self.__swapArmColor(newHeadColorIndex - self.armChoice) self.__swapArmColor(newHeadColorIndex - self.armChoice)
self.__swapGloveColor(newHeadColorIndex - self.gloveChoice)
self.__swapLegColor(newHeadColorIndex - self.legChoice) self.__swapLegColor(newHeadColorIndex - self.legChoice)
else: else:
self.__swapArmColor(newArmColorIndex - self.armChoice) self.__swapArmColor(newArmColorIndex - self.armChoice)
self.__swapGloveColor(newGloveColorIndex - self.gloveChoice)
self.__swapLegColor(newLegColorIndex - self.legChoice) self.__swapLegColor(newLegColorIndex - self.legChoice)
def indexOf(self, list, item, default): def indexOf(self, list, item, default):
@ -330,4 +306,4 @@ class ColorShop(StateData.StateData):
return default return default
def getCurrToonSetting(self): 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]

View file

@ -4,7 +4,7 @@ from DistributedMinigame import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
from toontown.safezone import Walk, SnowUtil from toontown.safezone import Walk, SZUtil
from toontown.toonbase import ToontownTimer from toontown.toonbase import ToontownTimer
from direct.gui import OnscreenText from direct.gui import OnscreenText
import MinigameAvatarScorePanel import MinigameAvatarScorePanel
@ -54,7 +54,7 @@ class DistributedTagGame(DistributedMinigame):
self.IT = None self.IT = None
if TagGameGlobals.isSnowHood(safezoneId): if TagGameGlobals.isSnowHood(safezoneId):
self.snow, self.snowRender = SnowUtil.createSnow(self.ground) self.snow, self.snowRender = SZUtil.createSnow(self.ground)
return return

View file

@ -12,7 +12,6 @@ import random
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs, TLNull from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs, TLNull
from toontown.hood import Place from toontown.hood import Place
from toontown.hood import SkyUtil
from toontown.parties import PartyPlanner from toontown.parties import PartyPlanner
from toontown.parties.DistributedParty import DistributedParty from toontown.parties.DistributedParty import DistributedParty

View file

@ -19,7 +19,6 @@ from math import sqrt
from RaceGUI import RaceGUI from RaceGUI import RaceGUI
import RaceGlobals import RaceGlobals
from direct.task.Task import Task from direct.task.Task import Task
from toontown.hood import SkyUtil
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
from toontown.battle.BattleProps import * from toontown.battle.BattleProps import *
@ -29,6 +28,7 @@ from toontown.racing import EffectManager
from toontown.racing import PiejectileManager from toontown.racing import PiejectileManager
from toontown.dna.DNAParser import * from toontown.dna.DNAParser import *
from otp.ai.MagicWordGlobal import * from otp.ai.MagicWordGlobal import *
from toontown.safezone import SZUtil
class DistributedRace(DistributedObject.DistributedObject): class DistributedRace(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedRace') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedRace')
@ -1095,13 +1095,13 @@ class DistributedRace(DistributedObject.DistributedObject):
self.gui.racerLeft(avId, unexpected=False) self.gui.racerLeft(avId, unexpected=False)
def skyTrack(self, task): def skyTrack(self, task):
return SkyUtil.cloudSkyTrack(task) return SZUtil.cloudSkyTrack(task)
def startSky(self): def startSky(self):
if self.hasFog: if self.hasFog:
SkyUtil.startCloudSky(self, parent=self.dummyNode, effects=CompassEffect.PRot) SZUtil.startCloudSky(self, parent=self.dummyNode, effects=CompassEffect.PRot)
else: else:
SkyUtil.startCloudSky(self, parent=render) SZUtil.startCloudSky(self, parent=render)
def stopSky(self): def stopSky(self):
taskMgr.remove('skyTrack') taskMgr.remove('skyTrack')

View file

@ -1,6 +1,6 @@
from toontown.safezone import BRPlayground from toontown.safezone import BRPlayground
from toontown.safezone import SafeZoneLoader from toontown.safezone import SafeZoneLoader
import SnowUtil import SZUtil
class BRSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): class BRSafeZoneLoader(SafeZoneLoader.SafeZoneLoader):
def __init__(self, hood, parentFSM, doneEvent): 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', 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_2.ogg',
'phase_8/audio/sfx/SZ_TB_wind_3.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): def unload(self):
SafeZoneLoader.SafeZoneLoader.unload(self) SafeZoneLoader.SafeZoneLoader.unload(self)

View file

@ -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')

View file

@ -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

View file

@ -1,9 +1,6 @@
from panda3d.core import * from panda3d.core import *
from direct.task.Task import Task
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData from direct.fsm import ClassicFSM, StateData, State
from direct.fsm import ClassicFSM, State
import colorsys
class Walk(StateData.StateData): class Walk(StateData.StateData):
notify = DirectNotifyGlobal.directNotify.newCategory('Walk') notify = DirectNotifyGlobal.directNotify.newCategory('Walk')
@ -91,13 +88,7 @@ class Walk(StateData.StateData):
self.swimSoundPlaying = 0 self.swimSoundPlaying = 0
self.swimSound.stop() self.swimSound.stop()
saturation = min(max((base.localAvatar.getZ() / -12.3), 0.51), 1) return task.cont
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
def enterSlowWalking(self): def enterSlowWalking(self):
self.accept(base.localAvatar.uniqueName('positiveHP'), self.__handlePositiveHP) self.accept(base.localAvatar.uniqueName('positiveHP'), self.__handlePositiveHP)

View file

@ -45,16 +45,16 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.anyChanged = 0 self.anyChanged = 0
self.apiChanged = 0 self.apiChanged = 0
if len(base.resDict[base.nativeRatio]) > 1: self.screenSizes = ((640, 480),
# We have resolutions that match our native ratio and fit it: (800, 600),
self.screenSizes = sorted(base.resDict[base.nativeRatio]) (1024, 768),
else: (1280, 720),
# Okay, we don't have any resolutions that match our native ratio (1280, 1024),
# and fit it (besides the native resolution itself, of course). (1440, 900),
# Let's just use the second largest ratio's resolutions: (1600, 900),
ratios = sorted(base.resDict.keys(), reverse=False) (1600, 1200),
nativeIndex = ratios.index(base.nativeRatio) (1920, 1080),
self.screenSizes = sorted(base.resDict[ratios[nativeIndex - 1]]) (2560, 1440))
guiButton = loader.loadModel('phase_3/models/gui/quit_button.bam') guiButton = loader.loadModel('phase_3/models/gui/quit_button.bam')
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui.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_pipe = base.pipe
self.current_properties = WindowProperties(base.win.getProperties()) self.current_properties = WindowProperties(base.win.getProperties())
properties = self.current_properties 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') self.notify.info('DISPLAY NO CHANGE REQUIRED')
state = True state = True
else: else:
properties = WindowProperties() 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.setSize(width, height)
properties.setFullscreen(fullscreen) properties.setFullscreen(fullscreen)
properties.setParentWindow(0) properties.setParentWindow(0)

View file

@ -75,7 +75,6 @@ class MapPage(ShtikerPage.ShtikerPage):
text=TTLocalizer.MapPageBackToPlayground, text=TTLocalizer.MapPageBackToPlayground,
text_scale=TTLocalizer.MPsafeZoneButton, text_scale=TTLocalizer.MPsafeZoneButton,
text_pos=(0, -0.02), text_pos=(0, -0.02),
textMayChange=0,
command=self.backToSafeZone) command=self.backToSafeZone)
self.goHomeButton = DirectButton( self.goHomeButton = DirectButton(
parent=self.map, parent=self.map,
@ -86,7 +85,6 @@ class MapPage(ShtikerPage.ShtikerPage):
text=TTLocalizer.MapPageGoHome, text=TTLocalizer.MapPageGoHome,
text_scale=TTLocalizer.MPgoHomeButton, text_scale=TTLocalizer.MPgoHomeButton,
text_pos=(0, -0.02), text_pos=(0, -0.02),
textMayChange=0,
command=self.goHome) command=self.goHome)
self.goHomeButton.hide() self.goHomeButton.hide()
guiButton.removeNode() guiButton.removeNode()

View file

@ -827,7 +827,6 @@ class ExtraOptionsTabPage(DirectFrame):
chooser = self.optionChoosers['pole'] chooser = self.optionChoosers['pole']
if resetIndex: if resetIndex:
print 'resetting index'
chooser.setIndex(base.localAvatar.getFishingRod()) chooser.setIndex(base.localAvatar.getFishingRod())
chooser.setDisplayText(TTLocalizer.FishingRodNameDict[chooser.index]) chooser.setDisplayText(TTLocalizer.FishingRodNameDict[chooser.index])

View file

@ -2211,10 +2211,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
from toontown.shtiker import EventsPage 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: 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() base.localAvatar.eventsPage.loadHostedPartyInfo()
if hasattr(self, 'displaySystemClickableWhisper'): self.setSystemMessage(0, TTLocalizer.PartyCanStart, WTSystem)
self.displaySystemClickableWhisper(0, TTLocalizer.PartyCanStart, whisperType=WTSystem)
else:
self.setSystemMessage(0, TTLocalizer.PartyCanStart)
def setPartyStatus(self, partyId, newStatus): def setPartyStatus(self, partyId, newStatus):
DistributedToon.partyNotify.debug('setPartyCanStatus called passing in partyId=%s status=%s' % (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 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: 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() base.localAvatar.eventsPage.loadInvitations()
if newStatus == PartyStatus.Started and hasattr(self, 'displaySystemClickableWhisper'): if newStatus == PartyStatus.Started and hasattr(self, 'setSystemMessage'):
invite = self.getInviteForPartyId(partyId) invite = self.getInviteForPartyId(partyId)
if invite: if invite:
name = ' ' name = ' '
@ -2241,10 +2238,9 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
name = host.getName() name = host.getName()
if invite.status == InviteStatus.Accepted: if invite.status == InviteStatus.Accepted:
displayStr = TTLocalizer.PartyHasStartedAcceptedInvite % TTLocalizer.GetPossesive(name) displayStr = TTLocalizer.PartyHasStartedAcceptedInvite % TTLocalizer.GetPossesive(name)
self.displaySystemClickableWhisper(-1, displayStr, whisperType=WTSystem)
else: else:
displayStr = TTLocalizer.PartyHasStartedNotAcceptedInvite % TTLocalizer.GetPossesive(name) displayStr = TTLocalizer.PartyHasStartedNotAcceptedInvite % TTLocalizer.GetPossesive(name)
self.setSystemMessage(partyInfo.hostId, displayStr, whisperType=WTSystem) self.setSystemMessage(partyInfo.hostId, displayStr, WTSystem)
break break
if not found: if not found:

View file

@ -11,8 +11,6 @@ from panda3d.core import *
import random import random
import re import re
import time import time
import zlib
import DistributedToon import DistributedToon
import LaffMeter import LaffMeter
import Toon import Toon
@ -144,9 +142,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
self.guiConflict = 0 self.guiConflict = 0
self.lastElevatorLeft = 0 self.lastElevatorLeft = 0
self.elevatorNotifier = ElevatorNotifier.ElevatorNotifier() 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._zoneId = None
self.accept('system message aknowledge', self.systemWarning) self.accept('system message aknowledge', self.systemWarning)
self.systemMsgAckGuiDoneEvent = 'systemMsgAckGuiDoneEvent' self.systemMsgAckGuiDoneEvent = 'systemMsgAckGuiDoneEvent'
@ -416,12 +411,11 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
return return
if base.whiteList: 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' % (sender.getName(), chat)
chatString = '%s: %s' % (name, chat)
whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), WTNormal) whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), WTNormal)
whisper.setClickable(name, avId) whisper.setClickable(avId)
whisper.manage(base.marginManager) whisper.manage(base.marginManager)
base.playSfx(self.soundWhisper) base.playSfx(self.soundWhisper)
@ -778,73 +772,9 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
else: else:
self.__pieButton['text'] = str(self.numPies) self.__pieButton['text'] = str(self.numPies)
self.__pieButtonCount = self.numPies self.__pieButtonCount = self.numPies
return
def displayWhisper(self, fromId, chatString, whisperType): def displayWhisper(self, fromId, chatString, whisperType):
sender = None LocalAvatar.LocalAvatar.displayWhisper(self, fromId, chatString, whisperType)
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')
def loadFurnitureGui(self): def loadFurnitureGui(self):
if self.__furnitureGui: 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) 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() self.__furnitureGui.hide()
guiModels.removeNode() guiModels.removeNode()
return
def showFurnitureGui(self): def showFurnitureGui(self):
self.loadFurnitureGui() self.loadFurnitureGui()
@ -1630,15 +1559,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
self.notify.info('closing shard...') self.notify.info('closing shard...')
base.cr.gameFSM.request('closeShard', ['afkTimeout']) 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): def addGolfPage(self):
if self.hasPlayedGolf(): if self.hasPlayedGolf():
if hasattr(self, 'golfPage') and self.golfPage != None: if hasattr(self, 'golfPage') and self.golfPage != None:

View file

@ -1932,6 +1932,12 @@ allColorsList = [(1.0, 1.0, 1.0, 1.0),
(0.86, 0.07, 0.23, 1.0), (0.86, 0.07, 0.23, 1.0),
(0.0, 0.63, 0.51, 1.0), (0.0, 0.63, 0.51, 1.0),
(0.8, 0.49, 0.19, 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, defaultColorList = [0,
1, 1,
32, 32,
@ -2662,7 +2668,7 @@ class ToonDNA:
self.head = generator.choice(toonHeadTypes[:22]) self.head = generator.choice(toonHeadTypes[:22])
top, topColor, sleeve, sleeveColor = getRandomTop(gender, generator=generator) top, topColor, sleeve, sleeveColor = getRandomTop(gender, generator=generator)
bottom, bottomColor = getRandomBottom(gender, generator=generator) bottom, bottomColor = getRandomBottom(gender, generator=generator)
color = generator.choice(allColorsList) color = generator.choice(matColorsList)
if gender == 'm': if gender == 'm':
self.torso = generator.choice(toonTorsoTypes[:3]) self.torso = generator.choice(toonTorsoTypes[:3])
self.topTex = top self.topTex = top

View file

@ -3303,7 +3303,7 @@ PartyTimeFormat = '%d:%.2d %s'
PartyTimeFormatMeridiemAM = 'am' PartyTimeFormatMeridiemAM = 'am'
PartyTimeFormatMeridiemPM = 'pm' PartyTimeFormatMeridiemPM = 'pm'
PartyCanStart = "It's Party Time, click Start Party in your Shticker Book Hosting page!" 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.' PartyHasStartedNotAcceptedInvite = '%s party has started! You can still go to it by teleporting to the host.'
EventsPageName = 'Events' EventsPageName = 'Events'
EventsPageCalendarTabName = 'Calendar' EventsPageCalendarTabName = 'Calendar'
@ -4427,7 +4427,6 @@ BodyShopLegs = 'Legs'
ColorShopToon = 'Toon Color' ColorShopToon = 'Toon Color'
ColorShopHead = 'Head' ColorShopHead = 'Head'
ColorShopBody = 'Body' ColorShopBody = 'Body'
ColorShopGloves = 'Gloves'
ColorShopLegs = 'Legs' ColorShopLegs = 'Legs'
ColorShopParts = 'Multi Color' ColorShopParts = 'Multi Color'
ColorShopAll = 'Single Color' ColorShopAll = 'Single Color'