mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Merge branch 'master' of https://gitlab.com/toontown-created/src
This commit is contained in:
commit
e73613d180
146 changed files with 1460 additions and 8630 deletions
47
astron/databases/air_cache/pets_401000001.pets
Normal file
47
astron/databases/air_cache/pets_401000001.pets
Normal file
|
@ -0,0 +1,47 @@
|
|||
(dp1
|
||||
I4000
|
||||
(lp2
|
||||
I11
|
||||
aI177
|
||||
aI238
|
||||
aI152
|
||||
aI89
|
||||
asI1000
|
||||
(lp3
|
||||
I123
|
||||
aI161
|
||||
aI145
|
||||
aI138
|
||||
aI122
|
||||
asI9000
|
||||
(lp4
|
||||
I66
|
||||
aI201
|
||||
aI27
|
||||
aI102
|
||||
aI185
|
||||
asI2000
|
||||
(lp5
|
||||
I135
|
||||
aI20
|
||||
aI54
|
||||
aI240
|
||||
aI147
|
||||
asI5000
|
||||
(lp6
|
||||
I129
|
||||
aI194
|
||||
aI222
|
||||
aI92
|
||||
aI37
|
||||
asI3000
|
||||
(lp7
|
||||
I166
|
||||
aI114
|
||||
aI70
|
||||
aI144
|
||||
aI30
|
||||
asS'day'
|
||||
p8
|
||||
I16523
|
||||
s.
|
|
@ -443,25 +443,6 @@ from direct.distributed import DistributedObjectGlobal
|
|||
from toontown.ai import WelcomeValleyManager/AI
|
||||
from toontown.building import DistributedAnimatedProp/AI
|
||||
from toontown.toon import DistributedToon/AI/UD
|
||||
from toontown.classicchars import DistributedCCharBase/AI
|
||||
from toontown.classicchars import DistributedMickey/AI
|
||||
from toontown.classicchars import DistributedVampireMickey/AI
|
||||
from toontown.classicchars import DistributedMinnie/AI
|
||||
from toontown.classicchars import DistributedWitchMinnie/AI
|
||||
from toontown.classicchars import DistributedGoofy/AI
|
||||
from toontown.classicchars import DistributedSuperGoofy/AI
|
||||
from toontown.classicchars import DistributedDaisy/AI
|
||||
from toontown.classicchars import DistributedSockHopDaisy/AI
|
||||
from toontown.classicchars import DistributedChip/AI
|
||||
from toontown.classicchars import DistributedPoliceChip/AI
|
||||
from toontown.classicchars import DistributedDale/AI
|
||||
from toontown.classicchars import DistributedJailbirdDale/AI
|
||||
from toontown.classicchars import DistributedGoofySpeedway/AI
|
||||
from toontown.classicchars import DistributedDonald/AI
|
||||
from toontown.classicchars import DistributedFrankenDonald/AI
|
||||
from toontown.classicchars import DistributedDonaldDock/AI
|
||||
from toontown.classicchars import DistributedPluto/AI
|
||||
from toontown.classicchars import DistributedWesternPluto/AI
|
||||
from toontown.safezone import DistributedTrolley/AI
|
||||
from toontown.safezone import DistributedPartyGate/AI
|
||||
from toontown.suit import DistributedSuitPlanner/AI
|
||||
|
@ -1070,74 +1051,6 @@ dclass DistributedToon : DistributedPlayer {
|
|||
setEmblems(uint32[] = [0, 0]) required ownrecv db;
|
||||
};
|
||||
|
||||
dclass DistributedCCharBase : DistributedObject {
|
||||
setChat(uint32, uint32, uint32) broadcast;
|
||||
fadeAway() broadcast;
|
||||
setWalk(string, string, int16) required broadcast ram;
|
||||
avatarEnter() airecv clsend;
|
||||
avatarExit() airecv clsend;
|
||||
setNearbyAvatarChat(char [0-1024]) airecv clsend;
|
||||
setNearbyAvatarSC(uint16) airecv clsend;
|
||||
setNearbyAvatarSCCustom(uint16) airecv clsend;
|
||||
setNearbyAvatarSCToontask(uint32, uint32, uint32, uint8) airecv clsend;
|
||||
};
|
||||
|
||||
dclass DistributedMickey : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedVampireMickey : DistributedMickey {
|
||||
};
|
||||
|
||||
dclass DistributedWitchMinnie : DistributedMickey {
|
||||
};
|
||||
|
||||
dclass DistributedMinnie : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedGoofy : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedDaisy : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedSockHopDaisy : DistributedDaisy {
|
||||
};
|
||||
|
||||
dclass DistributedChip : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedPoliceChip : DistributedChip {
|
||||
};
|
||||
|
||||
dclass DistributedDale : DistributedCCharBase {
|
||||
setFollowChip(string, string, int16, int16/100, int16/100) broadcast ram;
|
||||
setChipId(uint32) required broadcast ram;
|
||||
};
|
||||
|
||||
dclass DistributedJailbirdDale : DistributedDale {
|
||||
};
|
||||
|
||||
dclass DistributedDonald : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedFrankenDonald : DistributedDonald {
|
||||
};
|
||||
|
||||
dclass DistributedDonaldDock : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedPluto : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedWesternPluto : DistributedPluto {
|
||||
};
|
||||
|
||||
dclass DistributedGoofySpeedway : DistributedCCharBase {
|
||||
};
|
||||
|
||||
dclass DistributedSuperGoofy : DistributedGoofySpeedway {
|
||||
};
|
||||
|
||||
dclass DistributedPartyGate : DistributedObject {
|
||||
getPartyList(uint32) airecv clsend;
|
||||
partyChoiceRequest(uint32, uint64, uint64) airecv clsend;
|
||||
|
@ -3740,6 +3653,9 @@ dclass TTUFriendsManager : DistributedObjectGlobal {
|
|||
getAvatarDetails(uint32) clsend;
|
||||
friendDetails(uint32, blob, uint16[], uint16, int16, int16, uint32, uint32, blob, blob, int8[]);
|
||||
|
||||
getPetDetails(uint32) clsend;
|
||||
petDetails(uint32, uint32, string, uint32, uint32, uint16/1000[], PetTrait[], int8[], uint32);
|
||||
|
||||
routeTeleportQuery(uint32 toId) clsend;
|
||||
teleportQuery(uint32 fromId);
|
||||
|
||||
|
|
|
@ -5,11 +5,14 @@ set /P PPYTHON_PATH=<PPYTHON_PATH
|
|||
echo Choose your game server!
|
||||
echo #1 - Localhost
|
||||
echo #2 - Custom
|
||||
echo #3 - Loudrob
|
||||
echo.
|
||||
set /P INPUT=
|
||||
set server=unset
|
||||
|
||||
if %INPUT%==1 set server=127.0.0.1
|
||||
if %INPUT%==3 set server=71.200.196.180
|
||||
|
||||
if %server%==unset (
|
||||
echo.
|
||||
set /P server=Gameserver:
|
||||
|
|
|
@ -74,17 +74,6 @@ want-treasure-planners #t
|
|||
want-suit-planners #t
|
||||
want-butterflies #f
|
||||
|
||||
# Classic characters:
|
||||
want-classic-chars #t
|
||||
want-mickey #t
|
||||
want-donald-dock #t
|
||||
want-daisy #t
|
||||
want-minnie #t
|
||||
want-pluto #t
|
||||
want-donald-dreamland #t
|
||||
want-chip-and-dale #t
|
||||
want-goofy #t
|
||||
|
||||
# Trolley minigames:
|
||||
want-minigames #t
|
||||
want-photo-game #f
|
||||
|
|
|
@ -22,6 +22,7 @@ dc-file astron/dclass/united.dc
|
|||
want-pets #t
|
||||
want-parties #t
|
||||
want-cogdominiums #t
|
||||
want-lawbot-cogdo #t
|
||||
want-achievements #f
|
||||
|
||||
# Chat:
|
||||
|
@ -38,3 +39,5 @@ want-glove-npc #t
|
|||
# Developer options:
|
||||
show-population #t
|
||||
want-instant-parties #t
|
||||
cogdo-pop-factor 1.5
|
||||
cogdo-ratio 0.5
|
|
@ -11,7 +11,8 @@ shard-mid-pop 150
|
|||
want-housing #t
|
||||
want-pets #f
|
||||
want-parties #t
|
||||
want-cogdominiums #f
|
||||
want-cogdominiums #t
|
||||
want-lawbot-cogdo #f
|
||||
want-achievements #f
|
||||
boarding-group-merges #t
|
||||
|
||||
|
@ -21,6 +22,8 @@ disable-sos-card 91918
|
|||
|
||||
# Optional:
|
||||
want-chestnut-park-construction #t
|
||||
cogdo-pop-factor 1.5
|
||||
cogdo-ratio 0.4
|
||||
|
||||
# Temporary:
|
||||
want-phone-quest #f
|
||||
|
|
|
@ -4,8 +4,6 @@ from direct.fsm import State
|
|||
from direct.gui.DirectGui import *
|
||||
from direct.showbase import DirectObject
|
||||
from pandac.PandaModules import *
|
||||
from otp.login import PrivacyPolicyPanel
|
||||
from otp.login import SecretFriendsInfoPanel
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from toontown.chat.ChatGlobals import *
|
||||
|
||||
|
@ -52,8 +50,6 @@ class ChatManager(DirectObject.DirectObject):
|
|||
self.noSecretChatAtAllAndNoWhitelist = None
|
||||
self.noSecretChatWarning = None
|
||||
self.activateChatGui = None
|
||||
self.chatMoreInfo = None
|
||||
self.chatPrivacyPolicy = None
|
||||
self.secretChatActivated = None
|
||||
self.problemActivatingChat = None
|
||||
self.fsm = ClassicFSM.ClassicFSM('chatManager', [State.State('off', self.enterOff, self.exitOff),
|
||||
|
@ -73,8 +69,6 @@ class ChatManager(DirectObject.DirectObject):
|
|||
State.State('noFriendsWarning', self.enterNoFriendsWarning, self.exitNoFriendsWarning),
|
||||
State.State('otherDialog', self.enterOtherDialog, self.exitOtherDialog),
|
||||
State.State('activateChat', self.enterActivateChat, self.exitActivateChat),
|
||||
State.State('chatMoreInfo', self.enterChatMoreInfo, self.exitChatMoreInfo),
|
||||
State.State('chatPrivacyPolicy', self.enterChatPrivacyPolicy, self.exitChatPrivacyPolicy),
|
||||
State.State('secretChatActivated', self.enterSecretChatActivated, self.exitSecretChatActivated),
|
||||
State.State('problemActivatingChat', self.enterProblemActivatingChat, self.exitProblemActivatingChat),
|
||||
State.State('whiteListOpenChat', self.enterWhiteListOpenChat, self.exitWhiteListOpenChat),
|
||||
|
@ -111,12 +105,6 @@ class ChatManager(DirectObject.DirectObject):
|
|||
if self.activateChatGui:
|
||||
self.activateChatGui.destroy()
|
||||
self.activateChatGui = None
|
||||
if self.chatMoreInfo:
|
||||
self.chatMoreInfo.destroy()
|
||||
self.chatMoreInfo = None
|
||||
if self.chatPrivacyPolicy:
|
||||
self.chatPrivacyPolicy.destroy()
|
||||
self.chatPrivacyPolicy = None
|
||||
if self.secretChatActivated:
|
||||
self.secretChatActivated.destroy()
|
||||
self.secretChatActivated = None
|
||||
|
@ -441,30 +429,6 @@ class ChatManager(DirectObject.DirectObject):
|
|||
def exitOtherDialog(self):
|
||||
pass
|
||||
|
||||
def enterChatMoreInfo(self):
|
||||
if self.chatMoreInfo == None:
|
||||
self.chatMoreInfo = SecretFriendsInfoPanel.SecretFriendsInfoPanel('secretFriendsInfoDone')
|
||||
self.chatMoreInfo.show()
|
||||
self.accept('secretFriendsInfoDone', self.__secretFriendsInfoDone)
|
||||
return
|
||||
|
||||
def exitChatMoreInfo(self):
|
||||
self.chatMoreInfo.hide()
|
||||
self.ignore('secretFriendsInfoDone')
|
||||
|
||||
def enterChatPrivacyPolicy(self):
|
||||
if self.chatPrivacyPolicy == None:
|
||||
self.chatPrivacyPolicy = PrivacyPolicyPanel.PrivacyPolicyPanel('privacyPolicyDone')
|
||||
self.chatPrivacyPolicy.show()
|
||||
self.accept('privacyPolicyDone', self.__privacyPolicyDone)
|
||||
return
|
||||
|
||||
def exitChatPrivacyPolicy(self):
|
||||
cleanupDialog('privacyPolicyDialog')
|
||||
self.chatPrivacyPolicy = None
|
||||
self.ignore('privacyPolicyDone')
|
||||
return
|
||||
|
||||
def enterSecretChatActivated(self):
|
||||
self.notify.error('called enterSecretChatActivated() on parent class')
|
||||
|
||||
|
@ -476,9 +440,3 @@ class ChatManager(DirectObject.DirectObject):
|
|||
|
||||
def exitProblemActivatingChat(self):
|
||||
self.notify.error('called exitProblemActivatingChat() on parent class')
|
||||
|
||||
def __secretFriendsInfoDone(self):
|
||||
self.fsm.request('activateChat')
|
||||
|
||||
def __privacyPolicyDone(self):
|
||||
self.fsm.request('activateChat')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from pandac.PandaModules import *
|
||||
|
||||
|
||||
hashVal = 3216321797L
|
||||
hashVal = 598642574
|
||||
|
||||
|
||||
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot
|
||||
|
@ -18,7 +18,6 @@ from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToons
|
|||
from toontown.ai.DistributedTrashcanZeroMgr import DistributedTrashcanZeroMgr
|
||||
from toontown.uberdog.DistributedMailManager import DistributedMailManager
|
||||
from otp.chat import ChatAgent
|
||||
from toontown.classicchars import DistributedCCharBase, DistributedMickey, DistributedVampireMickey, DistributedMinnie, DistributedWitchMinnie, DistributedGoofy, DistributedSuperGoofy, DistributedDaisy, DistributedSockHopDaisy, DistributedChip, DistributedPoliceChip, DistributedDale, DistributedJailbirdDale, DistributedGoofySpeedway, DistributedDonald, DistributedFrankenDonald, DistributedDonaldDock, DistributedPluto, DistributedWesternPluto
|
||||
from toontown.parties.GlobalPartyManager import GlobalPartyManager
|
||||
from toontown.racing.DistributedStartingBlock import DistributedViewingBlock
|
||||
from toontown.ai.DistributedPhaseEventMgr import DistributedPhaseEventMgr
|
||||
|
|
|
@ -33,7 +33,6 @@ from otp.distributed.OtpDoGlobals import *
|
|||
from otp.distributed.TelemetryLimiter import TelemetryLimiter
|
||||
from otp.login import HTTPUtil
|
||||
from otp.login import LoginTTUAccount
|
||||
from otp.login.CreateAccountScreen import CreateAccountScreen
|
||||
from otp.otpbase import OTPGlobals
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from otp.otpgui import OTPDialog
|
||||
|
@ -257,16 +256,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.exitLogin, [
|
||||
'noConnection',
|
||||
'waitForGameList',
|
||||
'createAccount',
|
||||
'reject',
|
||||
'failedToConnect',
|
||||
'shutdown']),
|
||||
State('createAccount',
|
||||
self.enterCreateAccount,
|
||||
self.exitCreateAccount, [
|
||||
'noConnection',
|
||||
'waitForGameList',
|
||||
'login',
|
||||
'reject',
|
||||
'failedToConnect',
|
||||
'shutdown']),
|
||||
|
@ -596,9 +585,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.loginFSM.request('parentPassword')
|
||||
elif mode == 'freeTimeExpired':
|
||||
self.loginFSM.request('freeTimeInform')
|
||||
elif mode == 'createAccount':
|
||||
self.loginFSM.request('createAccount', [{'back': 'login',
|
||||
'backArgs': []}])
|
||||
elif mode == 'reject':
|
||||
self.loginFSM.request('reject')
|
||||
elif mode == 'quit':
|
||||
|
@ -616,47 +602,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.handler = None
|
||||
return
|
||||
|
||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||
def enterCreateAccount(self, createAccountDoneData = {'back': 'login',
|
||||
'backArgs': []}):
|
||||
self.createAccountDoneData = createAccountDoneData
|
||||
self.createAccountDoneEvent = 'createAccountDone'
|
||||
self.createAccountScreen = None
|
||||
self.createAccountScreen = CreateAccountScreen(self, self.createAccountDoneEvent)
|
||||
self.accept(self.createAccountDoneEvent, self.__handleCreateAccountDone)
|
||||
self.createAccountScreen.load()
|
||||
self.createAccountScreen.enter()
|
||||
return
|
||||
|
||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||
def __handleCreateAccountDone(self, doneStatus):
|
||||
mode = doneStatus['mode']
|
||||
if mode == 'success':
|
||||
self.setIsNotNewInstallation()
|
||||
self.loginFSM.request('waitForGameList')
|
||||
elif mode == 'reject':
|
||||
self.loginFSM.request('reject')
|
||||
elif mode == 'cancel':
|
||||
self.loginFSM.request(self.createAccountDoneData['back'], self.createAccountDoneData['backArgs'])
|
||||
elif mode == 'failure':
|
||||
self.loginFSM.request(self.createAccountDoneData['back'], self.createAccountDoneData['backArgs'])
|
||||
elif mode == 'quit':
|
||||
self.loginFSM.request('shutdown')
|
||||
else:
|
||||
self.notify.error('Invalid doneStatus mode from CreateAccountScreen: ' + str(mode))
|
||||
|
||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||
def exitCreateAccount(self):
|
||||
if self.createAccountScreen:
|
||||
self.createAccountScreen.exit()
|
||||
self.createAccountScreen.unload()
|
||||
self.createAccountScreen = None
|
||||
self.renderFrame()
|
||||
self.ignore(self.createAccountDoneEvent)
|
||||
del self.createAccountDoneEvent
|
||||
self.handler = None
|
||||
return
|
||||
|
||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||
def enterFailedToConnect(self, statusCode, statusString):
|
||||
self.handler = self.handleMessageType
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from RemoteValueSet import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
import TTAccount
|
||||
import HTTPUtil
|
||||
|
||||
class AccountServerConstants(RemoteValueSet):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('AccountServerConstants')
|
||||
|
||||
def __init__(self, cr):
|
||||
self.expectedConstants = ['minNameLength',
|
||||
'minPwLength',
|
||||
'allowNewAccounts',
|
||||
'freeTrialPeriodInDays',
|
||||
'priceFirstMonth',
|
||||
'pricePerMonth',
|
||||
'customerServicePhoneNumber',
|
||||
'creditCardUpFront']
|
||||
self.defaults = {'minNameLength': '1',
|
||||
'minPwLength': '1',
|
||||
'allowNewAccounts': '1',
|
||||
'creditCardUpFront': '0',
|
||||
'priceFirstMonth': '9.95',
|
||||
'pricePerMonth': '9.95'}
|
||||
noquery = 1
|
||||
if cr.productName == 'DisneyOnline-US':
|
||||
if base.config.GetBool('tt-specific-login', 0):
|
||||
pass
|
||||
else:
|
||||
noquery = 0
|
||||
if cr.accountOldAuth or base.config.GetBool('default-server-constants', noquery):
|
||||
self.notify.debug('setting defaults, not using account server constants')
|
||||
self.dict = {}
|
||||
for constantName in self.expectedConstants:
|
||||
self.dict[constantName] = 'DEFAULT'
|
||||
|
||||
self.dict.update(self.defaults)
|
||||
return
|
||||
url = URLSpec(AccountServerConstants.getServer())
|
||||
url.setPath('/constants.php')
|
||||
self.notify.debug('grabbing account server constants from %s' % url.cStr())
|
||||
RemoteValueSet.__init__(self, url, cr.http, expectedHeader='ACCOUNT SERVER CONSTANTS', expectedFields=self.expectedConstants)
|
||||
|
||||
def getBool(self, name):
|
||||
return self.__getConstant(name, RemoteValueSet.getBool)
|
||||
|
||||
def getInt(self, name):
|
||||
return self.__getConstant(name, RemoteValueSet.getInt)
|
||||
|
||||
def getFloat(self, name):
|
||||
return self.__getConstant(name, RemoteValueSet.getFloat)
|
||||
|
||||
def getString(self, name):
|
||||
return self.__getConstant(name, RemoteValueSet.getString)
|
||||
|
||||
def __getConstant(self, constantName, accessor):
|
||||
if constantName not in self.expectedConstants:
|
||||
self.notify.warning("requested constant '%s' not in expected constant list; if it's a new constant, add it to the list" % constantName)
|
||||
return accessor(self, constantName)
|
||||
|
||||
@staticmethod
|
||||
def getServer():
|
||||
return TTAccount.getAccountServer().cStr()
|
||||
|
||||
@staticmethod
|
||||
def getServerURL():
|
||||
return TTAccount.getAccountServer()
|
|
@ -1,247 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.gui.DirectGui import *
|
||||
from pandac.PandaModules import *
|
||||
from direct.fsm import StateData
|
||||
from otp.otpgui import OTPDialog
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.otpbase import OTPLocalizer
|
||||
import GuiScreen
|
||||
from otp.otpbase import OTPGlobals
|
||||
from direct.distributed.MsgTypes import *
|
||||
|
||||
class CreateAccountScreen(StateData.StateData, GuiScreen.GuiScreen):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CreateAccountScreen')
|
||||
ActiveEntryColor = Vec4(1, 1, 1, 1)
|
||||
InactiveEntryColor = Vec4(0.8, 0.8, 0.8, 1)
|
||||
labelFg = (1, 1, 1, 1)
|
||||
labelFgActive = (1, 1, 0, 1)
|
||||
|
||||
def __init__(self, cr, doneEvent):
|
||||
StateData.StateData.__init__(self, doneEvent)
|
||||
GuiScreen.GuiScreen.__init__(self)
|
||||
self.cr = cr
|
||||
self.loginInterface = self.cr.loginInterface
|
||||
self.fsm = ClassicFSM.ClassicFSM('CreateAccountScreen', [State.State('off', self.enterOff, self.exitOff, ['create']), State.State('create', self.enterCreate, self.exitCreate, ['waitForLoginResponse', 'create']), State.State('waitForLoginResponse', self.enterWaitForLoginResponse, self.exitWaitForLoginResponse, ['create'])], 'off', 'off')
|
||||
self.fsm.enterInitialState()
|
||||
|
||||
def load(self):
|
||||
self.notify.debug('load')
|
||||
masterScale = 0.8
|
||||
textScale = 0.1 * masterScale
|
||||
entryScale = 0.08 * masterScale
|
||||
lineHeight = 0.21 * masterScale
|
||||
buttonScale = 1.3 * masterScale
|
||||
buttonLineHeight = 0.16 * masterScale
|
||||
self.frame = DirectFrame(parent=aspect2d, relief=None)
|
||||
self.frame.hide()
|
||||
linePos = 0.5
|
||||
linePos -= lineHeight
|
||||
self.nameLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenUserName, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08))
|
||||
self.nameEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1)
|
||||
self.nameEntry.label = self.nameLabel
|
||||
linePos -= lineHeight
|
||||
self.passwordLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenPassword, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08))
|
||||
self.passwordEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1, obscured=1)
|
||||
self.passwordEntry.label = self.passwordLabel
|
||||
linePos -= lineHeight
|
||||
self.passwordConfirmLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenConfirmPassword, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08))
|
||||
self.passwordConfirmEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1, obscured=1)
|
||||
self.passwordConfirmEntry.label = self.passwordConfirmLabel
|
||||
linePos -= lineHeight
|
||||
linePos -= lineHeight
|
||||
self.submitButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.CreateAccountScreenSubmit, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleSubmit)
|
||||
linePos -= buttonLineHeight
|
||||
self.cancelButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.CreateAccountScreenCancel, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleCancel)
|
||||
linePos -= buttonLineHeight
|
||||
self.dialogDoneEvent = 'createAccountDialogAck'
|
||||
dialogClass = OTPGlobals.getGlobalDialogClass()
|
||||
self.dialog = dialogClass(dialogName='createAccountDialog', doneEvent=self.dialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100)
|
||||
self.dialog.hide()
|
||||
return
|
||||
|
||||
def unload(self):
|
||||
self.notify.debug('unload')
|
||||
self.dialog.cleanup()
|
||||
del self.dialog
|
||||
self.frame.destroy()
|
||||
del self.fsm
|
||||
del self.loginInterface
|
||||
del self.cr
|
||||
|
||||
def enter(self):
|
||||
self.__firstTime = 1
|
||||
self.frame.show()
|
||||
self.fsm.request('create')
|
||||
|
||||
def exit(self):
|
||||
self.ignore(self.dialogDoneEvent)
|
||||
self.fsm.requestFinalState()
|
||||
self.frame.hide()
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterCreate(self):
|
||||
self.password = ''
|
||||
self.passwordEntry.set('')
|
||||
self.passwordConfirmEntry.set('')
|
||||
if self.__firstTime:
|
||||
self.userName = ''
|
||||
self.nameEntry.set(self.userName)
|
||||
self.__firstTime = 0
|
||||
self.focusList = [self.nameEntry, self.passwordEntry, self.passwordConfirmEntry]
|
||||
self.startFocusMgmt(overrides={}, globalFocusHandler=self.__handleFocusChange)
|
||||
|
||||
def exitCreate(self):
|
||||
self.stopFocusMgmt()
|
||||
|
||||
def __handleFocusChange(self, focusItem):
|
||||
for item in self.focusList:
|
||||
item.label.component('text0').setFg(self.labelFg)
|
||||
|
||||
if focusItem is not None:
|
||||
focusItem.label.component('text0').setFg(self.labelFgActive)
|
||||
return
|
||||
|
||||
def __handleSubmit(self):
|
||||
self.removeFocus()
|
||||
self.userName = self.nameEntry.get()
|
||||
self.password = self.passwordEntry.get()
|
||||
passwordConfirm = self.passwordConfirmEntry.get()
|
||||
minNameLength = self.cr.accountServerConstants.getInt('minNameLength')
|
||||
minPwdLength = self.cr.accountServerConstants.getInt('minPwLength')
|
||||
if self.userName == '':
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenNoAccountName)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleUsernameAck)
|
||||
elif len(self.userName) < minNameLength:
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenAccountNameTooShort % minNameLength)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleUsernameAck)
|
||||
elif len(self.password) < minPwdLength:
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenPasswordTooShort % minPwdLength)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handlePasswordAck)
|
||||
elif self.password != passwordConfirm:
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenPasswordMismatch)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handlePasswordAck)
|
||||
else:
|
||||
self.fsm.request('waitForLoginResponse')
|
||||
|
||||
def __handleCancel(self):
|
||||
messenger.send(self.doneEvent, [{'mode': 'cancel'}])
|
||||
|
||||
def __handleUsernameAck(self):
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
||||
self.setFocus(self.nameEntry)
|
||||
|
||||
def __handlePasswordAck(self):
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
||||
self.setFocus(self.passwordEntry)
|
||||
|
||||
def enterWaitForLoginResponse(self):
|
||||
self.cr.handler = self.handleWaitForLoginResponse
|
||||
self.cr.userName = self.userName
|
||||
self.cr.password = self.password
|
||||
data = {}
|
||||
referrer = launcher.getReferrerCode()
|
||||
if referrer is not None:
|
||||
data['referrer'] = referrer
|
||||
error = self.loginInterface.createAccount(self.userName, self.password, data)
|
||||
|
||||
if error:
|
||||
self.notify.info(error)
|
||||
self.dialog.setMessage(error)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleBadAccountAck)
|
||||
else:
|
||||
self.cr.logAccountInfo()
|
||||
self.loginInterface.sendLoginMsg()
|
||||
self.waitForDatabaseTimeout(requestName='CreateAccountWaitForLoginResponse')
|
||||
return
|
||||
|
||||
def exitWaitForLoginResponse(self):
|
||||
self.cleanupWaitingForDatabase()
|
||||
self.cr.handler = None
|
||||
return
|
||||
|
||||
def handleWaitForLoginResponse(self, msgType, di):
|
||||
if msgType == CLIENT_LOGIN_2_RESP:
|
||||
self.handleLoginResponseMsg2(di)
|
||||
elif msgType == CLIENT_LOGIN_RESP:
|
||||
self.handleLoginResponseMsg(di)
|
||||
else:
|
||||
self.cr.handleMessageType(msgType, di)
|
||||
|
||||
def handleLoginResponseMsg2(self, di):
|
||||
returnCode = di.getUint8()
|
||||
self.notify.info('Login response return code: ' + str(returnCode))
|
||||
if returnCode == 0:
|
||||
self.__handleLoginSuccess()
|
||||
else:
|
||||
errorString = di.getString()
|
||||
self.notify.warning(errorString)
|
||||
messenger.send(self.doneEvent, [{'mode': 'reject'}])
|
||||
|
||||
def __handleLoginSuccess(self):
|
||||
self.notify.info('Logged in with username: %s' % self.userName)
|
||||
launcher.setGoUserName(self.userName)
|
||||
launcher.setLastLogin(self.userName)
|
||||
launcher.setUserLoggedIn()
|
||||
messenger.send(self.doneEvent, [{'mode': 'success'}])
|
||||
|
||||
def handleLoginResponseMsg(self, di):
|
||||
returnCode = di.getUint8()
|
||||
self.notify.info('Login response return code: ' + str(returnCode))
|
||||
if returnCode == 0:
|
||||
accountCode = di.getUint32()
|
||||
commentString = di.getString()
|
||||
sec = di.getUint32()
|
||||
usec = di.getUint32()
|
||||
self.__handleLoginSuccess()
|
||||
elif returnCode == 12:
|
||||
self.notify.info('Bad password')
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenUserNameTaken)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleBadPasswordAck)
|
||||
elif returnCode == 14:
|
||||
self.notify.info('Bad word in user name')
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenInvalidUserName)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleBadWordInUserName)
|
||||
elif returnCode == 129:
|
||||
self.notify.info('Username not found')
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenUserNameNotFound)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleBadAccountAck)
|
||||
else:
|
||||
accountCode = di.getUint32()
|
||||
errorString = di.getString()
|
||||
self.notify.warning(errorString)
|
||||
messenger.send(self.doneEvent, [{'mode': 'reject'}])
|
||||
|
||||
def __handleConnectionErrorAck(self):
|
||||
self.dialog.hide()
|
||||
messenger.send(self.doneEvent, [{'mode': 'failure'}])
|
||||
|
||||
def __handleBadPasswordAck(self):
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
||||
|
||||
def __handleBadAccountAck(self):
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
||||
|
||||
def __handleBadWordInUserName(self):
|
||||
self.userName = ''
|
||||
self.nameEntry.set('')
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
|
@ -1,276 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from otp.otpbase import OTPGlobals
|
||||
from direct.gui.DirectGui import *
|
||||
from otp.otpgui import OTPDialog
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from direct.task.Task import Task
|
||||
|
||||
class GuiScreen:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('GuiScreen')
|
||||
DGG.ENTERPRESS_ADVANCE = 0
|
||||
DGG.ENTERPRESS_ADVANCE_IFNOTEMPTY = 1
|
||||
DGG.ENTERPRESS_DONT_ADVANCE = 2
|
||||
DGG.ENTERPRESS_REMOVE_FOCUS = 3
|
||||
ENTRY_WIDTH = 20
|
||||
|
||||
def __init__(self):
|
||||
self.waitingForDatabase = None
|
||||
self.focusIndex = None
|
||||
self.suppressClickSound = 0
|
||||
return
|
||||
|
||||
def startFocusMgmt(self, startFocus = 0, enterPressBehavior = DGG.ENTERPRESS_ADVANCE_IFNOTEMPTY, overrides = {}, globalFocusHandler = None):
|
||||
GuiScreen.notify.debug('startFocusMgmt:\nstartFocus=%s,\nenterPressBehavior=%s\noverrides=%s' % (startFocus, enterPressBehavior, overrides))
|
||||
self.accept('tab', self.__handleTab)
|
||||
self.accept('shift-tab', self.__handleShiftTab)
|
||||
self.accept('enter', self.__handleEnter)
|
||||
self.__startFrameStartTask()
|
||||
self.userGlobalFocusHandler = globalFocusHandler
|
||||
self.focusHandlerAbsorbCounts = {}
|
||||
for i in xrange(len(self.focusList)):
|
||||
item = self.focusList[i]
|
||||
if isinstance(item, DirectEntry):
|
||||
self.focusHandlerAbsorbCounts[item] = 0
|
||||
|
||||
self.userFocusHandlers = {}
|
||||
self.userCommandHandlers = {}
|
||||
for i in xrange(len(self.focusList)):
|
||||
item = self.focusList[i]
|
||||
if isinstance(item, DirectEntry):
|
||||
self.userFocusHandlers[item] = (item['focusInCommand'], item['focusInExtraArgs'])
|
||||
item['focusInCommand'] = self.__handleFocusChangeAbsorb
|
||||
item['focusInExtraArgs'] = [i]
|
||||
self.userCommandHandlers[item] = (item['command'], item['extraArgs'])
|
||||
item['command'] = None
|
||||
item['extraArgs'] = []
|
||||
elif isinstance(item, DirectScrolledList):
|
||||
self.userCommandHandlers[item] = (item['command'], item['extraArgs'])
|
||||
item['command'] = self.__handleDirectScrolledListCommand
|
||||
item['extraArgs'] = [i]
|
||||
|
||||
self.enterPressHandlers = {}
|
||||
for i in xrange(len(self.focusList)):
|
||||
item = self.focusList[i]
|
||||
behavior = enterPressBehavior
|
||||
if item in overrides:
|
||||
behavior = overrides[item]
|
||||
if callable(behavior):
|
||||
self.enterPressHandlers[item] = behavior
|
||||
else:
|
||||
if not isinstance(item, DirectEntry) and behavior == GuiScreen_ENTERPRESS_ADVANCE_IFNOTEMPTY:
|
||||
behavior = GuiScreen_ENTERPRESS_ADVANCE
|
||||
commandHandlers = (self.__alwaysAdvanceFocus,
|
||||
self.__advanceFocusIfNotEmpty,
|
||||
self.__neverAdvanceFocus,
|
||||
self.__ignoreEnterPress)
|
||||
self.enterPressHandlers[item] = commandHandlers[behavior]
|
||||
|
||||
self.setFocus(startFocus)
|
||||
return
|
||||
|
||||
def focusMgmtActive(self):
|
||||
return self.focusIndex != None
|
||||
|
||||
def stopFocusMgmt(self):
|
||||
GuiScreen.notify.debug('stopFocusMgmt')
|
||||
if not self.focusMgmtActive():
|
||||
return
|
||||
self.ignore('tab')
|
||||
self.ignore('shift-tab')
|
||||
self.ignore('enter')
|
||||
self.__stopFrameStartTask()
|
||||
self.userGlobalFocusHandler = None
|
||||
self.focusIndex = None
|
||||
self.focusHandlerAbsorbCounts = {}
|
||||
for item in self.focusList:
|
||||
if isinstance(item, DirectEntry):
|
||||
userHandler, userHandlerArgs = self.userFocusHandlers[item]
|
||||
item['focusInCommand'] = userHandler
|
||||
item['focusInExtraArgs'] = userHandlerArgs
|
||||
userHandler, userHandlerArgs = self.userCommandHandlers[item]
|
||||
item['command'] = userHandler
|
||||
item['extraArgs'] = userHandlerArgs
|
||||
elif isinstance(item, DirectScrolledList):
|
||||
userHandler, userHandlerArgs = self.userCommandHandlers[item]
|
||||
item['command'] = userHandler
|
||||
item['extraArgs'] = userHandlerArgs
|
||||
|
||||
self.userFocusHandlers = {}
|
||||
self.userCommandHandlers = {}
|
||||
self.enterPressHandlers = {}
|
||||
return
|
||||
|
||||
def setFocus(self, arg, suppressSound = 1):
|
||||
if type(arg) == type(0):
|
||||
index = arg
|
||||
else:
|
||||
index = self.focusList.index(arg)
|
||||
if suppressSound:
|
||||
self.suppressClickSound += 1
|
||||
self.__setFocusIndex(index)
|
||||
|
||||
def advanceFocus(self, condition = 1):
|
||||
index = self.getFocusIndex()
|
||||
if condition:
|
||||
index += 1
|
||||
self.setFocus(index, suppressSound=0)
|
||||
|
||||
def getFocusIndex(self):
|
||||
if not self.focusMgmtActive():
|
||||
return None
|
||||
return self.focusIndex
|
||||
|
||||
def getFocusItem(self):
|
||||
if not self.focusMgmtActive():
|
||||
return None
|
||||
return self.focusList[self.focusIndex]
|
||||
|
||||
def removeFocus(self):
|
||||
focusItem = self.getFocusItem()
|
||||
if isinstance(focusItem, DirectEntry):
|
||||
focusItem['focus'] = 0
|
||||
if self.userGlobalFocusHandler:
|
||||
self.userGlobalFocusHandler(None)
|
||||
return
|
||||
|
||||
def restoreFocus(self):
|
||||
self.setFocus(self.getFocusItem())
|
||||
|
||||
def __setFocusIndex(self, index):
|
||||
focusIndex = index % len(self.focusList)
|
||||
focusItem = self.focusList[focusIndex]
|
||||
if isinstance(focusItem, DirectEntry):
|
||||
focusItem['focus'] = 1
|
||||
self.focusHandlerAbsorbCounts[focusItem] += 1
|
||||
self.__handleFocusChange(focusIndex)
|
||||
|
||||
def __chainToUserCommandHandler(self, item):
|
||||
userHandler, userHandlerArgs = self.userCommandHandlers[item]
|
||||
if userHandler:
|
||||
if isinstance(item, DirectEntry):
|
||||
enteredText = item.get()
|
||||
apply(userHandler, [enteredText] + userHandlerArgs)
|
||||
elif isinstance(item, DirectScrolledList):
|
||||
apply(userHandler, userHandlerArgs)
|
||||
|
||||
def __chainToUserFocusHandler(self, item):
|
||||
if isinstance(item, DirectEntry):
|
||||
userHandler, userHandlerArgs = self.userFocusHandlers[item]
|
||||
if userHandler:
|
||||
apply(userHandler, userHandlerArgs)
|
||||
|
||||
def __handleTab(self):
|
||||
self.tabPressed = 1
|
||||
self.focusDirection = 1
|
||||
self.__setFocusIndex(self.getFocusIndex() + self.focusDirection)
|
||||
|
||||
def __handleShiftTab(self):
|
||||
self.tabPressed = 1
|
||||
self.focusDirection = -1
|
||||
self.__setFocusIndex(self.getFocusIndex() + self.focusDirection)
|
||||
|
||||
def __handleFocusChangeAbsorb(self, index):
|
||||
item = self.focusList[index]
|
||||
if self.focusHandlerAbsorbCounts[item] > 0:
|
||||
self.focusHandlerAbsorbCounts[item] -= 1
|
||||
else:
|
||||
self.__handleFocusChange(index)
|
||||
|
||||
def playFocusChangeSound(self):
|
||||
base.playSfx(DGG.getDefaultClickSound())
|
||||
|
||||
def __handleFocusChange(self, index):
|
||||
if index != self.focusIndex:
|
||||
self.removeFocus()
|
||||
self.__focusChangedThisFrame = 1
|
||||
if hasattr(self, 'tabPressed'):
|
||||
del self.tabPressed
|
||||
else:
|
||||
self.focusDirection = 1
|
||||
self.focusIndex = index
|
||||
if self.suppressClickSound > 0:
|
||||
self.suppressClickSound -= 1
|
||||
else:
|
||||
self.playFocusChangeSound()
|
||||
focusItem = self.getFocusItem()
|
||||
if self.userGlobalFocusHandler:
|
||||
self.userGlobalFocusHandler(focusItem)
|
||||
if self.getFocusItem() != focusItem:
|
||||
GuiScreen.notify.debug('focus changed by global focus handler')
|
||||
if self.focusMgmtActive():
|
||||
self.__chainToUserFocusHandler(focusItem)
|
||||
|
||||
def __startFrameStartTask(self):
|
||||
self.__focusChangedThisFrame = 0
|
||||
self.frameStartTaskName = 'GuiScreenFrameStart'
|
||||
taskMgr.add(self.__handleFrameStart, self.frameStartTaskName, -100)
|
||||
|
||||
def __stopFrameStartTask(self):
|
||||
taskMgr.remove(self.frameStartTaskName)
|
||||
del self.frameStartTaskName
|
||||
del self.__focusChangedThisFrame
|
||||
|
||||
def __handleFrameStart(self, task):
|
||||
self.__focusChangedThisFrame = 0
|
||||
return Task.cont
|
||||
|
||||
def __handleDirectScrolledListCommand(self, index):
|
||||
self.__chainToUserCommandHandler(self.focusList[index])
|
||||
self.setFocus(index, suppressSound=self.getFocusIndex() == index)
|
||||
|
||||
def __handleEnter(self):
|
||||
if self.__focusChangedThisFrame:
|
||||
return
|
||||
focusItem = self.getFocusItem()
|
||||
if isinstance(focusItem, DirectEntry):
|
||||
self.__chainToUserCommandHandler(focusItem)
|
||||
if self.focusMgmtActive() and focusItem == self.getFocusItem():
|
||||
self.enterPressHandlers[focusItem]()
|
||||
|
||||
def __alwaysAdvanceFocus(self):
|
||||
self.advanceFocus()
|
||||
|
||||
def __advanceFocusIfNotEmpty(self):
|
||||
focusItem = self.getFocusItem()
|
||||
enteredText = focusItem.get()
|
||||
if enteredText != '':
|
||||
self.advanceFocus()
|
||||
else:
|
||||
self.setFocus(self.getFocusIndex())
|
||||
|
||||
def __neverAdvanceFocus(self):
|
||||
self.setFocus(self.getFocusIndex())
|
||||
|
||||
def __ignoreEnterPress(self):
|
||||
pass
|
||||
|
||||
def waitForDatabaseTimeout(self, requestName = 'unknown'):
|
||||
GuiScreen.notify.debug('waiting for database timeout %s at %s' % (requestName, globalClock.getFrameTime()))
|
||||
globalClock.tick()
|
||||
taskMgr.doMethodLater(OTPGlobals.DatabaseDialogTimeout, self.__showWaitingForDatabase, 'waitingForDatabase', extraArgs=[requestName])
|
||||
|
||||
def __showWaitingForDatabase(self, requestName):
|
||||
GuiScreen.notify.info('timed out waiting for %s at %s' % (requestName, globalClock.getFrameTime()))
|
||||
dialogClass = OTPGlobals.getDialogClass()
|
||||
self.waitingForDatabase = dialogClass(text=OTPLocalizer.GuiScreenToontownUnavailable, dialogName='WaitingForDatabase', buttonTextList=[OTPLocalizer.GuiScreenCancel], style=OTPDialog.Acknowledge, command=self.__handleCancelWaiting)
|
||||
self.waitingForDatabase.show()
|
||||
taskMgr.doMethodLater(OTPGlobals.DatabaseGiveupTimeout, self.__giveUpWaitingForDatabase, 'waitingForDatabase', extraArgs=[requestName])
|
||||
return Task.done
|
||||
|
||||
def __giveUpWaitingForDatabase(self, requestName):
|
||||
GuiScreen.notify.info('giving up waiting for %s at %s' % (requestName, globalClock.getFrameTime()))
|
||||
self.cleanupWaitingForDatabase()
|
||||
messenger.send(self.doneEvent, [{'mode': 'failure'}])
|
||||
return Task.done
|
||||
|
||||
def cleanupWaitingForDatabase(self):
|
||||
if self.waitingForDatabase != None:
|
||||
self.waitingForDatabase.cleanup()
|
||||
self.waitingForDatabase = None
|
||||
taskMgr.remove('waitingForDatabase')
|
||||
return
|
||||
|
||||
def __handleCancelWaiting(self, value):
|
||||
self.cleanupWaitingForDatabase()
|
||||
messenger.send(self.doneEvent, [{'mode': 'quit'}])
|
|
@ -1,80 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.gui.DirectGui import *
|
||||
from otp.otpbase import OTPLocalizer
|
||||
|
||||
class MultiPageTextFrame(DirectFrame):
|
||||
defWidth = 1.8
|
||||
defHeight = 0.9
|
||||
|
||||
def __init__(self, textList, width = defWidth, height = defHeight, wordWrap = None, hidePageNum = 0, pageChangeCallback = None, parent = aspect2d, **kw):
|
||||
self.textList = textList
|
||||
self.numPages = len(self.textList)
|
||||
self.pageChangeCallback = pageChangeCallback
|
||||
if not wordWrap:
|
||||
wordWrap = round(18.8 * width)
|
||||
hWidth = width / 2.0
|
||||
hHeight = height / 2.0
|
||||
optiondefs = (('relief', DGG.SUNKEN, None),
|
||||
('frameSize', (-hWidth,
|
||||
hWidth,
|
||||
-hHeight,
|
||||
hHeight), None),
|
||||
('frameColor', (0.85, 0.85, 0.6, 1), None),
|
||||
('borderWidth', (0.01, 0.01), None),
|
||||
('text', '', None),
|
||||
('text_pos', (-hWidth * 0.95, hHeight * 0.93), None),
|
||||
('text_scale', 0.05, None),
|
||||
('text_align', TextNode.ALeft, None),
|
||||
('text_wordwrap', wordWrap, None))
|
||||
self.defineoptions(kw, optiondefs)
|
||||
DirectFrame.__init__(self, parent)
|
||||
self.initialiseoptions(MultiPageTextFrame)
|
||||
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
|
||||
buttonScale = 0.7 * (float(height) / self.defHeight)
|
||||
buttonZ = -hHeight * 0.83
|
||||
self.nextButton = DirectButton(parent=self, relief=None, scale=buttonScale, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(0.75, 1, 1), pos=(hWidth * 0.35, 0, buttonZ), text=OTPLocalizer.MultiPageTextFrameNext, text_scale=0.05, text_pos=(0, -0.02), command=self.turnPage, extraArgs=[1])
|
||||
self.prevButton = DirectButton(parent=self, relief=None, scale=buttonScale, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(0.75, 1, 1), pos=(-hWidth * 0.35, 0, buttonZ), text=OTPLocalizer.MultiPageTextFramePrev, text_scale=0.05, text_pos=(0, -0.02), command=self.turnPage, extraArgs=[-1])
|
||||
self.pageNum = DirectLabel(relief=None, parent=self, pos=(0, 0, -hHeight * 0.86), text='', text_scale=0.05, text_pos=(0, 0))
|
||||
if hidePageNum:
|
||||
self.pageNum.hide()
|
||||
self.setPage(0)
|
||||
guiButton.removeNode()
|
||||
return
|
||||
|
||||
def setPageChangeCallback(self, callback):
|
||||
self.pageChangeCallback = callback
|
||||
self.setPage(self.curPage)
|
||||
|
||||
def setPage(self, pageNum):
|
||||
self.curPage = max(0, min(self.numPages - 1, pageNum))
|
||||
if self.numPages == 1:
|
||||
self.nextButton.hide()
|
||||
self.prevButton.hide()
|
||||
self.curPage = 0
|
||||
elif self.curPage == self.numPages - 1:
|
||||
self.nextButton.hide()
|
||||
self.prevButton.show()
|
||||
elif self.curPage == 0:
|
||||
self.nextButton.show()
|
||||
self.prevButton.hide()
|
||||
else:
|
||||
self.nextButton.show()
|
||||
self.prevButton.show()
|
||||
self.pageNum['text'] = OTPLocalizer.MultiPageTextFramePage % (self.curPage + 1, self.numPages)
|
||||
self['text'] = self.textList[self.curPage]
|
||||
if self.pageChangeCallback:
|
||||
self.pageChangeCallback(self.getCurPage())
|
||||
|
||||
def getCurPage(self):
|
||||
return self.curPage
|
||||
|
||||
def turnPage(self, delta):
|
||||
self.setPage(self.curPage + delta)
|
||||
|
||||
def acceptAgreementKeypresses(self):
|
||||
self.accept('page_down-up', self.turnPage, extraArgs=[1])
|
||||
self.accept('page_up-up', self.turnPage, extraArgs=[-1])
|
||||
|
||||
def ignoreAgreementKeypresses(self):
|
||||
self.ignore('page_down-up')
|
||||
self.ignore('page_up-up')
|
|
@ -1,97 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from otp.otpbase.OTPGlobals import *
|
||||
from direct.gui.DirectGui import *
|
||||
from MultiPageTextFrame import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from otp.otpgui import OTPDialog
|
||||
|
||||
class PrivacyPolicyTextPanel(getGlobalDialogClass()):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('PrivacyPolicyTextPanel')
|
||||
|
||||
def __init__(self, doneEvent, hidePageNum = 0, pageChangeCallback = None, textList = []):
|
||||
dialogClass = getGlobalDialogClass()
|
||||
dialogClass.__init__(self, parent=aspect2d, dialogName='privacyPolicyTextDialog', doneEvent=doneEvent, okButtonText=OTPLocalizer.PrivacyPolicyClose, style=OTPDialog.Acknowledge, text='', topPad=1.5, sidePad=1.2, pos=(0, 0, -.55), scale=0.9)
|
||||
self.privacyPolicyText = MultiPageTextFrame(parent=self, textList=textList, hidePageNum=hidePageNum, pageChangeCallback=pageChangeCallback, pos=(0, 0, 0.7), width=2.4, height=1.5)
|
||||
self['image'] = self['image']
|
||||
self['image_pos'] = (0, 0, 0.65)
|
||||
self['image_scale'] = (2.7, 1, 1.9)
|
||||
closeButton = self.getChild(0)
|
||||
closeButton.setZ(-.13)
|
||||
|
||||
|
||||
class PrivacyPolicyPanel(getGlobalDialogClass()):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('PrivacyPolicyPanel')
|
||||
|
||||
def __init__(self, doneEvent, hidePageNum = 0, pageChangeCallback = None, textList = 1):
|
||||
dialogClass = getGlobalDialogClass()
|
||||
dialogClass.__init__(self, parent=aspect2d, dialogName='privacyPolicyDialog', doneEvent=doneEvent, okButtonText=OTPLocalizer.PrivacyPolicyClose, style=OTPDialog.Acknowledge, text='', topPad=1.5, sidePad=1.2, pos=(0, 0, -.15), scale=0.6)
|
||||
self.chatPrivacyPolicy = None
|
||||
self.fsm = ClassicFSM.ClassicFSM('privacyPolicyPanel', [State.State('off', self.enterOff, self.exitOff),
|
||||
State.State('version1Adult', self.enterVersion1Adult, self.exitPrivacyPolicy),
|
||||
State.State('version1Kids', self.enterVersion1Kids, self.exitPrivacyPolicy),
|
||||
State.State('version2Adult', self.enterVersion2Adult, self.exitPrivacyPolicy),
|
||||
State.State('version2Kids', self.enterVersion2Kids, self.exitPrivacyPolicy)], 'off', 'off')
|
||||
self.fsm.enterInitialState()
|
||||
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
|
||||
moreButtonImage = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR'))
|
||||
DirectFrame(self, pos=(-0.4, 0.1, 0.4), relief=None, text=OTPLocalizer.PrivacyPolicyText_Intro, text_align=TextNode.ALeft, text_wordwrap=28, text_scale=0.09, text_pos=(-0.82, 1.0), textMayChange=0)
|
||||
textScale = 0.05
|
||||
buttonFrame = DirectFrame(self, pos=(0.0, 0.1, 0.0), scale=1.4, relief=None)
|
||||
DirectButton(buttonFrame, image=moreButtonImage, image_scale=(1.75, 1.0, 1.0), relief=None, text=OTPLocalizer.ActivateChatPrivacyPolicy_Button1A, text_scale=textScale, text_pos=(0, -0.01), textMayChange=0, pos=(-0.45, 0.0, 0.4), command=self.__handlePrivacyPolicy, extraArgs=['version1Adult'])
|
||||
DirectButton(buttonFrame, image=moreButtonImage, image_scale=(1.75, 1.0, 1.0), relief=None, text=OTPLocalizer.ActivateChatPrivacyPolicy_Button1K, text_scale=textScale, text_pos=(0, -0.01), textMayChange=0, pos=(-0.45, 0.0, 0.2), command=self.__handlePrivacyPolicy, extraArgs=['version1Kids'])
|
||||
DirectButton(buttonFrame, image=moreButtonImage, image_scale=(1.75, 1.0, 1.0), relief=None, text=OTPLocalizer.ActivateChatPrivacyPolicy_Button2A, text_scale=textScale, text_pos=(0, -0.01), textMayChange=0, pos=(0.45, 0.0, 0.4), command=self.__handlePrivacyPolicy, extraArgs=['version2Adult'])
|
||||
DirectButton(buttonFrame, image=moreButtonImage, image_scale=(1.75, 1.0, 1.0), relief=None, text=OTPLocalizer.ActivateChatPrivacyPolicy_Button2K, text_scale=textScale, text_pos=(0, -0.01), textMayChange=0, pos=(0.45, 0.0, 0.2), command=self.__handlePrivacyPolicy, extraArgs=['version2Kids'])
|
||||
self['image'] = self['image']
|
||||
self['image_pos'] = (0, 0, 0.65)
|
||||
self['image_scale'] = (2.7, 1, 1.9)
|
||||
closeButton = self.getChild(0)
|
||||
closeButton.setZ(-.13)
|
||||
return
|
||||
|
||||
def delete(self):
|
||||
self.ignoreAll()
|
||||
del self.fsm
|
||||
if self.chatPrivacyPolicy:
|
||||
self.chatPrivacyPolicy.destroy()
|
||||
self.chatPrivacyPolicy = None
|
||||
return
|
||||
|
||||
def __handlePrivacyPolicy(self, state, *oooo):
|
||||
self.fsm.request(state)
|
||||
|
||||
def __privacyPolicyTextDone(self):
|
||||
self.exitPrivacyPolicy()
|
||||
|
||||
def enterPrivacyPolicy(self, textList):
|
||||
if self.chatPrivacyPolicy == None:
|
||||
self.chatPrivacyPolicy = PrivacyPolicyTextPanel('privacyPolicyTextDone', textList=textList)
|
||||
self.chatPrivacyPolicy.show()
|
||||
self.acceptOnce('privacyPolicyTextDone', self.__privacyPolicyTextDone)
|
||||
return
|
||||
|
||||
def exitPrivacyPolicy(self):
|
||||
self.ignore('privacyPolicyTextDone')
|
||||
if self.chatPrivacyPolicy:
|
||||
cleanupDialog('privacyPolicyTextDialog')
|
||||
self.chatPrivacyPolicy = None
|
||||
return
|
||||
|
||||
def enterVersion1Adult(self):
|
||||
self.enterPrivacyPolicy(OTPLocalizer.PrivacyPolicyText_1A)
|
||||
|
||||
def enterVersion1Kids(self):
|
||||
self.enterPrivacyPolicy(OTPLocalizer.PrivacyPolicyText_1K)
|
||||
|
||||
def enterVersion2Adult(self):
|
||||
self.enterPrivacyPolicy(OTPLocalizer.PrivacyPolicyText_2A)
|
||||
|
||||
def enterVersion2Kids(self):
|
||||
self.enterPrivacyPolicy(OTPLocalizer.PrivacyPolicyText_2K)
|
||||
|
||||
def enterOff(self):
|
||||
self.ignoreAll()
|
||||
self.exitPrivacyPolicy()
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
|
@ -1,71 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
import TTAccount
|
||||
import HTTPUtil
|
||||
|
||||
class RemoteValueSet:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('RemoteValueSet')
|
||||
|
||||
def __init__(self, url, http, body = '', expectedHeader = None, expectedFields = [], onUnexpectedResponse = None):
|
||||
if onUnexpectedResponse is None:
|
||||
onUnexpectedResponse = self.__onUnexpectedResponse
|
||||
response = HTTPUtil.getHTTPResponse(url, http, body)
|
||||
if expectedHeader is not None:
|
||||
if response[0] != expectedHeader:
|
||||
errMsg = 'unexpected response: %s' % response
|
||||
self.notify.warning(errMsg)
|
||||
onUnexpectedResponse(errMsg)
|
||||
return
|
||||
response = response[1:]
|
||||
self.dict = {}
|
||||
for line in response:
|
||||
if not len(line):
|
||||
continue
|
||||
try:
|
||||
name, value = line.split('=', 1)
|
||||
except ValueError, e:
|
||||
errMsg = 'unexpected response: %s' % response
|
||||
self.notify.warning(errMsg)
|
||||
onUnexpectedResponse(errMsg)
|
||||
return
|
||||
|
||||
if len(expectedFields):
|
||||
if name not in expectedFields:
|
||||
self.notify.warning("received field '%s' that is not in expected field list" % name)
|
||||
self.dict[name] = value
|
||||
|
||||
for name in expectedFields:
|
||||
if name not in self.dict:
|
||||
errMsg = "missing expected field '%s'" % name
|
||||
self.notify.warning(errMsg)
|
||||
onUnexpectedResponse(errMsg)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def __repr__(self):
|
||||
return 'RemoteValueSet:%s' % str(self.dict)
|
||||
|
||||
def hasKey(self, key):
|
||||
return key in self.dict
|
||||
|
||||
def getBool(self, name, default = None):
|
||||
return self.__getValue(name, lambda x: int(x) != 0, default)
|
||||
|
||||
def getInt(self, name, default = None):
|
||||
return self.__getValue(name, int, default)
|
||||
|
||||
def getFloat(self, name, default = None):
|
||||
return self.__getValue(name, float, default)
|
||||
|
||||
def getString(self, name, default = None):
|
||||
return self.__getValue(name, str, default)
|
||||
|
||||
def __getValue(self, name, convOp, default):
|
||||
if default is None:
|
||||
return convOp(self.dict[name])
|
||||
else:
|
||||
return convOp(self.dict.get(name, default))
|
||||
return
|
||||
|
||||
def __onUnexpectedResponse(self, errStr):
|
||||
raise HTTPUtil.UnexpectedResponse(errStr)
|
|
@ -1,18 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from otp.otpbase.OTPGlobals import *
|
||||
from direct.gui.DirectGui import *
|
||||
from MultiPageTextFrame import *
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from otp.otpgui import OTPDialog
|
||||
|
||||
class SecretFriendsInfoPanel(getGlobalDialogClass()):
|
||||
|
||||
def __init__(self, doneEvent, hidePageNum = 0, pageChangeCallback = None):
|
||||
dialogClass = getGlobalDialogClass()
|
||||
dialogClass.__init__(self, parent=aspect2d, dialogName='secretFriendsInfoDialog', doneEvent=doneEvent, okButtonText=OTPLocalizer.SecretFriendsInfoPanelClose, style=OTPDialog.Acknowledge, text='', topPad=1.5, sidePad=1.2, pos=(0, 0, 0.1), scale=0.9)
|
||||
self.textPanel = MultiPageTextFrame(parent=self, textList=OTPLocalizer.SecretFriendsInfoPanelText, hidePageNum=hidePageNum, pageChangeCallback=pageChangeCallback)
|
||||
self['image'] = self['image']
|
||||
self['image_pos'] = (0, 0, -.1)
|
||||
self['image_scale'] = (2, 1, 1.3)
|
||||
closeButton = self.getChild(0)
|
||||
closeButton.setZ(-.56)
|
|
@ -1,280 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from pandac.PandaModules import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.showbase import PythonUtil
|
||||
from otp.otpbase import OTPLocalizer
|
||||
import HTTPUtil
|
||||
import RemoteValueSet
|
||||
import copy
|
||||
accountServer = ''
|
||||
accountServer = launcher.getAccountServer()
|
||||
print 'TTAccount: accountServer from launcher: ', accountServer
|
||||
configAccountServer = base.config.GetString('account-server', '')
|
||||
if configAccountServer:
|
||||
accountServer = configAccountServer
|
||||
print 'TTAccount: overriding accountServer from config: ', accountServer
|
||||
if not accountServer:
|
||||
accountServer = 'https://toontown.go.com'
|
||||
print 'TTAccount: default accountServer: ', accountServer
|
||||
accountServer = URLSpec(accountServer, 1)
|
||||
|
||||
def getAccountServer():
|
||||
return accountServer
|
||||
|
||||
|
||||
TTAccountException = HTTPUtil.HTTPUtilException
|
||||
|
||||
class TTAccount:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('TTAccount')
|
||||
|
||||
def __init__(self, cr):
|
||||
self.cr = cr
|
||||
self.response = None
|
||||
return
|
||||
|
||||
def createAccount(self, loginName, password, data):
|
||||
return self.talk('create', data=self.__makeLoginDict(loginName, password, data))
|
||||
|
||||
def authorize(self, loginName, password):
|
||||
return self.talk('play', data=self.__makeLoginDict(loginName, password))
|
||||
|
||||
def createBilling(self, loginName, password, data):
|
||||
return self.talk('purchase', data=self.__makeLoginDict(loginName, password, data))
|
||||
|
||||
def setParentPassword(self, loginName, password, parentPassword):
|
||||
return self.talk('setParentPassword', data=self.__makeLoginDict(loginName, password, {'parentPassword': parentPassword}))
|
||||
|
||||
def supportsParentPassword(self):
|
||||
return 1
|
||||
|
||||
def authenticateParentPassword(self, loginName, password, parentPassword):
|
||||
try:
|
||||
errorMsg = self.talk('authenticateParentPassword', data=self.__makeLoginDict(loginName, parentPassword))
|
||||
if not errorMsg:
|
||||
return (1, None)
|
||||
if self.response.getInt('errorCode') in (5, 72):
|
||||
return (0, None)
|
||||
return (0, errorMsg)
|
||||
except TTAccountException, e:
|
||||
return (0, str(e))
|
||||
|
||||
return None
|
||||
|
||||
def supportsAuthenticateDelete(self):
|
||||
return 1
|
||||
|
||||
def authenticateDelete(self, loginName, password):
|
||||
try:
|
||||
errorMsg = self.talk('authenticateDelete', data=self.__makeLoginDict(loginName, password))
|
||||
if not errorMsg:
|
||||
return (1, None)
|
||||
if self.response.getInt('errorCode') in (5, 72):
|
||||
return (0, None)
|
||||
return (0, errorMsg)
|
||||
except TTAccountException, e:
|
||||
return (0, str(e))
|
||||
|
||||
return None
|
||||
|
||||
def enableSecretFriends(self, loginName, password, parentPassword, enable = 1):
|
||||
try:
|
||||
errorMsg = self.talk('setSecretChat', data=self.__makeLoginDict(loginName, parentPassword, {'chat': base.cr.secretChatAllowed,
|
||||
'secretsNeedParentPassword': base.cr.secretChatNeedsParentPassword}))
|
||||
if not errorMsg:
|
||||
return (1, None)
|
||||
if self.response.getInt('errorCode') in (5, 72):
|
||||
return (0, None)
|
||||
return (0, errorMsg)
|
||||
except TTAccountException, e:
|
||||
return (0, str(e))
|
||||
|
||||
return None
|
||||
|
||||
def changePassword(self, loginName, password, newPassword):
|
||||
return self.talk('purchase', data=self.__makeLoginDict(loginName, password, {'newPassword': newPassword}))
|
||||
|
||||
def requestPwdReminder(self, email = None, acctName = None):
|
||||
data = {}
|
||||
if email is not None:
|
||||
data['email'] = email
|
||||
else:
|
||||
data['accountName'] = acctName
|
||||
return self.talk('forgotPassword', data)
|
||||
|
||||
def cancelAccount(self, loginName, password):
|
||||
return self.talk('cancel', data=self.__makeLoginDict(loginName, password))
|
||||
|
||||
def getAccountData(self, loginName, password):
|
||||
errorMsg = self.talk('get', data=self.__makeLoginDict(loginName, password))
|
||||
if errorMsg:
|
||||
self.notify.warning('getAccountData error: %s' % errorMsg)
|
||||
return errorMsg
|
||||
if self.response.hasKey('errorMsg'):
|
||||
self.notify.warning("error field is: '%s'" % self.response.getString('errorMsg'))
|
||||
self.accountData = copy.deepcopy(self.response)
|
||||
fieldNameMap = {'em': 'email',
|
||||
'l1': 'addr1',
|
||||
'l2': 'addr2',
|
||||
'l3': 'addr3'}
|
||||
dict = self.accountData.dict
|
||||
for fieldName in dict.keys():
|
||||
if fieldName in fieldNameMap:
|
||||
dict[fieldNameMap[fieldName]] = dict[fieldName]
|
||||
del dict[fieldName]
|
||||
|
||||
return None
|
||||
|
||||
def getLastErrorMsg(self, forceCustServNum = 0):
|
||||
errCode = self.response.getInt('errorCode')
|
||||
if errCode < 100:
|
||||
msg = self.response.getString('errorMsg')
|
||||
if forceCustServNum:
|
||||
msg += ' ' + OTPLocalizer.TTAccountCustomerServiceHelp % self.cr.accountServerConstants.getString('customerServicePhoneNumber')
|
||||
elif errCode < 200:
|
||||
msg = self.response.getString('errorMsg')
|
||||
msg += ' ' + OTPLocalizer.TTAccountCustomerServiceHelp % self.cr.accountServerConstants.getString('customerServicePhoneNumber')
|
||||
elif errCode >= 500:
|
||||
msg = OTPLocalizer.TTAccountIntractibleError
|
||||
msg += ' ' + OTPLocalizer.TTAccountCallCustomerService % self.cr.accountServerConstants.getString('customerServicePhoneNumber')
|
||||
else:
|
||||
self.notify.warning('unknown error code class: %s: %s' % (self.response.getInt('errorCode'), self.response.getString('errorMsg')))
|
||||
msg = self.response.getString('errorMsg')
|
||||
msg += ' ' + OTPLocalizer.TTAccountCallCustomerService % self.cr.accountServerConstants.getString('customerServicePhoneNumber')
|
||||
return msg
|
||||
|
||||
def __makeLoginDict(self, loginName, password, data = None):
|
||||
dict = {'accountName': loginName,
|
||||
'password': password}
|
||||
if data:
|
||||
dict.update(data)
|
||||
return dict
|
||||
|
||||
def makeLoginDict(self, loginName, password, data = None):
|
||||
return self.__makeLoginDict(loginName, password, data)
|
||||
|
||||
def talk(self, operation, data = {}):
|
||||
self.notify.debug('TTAccount.talk()')
|
||||
for key in data.keys():
|
||||
data[key] = str(data[key])
|
||||
|
||||
if operation in ('play', 'get', 'cancel', 'authenticateParentPassword', 'authenticateDelete', 'authenticateParentPasswordNewStyle', 'authenticateDeleteNewStyle'):
|
||||
pass
|
||||
elif operation == 'authenticateParentUsernameAndPassword':
|
||||
pass
|
||||
elif operation == 'forgotPassword':
|
||||
pass
|
||||
elif operation == 'setParentPassword':
|
||||
pass
|
||||
elif operation == 'setSecretChat':
|
||||
pass
|
||||
elif operation == 'create':
|
||||
pass
|
||||
elif operation == 'purchase':
|
||||
if 'newPassword' in data:
|
||||
pass
|
||||
else:
|
||||
self.notify.error("Internal TTAccount error: need to add 'required data' checking for %s operation" % operation)
|
||||
op2Php = {'play': 'play',
|
||||
'get': 'get',
|
||||
'cancel': 'cancel',
|
||||
'create': 'create',
|
||||
'purchase': 'purchase',
|
||||
'setParentPassword': 'setSecrets',
|
||||
'authenticateParentPassword': 'authenticateChat',
|
||||
'authenticateDelete': 'authDelete',
|
||||
'setSecretChat': 'setChat',
|
||||
'forgotPassword': 'forgotPw',
|
||||
'authenticateParentPasswordNewStyle': 'api/authChat',
|
||||
'authenticateParentUsernameAndPassword': 'api/authParentChat',
|
||||
'authenticateDeleteNewStyle': 'api/authDelete'}
|
||||
newWebOperations = ('authenticateParentPasswordNewStyle', 'authenticateParentUsernameAndPassword', 'authenticateDeleteNewStyle')
|
||||
url = URLSpec(getAccountServer())
|
||||
if operation in newWebOperations:
|
||||
url.setPath('/%s' % op2Php[operation])
|
||||
else:
|
||||
url.setPath('/%s.php' % op2Php[operation])
|
||||
body = ''
|
||||
if 'accountName' in data:
|
||||
if operation not in newWebOperations:
|
||||
url.setQuery('n=%s' % URLSpec.quote(data['accountName']))
|
||||
serverFields = {'accountName': 'n',
|
||||
'password': 'p',
|
||||
'parentPassword': 'sp',
|
||||
'newPassword': 'np',
|
||||
'chat': 'chat',
|
||||
'email': 'em',
|
||||
'dobYear': 'doby',
|
||||
'dobMonth': 'dobm',
|
||||
'dobDay': 'dobd',
|
||||
'ccNumber': 'ccn',
|
||||
'ccMonth': 'ccm',
|
||||
'ccYear': 'ccy',
|
||||
'nameOnCard': 'noc',
|
||||
'addr1': 'l1',
|
||||
'addr2': 'l2',
|
||||
'addr3': 'l3',
|
||||
'city': 'city',
|
||||
'state': 'state',
|
||||
'country': 'country',
|
||||
'zip': 'zip',
|
||||
'referrer': 'ref',
|
||||
'secretsNeedParentPassword': 'secretsNeedsParentPassword',
|
||||
'parentPasswordNewStyle': 'pp',
|
||||
'parentUsername': 'pu',
|
||||
'userid': 'userid'}
|
||||
ignoredFields = ('ccType',)
|
||||
outBoundFields = {}
|
||||
for fieldName in data.keys():
|
||||
if fieldName not in serverFields:
|
||||
if fieldName not in ignoredFields:
|
||||
self.notify.error('unknown data field: %s' % fieldName)
|
||||
else:
|
||||
outBoundFields[serverFields[fieldName]] = data[fieldName]
|
||||
|
||||
orderedFields = outBoundFields.keys()
|
||||
orderedFields.sort()
|
||||
for fieldName in orderedFields:
|
||||
if len(body):
|
||||
body += '&'
|
||||
body += '%s=%s' % (fieldName, URLSpec.quotePlus(outBoundFields[fieldName]))
|
||||
|
||||
self.notify.debug('url=' + url.cStr())
|
||||
self.notify.debug('body=' + body)
|
||||
if operation in ('get',):
|
||||
expectedHeader = 'ACCOUNT INFO'
|
||||
elif operation in ('play', 'cancel', 'create', 'purchase', 'setParentPassword', 'setSecretChat', 'authenticateParentPassword', 'authenticateDelete', 'forgotPassword', 'authenticateParentPasswordNewStyle', 'authenticateParentUsernameAndPassword', 'authenticateDeleteNewStyle'):
|
||||
expectedHeader = 'ACCOUNT SERVER RESPONSE'
|
||||
else:
|
||||
self.notify.error("Internal TTAccount error: need to set expected response header for '%s' operation" % operation)
|
||||
self.response = RemoteValueSet.RemoteValueSet(url, self.cr.http, body=body, expectedHeader=expectedHeader)
|
||||
self.notify.debug(' self.response=' + str(self.response))
|
||||
if self.response.hasKey('errorCode'):
|
||||
errorCode = self.response.getInt('errorCode')
|
||||
self.notify.info('account server error code: %s' % errorCode)
|
||||
if errorCode == 10:
|
||||
self.cr.freeTimeExpiresAt = 0
|
||||
if self.response.hasKey('errorMsg'):
|
||||
return self.getLastErrorMsg()
|
||||
if operation in ('get', 'forgotPassword', 'authenticateDelete', 'play', 'cancel', 'create', 'purchase', 'setParentPassword', 'authenticateParentPassword', 'authenticateParentPasswordNewStyle', 'authenticateParentUsernameAndPassword', 'authenticateDeleteNewStyle'):
|
||||
pass
|
||||
elif operation == 'setSecretChat':
|
||||
self.playToken = self.response.getString('playToken')
|
||||
self.playTokenIsEncrypted = 1
|
||||
else:
|
||||
self.notify.error('Internal TTAccount error: need to extract useful data for %s operation' % operation)
|
||||
return None
|
||||
|
||||
def authenticateParentUsernameAndPassword(self, loginName, password, parentUsername, parentPassword):
|
||||
try:
|
||||
errorMsg = self.talk('authenticateParentUsernameAndPassword', data=self.__makeLoginDict(loginName, password, {'parentUsername': parentUsername,
|
||||
'parentPasswordNewStyle': parentPassword,
|
||||
'userid': loginName}))
|
||||
if not errorMsg:
|
||||
return (1, None)
|
||||
if self.response.getInt('errorCode') in (5, 72):
|
||||
return (0, None)
|
||||
return (0, errorMsg)
|
||||
except TTAccountException, e:
|
||||
return (0, str(e))
|
||||
|
||||
return None
|
|
@ -220,11 +220,6 @@ ToonForwardSlowSpeed = 6.0
|
|||
ToonJumpSlowForce = 4.0
|
||||
ToonReverseSlowSpeed = 2.5
|
||||
ToonRotateSlowSpeed = 33.0
|
||||
MickeySpeed = 5.0
|
||||
MinnieSpeed = 3.2
|
||||
DonaldSpeed = 3.68
|
||||
GoofySpeed = 5.2
|
||||
PlutoSpeed = 5.5
|
||||
ThinkPosHotkey = 'shift-f1'
|
||||
PlaceMarkerHotkey = 'f2'
|
||||
FriendsListHotkey = 'f7'
|
||||
|
@ -337,17 +332,6 @@ 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.'
|
||||
CopyrightedNames = ('mickey',
|
||||
'mickey mouse',
|
||||
'mickeymouse',
|
||||
'minnie',
|
||||
'minnie mouse',
|
||||
'minniemouse',
|
||||
'donald',
|
||||
'donald duck',
|
||||
'donaldduck',
|
||||
'pluto',
|
||||
'goofy')
|
||||
GuildUpdateMembersEvent = 'guildUpdateMembersEvent'
|
||||
GuildInvitationEvent = 'guildInvitationEvent'
|
||||
GuildAcceptInviteEvent = 'guildAcceptInviteEvent'
|
||||
|
|
|
@ -118,25 +118,6 @@ ActivateChat = "True Friends allows one member to chat with another member only
|
|||
ActivateChatYes = 'Update'
|
||||
ActivateChatNo = lCancel
|
||||
ActivateChatMoreInfo = 'More Info'
|
||||
ActivateChatPrivacyPolicy = 'Privacy Policy'
|
||||
ActivateChatPrivacyPolicy_Button1A = 'Version 1'
|
||||
ActivateChatPrivacyPolicy_Button1K = 'Version 1'
|
||||
ActivateChatPrivacyPolicy_Button2A = 'Version 2'
|
||||
ActivateChatPrivacyPolicy_Button2K = 'Version 2'
|
||||
PrivacyPolicyText_1A = [' ']
|
||||
PrivacyPolicyText_1K = [' ']
|
||||
PrivacyPolicyText_2A = [' ']
|
||||
PrivacyPolicyText_2K = [' ']
|
||||
PrivacyPolicyText_Intro = [' ']
|
||||
PrivacyPolicyClose = lClose
|
||||
SecretFriendsInfoPanelOk = lOK
|
||||
SecretFriendsInfoPanelClose = lClose
|
||||
SecretFriendsInfoPanelText = ['\nThe Open Chat with True Friends Feature\n\nThe Open Chat with True Friends feature enables a member to chat directly with another member within Toontown United (the "Service") once the members establish a True Friends connection. When your child attempts to use the Open Chat with True Friends feature, we will require that you indicate your consent to your child\'s use of this feature by entering your Parent Account Password. Here is a detailed description of the process of creating an Open Chat with True Friends connection between members whom we will call "Sally" and "Mike."\n1. Sally\'s parent and Mike\'s parent each enable the Open Chat with True Friends feature by entering their respective Parent Account Passwords either (a) in the Account Options areas within the Service, or (b) when prompted within the game by a Parental Controls pop-up.\n2. Sally requests a True Friend Code (described below) from within the Service.\n',
|
||||
"\n3. Sally's True Friend Code is communicated to Mike outside of the Service. (Sally's True Friend Code may be communicated to Mike either directly by Sally, or indirectly through Sally's disclosure of the True Friend Code to another person.)\n4. Mike submits Sally's True Friend Code to the Service within 48 hours of the time that Sally requested the True Friend Code from the Service.\n5. The Service then notifies Mike that Sally has become Mike's True Friend. The Service similarly notifies Sally that Mike has become Sally's True Friend.\n6. Sally and Mike can now open chat directly with each other until either one chooses to terminate the other as a True Friend, or until the Open Chat with True Friends feature is disabled for either Sally or Mike by their respective parent. The True Friends connection can thus be disabled anytime by either: (a) a member removing the True Friend from his or her friends list (as described in the Service); or, (b) the parent of that member disabling the Open Chat with ",
|
||||
"\nTrue Friends feature by going to the Account Options area within the Service and following the steps set forth there.\n\nA True Friend Code is a computer-generated random code assigned to a particular member. The True Friend Code must be used to activate a True Friend connection within 48 hours of the time that the member requests the True Friend Code; otherwise, the True Friend Code expires and cannot be used. Moreover, a single True Friend Code can only be used to establish one True Friend connection. To make additional True Friend connections, a member must request an additional True Friend Code for each additional True Friend.\n\nTrue Friendships do not transfer. For example, if Sally becomes a True Friend of Mike, and Mike becomes a True Friend of Jessica, Sally does not automatically become Jessica's True Friend. In order for Sally and Jessica to\n",
|
||||
'\nbecome True Friends, one of them must request a new True Friend Code from the Service and communicate it to the other.\n\nTrue Friends communicate with one another in a free-form interactive open chat. The content of this chat is directly entered by the participating member and is processed through the Service, which is monitored by the Toontown United team. While we advise members not to exchange personal information such as first and last names, e-mail addresses, postal addresses, or phone numbers while using Open Chat with True Friends, we cannot guarantee that such exchanges of personal information will not happen. Although the True Friends chat is automatically filtered for most bad words, Open Chat with True Friends may be moderated, and we reserve the right to moderate any part of the Service that we,\n',
|
||||
"\nin our sole and absolute discretion, deems necessary. However, because Open Chat with True Friends will not always be moderated, if the Parent Account allows a child to use his or her account with the Open Chat with True Friends feature enabled, we strongly encourage parents to supervise their child or children while they play in the Service. By enabling the Open Chat with True Friends feature, the Parent Account acknowledges that there are some risks inherent in the Open Chat with True Friends feature and that the Parent Account has been informed of, and agrees to accept, any such risks, whether foreseeable or otherwise. \n\nWDIG does not use the content of True Friends chat for any purpose other than communicating that content to the member's true friend, and does not disclose that content to any third party except: (1) if required by law, for example, to comply with a court order or subpoena; (2) to enforce the Terms of Use\n",
|
||||
"\napplicable to the Service (which may be accessed on the home page of the Service); or, (3) to protect the safety and security of Members of the Service and the Service itself. In accordance with the Children's Online Privacy Protection Act, we are prohibited from conditioning, and do not condition, a child's participation in any activity (including Open Chat with True Friends) on the child's disclosing more personal information than is reasonably necessary to participate in such activity.\n\nIn addition, as noted above, we recognize the right of a parent to refuse to permit us to continue to allow a child to use the True Friends feature. By enabling the Open Chat with True Friends feature, you acknowledge that there are some risks inherent in the ability of members to open chat with one another through the Open Chat with True Friends feature, and that you have been informed of, and agree to accept, any such risks, whether foreseeable or otherwise.\n"]
|
||||
LeaveToSetParentPassword = 'In order to set parent account password, the game will exit to the Toontown website.'
|
||||
LeaveToSetParentPasswordYes = 'Set Password'
|
||||
LeaveToSetParentPasswordNo = lCancel
|
||||
|
@ -151,24 +132,6 @@ SecretChatActivatedOK = lOK
|
|||
SecretChatActivatedChange = 'Change Options'
|
||||
ProblemActivatingChat = 'Oops! We were unable to activate the "True Friends" chat feature.\n\n%s\n\nPlease try again later.'
|
||||
ProblemActivatingChatOK = lOK
|
||||
MultiPageTextFrameNext = lNext
|
||||
MultiPageTextFramePrev = 'Previous'
|
||||
MultiPageTextFramePage = 'Page %s/%s'
|
||||
GuiScreenToontownUnavailable = 'The server appears to be temporarily unavailable, still trying...'
|
||||
GuiScreenCancel = lCancel
|
||||
CreateAccountScreenUserName = 'Account Name'
|
||||
CreateAccountScreenPassword = 'Password'
|
||||
CreateAccountScreenConfirmPassword = 'Confirm Password'
|
||||
CreateAccountScreenCancel = lCancel
|
||||
CreateAccountScreenSubmit = 'Submit'
|
||||
CreateAccountScreenConnectionErrorSuffix = '.\n\nPlease try again later.'
|
||||
CreateAccountScreenNoAccountName = 'Please enter an account name.'
|
||||
CreateAccountScreenAccountNameTooShort = 'Your account name must be at least %s characters long. Please try again.'
|
||||
CreateAccountScreenPasswordTooShort = 'Your password must be at least %s characters long. Please try again.'
|
||||
CreateAccountScreenPasswordMismatch = 'The passwords you typed did not match. Please try again.'
|
||||
CreateAccountScreenUserNameTaken = 'That user name is already taken. Please try again.'
|
||||
CreateAccountScreenInvalidUserName = 'Invalid user name.\nPlease try again.'
|
||||
CreateAccountScreenUserNameNotFound = 'User name not found.\nPlease try again or create a new account.'
|
||||
CRConnecting = 'Connecting...'
|
||||
CRNoConnectTryAgain = 'Could not connect to %s:%s. Try again?'
|
||||
CRNoConnectProxyNoPort = 'Could not connect to %s:%s.\n\nYou are communicating to the internet via a proxy, but your proxy does not permit connections on port %s.\n\nYou must open up this port, or disable your proxy, in order to play. If your proxy has been provided by your ISP, you must contact your ISP to request them to open up this port.'
|
||||
|
@ -209,7 +172,6 @@ CREnteringToontown = 'Entering...'
|
|||
LoginScreenUserName = 'Account Name'
|
||||
LoginScreenPassword = 'Password'
|
||||
LoginScreenLogin = 'Login'
|
||||
LoginScreenCreateAccount = 'Create Account'
|
||||
LoginScreenQuit = lQuit
|
||||
LoginScreenLoginPrompt = 'Please enter a user name and password.'
|
||||
LoginScreenBadPassword = 'Bad password.\nPlease try again.'
|
||||
|
@ -2807,17 +2769,6 @@ 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.'
|
||||
CopyrightedNames = ('mickey',
|
||||
'mickey mouse',
|
||||
'mickeymouse',
|
||||
'minnie',
|
||||
'minnie mouse',
|
||||
'minniemouse',
|
||||
'donald',
|
||||
'donald duck',
|
||||
'donaldduck',
|
||||
'pluto',
|
||||
'goofy')
|
||||
NCTooShort = 'That name is too short.'
|
||||
NCNoDigits = 'Your name cannot contain numbers.'
|
||||
NCNeedLetters = 'Each word in your name must contain some letters.'
|
||||
|
@ -2896,9 +2847,6 @@ WhiteListMenu = [-1, 'WHITELIST']
|
|||
SellbotInvasionMenuSections = [-1]
|
||||
SellbotFieldOfficeMenuSections = [-1, 'STRATEGY']
|
||||
IdesOfMarchMenuSections = [-1]
|
||||
TTAccountCallCustomerService = 'Please call Customer Service at %s.'
|
||||
TTAccountCustomerServiceHelp = '\nIf you need help, please call Customer Service at %s.'
|
||||
TTAccountIntractibleError = 'An error occurred.'
|
||||
|
||||
def timeElapsedString(timeDelta):
|
||||
timeDelta = abs(timeDelta)
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
from pandac.PandaModules import Vec4
|
||||
from direct.gui.DirectGui import DirectFrame, DGG
|
||||
from direct.task import Task
|
||||
from direct.showbase.PythonUtil import bound
|
||||
from otp.otpbase import OTPGlobals
|
||||
|
||||
class OTPTimer(DirectFrame):
|
||||
ClockImage = None
|
||||
TimerId = 0
|
||||
|
||||
def __init__(self, useImage = True, highlightNearEnd = True):
|
||||
if useImage:
|
||||
image = self.getImage()
|
||||
else:
|
||||
image = None
|
||||
DirectFrame.__init__(self, state=DGG.DISABLED, relief=None, scale=0.45, image=image, image_pos=(0, 0, 0), text='0', text_fg=(0, 0, 0, 1), text_font=OTPGlobals.getInterfaceFont(), text_pos=(-0.01, -0.15), text_scale=0.35)
|
||||
self.initialiseoptions(OTPTimer)
|
||||
self.timerId = OTPTimer.TimerId
|
||||
OTPTimer.TimerId += 1
|
||||
self.highlightNearEnd = highlightNearEnd
|
||||
self.countdownTask = None
|
||||
self.currentTime = 0
|
||||
self.taskTime = 0.0
|
||||
self.setFontColor(Vec4(0, 0, 0, 1))
|
||||
return
|
||||
|
||||
def setFontColor(self, vColor):
|
||||
self.vFontColor = vColor
|
||||
|
||||
def getImage(self):
|
||||
if OTPTimer.ClockImage == None:
|
||||
model = loader.loadModel('phase_3.5/models/gui/clock_gui')
|
||||
OTPTimer.ClockImage = model.find('**/alarm_clock')
|
||||
model.removeNode()
|
||||
return OTPTimer.ClockImage
|
||||
|
||||
def posInTopRightCorner(self):
|
||||
self.reparentTo(base.a2dTopRight)
|
||||
self.setPos(-0.173, 0, -0.17)
|
||||
|
||||
def posBelowTopRightCorner(self):
|
||||
self.reparentTo(base.a2dTopRight)
|
||||
self.setPos(-0.173, 0, -0.42)
|
||||
|
||||
def posAboveShtikerBook(self):
|
||||
self.reparentTo(base.a2dBottomRight)
|
||||
self.setPos(-0.173, 0, 0.37)
|
||||
|
||||
def setTime(self, time):
|
||||
time = bound(time, 0, 999)
|
||||
if time == self.currentTime:
|
||||
return
|
||||
self.currentTime = time
|
||||
timeStr = str(time)
|
||||
timeStrLen = len(timeStr)
|
||||
if timeStrLen == 1:
|
||||
if time <= 5 and self.highlightNearEnd:
|
||||
self.setTimeStr(timeStr, 0.34, (-0.025, -0.125), Vec4(1, 0, 0, 1))
|
||||
else:
|
||||
self.setTimeStr(timeStr, 0.34, (-0.025, -0.125))
|
||||
elif timeStrLen == 2:
|
||||
self.setTimeStr(timeStr, 0.27, (-0.025, -0.1))
|
||||
elif timeStrLen == 3:
|
||||
self.setTimeStr(timeStr, 0.2, (-0.01, -0.08))
|
||||
|
||||
def setTimeStr(self, timeStr, scale = 0.2, pos = (-0.01, -0.08), fg = None):
|
||||
self['text'] = ''
|
||||
self['text_fg'] = fg or self.vFontColor
|
||||
self['text_scale'] = scale
|
||||
self['text_pos'] = pos
|
||||
self['text'] = timeStr
|
||||
|
||||
def getElapsedTime(self):
|
||||
return self.taskTime
|
||||
|
||||
def _timerTask(self, task):
|
||||
countdownTime = int(task.duration - task.time)
|
||||
self.setTime(countdownTime)
|
||||
self.taskTime = task.time
|
||||
if task.time >= task.duration:
|
||||
self.timerExpired()
|
||||
if task.callback:
|
||||
task.callback()
|
||||
return Task.done
|
||||
else:
|
||||
return Task.cont
|
||||
|
||||
def countdown(self, duration, callback = None):
|
||||
self.countdownTask = Task.Task(self._timerTask)
|
||||
self.countdownTask.duration = duration
|
||||
self.countdownTask.callback = callback
|
||||
taskMgr.remove('timerTask%s' % self.timerId)
|
||||
return taskMgr.add(self.countdownTask, 'timerTask%s' % self.timerId)
|
||||
|
||||
def timerExpired(self):
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
if self.countdownTask:
|
||||
taskMgr.remove(self.countdownTask)
|
||||
|
||||
def reset(self):
|
||||
self.stop()
|
||||
self.setTime(0)
|
||||
taskMgr.remove('timerTask%s' % self.timerId)
|
||||
self.taskTime = 0.0
|
||||
|
||||
def destroy(self):
|
||||
self.reset()
|
||||
self.countdownTask = None
|
||||
DirectFrame.destroy(self)
|
||||
return
|
||||
|
||||
def cleanup(self):
|
||||
self.destroy()
|
||||
self.notify.warning('Call destroy, not cleanup')
|
|
@ -769,7 +769,7 @@ class BattleCalculatorAI:
|
|||
return
|
||||
tgts = self.__createToonTargetList(toonId)
|
||||
for currTgt in tgts:
|
||||
tgtPos = self.battle.suits.index(currTgt)
|
||||
tgtPos = self.battle.activeSuits.index(currTgt)
|
||||
attackerId = self.toonAtkOrder[attackIndex]
|
||||
attack = self.battle.toonAttacks[attackerId]
|
||||
track = self.__getActualTrack(attack)
|
||||
|
|
|
@ -76,7 +76,6 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
|||
self.numNPCAttacks = 0
|
||||
self.npcAttacks = {}
|
||||
self.pets = {}
|
||||
self.fireCount = 0
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedBattleAI', [State.State('FaceOff', self.enterFaceOff, self.exitFaceOff, ['WaitForInput', 'Resume']),
|
||||
State.State('WaitForJoin', self.enterWaitForJoin, self.exitWaitForJoin, ['WaitForInput', 'Resume']),
|
||||
State.State('WaitForInput', self.enterWaitForInput, self.exitWaitForInput, ['MakeMovie', 'Resume']),
|
||||
|
@ -1051,13 +1050,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
|||
elif track == PASS:
|
||||
self.toonAttacks[toonId] = getToonAttack(toonId, track=PASS)
|
||||
elif track == FIRE:
|
||||
if simbase.air.doId2do[toonId].getPinkSlips() < self.getFireCount() + 1:
|
||||
#Not allowed to fire, force them to pass >:D
|
||||
self.toonAttacks[toonId] = getToonAttack(toonId, track=PASS)
|
||||
else:
|
||||
#Allowed to fire
|
||||
self.setFireCount(self.fireCount + 1)
|
||||
self.toonAttacks[toonId] = getToonAttack(toonId, track=FIRE, target=av)
|
||||
self.toonAttacks[toonId] = getToonAttack(toonId, track=FIRE, target=av)
|
||||
else:
|
||||
if not self.validate(toonId, track >= 0 and track <= MAX_TRACK_INDEX, 'requestAttack: invalid track %s' % track):
|
||||
return
|
||||
|
@ -1104,25 +1097,65 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
|||
petId = toon.getPetId()
|
||||
zoneId = self.zoneId
|
||||
if petId == av:
|
||||
if toonId not in self.pets:
|
||||
|
||||
def handleGetPetProxy(success, petProxy, petId = petId, zoneId = zoneId, toonId = toonId):
|
||||
if not toonId in self.pets:
|
||||
def handleGetPetProxy(success, pet, petId = petId, zoneId = zoneId, toonId = toonId):
|
||||
if success:
|
||||
if petId not in simbase.air.doId2do:
|
||||
simbase.air.requestDeleteDoId(petId)
|
||||
else:
|
||||
petDO = simbase.air.doId2do[petId]
|
||||
petDO.requestDelete()
|
||||
simbase.air.deleteDistObject(petDO)
|
||||
petProxy.dbObject = 1
|
||||
petProxy.generateWithRequiredAndId(petId, self.air.districtId, zoneId)
|
||||
petProxy.broadcastDominantMood()
|
||||
self.pets[toonId] = petProxy
|
||||
petProxy = DistributedPetProxyAI.DistributedPetProxyAI(self.air)
|
||||
petProxy.setOwnerId(pet.getOwnerId())
|
||||
petProxy.setPetName(pet.getPetName())
|
||||
petProxy.setTraitSeed(pet.getTraitSeed())
|
||||
petProxy.setSafeZone(pet.getSafeZone())
|
||||
petProxy.setForgetfulness(pet.getForgetfulness())
|
||||
petProxy.setBoredomThreshold(pet.getBoredomThreshold())
|
||||
petProxy.setRestlessnessThreshold(pet.getRestlessnessThreshold())
|
||||
petProxy.setPlayfulnessThreshold(pet.getPlayfulnessThreshold())
|
||||
petProxy.setLonelinessThreshold(pet.getLonelinessThreshold())
|
||||
petProxy.setSadnessThreshold(pet.getSadnessThreshold())
|
||||
petProxy.setFatigueThreshold(pet.getFatigueThreshold())
|
||||
petProxy.setHungerThreshold(pet.getHungerThreshold())
|
||||
petProxy.setConfusionThreshold(pet.getConfusionThreshold())
|
||||
petProxy.setExcitementThreshold(pet.getExcitementThreshold())
|
||||
petProxy.setAngerThreshold(pet.getAngerThreshold())
|
||||
petProxy.setSurpriseThreshold(pet.getSurpriseThreshold())
|
||||
petProxy.setAffectionThreshold(pet.getAffectionThreshold())
|
||||
petProxy.setHead(pet.getHead())
|
||||
petProxy.setEars(pet.getEars())
|
||||
petProxy.setNose(pet.getNose())
|
||||
petProxy.setTail(pet.getTail())
|
||||
petProxy.setBodyTexture(pet.getBodyTexture())
|
||||
petProxy.setColor(pet.getColor())
|
||||
petProxy.setColorScale(pet.getColorScale())
|
||||
petProxy.setEyeColor(pet.getEyeColor())
|
||||
petProxy.setGender(pet.getGender())
|
||||
petProxy.setLastSeenTimestamp(pet.getLastSeenTimestamp())
|
||||
petProxy.setBoredom(pet.getBoredom())
|
||||
petProxy.setRestlessness(pet.getRestlessness())
|
||||
petProxy.setPlayfulness(pet.getPlayfulness())
|
||||
petProxy.setLoneliness(pet.getLoneliness())
|
||||
petProxy.setSadness(pet.getSadness())
|
||||
petProxy.setAffection(pet.getAffection())
|
||||
petProxy.setHunger(pet.getHunger())
|
||||
petProxy.setConfusion(pet.getConfusion())
|
||||
petProxy.setExcitement(pet.getExcitement())
|
||||
petProxy.setFatigue(pet.getFatigue())
|
||||
petProxy.setAnger(pet.getAnger())
|
||||
petProxy.setSurprise(pet.getSurprise())
|
||||
pet.requestDelete()
|
||||
def deleted(task):
|
||||
petProxy.dbObject = 1
|
||||
petProxy.generateWithRequiredAndId(petId, self.air.districtId, self.zoneId)
|
||||
petProxy.broadcastDominantMood()
|
||||
self.pets[toonId] = petProxy
|
||||
return task.done
|
||||
|
||||
self.acceptOnce(self.air.getAvatarExitEvent(petId),
|
||||
lambda: taskMgr.doMethodLater(0,
|
||||
deleted, self.uniqueName('petdel-%d' % petId)))
|
||||
|
||||
else:
|
||||
self.notify.warning('error generating petProxy: %s' % petId)
|
||||
|
||||
self.getPetProxyObject(petId, handleGetPetProxy)
|
||||
return
|
||||
|
||||
def suitCanJoin(self):
|
||||
return len(self.suits) < self.maxSuits and self.isJoinable()
|
||||
|
@ -1621,7 +1654,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
|||
deadToons.append(activeToon)
|
||||
self.notify.debug('AFTER ROUND: toon: %d setHp: %d' % (toon.doId, toon.hp))
|
||||
if toon.unlimitedGags:
|
||||
toon.doRestock(noUber=0, noPaid=0)
|
||||
toon.doRestock(noUber=0)
|
||||
|
||||
for deadToon in deadToons:
|
||||
self.__removeToon(deadToon)
|
||||
|
@ -1809,18 +1842,12 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
|||
return None
|
||||
|
||||
def getPetProxyObject(self, petId, callback):
|
||||
doneEvent = 'readPet-%s' % self._getNextSerialNum()
|
||||
dbo = DatabaseObject.DatabaseObject(self.air, petId, doneEvent=doneEvent)
|
||||
pet = dbo.readPetProxy()
|
||||
doneEvent = 'generate-%d' % petId
|
||||
|
||||
def handlePetProxyRead(dbo, retCode, callback = callback, pet = pet):
|
||||
success = retCode == 0
|
||||
if not success:
|
||||
self.notify.warning('pet DB read failed')
|
||||
pet = None
|
||||
callback(success, pet)
|
||||
return
|
||||
def handlePetProxyRead(pet):
|
||||
callback(1, pet)
|
||||
|
||||
self.air.sendActivate(petId, self.air.districtId, 0)
|
||||
self.acceptOnce(doneEvent, handlePetProxyRead)
|
||||
|
||||
def _getNextSerialNum(self):
|
||||
|
@ -1828,13 +1855,8 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
|||
self.serialNum += 1
|
||||
return num
|
||||
|
||||
def setFireCount(self, amount):
|
||||
self.fireCount = amount
|
||||
|
||||
def getFireCount(self):
|
||||
return self.fireCount
|
||||
|
||||
@magicWord(category=CATEGORY_PROGRAMMER)
|
||||
@magicWord(category=CATEGORY_MODERATOR)
|
||||
def skipMovie():
|
||||
invoker = spellbook.getInvoker()
|
||||
battleId = invoker.getBattleId()
|
||||
|
|
|
@ -411,7 +411,7 @@ def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target,
|
|||
suitTrack.append(suitGettingHit)
|
||||
bonusTrack = None
|
||||
if hpbonus > 0:
|
||||
bonusTrack = Sequence(Wait(delay + tObjectAppears + 0.75), Func(suit.showHpText, -hpbonus, 1, openEnded=0))
|
||||
bonusTrack = Sequence(Wait(delay + tObjectAppears + 0.75), Func(suit.showHpText, -hpbonus, 1, openEnded=0), Func(suit.updateHealthBar, hpbonus))
|
||||
if revived != 0:
|
||||
suitTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle, npcs))
|
||||
elif died != 0:
|
||||
|
|
|
@ -101,18 +101,10 @@ def teleportIn(attack, npc, pos = Point3(0, 0, 0), hpr = Vec3(180.0, 0.0, 0.0)):
|
|||
d = Func(npc.pose, 'teleport', npc.getNumFrames('teleport') - 1)
|
||||
e = npc.getTeleportInTrack()
|
||||
ee = Func(npc.addActive)
|
||||
if npc.getName() == 'Trap Cat':
|
||||
f = Func(npc.setChatAbsolute, 'We are team trap! Fear me %s' % attack['toon'].getName() + ' for I am the Notorious T-Cat', CFSpeech | CFTimeout)
|
||||
else:
|
||||
f = Func(npc.setChatAbsolute, TTLocalizer.MovieNPCSOSGreeting % attack['toon'].getName(), CFSpeech | CFTimeout)
|
||||
if npc.getName() == 'Trap Cat':
|
||||
g = ActorInterval(npc, 'angry')
|
||||
else:
|
||||
g = ActorInterval(npc, 'wave')
|
||||
f = Func(npc.setChatAbsolute, TTLocalizer.MovieNPCSOSGreeting % attack['toon'].getName(), CFSpeech | CFTimeout)
|
||||
g = ActorInterval(npc, 'wave')
|
||||
h = Func(npc.loop, 'neutral')
|
||||
seq = Sequence(a, b, c, d, e, ee, f, g, h)
|
||||
if npc.getName() == 'Trap Cat':
|
||||
seq.append(Wait(3))
|
||||
seq.append(Func(npc.clearChat))
|
||||
if npc.getName() == 'Magic Cat':
|
||||
magicCatTrack = Sequence()
|
||||
|
@ -123,32 +115,18 @@ def teleportIn(attack, npc, pos = Point3(0, 0, 0), hpr = Vec3(180.0, 0.0, 0.0)):
|
|||
|
||||
|
||||
def teleportOut(attack, npc):
|
||||
if npc.getName() == 'Trap Cat':
|
||||
a = ActorInterval(npc, 'neutral')
|
||||
if npc.style.getGender() == 'm':
|
||||
a = ActorInterval(npc, 'bow')
|
||||
else:
|
||||
if npc.style.getGender() == 'm':
|
||||
a = ActorInterval(npc, 'bow')
|
||||
else:
|
||||
a = ActorInterval(npc, 'curtsy')
|
||||
if npc.getName() == 'Trap Cat':
|
||||
b = Func(npc.setChatAbsolute, 'Drat, my hacks failed... Oh well, I will just disconnect you all!', CFSpeech | CFTimeout)
|
||||
else:
|
||||
b = Func(npc.setChatAbsolute, TTLocalizer.MovieNPCSOSGoodbye, CFSpeech | CFTimeout)
|
||||
if npc.getName() == 'Trap Cat':
|
||||
c = Func(npc.loop, 'neutral')
|
||||
else:
|
||||
c = npc.getTeleportOutTrack()
|
||||
a = ActorInterval(npc, 'curtsy')
|
||||
b = Func(npc.setChatAbsolute, TTLocalizer.MovieNPCSOSGoodbye, CFSpeech | CFTimeout)
|
||||
c = npc.getTeleportOutTrack()
|
||||
seq = Sequence(a, b, c)
|
||||
if npc.getName() == 'Trap Cat':
|
||||
seq.append(Wait(3))
|
||||
seq.append(Func(npc.removeActive))
|
||||
seq.append(Func(npc.detachNode))
|
||||
seq.append(Func(npc.delete))
|
||||
if npc.getName() == 'Trap Cat':
|
||||
seq.append(Wait(3))
|
||||
return seq
|
||||
|
||||
|
||||
def __getPartTrack(particleEffect, startDelay, durationDelay, partExtraArgs):
|
||||
pEffect = partExtraArgs[0]
|
||||
parent = partExtraArgs[1]
|
||||
|
|
|
@ -102,7 +102,7 @@ def __getSuitTrack(sound, lastSoundThatHit, delay, hitCount, targets, totalDamag
|
|||
suitTrack.append(Func(battle.unlureSuit, suit))
|
||||
bonusTrack = None
|
||||
if hpbonus > 0:
|
||||
bonusTrack = Sequence(Wait(delay + tSuitReact + delay + 0.75 + uberDelay), Func(suit.showHpText, -hpbonus, 1, openEnded=0))
|
||||
bonusTrack = Sequence(Wait(delay + tSuitReact + delay + 0.75 + uberDelay), Func(suit.showHpText, -hpbonus, 1, openEnded=0), Func(suit.updateHealthBar, hpbonus))
|
||||
suitTrack.append(Func(suit.loop, 'neutral'))
|
||||
if bonusTrack == None:
|
||||
tracks.append(suitTrack)
|
||||
|
|
|
@ -206,9 +206,11 @@ def __getSuitTrack(suit, tContact, tDodge, hp, hpbonus, kbbonus, anim, died, lef
|
|||
if kbbonus > 0:
|
||||
bonusTrack.append(Wait(0.75))
|
||||
bonusTrack.append(Func(suit.showHpText, -kbbonus, 2, openEnded=0, attackTrack=SQUIRT_TRACK))
|
||||
bonusTrack.append(Func(suit.updateHealthBar, kbbonus))
|
||||
if hpbonus > 0:
|
||||
bonusTrack.append(Wait(0.75))
|
||||
bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0, attackTrack=SQUIRT_TRACK))
|
||||
bonusTrack.append(Func(suit.updateHealthBar, hpbonus))
|
||||
if died != 0:
|
||||
suitTrack.append(MovieUtil.createSuitDeathTrack(suit, toon, battle))
|
||||
else:
|
||||
|
|
|
@ -367,9 +367,11 @@ def __throwPie(throw, delay, hitCount):
|
|||
if kbbonus > 0:
|
||||
bonusTrack.append(Wait(0.75))
|
||||
bonusTrack.append(Func(suit.showHpText, -kbbonus, 2, openEnded=0, attackTrack=THROW_TRACK))
|
||||
bonusTrack.append(Func(suit.updateHealthBar, kbbonus))
|
||||
if hpbonus > 0:
|
||||
bonusTrack.append(Wait(0.75))
|
||||
bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0, attackTrack=THROW_TRACK))
|
||||
bonusTrack.append(Func(suit.updateHealthBar, hpbonus))
|
||||
if revived != 0:
|
||||
suitResponseTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle))
|
||||
elif died != 0:
|
||||
|
@ -563,9 +565,11 @@ def __throwGroupPie(throw, delay, groupHitDict):
|
|||
if kbbonus > 0:
|
||||
bonusTrack.append(Wait(0.75))
|
||||
bonusTrack.append(Func(suit.showHpText, -kbbonus, 2, openEnded=0, attackTrack=THROW_TRACK))
|
||||
bonusTrack.append(Func(suit.updateHealthBar, kbbonus))
|
||||
if hpbonus > 0:
|
||||
bonusTrack.append(Wait(0.75))
|
||||
bonusTrack.append(Func(suit.showHpText, -hpbonus, 1, openEnded=0, attackTrack=THROW_TRACK))
|
||||
bonusTrack.append(Func(suit.updateHealthBar, hpbonus))
|
||||
if revived != 0:
|
||||
singleSuitResponseTrack.append(MovieUtil.createSuitReviveTrack(suit, toon, battle))
|
||||
elif died != 0:
|
||||
|
|
|
@ -10,7 +10,6 @@ from direct.distributed import DistributedObject
|
|||
import random
|
||||
import ToonInteriorColors
|
||||
from toontown.hood import ZoneUtil
|
||||
from toontown.char import Char
|
||||
from toontown.suit import SuitDNA
|
||||
from toontown.suit import Suit
|
||||
from toontown.quest import QuestParser
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
import DistributedDoorAI
|
||||
import DistributedPetshopInteriorAI
|
||||
import FADoorCodes
|
||||
import DoorTypes
|
||||
from pandac.PandaModules import *
|
||||
from toontown.hood import ZoneUtil
|
||||
# from toontown.pets import DistributedPetAI, PetTraits, PetUtil
|
||||
from toontown.toon import NPCToons
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
||||
from toontown.quest import Quests
|
||||
from toontown.hood import ZoneUtil
|
||||
|
||||
class PetshopBuildingAI:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('PetshopBuildingAI')
|
||||
|
||||
def __init__(self, air, exteriorZone, interiorZone, blockNumber):
|
||||
self.air = air
|
||||
self.exteriorZone = exteriorZone
|
||||
|
@ -33,6 +36,8 @@ class PetshopBuildingAI:
|
|||
|
||||
self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)
|
||||
|
||||
seeds = self.air.petMgr.getAvailablePets(1, len(self.npcs))
|
||||
|
||||
door = DistributedDoorAI.DistributedDoorAI(
|
||||
self.air, blockNumber, DoorTypes.EXT_STANDARD)
|
||||
insideDoor = DistributedDoorAI.DistributedDoorAI(
|
||||
|
@ -47,13 +52,4 @@ class PetshopBuildingAI:
|
|||
self.insideDoor = insideDoor
|
||||
|
||||
def createPet(self, ownerId, seed):
|
||||
zoneId = self.interiorZone
|
||||
safeZoneId = ZoneUtil.getCanonicalSafeZoneId(zoneId)
|
||||
(name, dna, traitSeed) = PetUtil.getPetInfoFromSeed(seed, safeZoneId)
|
||||
pet = DistributedPetAI.DistributedPetAI(self.air, dna=dna)
|
||||
pet.setOwnerId(ownerId)
|
||||
pet.setPetName(name)
|
||||
pet.traits = PetTraits.PetTraits(traitSeed=traitSeed, safeZoneId=safeZoneId)
|
||||
pet.generateWithRequired(zoneId)
|
||||
pet.setPos(0, 0, 0)
|
||||
pet.b_setParent(ToontownGlobals.SPRender)
|
||||
return
|
|
@ -44,7 +44,7 @@ class CatalogPetTrickItem(CatalogItem.CatalogItem):
|
|||
def getPicture(self, avatar):
|
||||
from toontown.pets import PetDNA, Pet
|
||||
pet = Pet.Pet(forGui=1)
|
||||
dna = avatar.petDNA
|
||||
dna = avatar.getPetDNA()
|
||||
if dna == None:
|
||||
dna = PetDNA.getRandomPetDNA()
|
||||
pet.setDNA(dna)
|
||||
|
|
|
@ -1,632 +0,0 @@
|
|||
from otp.avatar import Avatar
|
||||
from toontown.nametag import NametagGlobals
|
||||
from pandac.PandaModules import *
|
||||
from direct.task import Task
|
||||
import random
|
||||
from pandac.PandaModules import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
AnimDict = {'mk': (('walk', 'walk', 3),
|
||||
('run', 'run', 3),
|
||||
('neutral', 'wait', 3),
|
||||
('left-point-start', 'left-start', 3.5),
|
||||
('left-point', 'left', 3.5),
|
||||
('right-point-start', 'right-start', 3.5),
|
||||
('right-point', 'right', 3.5)),
|
||||
'vmk': (('walk', 'sneak', 3),
|
||||
('run', 'run', 3),
|
||||
('neutral', 'idle', 3),
|
||||
('sneak', 'sneak', 3),
|
||||
('into_sneak', 'into_sneak', 3),
|
||||
('chat', 'run', 3),
|
||||
('into_idle', 'into_idle', 3)),
|
||||
'wmn': (('walk', 'walkHalloween3', 3), ('neutral', 'neutral2', 3)),
|
||||
'mn': (('walk', 'walk', 3),
|
||||
('run', 'run', 3),
|
||||
('neutral', 'wait', 3),
|
||||
('left-point-start', 'start-Lpoint', 3.5),
|
||||
('left-point', 'Lpoint', 3.5),
|
||||
('right-point-start', 'start-Rpoint', 3.5),
|
||||
('right-point', 'Rpoint', 3.5),
|
||||
('up', 'up', 4),
|
||||
('down', 'down', 4),
|
||||
('left', 'left', 4),
|
||||
('right', 'right', 4)),
|
||||
'g': (('walk', 'Walk', 6), ('run', 'Run', 6), ('neutral', 'Wait', 6)),
|
||||
'sg': (('walk', 'walkStrut2', 6), ('neutral', 'neutral', 6)),
|
||||
'd': (('walk', 'walk', 6),
|
||||
('trans', 'transition', 6),
|
||||
('neutral', 'neutral', 6),
|
||||
('trans-back', 'transBack', 6)),
|
||||
'fd': (('walk', 'walk', 6), ('neutral', 'idle', 6)),
|
||||
'dw': (('wheel', 'wheel', 6), ('neutral', 'wheel', 6)),
|
||||
'p': (('walk', 'walk', 6),
|
||||
('sit', 'sit', 6),
|
||||
('neutral', 'neutral', 6),
|
||||
('stand', 'stand', 6)),
|
||||
'wp': (('walk', 'walk', 6),
|
||||
('sit', 'sitStart', 6),
|
||||
('neutral', 'sitLoop', 6),
|
||||
('stand', 'sitStop', 6)),
|
||||
'cl': (),
|
||||
'dd': (('walk', 'walk', 4), ('neutral', 'idle', 4)),
|
||||
'shdd': (('walk', 'walk', 4), ('neutral', 'idle', 4)),
|
||||
'ch': (('walk', 'walk', 6), ('neutral', 'idle', 6)),
|
||||
'pch': (('walk', 'walk', 6), ('neutral', 'idle', 6)),
|
||||
'da': (('walk', 'walk', 6), ('neutral', 'idle', 6)),
|
||||
'jda': (('walk', 'walk', 6), ('neutral', 'idle', 6))}
|
||||
ModelDict = {'mk': 'phase_3/models/char/mickey-',
|
||||
'vmk': 'phase_3.5/models/char/tt_a_chr_csc_mickey_vampire_',
|
||||
'mn': 'phase_3/models/char/minnie-',
|
||||
'wmn': 'phase_3.5/models/char/tt_a_chr_csc_witchMinnie_',
|
||||
'g': 'phase_6/models/char/TT_G',
|
||||
'sg': 'phase_6/models/char/tt_a_chr_csc_goofyCostume_',
|
||||
'd': 'phase_6/models/char/DL_donald-',
|
||||
'fd': 'phase_6/models/char/tt_a_chr_csc_donaldCostume_',
|
||||
'dw': 'phase_6/models/char/donald-wheel-',
|
||||
'p': 'phase_6/models/char/pluto-',
|
||||
'wp': 'phase_6/models/char/tt_a_chr_csc_plutoCostume_',
|
||||
'cl': 'phase_5.5/models/estate/Clara_pose2-',
|
||||
'dd': 'phase_4/models/char/daisyduck_',
|
||||
'shdd': 'phase_4/models/char/tt_a_chr_csc_daisyCostume_',
|
||||
'ch': 'phase_6/models/char/chip_',
|
||||
'pch': 'phase_6/models/char/tt_a_chr_csc_chipCostume_',
|
||||
'da': 'phase_6/models/char/dale_',
|
||||
'jda': 'phase_6/models/char/tt_a_chr_csc_daleCostume_'}
|
||||
LODModelDict = {'mk': [1200, 800, 400],
|
||||
'vmk': [1200, 800, 400],
|
||||
'wmn': [1200, 800, 400],
|
||||
'mn': [1200, 800, 400],
|
||||
'g': [1500, 1000, 500],
|
||||
'sg': [1200, 800, 400],
|
||||
'd': [1000, 500, 250],
|
||||
'fd': ['default'],
|
||||
'dw': [1000],
|
||||
'p': [1000, 500, 300],
|
||||
'wp': [1200, 800, 400],
|
||||
'cl': [],
|
||||
'dd': [1600, 800, 400],
|
||||
'shdd': ['default'],
|
||||
'ch': [1000, 500, 250],
|
||||
'pch': ['default'],
|
||||
'da': [1000, 500, 250],
|
||||
'jda': ['default']}
|
||||
|
||||
class Char(Avatar.Avatar):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('Char')
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
self.Char_initialized
|
||||
except:
|
||||
self.Char_initialized = 1
|
||||
Avatar.Avatar.__init__(self)
|
||||
self.setPickable(0)
|
||||
self.setPlayerType(NametagGlobals.CCNonPlayer)
|
||||
self.dialogueArray = []
|
||||
self.chatterArray = [[], [], []]
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.Char_deleted
|
||||
except:
|
||||
self.Char_deleted = 1
|
||||
self.unloadDialogue()
|
||||
Avatar.Avatar.delete(self)
|
||||
|
||||
def updateCharDNA(self, newDNA):
|
||||
if newDNA.name != self.style.name:
|
||||
self.swapCharModel(newDNA)
|
||||
|
||||
def setDNAString(self, dnaString):
|
||||
newDNA = CharDNA.CharDNA()
|
||||
newDNA.makeFromNetString(dnaString)
|
||||
self.setDNA(newDNA)
|
||||
|
||||
def setDNA(self, dna):
|
||||
if self.style:
|
||||
self.updateCharDNA(dna)
|
||||
else:
|
||||
self.style = dna
|
||||
self.generateChar()
|
||||
self.initializeDropShadow()
|
||||
self.initializeNametag3d()
|
||||
self.nametag3d.setBin('fixed', 0)
|
||||
if self.name == 'chip' or self.name == 'dale' or self.name == 'police_chip' or self.name == 'jailbird_dale':
|
||||
self.find('**/drop-shadow').setScale(0.33)
|
||||
|
||||
def setLODs(self):
|
||||
self.setLODNode()
|
||||
levelOneIn = base.config.GetInt('lod1-in', 50)
|
||||
levelOneOut = base.config.GetInt('lod1-out', 1)
|
||||
levelTwoIn = base.config.GetInt('lod2-in', 100)
|
||||
levelTwoOut = base.config.GetInt('lod2-out', 50)
|
||||
levelThreeIn = base.config.GetInt('lod3-in', 280)
|
||||
levelThreeOut = base.config.GetInt('lod3-out', 100)
|
||||
self.addLOD(LODModelDict[self.style.name][0], levelOneIn, levelOneOut)
|
||||
self.addLOD(LODModelDict[self.style.name][1], levelTwoIn, levelTwoOut)
|
||||
self.addLOD(LODModelDict[self.style.name][2], levelThreeIn, levelThreeOut)
|
||||
|
||||
def generateChar(self):
|
||||
dna = self.style
|
||||
self.name = dna.getCharName()
|
||||
self.geoEyes = 0
|
||||
if len(LODModelDict[dna.name]) > 1:
|
||||
self.setLODs()
|
||||
filePrefix = ModelDict[dna.name]
|
||||
if self.name == 'mickey':
|
||||
height = 3.0
|
||||
elif self.name == 'vampire_mickey':
|
||||
height = 3.0
|
||||
elif self.name == 'minnie':
|
||||
height = 3.0
|
||||
elif self.name == 'witch_minnie':
|
||||
height = 3.0
|
||||
elif self.name == 'goofy':
|
||||
height = 4.8
|
||||
elif self.name == 'super_goofy':
|
||||
height = 4.8
|
||||
elif self.name == 'donald' or self.name == 'donald-wheel' or self.name == 'franken_donald':
|
||||
height = 4.5
|
||||
elif self.name == 'daisy' or self.name == 'sockHop_daisy':
|
||||
height = 4.5
|
||||
elif self.name == 'pluto':
|
||||
height = 3.0
|
||||
elif self.name == 'western_pluto':
|
||||
height = 4.5
|
||||
elif self.name == 'clarabelle':
|
||||
height = 3.0
|
||||
elif self.name == 'chip':
|
||||
height = 2.0
|
||||
elif self.name == 'dale':
|
||||
height = 2.0
|
||||
elif self.name == 'police_chip':
|
||||
height = 2.0
|
||||
elif self.name == 'jailbird_dale':
|
||||
height = 2.0
|
||||
self.lodStrings = []
|
||||
for lod in LODModelDict[self.style.name]:
|
||||
self.lodStrings.append(str(lod))
|
||||
|
||||
if self.lodStrings:
|
||||
for lodStr in self.lodStrings:
|
||||
if len(self.lodStrings) > 1:
|
||||
lodName = lodStr
|
||||
else:
|
||||
lodName = 'lodRoot'
|
||||
if self.name == 'goofy':
|
||||
self.loadModel(filePrefix + '-' + lodStr, lodName=lodName)
|
||||
else:
|
||||
self.loadModel(filePrefix + lodStr, lodName=lodName)
|
||||
|
||||
else:
|
||||
self.loadModel(filePrefix)
|
||||
animDict = {}
|
||||
animList = AnimDict[self.style.name]
|
||||
for anim in animList:
|
||||
animFilePrefix = filePrefix[:6] + str(anim[2]) + filePrefix[7:]
|
||||
animDict[anim[0]] = animFilePrefix + anim[1]
|
||||
|
||||
for lodStr in self.lodStrings:
|
||||
if len(self.lodStrings) > 1:
|
||||
lodName = lodStr
|
||||
else:
|
||||
lodName = 'lodRoot'
|
||||
self.loadAnims(animDict, lodName=lodName)
|
||||
|
||||
self.setHeight(height)
|
||||
self.loadDialogue(dna.name)
|
||||
self.ears = []
|
||||
if self.name == 'mickey' or self.name == 'vampire_mickey' or self.name == 'minnie':
|
||||
for bundle in self.getPartBundleDict().values():
|
||||
bundle = bundle['modelRoot'].getBundle()
|
||||
earNull = bundle.findChild('sphere3')
|
||||
if not earNull:
|
||||
earNull = bundle.findChild('*sphere3')
|
||||
earNull.clearNetTransforms()
|
||||
|
||||
for bundle in self.getPartBundleDict().values():
|
||||
charNodepath = bundle['modelRoot'].partBundleNP
|
||||
bundle = bundle['modelRoot'].getBundle()
|
||||
earNull = bundle.findChild('sphere3')
|
||||
if not earNull:
|
||||
earNull = bundle.findChild('*sphere3')
|
||||
ears = charNodepath.find('**/sphere3')
|
||||
if ears.isEmpty():
|
||||
ears = charNodepath.find('**/*sphere3')
|
||||
ears.clearEffect(CharacterJointEffect.getClassType())
|
||||
earRoot = charNodepath.attachNewNode('earRoot')
|
||||
earPitch = earRoot.attachNewNode('earPitch')
|
||||
earPitch.setP(40.0)
|
||||
ears.reparentTo(earPitch)
|
||||
earNull.addNetTransform(earRoot.node())
|
||||
ears.clearMat()
|
||||
ears.node().setPreserveTransform(ModelNode.PTNone)
|
||||
ears.setP(-40.0)
|
||||
ears.flattenMedium()
|
||||
self.ears.append(ears)
|
||||
ears.setBillboardAxis()
|
||||
|
||||
self.eyes = None
|
||||
self.lpupil = None
|
||||
self.rpupil = None
|
||||
self.eyesOpen = None
|
||||
self.eyesClosed = None
|
||||
if self.name == 'mickey' or self.name == 'minnie':
|
||||
self.eyesOpen = loader.loadTexture('phase_3/maps/eyes1.jpg', 'phase_3/maps/eyes1_a.rgb')
|
||||
self.eyesClosed = loader.loadTexture('phase_3/maps/mickey_eyes_closed.jpg', 'phase_3/maps/mickey_eyes_closed_a.rgb')
|
||||
self.eyes = self.find('**/1200/**/eyes')
|
||||
self.eyes.setBin('transparent', 0)
|
||||
self.lpupil = self.find('**/1200/**/joint_pupilL')
|
||||
self.rpupil = self.find('**/1200/**/joint_pupilR')
|
||||
for lodName in self.getLODNames():
|
||||
self.drawInFront('joint_pupil?', 'eyes*', -3, lodName=lodName)
|
||||
|
||||
elif (self.name == 'witch_minnie' or
|
||||
self.name == 'vampire_mickey' or
|
||||
self.name == 'super_goofy' or
|
||||
self.name == 'western_pluto' or
|
||||
self.name == 'police_chip' or
|
||||
self.name == 'jailbird_dale' or
|
||||
self.name == 'franken_donald' or
|
||||
self.name == 'sockHop_daisy'):
|
||||
self.geoEyes = 1
|
||||
self.eyeOpenList = []
|
||||
self.eyeCloseList = []
|
||||
if self.find('**/1200/**/eyesOpen').isEmpty():
|
||||
self.eyeCloseList.append(self.find('**/eyesClosed'))
|
||||
self.eyeOpenList.append(self.find('**/eyesOpen'))
|
||||
else:
|
||||
self.eyeCloseList.append(self.find('**/1200/**/eyesClosed'))
|
||||
self.eyeOpenList.append(self.find('**/1200/**/eyesOpen'))
|
||||
for part in self.eyeOpenList:
|
||||
part.show()
|
||||
|
||||
for part in self.eyeCloseList:
|
||||
part.hide()
|
||||
|
||||
elif self.name == 'pluto':
|
||||
self.eyesOpen = loader.loadTexture('phase_6/maps/plutoEyesOpen.jpg', 'phase_6/maps/plutoEyesOpen_a.rgb')
|
||||
self.eyesClosed = loader.loadTexture('phase_6/maps/plutoEyesClosed.jpg', 'phase_6/maps/plutoEyesClosed_a.rgb')
|
||||
self.eyes = self.find('**/1000/**/eyes')
|
||||
self.lpupil = self.find('**/1000/**/joint_pupilL')
|
||||
self.rpupil = self.find('**/1000/**/joint_pupilR')
|
||||
for lodName in self.getLODNames():
|
||||
self.drawInFront('joint_pupil?', 'eyes*', -3, lodName=lodName)
|
||||
|
||||
elif self.name == 'daisy':
|
||||
self.geoEyes = 1
|
||||
self.eyeOpenList = []
|
||||
self.eyeCloseList = []
|
||||
self.eyeCloseList.append(self.find('**/1600/**/eyesclose'))
|
||||
self.eyeCloseList.append(self.find('**/800/**/eyesclose'))
|
||||
self.eyeOpenList.append(self.find('**/1600/**/eyesclose'))
|
||||
self.eyeOpenList.append(self.find('**/800/**/eyesclose'))
|
||||
self.eyeOpenList.append(self.find('**/1600/**/eyespupil'))
|
||||
self.eyeOpenList.append(self.find('**/800/**/eyespupil'))
|
||||
self.eyeOpenList.append(self.find('**/1600/**/eyesopen'))
|
||||
self.eyeOpenList.append(self.find('**/800/**/eyesopen'))
|
||||
for part in self.eyeOpenList:
|
||||
part.show()
|
||||
|
||||
for part in self.eyeCloseList:
|
||||
part.hide()
|
||||
|
||||
elif self.name == 'donald-wheel':
|
||||
self.eyes = self.find('**/eyes')
|
||||
self.lpupil = self.find('**/joint_pupilL')
|
||||
self.rpupil = self.find('**/joint_pupilR')
|
||||
self.drawInFront('joint_pupil?', 'eyes*', -3)
|
||||
elif self.name == 'chip' or self.name == 'dale':
|
||||
self.eyesOpen = loader.loadTexture('phase_6/maps/dale_eye1.jpg', 'phase_6/maps/dale_eye1_a.rgb')
|
||||
self.eyesClosed = loader.loadTexture('phase_6/maps/chip_dale_eye1_blink.jpg', 'phase_6/maps/chip_dale_eye1_blink_a.rgb')
|
||||
self.eyes = self.find('**/eyes')
|
||||
self.lpupil = self.find('**/pupil_left')
|
||||
self.rpupil = self.find('**/pupil_right')
|
||||
self.find('**/blink').hide()
|
||||
if self.lpupil != None:
|
||||
self.lpupil.adjustAllPriorities(1)
|
||||
self.rpupil.adjustAllPriorities(1)
|
||||
if self.eyesOpen:
|
||||
self.eyesOpen.setMinfilter(Texture.FTLinear)
|
||||
self.eyesOpen.setMagfilter(Texture.FTLinear)
|
||||
if self.eyesClosed:
|
||||
self.eyesClosed.setMinfilter(Texture.FTLinear)
|
||||
self.eyesClosed.setMagfilter(Texture.FTLinear)
|
||||
if self.name == 'mickey':
|
||||
pupilParent = self.rpupil.getParent()
|
||||
pupilOffsetNode = pupilParent.attachNewNode('pupilOffsetNode')
|
||||
pupilOffsetNode.setPos(0, 0.025, 0)
|
||||
self.rpupil.reparentTo(pupilOffsetNode)
|
||||
self.__blinkName = 'blink-' + self.name
|
||||
return
|
||||
|
||||
def swapCharModel(self, charStyle):
|
||||
for lodStr in self.lodStrings:
|
||||
if len(self.lodStrings) > 1:
|
||||
lodName = lodStr
|
||||
else:
|
||||
lodName = 'lodRoot'
|
||||
self.removePart('modelRoot', lodName=lodName)
|
||||
|
||||
self.setStyle(charStyle)
|
||||
self.generateChar()
|
||||
|
||||
def getDialogue(self, type, length):
|
||||
sfxIndex = None
|
||||
if type == 'statementA' or type == 'statementB':
|
||||
if length == 1:
|
||||
sfxIndex = 0
|
||||
elif length == 2:
|
||||
sfxIndex = 1
|
||||
elif length >= 3:
|
||||
sfxIndex = 2
|
||||
elif type == 'question':
|
||||
sfxIndex = 3
|
||||
elif type == 'exclamation':
|
||||
sfxIndex = 4
|
||||
elif type == 'special':
|
||||
sfxIndex = 5
|
||||
else:
|
||||
self.notify.error('unrecognized dialogue type: ', type)
|
||||
if sfxIndex != None and sfxIndex < len(self.dialogueArray) and self.dialogueArray[sfxIndex] != None:
|
||||
return self.dialogueArray[sfxIndex]
|
||||
else:
|
||||
return
|
||||
return
|
||||
|
||||
def playDialogue(self, type, length, delay = None):
|
||||
dialogue = self.getDialogue(type, length)
|
||||
base.playSfx(dialogue)
|
||||
|
||||
def getChatterDialogue(self, category, msg):
|
||||
try:
|
||||
return self.chatterArray[category][msg]
|
||||
except IndexError:
|
||||
return None
|
||||
|
||||
return None
|
||||
|
||||
def getShadowJoint(self):
|
||||
return self.getGeomNode()
|
||||
|
||||
def getNametagJoints(self):
|
||||
return []
|
||||
|
||||
def loadChatterDialogue(self, name, audioIndexArray, loadPath, language):
|
||||
chatterTypes = ['greetings', 'comments', 'goodbyes']
|
||||
for categoryIndex in xrange(len(audioIndexArray)):
|
||||
chatterType = chatterTypes[categoryIndex]
|
||||
for fileIndex in audioIndexArray[categoryIndex]:
|
||||
if fileIndex:
|
||||
self.chatterArray[categoryIndex].append(base.loadSfx('%s/CC_%s_chatter_%s%02d.ogg' % (loadPath,
|
||||
name,
|
||||
chatterType,
|
||||
fileIndex)))
|
||||
else:
|
||||
self.chatterArray[categoryIndex].append(None)
|
||||
|
||||
return
|
||||
|
||||
def loadDialogue(self, char):
|
||||
if self.dialogueArray:
|
||||
self.notify.warning('loadDialogue() called twice.')
|
||||
self.unloadDialogue()
|
||||
language = base.config.GetString('language', 'english')
|
||||
if char == 'mk':
|
||||
dialogueFile = base.loadSfx('phase_3/audio/dial/mickey.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
if language == 'japanese':
|
||||
chatterIndexArray = ([1, 2], [1,
|
||||
2,
|
||||
3,
|
||||
4], [1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5])
|
||||
self.loadChatterDialogue('mickey', chatterIndexArray, 'phase_3/audio/dial', language)
|
||||
elif char == 'vmk':
|
||||
dialogueFile = base.loadSfx('phase_3/audio/dial/mickey.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
if language == 'japanese':
|
||||
chatterIndexArray = ([1, 2], [1,
|
||||
2,
|
||||
3,
|
||||
4], [1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5])
|
||||
self.loadChatterDialogue('mickey', chatterIndexArray, 'phase_3/audio/dial', language)
|
||||
elif char == 'mn' or char == 'wmn':
|
||||
dialogueFile = base.loadSfx('phase_3/audio/dial/minnie.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
if language == 'japanese':
|
||||
chatterIndexArray = ([1, 2], [1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17], [1, 2, 3])
|
||||
self.loadChatterDialogue('minnie', chatterIndexArray, 'phase_3/audio/dial', language)
|
||||
elif char == 'dd' or char == 'shdd':
|
||||
dialogueFile = base.loadSfx('phase_4/audio/dial/daisy.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
if language == 'japanese':
|
||||
chatterIndexArray = ([1, 2, 3], [1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12], [1,
|
||||
2,
|
||||
3,
|
||||
4])
|
||||
self.loadChatterDialogue('daisy', chatterIndexArray, 'phase_8/audio/dial', language)
|
||||
elif char == 'g' or char == 'sg':
|
||||
dialogueFile = base.loadSfx('phase_6/audio/dial/goofy.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
if language == 'japanese':
|
||||
chatterIndexArray = ([1, 2, 3], [1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12], [1,
|
||||
2,
|
||||
3,
|
||||
4])
|
||||
self.loadChatterDialogue('goofy', chatterIndexArray, 'phase_6/audio/dial', language)
|
||||
elif char == 'd' or char == 'dw' or char == 'fd':
|
||||
dialogueFile = base.loadSfx('phase_6/audio/dial/donald.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
if char == 'd':
|
||||
if language == 'japanese':
|
||||
chatterIndexArray = ([1, 2], [1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11], [1,
|
||||
2,
|
||||
3,
|
||||
4])
|
||||
self.loadChatterDialogue('donald', chatterIndexArray, 'phase_6/audio/dial', language)
|
||||
elif char == 'p' or char == 'wp':
|
||||
dialogueFile = base.loadSfx('phase_3.5/audio/dial/AV_dog_med.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
elif char == 'cl':
|
||||
dialogueFile = base.loadSfx('phase_3.5/audio/dial/AV_dog_med.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
elif char == 'ch':
|
||||
dialogueFile = base.loadSfx('phase_6/audio/dial/chip.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
elif char == 'da':
|
||||
dialogueFile = base.loadSfx('phase_6/audio/dial/dale.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
elif char == 'pch':
|
||||
dialogueFile = base.loadSfx('phase_6/audio/dial/chip.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
elif char == 'jda':
|
||||
dialogueFile = base.loadSfx('phase_6/audio/dial/dale.ogg')
|
||||
for i in xrange(0, 6):
|
||||
self.dialogueArray.append(dialogueFile)
|
||||
|
||||
else:
|
||||
self.notify.error('unknown character %s' % char)
|
||||
|
||||
def unloadDialogue(self):
|
||||
self.dialogueArray = []
|
||||
self.chatterArray = [[], [], []]
|
||||
|
||||
def __blinkOpenEyes(self, task):
|
||||
self.openEyes()
|
||||
r = random.random()
|
||||
if r < 0.1:
|
||||
t = 0.2
|
||||
else:
|
||||
t = r * 4.0 + 1.0
|
||||
taskMgr.doMethodLater(t, self.__blinkCloseEyes, self.__blinkName)
|
||||
return Task.done
|
||||
|
||||
def __blinkCloseEyes(self, task):
|
||||
self.closeEyes()
|
||||
taskMgr.doMethodLater(0.125, self.__blinkOpenEyes, self.__blinkName)
|
||||
return Task.done
|
||||
|
||||
def openEyes(self):
|
||||
if self.geoEyes:
|
||||
for part in self.eyeOpenList:
|
||||
part.show()
|
||||
|
||||
for part in self.eyeCloseList:
|
||||
part.hide()
|
||||
|
||||
else:
|
||||
if self.eyes:
|
||||
self.eyes.setTexture(self.eyesOpen, 1)
|
||||
self.lpupil.show()
|
||||
self.rpupil.show()
|
||||
|
||||
def closeEyes(self):
|
||||
if self.geoEyes:
|
||||
for part in self.eyeOpenList:
|
||||
part.hide()
|
||||
|
||||
for part in self.eyeCloseList:
|
||||
part.show()
|
||||
|
||||
else:
|
||||
if self.eyes:
|
||||
self.eyes.setTexture(self.eyesClosed, 1)
|
||||
self.lpupil.hide()
|
||||
self.rpupil.hide()
|
||||
|
||||
def startBlink(self):
|
||||
if self.eyesOpen or self.geoEyes:
|
||||
taskMgr.remove(self.__blinkName)
|
||||
taskMgr.doMethodLater(random.random() * 4 + 1, self.__blinkCloseEyes, self.__blinkName)
|
||||
|
||||
def stopBlink(self):
|
||||
if self.eyesOpen or self.geoEyes:
|
||||
taskMgr.remove(self.__blinkName)
|
||||
self.openEyes()
|
||||
|
||||
def startEarTask(self):
|
||||
pass
|
||||
|
||||
def stopEarTask(self):
|
||||
pass
|
||||
|
||||
def uniqueName(self, idString):
|
||||
return idString + '-' + str(self.this)
|
|
@ -1,127 +0,0 @@
|
|||
import random
|
||||
from pandac.PandaModules import *
|
||||
from direct.directnotify.DirectNotifyGlobal import *
|
||||
import random
|
||||
from direct.distributed.PyDatagram import PyDatagram
|
||||
from direct.distributed.PyDatagramIterator import PyDatagramIterator
|
||||
from otp.avatar import AvatarDNA
|
||||
notify = directNotify.newCategory('CharDNA')
|
||||
charTypes = ['mk',
|
||||
'vmk',
|
||||
'mn',
|
||||
'wmn',
|
||||
'g',
|
||||
'sg',
|
||||
'd',
|
||||
'fd',
|
||||
'dw',
|
||||
'p',
|
||||
'wp',
|
||||
'cl',
|
||||
'dd',
|
||||
'shdd',
|
||||
'ch',
|
||||
'da',
|
||||
'pch',
|
||||
'jda']
|
||||
|
||||
class CharDNA(AvatarDNA.AvatarDNA):
|
||||
|
||||
def __init__(self, str = None, type = None, dna = None, r = None, b = None, g = None):
|
||||
if str != None:
|
||||
self.makeFromNetString(str)
|
||||
elif type != None:
|
||||
if type == 'c':
|
||||
self.newChar(dna)
|
||||
else:
|
||||
self.type = 'u'
|
||||
return
|
||||
|
||||
def __str__(self):
|
||||
if self.type == 'c':
|
||||
return 'type = char, name = %s' % self.name
|
||||
else:
|
||||
return 'type undefined'
|
||||
|
||||
def makeNetString(self):
|
||||
dg = PyDatagram()
|
||||
dg.addFixedString(self.type, 1)
|
||||
if self.type == 'c':
|
||||
dg.addFixedString(self.name, 2)
|
||||
elif self.type == 'u':
|
||||
notify.error('undefined avatar')
|
||||
else:
|
||||
notify.error('unknown avatar type: ', self.type)
|
||||
return dg.getMessage()
|
||||
|
||||
def makeFromNetString(self, string):
|
||||
dg = PyDatagram(string)
|
||||
dgi = PyDatagramIterator(dg)
|
||||
self.type = dgi.getFixedString(1)
|
||||
if self.type == 'c':
|
||||
self.name = sgi.getFixedString(2)
|
||||
else:
|
||||
notify.error('unknown avatar type: ', self.type)
|
||||
return None
|
||||
|
||||
def __defaultChar(self):
|
||||
self.type = 'c'
|
||||
self.name = charTypes[0]
|
||||
|
||||
def newChar(self, name = None):
|
||||
if name == None:
|
||||
self.__defaultChar()
|
||||
else:
|
||||
self.type = 'c'
|
||||
if name in charTypes:
|
||||
self.name = name
|
||||
else:
|
||||
notify.error('unknown avatar type: %s' % name)
|
||||
return
|
||||
|
||||
def getType(self):
|
||||
if self.type == 'c':
|
||||
type = self.getCharName()
|
||||
else:
|
||||
notify.error('Invalid DNA type: ', self.type)
|
||||
return type
|
||||
|
||||
def getCharName(self):
|
||||
if self.name == 'mk':
|
||||
return 'mickey'
|
||||
elif self.name == 'vmk':
|
||||
return 'vampire_mickey'
|
||||
elif self.name == 'mn':
|
||||
return 'minnie'
|
||||
elif self.name == 'wmn':
|
||||
return 'witch_minnie'
|
||||
elif self.name == 'g':
|
||||
return 'goofy'
|
||||
elif self.name == 'sg':
|
||||
return 'super_goofy'
|
||||
elif self.name == 'd':
|
||||
return 'donald'
|
||||
elif self.name == 'dw':
|
||||
return 'donald-wheel'
|
||||
elif self.name == 'fd':
|
||||
return 'franken_donald'
|
||||
elif self.name == 'dd':
|
||||
return 'daisy'
|
||||
elif self.name == 'shdd':
|
||||
return 'sockHop_daisy'
|
||||
elif self.name == 'p':
|
||||
return 'pluto'
|
||||
elif self.name == 'wp':
|
||||
return 'western_pluto'
|
||||
elif self.name == 'cl':
|
||||
return 'clarabelle'
|
||||
elif self.name == 'ch':
|
||||
return 'chip'
|
||||
elif self.name == 'da':
|
||||
return 'dale'
|
||||
elif self.name == 'pch':
|
||||
return 'police_chip'
|
||||
elif self.name == 'jda':
|
||||
return 'jailbird_dale'
|
||||
else:
|
||||
notify.error('unknown char type: ', self.name)
|
|
@ -1,32 +0,0 @@
|
|||
from otp.avatar import DistributedAvatar
|
||||
import Char
|
||||
|
||||
class DistributedChar(DistributedAvatar.DistributedAvatar, Char.Char):
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedChar_initialized
|
||||
except:
|
||||
self.DistributedChar_initialized = 1
|
||||
DistributedAvatar.DistributedAvatar.__init__(self, cr)
|
||||
Char.Char.__init__(self)
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedChar_deleted
|
||||
except:
|
||||
self.DistributedChar_deleted = 1
|
||||
Char.Char.delete(self)
|
||||
DistributedAvatar.DistributedAvatar.delete(self)
|
||||
|
||||
def setDNAString(self, dnaString):
|
||||
Char.Char.setDNAString(self, dnaString)
|
||||
|
||||
def setDNA(self, dna):
|
||||
Char.Char.setDNA(self, dna)
|
||||
|
||||
def playDialogue(self, *args):
|
||||
Char.Char.playDialogue(self, *args)
|
||||
|
||||
def setHp(self, hp):
|
||||
self.hp = hp
|
|
@ -1,266 +0,0 @@
|
|||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
GREETING = 0
|
||||
COMMENT = 1
|
||||
GOODBYE = 2
|
||||
DaisyChatter = TTLocalizer.DaisyChatter
|
||||
MickeyChatter = TTLocalizer.MickeyChatter
|
||||
VampireMickeyChatter = TTLocalizer.VampireMickeyChatter
|
||||
MinnieChatter = TTLocalizer.MinnieChatter
|
||||
GoofyChatter = TTLocalizer.GoofyChatter
|
||||
GoofySpeedwayChatter = TTLocalizer.GoofySpeedwayChatter
|
||||
DonaldChatter = TTLocalizer.DonaldChatter
|
||||
ChipChatter = TTLocalizer.ChipChatter
|
||||
DaleChatter = TTLocalizer.DaleChatter
|
||||
|
||||
def getExtendedChat(chatset, extendedChat):
|
||||
newChat = []
|
||||
for chatList in chatset:
|
||||
newChat.append(list(chatList))
|
||||
|
||||
newChat[1] += extendedChat
|
||||
return newChat
|
||||
|
||||
|
||||
def getChatter(charName, chatterType):
|
||||
if charName == TTLocalizer.Mickey:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFMickeyChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_CAROLING:
|
||||
return TTLocalizer.WinterMickeyCChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterMickeyDChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterMickeyCChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterMickeyDChatter
|
||||
elif chatterType == ToontownGlobals.VALENTINES_DAY:
|
||||
return TTLocalizer.ValentinesMickeyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_ONE:
|
||||
SillyMickeyChatter = getExtendedChat(MickeyChatter, TTLocalizer.SillyPhase1Chatter)
|
||||
return SillyMickeyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_TWO:
|
||||
SillyMickeyChatter = getExtendedChat(MickeyChatter, TTLocalizer.SillyPhase2Chatter)
|
||||
return SillyMickeyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_THREE:
|
||||
SillyMickeyChatter = getExtendedChat(MickeyChatter, TTLocalizer.SillyPhase3Chatter)
|
||||
return SillyMickeyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_FOUR:
|
||||
SillyMickeyChatter = getExtendedChat(MickeyChatter, TTLocalizer.SillyPhase4Chatter)
|
||||
return SillyMickeyChatter
|
||||
elif chatterType == ToontownGlobals.SELLBOT_FIELD_OFFICE:
|
||||
fieldOfficeMickeyChatter = getExtendedChat(MickeyChatter, TTLocalizer.FieldOfficeMickeyChatter)
|
||||
return fieldOfficeMickeyChatter
|
||||
else:
|
||||
return MickeyChatter
|
||||
elif charName == TTLocalizer.VampireMickey:
|
||||
return VampireMickeyChatter
|
||||
elif charName == TTLocalizer.Minnie:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFMinnieChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_CAROLING:
|
||||
return TTLocalizer.WinterMinnieCChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterMinnieDChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterMinnieCChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterMinnieDChatter
|
||||
elif chatterType == ToontownGlobals.VALENTINES_DAY:
|
||||
return TTLocalizer.ValentinesMinnieChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_ONE:
|
||||
SillyMinnieChatter = getExtendedChat(MinnieChatter, TTLocalizer.SillyPhase1Chatter)
|
||||
return SillyMinnieChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_TWO:
|
||||
SillyMinnieChatter = getExtendedChat(MinnieChatter, TTLocalizer.SillyPhase2Chatter)
|
||||
return SillyMinnieChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_THREE:
|
||||
SillyMinnieChatter = getExtendedChat(MinnieChatter, TTLocalizer.SillyPhase3Chatter)
|
||||
return SillyMinnieChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_FOUR:
|
||||
SillyMinnieChatter = getExtendedChat(MinnieChatter, TTLocalizer.SillyPhase4Chatter)
|
||||
return SillyMinnieChatter
|
||||
elif chatterType == ToontownGlobals.SELLBOT_FIELD_OFFICE:
|
||||
fieldOfficeMinnieChatter = getExtendedChat(MinnieChatter, TTLocalizer.FieldOfficeMinnieChatter)
|
||||
return fieldOfficeMinnieChatter
|
||||
else:
|
||||
return MinnieChatter
|
||||
elif charName == TTLocalizer.WitchMinnie:
|
||||
return TTLocalizer.WitchMinnieChatter
|
||||
elif charName == TTLocalizer.Daisy or charName == TTLocalizer.SockHopDaisy:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFDaisyChatter
|
||||
elif chatterType == ToontownGlobals.HALLOWEEN_COSTUMES:
|
||||
return TTLocalizer.HalloweenDaisyChatter
|
||||
elif chatterType == ToontownGlobals.SPOOKY_COSTUMES:
|
||||
return TTLocalizer.HalloweenDaisyChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_CAROLING:
|
||||
return TTLocalizer.WinterDaisyCChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterDaisyDChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterDaisyCChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterDaisyDChatter
|
||||
elif chatterType == ToontownGlobals.VALENTINES_DAY:
|
||||
return TTLocalizer.ValentinesDaisyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_ONE:
|
||||
SillyDaisyChatter = getExtendedChat(DaisyChatter, TTLocalizer.SillyPhase1Chatter)
|
||||
return SillyDaisyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_TWO:
|
||||
SillyDaisyChatter = getExtendedChat(DaisyChatter, TTLocalizer.SillyPhase2Chatter)
|
||||
return SillyDaisyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_THREE:
|
||||
SillyDaisyChatter = getExtendedChat(DaisyChatter, TTLocalizer.SillyPhase3Chatter)
|
||||
return SillyDaisyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_FOUR:
|
||||
SillyDaisyChatter = getExtendedChat(DaisyChatter, TTLocalizer.SillyPhase4Chatter)
|
||||
return SillyDaisyChatter
|
||||
elif chatterType == ToontownGlobals.SELLBOT_FIELD_OFFICE:
|
||||
fieldOfficeDaisyChatter = getExtendedChat(DaisyChatter, TTLocalizer.FieldOfficeDaisyChatter)
|
||||
return fieldOfficeDaisyChatter
|
||||
else:
|
||||
return DaisyChatter
|
||||
elif charName == TTLocalizer.Goofy:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFGoofySpeedwayChatter
|
||||
elif chatterType == ToontownGlobals.CRASHED_LEADERBOARD:
|
||||
return TTLocalizer.CLGoofySpeedwayChatter
|
||||
elif chatterType == ToontownGlobals.CIRCUIT_RACING_EVENT:
|
||||
return TTLocalizer.GPGoofySpeedwayChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS or chatterType == ToontownGlobals.WINTER_CAROLING or chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS or chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterGoofyChatter
|
||||
elif chatterType == ToontownGlobals.VALENTINES_DAY:
|
||||
return TTLocalizer.ValentinesGoofyChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_ONE:
|
||||
SillyGoofySpeedwayChatter = getExtendedChat(GoofySpeedwayChatter, TTLocalizer.SillyPhase1Chatter)
|
||||
return SillyGoofySpeedwayChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_TWO:
|
||||
SillyGoofySpeedwayChatter = getExtendedChat(GoofySpeedwayChatter, TTLocalizer.SillyPhase2Chatter)
|
||||
return SillyGoofySpeedwayChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_THREE:
|
||||
SillyGoofySpeedwayChatter = getExtendedChat(GoofySpeedwayChatter, TTLocalizer.SillyPhase3Chatter)
|
||||
return SillyGoofySpeedwayChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_FOUR:
|
||||
SillyGoofySpeedwayChatter = getExtendedChat(GoofySpeedwayChatter, TTLocalizer.SillyPhase4Chatter)
|
||||
return SillyGoofySpeedwayChatter
|
||||
else:
|
||||
return GoofySpeedwayChatter
|
||||
elif charName == TTLocalizer.SuperGoofy:
|
||||
return TTLocalizer.SuperGoofyChatter
|
||||
elif charName == TTLocalizer.Donald or charName == TTLocalizer.FrankenDonald:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFDonaldChatter
|
||||
elif chatterType == ToontownGlobals.HALLOWEEN_COSTUMES:
|
||||
return TTLocalizer.HalloweenDreamlandChatter
|
||||
elif chatterType == ToontownGlobals.SPOOKY_COSTUMES:
|
||||
return TTLocalizer.HalloweenDreamlandChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_CAROLING:
|
||||
return TTLocalizer.WinterDreamlandCChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterDreamlandDChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterDreamlandCChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterDreamlandDChatter
|
||||
elif chatterType == ToontownGlobals.VALENTINES_DAY:
|
||||
return TTLocalizer.ValentinesDreamlandChatter
|
||||
elif chatterType == ToontownGlobals.SELLBOT_FIELD_OFFICE:
|
||||
fieldOfficeDreamlandChatter = getExtendedChat(DonaldChatter, TTLocalizer.FieldOfficeDreamlandChatter)
|
||||
return fieldOfficeDreamlandChatter
|
||||
else:
|
||||
return DonaldChatter
|
||||
elif charName == TTLocalizer.DonaldDock:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFDonaldDockChatter
|
||||
elif chatterType == ToontownGlobals.HALLOWEEN_COSTUMES:
|
||||
return TTLocalizer.HalloweenDonaldChatter
|
||||
elif chatterType == ToontownGlobals.SPOOKY_COSTUMES:
|
||||
return TTLocalizer.HalloweenDonaldChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_CAROLING:
|
||||
return TTLocalizer.WinterDonaldCChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterDonaldDChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterDonaldCChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterDonaldDChatter
|
||||
elif chatterType == ToontownGlobals.VALENTINES_DAY:
|
||||
return TTLocalizer.ValentinesDonaldChatter
|
||||
else:
|
||||
return None
|
||||
elif charName == TTLocalizer.Pluto:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFPlutoChatter
|
||||
elif chatterType == ToontownGlobals.HALLOWEEN_COSTUMES:
|
||||
return TTLocalizer.WesternPlutoChatter
|
||||
elif chatterType == ToontownGlobals.SPOOKY_COSTUMES:
|
||||
return TTLocalizer.WesternPlutoChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_CAROLING:
|
||||
return TTLocalizer.WinterPlutoCChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterPlutoDChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterPlutoCChatter
|
||||
elif chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS:
|
||||
return TTLocalizer.WinterPlutoDChatter
|
||||
else:
|
||||
return None
|
||||
elif charName == TTLocalizer.WesternPluto:
|
||||
if chatterType == ToontownGlobals.HALLOWEEN_COSTUMES:
|
||||
return TTLocalizer.WesternPlutoChatter
|
||||
elif chatterType == ToontownGlobals.SPOOKY_COSTUMES:
|
||||
return TTLocalizer.WesternPlutoChatter
|
||||
else:
|
||||
return None
|
||||
elif charName == TTLocalizer.Chip or charName == TTLocalizer.PoliceChip:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFChipChatter
|
||||
elif chatterType == ToontownGlobals.HALLOWEEN_COSTUMES:
|
||||
return TTLocalizer.HalloweenChipChatter
|
||||
elif chatterType == ToontownGlobals.SPOOKY_COSTUMES:
|
||||
return TTLocalizer.HalloweenChipChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS or chatterType == ToontownGlobals.WINTER_CAROLING or chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS or chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterChipChatter
|
||||
elif chatterType == ToontownGlobals.VALENTINES_DAY:
|
||||
return TTLocalizer.ValentinesChipChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_ONE:
|
||||
SillyChipChatter = getExtendedChat(ChipChatter, TTLocalizer.SillyPhase1Chatter)
|
||||
return SillyChipChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_TWO:
|
||||
SillyChipChatter = getExtendedChat(ChipChatter, TTLocalizer.SillyPhase2Chatter)
|
||||
return SillyChipChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_THREE:
|
||||
SillyChipChatter = getExtendedChat(ChipChatter, TTLocalizer.SillyPhase3Chatter)
|
||||
return SillyChipChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_FOUR:
|
||||
SillyChipChatter = getExtendedChat(ChipChatter, TTLocalizer.SillyPhase4Chatter)
|
||||
return SillyChipChatter
|
||||
else:
|
||||
return ChipChatter
|
||||
elif charName == TTLocalizer.Dale or TTLocalizer.JailbirdDale:
|
||||
if chatterType == ToontownGlobals.APRIL_FOOLS_COSTUMES:
|
||||
return TTLocalizer.AFDaleChatter
|
||||
elif chatterType == ToontownGlobals.HALLOWEEN_COSTUMES:
|
||||
return TTLocalizer.HalloweenDaleChatter
|
||||
elif chatterType == ToontownGlobals.SPOOKY_COSTUMES:
|
||||
return TTLocalizer.HalloweenDaleChatter
|
||||
elif chatterType == ToontownGlobals.WINTER_DECORATIONS or chatterType == ToontownGlobals.WINTER_CAROLING or chatterType == ToontownGlobals.WACKY_WINTER_DECORATIONS or chatterType == ToontownGlobals.WACKY_WINTER_CAROLING:
|
||||
return TTLocalizer.WinterDaleChatter
|
||||
elif chatterType == ToontownGlobals.VALENTINES_DAY:
|
||||
return TTLocalizer.ValentinesDaleChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_ONE:
|
||||
SillyDaleChatter = getExtendedChat(DaleChatter, TTLocalizer.SillyPhase1Chatter)
|
||||
return SillyDaleChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_TWO:
|
||||
SillyDaleChatter = getExtendedChat(DaleChatter, TTLocalizer.SillyPhase2Chatter)
|
||||
return SillyDaleChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_THREE:
|
||||
SillyDaleChatter = getExtendedChat(DaleChatter, TTLocalizer.SillyPhase3Chatter)
|
||||
return SillyDaleChatter
|
||||
elif chatterType == ToontownGlobals.SILLY_CHATTER_FOUR:
|
||||
SillyDaleChatter = getExtendedChat(DaleChatter, TTLocalizer.SillyPhase4Chatter)
|
||||
return SillyDaleChatter
|
||||
else:
|
||||
return DaleChatter
|
||||
return None
|
|
@ -1,459 +0,0 @@
|
|||
from pandac.PandaModules import Point3
|
||||
from pandac.PandaModules import Vec3
|
||||
import copy
|
||||
from toontown.toonbase import TTLocalizer
|
||||
__mickeyPaths = {'a': (Point3(17, -17, 4.025), ('b', 'e')),
|
||||
'b': (Point3(17.5, 7.6, 4.025), ('c', 'e')),
|
||||
'c': (Point3(85, 11.5, 4.025), ('d',)),
|
||||
'd': (Point3(85, -13, 4.025), ('a',)),
|
||||
'e': (Point3(-27.5, -5.25, 0.0), ('a', 'b', 'f')),
|
||||
'f': (Point3(-106.15, -4.0, -2.5), ('e',
|
||||
'g',
|
||||
'h',
|
||||
'i')),
|
||||
'g': (Point3(-89.5, 93.5, 0.5), ('f', 'h')),
|
||||
'h': (Point3(-139.95, 1.69, 0.5), ('f', 'g', 'i')),
|
||||
'i': (Point3(-110.95, -68.57, 0.5), ('f', 'h'))}
|
||||
__mickeyWaypoints = (('a',
|
||||
'e',
|
||||
1,
|
||||
[]),
|
||||
('b',
|
||||
'e',
|
||||
1,
|
||||
[]),
|
||||
('e',
|
||||
'f',
|
||||
1,
|
||||
[Point3(-76.87, -7.85, -1.85), Point3(-80.57, -4.0, -1.85)]),
|
||||
('f',
|
||||
'g',
|
||||
1,
|
||||
[Point3(-106.62, 28.65, -1.5)]),
|
||||
('g',
|
||||
'h',
|
||||
1,
|
||||
[Point3(-128.38, 60.27, 0.5)]),
|
||||
('h',
|
||||
'f',
|
||||
1,
|
||||
[]),
|
||||
('h',
|
||||
'i',
|
||||
1,
|
||||
[Point3(-137.13, -42.79, 0.5)]),
|
||||
('i',
|
||||
'f',
|
||||
1,
|
||||
[]))
|
||||
__minniePaths = {'a': (Point3(53.334, 71.057, 6.525), ('b', 'r')),
|
||||
'b': (Point3(127.756, 58.665, -11.75), ('a', 's', 'c')),
|
||||
'c': (Point3(130.325, 15.174, -2.003), ('b', 'd')),
|
||||
'd': (Point3(126.173, 7.057, 0.522), ('c', 'e')),
|
||||
'e': (Point3(133.843, -6.618, 4.71), ('d',
|
||||
'f',
|
||||
'g',
|
||||
'h')),
|
||||
'f': (Point3(116.876, 1.119, 3.304), 'e'),
|
||||
'g': (Point3(116.271, -41.568, 3.304), ('e', 'h')),
|
||||
'h': (Point3(128.983, -49.656, -0.231), ('e',
|
||||
'g',
|
||||
'i',
|
||||
'j')),
|
||||
'i': (Point3(106.024, -75.249, -4.498), 'h'),
|
||||
'j': (Point3(135.016, -93.072, -13.376), ('h', 'k', 'z')),
|
||||
'k': (Point3(123.966, -100.242, -10.879), ('j', 'l')),
|
||||
'l': (Point3(52.859, -109.081, 6.525), ('k', 'm')),
|
||||
'm': (Point3(-32.071, -107.049, 6.525), ('l', 'n')),
|
||||
'n': (Point3(-40.519, -99.685, 6.525), ('m', 'o')),
|
||||
'o': (Point3(-40.245, -88.634, 6.525), ('n', 'p')),
|
||||
'p': (Point3(-66.3, -62.192, 6.525), ('o', 'q')),
|
||||
'q': (Point3(-66.212, 23.069, 6.525), ('p', 'r')),
|
||||
'r': (Point3(-18.344, 69.532, 6.525), ('q', 'a')),
|
||||
's': (Point3(91.357, 44.546, -13.475), ('b', 't')),
|
||||
't': (Point3(90.355, 6.279, -13.475), ('s', 'u')),
|
||||
'u': (Point3(-13.765, 42.362, -14.553), ('t', 'v')),
|
||||
'v': (Point3(-52.627, 7.428, -14.553), ('u', 'w')),
|
||||
'w': (Point3(-50.654, -54.879, -14.553), ('v', 'x')),
|
||||
'x': (Point3(-3.711, -81.819, -14.553), ('w', 'y')),
|
||||
'y': (Point3(90.777, -49.714, -13.475), ('z', 'x')),
|
||||
'z': (Point3(90.059, -79.426, -13.475), ('j', 'y'))}
|
||||
__minnieWaypoints = (('a',
|
||||
'b',
|
||||
1,
|
||||
[]),
|
||||
('k',
|
||||
'l',
|
||||
1,
|
||||
[]),
|
||||
('b',
|
||||
'c',
|
||||
1,
|
||||
[]),
|
||||
('c',
|
||||
'd',
|
||||
1,
|
||||
[]),
|
||||
('d',
|
||||
'e',
|
||||
1,
|
||||
[]),
|
||||
('e',
|
||||
'f',
|
||||
1,
|
||||
[]),
|
||||
('e',
|
||||
'g',
|
||||
1,
|
||||
[]),
|
||||
('e',
|
||||
'h',
|
||||
1,
|
||||
[]),
|
||||
('g',
|
||||
'h',
|
||||
1,
|
||||
[]),
|
||||
('h',
|
||||
'i',
|
||||
1,
|
||||
[]),
|
||||
('h',
|
||||
'j',
|
||||
1,
|
||||
[]),
|
||||
('s',
|
||||
'b',
|
||||
1,
|
||||
[]),
|
||||
('t',
|
||||
'u',
|
||||
1,
|
||||
[]),
|
||||
('x',
|
||||
'y',
|
||||
1,
|
||||
[]))
|
||||
__goofyPaths = {'a': (Point3(64.995, 169.665, 10.027), ('b', 'q')),
|
||||
'b': (Point3(48.893, 208.912, 10.027), ('a', 'c')),
|
||||
'c': (Point3(5.482, 210.479, 10.03), ('b', 'd')),
|
||||
'd': (Point3(-34.153, 203.284, 10.029), ('c', 'e')),
|
||||
'e': (Point3(-66.656, 174.334, 10.026), ('d', 'f')),
|
||||
'f': (Point3(-55.994, 162.33, 10.026), ('e', 'g')),
|
||||
'g': (Point3(-84.554, 142.099, 0.027), ('f', 'h')),
|
||||
'h': (Point3(-92.215, 96.446, 0.027), ('g', 'i')),
|
||||
'i': (Point3(-63.168, 60.055, 0.027), ('h', 'j')),
|
||||
'j': (Point3(-37.637, 69.974, 0.027), ('i', 'k')),
|
||||
'k': (Point3(-3.018, 26.157, 0.027), ('j', 'l', 'm')),
|
||||
'l': (Point3(-0.711, 46.843, 0.027), 'k'),
|
||||
'm': (Point3(26.071, 46.401, 0.027), ('k', 'n')),
|
||||
'n': (Point3(30.87, 67.432, 0.027), ('m', 'o')),
|
||||
'o': (Point3(93.903, 90.685, 0.027), ('n', 'p')),
|
||||
'p': (Point3(88.129, 140.575, 0.027), ('o', 'q')),
|
||||
'q': (Point3(53.988, 158.232, 10.027), ('p', 'a'))}
|
||||
__goofyWaypoints = (('f',
|
||||
'g',
|
||||
1,
|
||||
[]), ('p',
|
||||
'q',
|
||||
1,
|
||||
[]))
|
||||
__goofySpeedwayPaths = {'a': (Point3(-9.0, -19.517, -0.323), ('b', 'k')),
|
||||
'b': (Point3(-30.047, -1.578, -0.373), ('a', 'c')),
|
||||
'c': (Point3(-10.367, 49.042, -0.373), ('b', 'd')),
|
||||
'd': (Point3(38.439, 44.348, -0.373), ('c', 'e')),
|
||||
'e': (Point3(25.527, -2.395, -0.373), ('d', 'f')),
|
||||
'f': (Point3(-4.043, -59.865, -0.003), ('e', 'g')),
|
||||
'g': (Point3(0.39, -99.475, -0.009), ('f', 'h')),
|
||||
'h': (Point3(21.147, -109.127, -0.013), ('g', 'i')),
|
||||
'i': (Point3(5.981, -147.606, -0.013), ('h', 'j')),
|
||||
'j': (Point3(-24.898, -120.618, -0.013), ('i', 'k')),
|
||||
'k': (Point3(-2.71, -90.315, -0.011), ('j', 'a'))}
|
||||
__goofySpeedwayWaypoints = (('a',
|
||||
'k',
|
||||
1,
|
||||
[]), ('k',
|
||||
'a',
|
||||
1,
|
||||
[]))
|
||||
__donaldPaths = {'a': (Point3(-94.883, -94.024, 0.025), 'b'),
|
||||
'b': (Point3(-13.962, -92.233, 0.025), ('a', 'h')),
|
||||
'c': (Point3(68.417, -91.929, 0.025), ('m', 'g')),
|
||||
'd': (Point3(68.745, 91.227, 0.025), ('k', 'i')),
|
||||
'e': (Point3(4.047, 94.26, 0.025), ('i', 'j')),
|
||||
'f': (Point3(-91.271, 90.987, 0.025), 'j'),
|
||||
'g': (Point3(43.824, -94.129, 0.025), ('c', 'h')),
|
||||
'h': (Point3(13.905, -91.334, 0.025), ('b', 'g')),
|
||||
'i': (Point3(43.062, 88.152, 0.025), ('d', 'e')),
|
||||
'j': (Point3(-48.96, 88.565, 0.025), ('e', 'f')),
|
||||
'k': (Point3(75.118, 52.84, -16.62), ('d', 'l')),
|
||||
'l': (Point3(44.677, 27.091, -15.385), ('k', 'm')),
|
||||
'm': (Point3(77.009, -16.022, -14.975), ('l', 'c'))}
|
||||
__donaldWaypoints = (('d',
|
||||
'k',
|
||||
1,
|
||||
[]),
|
||||
('k',
|
||||
'l',
|
||||
1,
|
||||
[]),
|
||||
('l',
|
||||
'm',
|
||||
1,
|
||||
[]),
|
||||
('m',
|
||||
'c',
|
||||
1,
|
||||
[]),
|
||||
('b',
|
||||
'a',
|
||||
1,
|
||||
[Point3(-55.883, -89.0, 0.025)]))
|
||||
__plutoPaths = {'a': (Point3(-110.0, -37.8, 8.6), ('b', 'c')),
|
||||
'b': (Point3(-11.9, -128.2, 6.2), ('a', 'c')),
|
||||
'c': (Point3(48.9, -14.4, 6.2), ('b', 'a', 'd')),
|
||||
'd': (Point3(0.25, 80.5, 6.2), ('c', 'e')),
|
||||
'e': (Point3(-83.3, 36.1, 6.2), ('d', 'a'))}
|
||||
__plutoWaypoints = (('a',
|
||||
'b',
|
||||
1,
|
||||
[Point3(-90.4, -57.2, 3.0), Point3(-63.6, -79.8, 3.0), Point3(-50.1, -89.1, 6.2)]),
|
||||
('c',
|
||||
'a',
|
||||
1,
|
||||
[Point3(-15.6, -25.6, 6.2),
|
||||
Point3(-37.5, -38.5, 3.0),
|
||||
Point3(-55.0, -55.0, 3.0),
|
||||
Point3(-85.0, -46.4, 3.0)]),
|
||||
('d',
|
||||
'e',
|
||||
0,
|
||||
[Point3(-25.8, 60.0, 6.2), Point3(-61.9, 64.5, 6.2)]),
|
||||
('e',
|
||||
'a',
|
||||
1,
|
||||
[Point3(-77.2, 28.5, 6.2), Point3(-76.4, 12.0, 3.0), Point3(-93.2, -21.2, 3.0)]))
|
||||
__daisyPaths = {'a': (Point3(64.995, 169.665, 10.027), ('b', 'q')),
|
||||
'b': (Point3(48.893, 208.912, 10.027), ('a', 'c')),
|
||||
'c': (Point3(5.482, 210.479, 10.03), ('b', 'd')),
|
||||
'd': (Point3(-34.153, 203.284, 10.029), ('c', 'e')),
|
||||
'e': (Point3(-66.656, 174.334, 10.026), ('d', 'f')),
|
||||
'f': (Point3(-55.994, 162.33, 10.026), ('e', 'g')),
|
||||
'g': (Point3(-84.554, 142.099, 0.027), ('f', 'h')),
|
||||
'h': (Point3(-92.215, 96.446, 0.027), ('g', 'i')),
|
||||
'i': (Point3(-63.168, 60.055, 0.027), ('h', 'j')),
|
||||
'j': (Point3(-37.637, 69.974, 0.027), ('i', 'k')),
|
||||
'k': (Point3(-3.018, 26.157, 0.027), ('j', 'l', 'm')),
|
||||
'l': (Point3(-0.711, 46.843, 0.027), 'k'),
|
||||
'm': (Point3(26.071, 46.401, 0.027), ('k', 'n')),
|
||||
'n': (Point3(30.87, 67.432, 0.027), ('m', 'o')),
|
||||
'o': (Point3(93.903, 90.685, 0.027), ('n', 'p')),
|
||||
'p': (Point3(88.129, 140.575, 0.027), ('o', 'q')),
|
||||
'q': (Point3(53.988, 158.232, 10.027), ('p', 'a'))}
|
||||
__daisyWaypoints = (('f',
|
||||
'g',
|
||||
1,
|
||||
[]), ('p',
|
||||
'q',
|
||||
1,
|
||||
[]))
|
||||
__chipPaths = {'a': (Point3(50.004, 102.725, 0.6), ('b', 'k')),
|
||||
'b': (Point3(-29.552, 112.531, 0.6), ('c', 'a')),
|
||||
'c': (Point3(-51.941, 146.155, 0.025), ('d', 'b')),
|
||||
'd': (Point3(-212.334, -3.639, 0.025), ('e', 'c')),
|
||||
'e': (Point3(-143.466, -67.526, 0.025), ('f', 'd', 'i')),
|
||||
'f': (Point3(-107.556, -62.257, 0.025), ('g', 'e', 'j')),
|
||||
'g': (Point3(-43.103, -71.518, 0.2734), ('h', 'f', 'j')),
|
||||
'h': (Point3(-40.605, -125.124, 0.025), ('i', 'g')),
|
||||
'i': (Point3(-123.05, -124.542, 0.025), ('h', 'e')),
|
||||
'j': (Point3(-40.092, 2.784, 1.268), ('k',
|
||||
'b',
|
||||
'f',
|
||||
'g')),
|
||||
'k': (Point3(75.295, 26.715, 1.4), ('a', 'j'))}
|
||||
__chipWaypoints = (('a',
|
||||
'b',
|
||||
1,
|
||||
[]),
|
||||
('a',
|
||||
'k',
|
||||
1,
|
||||
[]),
|
||||
('b',
|
||||
'c',
|
||||
1,
|
||||
[]),
|
||||
('b',
|
||||
'j',
|
||||
1,
|
||||
[]),
|
||||
('c',
|
||||
'd',
|
||||
1,
|
||||
[]),
|
||||
('d',
|
||||
'e',
|
||||
1,
|
||||
[]),
|
||||
('e',
|
||||
'f',
|
||||
1,
|
||||
[]),
|
||||
('e',
|
||||
'i',
|
||||
1,
|
||||
[]),
|
||||
('f',
|
||||
'g',
|
||||
1,
|
||||
[]),
|
||||
('f',
|
||||
'j',
|
||||
1,
|
||||
[]),
|
||||
('g',
|
||||
'h',
|
||||
1,
|
||||
[]),
|
||||
('g',
|
||||
'j',
|
||||
1,
|
||||
[]),
|
||||
('h',
|
||||
'i',
|
||||
1,
|
||||
[]),
|
||||
('j',
|
||||
'k',
|
||||
1,
|
||||
[]))
|
||||
DaleOrbitDistanceOverride = {('b', 'c'): 2.5,
|
||||
('e', 'f'): 2.5}
|
||||
startNode = 'a'
|
||||
|
||||
def getPaths(charName, location = 0):
|
||||
if charName == TTLocalizer.Mickey:
|
||||
return __mickeyPaths
|
||||
elif charName == TTLocalizer.VampireMickey:
|
||||
return __mickeyPaths
|
||||
elif charName == TTLocalizer.Minnie:
|
||||
return __minniePaths
|
||||
elif charName == TTLocalizer.WitchMinnie:
|
||||
return __minniePaths
|
||||
elif charName == TTLocalizer.Daisy or charName == TTLocalizer.SockHopDaisy:
|
||||
return __daisyPaths
|
||||
elif charName == TTLocalizer.Goofy:
|
||||
if location == 0:
|
||||
return __goofyPaths
|
||||
else:
|
||||
return __goofySpeedwayPaths
|
||||
elif charName == TTLocalizer.SuperGoofy:
|
||||
return __goofySpeedwayPaths
|
||||
elif charName == TTLocalizer.Donald or charName == TTLocalizer.FrankenDonald:
|
||||
return __donaldPaths
|
||||
elif charName == TTLocalizer.Pluto:
|
||||
return __plutoPaths
|
||||
elif charName == TTLocalizer.WesternPluto:
|
||||
return __plutoPaths
|
||||
elif charName == TTLocalizer.Chip or charName == TTLocalizer.PoliceChip:
|
||||
return __chipPaths
|
||||
elif charName == TTLocalizer.Dale or charName == TTLocalizer.JailbirdDale:
|
||||
return __chipPaths
|
||||
elif charName == TTLocalizer.DonaldDock:
|
||||
return {'a': (Point3(0, 0, 0), 'a')}
|
||||
|
||||
|
||||
def __getWaypointList(paths):
|
||||
if paths == __mickeyPaths:
|
||||
return __mickeyWaypoints
|
||||
elif paths == __minniePaths:
|
||||
return __minnieWaypoints
|
||||
elif paths == __daisyPaths:
|
||||
return __daisyWaypoints
|
||||
elif paths == __goofyPaths:
|
||||
return __goofyWaypoints
|
||||
elif paths == __goofySpeedwayPaths:
|
||||
return __goofySpeedwayWaypoints
|
||||
elif paths == __donaldPaths:
|
||||
return __donaldWaypoints
|
||||
elif paths == __plutoPaths:
|
||||
return __plutoWaypoints
|
||||
elif paths == __chipPaths:
|
||||
return __chipWaypoints
|
||||
elif paths == __dalePaths:
|
||||
return __chipWaypoints
|
||||
|
||||
|
||||
def getNodePos(node, paths):
|
||||
return paths[node][0]
|
||||
|
||||
|
||||
def getAdjacentNodes(node, paths):
|
||||
return paths[node][1]
|
||||
|
||||
|
||||
def getWayPoints(fromNode, toNode, paths, wpts = None):
|
||||
list = []
|
||||
if fromNode != toNode:
|
||||
if wpts == None:
|
||||
wpts = __getWaypointList(paths)
|
||||
for path in wpts:
|
||||
if path[0] == fromNode and path[1] == toNode:
|
||||
for point in path[3]:
|
||||
list.append(Point3(point))
|
||||
|
||||
break
|
||||
elif path[0] == toNode and path[1] == fromNode:
|
||||
for point in path[3]:
|
||||
list = [Point3(point)] + list
|
||||
|
||||
break
|
||||
|
||||
return list
|
||||
|
||||
|
||||
def getRaycastFlag(fromNode, toNode, paths):
|
||||
result = 0
|
||||
if fromNode != toNode:
|
||||
wpts = __getWaypointList(paths)
|
||||
for path in wpts:
|
||||
if path[0] == fromNode and path[1] == toNode:
|
||||
if path[2]:
|
||||
result = 1
|
||||
break
|
||||
elif path[0] == toNode and path[1] == fromNode:
|
||||
if path[2]:
|
||||
result = 1
|
||||
break
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def getPointsFromTo(fromNode, toNode, paths):
|
||||
startPoint = Point3(getNodePos(fromNode, paths))
|
||||
endPoint = Point3(getNodePos(toNode, paths))
|
||||
return [startPoint] + getWayPoints(fromNode, toNode, paths) + [endPoint]
|
||||
|
||||
|
||||
def getWalkDuration(fromNode, toNode, velocity, paths):
|
||||
posPoints = getPointsFromTo(fromNode, toNode, paths)
|
||||
duration = 0
|
||||
for pointIndex in xrange(len(posPoints) - 1):
|
||||
startPoint = posPoints[pointIndex]
|
||||
endPoint = posPoints[pointIndex + 1]
|
||||
distance = Vec3(endPoint - startPoint).length()
|
||||
duration += distance / velocity
|
||||
|
||||
return duration
|
||||
|
||||
|
||||
def getWalkDistance(fromNode, toNode, velocity, paths):
|
||||
posPoints = getPointsFromTo(fromNode, toNode, paths)
|
||||
retval = 0
|
||||
for pointIndex in xrange(len(posPoints) - 1):
|
||||
startPoint = posPoints[pointIndex]
|
||||
endPoint = posPoints[pointIndex + 1]
|
||||
distance = Vec3(endPoint - startPoint).length()
|
||||
retval += distance
|
||||
|
||||
return retval
|
|
@ -1,225 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
from direct.distributed.ClockDelta import *
|
||||
from direct.fsm import StateData
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.showbase.PythonUtil import *
|
||||
from direct.task import Task
|
||||
import CCharPaths
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
||||
class CharNeutralState(StateData.StateData):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CharNeutralState')
|
||||
|
||||
def __init__(self, doneEvent, character):
|
||||
StateData.StateData.__init__(self, doneEvent)
|
||||
self.__doneEvent = doneEvent
|
||||
self.character = character
|
||||
|
||||
def enter(self, startTrack = None, playRate = None):
|
||||
StateData.StateData.enter(self)
|
||||
self.notify.debug('Neutral ' + self.character.getName() + '...')
|
||||
self.__neutralTrack = Sequence(name=self.character.getName() + '-neutral')
|
||||
if startTrack:
|
||||
self.__neutralTrack.append(startTrack)
|
||||
if playRate:
|
||||
self.__neutralTrack.append(Func(self.character.setPlayRate, playRate, 'neutral'))
|
||||
self.__neutralTrack.append(Func(self.character.loop, 'neutral'))
|
||||
self.__neutralTrack.start()
|
||||
|
||||
def exit(self):
|
||||
StateData.StateData.exit(self)
|
||||
self.__neutralTrack.finish()
|
||||
|
||||
def __doneHandler(self):
|
||||
doneStatus = {}
|
||||
doneStatus['state'] = 'walk'
|
||||
doneStatus['status'] = 'done'
|
||||
messenger.send(self.__doneEvent, [doneStatus])
|
||||
return Task.done
|
||||
|
||||
|
||||
class CharWalkState(StateData.StateData):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CharWalkState')
|
||||
|
||||
def __init__(self, doneEvent, character, diffPath = None):
|
||||
StateData.StateData.__init__(self, doneEvent)
|
||||
self.doneEvent = doneEvent
|
||||
self.character = character
|
||||
if diffPath == None:
|
||||
self.paths = CCharPaths.getPaths(character.getName(), character.getCCLocation())
|
||||
else:
|
||||
self.paths = CCharPaths.getPaths(diffPath, character.getCCLocation())
|
||||
self.speed = character.walkSpeed()
|
||||
self.offsetX = 0
|
||||
self.offsetY = 0
|
||||
self.oldOffsetX = 0
|
||||
self.olfOffsetY = 0
|
||||
self.walkTrack = None
|
||||
return
|
||||
|
||||
def enter(self, startTrack = None, playRate = None):
|
||||
StateData.StateData.enter(self)
|
||||
self.notify.debug('Walking ' + self.character.getName() + '... from ' + str(self.walkInfo[0]) + ' to ' + str(self.walkInfo[1]))
|
||||
posPoints = CCharPaths.getPointsFromTo(self.walkInfo[0], self.walkInfo[1], self.paths)
|
||||
lastPos = posPoints[-1]
|
||||
newLastPos = Point3(lastPos[0] + self.offsetX, lastPos[1] + self.offsetY, lastPos[2])
|
||||
posPoints[-1] = newLastPos
|
||||
firstPos = posPoints[0]
|
||||
newFirstPos = Point3(firstPos[0] + self.oldOffsetX, firstPos[1] + self.oldOffsetY, firstPos[2])
|
||||
posPoints[0] = newFirstPos
|
||||
self.walkTrack = Sequence(name=self.character.getName() + '-walk')
|
||||
if startTrack:
|
||||
self.walkTrack.append(startTrack)
|
||||
self.character.setPos(posPoints[0])
|
||||
raycast = CCharPaths.getRaycastFlag(self.walkInfo[0], self.walkInfo[1], self.paths)
|
||||
moveTrack = self.makePathTrack(self.character, posPoints, self.speed, raycast)
|
||||
if playRate:
|
||||
self.walkTrack.append(Func(self.character.setPlayRate, playRate, 'walk'))
|
||||
self.walkTrack.append(Func(self.character.loop, 'walk'))
|
||||
self.walkTrack.append(moveTrack)
|
||||
doneEventName = self.character.getName() + 'WalkDone'
|
||||
self.walkTrack.append(Func(messenger.send, doneEventName))
|
||||
ts = globalClockDelta.localElapsedTime(self.walkInfo[2])
|
||||
self.accept(doneEventName, self.doneHandler)
|
||||
self.notify.debug('walkTrack.start(%s)' % ts)
|
||||
self.walkTrack.start(ts)
|
||||
|
||||
def makePathTrack(self, nodePath, posPoints, velocity, raycast = 0):
|
||||
track = Sequence()
|
||||
if raycast:
|
||||
track.append(Func(nodePath.enableRaycast, 1))
|
||||
startHpr = nodePath.getHpr()
|
||||
for pointIndex in xrange(len(posPoints) - 1):
|
||||
startPoint = posPoints[pointIndex]
|
||||
endPoint = posPoints[pointIndex + 1]
|
||||
track.append(Func(nodePath.setPos, startPoint))
|
||||
distance = Vec3(endPoint - startPoint).length()
|
||||
duration = distance / velocity
|
||||
curHpr = nodePath.getHpr()
|
||||
nodePath.headsUp(endPoint[0], endPoint[1], endPoint[2])
|
||||
destHpr = nodePath.getHpr()
|
||||
reducedCurH = reduceAngle(curHpr[0])
|
||||
reducedCurHpr = Vec3(reducedCurH, curHpr[1], curHpr[2])
|
||||
reducedDestH = reduceAngle(destHpr[0])
|
||||
shortestAngle = closestDestAngle(reducedCurH, reducedDestH)
|
||||
shortestHpr = Vec3(shortestAngle, destHpr[1], destHpr[2])
|
||||
turnTime = abs(shortestAngle) / 270.0
|
||||
nodePath.setHpr(shortestHpr)
|
||||
if duration - turnTime > 0.01:
|
||||
track.append(Parallel(Func(nodePath.loop, 'walk'), LerpHprInterval(nodePath, turnTime, shortestHpr, startHpr=reducedCurHpr, name='lerp' + nodePath.getName() + 'Hpr'), LerpPosInterval(nodePath, duration=duration - turnTime, pos=Point3(endPoint), startPos=Point3(startPoint), fluid=1)))
|
||||
|
||||
nodePath.setHpr(startHpr)
|
||||
if raycast:
|
||||
track.append(Func(nodePath.enableRaycast, 0))
|
||||
return track
|
||||
|
||||
def doneHandler(self):
|
||||
doneStatus = {}
|
||||
doneStatus['state'] = 'walk'
|
||||
doneStatus['status'] = 'done'
|
||||
messenger.send(self.doneEvent, [doneStatus])
|
||||
return Task.done
|
||||
|
||||
def exit(self):
|
||||
StateData.StateData.exit(self)
|
||||
self.ignore(self.character.getName() + 'WalkDone')
|
||||
if self.walkTrack:
|
||||
self.walkTrack.finish()
|
||||
self.walkTrack = None
|
||||
return
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp, offsetX = 0, offsetY = 0):
|
||||
self.oldOffsetX = self.offsetX
|
||||
self.oldOffsetY = self.offsetY
|
||||
self.walkInfo = (srcNode, destNode, timestamp)
|
||||
self.offsetX = offsetX
|
||||
self.offsetY = offsetY
|
||||
|
||||
|
||||
class CharFollowChipState(CharWalkState):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CharFollowChipState')
|
||||
completeRevolutionDistance = 13
|
||||
|
||||
def __init__(self, doneEvent, character, chipId):
|
||||
CharWalkState.__init__(self, doneEvent, character)
|
||||
self.offsetDict = {'a': (ToontownGlobals.DaleOrbitDistance, 0)}
|
||||
self.chipId = chipId
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp, offsetX = 0, offsetY = 0):
|
||||
self.offsetDict[destNode] = (offsetX, offsetY)
|
||||
self.srcNode = srcNode
|
||||
self.destNode = destNode
|
||||
self.orbitDistance = ToontownGlobals.DaleOrbitDistance
|
||||
if (srcNode, destNode) in CCharPaths.DaleOrbitDistanceOverride:
|
||||
self.orbitDistance = CCharPaths.DaleOrbitDistanceOverride[srcNode, destNode]
|
||||
elif (destNode, srcNode) in CCharPaths.DaleOrbitDistanceOverride:
|
||||
self.orbitDistance = CCharPaths.DaleOrbitDistanceOverride[destNode, srcNode]
|
||||
CharWalkState.setWalk(self, srcNode, destNode, timestamp, offsetX, offsetY)
|
||||
|
||||
def makePathTrack(self, nodePath, posPoints, velocity, raycast = 0):
|
||||
retval = Sequence()
|
||||
if raycast:
|
||||
retval.append(Func(nodePath.enableRaycast, 1))
|
||||
chip = base.cr.doId2do.get(self.chipId)
|
||||
self.chipPaths = CCharPaths.getPaths(chip.getName(), chip.getCCLocation())
|
||||
self.posPoints = posPoints
|
||||
chipDuration = chip.walk.walkTrack.getDuration()
|
||||
self.notify.debug('chipDuration = %f' % chipDuration)
|
||||
chipDistance = CCharPaths.getWalkDistance(self.srcNode, self.destNode, ToontownGlobals.ChipSpeed, self.chipPaths)
|
||||
self.revolutions = chipDistance / self.completeRevolutionDistance
|
||||
srcOffset = (0, 0)
|
||||
if self.srcNode in self.offsetDict:
|
||||
srcOffset = self.offsetDict[self.srcNode]
|
||||
srcTheta = math.atan2(srcOffset[1], srcOffset[0])
|
||||
if srcTheta < 0:
|
||||
srcTheta += 2 * math.pi
|
||||
if srcTheta > 0:
|
||||
srcRev = (2 * math.pi - srcTheta) / (2 * math.pi)
|
||||
else:
|
||||
srcRev = 0
|
||||
self.srcTheta = srcTheta
|
||||
destOffset = (0, 0)
|
||||
if self.destNode in self.offsetDict:
|
||||
destOffset = self.offsetDict[self.destNode]
|
||||
destTheta = math.atan2(destOffset[1], destOffset[0])
|
||||
if destTheta < 0:
|
||||
destTheta += 2 * math.pi
|
||||
self.destTheta = destTheta
|
||||
self.revolutions += srcRev
|
||||
endingTheta = srcTheta + self.revolutions % 1.0 * 2 * math.pi
|
||||
diffTheta = destTheta - endingTheta
|
||||
destRev = diffTheta / (2 * math.pi)
|
||||
self.revolutions += destRev
|
||||
while self.revolutions < 1:
|
||||
self.revolutions += 1
|
||||
|
||||
def positionDale(t):
|
||||
self.orbitChip(t)
|
||||
|
||||
retval.append(LerpFunctionInterval(positionDale, chipDuration))
|
||||
if raycast:
|
||||
retval.append(Func(nodePath.enableRaycast, 0))
|
||||
return retval
|
||||
|
||||
def orbitChip(self, t):
|
||||
srcOffset = (0, 0)
|
||||
if self.srcNode in self.offsetDict:
|
||||
srcOffset = self.offsetDict[self.srcNode]
|
||||
chipSrcPos = Point3(self.posPoints[0][0] - srcOffset[0], self.posPoints[0][1] - srcOffset[1], self.posPoints[0][2])
|
||||
destOffset = (0, 0)
|
||||
if self.destNode in self.offsetDict:
|
||||
destOffset = self.offsetDict[self.destNode]
|
||||
chipDestPos = Point3(self.posPoints[-1][0] - destOffset[0], self.posPoints[-1][1] - destOffset[1], self.posPoints[-1][2])
|
||||
displacement = chipDestPos - chipSrcPos
|
||||
displacement *= t
|
||||
chipPos = chipSrcPos + displacement
|
||||
diffTheta = t * self.revolutions * 2 * math.pi
|
||||
curTheta = self.srcTheta + diffTheta
|
||||
newOffsetX = math.cos(curTheta) * self.orbitDistance
|
||||
newOffsetY = math.sin(curTheta) * self.orbitDistance
|
||||
dalePos = Point3(chipPos[0] + newOffsetX, chipPos[1] + newOffsetY, chipPos[2])
|
||||
self.character.setPos(dalePos)
|
||||
newHeading = rad2Deg(curTheta)
|
||||
newHeading %= 360
|
||||
self.character.setH(newHeading)
|
|
@ -1,385 +0,0 @@
|
|||
# File: C (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
from direct.distributed.ClockDelta import *
|
||||
from direct.fsm import StateData
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
import random
|
||||
from direct.task import Task
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
import CCharChatter
|
||||
import CCharPaths
|
||||
|
||||
class CharLonelyStateAI(StateData.StateData):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CharLonelyStateAI')
|
||||
|
||||
def __init__(self, doneEvent, character):
|
||||
StateData.StateData.__init__(self, doneEvent)
|
||||
self._CharLonelyStateAI__doneEvent = doneEvent
|
||||
self.character = character
|
||||
|
||||
|
||||
def enter(self):
|
||||
if hasattr(self.character, 'name'):
|
||||
name = self.character.getName()
|
||||
else:
|
||||
name = 'character'
|
||||
self.notify.debug('Lonely ' + self.character.getName() + '...')
|
||||
StateData.StateData.enter(self)
|
||||
duration = random.randint(3, 15)
|
||||
taskMgr.doMethodLater(duration, self._CharLonelyStateAI__doneHandler, self.character.taskName('startWalking'))
|
||||
|
||||
|
||||
def exit(self):
|
||||
StateData.StateData.exit(self)
|
||||
taskMgr.remove(self.character.taskName('startWalking'))
|
||||
|
||||
|
||||
def _CharLonelyStateAI__doneHandler(self, task):
|
||||
doneStatus = { }
|
||||
doneStatus['state'] = 'lonely'
|
||||
doneStatus['status'] = 'done'
|
||||
messenger.send(self._CharLonelyStateAI__doneEvent, [
|
||||
doneStatus])
|
||||
return Task.done
|
||||
|
||||
|
||||
|
||||
class CharChattyStateAI(StateData.StateData):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CharChattyStateAI')
|
||||
|
||||
def __init__(self, doneEvent, character):
|
||||
StateData.StateData.__init__(self, doneEvent)
|
||||
self._CharChattyStateAI__doneEvent = doneEvent
|
||||
self.character = character
|
||||
self._CharChattyStateAI__chatTaskName = 'characterChat-' + str(character)
|
||||
self.lastChatTarget = 0
|
||||
self.nextChatTime = 0
|
||||
self.lastMessage = [
|
||||
-1,
|
||||
-1]
|
||||
|
||||
|
||||
def enter(self):
|
||||
if hasattr(self.character, 'name'):
|
||||
name = self.character.getName()
|
||||
else:
|
||||
name = 'character'
|
||||
self.notify.debug('Chatty ' + self.character.getName() + '...')
|
||||
self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter())
|
||||
if self.chatter != None:
|
||||
taskMgr.remove(self._CharChattyStateAI__chatTaskName)
|
||||
taskMgr.add(self.blather, self._CharChattyStateAI__chatTaskName)
|
||||
|
||||
StateData.StateData.enter(self)
|
||||
|
||||
|
||||
def pickMsg(self, category):
|
||||
self.getLatestChatter()
|
||||
if self.chatter:
|
||||
return random.randint(0, len(self.chatter[category]) - 1)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def getLatestChatter(self):
|
||||
self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter())
|
||||
|
||||
|
||||
def setCorrectChatter(self):
|
||||
self.chatter = CCharChatter.getChatter(self.character.getName(), self.character.getCCChatter())
|
||||
|
||||
|
||||
def blather(self, task):
|
||||
now = globalClock.getFrameTime()
|
||||
if now < self.nextChatTime:
|
||||
return Task.cont
|
||||
|
||||
self.getLatestChatter()
|
||||
if self.character.lostInterest():
|
||||
self.leave()
|
||||
return Task.done
|
||||
|
||||
if not self.chatter:
|
||||
self.notify.debug('I do not want to talk')
|
||||
return Task.done
|
||||
|
||||
if not self.character.getNearbyAvatars():
|
||||
return Task.cont
|
||||
|
||||
target = self.character.getNearbyAvatars()[0]
|
||||
if self.lastChatTarget != target:
|
||||
self.lastChatTarget = target
|
||||
category = CCharChatter.GREETING
|
||||
else:
|
||||
category = CCharChatter.COMMENT
|
||||
self.setCorrectChatter()
|
||||
if category == self.lastMessage[0] and len(self.chatter[category]) > 1:
|
||||
msg = self.lastMessage[1]
|
||||
lastMsgIndex = self.lastMessage[1]
|
||||
if lastMsgIndex < len(self.chatter[category]) and lastMsgIndex >= 0:
|
||||
while self.chatter[category][msg] == self.chatter[category][lastMsgIndex]:
|
||||
msg = self.pickMsg(category)
|
||||
if not msg:
|
||||
break
|
||||
continue
|
||||
else:
|
||||
msg = self.pickMsg(category)
|
||||
else:
|
||||
msg = self.pickMsg(category)
|
||||
if msg == None:
|
||||
self.notify.debug('I do not want to talk')
|
||||
return Task.done
|
||||
|
||||
self.character.sendUpdate('setChat', [
|
||||
category,
|
||||
msg,
|
||||
target])
|
||||
self.lastMessage = [
|
||||
category,
|
||||
msg]
|
||||
self.nextChatTime = now + 8.0 + random.random() * 4.0
|
||||
return Task.cont
|
||||
|
||||
|
||||
def leave(self):
|
||||
if self.chatter != None:
|
||||
category = CCharChatter.GOODBYE
|
||||
msg = random.randint(0, len(self.chatter[CCharChatter.GOODBYE]) - 1)
|
||||
target = self.character.getNearbyAvatars()[0]
|
||||
self.character.sendUpdate('setChat', [
|
||||
category,
|
||||
msg,
|
||||
target])
|
||||
|
||||
taskMgr.doMethodLater(1, self.doneHandler, self.character.taskName('waitToFinish'))
|
||||
|
||||
|
||||
def exit(self):
|
||||
StateData.StateData.exit(self)
|
||||
taskMgr.remove(self._CharChattyStateAI__chatTaskName)
|
||||
|
||||
|
||||
def doneHandler(self, task):
|
||||
doneStatus = { }
|
||||
doneStatus['state'] = 'chatty'
|
||||
doneStatus['status'] = 'done'
|
||||
messenger.send(self._CharChattyStateAI__doneEvent, [
|
||||
doneStatus])
|
||||
return Task.done
|
||||
|
||||
|
||||
|
||||
class CharWalkStateAI(StateData.StateData):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CharWalkStateAI')
|
||||
|
||||
def __init__(self, doneEvent, character, diffPath = None):
|
||||
StateData.StateData.__init__(self, doneEvent)
|
||||
self._CharWalkStateAI__doneEvent = doneEvent
|
||||
self.character = character
|
||||
if diffPath == None:
|
||||
self.paths = CCharPaths.getPaths(character.getName(), character.getCCLocation())
|
||||
else:
|
||||
self.paths = CCharPaths.getPaths(diffPath, character.getCCLocation())
|
||||
self.speed = character.walkSpeed()
|
||||
self._CharWalkStateAI__lastWalkNode = CCharPaths.startNode
|
||||
self._CharWalkStateAI__curWalkNode = CCharPaths.startNode
|
||||
|
||||
|
||||
def enter(self):
|
||||
destNode = self._CharWalkStateAI__lastWalkNode
|
||||
choices = CCharPaths.getAdjacentNodes(self._CharWalkStateAI__curWalkNode, self.paths)
|
||||
if len(choices) == 1:
|
||||
destNode = choices[0]
|
||||
else:
|
||||
while destNode == self._CharWalkStateAI__lastWalkNode:
|
||||
destNode = random.choice(CCharPaths.getAdjacentNodes(self._CharWalkStateAI__curWalkNode, self.paths))
|
||||
self.notify.debug('Walking ' + self.character.getName() + '... from ' + str(self._CharWalkStateAI__curWalkNode) + '(' + str(CCharPaths.getNodePos(self._CharWalkStateAI__curWalkNode, self.paths)) + ') to ' + str(destNode) + '(' + str(CCharPaths.getNodePos(destNode, self.paths)) + ')')
|
||||
self.character.sendUpdate('setWalk', [
|
||||
self._CharWalkStateAI__curWalkNode,
|
||||
destNode,
|
||||
globalClockDelta.getRealNetworkTime()])
|
||||
duration = CCharPaths.getWalkDuration(self._CharWalkStateAI__curWalkNode, destNode, self.speed, self.paths)
|
||||
t = taskMgr.doMethodLater(duration, self.doneHandler, self.character.taskName(self.character.getName() + 'DoneWalking'))
|
||||
t.newWalkNode = destNode
|
||||
self.destNode = destNode
|
||||
|
||||
|
||||
def exit(self):
|
||||
StateData.StateData.exit(self)
|
||||
taskMgr.remove(self.character.taskName(self.character.getName() + 'DoneWalking'))
|
||||
|
||||
|
||||
def getDestNode(self):
|
||||
if hasattr(self, 'destNode') and self.destNode:
|
||||
return self.destNode
|
||||
else:
|
||||
return self._CharWalkStateAI__curWalkNode
|
||||
|
||||
|
||||
def setCurNode(self, curWalkNode):
|
||||
self._CharWalkStateAI__curWalkNode = curWalkNode
|
||||
|
||||
|
||||
def doneHandler(self, task):
|
||||
self._CharWalkStateAI__lastWalkNode = self._CharWalkStateAI__curWalkNode
|
||||
self._CharWalkStateAI__curWalkNode = task.newWalkNode
|
||||
self.character.sendUpdate('setWalk', [
|
||||
self._CharWalkStateAI__curWalkNode,
|
||||
self._CharWalkStateAI__curWalkNode,
|
||||
globalClockDelta.getRealNetworkTime()])
|
||||
doneStatus = { }
|
||||
doneStatus['state'] = 'walk'
|
||||
doneStatus['status'] = 'done'
|
||||
messenger.send(self._CharWalkStateAI__doneEvent, [
|
||||
doneStatus])
|
||||
return Task.done
|
||||
|
||||
|
||||
|
||||
class CharFollowChipStateAI(StateData.StateData):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CharFollowChipStateAI')
|
||||
|
||||
def __init__(self, doneEvent, character, followedChar):
|
||||
StateData.StateData.__init__(self, doneEvent)
|
||||
self._CharFollowChipStateAI__doneEvent = doneEvent
|
||||
self.character = character
|
||||
self.followedChar = followedChar
|
||||
self.paths = CCharPaths.getPaths(character.getName(), character.getCCLocation())
|
||||
self.speed = character.walkSpeed()
|
||||
self._CharFollowChipStateAI__lastWalkNode = CCharPaths.startNode
|
||||
self._CharFollowChipStateAI__curWalkNode = CCharPaths.startNode
|
||||
|
||||
|
||||
def enter(self, chipDestNode):
|
||||
destNode = self._CharFollowChipStateAI__lastWalkNode
|
||||
choices = CCharPaths.getAdjacentNodes(self._CharFollowChipStateAI__curWalkNode, self.paths)
|
||||
if len(choices) == 1:
|
||||
destNode = choices[0]
|
||||
else:
|
||||
while destNode == self._CharFollowChipStateAI__lastWalkNode:
|
||||
destNode = random.choice(CCharPaths.getAdjacentNodes(self._CharFollowChipStateAI__curWalkNode, self.paths))
|
||||
destNode = chipDestNode
|
||||
self.notify.debug('Walking ' + self.character.getName() + '... from ' + str(self._CharFollowChipStateAI__curWalkNode) + '(' + str(CCharPaths.getNodePos(self._CharFollowChipStateAI__curWalkNode, self.paths)) + ') to ' + str(destNode) + '(' + str(CCharPaths.getNodePos(destNode, self.paths)) + ')')
|
||||
self.offsetDistance = ToontownGlobals.DaleOrbitDistance
|
||||
angle = random.randint(0, 359)
|
||||
self.offsetX = math.cos(deg2Rad(angle)) * self.offsetDistance
|
||||
self.offsetY = math.sin(deg2Rad(angle)) * self.offsetDistance
|
||||
self.character.sendUpdate('setFollowChip', [
|
||||
self._CharFollowChipStateAI__curWalkNode,
|
||||
destNode,
|
||||
globalClockDelta.getRealNetworkTime(),
|
||||
self.offsetX,
|
||||
self.offsetY])
|
||||
duration = CCharPaths.getWalkDuration(self._CharFollowChipStateAI__curWalkNode, destNode, self.speed, self.paths)
|
||||
t = taskMgr.doMethodLater(duration, self._CharFollowChipStateAI__doneHandler, self.character.taskName(self.character.getName() + 'DoneWalking'))
|
||||
t.newWalkNode = destNode
|
||||
|
||||
|
||||
def exit(self):
|
||||
StateData.StateData.exit(self)
|
||||
taskMgr.remove(self.character.taskName(self.character.getName() + 'DoneWalking'))
|
||||
|
||||
|
||||
def _CharFollowChipStateAI__doneHandler(self, task):
|
||||
self._CharFollowChipStateAI__lastWalkNode = self._CharFollowChipStateAI__curWalkNode
|
||||
self._CharFollowChipStateAI__curWalkNode = task.newWalkNode
|
||||
self.character.sendUpdate('setFollowChip', [
|
||||
self._CharFollowChipStateAI__curWalkNode,
|
||||
self._CharFollowChipStateAI__curWalkNode,
|
||||
globalClockDelta.getRealNetworkTime(),
|
||||
self.offsetX,
|
||||
self.offsetY])
|
||||
doneStatus = { }
|
||||
doneStatus['state'] = 'walk'
|
||||
doneStatus['status'] = 'done'
|
||||
messenger.send(self._CharFollowChipStateAI__doneEvent, [
|
||||
doneStatus])
|
||||
return Task.done
|
||||
|
||||
|
||||
|
||||
class ChipChattyStateAI(CharChattyStateAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('ChipChattyStateAI')
|
||||
|
||||
def setDaleId(self, daleId):
|
||||
self.daleId = daleId
|
||||
self.dale = simbase.air.doId2do.get(self.daleId)
|
||||
|
||||
|
||||
def blather(self, task):
|
||||
now = globalClock.getFrameTime()
|
||||
if now < self.nextChatTime:
|
||||
return Task.cont
|
||||
|
||||
self.getLatestChatter()
|
||||
if self.character.lostInterest():
|
||||
self.leave()
|
||||
return Task.done
|
||||
|
||||
if not self.chatter:
|
||||
self.notify.debug('I do not want to talk')
|
||||
return Task.done
|
||||
|
||||
if not self.character.getNearbyAvatars():
|
||||
return Task.cont
|
||||
|
||||
target = self.character.getNearbyAvatars()[0]
|
||||
if self.lastChatTarget != target:
|
||||
self.lastChatTarget = target
|
||||
category = CCharChatter.GREETING
|
||||
else:
|
||||
category = CCharChatter.COMMENT
|
||||
if category == self.lastMessage[0] and len(self.chatter[category]) > 1:
|
||||
msg = self.lastMessage[1]
|
||||
lastMsgIndex = self.lastMessage[1]
|
||||
if lastMsgIndex < len(self.chatter[category]) and lastMsgIndex >= 0:
|
||||
while self.chatter[category][msg] == self.chatter[category][lastMsgIndex]:
|
||||
msg = self.pickMsg(category)
|
||||
if not msg:
|
||||
break
|
||||
continue
|
||||
else:
|
||||
msg = self.pickMsg(category)
|
||||
else:
|
||||
msg = self.pickMsg(category)
|
||||
if msg == None:
|
||||
self.notify.debug('I do not want to talk')
|
||||
return Task.done
|
||||
|
||||
self.character.sendUpdate('setChat', [
|
||||
category,
|
||||
msg,
|
||||
target])
|
||||
if hasattr(self, 'dale') and self.dale:
|
||||
self.dale.sendUpdate('setChat', [
|
||||
category,
|
||||
msg,
|
||||
target])
|
||||
|
||||
self.lastMessage = [
|
||||
category,
|
||||
msg]
|
||||
self.nextChatTime = now + 8.0 + random.random() * 4.0
|
||||
return Task.cont
|
||||
|
||||
|
||||
def leave(self):
|
||||
if self.chatter != None:
|
||||
category = CCharChatter.GOODBYE
|
||||
msg = random.randint(0, len(self.chatter[CCharChatter.GOODBYE]) - 1)
|
||||
target = self.character.getNearbyAvatars()[0]
|
||||
self.character.sendUpdate('setChat', [
|
||||
category,
|
||||
msg,
|
||||
target])
|
||||
if hasattr(self, 'dale') and self.dale:
|
||||
self.dale.sendUpdate('setChat', [
|
||||
category,
|
||||
msg,
|
||||
target])
|
||||
|
||||
|
||||
taskMgr.doMethodLater(1, self.doneHandler, self.character.taskName('waitToFinish'))
|
||||
|
||||
|
|
@ -1,295 +0,0 @@
|
|||
import copy
|
||||
from direct.controls.ControlManager import CollisionHandlerRayStart
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
from direct.interval.IntervalGlobal import *
|
||||
from pandac.PandaModules import *
|
||||
import string
|
||||
|
||||
import CCharChatter
|
||||
import CCharPaths
|
||||
from otp.avatar import Avatar
|
||||
from toontown.char import CharDNA
|
||||
from toontown.char import DistributedChar
|
||||
from toontown.chat.ChatGlobals import *
|
||||
from toontown.effects import DustCloud
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase.TTLocalizer import Donald, DonaldDock, WesternPluto, Pluto
|
||||
|
||||
|
||||
class DistributedCCharBase(DistributedChar.DistributedChar):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCCharBase')
|
||||
|
||||
def __init__(self, cr, name, dnaName):
|
||||
try:
|
||||
self.DistributedCCharBase_initialized
|
||||
return
|
||||
except:
|
||||
self.DistributedCCharBase_initialized = 1
|
||||
|
||||
DistributedChar.DistributedChar.__init__(self, cr)
|
||||
dna = CharDNA.CharDNA()
|
||||
dna.newChar(dnaName)
|
||||
self.setDNA(dna)
|
||||
self.setName(name)
|
||||
self.setTransparency(TransparencyAttrib.MDual, 1)
|
||||
fadeIn = self.colorScaleInterval(0.5, Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0), blendType='easeInOut')
|
||||
fadeIn.start()
|
||||
self.diffPath = None
|
||||
self.transitionToCostume = 0
|
||||
self.__initCollisions()
|
||||
return
|
||||
|
||||
def __initCollisions(self):
|
||||
self.cSphere = CollisionSphere(0.0, 0.0, 0.0, 8.0)
|
||||
self.cSphere.setTangible(0)
|
||||
self.cSphereNode = CollisionNode(self.getName() + 'BlatherSphere')
|
||||
self.cSphereNode.addSolid(self.cSphere)
|
||||
self.cSphereNodePath = self.attachNewNode(self.cSphereNode)
|
||||
self.cSphereNodePath.hide()
|
||||
self.cSphereNode.setCollideMask(ToontownGlobals.WallBitmask)
|
||||
self.acceptOnce('enter' + self.cSphereNode.getName(), self.__handleCollisionSphereEnter)
|
||||
self.cRay = CollisionRay(0.0, 0.0, CollisionHandlerRayStart, 0.0, 0.0, -1.0)
|
||||
self.cRayNode = CollisionNode(self.getName() + 'cRay')
|
||||
self.cRayNode.addSolid(self.cRay)
|
||||
self.cRayNodePath = self.attachNewNode(self.cRayNode)
|
||||
self.cRayNodePath.hide()
|
||||
self.cRayBitMask = ToontownGlobals.FloorBitmask
|
||||
self.cRayNode.setFromCollideMask(self.cRayBitMask)
|
||||
self.cRayNode.setIntoCollideMask(BitMask32.allOff())
|
||||
self.lifter = CollisionHandlerFloor()
|
||||
self.lifter.setOffset(ToontownGlobals.FloorOffset)
|
||||
self.lifter.setReach(10.0)
|
||||
self.lifter.setMaxVelocity(0.0)
|
||||
self.lifter.addCollider(self.cRayNodePath, self)
|
||||
self.cTrav = base.localAvatar.cTrav
|
||||
|
||||
def __deleteCollisions(self):
|
||||
del self.cSphere
|
||||
del self.cSphereNode
|
||||
self.cSphereNodePath.removeNode()
|
||||
del self.cSphereNodePath
|
||||
self.cRay = None
|
||||
self.cRayNode = None
|
||||
self.cRayNodePath = None
|
||||
self.lifter = None
|
||||
self.cTrav = None
|
||||
return
|
||||
|
||||
def disable(self):
|
||||
self.stopBlink()
|
||||
self.ignoreAll()
|
||||
self.chatTrack.finish()
|
||||
del self.chatTrack
|
||||
if self.chatterDialogue:
|
||||
self.chatterDialogue.stop()
|
||||
del self.chatterDialogue
|
||||
DistributedChar.DistributedChar.disable(self)
|
||||
self.stopEarTask()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedCCharBase_deleted
|
||||
except:
|
||||
self.setParent(NodePath('Temp'))
|
||||
self.DistributedCCharBase_deleted = 1
|
||||
self.__deleteCollisions()
|
||||
DistributedChar.DistributedChar.delete(self)
|
||||
|
||||
def generate(self, diffPath = None):
|
||||
DistributedChar.DistributedChar.generate(self)
|
||||
if diffPath == None:
|
||||
self.setPos(CCharPaths.getNodePos(CCharPaths.startNode, CCharPaths.getPaths(self.getName(), self.getCCLocation())))
|
||||
else:
|
||||
self.setPos(CCharPaths.getNodePos(CCharPaths.startNode, CCharPaths.getPaths(diffPath, self.getCCLocation())))
|
||||
self.setHpr(0, 0, 0)
|
||||
self.setParent(ToontownGlobals.SPRender)
|
||||
self.startBlink()
|
||||
self.startEarTask()
|
||||
self.chatTrack = Sequence()
|
||||
self.chatterDialogue = None
|
||||
self.acceptOnce('enter' + self.cSphereNode.getName(), self.__handleCollisionSphereEnter)
|
||||
self.accept('exitSafeZone', self.__handleExitSafeZone)
|
||||
return
|
||||
|
||||
def __handleExitSafeZone(self):
|
||||
self.__handleCollisionSphereExit(None)
|
||||
return
|
||||
|
||||
def __handleCollisionSphereEnter(self, collEntry):
|
||||
self.notify.debug('Entering collision sphere...')
|
||||
self.sendUpdate('avatarEnter', [])
|
||||
self.accept('chatUpdate', self.__handleChatUpdate)
|
||||
self.accept('chatUpdateSC', self.__handleChatUpdateSC)
|
||||
self.accept('chatUpdateSCCustom', self.__handleChatUpdateSCCustom)
|
||||
self.accept('chatUpdateSCToontask', self.__handleChatUpdateSCToontask)
|
||||
self.nametag3d.setBin('transparent', 100)
|
||||
self.acceptOnce('exit' + self.cSphereNode.getName(), self.__handleCollisionSphereExit)
|
||||
|
||||
def __handleCollisionSphereExit(self, collEntry):
|
||||
self.notify.debug('Exiting collision sphere...')
|
||||
self.sendUpdate('avatarExit', [])
|
||||
self.ignore('chatUpdate')
|
||||
self.ignore('chatUpdateSC')
|
||||
self.ignore('chatUpdateSCCustom')
|
||||
self.ignore('chatUpdateSCToontask')
|
||||
self.acceptOnce('enter' + self.cSphereNode.getName(), self.__handleCollisionSphereEnter)
|
||||
|
||||
def __handleChatUpdate(self, msg, chatFlags):
|
||||
self.sendUpdate('setNearbyAvatarChat', [msg])
|
||||
|
||||
def __handleChatUpdateSC(self, msgIndex):
|
||||
self.sendUpdate('setNearbyAvatarSC', [msgIndex])
|
||||
|
||||
def __handleChatUpdateSCCustom(self, msgIndex):
|
||||
self.sendUpdate('setNearbyAvatarSCCustom', [msgIndex])
|
||||
|
||||
def __handleChatUpdateSCToontask(self, taskId, toNpcId, toonProgress, msgIndex):
|
||||
self.sendUpdate('setNearbyAvatarSCToontask', [taskId,
|
||||
toNpcId,
|
||||
toonProgress,
|
||||
msgIndex])
|
||||
|
||||
def makeTurnToHeadingTrack(self, heading):
|
||||
curHpr = self.getHpr()
|
||||
destHpr = self.getHpr()
|
||||
destHpr.setX(heading)
|
||||
if destHpr[0] - curHpr[0] > 180.0:
|
||||
destHpr.setX(destHpr[0] - 360)
|
||||
elif destHpr[0] - curHpr[0] < -180.0:
|
||||
destHpr.setX(destHpr[0] + 360)
|
||||
turnSpeed = 180.0
|
||||
time = abs(destHpr[0] - curHpr[0]) / turnSpeed
|
||||
turnTracks = Parallel()
|
||||
if time > 0.2:
|
||||
turnTracks.append(Sequence(Func(self.loop, 'walk'), Wait(time), Func(self.loop, 'neutral')))
|
||||
turnTracks.append(LerpHprInterval(self, time, destHpr, name='lerp' + self.getName() + 'Hpr'))
|
||||
return turnTracks
|
||||
|
||||
def setChat(self, category, msg, avId):
|
||||
if avId in self.cr.doId2do:
|
||||
avatar = self.cr.doId2do[avId]
|
||||
chatter = CCharChatter.getChatter(self.getName(), self.getCCChatter())
|
||||
if category >= len(chatter):
|
||||
self.notify.debug("Chatter's changed")
|
||||
return
|
||||
elif len(chatter[category]) <= msg:
|
||||
self.notify.debug("Chatter's changed")
|
||||
return
|
||||
str = chatter[category][msg]
|
||||
if '%' in str:
|
||||
str = copy.deepcopy(str)
|
||||
avName = avatar.getName()
|
||||
str = str.replace('%', avName)
|
||||
track = Sequence()
|
||||
if category != CCharChatter.GOODBYE:
|
||||
curHpr = self.getHpr()
|
||||
self.headsUp(avatar)
|
||||
destHpr = self.getHpr()
|
||||
self.setHpr(curHpr)
|
||||
track.append(self.makeTurnToHeadingTrack(destHpr[0]))
|
||||
if self.getName() == Donald or self.getName() == WesternPluto or self.getName() == Pluto:
|
||||
chatFlags = CFThought | CFTimeout
|
||||
if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
|
||||
holidayIds = base.cr.newsManager.getHolidayIdList()
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds:
|
||||
if self.getName() == Pluto:
|
||||
chatFlags = CFTimeout | CFSpeech
|
||||
elif self.getName() == DonaldDock:
|
||||
chatFlags = CFTimeout | CFSpeech
|
||||
self.nametag3d.hide()
|
||||
else:
|
||||
chatFlags = CFTimeout | CFSpeech
|
||||
self.chatterDialogue = self.getChatterDialogue(category, msg)
|
||||
track.append(Func(self.setChatAbsolute, str, chatFlags, self.chatterDialogue))
|
||||
self.chatTrack.finish()
|
||||
self.chatTrack = track
|
||||
self.chatTrack.start()
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
pass
|
||||
|
||||
def walkSpeed(self):
|
||||
return 0.1
|
||||
|
||||
def enableRaycast(self, enable = 1):
|
||||
if not self.cTrav or not hasattr(self, 'cRayNode') or not self.cRayNode:
|
||||
self.notify.debug('raycast info not found for ' + self.getName())
|
||||
return
|
||||
self.cTrav.removeCollider(self.cRayNodePath)
|
||||
if enable:
|
||||
if self.notify.getDebug():
|
||||
self.notify.debug('enabling raycast for ' + self.getName())
|
||||
self.cTrav.addCollider(self.cRayNodePath, self.lifter)
|
||||
elif self.notify.getDebug():
|
||||
self.notify.debug('disabling raycast for ' + self.getName())
|
||||
|
||||
def getCCLocation(self):
|
||||
return 0
|
||||
|
||||
def getCCChatter(self):
|
||||
self.handleHolidays()
|
||||
return self.CCChatter
|
||||
|
||||
def handleHolidays(self):
|
||||
self.CCChatter = 0
|
||||
if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
|
||||
holidayIds = base.cr.newsManager.getHolidayIdList()
|
||||
if ToontownGlobals.CRASHED_LEADERBOARD in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.CRASHED_LEADERBOARD
|
||||
elif ToontownGlobals.CIRCUIT_RACING_EVENT in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.CIRCUIT_RACING_EVENT
|
||||
elif ToontownGlobals.WINTER_CAROLING in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.WINTER_CAROLING
|
||||
elif ToontownGlobals.WINTER_DECORATIONS in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.WINTER_DECORATIONS
|
||||
elif ToontownGlobals.WACKY_WINTER_CAROLING in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.WACKY_WINTER_CAROLING
|
||||
elif ToontownGlobals.WACKY_WINTER_DECORATIONS in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.WACKY_WINTER_DECORATIONS
|
||||
elif ToontownGlobals.VALENTINES_DAY in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.VALENTINES_DAY
|
||||
elif ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.APRIL_FOOLS_COSTUMES
|
||||
elif ToontownGlobals.SILLY_CHATTER_ONE in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_ONE
|
||||
elif ToontownGlobals.SILLY_CHATTER_TWO in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_TWO
|
||||
elif ToontownGlobals.SILLY_CHATTER_THREE in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_THREE
|
||||
elif ToontownGlobals.SILLY_CHATTER_FOUR in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_FOUR
|
||||
elif ToontownGlobals.SILLY_CHATTER_FIVE in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_FOUR
|
||||
elif ToontownGlobals.HALLOWEEN_COSTUMES in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.HALLOWEEN_COSTUMES
|
||||
elif ToontownGlobals.SPOOKY_COSTUMES in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.SPOOKY_COSTUMES
|
||||
elif ToontownGlobals.SELLBOT_FIELD_OFFICE in holidayIds:
|
||||
self.CCChatter = ToontownGlobals.SELLBOT_FIELD_OFFICE
|
||||
|
||||
def fadeAway(self):
|
||||
fadeOut = self.colorScaleInterval(0.5, Vec4(1, 1, 1, 0.5), startColorScale=Vec4(1, 1, 1, 1), blendType='easeInOut')
|
||||
fadeOut.start()
|
||||
self.loop('neutral')
|
||||
if self.fsm:
|
||||
self.fsm.addState(State.State('TransitionToCostume', self.enterTransitionToCostume, self.exitTransitionToCostume, ['Off']))
|
||||
self.fsm.request('TransitionToCostume', force=1)
|
||||
self.ignoreAll()
|
||||
|
||||
def enterTransitionToCostume(self):
|
||||
|
||||
def getDustCloudIval():
|
||||
dustCloud = DustCloud.DustCloud(fBillboard=0, wantSound=1)
|
||||
dustCloud.setBillboardAxis(2.0)
|
||||
dustCloud.setZ(4)
|
||||
dustCloud.setScale(0.6)
|
||||
dustCloud.createTrack()
|
||||
return Sequence(Func(dustCloud.reparentTo, self), dustCloud.track, Func(dustCloud.destroy), name='dustCloadIval')
|
||||
|
||||
dust = getDustCloudIval()
|
||||
dust.start()
|
||||
|
||||
def exitTransitionToCostume(self):
|
||||
pass
|
|
@ -1,208 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
from direct.distributed.ClockDelta import *
|
||||
from otp.avatar import DistributedAvatarAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
||||
class DistributedCCharBaseAI(DistributedAvatarAI.DistributedAvatarAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCCharBaseAI')
|
||||
|
||||
def __init__(self, air, name):
|
||||
DistributedAvatarAI.DistributedAvatarAI.__init__(self, air)
|
||||
self.setName(name)
|
||||
self.exitOff()
|
||||
self.transitionToCostume = 0
|
||||
self.diffPath = None
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.ignoreAll()
|
||||
DistributedAvatarAI.DistributedAvatarAI.delete(self)
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
self._DistributedCCharBaseAI__initAttentionSpan()
|
||||
self._DistributedCCharBaseAI__clearNearbyAvatars()
|
||||
|
||||
|
||||
def avatarEnter(self):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
self.notify.debug('adding avatar ' + str(avId) + ' to the nearby avatar list')
|
||||
if avId not in self.nearbyAvatars:
|
||||
self.nearbyAvatars.append(avId)
|
||||
else:
|
||||
self.air.writeServerEvent('suspicious', avId, 'CCharBase.avatarEnter')
|
||||
self.notify.warning('Avatar %s already in nearby avatars!' % avId)
|
||||
self.nearbyAvatarInfoDict[avId] = { }
|
||||
self.nearbyAvatarInfoDict[avId]['enterTime'] = globalClock.getRealTime()
|
||||
self.nearbyAvatarInfoDict[avId]['lastChatTime'] = 0
|
||||
self.sortNearbyAvatars()
|
||||
self._DistributedCCharBaseAI__interestingAvatarEventOccured()
|
||||
avExitEvent = self.air.getAvatarExitEvent(avId)
|
||||
self.acceptOnce(avExitEvent, self._DistributedCCharBaseAI__handleExitedAvatar, [
|
||||
avId])
|
||||
self.avatarEnterNextState()
|
||||
|
||||
|
||||
def avatarExit(self):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
self._DistributedCCharBaseAI__doAvatarExit(avId)
|
||||
|
||||
|
||||
def _DistributedCCharBaseAI__doAvatarExit(self, avId):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
self.notify.debug('removing avatar ' + str(avId) + ' from the nearby avatar list')
|
||||
if avId not in self.nearbyAvatars:
|
||||
self.notify.debug('avatar ' + str(avId) + ' not in the nearby avatar list')
|
||||
else:
|
||||
avExitEvent = self.air.getAvatarExitEvent(avId)
|
||||
self.ignore(avExitEvent)
|
||||
del self.nearbyAvatarInfoDict[avId]
|
||||
self.nearbyAvatars.remove(avId)
|
||||
self.avatarExitNextState()
|
||||
|
||||
|
||||
def avatarEnterNextState():
|
||||
pass
|
||||
|
||||
|
||||
def avatarExitNextState():
|
||||
pass
|
||||
|
||||
|
||||
def _DistributedCCharBaseAI__clearNearbyAvatars(self):
|
||||
self.nearbyAvatars = []
|
||||
self.nearbyAvatarInfoDict = { }
|
||||
|
||||
|
||||
def sortNearbyAvatars(self):
|
||||
|
||||
def nAv_compare(a, b, nAvIDict = self.nearbyAvatarInfoDict):
|
||||
tsA = nAvIDict[a]['enterTime']
|
||||
tsB = nAvIDict[b]['enterTime']
|
||||
if tsA == tsB:
|
||||
return 0
|
||||
elif tsA < tsB:
|
||||
return -1
|
||||
else:
|
||||
return 1
|
||||
|
||||
self.nearbyAvatars.sort(nAv_compare)
|
||||
|
||||
|
||||
def getNearbyAvatars(self):
|
||||
return self.nearbyAvatars
|
||||
|
||||
|
||||
def _DistributedCCharBaseAI__avatarSpoke(self, avId):
|
||||
now = globalClock.getRealTime()
|
||||
if avId in self.nearbyAvatarInfoDict:
|
||||
self.nearbyAvatarInfoDict[avId]['lastChatTime'] = now
|
||||
self._DistributedCCharBaseAI__interestingAvatarEventOccured()
|
||||
|
||||
|
||||
|
||||
def _DistributedCCharBaseAI__initAttentionSpan(self):
|
||||
self._DistributedCCharBaseAI__avatarTimeoutBase = 0
|
||||
|
||||
|
||||
def _DistributedCCharBaseAI__interestingAvatarEventOccured(self, t = None):
|
||||
if t == None:
|
||||
t = globalClock.getRealTime()
|
||||
|
||||
self._DistributedCCharBaseAI__avatarTimeoutBase = t
|
||||
|
||||
|
||||
def lostInterest(self):
|
||||
now = globalClock.getRealTime()
|
||||
if now > self._DistributedCCharBaseAI__avatarTimeoutBase + 50.0:
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def _DistributedCCharBaseAI__handleExitedAvatar(self, avId):
|
||||
self._DistributedCCharBaseAI__doAvatarExit(avId)
|
||||
|
||||
|
||||
def setNearbyAvatarChat(self, msg):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
self.notify.debug('setNearbyAvatarChat: avatar ' + str(avId) + ' said ' + str(msg))
|
||||
self._DistributedCCharBaseAI__avatarSpoke(avId)
|
||||
self.air.doFind('DistributedSmartNPC').sendUpdate('talkMessage', [avId, msg])
|
||||
|
||||
|
||||
def setNearbyAvatarSC(self, msgIndex):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
self.notify.debug('setNearbyAvatarSC: avatar %s said SpeedChat phrase %s' % (avId, msgIndex))
|
||||
self._DistributedCCharBaseAI__avatarSpoke(avId)
|
||||
|
||||
|
||||
def setNearbyAvatarSCCustom(self, msgIndex):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
self.notify.debug('setNearbyAvatarSCCustom: avatar %s said custom SpeedChat phrase %s' % (avId, msgIndex))
|
||||
self._DistributedCCharBaseAI__avatarSpoke(avId)
|
||||
|
||||
|
||||
def setNearbyAvatarSCToontask(self, taskId, toNpcId, toonProgress, msgIndex):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
self.notify.debug('setNearbyAvatarSCToontask: avatar %s said %s' % (avId, (taskId, toNpcId, toonProgress, msgIndex)))
|
||||
self._DistributedCCharBaseAI__avatarSpoke(avId)
|
||||
|
||||
|
||||
def getWalk(self):
|
||||
return ('', '', 0)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return 0.10000000000000001
|
||||
|
||||
|
||||
def handleHolidays(self):
|
||||
self.CCChatter = 0
|
||||
if hasattr(simbase.air, 'holidayManager'):
|
||||
if ToontownGlobals.CRASHED_LEADERBOARD in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.CRASHED_LEADERBOARD
|
||||
elif ToontownGlobals.CIRCUIT_RACING_EVENT in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.CIRCUIT_RACING_EVENT
|
||||
elif ToontownGlobals.WINTER_CAROLING in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.WINTER_CAROLING
|
||||
elif ToontownGlobals.WINTER_DECORATIONS in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.WINTER_DECORATIONS
|
||||
elif ToontownGlobals.VALENTINES_DAY in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.VALENTINES_DAY
|
||||
elif ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.APRIL_FOOLS_COSTUMES
|
||||
elif ToontownGlobals.SILLY_CHATTER_ONE in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_ONE
|
||||
elif ToontownGlobals.SILLY_CHATTER_TWO in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_TWO
|
||||
elif ToontownGlobals.SILLY_CHATTER_THREE in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_THREE
|
||||
elif ToontownGlobals.SILLY_CHATTER_FOUR in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_FOUR
|
||||
elif ToontownGlobals.SILLY_CHATTER_FIVE in simbase.air.holidayManager.currentHolidays:
|
||||
self.CCChatter = ToontownGlobals.SILLY_CHATTER_FOUR
|
||||
|
||||
|
||||
|
||||
|
||||
def getCCLocation(self):
|
||||
return 0
|
||||
|
||||
|
||||
def getCCChatter(self):
|
||||
self.handleHolidays()
|
||||
return self.CCChatter
|
||||
|
||||
|
||||
def fadeAway(self):
|
||||
self.sendUpdate('fadeAway', [])
|
||||
|
||||
|
||||
def transitionCostume(self):
|
||||
self.transitionToCostume = 1
|
||||
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
from direct.showbase.ShowBaseGlobal import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class DistributedChip(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedChip')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedChip_initialized
|
||||
except:
|
||||
self.DistributedChip_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Chip, 'ch')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
del self.walkDoneEvent
|
||||
del self.walk
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedChip_deleted
|
||||
except:
|
||||
del self.fsm
|
||||
self.DistributedChip_deleted = 1
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self)
|
||||
name = self.getName()
|
||||
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.ChipSpeed
|
|
@ -1,165 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import CharStateDatasAI
|
||||
|
||||
class DistributedChipAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedChipAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.Chip)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedChipAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'Walk']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'Walk']),
|
||||
State.State('Walk', self.enterWalk, self.exitWalk, [
|
||||
'Lonely',
|
||||
'Chatty'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.dale = None
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
name = self.getName()
|
||||
self.lonelyDoneEvent = self.taskName(name + '-lonely-done')
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(self.lonelyDoneEvent, self)
|
||||
self.chattyDoneEvent = self.taskName(name + '-chatty-done')
|
||||
self.chatty = CharStateDatasAI.ChipChattyStateAI(self.chattyDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.ChipSpeed
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedChipAI__decideNextState(self, doneStatus):
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'walk' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.lonely.enter()
|
||||
self.acceptOnce(self.lonelyDoneEvent, self._DistributedChipAI__decideNextState)
|
||||
if self.dale:
|
||||
self.dale.chipEnteringState(self.fsm.getCurrentState().getName())
|
||||
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.ignore(self.lonelyDoneEvent)
|
||||
self.lonely.exit()
|
||||
if self.dale:
|
||||
self.dale.chipLeavingState(self.fsm.getCurrentState().getName())
|
||||
|
||||
|
||||
|
||||
def _DistributedChipAI__goForAWalk(self, task):
|
||||
self.notify.debug('going for a walk')
|
||||
self.fsm.request('Walk')
|
||||
return Task.done
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.chatty.enter()
|
||||
self.acceptOnce(self.chattyDoneEvent, self._DistributedChipAI__decideNextState)
|
||||
if self.dale:
|
||||
self.dale.chipEnteringState(self.fsm.getCurrentState().getName())
|
||||
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.ignore(self.chattyDoneEvent)
|
||||
self.chatty.exit()
|
||||
if self.dale:
|
||||
self.dale.chipLeavingState(self.fsm.getCurrentState().getName())
|
||||
|
||||
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('going for a walk')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self._DistributedChipAI__decideNextState)
|
||||
if self.dale:
|
||||
self.dale.chipEnteringState(self.fsm.getCurrentState().getName())
|
||||
|
||||
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
if self.dale:
|
||||
self.dale.chipLeavingState(self.fsm.getCurrentState().getName())
|
||||
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: in walk state')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
|
||||
def setDaleId(self, daleId):
|
||||
self.daleId = daleId
|
||||
self.dale = self.air.doId2do.get(daleId)
|
||||
self.chatty.setDaleId(self.daleId)
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
from direct.showbase.ShowBaseGlobal import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.hood import TTHood
|
||||
|
||||
class DistributedDaisy(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDaisy')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedDaisy_initialized
|
||||
except:
|
||||
self.DistributedDaisy_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Daisy, 'dd')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
del self.walkDoneEvent
|
||||
del self.walk
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedDaisy_deleted
|
||||
except:
|
||||
del self.fsm
|
||||
self.DistributedDaisy_deleted = 1
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self, self.diffPath)
|
||||
name = self.getName()
|
||||
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self, self.diffPath)
|
||||
self.fsm.request('Neutral')
|
||||
return
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.DaisySpeed
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBase.DistributedCCharBase.handleHolidays(self)
|
||||
if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
|
||||
holidayIds = base.cr.newsManager.getHolidayIdList()
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds and isinstance(self.cr.playGame.hood, TTHood.TTHood):
|
||||
self.diffPath = TTLocalizer.Mickey
|
|
@ -1,183 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import CharStateDatasAI
|
||||
|
||||
class DistributedDaisyAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDaisyAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.Daisy)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedDaisyAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely',
|
||||
'TransitionToCostume',
|
||||
'Walk']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Walk', self.enterWalk, self.exitWalk, [
|
||||
'Lonely',
|
||||
'Chatty',
|
||||
'TransitionToCostume']),
|
||||
State.State('TransitionToCostume', self.enterTransitionToCostume, self.exitTransitionToCostume, [
|
||||
'Off'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
name = self.getName()
|
||||
self.lonelyDoneEvent = self.taskName(name + '-lonely-done')
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(self.lonelyDoneEvent, self)
|
||||
self.chattyDoneEvent = self.taskName(name + '-chatty-done')
|
||||
self.chatty = CharStateDatasAI.CharChattyStateAI(self.chattyDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self, self.diffPath)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.DaisySpeed
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedDaisyAI__decideNextState(self, doneStatus):
|
||||
if self.transitionToCostume == 1:
|
||||
curWalkNode = self.walk.getDestNode()
|
||||
if simbase.air.holidayManager:
|
||||
if ToontownGlobals.HALLOWEEN_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
elif ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no costume holiday')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no holiday Manager')
|
||||
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'walk' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.lonely.enter()
|
||||
self.acceptOnce(self.lonelyDoneEvent, self._DistributedDaisyAI__decideNextState)
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.ignore(self.lonelyDoneEvent)
|
||||
self.lonely.exit()
|
||||
|
||||
|
||||
def _DistributedDaisyAI__goForAWalk(self, task):
|
||||
self.notify.debug('going for a walk')
|
||||
self.fsm.request('Walk')
|
||||
return Task.done
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.chatty.enter()
|
||||
self.acceptOnce(self.chattyDoneEvent, self._DistributedDaisyAI__decideNextState)
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.ignore(self.chattyDoneEvent)
|
||||
self.chatty.exit()
|
||||
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('going for a walk')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self._DistributedDaisyAI__decideNextState)
|
||||
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: in walk state')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
|
||||
def enterTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.handleHolidays(self)
|
||||
if hasattr(simbase.air, 'holidayManager'):
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays:
|
||||
if simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES] != None and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].getRunningState():
|
||||
self.diffPath = TTLocalizer.Mickey
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
from direct.showbase.ShowBaseGlobal import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class DistributedDale(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDale')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedDale_initialized
|
||||
except:
|
||||
self.DistributedDale_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Dale, 'da')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
del self.walkDoneEvent
|
||||
if self.walk:
|
||||
self.walk.exit()
|
||||
del self.walk
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedDale_deleted
|
||||
except:
|
||||
del self.fsm
|
||||
self.DistributedDale_deleted = 1
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self)
|
||||
self.setX(self.getX() + ToontownGlobals.DaleOrbitDistance)
|
||||
name = self.getName()
|
||||
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def announceGenerate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.announceGenerate(self)
|
||||
self.walk = CharStateDatas.CharFollowChipState(self.walkDoneEvent, self, self.chipId)
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp, offsetX = 0, offsetY = 0):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp, offsetX, offsetY)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.DaleSpeed
|
||||
|
||||
def setFollowChip(self, srcNode, destNode, timestamp, offsetX, offsetY):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp, offsetX, offsetY)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def setChipId(self, chipId):
|
||||
self.chipId = chipId
|
|
@ -1,176 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import CharStateDatasAI
|
||||
|
||||
class DistributedDaleAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDaleAI')
|
||||
|
||||
def __init__(self, air, chipId):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.Dale)
|
||||
self.chipId = chipId
|
||||
self.chip = air.doId2do.get(chipId)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedDaleAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'FollowChip',
|
||||
'Walk']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'FollowChip',
|
||||
'Walk']),
|
||||
State.State('Walk', self.enterWalk, self.exitWalk, [
|
||||
'Lonely',
|
||||
'Chatty']),
|
||||
State.State('FollowChip', self.enterFollowChip, self.exitFollowChip, [
|
||||
'Lonely',
|
||||
'Chatty',
|
||||
'FollowChip'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(None, self)
|
||||
self.chatty = CharStateDatasAI.CharChattyStateAI(None, self)
|
||||
self.followChip = CharStateDatasAI.CharFollowChipStateAI(None, self, self.chip)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.DaleSpeed
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedDaleAI__decideNextState(self, doneStatus):
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'walk' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.lonely.enter()
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.lonely.exit()
|
||||
|
||||
|
||||
def _DistributedDaleAI__goForAWalk(self, task):
|
||||
self.notify.debug('going for a walk')
|
||||
self.fsm.request('Walk')
|
||||
return Task.done
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.chatty.enter()
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.chatty.exit()
|
||||
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('going for a walk')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self._DistributedDaleAI__decideNextState)
|
||||
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
|
||||
def enterFollowChip(self):
|
||||
self.notify.debug('enterFollowChip')
|
||||
walkState = self.chip.walk
|
||||
destNode = walkState.getDestNode()
|
||||
self.followChip.enter(destNode)
|
||||
|
||||
|
||||
def exitFollowChip(self):
|
||||
self.notify.debug('exitFollowChip')
|
||||
self.followChip.exit()
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
if False:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: in walk state')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
def chipEnteringState(self, newState):
|
||||
if newState == 'Walk':
|
||||
self.doFollowChip()
|
||||
|
||||
|
||||
|
||||
def chipLeavingState(self, oldState):
|
||||
pass
|
||||
|
||||
|
||||
def doFollowChip(self):
|
||||
walkState = self.chip.walk
|
||||
destNode = walkState.getDestNode()
|
||||
self.fsm.request('FollowChip')
|
||||
|
||||
|
||||
def doChatty(self):
|
||||
pass
|
||||
|
||||
|
||||
def getChipId(self):
|
||||
return self.chipId
|
||||
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
import CCharChatter
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.hood import GSHood
|
||||
|
||||
class DistributedDonald(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDonald')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedDonald_initialized
|
||||
except:
|
||||
self.DistributedDonald_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Donald, 'd')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
del self.walkDoneEvent
|
||||
del self.walk
|
||||
del self.walkStartTrack
|
||||
del self.neutralStartTrack
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedDonald_deleted
|
||||
except:
|
||||
self.DistributedDonald_deleted = 1
|
||||
del self.fsm
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self, self.diffPath)
|
||||
name = self.getName()
|
||||
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self, self.diffPath)
|
||||
self.walkStartTrack = self.actorInterval('trans-back')
|
||||
self.neutralStartTrack = self.actorInterval('trans')
|
||||
self.fsm.request('Neutral')
|
||||
return
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.notify.debug('Neutral ' + self.getName() + '...')
|
||||
self.neutral.enter(startTrack=self.neutralStartTrack, playRate=0.5)
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('Walking ' + self.getName() + '...')
|
||||
self.walk.enter(startTrack=self.walkStartTrack)
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.DonaldSpeed
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBase.DistributedCCharBase.handleHolidays(self)
|
||||
if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
|
||||
holidayIds = base.cr.newsManager.getHolidayIdList()
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds and isinstance(self.cr.playGame.hood, GSHood.GSHood):
|
||||
self.diffPath = TTLocalizer.Goofy
|
||||
|
||||
def getCCLocation(self):
|
||||
if self.diffPath != None:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
return
|
||||
|
||||
def getCCChatter(self):
|
||||
self.handleHolidays()
|
||||
return self.CCChatter
|
|
@ -1,190 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import CharStateDatasAI
|
||||
|
||||
class DistributedDonaldAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDonaldAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.Donald)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedDonaldAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely',
|
||||
'TransitionToCostume',
|
||||
'Walk']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Walk', self.enterWalk, self.exitWalk, [
|
||||
'Lonely',
|
||||
'Chatty',
|
||||
'TransitionToCostume']),
|
||||
State.State('TransitionToCostume', self.enterTransitionToCostume, self.exitTransitionToCostume, [
|
||||
'Off'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
name = self.getName()
|
||||
self.lonelyDoneEvent = self.taskName(name + '-lonely-done')
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(self.lonelyDoneEvent, self)
|
||||
self.chattyDoneEvent = self.taskName(name + '-chatty-done')
|
||||
self.chatty = CharStateDatasAI.CharChattyStateAI(self.chattyDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self, self.diffPath)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.DonaldSpeed
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedDonaldAI__decideNextState(self, doneStatus):
|
||||
if self.transitionToCostume == 1:
|
||||
curWalkNode = self.walk.getDestNode()
|
||||
if simbase.air.holidayManager:
|
||||
if ToontownGlobals.HALLOWEEN_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
elif ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no costume holiday')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no holiday Manager')
|
||||
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'walk' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.lonely.enter()
|
||||
self.acceptOnce(self.lonelyDoneEvent, self._DistributedDonaldAI__decideNextState)
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.ignore(self.lonelyDoneEvent)
|
||||
self.lonely.exit()
|
||||
|
||||
|
||||
def _DistributedDonaldAI__goForAWalk(self, task):
|
||||
self.notify.debug('going for a walk')
|
||||
self.fsm.request('Walk')
|
||||
return Task.done
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.chatty.enter()
|
||||
self.acceptOnce(self.chattyDoneEvent, self._DistributedDonaldAI__decideNextState)
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.ignore(self.chattyDoneEvent)
|
||||
self.chatty.exit()
|
||||
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('going for a walk')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self._DistributedDonaldAI__decideNextState)
|
||||
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: in walk state')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.handleHolidays(self)
|
||||
if hasattr(simbase.air, 'holidayManager'):
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays:
|
||||
if simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES] != None and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].getRunningState():
|
||||
self.diffPath = TTLocalizer.Goofy
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def getCCLocation(self):
|
||||
if self.diffPath != None:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
def enterTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
import CharStateDatas
|
||||
from direct.fsm import StateData
|
||||
from direct.task import Task
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class DistributedDonaldDock(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDonaldDock')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedDonaldDock_initialized
|
||||
except:
|
||||
self.DistributedDonaldDock_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.DonaldDock, 'dw')
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedDonaldDock', [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Off'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.nametag.setText(TTLocalizer.Donald)
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
taskMgr.remove('enterNeutralTask')
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedDonaldDock_deleted
|
||||
except:
|
||||
self.DistributedDonaldDock_deleted = 1
|
||||
del self.fsm
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self)
|
||||
boat = base.cr.playGame.hood.loader.boat
|
||||
self.setPos(0, -1, 3.95)
|
||||
self.reparentTo(boat)
|
||||
self.neutralDoneEvent = self.taskName('DonaldDock-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.notify.debug('Neutral ' + self.getName() + '...')
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
|
@ -1,119 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
import CharStateDatasAI
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class DistributedDonaldDockAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDonaldDockAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.DonaldDock)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedDonaldDockAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely',
|
||||
'TransitionToCostume']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'TransitionToCostume']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'TransitionToCostume']),
|
||||
State.State('TransitionToCostume', self.enterTransitionToCostume, self.exitTransitionToCostume, [
|
||||
'Off'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
self.lonelyDoneEvent = self.taskName('DonaldDock-lonely-done')
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(self.lonelyDoneEvent, self)
|
||||
self.chattyDoneEvent = self.taskName('DonaldDock-chatty-done')
|
||||
self.chatty = CharStateDatasAI.CharChattyStateAI(self.chattyDoneEvent, self)
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedDonaldDockAI__decideNextState(self, doneStatus):
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.notify.debug('Entering Lonely')
|
||||
self.lonely.enter()
|
||||
self.acceptOnce(self.lonelyDoneEvent, self._DistributedDonaldDockAI__decideNextState)
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.notify.debug('Exiting Lonely')
|
||||
self.ignore(self.lonelyDoneEvent)
|
||||
self.lonely.exit()
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.notify.debug('Entering Chatty')
|
||||
self.chatty.enter()
|
||||
self.acceptOnce(self.chattyDoneEvent, self._DistributedDonaldDockAI__decideNextState)
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.notify.debug('Exiting Chatty')
|
||||
self.ignore(self.chattyDoneEvent)
|
||||
self.chatty.exit()
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
import DistributedCCharBase
|
||||
import DistributedDonald
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
import CCharChatter
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.hood import GSHood
|
||||
|
||||
class DistributedFrankenDonald(DistributedDonald.DistributedDonald):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedFrankenDonald')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedFrankenDonald_initialized
|
||||
except:
|
||||
self.DistributedFrankenDonald_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.FrankenDonald, 'fd')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.nametag.setText(TTLocalizer.Donald)
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
del self.walkDoneEvent
|
||||
del self.walk
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self, self.diffPath)
|
||||
name = self.getName()
|
||||
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self, self.diffPath)
|
||||
self.fsm.request('Neutral')
|
||||
return
|
||||
|
||||
def enterNeutral(self):
|
||||
self.notify.debug('Neutral ' + self.getName() + '...')
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('Walking ' + self.getName() + '...')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.FrankenDonaldSpeed
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedDonaldAI import DistributedDonaldAI
|
||||
|
||||
class DistributedFrankenDonaldAI(DistributedDonaldAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedFrankenDonaldAI")
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class DistributedGoofy(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGoofy')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedGoofy_initialized
|
||||
except:
|
||||
self.DistributedGoofy_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Goofy, 'g')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
del self.walkDoneEvent
|
||||
del self.walk
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedGoofy_deleted
|
||||
except:
|
||||
del self.fsm
|
||||
self.DistributedGoofy_deleted = 1
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self)
|
||||
name = self.getName()
|
||||
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.GoofySpeed
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedCCharBaseAI import DistributedCCharBaseAI
|
||||
|
||||
class DistributedGoofyAI(DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGoofyAI")
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.hood import DLHood
|
||||
|
||||
class DistributedGoofySpeedway(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGoofySpeedway')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedGoofySpeedway_initialized
|
||||
except:
|
||||
self.DistributedGoofySpeedway_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Goofy, 'g')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
del self.walkDoneEvent
|
||||
del self.walk
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedGoofySpeedway_deleted
|
||||
except:
|
||||
del self.fsm
|
||||
self.DistributedGoofySpeedway_deleted = 1
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self, self.diffPath)
|
||||
name = self.getName()
|
||||
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self, self.diffPath)
|
||||
self.fsm.request('Neutral')
|
||||
return
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.GoofySpeed
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBase.DistributedCCharBase.handleHolidays(self)
|
||||
if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
|
||||
holidayIds = base.cr.newsManager.getHolidayIdList()
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds and isinstance(self.cr.playGame.hood, DLHood.DLHood):
|
||||
self.diffPath = TTLocalizer.Donald
|
||||
|
||||
def getCCLocation(self):
|
||||
if self.diffPath == None:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
return
|
|
@ -1,190 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import CharStateDatasAI
|
||||
|
||||
class DistributedGoofySpeedwayAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGoofySpeedwayAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.Goofy)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedGoofySpeedwayAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely',
|
||||
'TransitionToCostume',
|
||||
'Walk']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Walk', self.enterWalk, self.exitWalk, [
|
||||
'Lonely',
|
||||
'Chatty',
|
||||
'TransitionToCostume']),
|
||||
State.State('TransitionToCostume', self.enterTransitionToCostume, self.exitTransitionToCostume, [
|
||||
'Off'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
name = self.getName()
|
||||
self.lonelyDoneEvent = self.taskName(name + '-lonely-done')
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(self.lonelyDoneEvent, self)
|
||||
self.chattyDoneEvent = self.taskName(name + '-chatty-done')
|
||||
self.chatty = CharStateDatasAI.CharChattyStateAI(self.chattyDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self, self.diffPath)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.GoofySpeed
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedGoofySpeedwayAI__decideNextState(self, doneStatus):
|
||||
if self.transitionToCostume == 1:
|
||||
curWalkNode = self.walk.getDestNode()
|
||||
if simbase.air.holidayManager:
|
||||
if ToontownGlobals.HALLOWEEN_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
elif ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no costume holiday')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no holiday Manager')
|
||||
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'walk' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.lonely.enter()
|
||||
self.acceptOnce(self.lonelyDoneEvent, self._DistributedGoofySpeedwayAI__decideNextState)
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.ignore(self.lonelyDoneEvent)
|
||||
self.lonely.exit()
|
||||
|
||||
|
||||
def _DistributedGoofySpeedwayAI__goForAWalk(self, task):
|
||||
self.notify.debug('going for a walk')
|
||||
self.fsm.request('Walk')
|
||||
return Task.done
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.chatty.enter()
|
||||
self.acceptOnce(self.chattyDoneEvent, self._DistributedGoofySpeedwayAI__decideNextState)
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.ignore(self.chattyDoneEvent)
|
||||
self.chatty.exit()
|
||||
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('going for a walk')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self._DistributedGoofySpeedwayAI__decideNextState)
|
||||
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: in walk state')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.handleHolidays(self)
|
||||
if hasattr(simbase.air, 'holidayManager'):
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays:
|
||||
if simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES] != None and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].getRunningState():
|
||||
self.diffPath = TTLocalizer.Donald
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def getCCLocation(self):
|
||||
if self.diffPath == None:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
def enterTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
from direct.showbase.ShowBaseGlobal import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import DistributedDale
|
||||
|
||||
class DistributedJailbirdDale(DistributedDale.DistributedDale):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedJailbirdDale')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedDale_initialized
|
||||
except:
|
||||
self.DistributedDale_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.JailbirdDale, 'jda')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
self.nametag.setText(TTLocalizer.Dale)
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedDaleAI import DistributedDaleAI
|
||||
|
||||
class DistributedJailbirdDaleAI(DistributedDaleAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedJailbirdDaleAI")
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.hood import DGHood
|
||||
|
||||
class DistributedMickey(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedMickey')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedMickey_initialized
|
||||
except:
|
||||
self.DistributedMickey_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Mickey, 'mk')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
self.neutralDoneEvent = None
|
||||
self.neutral = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
self.fsm.requestFinalState()
|
||||
self.notify.debug('Mickey Disbled')
|
||||
return
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedMickey_deleted
|
||||
except:
|
||||
self.DistributedMickey_deleted = 1
|
||||
del self.fsm
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
self.notify.debug('Mickey Deleted')
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self, self.diffPath)
|
||||
name = self.getName()
|
||||
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self, self.diffPath)
|
||||
self.fsm.request('Neutral')
|
||||
return
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.MickeySpeed
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBase.DistributedCCharBase.handleHolidays(self)
|
||||
if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
|
||||
holidayIds = base.cr.newsManager.getHolidayIdList()
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds and isinstance(self.cr.playGame.hood, DGHood.DGHood):
|
||||
self.diffPath = TTLocalizer.Daisy
|
|
@ -1,183 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
import CharStateDatasAI
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class DistributedMickeyAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedMickeyAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.Mickey)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedMickeyAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely',
|
||||
'TransitionToCostume',
|
||||
'Walk']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Walk', self.enterWalk, self.exitWalk, [
|
||||
'Lonely',
|
||||
'Chatty',
|
||||
'TransitionToCostume']),
|
||||
State.State('TransitionToCostume', self.enterTransitionToCostume, self.exitTransitionToCostume, [
|
||||
'Off'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
del self.fsm
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
self.notify.debug('MickeyAI Deleted')
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
name = self.getName()
|
||||
self.lonelyDoneEvent = self.taskName(name + '-lonely-done')
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(self.lonelyDoneEvent, self)
|
||||
self.chattyDoneEvent = self.taskName(name + '-chatty-done')
|
||||
self.chatty = CharStateDatasAI.CharChattyStateAI(self.chattyDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self, self.diffPath)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.MickeySpeed
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedMickeyAI__decideNextState(self, doneStatus):
|
||||
if self.transitionToCostume == 1:
|
||||
curWalkNode = self.walk.getDestNode()
|
||||
if simbase.air.holidayManager:
|
||||
if ToontownGlobals.HALLOWEEN_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
elif ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no costume holiday')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no holiday Manager')
|
||||
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'walk' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.lonely.enter()
|
||||
self.acceptOnce(self.lonelyDoneEvent, self._DistributedMickeyAI__decideNextState)
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.ignore(self.lonelyDoneEvent)
|
||||
self.lonely.exit()
|
||||
|
||||
|
||||
def _DistributedMickeyAI__goForAWalk(self, task):
|
||||
self.notify.debug('going for a walk')
|
||||
self.fsm.request('Walk')
|
||||
return Task.done
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.chatty.enter()
|
||||
self.acceptOnce(self.chattyDoneEvent, self._DistributedMickeyAI__decideNextState)
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.ignore(self.chattyDoneEvent)
|
||||
self.chatty.exit()
|
||||
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('going for a walk')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self._DistributedMickeyAI__decideNextState)
|
||||
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: in walk state')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
|
||||
def enterTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.handleHolidays(self)
|
||||
if hasattr(simbase.air, 'holidayManager'):
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES] != None and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].getRunningState():
|
||||
self.diffPath = TTLocalizer.Daisy
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.hood import BRHood
|
||||
|
||||
class DistributedMinnie(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedMinnie')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedMinnie_initialized
|
||||
except:
|
||||
self.DistributedMinnie_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Minnie, 'mn')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
self.neutralDoneEvent = None
|
||||
self.neutral = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
self.fsm.requestFinalState()
|
||||
return
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedMinnie_deleted
|
||||
except:
|
||||
self.DistributedMinnie_deleted = 1
|
||||
del self.fsm
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self, self.diffPath)
|
||||
self.neutralDoneEvent = self.taskName('minnie-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName('minnie-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self, self.diffPath)
|
||||
self.fsm.request('Neutral')
|
||||
return
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.neutral.enter()
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.MinnieSpeed
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBase.DistributedCCharBase.handleHolidays(self)
|
||||
if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
|
||||
holidayIds = base.cr.newsManager.getHolidayIdList()
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds and isinstance(self.cr.playGame.hood, BRHood.BRHood):
|
||||
self.diffPath = TTLocalizer.Pluto
|
|
@ -1,181 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import CharStateDatasAI
|
||||
|
||||
class DistributedMinnieAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedMinnieAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.Minnie)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedMinnieAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely',
|
||||
'TransitionToCostume',
|
||||
'Walk']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Walk', self.enterWalk, self.exitWalk, [
|
||||
'Lonely',
|
||||
'Chatty',
|
||||
'TransitionToCostume']),
|
||||
State.State('TransitionToCostume', self.enterTransitionToCostume, self.exitTransitionToCostume, [
|
||||
'Off'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
name = self.getName()
|
||||
self.lonelyDoneEvent = self.taskName(name + '-lonely-done')
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(self.lonelyDoneEvent, self)
|
||||
self.chattyDoneEvent = self.taskName(name + '-chatty-done')
|
||||
self.chatty = CharStateDatasAI.CharChattyStateAI(self.chattyDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self, self.diffPath)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.MinnieSpeed
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedMinnieAI__decideNextState(self, doneStatus):
|
||||
if self.transitionToCostume == 1:
|
||||
curWalkNode = self.walk.getDestNode()
|
||||
if simbase.air.holidayManager:
|
||||
if ToontownGlobals.HALLOWEEN_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
elif ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no costume holiday')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no holiday Manager')
|
||||
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'walk' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.lonely.enter()
|
||||
self.acceptOnce(self.lonelyDoneEvent, self._DistributedMinnieAI__decideNextState)
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.ignore(self.lonelyDoneEvent)
|
||||
self.lonely.exit()
|
||||
|
||||
|
||||
def _DistributedMinnieAI__goForAWalk(self, task):
|
||||
self.notify.debug('going for a walk')
|
||||
self.fsm.request('Walk')
|
||||
return Task.done
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.chatty.enter()
|
||||
self.acceptOnce(self.chattyDoneEvent, self._DistributedMinnieAI__decideNextState)
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.ignore(self.chattyDoneEvent)
|
||||
self.chatty.exit()
|
||||
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('going for a walk')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self._DistributedMinnieAI__decideNextState)
|
||||
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: in walk state')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.handleHolidays(self)
|
||||
if hasattr(simbase.air, 'holidayManager'):
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES] != None and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].getRunningState():
|
||||
self.diffPath = TTLocalizer.Pluto
|
||||
|
||||
|
||||
|
||||
|
||||
def enterTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.interval.IntervalGlobal import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
import CharStateDatas
|
||||
from direct.fsm import StateData
|
||||
from direct.task import Task
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.hood import MMHood
|
||||
|
||||
class DistributedPluto(DistributedCCharBase.DistributedCCharBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPluto')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedPluto_initialized
|
||||
except:
|
||||
self.DistributedPluto_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.Pluto, 'p')
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedPluto', [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
def disable(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBase.DistributedCCharBase.disable(self)
|
||||
taskMgr.remove('enterNeutralTask')
|
||||
taskMgr.remove('enterWalkTask')
|
||||
del self.neutralDoneEvent
|
||||
del self.neutral
|
||||
del self.walkDoneEvent
|
||||
del self.walk
|
||||
del self.neutralStartTrack
|
||||
del self.walkStartTrack
|
||||
self.fsm.requestFinalState()
|
||||
|
||||
def delete(self):
|
||||
try:
|
||||
self.DistributedPluto_deleted
|
||||
except:
|
||||
self.DistributedPluto_deleted = 1
|
||||
del self.fsm
|
||||
DistributedCCharBase.DistributedCCharBase.delete(self)
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBase.DistributedCCharBase.generate(self, self.diffPath)
|
||||
self.neutralDoneEvent = self.taskName('pluto-neutral-done')
|
||||
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName('pluto-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self, self.diffPath)
|
||||
self.walkStartTrack = Sequence(self.actorInterval('stand'), Func(self.stand))
|
||||
self.neutralStartTrack = Sequence(self.actorInterval('sit'), Func(self.sit))
|
||||
self.fsm.request('Neutral')
|
||||
return
|
||||
|
||||
def stand(self):
|
||||
self.dropShadow.setScale(0.9, 1.35, 0.9)
|
||||
if hasattr(self, 'collNodePath'):
|
||||
self.collNodePath.setScale(1.0, 1.5, 1.0)
|
||||
|
||||
def sit(self):
|
||||
self.dropShadow.setScale(0.9)
|
||||
if hasattr(self, 'collNodePath'):
|
||||
self.collNodePath.setScale(1.0)
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterNeutral(self):
|
||||
self.notify.debug('Neutral ' + self.getName() + '...')
|
||||
self.neutral.enter(self.neutralStartTrack)
|
||||
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitNeutral(self):
|
||||
self.ignore(self.neutralDoneEvent)
|
||||
self.neutral.exit()
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('Walking ' + self.getName() + '...')
|
||||
self.walk.enter(self.walkStartTrack)
|
||||
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
def __decideNextState(self, doneStatus):
|
||||
self.fsm.request('Neutral')
|
||||
|
||||
def setWalk(self, srcNode, destNode, timestamp):
|
||||
if destNode and not destNode == srcNode:
|
||||
self.walk.setWalk(srcNode, destNode, timestamp)
|
||||
self.fsm.request('Walk')
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.PlutoSpeed
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBase.DistributedCCharBase.handleHolidays(self)
|
||||
if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
|
||||
holidayIds = base.cr.newsManager.getHolidayIdList()
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in holidayIds and isinstance(self.cr.playGame.hood, MMHood.MMHood):
|
||||
self.diffPath = TTLocalizer.Minnie
|
||||
|
||||
def getCCLocation(self):
|
||||
if self.diffPath == None:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
return
|
|
@ -1,182 +0,0 @@
|
|||
# File: D (Python 2.4)
|
||||
|
||||
from otp.ai.AIBaseGlobal import *
|
||||
import DistributedCCharBaseAI
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from direct.task import Task
|
||||
import random
|
||||
import CharStateDatasAI
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class DistributedPlutoAI(DistributedCCharBaseAI.DistributedCCharBaseAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPlutoAI')
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.__init__(self, air, TTLocalizer.Pluto)
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedPlutoAI', [
|
||||
State.State('Off', self.enterOff, self.exitOff, [
|
||||
'Lonely',
|
||||
'TransitionToCostume',
|
||||
'Walk']),
|
||||
State.State('Lonely', self.enterLonely, self.exitLonely, [
|
||||
'Chatty',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Chatty', self.enterChatty, self.exitChatty, [
|
||||
'Lonely',
|
||||
'Walk',
|
||||
'TransitionToCostume']),
|
||||
State.State('Walk', self.enterWalk, self.exitWalk, [
|
||||
'Lonely',
|
||||
'Chatty',
|
||||
'TransitionToCostume']),
|
||||
State.State('TransitionToCostume', self.enterTransitionToCostume, self.exitTransitionToCostume, [
|
||||
'Off'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
|
||||
|
||||
def delete(self):
|
||||
self.fsm.requestFinalState()
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.delete(self)
|
||||
self.lonelyDoneEvent = None
|
||||
self.lonely = None
|
||||
self.chattyDoneEvent = None
|
||||
self.chatty = None
|
||||
self.walkDoneEvent = None
|
||||
self.walk = None
|
||||
|
||||
|
||||
def generate(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.generate(self)
|
||||
self.lonelyDoneEvent = self.taskName('pluto-lonely-done')
|
||||
self.lonely = CharStateDatasAI.CharLonelyStateAI(self.lonelyDoneEvent, self)
|
||||
self.chattyDoneEvent = self.taskName('pluto-chatty-done')
|
||||
self.chatty = CharStateDatasAI.CharChattyStateAI(self.chattyDoneEvent, self)
|
||||
self.walkDoneEvent = self.taskName('pluto-walk-done')
|
||||
if self.diffPath == None:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self)
|
||||
else:
|
||||
self.walk = CharStateDatasAI.CharWalkStateAI(self.walkDoneEvent, self, self.diffPath)
|
||||
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.PlutoSpeed
|
||||
|
||||
|
||||
def start(self):
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
def _DistributedPlutoAI__decideNextState(self, doneStatus):
|
||||
if self.transitionToCostume == 1:
|
||||
curWalkNode = self.walk.getDestNode()
|
||||
if simbase.air.holidayManager:
|
||||
if ToontownGlobals.HALLOWEEN_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.HALLOWEEN_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
elif ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES]:
|
||||
simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].triggerSwitch(curWalkNode, self)
|
||||
self.fsm.request('TransitionToCostume')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no costume holiday')
|
||||
else:
|
||||
self.notify.warning('transitionToCostume == 1 but no holiday Manager')
|
||||
|
||||
if doneStatus['state'] == 'lonely' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'chatty' and doneStatus['status'] == 'done':
|
||||
self.fsm.request('Walk')
|
||||
elif doneStatus['state'] == 'walk' and doneStatus['status'] == 'done':
|
||||
if len(self.nearbyAvatars) > 0:
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitOff(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.exitOff(self)
|
||||
|
||||
|
||||
def enterLonely(self):
|
||||
self.lonely.enter()
|
||||
self.acceptOnce(self.lonelyDoneEvent, self._DistributedPlutoAI__decideNextState)
|
||||
|
||||
|
||||
def exitLonely(self):
|
||||
self.ignore(self.lonelyDoneEvent)
|
||||
self.lonely.exit()
|
||||
|
||||
|
||||
def _DistributedPlutoAI__goForAWalk(self, task):
|
||||
self.notify.debug('going for a walk')
|
||||
self.fsm.request('Walk')
|
||||
return Task.done
|
||||
|
||||
|
||||
def enterChatty(self):
|
||||
self.chatty.enter()
|
||||
self.acceptOnce(self.chattyDoneEvent, self._DistributedPlutoAI__decideNextState)
|
||||
|
||||
|
||||
def exitChatty(self):
|
||||
self.ignore(self.chattyDoneEvent)
|
||||
self.chatty.exit()
|
||||
|
||||
|
||||
def enterWalk(self):
|
||||
self.notify.debug('going for a walk')
|
||||
self.walk.enter()
|
||||
self.acceptOnce(self.walkDoneEvent, self._DistributedPlutoAI__decideNextState)
|
||||
|
||||
|
||||
def exitWalk(self):
|
||||
self.ignore(self.walkDoneEvent)
|
||||
self.walk.exit()
|
||||
|
||||
|
||||
def avatarEnterNextState(self):
|
||||
if len(self.nearbyAvatars) == 1:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Chatty')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: in walk state')
|
||||
else:
|
||||
self.notify.debug('avatarEnterNextState: num avatars: ' + str(len(self.nearbyAvatars)))
|
||||
|
||||
|
||||
def avatarExitNextState(self):
|
||||
if len(self.nearbyAvatars) == 0:
|
||||
if self.fsm.getCurrentState().getName() != 'Walk':
|
||||
self.fsm.request('Lonely')
|
||||
|
||||
|
||||
|
||||
|
||||
def handleHolidays(self):
|
||||
DistributedCCharBaseAI.DistributedCCharBaseAI.handleHolidays(self)
|
||||
if hasattr(simbase.air, 'holidayManager'):
|
||||
if ToontownGlobals.APRIL_FOOLS_COSTUMES in simbase.air.holidayManager.currentHolidays:
|
||||
if simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES] != None and simbase.air.holidayManager.currentHolidays[ToontownGlobals.APRIL_FOOLS_COSTUMES].getRunningState():
|
||||
self.diffPath = TTLocalizer.Minnie
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def enterTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
||||
def exitTransitionToCostume(self):
|
||||
pass
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
from direct.showbase.ShowBaseGlobal import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import DistributedChip
|
||||
|
||||
class DistributedPoliceChip(DistributedChip.DistributedChip):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPoliceChip')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedChip_initialized
|
||||
except:
|
||||
self.DistributedChip_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.PoliceChip, 'pch')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.handleHolidays()
|
||||
self.nametag.setText(TTLocalizer.Chip)
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedChipAI import DistributedChipAI
|
||||
|
||||
class DistributedPoliceChipAI(DistributedChipAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPoliceChipAI")
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
from direct.showbase.ShowBaseGlobal import *
|
||||
import DistributedCCharBase
|
||||
import DistributedDaisy
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.hood import TTHood
|
||||
|
||||
class DistributedSockHopDaisy(DistributedDaisy.DistributedDaisy):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSockHopDaisy')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedSockHopDaisy_initialized
|
||||
except:
|
||||
self.DistributedSockHopDaisy_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.SockHopDaisy, 'shdd')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.nametag.setText(TTLocalizer.Daisy)
|
||||
self.handleHolidays()
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedDaisyAI import DistributedDaisyAI
|
||||
|
||||
class DistributedSockHopDaisyAI(DistributedDaisyAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedSockHopDaisyAI")
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from toontown.classicchars import DistributedGoofySpeedway
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import DistributedCCharBase
|
||||
|
||||
class DistributedSuperGoofy(DistributedGoofySpeedway.DistributedGoofySpeedway):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSuperGoofy')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedGoofySpeedway_initialized
|
||||
except:
|
||||
self.DistributedGoofySpeedway_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.SuperGoofy, 'sg')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.nametag.setText(TTLocalizer.Goofy)
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.SuperGoofySpeed
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedGoofySpeedwayAI import DistributedGoofySpeedwayAI
|
||||
|
||||
class DistributedSuperGoofyAI(DistributedGoofySpeedwayAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedSuperGoofyAI")
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from toontown.classicchars import DistributedMickey
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import DistributedCCharBase
|
||||
|
||||
class DistributedVampireMickey(DistributedMickey.DistributedMickey):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedVampireMickey')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedMickey_initialized
|
||||
except:
|
||||
self.DistributedMickey_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.VampireMickey, 'vmk')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.nametag.setText(TTLocalizer.Mickey)
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.VampireMickeySpeed
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedMickeyAI import DistributedMickeyAI
|
||||
|
||||
class DistributedVampireMickeyAI(DistributedMickeyAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedVampireMickeyAI")
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from toontown.classicchars import DistributedPluto
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import DistributedCCharBase
|
||||
|
||||
class DistributedWesternPluto(DistributedPluto.DistributedPluto):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWesternPluto')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedPluto_initialized
|
||||
except:
|
||||
self.DistributedPluto_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.WesternPluto, 'wp')
|
||||
self.fsm = ClassicFSM.ClassicFSM('DistributedWesternPluto', [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.nametag.setText(TTLocalizer.Pluto)
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.WesternPlutoSpeed
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedPlutoAI import DistributedPlutoAI
|
||||
|
||||
class DistributedWesternPlutoAI(DistributedPlutoAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedWesternPlutoAI")
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
import DistributedCCharBase
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
from toontown.classicchars import DistributedMinnie
|
||||
import CharStateDatas
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
import DistributedCCharBase
|
||||
|
||||
class DistributedWitchMinnie(DistributedMinnie.DistributedMinnie):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWitchMinnie')
|
||||
|
||||
def __init__(self, cr):
|
||||
try:
|
||||
self.DistributedMinnie_initialized
|
||||
except:
|
||||
self.DistributedMinnie_initialized = 1
|
||||
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.WitchMinnie, 'wmn')
|
||||
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
||||
self.fsm.enterInitialState()
|
||||
self.nametag.setText(TTLocalizer.Minnie)
|
||||
|
||||
def walkSpeed(self):
|
||||
return ToontownGlobals.WitchMinnieSpeed
|
|
@ -1,6 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.classicchars.DistributedMickeyAI import DistributedMickeyAI
|
||||
|
||||
class DistributedWitchMinnieAI(DistributedMickeyAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedWitchMinnieAI")
|
||||
|
|
@ -33,7 +33,6 @@ from toontown.distributed import DelayDelete
|
|||
from toontown.friends import FriendHandle
|
||||
from toontown.friends import FriendsListPanel
|
||||
from toontown.friends import ToontownFriendSecret
|
||||
from toontown.login import DateObject
|
||||
from toontown.login import AvatarChooser
|
||||
from toontown.makeatoon import MakeAToon
|
||||
from toontown.pets import DistributedPet, PetDetail, PetHandle
|
||||
|
@ -105,7 +104,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
self.friendPendingChatSettings = {}
|
||||
self.elderFriendsMap = {}
|
||||
self.__queryAvatarMap = {}
|
||||
self.dateObject = DateObject.DateObject()
|
||||
self.hoodMgr = HoodMgr.HoodMgr(self)
|
||||
self.setZonesEmulated = 0
|
||||
self.old_setzone_interest_handle = None
|
||||
|
@ -351,7 +349,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
pad.avatar = avatar
|
||||
pad.delayDelete = DelayDelete.DelayDelete(avatar, 'getAvatarDetails')
|
||||
self.__queryAvatarMap[avatar.doId] = pad
|
||||
self.__sendGetAvatarDetails(avatar.doId)
|
||||
self.__sendGetAvatarDetails(avatar.doId, pet=(args[0].endswith("Pet")))
|
||||
|
||||
def cancelAvatarDetailsRequest(self, avatar):
|
||||
avId = avatar.doId
|
||||
|
@ -359,8 +357,11 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
pad = self.__queryAvatarMap.pop(avId)
|
||||
pad.delayDelete.destroy()
|
||||
|
||||
def __sendGetAvatarDetails(self, avId):
|
||||
self.ttuFriendsManager.d_getAvatarDetails(avId)
|
||||
def __sendGetAvatarDetails(self, avId, pet=0):
|
||||
if pet:
|
||||
self.ttuFriendsManager.d_getPetDetails(avId)
|
||||
else:
|
||||
self.ttuFriendsManager.d_getAvatarDetails(avId)
|
||||
|
||||
def n_handleGetAvatarDetailsResp(self, avId, fields):
|
||||
self.notify.info('Query reponse for avId %d' % avId)
|
||||
|
@ -761,12 +762,13 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
|
||||
def addPetToFriendsMap(self, callback = None):
|
||||
doId = base.localAvatar.getPetId()
|
||||
if doId not in self.friendsMap:
|
||||
if not doId or doId in self.friendsMap:
|
||||
if callback:
|
||||
callback()
|
||||
return
|
||||
|
||||
def petDetailsCallback(petAvatar):
|
||||
petAvatar.announceGenerate()
|
||||
handle = PetHandle.PetHandle(petAvatar)
|
||||
self.friendsMap[doId] = handle
|
||||
petAvatar.disable()
|
||||
|
|
|
@ -108,6 +108,27 @@ class DistributedPhoneAI(DistributedFurnitureItemAI):
|
|||
else:
|
||||
return
|
||||
|
||||
def _getEmblemPrices():
|
||||
if config.GetBool('catalog-emblems-OR', False):
|
||||
ep = list(item.getEmblemPrices())
|
||||
if len(ep) != 2:
|
||||
return []
|
||||
|
||||
if all(ep):
|
||||
ep[payMethod] = 0
|
||||
|
||||
else:
|
||||
ep = item.getEmblemPrices()
|
||||
|
||||
return ep
|
||||
|
||||
def charge():
|
||||
ep = _getEmblemPrices()
|
||||
if ep:
|
||||
av.subtractEmblems(ep)
|
||||
|
||||
av.takeMoney(item.getPrice(priceType))
|
||||
|
||||
if item.getDeliveryTime():
|
||||
if len(av.onOrder) > 5:
|
||||
self.sendUpdateToAvatarId(avId, 'requestPurchaseResponse', [context, ToontownGlobals.P_OnOrderListFull])
|
||||
|
|
|
@ -7,6 +7,7 @@ import HouseGlobals
|
|||
import functools
|
||||
|
||||
class LoadHouseFSM(FSM):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('LoadHouseFSM')
|
||||
def __init__(self, mgr, estate, houseIndex, toon, callback):
|
||||
FSM.__init__(self, 'LoadHouseFSM')
|
||||
self.mgr = mgr
|
||||
|
@ -100,6 +101,35 @@ class LoadHouseFSM(FSM):
|
|||
self.done = True
|
||||
self.callback(self.house)
|
||||
|
||||
class LoadPetFSM(FSM):
|
||||
def __init__(self, mgr, estate, toon, callback):
|
||||
FSM.__init__(self, 'LoadPetFSM')
|
||||
self.mgr = mgr
|
||||
self.estate = estate
|
||||
self.toon = toon
|
||||
self.callback = callback
|
||||
self.pet = None
|
||||
|
||||
self.done = False
|
||||
|
||||
def start(self):
|
||||
self.petId = self.toon['setPetId'][0]
|
||||
if not self.petId in self.mgr.air.doId2do:
|
||||
self.mgr.air.sendActivate(self.petId, self.mgr.air.districtId, self.estate.zoneId)
|
||||
self.acceptOnce('generate-%d' % self.petId, self.__generated)
|
||||
|
||||
else:
|
||||
self.__generated(self.mgr.air.doId2do[self.petId])
|
||||
|
||||
def __generated(self, pet):
|
||||
self.pet = pet
|
||||
self.estate.pets.append(pet)
|
||||
self.demand('Off')
|
||||
|
||||
def enterOff(self):
|
||||
self.done = True
|
||||
self.callback(self.pet)
|
||||
|
||||
class LoadEstateFSM(FSM):
|
||||
def __init__(self, mgr, callback):
|
||||
FSM.__init__(self, 'LoadEstateFSM')
|
||||
|
@ -201,6 +231,7 @@ class LoadEstateFSM(FSM):
|
|||
|
||||
def __gotEstate(self, estate):
|
||||
self.estate = estate
|
||||
self.estate.pets = []
|
||||
|
||||
self.estate.toons = self.toonIds
|
||||
self.estate.updateToons()
|
||||
|
@ -229,6 +260,28 @@ class LoadEstateFSM(FSM):
|
|||
|
||||
# A houseFSM just finished! Let's see if all of them are done:
|
||||
if all(houseFSM.done for houseFSM in self.houseFSMs):
|
||||
self.demand('LoadPets')
|
||||
|
||||
def enterLoadPets(self):
|
||||
self.petFSMs = []
|
||||
for houseIndex in range(6):
|
||||
toon = self.toons[houseIndex]
|
||||
if toon and toon['setPetId'][0] != 0:
|
||||
fsm = LoadPetFSM(self.mgr, self.estate, toon, self.__petDone)
|
||||
self.petFSMs.append(fsm)
|
||||
fsm.start()
|
||||
else:
|
||||
continue
|
||||
|
||||
if not self.petFSMs:
|
||||
self.demand('Finished')
|
||||
|
||||
def __petDone(self, pet):
|
||||
if self.state != 'LoadPets':
|
||||
pet.requestDelete()
|
||||
return
|
||||
|
||||
if all(petFSM.done for petFSM in self.petFSMs):
|
||||
self.demand('Finished')
|
||||
|
||||
def enterFinished(self):
|
||||
|
@ -403,5 +456,7 @@ class EstateManagerAI(DistributedObjectAI):
|
|||
pass
|
||||
|
||||
def _lookupEstate(self, toon):
|
||||
print(self.toon2estate)
|
||||
return self.toon2estate.get(toon)
|
||||
|
||||
def getOwnerFromZone(self, avId):
|
||||
return False
|
|
@ -110,3 +110,12 @@ HALF_DAY_PERIOD = 1050
|
|||
HALF_NIGHT_PERIOD = 300
|
||||
FIREWORKS_MOVIE_CLEAR = 0
|
||||
FIREWORKS_MOVIE_GUI = 1
|
||||
|
||||
HouseEmblemPrices = (
|
||||
(50, 20), # bungalo
|
||||
(200, 75), # tiki
|
||||
(200, 75), # tepee
|
||||
(500, 250), # castle
|
||||
(350, 150), # cupcake
|
||||
(400, 200) # cabin
|
||||
)
|
||||
|
|
|
@ -97,11 +97,13 @@ class FishPanel(DirectFrame):
|
|||
self.extraLabel.hide()
|
||||
elif code == FishGlobals.FishItemNewEntry:
|
||||
self.extraLabel.show()
|
||||
self.extraLabel['text_fg'] = (0.2, 0.8, 0.4, 1)
|
||||
self.extraLabel['text'] = TTLocalizer.FishingNewEntry
|
||||
self.extraLabel['text_scale'] = TTLocalizer.FPnewEntry
|
||||
self.extraLabel.setPos(0, 0, 0.26)
|
||||
elif code == FishGlobals.FishItemNewRecord:
|
||||
self.extraLabel.show()
|
||||
self.extraLabel['text_fg'] = (1, .5, 0, 1)
|
||||
self.extraLabel['text'] = TTLocalizer.FishingNewRecord
|
||||
self.extraLabel['text_scale'] = TTLocalizer.FPnewRecord
|
||||
self.photo.show()
|
||||
|
|
|
@ -41,6 +41,26 @@ class TTUFriendsManager(DistributedObjectGlobal):
|
|||
]
|
||||
base.cr.n_handleGetAvatarDetailsResp(avId, fields=fields)
|
||||
|
||||
def d_getPetDetails(self, avId):
|
||||
self.sendUpdate('getPetDetails', [avId])
|
||||
|
||||
def petDetails(self, avId, ownerId, petName, traitSeed, sz, traits, moods, dna, lastSeen):
|
||||
fields = list(zip(("setHead", "setEars", "setNose", "setTail", "setBodyTexture", "setColor", "setColorScale", "setEyeColor", "setGender"), dna))
|
||||
fields.extend(zip(("setBoredom", "setRestlessness", "setPlayfulness", "setLoneliness",
|
||||
"setSadness", "setAffection", "setHunger", "setConfusion", "setExcitement",
|
||||
"setFatigue", "setAnger", "setSurprise"), moods))
|
||||
fields.extend(zip(("setForgetfulness", "setBoredomThreshold", "setRestlessnessThreshold",
|
||||
"setPlayfulnessThreshold", "setLonelinessThreshold", "setSadnessThreshold",
|
||||
"setFatigueThreshold", "setHungerThreshold", "setConfusionThreshold",
|
||||
"setExcitementThreshold", "setAngerThreshold", "setSurpriseThreshold",
|
||||
"setAffectionThreshold"), traits))
|
||||
fields.append(("setOwnerId", ownerId))
|
||||
fields.append(("setPetName", petName))
|
||||
fields.append(("setTraitSeed", traitSeed))
|
||||
fields.append(("setSafeZone", sz))
|
||||
fields.append(("setLastSeenTimestamp", lastSeen))
|
||||
base.cr.n_handleGetAvatarDetailsResp(avId, fields=fields)
|
||||
|
||||
def d_teleportQuery(self, toId):
|
||||
self.sendUpdate('routeTeleportQuery', [toId])
|
||||
|
||||
|
|
|
@ -258,6 +258,26 @@ class TTUFriendsManagerUD(DistributedObjectGlobalUD):
|
|||
self.sendUpdateToAvatarId(senderId, 'friendDetails', [avId, inventory, trackAccess, trophies, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel])
|
||||
self.air.dbInterface.queryObject(self.air.dbId, avId, handleToon)
|
||||
|
||||
def getPetDetails(self, avId):
|
||||
senderId = self.air.getAvatarIdFromSender()
|
||||
def handlePet(dclass, fields):
|
||||
if dclass != self.air.dclassesByName['DistributedPetAI']:
|
||||
return
|
||||
dna = [fields.get(x, [0])[0] for x in ("setHead", "setEars", "setNose", "setTail", "setBodyTexture", "setColor",
|
||||
"setColorScale", "setEyeColor", "setGender")]
|
||||
moods = [fields.get(x, [0])[0] for x in ("setBoredom", "setRestlessness", "setPlayfulness", "setLoneliness",
|
||||
"setSadness", "setAffection", "setHunger", "setConfusion", "setExcitement",
|
||||
"setFatigue", "setAnger", "setSurprise")]
|
||||
traits = [fields.get(x, [0])[0] for x in ("setForgetfulness", "setBoredomThreshold", "setRestlessnessThreshold",
|
||||
"setPlayfulnessThreshold", "setLonelinessThreshold", "setSadnessThreshold",
|
||||
"setFatigueThreshold", "setHungerThreshold", "setConfusionThreshold",
|
||||
"setExcitementThreshold", "setAngerThreshold", "setSurpriseThreshold",
|
||||
"setAffectionThreshold")]
|
||||
self.sendUpdateToAvatarId(senderId, 'petDetails', [avId, fields.get("setOwnerId", [0])[0], fields.get("setPetName", ["???"])[0],
|
||||
fields.get("setTraitSeed", [0])[0], fields.get("setSafeZone", [0])[0],
|
||||
traits, moods, dna, fields.get("setLastSeenTimestamp", [0])[0]])
|
||||
self.air.dbInterface.queryObject(self.air.dbId, avId, handlePet)
|
||||
|
||||
# -- Toon Online/Offline --
|
||||
def toonOnline(self, doId, friendsList):
|
||||
self.onlineToons.append(doId)
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
from toontown.classicchars import DistributedPlutoAI
|
||||
from toontown.hood import HoodAI
|
||||
from toontown.safezone import DistributedTrolleyAI
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.ai import DistributedPolarPlaceEffectMgrAI
|
||||
from toontown.ai import DistributedTrickOrTreatTargetAI
|
||||
|
||||
|
||||
class BRHoodAI(HoodAI.HoodAI):
|
||||
def __init__(self, air):
|
||||
HoodAI.HoodAI.__init__(self, air,
|
||||
|
@ -13,7 +11,6 @@ class BRHoodAI(HoodAI.HoodAI):
|
|||
ToontownGlobals.TheBrrrgh)
|
||||
|
||||
self.trolley = None
|
||||
self.classicChar = None
|
||||
|
||||
self.startup()
|
||||
|
||||
|
@ -22,9 +19,6 @@ class BRHoodAI(HoodAI.HoodAI):
|
|||
|
||||
if simbase.config.GetBool('want-minigames', True):
|
||||
self.createTrolley()
|
||||
if simbase.config.GetBool('want-classic-chars', True):
|
||||
if simbase.config.GetBool('want-pluto', True):
|
||||
self.createClassicChar()
|
||||
|
||||
self.PolarPlaceEffectManager = DistributedPolarPlaceEffectMgrAI.DistributedPolarPlaceEffectMgrAI(self.air)
|
||||
self.PolarPlaceEffectManager.generateWithRequired(3821)
|
||||
|
@ -37,8 +31,3 @@ class BRHoodAI(HoodAI.HoodAI):
|
|||
self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air)
|
||||
self.trolley.generateWithRequired(self.zoneId)
|
||||
self.trolley.start()
|
||||
|
||||
def createClassicChar(self):
|
||||
self.classicChar = DistributedPlutoAI.DistributedPlutoAI(self.air)
|
||||
self.classicChar.generateWithRequired(self.zoneId)
|
||||
self.classicChar.start()
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from toontown.classicchars import DistributedDonaldDockAI
|
||||
from toontown.hood import HoodAI
|
||||
from toontown.safezone import DistributedBoatAI
|
||||
from toontown.safezone import DistributedTrolleyAI
|
||||
|
@ -14,7 +13,6 @@ class DDHoodAI(HoodAI.HoodAI):
|
|||
|
||||
self.trolley = None
|
||||
self.boat = None
|
||||
self.classicChar = None
|
||||
|
||||
self.startup()
|
||||
|
||||
|
@ -24,9 +22,6 @@ class DDHoodAI(HoodAI.HoodAI):
|
|||
if simbase.config.GetBool('want-minigames', True):
|
||||
self.createTrolley()
|
||||
self.createBoat()
|
||||
if simbase.config.GetBool('want-classic-chars', True):
|
||||
if simbase.config.GetBool('want-donald-dock', True):
|
||||
self.createClassicChar()
|
||||
|
||||
if simbase.air.wantHalloween:
|
||||
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air)
|
||||
|
@ -41,8 +36,3 @@ class DDHoodAI(HoodAI.HoodAI):
|
|||
self.boat = DistributedBoatAI.DistributedBoatAI(self.air)
|
||||
self.boat.generateWithRequired(self.zoneId)
|
||||
self.boat.start()
|
||||
|
||||
def createClassicChar(self):
|
||||
self.classicChar = DistributedDonaldDockAI.DistributedDonaldDockAI(self.air)
|
||||
self.classicChar.generateWithRequired(self.zoneId)
|
||||
self.classicChar.start()
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from toontown.classicchars import DistributedDaisyAI
|
||||
from toontown.hood import HoodAI
|
||||
from toontown.safezone import ButterflyGlobals
|
||||
from toontown.safezone import DistributedButterflyAI
|
||||
|
@ -17,7 +16,6 @@ class DGHoodAI(HoodAI.HoodAI):
|
|||
|
||||
self.trolley = None
|
||||
self.flower = None
|
||||
self.classicChar = None
|
||||
|
||||
self.startup()
|
||||
|
||||
|
@ -27,9 +25,6 @@ class DGHoodAI(HoodAI.HoodAI):
|
|||
if simbase.config.GetBool('want-minigames', True):
|
||||
self.createTrolley()
|
||||
self.createFlower()
|
||||
if simbase.config.GetBool('want-classic-chars', True):
|
||||
if simbase.config.GetBool('want-daisy', True):
|
||||
self.createClassicChar()
|
||||
if simbase.config.GetBool('want-butterflies', True):
|
||||
self.createButterflies()
|
||||
|
||||
|
@ -55,11 +50,6 @@ class DGHoodAI(HoodAI.HoodAI):
|
|||
self.flower.generateWithRequired(self.zoneId)
|
||||
self.flower.start()
|
||||
|
||||
def createClassicChar(self):
|
||||
self.classicChar = DistributedDaisyAI.DistributedDaisyAI(self.air)
|
||||
self.classicChar.generateWithRequired(self.zoneId)
|
||||
self.classicChar.start()
|
||||
|
||||
def createButterflies(self, playground):
|
||||
ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.DG)
|
||||
for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.DG]):
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from toontown.classicchars import DistributedDonaldAI
|
||||
from toontown.hood import HoodAI
|
||||
from toontown.safezone import DistributedTrolleyAI
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
@ -13,7 +12,6 @@ class DLHoodAI(HoodAI.HoodAI):
|
|||
ToontownGlobals.DonaldsDreamland)
|
||||
|
||||
self.trolley = None
|
||||
self.classicChar = None
|
||||
|
||||
self.startup()
|
||||
|
||||
|
@ -22,9 +20,6 @@ class DLHoodAI(HoodAI.HoodAI):
|
|||
|
||||
if simbase.config.GetBool('want-minigames', True):
|
||||
self.createTrolley()
|
||||
if simbase.config.GetBool('want-classic-chars', True):
|
||||
if simbase.config.GetBool('want-donald-dreamland', True):
|
||||
self.createClassicChar()
|
||||
self.resistanceEmoteManager = DistributedResistanceEmoteMgrAI.DistributedResistanceEmoteMgrAI(self.air)
|
||||
self.resistanceEmoteManager.generateWithRequired(9720)
|
||||
|
||||
|
@ -36,8 +31,3 @@ class DLHoodAI(HoodAI.HoodAI):
|
|||
self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air)
|
||||
self.trolley.generateWithRequired(self.zoneId)
|
||||
self.trolley.start()
|
||||
|
||||
def createClassicChar(self):
|
||||
self.classicChar = DistributedDonaldAI.DistributedDonaldAI(self.air)
|
||||
self.classicChar.generateWithRequired(self.zoneId)
|
||||
self.classicChar.start()
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from toontown.classicchars import DistributedGoofySpeedwayAI
|
||||
from toontown.dna.DNAParser import DNAGroup, DNAVisGroup
|
||||
from toontown.hood import HoodAI
|
||||
from toontown.hood import ZoneUtil
|
||||
|
@ -21,7 +20,6 @@ class GSHoodAI(HoodAI.HoodAI):
|
|||
self.viewingBlocks = []
|
||||
self.startingBlocks = []
|
||||
self.leaderBoards = []
|
||||
self.classicChar = None
|
||||
|
||||
self.startup()
|
||||
|
||||
|
@ -31,8 +29,6 @@ class GSHoodAI(HoodAI.HoodAI):
|
|||
self.createStartingBlocks()
|
||||
self.createLeaderBoards()
|
||||
self.cycleLeaderBoards()
|
||||
if simbase.config.GetBool('want-goofy', True):
|
||||
self.createClassicChar()
|
||||
|
||||
def shutdown(self):
|
||||
HoodAI.HoodAI.shutdown(self)
|
||||
|
@ -147,8 +143,3 @@ class GSHoodAI(HoodAI.HoodAI):
|
|||
def cycleLeaderBoards(self, task=None):
|
||||
messenger.send('leaderBoardSwap-' + str(self.zoneId))
|
||||
taskMgr.doMethodLater(10, self.cycleLeaderBoards, 'leaderBoardSwitch')
|
||||
|
||||
def createClassicChar(self):
|
||||
self.classicChar = DistributedGoofySpeedwayAI.DistributedGoofySpeedwayAI(self.air)
|
||||
self.classicChar.generateWithRequired(self.zoneId)
|
||||
self.classicChar.start()
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
from toontown.classicchars import DistributedMinnieAI
|
||||
from toontown.hood import HoodAI
|
||||
from toontown.safezone import DistributedTrolleyAI
|
||||
from toontown.safezone import DistributedMMPianoAI
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.ai import DistributedTrickOrTreatTargetAI
|
||||
|
||||
|
||||
|
||||
class MMHoodAI(HoodAI.HoodAI):
|
||||
def __init__(self, air):
|
||||
HoodAI.HoodAI.__init__(self, air,
|
||||
|
@ -15,7 +12,6 @@ class MMHoodAI(HoodAI.HoodAI):
|
|||
|
||||
self.trolley = None
|
||||
self.piano = None
|
||||
self.classicChar = None
|
||||
|
||||
self.startup()
|
||||
|
||||
|
@ -24,9 +20,6 @@ class MMHoodAI(HoodAI.HoodAI):
|
|||
|
||||
if simbase.config.GetBool('want-minigames', True):
|
||||
self.createTrolley()
|
||||
if simbase.config.GetBool('want-classic-chars', True):
|
||||
if simbase.config.GetBool('want-minnie', True):
|
||||
self.createClassicChar()
|
||||
|
||||
self.piano = DistributedMMPianoAI.DistributedMMPianoAI(self.air)
|
||||
self.piano.generateWithRequired(self.zoneId)
|
||||
|
@ -39,8 +32,3 @@ class MMHoodAI(HoodAI.HoodAI):
|
|||
self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air)
|
||||
self.trolley.generateWithRequired(self.zoneId)
|
||||
self.trolley.start()
|
||||
|
||||
def createClassicChar(self):
|
||||
self.classicChar = DistributedMinnieAI.DistributedMinnieAI(self.air)
|
||||
self.classicChar.generateWithRequired(self.zoneId)
|
||||
self.classicChar.start()
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from toontown.hood import HoodAI
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.distributed.DistributedTimerAI import DistributedTimerAI
|
||||
from toontown.classicchars import DistributedChipAI
|
||||
from toontown.classicchars import DistributedDaleAI
|
||||
from toontown.dna.DNAParser import DNAGroup, DNAVisGroup
|
||||
from toontown.safezone.DistributedPicnicBasketAI import DistributedPicnicBasketAI
|
||||
from toontown.safezone import DistributedGameTableAI
|
||||
|
@ -16,8 +14,6 @@ class OZHoodAI(HoodAI.HoodAI):
|
|||
ToontownGlobals.OutdoorZone)
|
||||
|
||||
self.timer = None
|
||||
self.classicCharChip = None
|
||||
self.classicCharDale = None
|
||||
self.picnicTables = []
|
||||
self.gameTables = []
|
||||
|
||||
|
@ -27,9 +23,6 @@ class OZHoodAI(HoodAI.HoodAI):
|
|||
HoodAI.HoodAI.startup(self)
|
||||
|
||||
self.createTimer()
|
||||
if simbase.config.GetBool('want-classic-chars', True):
|
||||
if simbase.config.GetBool('want-chip-and-dale', True):
|
||||
self.createClassicChars()
|
||||
self.createPicnicTables()
|
||||
if simbase.config.GetBool('want-game-tables', True):
|
||||
self.createGameTables()
|
||||
|
@ -38,15 +31,6 @@ class OZHoodAI(HoodAI.HoodAI):
|
|||
self.timer = DistributedTimerAI(self.air)
|
||||
self.timer.generateWithRequired(self.zoneId)
|
||||
|
||||
def createClassicChars(self):
|
||||
self.classicCharChip = DistributedChipAI.DistributedChipAI(self.air)
|
||||
self.classicCharChip.generateWithRequired(self.zoneId)
|
||||
self.classicCharChip.start()
|
||||
self.classicCharDale = DistributedDaleAI.DistributedDaleAI(self.air, self.classicCharChip.doId)
|
||||
self.classicCharDale.generateWithRequired(self.zoneId)
|
||||
self.classicCharDale.start()
|
||||
self.classicCharChip.setDaleId(self.classicCharDale.doId)
|
||||
|
||||
def findPicnicTables(self, dnaGroup, zoneId, area, overrideDNAZone=False):
|
||||
picnicTables = []
|
||||
if isinstance(dnaGroup, DNAGroup) and ('picnic_table' in dnaGroup.getName()):
|
||||
|
|
|
@ -720,10 +720,17 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager):
|
|||
base.localAvatar.b_teleportGreeting(avId)
|
||||
else:
|
||||
friend = base.cr.identifyAvatar(avId)
|
||||
if friend != None:
|
||||
if friend == None:
|
||||
teleportDebug(requestStatus, 'friend not here, giving up')
|
||||
base.localAvatar.setSystemMessage(avId, OTPLocalizer.WhisperTargetLeftVisit % (friend.getName(),))
|
||||
friend.d_teleportGiveup(base.localAvatar.doId)
|
||||
else:
|
||||
def doTeleport(task):
|
||||
avatar = base.cr.doId2do[friend.getDoId()]
|
||||
base.localAvatar.gotoNode(avatar)
|
||||
base.localAvatar.b_teleportGreeting(friend.getDoId())
|
||||
return task.done
|
||||
self.acceptOnce('generate-%d' % friend.getDoId(), lambda x: taskMgr.doMethodLater(1, doTeleport, uniqueName('doTeleport')))
|
||||
base.transitions.irisIn()
|
||||
self.nextState = requestStatus.get('nextState', 'walk')
|
||||
base.localAvatar.attachCamera()
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from toontown.classicchars import DistributedMickeyAI
|
||||
from toontown.hood import HoodAI
|
||||
from toontown.safezone import ButterflyGlobals
|
||||
from toontown.safezone import DistributedButterflyAI
|
||||
|
@ -17,7 +16,6 @@ class TTHoodAI(HoodAI.HoodAI):
|
|||
ToontownGlobals.ToontownCentral)
|
||||
|
||||
self.trolley = None
|
||||
self.classicChar = None
|
||||
|
||||
self.startup()
|
||||
|
||||
|
@ -26,9 +24,6 @@ class TTHoodAI(HoodAI.HoodAI):
|
|||
|
||||
if simbase.config.GetBool('want-minigames', True):
|
||||
self.createTrolley()
|
||||
if simbase.config.GetBool('want-classic-chars', True):
|
||||
if simbase.config.GetBool('want-mickey', True):
|
||||
self.createClassicChar()
|
||||
if simbase.config.GetBool('want-butterflies', True):
|
||||
self.createButterflies()
|
||||
|
||||
|
@ -56,11 +51,6 @@ class TTHoodAI(HoodAI.HoodAI):
|
|||
self.trolley.generateWithRequired(self.zoneId)
|
||||
self.trolley.start()
|
||||
|
||||
def createClassicChar(self):
|
||||
self.classicChar = DistributedMickeyAI.DistributedMickeyAI(self.air)
|
||||
self.classicChar.generateWithRequired(self.zoneId)
|
||||
self.classicChar.start()
|
||||
|
||||
def createButterflies(self):
|
||||
ButterflyGlobals.generateIndexes(self.zoneId, ButterflyGlobals.TTC)
|
||||
for i in xrange(0, ButterflyGlobals.NUM_BUTTERFLY_AREAS[ButterflyGlobals.TTC]):
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from otp.login.HTTPUtil import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.login import TTAccount
|
||||
import DateObject
|
||||
import TTDateObject
|
||||
import time
|
||||
|
||||
class AccountServerDate:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('AccountServerDate')
|
||||
|
||||
def __init__(self):
|
||||
self.__grabbed = 0
|
||||
|
||||
def getServer(self):
|
||||
return TTAccount.getAccountServer().cStr()
|
||||
|
||||
def grabDate(self, force = 0):
|
||||
if self.__grabbed and not force:
|
||||
self.notify.debug('using cached account server date')
|
||||
return
|
||||
if base.cr.accountOldAuth or base.config.GetBool('use-local-date', 0):
|
||||
self.__useLocalClock()
|
||||
return
|
||||
url = URLSpec(self.getServer())
|
||||
url.setPath('/getDate.php')
|
||||
self.notify.debug('grabbing account server date from %s' % url.cStr())
|
||||
response = getHTTPResponse(url, http)
|
||||
if response[0] != 'ACCOUNT SERVER DATE':
|
||||
self.notify.debug('invalid response header')
|
||||
raise UnexpectedResponse, 'unexpected response, response=%s' % response
|
||||
try:
|
||||
epoch = int(response[1])
|
||||
except ValueError, e:
|
||||
self.notify.debug(str(e))
|
||||
raise UnexpectedResponse, 'unexpected response, response=%s' % response
|
||||
|
||||
timeTuple = time.gmtime(epoch)
|
||||
self.year = timeTuple[0]
|
||||
self.month = timeTuple[1]
|
||||
self.day = timeTuple[2]
|
||||
base.cr.dateObject = TTDateObject.TTDateObject(self)
|
||||
self.__grabbed = 1
|
||||
|
||||
def __useLocalClock(self):
|
||||
self.month = base.cr.dateObject.getMonth()
|
||||
self.year = base.cr.dateObject.getYear()
|
||||
self.day = base.cr.dateObject.getDay()
|
||||
|
||||
def getMonth(self):
|
||||
return self.month
|
||||
|
||||
def getYear(self):
|
||||
return self.year
|
||||
|
||||
def getDay(self):
|
||||
return self.day
|
|
@ -1,64 +0,0 @@
|
|||
import time
|
||||
|
||||
class DateObject:
|
||||
|
||||
def getYear(self):
|
||||
return time.localtime(time.time())[0]
|
||||
|
||||
def getMonth(self):
|
||||
return time.localtime(time.time())[1]
|
||||
|
||||
def getDay(self):
|
||||
return time.localtime(time.time())[2]
|
||||
|
||||
def getDetailedAge(self, dobMonth, dobYear, dobDay = None, curMonth = None, curYear = None, curDay = None):
|
||||
if curMonth is None:
|
||||
curMonth = self.getMonth()
|
||||
if curYear is None:
|
||||
curYear = self.getYear()
|
||||
if curDay is None:
|
||||
curDay = self.getDay()
|
||||
curMonths = curYear * 12 + (curMonth - 1)
|
||||
dobMonths = dobYear * 12 + (dobMonth - 1)
|
||||
if dobMonth == curMonth:
|
||||
if dobDay is not None:
|
||||
if dobDay > curDay:
|
||||
curMonths -= 1
|
||||
ageMonths = curMonths - dobMonths
|
||||
return (int(ageMonths / 12), ageMonths % 12)
|
||||
|
||||
def getAge(self, dobMonth, dobYear, dobDay = None, curMonth = None, curYear = None, curDay = None):
|
||||
return self.getDetailedAge(dobMonth, dobYear, dobDay=dobDay, curMonth=curMonth, curYear=curYear, curDay=curDay)[0]
|
||||
|
||||
def getNumDaysInMonth(self, month = None, year = None):
|
||||
|
||||
def isLeapYear(year):
|
||||
if year % 4 == 0:
|
||||
if year % 100 == 0:
|
||||
if year % 400 == 0:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
if month is None:
|
||||
m = self.getMonth()
|
||||
else:
|
||||
m = month
|
||||
if year is None:
|
||||
y = self.getYear()
|
||||
else:
|
||||
y = year
|
||||
if m == 2:
|
||||
if isLeapYear(y):
|
||||
return 29
|
||||
else:
|
||||
return 28
|
||||
elif m in (1, 3, 5, 7, 8, 10, 12):
|
||||
return 31
|
||||
else:
|
||||
return 30
|
||||
return
|
|
@ -1,21 +0,0 @@
|
|||
import DateObject
|
||||
|
||||
class TTDateObject(DateObject.DateObject):
|
||||
|
||||
def __init__(self, accountServerDate):
|
||||
self.accountServerDate = accountServerDate
|
||||
|
||||
def getYear(self):
|
||||
return self.accountServerDate.getYear()
|
||||
|
||||
def getMonth(self):
|
||||
return self.accountServerDate.getMonth()
|
||||
|
||||
def getDay(self):
|
||||
return self.accountServerDate.getDay()
|
||||
|
||||
def getDetailedAge(self, dobMonth, dobYear, dobDay = None, curMonth = None, curYear = None, curDay = None):
|
||||
return DateObject.DateObject.getDetailedAge(self, dobMonth, dobYear, dobDay, curMonth=self.getMonth(), curYear=self.getYear(), curDay=self.getDay())
|
||||
|
||||
def getAge(self, dobMonth, dobYear, dobDay = None, curMonth = None, curYear = None, curDay = None):
|
||||
return TTDateObject.getDetailedAge(self, dobMonth, dobYear, dobDay=dobDay, curMonth=curMonth, curYear=curYear, curDay=curDay)[0]
|
|
@ -10,8 +10,6 @@ from pandac.PandaModules import *
|
|||
import random, BodyShop, ColorShop, GenderShop, MakeClothesGUI, TrackShop, NameShop
|
||||
from MakeAToonGlobals import *
|
||||
from otp.avatar import Avatar
|
||||
from toontown.char import Char
|
||||
from toontown.char import CharDNA
|
||||
from toontown.chat.ChatGlobals import *
|
||||
from toontown.distributed.ToontownMsgTypes import *
|
||||
from toontown.toon import LocalToon
|
||||
|
@ -429,11 +427,6 @@ class MakeAToon(StateData.StateData):
|
|||
elif self.shop == NAMESHOP:
|
||||
self.fsm.request('TrackShop')
|
||||
|
||||
def charSez(self, char, statement, dialogue = None):
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
char.setChatAbsolute(statement, CFSpeech, dialogue)
|
||||
|
||||
def enterInit(self):
|
||||
pass
|
||||
|
||||
|
|
|
@ -10,10 +10,9 @@ import string
|
|||
import ArrowKeys
|
||||
from DistributedMinigame import *
|
||||
import PatternGameGlobals
|
||||
from toontown.char import Char
|
||||
from toontown.char import CharDNA
|
||||
from toontown.chat.ChatGlobals import *
|
||||
from toontown.nametag.NametagGlobals import *
|
||||
from toontown.toon import NPCToons
|
||||
from toontown.toon import ToonHead
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
@ -37,10 +36,6 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
strWaitingOtherPlayers = TTLocalizer.PatternGameWaitingOtherPlayers
|
||||
strPleaseWait = TTLocalizer.PatternGamePleaseWait
|
||||
strRound = TTLocalizer.PatternGameRound
|
||||
minnieAnimNames = ['up',
|
||||
'left',
|
||||
'down',
|
||||
'right']
|
||||
toonAnimNames = ['up',
|
||||
'left',
|
||||
'down',
|
||||
|
@ -129,18 +124,13 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
minnieX.removeNode()
|
||||
minnieCircle.removeNode()
|
||||
matchingGameGui.removeNode()
|
||||
self.minnie = Char.Char()
|
||||
m = self.minnie
|
||||
dna = CharDNA.CharDNA()
|
||||
dna.newChar('mn')
|
||||
m.setDNA(dna)
|
||||
m.setName(TTLocalizer.Minnie)
|
||||
m.reparentTo(hidden)
|
||||
self.blinky = NPCToons.createLocalNPC(7010)
|
||||
self.blinky.reparentTo(hidden)
|
||||
self.backRowHome = Point3(3, 11, 0)
|
||||
self.backRowXSpacing = 1.8
|
||||
self.frontRowHome = Point3(0, 18, 0)
|
||||
self.frontRowXSpacing = 3.0
|
||||
self.stdNumDanceStepPingFrames = self.minnie.getNumFrames(self.minnieAnimNames[0])
|
||||
self.stdNumDanceStepPingFrames = self.blinky.getNumFrames(self.toonAnimNames[0])
|
||||
self.stdNumDanceStepPingPongFrames = self.__numPingPongFrames(self.stdNumDanceStepPingFrames)
|
||||
self.buttonPressDelayPercent = (self.stdNumDanceStepPingFrames - 1.0) / self.stdNumDanceStepPingPongFrames
|
||||
self.animPlayRates = []
|
||||
|
@ -197,8 +187,8 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
del self.statusBalls
|
||||
self.room.removeNode()
|
||||
del self.room
|
||||
self.minnie.delete()
|
||||
del self.minnie
|
||||
self.blinky.delete()
|
||||
del self.blinky
|
||||
self.removeChildGameFSM(self.gameFSM)
|
||||
del self.gameFSM
|
||||
|
||||
|
@ -215,17 +205,11 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
self.room.reparentTo(render)
|
||||
self.room.setPosHpr(0.0, 18.39, -ToontownGlobals.FloorOffset, 0.0, 0.0, 0.0)
|
||||
self.room.setScale(1)
|
||||
for anim in self.minnieAnimNames:
|
||||
self.minnie.pose(anim, 0)
|
||||
|
||||
for anim in self.toonAnimNames:
|
||||
self.lt.pose(anim, 0)
|
||||
|
||||
self.minnieAnimSpeedMult = {}
|
||||
self.toonAnimSpeedMult = {}
|
||||
for anim in self.minnieAnimNames:
|
||||
numFrames = self.minnie.getNumFrames(anim)
|
||||
self.minnieAnimSpeedMult[anim] = float(self.__numPingPongFrames(numFrames)) / float(self.stdNumDanceStepPingPongFrames)
|
||||
|
||||
for anim in self.toonAnimNames:
|
||||
numFrames = self.lt.getNumFrames(anim)
|
||||
|
@ -245,7 +229,7 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
for k in xrange(0, 2):
|
||||
self.arrowDict['lt'][k].setBillboardAxis()
|
||||
self.arrowDict['lt'][k].setBin('fixed', 100)
|
||||
self.arrowDict['lt'][k].reparentTo(jj)
|
||||
self.arrowDict['lt'][k].reparentTo(self.lt.nametag3d)
|
||||
if k == 0:
|
||||
self.arrowDict['lt'][k].setScale(2.5)
|
||||
self.arrowDict['lt'][k].setColor(self.arrowColor)
|
||||
|
@ -254,25 +238,20 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
self.arrowDict['lt'][k].setColor(self.xColor)
|
||||
self.arrowDict['lt'][k].setPos(0, 0, 1)
|
||||
|
||||
self.formatStatusBalls(self.arrowDict['lt'][2], jj)
|
||||
m = self.minnie
|
||||
m.reparentTo(render)
|
||||
m.setPos(-1.6, 20, 0)
|
||||
m.setScale(1)
|
||||
self.makeToonLookatCamera(m)
|
||||
m.loop('neutral')
|
||||
m.startBlink()
|
||||
self.minnie.nametag.manage(base.marginManager)
|
||||
self.minnie.startEarTask()
|
||||
self.minnie.setPickable(0)
|
||||
self.minnie.nametag.getNametag3d().setChatWordWrap(8)
|
||||
self.formatStatusBalls(self.arrowDict['lt'][2], self.lt.nametag3d)
|
||||
self.blinky.reparentTo(render)
|
||||
self.blinky.setPos(-1.6, 20, 0)
|
||||
self.blinky.setScale(1)
|
||||
self.makeToonLookatCamera(self.blinky)
|
||||
self.blinky.loop('neutral')
|
||||
self.blinky.nametag.manage(base.marginManager)
|
||||
self.blinky.nametag.getNametag3d().setChatWordWrap(8)
|
||||
self.arrowDict['m'] = [self.arrows.pop(), self.xs.pop()]
|
||||
jj = self.minnie.nametag3d
|
||||
for k in xrange(0, 2):
|
||||
self.arrowDict['m'][k].setBillboardAxis()
|
||||
self.arrowDict['m'][k].setBin('fixed', 100)
|
||||
self.arrowDict['m'][k].setColor(self.arrowColor)
|
||||
self.arrowDict['m'][k].reparentTo(jj)
|
||||
self.arrowDict['m'][k].reparentTo(self.blinky.nametag3d)
|
||||
self.arrowDict['m'][k].setScale(4)
|
||||
self.arrowDict['m'][k].setPos(0, 0, 1.7)
|
||||
|
||||
|
@ -288,11 +267,9 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
del self.arrowKeys
|
||||
self.room.reparentTo(hidden)
|
||||
self.roundText.hide()
|
||||
self.minnie.nametag.unmanage(base.marginManager)
|
||||
self.minnie.stopEarTask()
|
||||
self.minnie.stop()
|
||||
self.minnie.stopBlink()
|
||||
self.minnie.reparentTo(hidden)
|
||||
self.blinky.nametag.unmanage(base.marginManager)
|
||||
self.blinky.stop()
|
||||
self.blinky.reparentTo(hidden)
|
||||
self.lt.setScale(1)
|
||||
for avId in self.remoteAvIdList:
|
||||
toon = self.getAvatar(avId)
|
||||
|
@ -410,16 +387,12 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
|
||||
def getDanceStepDuration(self):
|
||||
numFrames = self.stdNumDanceStepPingPongFrames
|
||||
return numFrames / abs(self.animPlayRate * self.minnieAnimSpeedMult[self.minnieAnimNames[0]] * self.minnie.getFrameRate(self.minnieAnimNames[0]))
|
||||
return numFrames / abs(self.animPlayRate * self.toonAnimSpeedMult[self.toonAnimNames[0]] * self.blinky.getFrameRate(self.toonAnimNames[0]))
|
||||
|
||||
def __getDanceStepAnimTrack(self, toon, anim, speedScale):
|
||||
numFrames = toon.getNumFrames(anim)
|
||||
return Sequence(Func(toon.pingpong, anim, fromFrame=0, toFrame=numFrames - 1), Wait(self.getDanceStepDuration()))
|
||||
|
||||
def __getMinnieDanceStepAnimTrack(self, minnie, direction):
|
||||
animName = self.minnieAnimNames[direction]
|
||||
return self.__getDanceStepAnimTrack(minnie, animName, self.minnieAnimSpeedMult[animName])
|
||||
|
||||
def __getToonDanceStepAnimTrack(self, toon, direction):
|
||||
animName = self.toonAnimNames[direction]
|
||||
return self.__getDanceStepAnimTrack(toon, animName, self.toonAnimSpeedMult[animName])
|
||||
|
@ -516,8 +489,6 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
|
||||
def getDanceSequenceAnimTrack(self, toon, pattern):
|
||||
getDanceStepTrack = self.__getToonDanceStepAnimTrack
|
||||
if toon == self.minnie:
|
||||
getDanceStepTrack = self.__getMinnieDanceStepAnimTrack
|
||||
tracks = Sequence()
|
||||
for direction in pattern:
|
||||
tracks.append(getDanceStepTrack(toon, direction))
|
||||
|
@ -545,14 +516,12 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
index = self.avIdList.index(avId)
|
||||
return self.__getRowPos(self.frontRowHome, self.frontRowXSpacing, index, len(self.avIdList))
|
||||
|
||||
def __setMinnieChat(self, str, giggle):
|
||||
def __setBlinkyChat(self, str, giggle):
|
||||
str = str.replace('%s', self.getAvatar(self.localAvId).getName())
|
||||
self.minnie.setChatAbsolute(str, CFSpeech)
|
||||
if giggle:
|
||||
self.minnie.playDialogue('statementA', 1)
|
||||
self.blinky.setChatAbsolute(str, CFSpeech)
|
||||
|
||||
def __clearMinnieChat(self):
|
||||
self.minnie.clearChat()
|
||||
def __clearBlinkyChat(self):
|
||||
self.blinky.clearChat()
|
||||
|
||||
def enterOff(self):
|
||||
self.notify.debug('enterOff')
|
||||
|
@ -587,14 +556,14 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
for anim in self.toonAnimNames:
|
||||
toon.setPlayRate(self.animPlayRate * self.toonAnimSpeedMult[anim], anim)
|
||||
|
||||
for anim in self.minnieAnimNames:
|
||||
self.minnie.setPlayRate(self.animPlayRate * self.minnieAnimSpeedMult[anim], anim)
|
||||
for anim in self.toonAnimNames:
|
||||
self.blinky.setPlayRate(self.animPlayRate * self.toonAnimSpeedMult[anim], anim)
|
||||
|
||||
text = self.strWatch
|
||||
danceTrack = self.getDanceSequenceAnimTrack(self.minnie, self.__serverPattern)
|
||||
danceTrack = self.getDanceSequenceAnimTrack(self.blinky, self.__serverPattern)
|
||||
arrowTrack = self.getDanceArrowAnimTrack('m', self.__serverPattern, 0)
|
||||
soundTrack = self.getDanceSequenceButtonSoundTrack(self.__serverPattern)
|
||||
self.showTrack = Sequence(Func(self.__setMinnieChat, text, 1), Wait(0.5), Parallel(danceTrack, soundTrack, arrowTrack), Wait(0.2), Func(self.__clearMinnieChat), Func(self.gameFSM.request, 'getUserInput'))
|
||||
self.showTrack = Sequence(Func(self.__setBlinkyChat, text, 1), Wait(0.5), Parallel(danceTrack, soundTrack, arrowTrack), Wait(0.2), Func(self.__clearBlinkyChat), Func(self.gameFSM.request, 'getUserInput'))
|
||||
self.showTrack.start()
|
||||
|
||||
def exitShowServerPattern(self):
|
||||
|
@ -636,7 +605,7 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
self.showStatusBalls(avId)
|
||||
self.__otherToonIndex[avId] = 0
|
||||
|
||||
self.setupTrack = Sequence(Func(self.__setMinnieChat, self.strGo, 0), Func(self.setText, self.roundText, TTLocalizer.PatternGameGo), Func(self.roundText.setScale, 0.3), Func(enableKeys), Func(startTimer), Wait(0.8), Func(self.__clearMinnieChat), Func(self.setText, self.roundText, ' '), Func(self.roundText.setScale, 0.12), Func(self.setTextFG, self.roundText, self.normalTextColor))
|
||||
self.setupTrack = Sequence(Func(self.__setBlinkyChat, self.strGo, 0), Func(self.setText, self.roundText, TTLocalizer.PatternGameGo), Func(self.roundText.setScale, 0.3), Func(enableKeys), Func(startTimer), Wait(0.8), Func(self.__clearBlinkyChat), Func(self.setText, self.roundText, ' '), Func(self.roundText.setScale, 0.12), Func(self.setTextFG, self.roundText, self.normalTextColor))
|
||||
self.setupTrack.start()
|
||||
return
|
||||
|
||||
|
@ -716,7 +685,7 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
self.proceedTrack.pause()
|
||||
del self.setupTrack
|
||||
del self.proceedTrack
|
||||
self.__clearMinnieChat()
|
||||
self.__clearBlinkyChat()
|
||||
|
||||
def enterWaitForPlayerPatterns(self):
|
||||
self.notify.debug('enterWaitForPlayerPatterns')
|
||||
|
@ -782,7 +751,7 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
sound = self.incorrectSound
|
||||
text = self.strWrong
|
||||
soundTrack = Sequence(Func(base.playSfx, sound), Wait(1.6))
|
||||
textTrack = Sequence(Wait(0.2), Func(self.__setMinnieChat, text, 0), Wait(1.3), Func(self.__clearMinnieChat))
|
||||
textTrack = Sequence(Wait(0.2), Func(self.__setBlinkyChat, text, 0), Wait(1.3), Func(self.__clearBlinkyChat))
|
||||
self.playBackPatternsTrack = Sequence(Parallel(soundTrack, textTrack, jumpTrack), Func(self.gameFSM.request, 'checkGameOver'))
|
||||
self.playBackPatternsTrack.start()
|
||||
|
||||
|
@ -806,9 +775,9 @@ class DistributedPatternGame(DistributedMinigame):
|
|||
delay = 2.2
|
||||
if self.celebrate:
|
||||
text = TTLocalizer.PatternGameImprov
|
||||
self.__winTrack = Sequence(Func(self.__setMinnieChat, text, 1), Func(base.playSfx, self.perfectSound), Sequence(self.returnCelebrationIntervals(1)), Sequence(self.returnCelebrationIntervals(0)), Func(self.__clearMinnieChat), Func(self.gameOver))
|
||||
self.__winTrack = Sequence(Func(self.__setBlinkyChat, text, 1), Func(base.playSfx, self.perfectSound), Sequence(self.returnCelebrationIntervals(1)), Sequence(self.returnCelebrationIntervals(0)), Func(self.__clearBlinkyChat), Func(self.gameOver))
|
||||
else:
|
||||
self.__winTrack = Sequence(Func(self.__setMinnieChat, text, 1), Func(base.playSfx, sound), Wait(delay), Func(self.__clearMinnieChat), Func(self.gameOver))
|
||||
self.__winTrack = Sequence(Func(self.__setBlinkyChat, text, 1), Func(base.playSfx, sound), Wait(delay), Func(self.__clearBlinkyChat), Func(self.gameOver))
|
||||
self.__winTrack.start()
|
||||
return
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ from toontown.toonbase import ToontownTimer
|
|||
from toontown.toon import ToonHead
|
||||
from toontown.suit import SuitDNA
|
||||
from toontown.suit import Suit
|
||||
from toontown.char import Char
|
||||
import ArrowKeys
|
||||
import random
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
|
|
|
@ -9,9 +9,7 @@ from direct.fsm import ClassicFSM, State
|
|||
from direct.interval.IntervalGlobal import *
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from direct.task import Task
|
||||
from otp.movement import Mover
|
||||
from toontown.pets import PetChase, PetFlee, PetWander, PetLeash
|
||||
from toontown.pets import PetCollider, PetSphere, PetLookerAI
|
||||
from toontown.pets import PetLookerAI
|
||||
from toontown.pets import PetConstants, PetDNA, PetTraits
|
||||
from toontown.pets import PetObserve, PetBrain, PetMood
|
||||
from toontown.pets import PetActionFSM, PetBase, PetGoal, PetTricks
|
||||
|
@ -24,6 +22,8 @@ import string
|
|||
import copy
|
||||
from direct.showbase.PythonUtil import StackTrace
|
||||
|
||||
from PetMoverAI import PetMoverAI
|
||||
|
||||
class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLookerAI.PetLookerAI, PetBase.PetBase):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPetAI')
|
||||
movieTimeSwitch = {PetConstants.PET_MOVIE_FEED: PetConstants.FEED_TIME,
|
||||
|
@ -126,18 +126,16 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
def handleLogicalZoneChange(self, newZoneId, oldZoneId):
|
||||
DistributedSmoothNodeAI.DistributedSmoothNodeAI.handleLogicalZoneChange(self, newZoneId, oldZoneId)
|
||||
self.announceZoneChange(newZoneId, oldZoneId)
|
||||
self.destroySphereImpulse()
|
||||
self.createSphereImpulse()
|
||||
|
||||
def announceZoneChange(self, newZoneId, oldZoneId):
|
||||
DistributedPetAI.notify.debug('%s.announceZoneChange: %s->%s' % (self.doId, oldZoneId, newZoneId))
|
||||
broadcastZones = list2dict([newZoneId, oldZoneId])
|
||||
self.estateOwnerId = simbase.air.estateMgr.getOwnerFromZone(newZoneId)
|
||||
self.estateOwnerId = simbase.air.estateManager.getOwnerFromZone(newZoneId)
|
||||
if self.estateOwnerId:
|
||||
if __dev__:
|
||||
pass
|
||||
self.inEstate = 1
|
||||
self.estateZones = simbase.air.estateMgr.getEstateZones(self.estateOwnerId)
|
||||
self.estateZones = simbase.air.estateManager.getEstateZones(self.estateOwnerId)
|
||||
else:
|
||||
self.inEstate = 0
|
||||
self.estateZones = []
|
||||
|
@ -475,8 +473,8 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
else:
|
||||
self.setTrickAptitudes(aptitudes, local=1)
|
||||
|
||||
def generate(self):
|
||||
DistributedSmoothNodeAI.DistributedSmoothNodeAI.generate(self)
|
||||
def announceGenerate(self):
|
||||
DistributedSmoothNodeAI.DistributedSmoothNodeAI.announceGenerate(self)
|
||||
self._hasCleanedUp = False
|
||||
self.setHasRequestedDelete(False)
|
||||
self.b_setParent(ToontownGlobals.SPHidden)
|
||||
|
@ -517,9 +515,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
|
||||
self.requiredMoodComponents = {}
|
||||
self.brain = PetBrain.PetBrain(self)
|
||||
self.mover = Mover.Mover(self)
|
||||
self.lockMover = Mover.Mover(self)
|
||||
self.createImpulses()
|
||||
self.mover = PetMoverAI(self)
|
||||
self.enterPetLook()
|
||||
self.actionFSM = PetActionFSM.PetActionFSM(self)
|
||||
self.teleportIn()
|
||||
|
@ -591,11 +587,8 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
self.actionFSM.destroy()
|
||||
del self.actionFSM
|
||||
self.exitPetLook()
|
||||
self.destroyImpulses()
|
||||
self.mover.destroy()
|
||||
del self.mover
|
||||
self.lockMover.destroy()
|
||||
del self.lockMover
|
||||
self.stopPosHprBroadcast()
|
||||
if hasattr(self, 'mood'):
|
||||
self.mood.destroy()
|
||||
|
@ -645,37 +638,6 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
self.ignoreAll()
|
||||
return
|
||||
|
||||
def createImpulses(self):
|
||||
self.createSphereImpulse()
|
||||
self.chaseImpulse = PetChase()
|
||||
self.fleeImpulse = PetFlee()
|
||||
self.wanderImpulse = PetWander.PetWander()
|
||||
self.lockChaseImpulse = PetChase()
|
||||
|
||||
def destroyImpulses(self):
|
||||
self.wanderImpulse.destroy()
|
||||
del self.chaseImpulse
|
||||
del self.fleeImpulse
|
||||
del self.wanderImpulse
|
||||
self.destroySphereImpulse()
|
||||
del self.lockChaseImpulse
|
||||
|
||||
def createSphereImpulse(self):
|
||||
petRadius = 1.0
|
||||
collTrav = self.getCollTrav()
|
||||
if collTrav is None:
|
||||
DistributedPetAI.notify.warning('no collision traverser for zone %s' % self.zoneId)
|
||||
else:
|
||||
self.sphereImpulse = PetSphere.PetSphere(petRadius, collTrav)
|
||||
self.mover.addImpulse('sphere', self.sphereImpulse)
|
||||
return
|
||||
|
||||
def destroySphereImpulse(self):
|
||||
self.mover.removeImpulse('sphere')
|
||||
if hasattr(self, 'sphereImpulse'):
|
||||
self.sphereImpulse.destroy()
|
||||
del self.sphereImpulse
|
||||
|
||||
def getMoveTaskName(self):
|
||||
return 'petMove-%s' % self.doId
|
||||
|
||||
|
@ -684,15 +646,10 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
|
||||
def move(self, task = None):
|
||||
if self.isEmpty():
|
||||
try:
|
||||
self.air.writeServerEvent('Late Pet Move Call', self.doId, ' ')
|
||||
except:
|
||||
pass
|
||||
|
||||
self.air.writeServerEvent('Late Pet Move Call', self.doId, ' ')
|
||||
taskMgr.remove(task.name)
|
||||
return Task.done
|
||||
if not self.isLockMoverEnabled():
|
||||
self.mover.move()
|
||||
|
||||
numNearby = len(self.brain.nearbyAvs) - 1
|
||||
minNearby = 5
|
||||
if numNearby > minNearby:
|
||||
|
@ -784,6 +741,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
def lockPet(self):
|
||||
DistributedPetAI.notify.debug('%s: lockPet' % self.doId)
|
||||
if not self.lockedDown:
|
||||
self.mover.lock()
|
||||
self.stopPosHprBroadcast()
|
||||
self.lockedDown += 1
|
||||
|
||||
|
@ -840,18 +798,6 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
|
||||
def unstickEnterOn(self):
|
||||
self._collisionTimestamps = []
|
||||
self.accept(self.mover.getCollisionEventName(), self._handleCollided)
|
||||
|
||||
def _handleCollided(self, collEntry):
|
||||
now = globalClock.getFrameTime()
|
||||
self._collisionTimestamps.append(now)
|
||||
while now - self._collisionTimestamps[0] > PetConstants.UnstickSampleWindow:
|
||||
del self._collisionTimestamps[0:1]
|
||||
|
||||
if len(self._collisionTimestamps) > PetConstants.UnstickCollisionThreshold:
|
||||
self._collisionTimestamps = []
|
||||
DistributedPetAI.notify.debug('unsticking pet %s' % self.doId)
|
||||
self.brain._unstick()
|
||||
|
||||
def unstickExitOn(self):
|
||||
pass
|
||||
|
@ -987,14 +933,10 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
|
||||
def startLockPetMove(self, avId):
|
||||
self.enableLockMover()
|
||||
self.lockChaseImpulse.setTarget(self.air.doId2do.get(avId))
|
||||
self.lockMover.addImpulse('LockTarget', self.lockChaseImpulse)
|
||||
self.lockMover.setFwdSpeed(self.mover.getFwdSpeed())
|
||||
self.lockMover.setRotSpeed(self.mover.getRotSpeed())
|
||||
dist_Callable = self.movieDistSwitch.get(self.movieMode)
|
||||
dist = dist_Callable(self.air.doId2do.get(avId).getStyle().getLegSize())
|
||||
self.lockChaseImpulse.setMinDist(dist)
|
||||
self.distList = [0, 0, 0]
|
||||
self.mover.walkToAvatar(self.air.doId2do[avId], callback=lambda: self.endLockPetMove(avId))
|
||||
self.__lockPetMoveTask(avId)
|
||||
|
||||
def getAverageDist(self):
|
||||
|
@ -1005,36 +947,18 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
return sum / 3.0
|
||||
|
||||
def __lockPetMoveTask(self, avId):
|
||||
if not hasattr(self, 'air') or avId not in self.air.doId2do:
|
||||
self.notify.warning('avId: %s gone or self deleted!' % avId)
|
||||
return Task.done
|
||||
av = self.air.doId2do.get(avId)
|
||||
dist = av.getDistance(self)
|
||||
self.distList.append(dist)
|
||||
if len(self.distList) > 3:
|
||||
self.distList.pop(0)
|
||||
if self.movieMode in self.movieDistSwitch:
|
||||
dist_Callable = self.movieDistSwitch.get(self.movieMode)
|
||||
movieDist = dist_Callable(av.getStyle().getLegSize())
|
||||
else:
|
||||
self.notify.warning('movieMode: %s not in movieSwitchDist map!' % self.movieMode)
|
||||
return Task.done
|
||||
avgDist = self.getAverageDist()
|
||||
if dist - movieDist > 0.25 and abs(avgDist - dist) > 0.1:
|
||||
self.lockMover.move()
|
||||
taskMgr.doMethodLater(simbase.petMovePeriod, self.__lockPetMoveTask, self.getLockMoveTaskName(), [avId])
|
||||
else:
|
||||
self.endLockPetMove(avId)
|
||||
return Task.done
|
||||
|
||||
def endLockPetMove(self, avId):
|
||||
del self.distList
|
||||
taskMgr.remove(self.getLockMoveTaskName())
|
||||
self.lockPet()
|
||||
self.lockMover.removeImpulse('LockTarget')
|
||||
self.__petMovieStart(avId)
|
||||
|
||||
def enableLockMover(self):
|
||||
if not hasattr(self, 'brain'):
|
||||
return
|
||||
|
||||
if self.lockMoverEnabled == 0:
|
||||
self.brain._startMovie()
|
||||
self.lockMoverEnabled += 1
|
||||
|
@ -1043,6 +967,9 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
return self.lockMoverEnabled > 0
|
||||
|
||||
def disableLockMover(self):
|
||||
if not hasattr(self, 'brain'):
|
||||
return
|
||||
|
||||
if self.lockMoverEnabled > 0:
|
||||
self.lockMoverEnabled -= 1
|
||||
if self.lockMoverEnabled == 0:
|
||||
|
@ -1060,7 +987,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
if self.mood.isComponentActive('fatigue'):
|
||||
cutoff *= 0.5
|
||||
cutoff *= PetTricks.TrickAccuracies[trickId]
|
||||
DistributedPetAI.notify.debug('_willDoTrick: %s / %s' % (randVal, cutoff))
|
||||
DistributedPetAI.notify.info('_willDoTrick: %s / %s' % (randVal, cutoff)) # .debug
|
||||
return randVal < cutoff
|
||||
|
||||
def _handleDidTrick(self, trickId):
|
||||
|
@ -1081,13 +1008,9 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke
|
|||
if self.leashMode:
|
||||
self.leashMode = 0
|
||||
self.leashAvId = None
|
||||
self.brain.goalMgr.removeGoal(self.leashGoal)
|
||||
del self.leashGoal
|
||||
response = 'leash OFF'
|
||||
else:
|
||||
self.leashMode = 1
|
||||
self.leashAvId = avId
|
||||
self.leashGoal = PetGoal.ChaseAvatarLeash(avId)
|
||||
self.brain.goalMgr.addGoal(self.leashGoal)
|
||||
response = 'leash ON'
|
||||
return response
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue