From 9a58ff9568cda2977dad13e307fdb2eca65e1cec Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Mar 2015 14:38:52 +0300 Subject: [PATCH 01/21] Remove some Disney shit --- otp/distributed/OTPClientRepository.py | 55 ---- otp/login/AccountServerConstants.py | 67 ----- otp/login/CreateAccountScreen.py | 247 --------------- otp/login/GuiScreen.py | 276 ----------------- otp/login/RemoteValueSet.py | 1 - otp/login/TTAccount.py | 280 ------------------ otp/otpbase/OTPLocalizerEnglish.py | 19 -- .../distributed/ToontownClientRepository.py | 2 - toontown/login/AccountServerDate.py | 57 ---- toontown/login/DateObject.py | 64 ---- toontown/login/TTDateObject.py | 21 -- 11 files changed, 1089 deletions(-) delete mode 100644 otp/login/AccountServerConstants.py delete mode 100644 otp/login/CreateAccountScreen.py delete mode 100644 otp/login/GuiScreen.py delete mode 100644 otp/login/TTAccount.py delete mode 100644 toontown/login/AccountServerDate.py delete mode 100644 toontown/login/DateObject.py delete mode 100644 toontown/login/TTDateObject.py diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 812388f2..100b365e 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -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 diff --git a/otp/login/AccountServerConstants.py b/otp/login/AccountServerConstants.py deleted file mode 100644 index 51fe790e..00000000 --- a/otp/login/AccountServerConstants.py +++ /dev/null @@ -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() diff --git a/otp/login/CreateAccountScreen.py b/otp/login/CreateAccountScreen.py deleted file mode 100644 index b273f48e..00000000 --- a/otp/login/CreateAccountScreen.py +++ /dev/null @@ -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') diff --git a/otp/login/GuiScreen.py b/otp/login/GuiScreen.py deleted file mode 100644 index 69a83dcf..00000000 --- a/otp/login/GuiScreen.py +++ /dev/null @@ -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'}]) diff --git a/otp/login/RemoteValueSet.py b/otp/login/RemoteValueSet.py index 56955c5f..b9cd31ce 100644 --- a/otp/login/RemoteValueSet.py +++ b/otp/login/RemoteValueSet.py @@ -1,5 +1,4 @@ from direct.directnotify import DirectNotifyGlobal -import TTAccount import HTTPUtil class RemoteValueSet: diff --git a/otp/login/TTAccount.py b/otp/login/TTAccount.py deleted file mode 100644 index 75a40fae..00000000 --- a/otp/login/TTAccount.py +++ /dev/null @@ -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 diff --git a/otp/otpbase/OTPLocalizerEnglish.py b/otp/otpbase/OTPLocalizerEnglish.py index dc707ab3..d6547469 100644 --- a/otp/otpbase/OTPLocalizerEnglish.py +++ b/otp/otpbase/OTPLocalizerEnglish.py @@ -154,21 +154,6 @@ 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 +194,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.' @@ -2896,9 +2880,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) diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 64c1e312..24cda8b4 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -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 diff --git a/toontown/login/AccountServerDate.py b/toontown/login/AccountServerDate.py deleted file mode 100644 index eed9ee39..00000000 --- a/toontown/login/AccountServerDate.py +++ /dev/null @@ -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 diff --git a/toontown/login/DateObject.py b/toontown/login/DateObject.py deleted file mode 100644 index f354a1a2..00000000 --- a/toontown/login/DateObject.py +++ /dev/null @@ -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 diff --git a/toontown/login/TTDateObject.py b/toontown/login/TTDateObject.py deleted file mode 100644 index 5abaac25..00000000 --- a/toontown/login/TTDateObject.py +++ /dev/null @@ -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] From c59211995e38e7f8579e0d98f2cff6729b1f9e67 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 07:54:22 -0400 Subject: [PATCH 02/21] Added config values for production. --- config/release/dev.prc | 5 ++++- config/release/test.prc | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/release/dev.prc b/config/release/dev.prc index d05ae509..b8d23c72 100644 --- a/config/release/dev.prc +++ b/config/release/dev.prc @@ -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: @@ -37,4 +38,6 @@ want-glove-npc #t # Developer options: show-population #t -want-instant-parties #t \ No newline at end of file +want-instant-parties #t +cogdo-pop-factor 1.5 +cogdo-ratio DEFAULT_COGDO_RATIO \ No newline at end of file diff --git a/config/release/test.prc b/config/release/test.prc index a7f318d7..4f3287ec 100644 --- a/config/release/test.prc +++ b/config/release/test.prc @@ -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 From af618b240cd0c0e2d95275cfee914dd4e2cea882 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 07:58:08 -0400 Subject: [PATCH 03/21] ass --- config/release/dev.prc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/release/dev.prc b/config/release/dev.prc index b8d23c72..7ac6a986 100644 --- a/config/release/dev.prc +++ b/config/release/dev.prc @@ -40,4 +40,4 @@ want-glove-npc #t show-population #t want-instant-parties #t cogdo-pop-factor 1.5 -cogdo-ratio DEFAULT_COGDO_RATIO \ No newline at end of file +cogdo-ratio 0.5 \ No newline at end of file From 887ab8443fcd2fe457fd2b3709d990531125198c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Mar 2015 14:59:51 +0300 Subject: [PATCH 04/21] More killing --- otp/chat/ChatManager.py | 44 +------- otp/login/MultiPageTextFrame.py | 80 --------------- otp/login/PrivacyPolicyPanel.py | 97 ------------------ otp/login/RemoteValueSet.py | 70 ------------- otp/login/SecretFriendsInfoPanel.py | 18 ---- otp/otpbase/OTPLocalizerEnglish.py | 22 ---- otp/otpbase/OTPTimer.py | 116 ---------------------- toontown/racing/DistributedLeaderBoard.py | 1 - toontown/toonbase/ToontownTimer.py | 109 +++++++++++++++++++- 9 files changed, 106 insertions(+), 451 deletions(-) delete mode 100644 otp/login/MultiPageTextFrame.py delete mode 100644 otp/login/PrivacyPolicyPanel.py delete mode 100644 otp/login/RemoteValueSet.py delete mode 100644 otp/login/SecretFriendsInfoPanel.py delete mode 100644 otp/otpbase/OTPTimer.py diff --git a/otp/chat/ChatManager.py b/otp/chat/ChatManager.py index b37a1f1a..648a5a93 100644 --- a/otp/chat/ChatManager.py +++ b/otp/chat/ChatManager.py @@ -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') @@ -475,10 +439,4 @@ class ChatManager(DirectObject.DirectObject): self.notify.error('called enterProblemActivatingChat() on parent class') 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') + self.notify.error('called exitProblemActivatingChat() on parent class') \ No newline at end of file diff --git a/otp/login/MultiPageTextFrame.py b/otp/login/MultiPageTextFrame.py deleted file mode 100644 index b7d82c25..00000000 --- a/otp/login/MultiPageTextFrame.py +++ /dev/null @@ -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') diff --git a/otp/login/PrivacyPolicyPanel.py b/otp/login/PrivacyPolicyPanel.py deleted file mode 100644 index 667acd78..00000000 --- a/otp/login/PrivacyPolicyPanel.py +++ /dev/null @@ -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 diff --git a/otp/login/RemoteValueSet.py b/otp/login/RemoteValueSet.py deleted file mode 100644 index b9cd31ce..00000000 --- a/otp/login/RemoteValueSet.py +++ /dev/null @@ -1,70 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -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) diff --git a/otp/login/SecretFriendsInfoPanel.py b/otp/login/SecretFriendsInfoPanel.py deleted file mode 100644 index 1c0b8ea4..00000000 --- a/otp/login/SecretFriendsInfoPanel.py +++ /dev/null @@ -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) diff --git a/otp/otpbase/OTPLocalizerEnglish.py b/otp/otpbase/OTPLocalizerEnglish.py index d6547469..5414cb35 100644 --- a/otp/otpbase/OTPLocalizerEnglish.py +++ b/otp/otpbase/OTPLocalizerEnglish.py @@ -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,9 +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' 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.' diff --git a/otp/otpbase/OTPTimer.py b/otp/otpbase/OTPTimer.py deleted file mode 100644 index 056d4020..00000000 --- a/otp/otpbase/OTPTimer.py +++ /dev/null @@ -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') diff --git a/toontown/racing/DistributedLeaderBoard.py b/toontown/racing/DistributedLeaderBoard.py index 57d2f8cc..7b0fcf40 100644 --- a/toontown/racing/DistributedLeaderBoard.py +++ b/toontown/racing/DistributedLeaderBoard.py @@ -1,6 +1,5 @@ from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal -from otp.otpbase import OTPTimer from toontown.toonbase import TTLocalizer from toontown.racing import KartShopGlobals from toontown.toonbase.ToonBaseGlobal import * diff --git a/toontown/toonbase/ToontownTimer.py b/toontown/toonbase/ToontownTimer.py index 28e2e0fb..a8e72f26 100644 --- a/toontown/toonbase/ToontownTimer.py +++ b/toontown/toonbase/ToontownTimer.py @@ -1,11 +1,31 @@ -from otp.otpbase.OTPTimer import OTPTimer -from pandac.PandaModules import * +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 ToontownTimer(OTPTimer): +class ToontownTimer(DirectFrame): + ClockImage = None + TimerId = 0 def __init__(self, useImage = True, highlightNearEnd = True): - OTPTimer.__init__(self, useImage, highlightNearEnd) + 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(ToontownTimer) + self.timerId = ToontownTimer.TimerId + ToontownTimer.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 ToontownTimer.ClockImage == None: @@ -13,3 +33,84 @@ class ToontownTimer(OTPTimer): ToontownTimer.ClockImage = model.find('**/alarm_clock') model.removeNode() return ToontownTimer.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') From 64845859ff397b38a45fd9267609670e714bf492 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 09:06:13 -0400 Subject: [PATCH 05/21] Began work on emblem items, we don't really need these urgently. --- toontown/estate/DistributedPhoneAI.py | 21 +++++++++++++++++++++ toontown/estate/HouseGlobals.py | 9 +++++++++ toontown/toon/DistributedToon.py | 3 +++ toontown/toonbase/TTLocalizerEnglish.py | 3 +++ 4 files changed, 36 insertions(+) diff --git a/toontown/estate/DistributedPhoneAI.py b/toontown/estate/DistributedPhoneAI.py index 3741bf97..e6bc5c05 100644 --- a/toontown/estate/DistributedPhoneAI.py +++ b/toontown/estate/DistributedPhoneAI.py @@ -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]) diff --git a/toontown/estate/HouseGlobals.py b/toontown/estate/HouseGlobals.py index 4f4de731..a8c5035d 100644 --- a/toontown/estate/HouseGlobals.py +++ b/toontown/estate/HouseGlobals.py @@ -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 + ) diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index baa9ebe7..8e977dc2 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -1153,6 +1153,9 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.monthlyCatalog = CatalogItemList.CatalogItemList(monthlyCatalog) self.weeklyCatalog = CatalogItemList.CatalogItemList(weeklyCatalog) self.backCatalog = CatalogItemList.CatalogItemList(backCatalog) + if config.GetBool('want-house-types', False): + from toontown.catalog import CatalogHouseItem + self.backCatalog.extend(CatalogHouseItem.getAllHouses()) if self.catalogNotify == ToontownGlobals.NewItems: self.catalogNotify = ToontownGlobals.OldItems diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 6347a7d0..ce7b0714 100644 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -9747,6 +9747,9 @@ PickTrackTitle = 'Pick your third track!' PickTrackNotice = 'Choose a track!' UnknownTrack = 'None' +HouseNames = ("Bungalow", "Tiki", "Teepee", "Castle", "Cupcake", "Cabin") +CatalogPurchaseHouseType = "When you buy a new house type, the current one is replaced by it. To recover the old type, you'll need to buy it back. Continue?" + # Buffs buffIdStrings = { From f0c782f19b4faa20b01b7f262647a9012629d0e3 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 09:27:23 -0400 Subject: [PATCH 06/21] Added loudrob serv --- client.bat | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.bat b/client.bat index 9b616bf2..c7f10165 100644 --- a/client.bat +++ b/client.bat @@ -5,11 +5,14 @@ set /P PPYTHON_PATH= Date: Sun, 29 Mar 2015 16:35:45 +0300 Subject: [PATCH 07/21] Fix server connecting --- toontown/toonbase/ToonBase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toontown/toonbase/ToonBase.py b/toontown/toonbase/ToonBase.py index a5a7a304..009cac9c 100644 --- a/toontown/toonbase/ToonBase.py +++ b/toontown/toonbase/ToonBase.py @@ -387,7 +387,7 @@ class ToonBase(OTPBase.OTPBase): def startShow(self, cr, launcherServer = None): self.cr = cr base.graphicsEngine.renderFrame() - gameServer = os.environ.get('TTU_GAMESERVER', 'localhost') + gameServer = launcher.getGameServer() # Get the base port. serverPort = base.config.GetInt('server-port', 7199) From 4881a40bc04cbf1591a444c4c46cecba46537cd0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Mar 2015 17:17:34 +0300 Subject: [PATCH 08/21] Curse you Loudrob --- toontown/battle/DistributedBattleBaseAI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toontown/battle/DistributedBattleBaseAI.py b/toontown/battle/DistributedBattleBaseAI.py index abb41b6f..55afec64 100644 --- a/toontown/battle/DistributedBattleBaseAI.py +++ b/toontown/battle/DistributedBattleBaseAI.py @@ -1621,7 +1621,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) From e0ea00b3bd6f5a3d585338a47599f3da642126b8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Mar 2015 17:36:54 +0300 Subject: [PATCH 09/21] Potential street teleport fix --- otp/distributed/OTPClientRepository.py | 8 +++----- otp/friends/PlayerFriendsManager.py | 2 +- toontown/distributed/ToontownClientRepository.py | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 100b365e..7e08bd2b 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -1899,12 +1899,10 @@ class OTPClientRepository(ClientRepositoryBase): pass def identifyAvatar(self, doId): - info = self.doId2do.get(doId) - if info: - return info + if self.doId2do.has_key(doId): + return self.doId2do[doId] else: - info = self.identifyFriend(doId) - return info + return self.identifyFriend(doId) def sendDisconnect(self): if self.isConnected(): diff --git a/otp/friends/PlayerFriendsManager.py b/otp/friends/PlayerFriendsManager.py index e7dabafa..7c045806 100644 --- a/otp/friends/PlayerFriendsManager.py +++ b/otp/friends/PlayerFriendsManager.py @@ -251,7 +251,7 @@ class PlayerFriendsManager(DistributedObjectGlobal): return returnList def identifyAvatar(self, doId): - if doId in base.cr.doId2do: + if base.cr.doId2do.has_key(doId) return base.cr.doId2do[doId] else: return self.identifyFriend(doId) diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 24cda8b4..074e8738 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -679,11 +679,11 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): self.friendsMap[avatar.doId] = avatar def identifyFriend(self, doId, source = None): - if doId in self.friendsMap: + if self.friendsMap.has_key(doId): teleportNotify.debug('friend %s in friendsMap' % doId) return self.friendsMap[doId] avatar = None - if doId in self.doId2do: + if self.doId2do.has_key(doId): teleportNotify.debug('found friend %s in doId2do' % doId) avatar = self.doId2do[doId] elif self.cache.contains(doId): @@ -716,7 +716,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): return base.cr.playerFriendsManager.getFriendInfo(pId) def identifyAvatar(self, doId): - if doId in self.doId2do: + if self.doId2do.has_key(doId): return self.doId2do[doId] else: return self.identifyFriend(doId) From 8516b04c1e5c9e6d2576ec06b9637a5ca4dfd7ca Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 10:47:36 -0400 Subject: [PATCH 10/21] amateur hour --- config/general.prc | 2 +- otp/friends/PlayerFriendsManager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/general.prc b/config/general.prc index adfc8f04..15b3864a 100644 --- a/config/general.prc +++ b/config/general.prc @@ -81,7 +81,7 @@ want-donald-dock #t want-daisy #t want-minnie #t want-pluto #t -want-donald-dreamland #t +want-donald-dreamland #f want-chip-and-dale #t want-goofy #t diff --git a/otp/friends/PlayerFriendsManager.py b/otp/friends/PlayerFriendsManager.py index 7c045806..f1d83e53 100644 --- a/otp/friends/PlayerFriendsManager.py +++ b/otp/friends/PlayerFriendsManager.py @@ -251,7 +251,7 @@ class PlayerFriendsManager(DistributedObjectGlobal): return returnList def identifyAvatar(self, doId): - if base.cr.doId2do.has_key(doId) + if base.cr.doId2do.has_key(doId): return base.cr.doId2do[doId] else: return self.identifyFriend(doId) From f38f910638c1f52c601ad0c86c6f70b5b4af8051 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Mar 2015 18:41:02 +0300 Subject: [PATCH 11/21] Upstream update --- astron/dclass/united.dc | 3 + toontown/battle/BattleCalculatorAI.py | 2 +- toontown/battle/DistributedBattleBaseAI.py | 98 ++++++---- toontown/battle/MovieDrop.py | 2 +- toontown/battle/MovieSound.py | 2 +- toontown/battle/MovieSquirt.py | 2 + toontown/battle/MovieThrow.py | 4 + toontown/building/PetshopBuildingAI.py | 24 +-- toontown/catalog/CatalogPetTrickItem.py | 2 +- .../distributed/ToontownClientRepository.py | 12 +- toontown/estate/EstateManagerAI.py | 57 +++++- toontown/friends/TTUFriendsManager.py | 20 ++ toontown/friends/TTUFriendsManagerUD.py | 20 ++ toontown/hood/Place.py | 11 +- toontown/pets/DistributedPetAI.py | 109 ++--------- toontown/pets/DistributedPetProxyAI.py | 1 - toontown/pets/DistributedPetUD.py | 55 ++++++ toontown/pets/Pet.py | 38 ++-- toontown/pets/PetActionFSM.py | 54 +----- toontown/pets/PetBrain.py | 20 +- toontown/pets/PetChase.py | 3 + toontown/pets/PetDCImportsAI.py | 1 + toontown/pets/PetDNA.py | 2 +- toontown/pets/PetHandle.py | 1 + toontown/pets/PetLookerAI.py | 10 +- toontown/pets/PetManagerAI.py | 82 +++++++- toontown/pets/PetMoverAI.py | 177 ++++++++++++++++++ toontown/pets/PetTricks.py | 2 +- toontown/pets/PetWander.py | 6 +- toontown/pets/PetshopGUI.py | 3 +- toontown/toon/DistributedNPCPetclerkAI.py | 6 +- toontown/toon/DistributedToon.py | 3 - toontown/toon/Documents - Shortcut.lnk | Bin 922 -> 0 bytes toontown/toon/LocalToon.py | 18 +- toontown/toonbase/BitmaskGlobals.py | 23 +++ toontown/town/Street.py | 24 +-- 36 files changed, 623 insertions(+), 274 deletions(-) create mode 100644 toontown/pets/DistributedPetUD.py create mode 100644 toontown/pets/PetMoverAI.py delete mode 100644 toontown/toon/Documents - Shortcut.lnk create mode 100644 toontown/toonbase/BitmaskGlobals.py diff --git a/astron/dclass/united.dc b/astron/dclass/united.dc index 5db015ae..5eedd98d 100644 --- a/astron/dclass/united.dc +++ b/astron/dclass/united.dc @@ -3740,6 +3740,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); diff --git a/toontown/battle/BattleCalculatorAI.py b/toontown/battle/BattleCalculatorAI.py index 81f271fa..f54d2323 100644 --- a/toontown/battle/BattleCalculatorAI.py +++ b/toontown/battle/BattleCalculatorAI.py @@ -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) diff --git a/toontown/battle/DistributedBattleBaseAI.py b/toontown/battle/DistributedBattleBaseAI.py index 55afec64..da8e39b8 100644 --- a/toontown/battle/DistributedBattleBaseAI.py +++ b/toontown/battle/DistributedBattleBaseAI.py @@ -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() @@ -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() diff --git a/toontown/battle/MovieDrop.py b/toontown/battle/MovieDrop.py index d7a1f063..f1e13d61 100644 --- a/toontown/battle/MovieDrop.py +++ b/toontown/battle/MovieDrop.py @@ -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: diff --git a/toontown/battle/MovieSound.py b/toontown/battle/MovieSound.py index b52c9175..2f81c76d 100644 --- a/toontown/battle/MovieSound.py +++ b/toontown/battle/MovieSound.py @@ -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) diff --git a/toontown/battle/MovieSquirt.py b/toontown/battle/MovieSquirt.py index 72ba13eb..9866c94d 100644 --- a/toontown/battle/MovieSquirt.py +++ b/toontown/battle/MovieSquirt.py @@ -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: diff --git a/toontown/battle/MovieThrow.py b/toontown/battle/MovieThrow.py index a80684ae..be458bbb 100644 --- a/toontown/battle/MovieThrow.py +++ b/toontown/battle/MovieThrow.py @@ -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: diff --git a/toontown/building/PetshopBuildingAI.py b/toontown/building/PetshopBuildingAI.py index 6c1ca6cb..d0216bf3 100644 --- a/toontown/building/PetshopBuildingAI.py +++ b/toontown/building/PetshopBuildingAI.py @@ -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 \ No newline at end of file diff --git a/toontown/catalog/CatalogPetTrickItem.py b/toontown/catalog/CatalogPetTrickItem.py index a9ae44bf..ed6f8b62 100644 --- a/toontown/catalog/CatalogPetTrickItem.py +++ b/toontown/catalog/CatalogPetTrickItem.py @@ -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) diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 074e8738..0f90876b 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -349,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 @@ -357,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) @@ -759,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() diff --git a/toontown/estate/EstateManagerAI.py b/toontown/estate/EstateManagerAI.py index da5a4a01..07a17f17 100644 --- a/toontown/estate/EstateManagerAI.py +++ b/toontown/estate/EstateManagerAI.py @@ -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 @@ -99,7 +100,36 @@ class LoadHouseFSM(FSM): def enterOff(self): 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,7 +260,29 @@ 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): self.callback(True) @@ -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 \ No newline at end of file diff --git a/toontown/friends/TTUFriendsManager.py b/toontown/friends/TTUFriendsManager.py index ff8c6614..87237c36 100644 --- a/toontown/friends/TTUFriendsManager.py +++ b/toontown/friends/TTUFriendsManager.py @@ -40,6 +40,26 @@ class TTUFriendsManager(DistributedObjectGlobal): ['setDNAString' , dnaString], ] 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]) diff --git a/toontown/friends/TTUFriendsManagerUD.py b/toontown/friends/TTUFriendsManagerUD.py index 776fedb7..4bc68240 100644 --- a/toontown/friends/TTUFriendsManagerUD.py +++ b/toontown/friends/TTUFriendsManagerUD.py @@ -257,6 +257,26 @@ class TTUFriendsManagerUD(DistributedObjectGlobalUD): # Inventory, trackAccess, trophies, Hp, maxHp, defaultshard, lastHood, dnastring 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['DistributedPetUD']: + 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): diff --git a/toontown/hood/Place.py b/toontown/hood/Place.py index 86d10b5c..9c837764 100644 --- a/toontown/hood/Place.py +++ b/toontown/hood/Place.py @@ -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() @@ -925,4 +932,4 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager): def handleQuietZoneDone(self): how = base.cr.handlerArgs['how'] - self.fsm.request(how, [base.cr.handlerArgs]) + self.fsm.request(how, [base.cr.handlerArgs]) \ No newline at end of file diff --git a/toontown/pets/DistributedPetAI.py b/toontown/pets/DistributedPetAI.py index dc507627..8a848a70 100644 --- a/toontown/pets/DistributedPetAI.py +++ b/toontown/pets/DistributedPetAI.py @@ -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,33 +947,12 @@ 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): @@ -1060,7 +981,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 +1002,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 diff --git a/toontown/pets/DistributedPetProxyAI.py b/toontown/pets/DistributedPetProxyAI.py index 1b9f91b9..ae83e489 100644 --- a/toontown/pets/DistributedPetProxyAI.py +++ b/toontown/pets/DistributedPetProxyAI.py @@ -356,7 +356,6 @@ class DistributedPetProxyAI(DistributedObjectAI.DistributedObjectAI): def generate(self): DistributedObjectAI.DistributedObjectAI.generate(self) self.traits = PetTraits.PetTraits(self.traitSeed, self.safeZone) - print self.traits.traits for i in xrange(len(self.traitList)): value = self.traitList[i] if value == 0.0: diff --git a/toontown/pets/DistributedPetUD.py b/toontown/pets/DistributedPetUD.py new file mode 100644 index 00000000..7dbf0d2b --- /dev/null +++ b/toontown/pets/DistributedPetUD.py @@ -0,0 +1,55 @@ +from direct.directnotify import DirectNotifyGlobal +from direct.distributed.DistributedObjectUD import DistributedObjectUD + +class DistributedPetUD(DistributedObjectUD): + notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPetUD") + + def setDNA(self, dna): + pass + + def setOwnerId(self, ownerId): + pass + + def setTraitSeed(self, traitSeed): + pass + + def setSafeZone(self, safeZone): + pass + + def setHead(self, head): + pass + + def setEars(self, ears): + pass + + def setNose(self, nose): + pass + + def setTail(self, tail): + pass + + def setBodyTexture(self, bodyTexture): + pass + + def setColor(self, color): + pass + + def setColorScale(self, colorScale): + pass + + def setEyeColor(self, eyeColor): + pass + + def setGender(self, gender): + pass + + def setLastSeenTimestamp(self, timestamp): + pass + + def setTrickAptitudes(self, aptitudes): + pass + + def setLastSeenTimestamp(self, timestamp): + pass + + \ No newline at end of file diff --git a/toontown/pets/Pet.py b/toontown/pets/Pet.py index e3a73496..d37d14f2 100644 --- a/toontown/pets/Pet.py +++ b/toontown/pets/Pet.py @@ -1,24 +1,20 @@ -from direct.actor import Actor +from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal -from direct.distributed.ClockDelta import globalClockDelta +from direct.interval.IntervalGlobal import * from direct.fsm.ClassicFSM import * from direct.fsm.State import * -from direct.interval.IntervalGlobal import * -from direct.showbase import PythonUtil -from direct.task import Task -from pandac.PandaModules import * -import random -import types - -from PetDNA import HeadParts, EarParts, NoseParts, TailParts, BodyTypes, BodyTextures, AllPetColors, getColors, ColorScales, PetEyeColors, EarTextures, TailTextures, getFootTexture, getEarTexture, GiraffeTail, LeopardTail, PetGenders +from direct.distributed.ClockDelta import globalClockDelta from otp.avatar import Avatar -from toontown.chat.ChatGlobals import * -from toontown.nametag import NametagGlobals +from direct.actor import Actor +from direct.task import Task from toontown.pets import PetDNA +from PetDNA import HeadParts, EarParts, NoseParts, TailParts, BodyTypes, BodyTextures, AllPetColors, getColors, ColorScales, PetEyeColors, EarTextures, TailTextures, getFootTexture, getEarTexture, GiraffeTail, LeopardTail, PetGenders +from toontown.toonbase.BitmaskGlobals import PieBitmask from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals - - +from direct.showbase import PythonUtil +import random +import types Component2IconDict = {'boredom': 'Bored', 'restlessness': None, 'playfulness': 'Play', @@ -31,6 +27,10 @@ Component2IconDict = {'boredom': 'Bored', 'anger': 'Angry', 'surprise': 'Surprised', 'affection': 'Love'} + +from toontown.nametag import * +from toontown.nametag.NametagGlobals import * +from toontown.nametag.NametagGroup import * class Pet(Avatar.Avatar): notify = DirectNotifyGlobal.directNotify.newCategory('Pet') @@ -268,7 +268,7 @@ class Pet(Avatar.Avatar): def initializeBodyCollisions(self, collIdStr): Avatar.Avatar.initializeBodyCollisions(self, collIdStr) if not self.ghostMode: - self.collNode.setCollideMask(self.collNode.getIntoCollideMask() | ToontownGlobals.PieBitmask) + self.collNode.setCollideMask(self.collNode.getIntoCollideMask() | PieBitmask) def amplifyColor(self, color, scale): color = color * scale @@ -284,7 +284,7 @@ class Pet(Avatar.Avatar): self.moodIcons.setScale(2.0) self.moodIcons.setZ(3.65) moods = moodIcons.findAllMatches('**/+GeomNode') - for moodNum in xrange(0, moods.getNumPaths()): + for moodNum in range(0, moods.getNumPaths()): mood = moods.getPath(moodNum) mood.reparentTo(self.moodIcons) mood.setBillboardPointEye() @@ -327,9 +327,9 @@ class Pet(Avatar.Avatar): if self.moodModel: self.moodModel.hide() if base.config.GetBool('want-speech-bubble', 1): - self.nametag.setChatText(random.choice(TTLocalizer.SpokenMoods[mood])) + self.nametag.setChat(random.choice(TTLocalizer.SpokenMoods[mood]), CFSpeech) else: - self.nametag.setChatText(random.choice(TTLocalizer.SpokenMoods[mood])) + self.nametag.setChat(random.choice(TTLocalizer.SpokenMoods[mood]), CFThought) def getGenderString(self): if self.style: @@ -653,7 +653,7 @@ def gridPets(): offsetX = 0 offsetY = 0 startPos = base.localAvatar.getPos() - for body in xrange(0, len(BodyTypes)): + for body in range(0, len(BodyTypes)): colors = getColors(body) for color in colors: p = Pet() diff --git a/toontown/pets/PetActionFSM.py b/toontown/pets/PetActionFSM.py index 2f11cf0b..6566e70f 100644 --- a/toontown/pets/PetActionFSM.py +++ b/toontown/pets/PetActionFSM.py @@ -18,70 +18,30 @@ class PetActionFSM(FSM.FSM): def destroy(self): self.cleanup() - def enterNeutral(self): - PetActionFSM.notify.debug('enterNeutral') - - def exitNeutral(self): - pass - def enterChase(self, target): PetActionFSM.notify.debug('enterChase: %s' % target) - self.pet.chaseImpulse.setTarget(target) - self.pet.mover.addImpulse('chase', self.pet.chaseImpulse) self.pet.unstickFSM.request('on') def exitChase(self): self.pet.unstickFSM.request('off') - self.pet.mover.removeImpulse('chase') def enterFlee(self, chaser): PetActionFSM.notify.debug('enterFlee: %s' % chaser) - self.pet.fleeImpulse.setChaser(chaser) - self.pet.mover.addImpulse('flee', self.pet.fleeImpulse) self.pet.unstickFSM.request('on') def exitFlee(self): self.pet.unstickFSM.request('off') - self.pet.mover.removeImpulse('flee') - - def enterWander(self): - PetActionFSM.notify.debug('enterWander') - self.pet.mover.addImpulse('wander', self.pet.wanderImpulse) - - def exitWander(self): - self.pet.mover.removeImpulse('wander') - - def enterUnstick(self): - PetActionFSM.notify.debug('enterUnstick') - self.pet.mover.addImpulse('unstick', self.pet.wanderImpulse) - - def exitUnstick(self): - self.pet.mover.removeImpulse('unstick') def enterInspectSpot(self, spot): PetActionFSM.notify.debug('enterInspectSpot') - self.pet.chaseImpulse.setTarget(spot) - self.pet.mover.addImpulse('inspect', self.pet.chaseImpulse) self.pet.unstickFSM.request('on') def exitInspectSpot(self): self.pet.unstickFSM.request('off') - self.pet.mover.removeImpulse('inspect') - - def enterStay(self, avatar): - PetActionFSM.notify.debug('enterStay') - - def exitStay(self): - pass def enterHeal(self, avatar): PetActionFSM.notify.debug('enterHeal') avatar.toonUp(3) - self.pet.chaseImpulse.setTarget(avatar) - self.pet.mover.addImpulse('chase', self.pet.chaseImpulse) - - def exitHeal(self): - self.pet.mover.removeImpulse('chase') def enterTrick(self, avatar, trickId): PetActionFSM.notify.debug('enterTrick') @@ -95,11 +55,9 @@ class PetActionFSM(FSM.FSM): aptitude = self.pet.getTrickAptitude(trickId) healAmt = int(lerp(healRange[0], healRange[1], aptitude)) if healAmt: - for avId in self.pet.brain.getAvIdsLookingAtUs(): - av = self.pet.air.doId2do.get(avId) - if av: - if isinstance(av, DistributedToonAI.DistributedToonAI): - av.toonUp(healAmt) + for avId, av in self.pet._getFullNearbyToonDict().items(): + if isinstance(av, DistributedToonAI.DistributedToonAI): + av.toonUp(healAmt) self.pet._handleDidTrick(trickId) if not self.pet.isLockedDown(): @@ -124,9 +82,3 @@ class PetActionFSM(FSM.FSM): if self.pet.isLockedDown(): self.pet.unlockPet() del self.trickDoneEvent - - def enterMovie(self): - PetActionFSM.notify.debug('enterMovie') - - def exitMovie(self): - pass diff --git a/toontown/pets/PetBrain.py b/toontown/pets/PetBrain.py index 33044296..581f9d6e 100644 --- a/toontown/pets/PetBrain.py +++ b/toontown/pets/PetBrain.py @@ -2,11 +2,10 @@ from pandac.PandaModules import * from direct.showbase.PythonUtil import weightedChoice, randFloat, Functor from direct.showbase.PythonUtil import list2dict from direct.showbase import DirectObject -from direct.distributed import DistributedObjectAI +from direct.distributed import DistributedObject, DistributedObjectAI from direct.directnotify import DirectNotifyGlobal from direct.task import Task from direct.fsm import FSM -from toontown.toon import DistributedToonAI from toontown.pets import PetConstants, PetObserve, PetGoal, PetGoalMgr from toontown.pets import PetTricks, PetLookerAI import random, types @@ -387,13 +386,13 @@ class PetBrain(DirectObject.DirectObject): def _handleComeHere(avId, self = self): avatar = simbase.air.doId2do.get(avId) if avatar: - self._chase(avatar) + self.pet.mover.walkToAvatar(avatar) avatar.setHatePets(0) def _handleFollowMe(avId, self = self): avatar = simbase.air.doId2do.get(avId) if avatar: - self._chase(avatar) + self.pet.mover.walkToAvatar(avatar) avatar.setHatePets(0) def _handleStay(avId, self = self): @@ -421,15 +420,14 @@ class PetBrain(DirectObject.DirectObject): return def _handleDoTrick(trickId, avId, self = self): + looked = self.lookedAtBy(avId) or config.GetBool('pet-brain-ignore-looked-tricks', True) avatar = simbase.air.doId2do.get(avId) if avatar: - if self.lookedAtBy(avatar.doId): - if not self.goalMgr.hasTrickGoal(): - if not self.pet._willDoTrick(trickId): - self.pet.trickFailLogger.addEvent(trickId) - trickId = PetTricks.Tricks.BALK - trickGoal = PetGoal.DoTrick(avatar, trickId) - self.goalMgr.addGoal(trickGoal) + if looked: + if not self.pet._willDoTrick(trickId): + self.pet.trickFailLogger.addEvent(trickId) + trickId = PetTricks.Tricks.BALK + self._doTrick(trickId, avatar) phrase = observe.getPetPhrase() avId = observe.getAvId() diff --git a/toontown/pets/PetChase.py b/toontown/pets/PetChase.py index 599770aa..a178aaf7 100644 --- a/toontown/pets/PetChase.py +++ b/toontown/pets/PetChase.py @@ -69,3 +69,6 @@ class PetChase(Impulse.Impulse): if vH: self.rotVel.setX(vH) self.mover.addRotShove(self.rotVel) + + def setMinDist(self, minDist): + self.minDist = minDist diff --git a/toontown/pets/PetDCImportsAI.py b/toontown/pets/PetDCImportsAI.py index fb2b5c86..1c92bbeb 100644 --- a/toontown/pets/PetDCImportsAI.py +++ b/toontown/pets/PetDCImportsAI.py @@ -1,2 +1,3 @@ if hasattr(simbase, 'wantPets') and simbase.wantPets: import DistributedPetAI + import DistributedPetUD diff --git a/toontown/pets/PetDNA.py b/toontown/pets/PetDNA.py index f7b2d708..3395464f 100644 --- a/toontown/pets/PetDNA.py +++ b/toontown/pets/PetDNA.py @@ -240,7 +240,7 @@ def getBodyRarity(bodyIndex): for zoneId in PetRarities['body']: for body in PetRarities['body'][zoneId]: totalWeight += PetRarities['body'][zoneId][body] - if body in weight: + if weight.has_key(body): weight[body] += PetRarities['body'][zoneId][body] else: weight[body] = PetRarities['body'][zoneId][body] diff --git a/toontown/pets/PetHandle.py b/toontown/pets/PetHandle.py index 1eecdf1f..c377310a 100644 --- a/toontown/pets/PetHandle.py +++ b/toontown/pets/PetHandle.py @@ -59,6 +59,7 @@ class PetHandle: def updateMoodFromServer(self, callWhenDone = None): def handleGotDetails(avatar, callWhenDone = callWhenDone): + avatar.announceGenerate() self._grabMood(avatar) if callWhenDone: callWhenDone() diff --git a/toontown/pets/PetLookerAI.py b/toontown/pets/PetLookerAI.py index 6cbdd42d..b9bede67 100644 --- a/toontown/pets/PetLookerAI.py +++ b/toontown/pets/PetLookerAI.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal from direct.showbase import DirectObject from otp.ai.AIZoneData import AIZoneData -from toontown.toonbase import ToontownGlobals +from toontown.toonbase.BitmaskGlobals import PetLookatPetBitmask, PetLookatNonPetBitmask from toontown.pets import PetConstants def getStartLookingAtOtherEvent(lookingAvId): @@ -83,11 +83,11 @@ class PetLookerAI: lookSphereNode.addSolid(lookSphere) lookSphereNode.setFromCollideMask(BitMask32.allOff()) if isPet: - intoCollideMask = ToontownGlobals.PetLookatPetBitmask - fromCollideMask = ToontownGlobals.PetLookatPetBitmask | ToontownGlobals.PetLookatNonPetBitmask + intoCollideMask = PetLookatPetBitmask + fromCollideMask = PetLookatPetBitmask | PetLookatNonPetBitmask else: - intoCollideMask = ToontownGlobals.PetLookatNonPetBitmask - fromCollideMask = ToontownGlobals.PetLookatPetBitmask + intoCollideMask = PetLookatNonPetBitmask + fromCollideMask = PetLookatPetBitmask lookSphereNode.setIntoCollideMask(intoCollideMask) lookSphereNode.setFromCollideMask(fromCollideMask) self.lookSphereNodePath = self.__collNode.attachNewNode(lookSphereNode) diff --git a/toontown/pets/PetManagerAI.py b/toontown/pets/PetManagerAI.py index fbdaeb6e..da991ce3 100644 --- a/toontown/pets/PetManagerAI.py +++ b/toontown/pets/PetManagerAI.py @@ -1,12 +1,86 @@ +from direct.directnotify import DirectNotifyGlobal +from direct.fsm.FSM import FSM +import PetUtil, PetDNA +from toontown.hood import ZoneUtil +from toontown.building import PetshopBuildingAI +from toontown.toonbase import ToontownGlobals, TTLocalizer import random +import cPickle, time, random, os +MINUTE = 60 +HOUR = 60 * MINUTE +DAY = 24 * HOUR +def getDayId(): + return int(time.time() // DAY) + class PetManagerAI: + NUM_DAILY_PETS = 5 + cachePath = config.GetString('air-pet-cache', 'astron/databases/air_cache/') def __init__(self, air): self.air = air + self.cacheFile = '%spets_%d.pets' % (self.cachePath, self.air.districtId) + if os.path.isfile(self.cacheFile): + with open(self.cacheFile, 'rb') as f: + data = f.read() + + self.seeds = cPickle.loads(data) + if self.seeds.get('day', -1) != getDayId() or len(self.seeds.get(ToontownGlobals.ToontownCentral, [])) != self.NUM_DAILY_PETS: + self.generateSeeds() + + else: + self.generateSeeds() + + def generateSeeds(self): + seeds = range(0, 255) + random.shuffle(seeds) + + self.seeds = {} + for hood in (ToontownGlobals.ToontownCentral, ToontownGlobals.DonaldsDock, ToontownGlobals.DaisyGardens, + ToontownGlobals.MinniesMelodyland, ToontownGlobals.TheBrrrgh, ToontownGlobals.DonaldsDreamland): + self.seeds[hood] = [seeds.pop() for _ in xrange(self.NUM_DAILY_PETS)] + + self.seeds['day'] = getDayId() + + with open(self.cacheFile, 'wb') as f: + f.write(cPickle.dumps(self.seeds)) - def getAvailablePets(self, numPets=5): - return random.sample(xrange(256), numPets) + + def getAvailablePets(self, seed, safezoneId): + if self.seeds.get('day', -1) != getDayId(): + self.generateSeeds() + + return self.seeds.get(safezoneId, [seed]) - def createNewPetFromSeed(self, avId, petSeeds, nameIndex, gender, safeZoneId): - pass # TODO + def createNewPetFromSeed(self, avId, seed, nameIndex, gender, safeZoneId): + av = self.air.doId2do[avId] + + name = TTLocalizer.getPetName(nameIndex) + _, dna, traitSeed = PetUtil.getPetInfoFromSeed(seed, safeZoneId) + head, ears, nose, tail, body, color, cs, eye, _ = dna + numGenders = len(PetDNA.PetGenders) + gender %= numGenders + + fields = {'setOwnerId' : avId, 'setPetName' : name, 'setTraitSeed' : traitSeed, 'setSafeZone' : safeZoneId, + 'setHead' : head, 'setEars' : ears, 'setNose' : nose, 'setTail' : tail, 'setBodyTexture' : body, + 'setColor' : color, 'setColorScale' : cs, 'setEyeColor' : eye, 'setGender' : gender} + + def response(doId): + if not doId: + self.air.notify.warning("Cannot create pet for %s!" % avId) + return + + self.air.writeServerEvent('bought-pet', avId, doId) + av.b_setPetId(doId) + + self.air.dbInterface.createObject(self.air.dbId, self.air.dclassesByName['DistributedPetAI'], + {k: (v,) for k,v in fields.items()}, response) + + def deleteToonsPet(self, avId): + av = self.air.doId2do[avId] + pet = av.getPetId() + if pet: + if pet in self.air.doId2do: + self.air.doId2do[pet].requestDelete() + + av.b_setPetId(0) \ No newline at end of file diff --git a/toontown/pets/PetMoverAI.py b/toontown/pets/PetMoverAI.py new file mode 100644 index 00000000..f0502e51 --- /dev/null +++ b/toontown/pets/PetMoverAI.py @@ -0,0 +1,177 @@ +from panda3d.core import * +from direct.interval.IntervalGlobal import * +from direct.fsm.FSM import * +import random, math + +estateRadius = 130 +estateCenter = (0, -40) + +houseRadius = 15 +houses = ((60, 10), (42, 75), (-37, 35), (80, -80), (-70, -120), (-55, -40)) + +def inCircle(x, y, c=estateCenter, r=estateRadius): + center_x, center_y = c + square_dist = (center_x - x) ** 2 + (center_y - y) ** 2 + return square_dist <= r ** 2 + +def housePointCollision(x, y): + for i, h in enumerate(houses): + if inCircle(x, y, h, houseRadius): + return 1 + + return 0 + +def generatePos(): + def get(): + r = random.randint(0, estateRadius) - estateRadius / 2 + r2 = random.randint(0, estateRadius) - estateRadius / 2 + x = r + estateCenter[0] + y = r2 + estateCenter[1] + assert inCircle(x, y) + return x, y + + p = get() + while housePointCollision(*p): + p = get() + + return p + +def lineInCircle(pt1, pt2, circlePoint, circleRadius=houseRadius): + x1, y1 = pt1 + x2, y2 = pt2 + + dist = math.hypot(x2 - x1, y2 - y1) + if dist == 0: + return 0 + + dx = (x2 - x1) / dist + dy = (y2 - y1) / dist + + t = dx * (circlePoint[0] - x1) + dy * (circlePoint[1] - y1) + + ex = t * dx + x1 + ey = t * dy + y1 + + d2 = math.hypot(ex - circlePoint[0], ey - circlePoint[1]) + return d2 <= circleRadius + +def houseCollision(pt1, pt2): + for i, h in enumerate(houses): + if lineInCircle(pt1, pt2, h): + return 1 + + return 0 + +def generatePath(start, end): + points = [start] + if not houseCollision(start, end): + points.append(end) + return points + + while True: + next = generatePos() + while houseCollision(points[-1], next): + next = generatePos() + + points.append(next) + if not houseCollision(next, end): + points.append(end) + return points + +class PetMoverAI(FSM): + def __init__(self, pet): + self.pet = pet + FSM.__init__(self, 'PetMoverAI-%d' % self.pet.doId) + self.chaseTarget = None + self.__seq = None + self.fwdSpeed = 10.0 + self.rotSpeed = 360.0 + self.__moveFromStill() + self.__chaseCallback = None + + def enterStill(self): + taskMgr.doMethodLater(random.randint(15, 60), self.__moveFromStill, self.pet.uniqueName('next-state')) + + def exitStill(self): + taskMgr.remove(self.pet.uniqueName('next-state')) + + def __moveFromStill(self, task=None): + choices = ["Wander"] + # if self.pet._getNearbyAvatarDict(): + # choices.append("Chase") + + nextState = random.choice(choices) + self.request(nextState) + + def enterWander(self): + target = self.getPoint() + self.walkToPoint(target) + + def getPoint(self): + x, y = generatePos() + return Point3(x, y, 0) + + def walkToPoint(self, target): + here = self.pet.getPos() + dist = Vec3((here - target)).length() + dist = dist * 0.9 + self.__seq = Sequence(Func(self.pet.lookAt, target), self.pet.posInterval(dist / self.fwdSpeed, target, here), + Func(self.__stateComplete)) + self.__seq.start() + + def exitWander(self): + if self.__seq: + self.__seq.pause() + + self.__seq = None + + def __stateComplete(self): + try: + self.request("Still") + + except: + pass + + def destroy(self): + self.demand("Off") + + def setFwdSpeed(self, speed): + self.fwdSpeed = speed + + def getFwdSpeed(self): + return self.fwdSpeed + + def setRotSpeed(self, speed): + self.rotSpeed = speed + + def getRotSpeed(self): + return self.rotSpeed + + def lock(self): + if self.state != "Still": + self.demand("Still") + + def enterChase(self, target=None): + if not target: + target = hidden.attachNewNode('target') + target.setPos(self.getPoint()) + + self.walkToPoint(target.getPos()) + + + def exitChase(self): + if self.__chaseCallback: + self.__chaseCallback() + self.__chaseCallback = None + + if self.__seq: + self.__seq.pause() + + self.__seq = None + + def walkToAvatar(self, av, callback=None): + if callback: + self.__chaseCallback = callback + + self.demand("Chase", av) + \ No newline at end of file diff --git a/toontown/pets/PetTricks.py b/toontown/pets/PetTricks.py index e5fcecf1..aed0914a 100644 --- a/toontown/pets/PetTricks.py +++ b/toontown/pets/PetTricks.py @@ -7,7 +7,7 @@ NonHappyMinActualTrickAptitude = 0.1 NonHappyMaxActualTrickAptitude = 0.6 MinActualTrickAptitude = 0.5 MaxActualTrickAptitude = 0.97 -AptitudeIncrementDidTrick = 0.0005 +AptitudeIncrementDidTrick = 0.0005 * config.GetFloat('pet-trick-aptitude-mult', 4) MaxAptitudeIncrementGotPraise = 0.0003 MaxTrickFatigue = 0.65 MinTrickFatigue = 0.1 diff --git a/toontown/pets/PetWander.py b/toontown/pets/PetWander.py index fa700a38..e2374708 100644 --- a/toontown/pets/PetWander.py +++ b/toontown/pets/PetWander.py @@ -24,14 +24,14 @@ class PetWander(PetChase, DirectObject.DirectObject): return def _setMover(self, mover): - CPetChase.setMover(self, mover) + PetChase._setMover(self, mover) self.mover = mover self.__ignoreCollisions() self.collEvent = mover.getCollisionEventName() self.accept(self.collEvent, self._handleCollision) def _clearMover(self, mover): - CPetChase.clearMover(self, mover) + PetChase._clearMover(self, mover) self.__ignoreCollisions() def _handleCollision(self, collEntry): @@ -58,4 +58,4 @@ class PetWander(PetChase, DirectObject.DirectObject): target.setY(target, distance) duration = distance / self.mover.getFwdSpeed() self.targetMoveCountdown = duration * randFloat(1.2, 3.0) - CPetChase.process(self, dt) + PetChase._process(self, dt) diff --git a/toontown/pets/PetshopGUI.py b/toontown/pets/PetshopGUI.py index caaf1a99..b9360b4e 100644 --- a/toontown/pets/PetshopGUI.py +++ b/toontown/pets/PetshopGUI.py @@ -254,6 +254,7 @@ class PetshopGUI(DirectObject): self.okButton = DirectButton(parent=self, relief=None, image=okImageList, geom=checkIcon, scale=modelScale, text=('', TTLocalizer.PetshopReturn), text_pos=(5.8, 4.4), text_scale=0.7, pressEffect=False, command=lambda : messenger.send(doneEvent, [1])) self.petView = self.attachNewNode('petView') self.petView.setPos(-0.15, 0, 0.8) + avatar.announceGenerate() self.petModel = Pet.Pet(forGui=1) self.petModel.setDNA(avatar.getDNA()) self.petModel.fitAndCenterHead(0.395, forGui=1) @@ -342,7 +343,7 @@ class PetshopGUI(DirectObject): descList.append('\t%s' % trait) descList.append(TTLocalizer.PetshopDescCost % cost) - self.petDesc.append(string.join(descList, '\n')) + self.petDesc.append('\n'.join(descList)) self.petCost.append(cost) def destroy(self): diff --git a/toontown/toon/DistributedNPCPetclerkAI.py b/toontown/toon/DistributedNPCPetclerkAI.py index 46a620fd..9833f518 100644 --- a/toontown/toon/DistributedNPCPetclerkAI.py +++ b/toontown/toon/DistributedNPCPetclerkAI.py @@ -5,6 +5,7 @@ from toontown.toonbase import TTLocalizer from direct.task import Task from toontown.fishing import FishGlobals from toontown.pets import PetUtil, PetDNA, PetConstants +from toontown.hood import ZoneUtil class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): @@ -20,13 +21,13 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): def avatarEnter(self): avId = self.air.getAvatarIdFromSender() - if avId not in self.air.doId2do: + if not self.air.doId2do.has_key(avId): self.notify.warning('Avatar: %s not found' % avId) return if self.isBusy(): self.freeAvatar(avId) return - self.petSeeds = simbase.air.petMgr.getAvailablePets(5) + self.petSeeds = self.petMgr.getAvailablePets(3, ZoneUtil.getCanonicalSafeZoneId(self.zoneId)) numGenders = len(PetDNA.PetGenders) self.petSeeds *= numGenders self.petSeeds.sort() @@ -125,6 +126,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): if av: simbase.air.petMgr.deleteToonsPet(avId) self.transactionType = 'return' + self.transactionDone() def transactionDone(self): avId = self.air.getAvatarIdFromSender() diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 8e977dc2..522db9a3 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -1758,9 +1758,6 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def getPetId(self): return self.petId - def getPetId(self): - return self.petId - def hasPet(self): return self.petId != 0 diff --git a/toontown/toon/Documents - Shortcut.lnk b/toontown/toon/Documents - Shortcut.lnk deleted file mode 100644 index 1abdc0623c2f1e861cc91e1571e505e91b6d3516..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 922 zcmah{Ur1A76#qFZv_WpnB5dR+mPTydZI*KoWOvL3mZLQ=xzJ>;G;}NP2HH~uL1ocH z3@j*CRQ6B=k@R4R^wLv03Ze`mqNgOpH=(3{=U&@`34NE}`G3xLzH?7IfQniRDKKSF zL`F~rJLOEzx=n?jGZoXHhCH*$Qkg?B11n5crcuycxgm}&;1t2@=(Jvgj|v#I<*I+N33g_oc950wkn0!0E5 zLYlHtFWr2%bZz^S$m3`I7owGYuf;dVc~sMvpzMps;y;v^vnnpNjV+cO_w*CnT4?Vf zP)|6BE_5S>UeZAf!-Ynu2(gI-bfjt1u~Wj0bCpzze!biodC?wJCw@7u?-(7JmPxIV z2r0Uoh{FRPv4`**k`FB$UJ!c?1gMEGK(9hufV7D;NV{Yk?dv5%nh_z4EMJ(%0N;~AjxPc>5;X+&3;BH5STXs* z Date: Sun, 29 Mar 2015 11:55:25 -0400 Subject: [PATCH 12/21] Revert "amateur hour" This reverts commit 8516b04c1e5c9e6d2576ec06b9637a5ca4dfd7ca. --- config/general.prc | 2 +- otp/friends/PlayerFriendsManager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/general.prc b/config/general.prc index 15b3864a..adfc8f04 100644 --- a/config/general.prc +++ b/config/general.prc @@ -81,7 +81,7 @@ want-donald-dock #t want-daisy #t want-minnie #t want-pluto #t -want-donald-dreamland #f +want-donald-dreamland #t want-chip-and-dale #t want-goofy #t diff --git a/otp/friends/PlayerFriendsManager.py b/otp/friends/PlayerFriendsManager.py index f1d83e53..7c045806 100644 --- a/otp/friends/PlayerFriendsManager.py +++ b/otp/friends/PlayerFriendsManager.py @@ -251,7 +251,7 @@ class PlayerFriendsManager(DistributedObjectGlobal): return returnList def identifyAvatar(self, doId): - if base.cr.doId2do.has_key(doId): + if base.cr.doId2do.has_key(doId) return base.cr.doId2do[doId] else: return self.identifyFriend(doId) From c79f5498e1c22f291ce77fa5520fe2661a7d4bbb Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 11:55:35 -0400 Subject: [PATCH 13/21] Revert "Potential street teleport fix" This reverts commit e0ea00b3bd6f5a3d585338a47599f3da642126b8. --- otp/distributed/OTPClientRepository.py | 8 +++++--- otp/friends/PlayerFriendsManager.py | 2 +- toontown/distributed/ToontownClientRepository.py | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 7e08bd2b..100b365e 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -1899,10 +1899,12 @@ class OTPClientRepository(ClientRepositoryBase): pass def identifyAvatar(self, doId): - if self.doId2do.has_key(doId): - return self.doId2do[doId] + info = self.doId2do.get(doId) + if info: + return info else: - return self.identifyFriend(doId) + info = self.identifyFriend(doId) + return info def sendDisconnect(self): if self.isConnected(): diff --git a/otp/friends/PlayerFriendsManager.py b/otp/friends/PlayerFriendsManager.py index 7c045806..e7dabafa 100644 --- a/otp/friends/PlayerFriendsManager.py +++ b/otp/friends/PlayerFriendsManager.py @@ -251,7 +251,7 @@ class PlayerFriendsManager(DistributedObjectGlobal): return returnList def identifyAvatar(self, doId): - if base.cr.doId2do.has_key(doId) + if doId in base.cr.doId2do: return base.cr.doId2do[doId] else: return self.identifyFriend(doId) diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 074e8738..24cda8b4 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -679,11 +679,11 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): self.friendsMap[avatar.doId] = avatar def identifyFriend(self, doId, source = None): - if self.friendsMap.has_key(doId): + if doId in self.friendsMap: teleportNotify.debug('friend %s in friendsMap' % doId) return self.friendsMap[doId] avatar = None - if self.doId2do.has_key(doId): + if doId in self.doId2do: teleportNotify.debug('found friend %s in doId2do' % doId) avatar = self.doId2do[doId] elif self.cache.contains(doId): @@ -716,7 +716,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): return base.cr.playerFriendsManager.getFriendInfo(pId) def identifyAvatar(self, doId): - if self.doId2do.has_key(doId): + if doId in self.doId2do: return self.doId2do[doId] else: return self.identifyFriend(doId) From 9b755ed2a7ffba4371bcf71d14e29e84151d2843 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 12:08:31 -0400 Subject: [PATCH 14/21] New record is supposed to be orange. --- toontown/fishing/FishPanel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toontown/fishing/FishPanel.py b/toontown/fishing/FishPanel.py index c2a31a1f..ac5c9219 100644 --- a/toontown/fishing/FishPanel.py +++ b/toontown/fishing/FishPanel.py @@ -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() From 35abc0b1c392f0cb51fb47fce59a2ff791fa326c Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 12:19:47 -0400 Subject: [PATCH 15/21] Fix --- otp/distributed/DCClassImports.py | 2 +- toontown/toon/DistributedNPCPetclerkAI.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/otp/distributed/DCClassImports.py b/otp/distributed/DCClassImports.py index f0e371ae..aaf09b3a 100644 --- a/otp/distributed/DCClassImports.py +++ b/otp/distributed/DCClassImports.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * -hashVal = 3216321797L +hashVal = 188749006 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 diff --git a/toontown/toon/DistributedNPCPetclerkAI.py b/toontown/toon/DistributedNPCPetclerkAI.py index 9833f518..92c0e578 100644 --- a/toontown/toon/DistributedNPCPetclerkAI.py +++ b/toontown/toon/DistributedNPCPetclerkAI.py @@ -27,7 +27,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): if self.isBusy(): self.freeAvatar(avId) return - self.petSeeds = self.petMgr.getAvailablePets(3, ZoneUtil.getCanonicalSafeZoneId(self.zoneId)) + self.petSeeds = self.air.petMgr.getAvailablePets(3, ZoneUtil.getCanonicalHoodId(self.zoneId)) numGenders = len(PetDNA.PetGenders) self.petSeeds *= numGenders self.petSeeds.sort() @@ -40,7 +40,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): self.d_setMovie(avId, flag) taskMgr.doMethodLater(PetConstants.PETCLERK_TIMER, self.sendTimeoutMovie, self.uniqueName('clearMovie')) DistributedNPCToonBaseAI.avatarEnter(self) - + def rejectAvatar(self, avId): self.notify.warning('rejectAvatar: should not be called by a fisherman!') @@ -105,11 +105,12 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): if av.petId != 0: simbase.air.petMgr.deleteToonsPet(avId) gender = petNum % len(PetDNA.PetGenders) - if nameIndex not in xrange(0, len(TTLocalizer.PetNameDictionary) - 1): + if nameIndex not in xrange(0, TTLocalizer.PetNameIndexMAX): self.air.writeServerEvent('avoid_crash', avId, "DistributedNPCPetclerkAI.petAdopted and didn't have valid nameIndex!") self.notify.warning("somebody called petAdopted and didn't have valid nameIndex to adopt! avId: %s" % avId) return simbase.air.petMgr.createNewPetFromSeed(avId, self.petSeeds[petNum], nameIndex=nameIndex, gender=gender, safeZoneId=zoneId) + self.notify.warning("Created new pet from seed") self.transactionType = 'adopt' bankPrice = min(av.getBankMoney(), cost) walletPrice = cost - bankPrice @@ -126,7 +127,8 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): if av: simbase.air.petMgr.deleteToonsPet(avId) self.transactionType = 'return' - self.transactionDone() + + self.transactionDone() def transactionDone(self): avId = self.air.getAvatarIdFromSender() From 983eb61b68a1726b0c2cd61a2ca1c998abfbe658 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Mar 2015 19:46:50 +0300 Subject: [PATCH 16/21] Fix pet shop --- toontown/pets/PetDNA.py | 21 +++++++++++---------- toontown/pets/PetUtil.py | 4 ++-- toontown/toon/DistributedNPCPetclerkAI.py | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/toontown/pets/PetDNA.py b/toontown/pets/PetDNA.py index 3395464f..46be0712 100644 --- a/toontown/pets/PetDNA.py +++ b/toontown/pets/PetDNA.py @@ -2,6 +2,7 @@ from toontown.toon import ToonDNA from pandac.PandaModules import VBase4 from toontown.toonbase import TTLocalizer, ToontownGlobals from direct.showbase import PythonUtil +import random NumFields = 9 Fields = {'head': 0, 'ears': 1, @@ -179,17 +180,17 @@ PetEyeColors = (VBase4(0.29, 0.29, 0.69, 1.0), VBase4(0.49, 0.99, 0.49, 1.0)) PetGenders = [0, 1] -def getRandomPetDNA(zoneId = ToontownGlobals.DonaldsDreamland): - from random import choice - head = choice(range(-1, len(HeadParts))) - ears = choice(range(-1, len(EarParts))) - nose = choice(range(-1, len(NoseParts))) - tail = choice(range(-1, len(TailParts))) +def getRandomPetDNA(seed = 0, zoneId = ToontownGlobals.DonaldsDreamland): + random.seed(seed + zoneId) + head = random.choice(range(-1, len(HeadParts))) + ears = random.choice(range(-1, len(EarParts))) + nose = random.choice(range(-1, len(NoseParts))) + tail = random.choice(range(-1, len(TailParts))) body = getSpecies(zoneId) - color = choice(range(0, len(getColors(body)))) - colorScale = choice(range(0, len(ColorScales))) - eyes = choice(range(0, len(PetEyeColors))) - gender = choice(range(0, len(PetGenders))) + color = random.choice(range(0, len(getColors(body)))) + colorScale = random.choice(range(0, len(ColorScales))) + eyes = random.choice(range(0, len(PetEyeColors))) + gender = random.choice(range(0, len(PetGenders))) return [head, ears, nose, diff --git a/toontown/pets/PetUtil.py b/toontown/pets/PetUtil.py index 8eb1c11a..454482c9 100644 --- a/toontown/pets/PetUtil.py +++ b/toontown/pets/PetUtil.py @@ -3,9 +3,9 @@ from toontown.toonbase import TTLocalizer from direct.showbase import PythonUtil def getPetInfoFromSeed(seed, safezoneId): - dnaArray = PetDNA.getRandomPetDNA(safezoneId) + dnaArray = PetDNA.getRandomPetDNA(seed, safezoneId) gender = PetDNA.getGender(dnaArray) - nameString = TTLocalizer.getRandomPetName(gender=gender, seed=seed + safezoneId) + nameString = TTLocalizer.getRandomPetName(gender=gender, seed=seed) traitSeed = PythonUtil.randUint31() return (nameString, dnaArray, traitSeed) diff --git a/toontown/toon/DistributedNPCPetclerkAI.py b/toontown/toon/DistributedNPCPetclerkAI.py index 92c0e578..2daee72d 100644 --- a/toontown/toon/DistributedNPCPetclerkAI.py +++ b/toontown/toon/DistributedNPCPetclerkAI.py @@ -105,7 +105,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): if av.petId != 0: simbase.air.petMgr.deleteToonsPet(avId) gender = petNum % len(PetDNA.PetGenders) - if nameIndex not in xrange(0, TTLocalizer.PetNameIndexMAX): + if nameIndex not in xrange(0, len(TTLocalizer.PetNameDictionary) - 1): self.air.writeServerEvent('avoid_crash', avId, "DistributedNPCPetclerkAI.petAdopted and didn't have valid nameIndex!") self.notify.warning("somebody called petAdopted and didn't have valid nameIndex to adopt! avId: %s" % avId) return From 48998e45cea7c7050160b60d935e9ccc68520116 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Mar 2015 20:45:32 +0300 Subject: [PATCH 17/21] Remove classic chars and add Match Blinky minigame --- astron/dclass/united.dc | 87 -- config/general.prc | 11 - otp/distributed/DCClassImports.py | 3 +- otp/otpbase/OTPGlobals.py | 16 - otp/otpbase/OTPLocalizerEnglish.py | 11 - .../building/DistributedTutorialInterior.py | 1 - toontown/char/Char.py | 632 -------------- toontown/char/CharDNA.py | 127 --- toontown/char/DistributedChar.py | 32 - toontown/char/__init__.py | 0 toontown/classicchars/CCharChatter.py | 266 ------ toontown/classicchars/CCharPaths.py | 459 ---------- toontown/classicchars/CharStateDatas.py | 225 ----- toontown/classicchars/CharStateDatasAI.py | 385 --------- toontown/classicchars/DistributedCCharBase.py | 295 ------- .../classicchars/DistributedCCharBaseAI.py | 208 ----- toontown/classicchars/DistributedChip.py | 80 -- toontown/classicchars/DistributedChipAI.py | 165 ---- toontown/classicchars/DistributedDaisy.py | 93 -- toontown/classicchars/DistributedDaisyAI.py | 183 ---- toontown/classicchars/DistributedDale.py | 94 --- toontown/classicchars/DistributedDaleAI.py | 176 ---- toontown/classicchars/DistributedDonald.py | 112 --- toontown/classicchars/DistributedDonaldAI.py | 190 ----- .../classicchars/DistributedDonaldDock.py | 68 -- .../classicchars/DistributedDonaldDockAI.py | 119 --- .../classicchars/DistributedFrankenDonald.py | 64 -- .../DistributedFrankenDonaldAI.py | 6 - toontown/classicchars/DistributedGoofy.py | 79 -- toontown/classicchars/DistributedGoofyAI.py | 6 - .../classicchars/DistributedGoofySpeedway.py | 100 --- .../DistributedGoofySpeedwayAI.py | 190 ----- .../classicchars/DistributedJailbirdDale.py | 23 - .../classicchars/DistributedJailbirdDaleAI.py | 6 - toontown/classicchars/DistributedMickey.py | 96 --- toontown/classicchars/DistributedMickeyAI.py | 183 ---- toontown/classicchars/DistributedMinnie.py | 93 -- toontown/classicchars/DistributedMinnieAI.py | 181 ---- toontown/classicchars/DistributedPluto.py | 119 --- toontown/classicchars/DistributedPlutoAI.py | 182 ---- .../classicchars/DistributedPoliceChip.py | 23 - .../classicchars/DistributedPoliceChipAI.py | 6 - .../classicchars/DistributedSockHopDaisy.py | 24 - .../classicchars/DistributedSockHopDaisyAI.py | 6 - .../classicchars/DistributedSuperGoofy.py | 26 - .../classicchars/DistributedSuperGoofyAI.py | 6 - .../classicchars/DistributedVampireMickey.py | 26 - .../DistributedVampireMickeyAI.py | 6 - .../classicchars/DistributedWesternPluto.py | 26 - .../classicchars/DistributedWesternPlutoAI.py | 6 - .../classicchars/DistributedWitchMinnie.py | 26 - .../classicchars/DistributedWitchMinnieAI.py | 6 - toontown/classicchars/__init__.py | 0 toontown/hood/BRHoodAI.py | 13 +- toontown/hood/DDHoodAI.py | 12 +- toontown/hood/DGHoodAI.py | 10 - toontown/hood/DLHoodAI.py | 12 +- toontown/hood/GSHoodAI.py | 11 +- toontown/hood/MMHoodAI.py | 14 +- toontown/hood/OZHoodAI.py | 16 - toontown/hood/TTHoodAI.py | 10 - toontown/makeatoon/MakeAToon.py | 7 - toontown/minigame/DistributedPatternGame.py | 99 +-- toontown/minigame/DistributedTugOfWarGame.py | 1 - toontown/quest/QuestParser.py | 108 --- toontown/safezone/BRPlayground.py | 9 +- toontown/safezone/DGPlayground.py | 9 +- toontown/safezone/DLPlayground.py | 8 - toontown/safezone/DLSafeZoneLoader.py | 4 +- toontown/safezone/GSPlayground.py | 8 +- toontown/safezone/MMPlayground.py | 8 +- toontown/safezone/OZPlayground.py | 5 - toontown/safezone/Playground.py | 21 - toontown/safezone/TTPlayground.py | 9 +- toontown/toon/NPCToons.py | 19 + toontown/toonbase/TTLocalizerEnglish.py | 791 +----------------- toontown/toonbase/ToontownGlobals.py | 14 - 77 files changed, 80 insertions(+), 6691 deletions(-) delete mode 100644 toontown/char/Char.py delete mode 100644 toontown/char/CharDNA.py delete mode 100644 toontown/char/DistributedChar.py delete mode 100644 toontown/char/__init__.py delete mode 100644 toontown/classicchars/CCharChatter.py delete mode 100644 toontown/classicchars/CCharPaths.py delete mode 100644 toontown/classicchars/CharStateDatas.py delete mode 100644 toontown/classicchars/CharStateDatasAI.py delete mode 100644 toontown/classicchars/DistributedCCharBase.py delete mode 100644 toontown/classicchars/DistributedCCharBaseAI.py delete mode 100644 toontown/classicchars/DistributedChip.py delete mode 100644 toontown/classicchars/DistributedChipAI.py delete mode 100644 toontown/classicchars/DistributedDaisy.py delete mode 100644 toontown/classicchars/DistributedDaisyAI.py delete mode 100644 toontown/classicchars/DistributedDale.py delete mode 100644 toontown/classicchars/DistributedDaleAI.py delete mode 100644 toontown/classicchars/DistributedDonald.py delete mode 100644 toontown/classicchars/DistributedDonaldAI.py delete mode 100644 toontown/classicchars/DistributedDonaldDock.py delete mode 100644 toontown/classicchars/DistributedDonaldDockAI.py delete mode 100644 toontown/classicchars/DistributedFrankenDonald.py delete mode 100644 toontown/classicchars/DistributedFrankenDonaldAI.py delete mode 100644 toontown/classicchars/DistributedGoofy.py delete mode 100644 toontown/classicchars/DistributedGoofyAI.py delete mode 100644 toontown/classicchars/DistributedGoofySpeedway.py delete mode 100644 toontown/classicchars/DistributedGoofySpeedwayAI.py delete mode 100644 toontown/classicchars/DistributedJailbirdDale.py delete mode 100644 toontown/classicchars/DistributedJailbirdDaleAI.py delete mode 100644 toontown/classicchars/DistributedMickey.py delete mode 100644 toontown/classicchars/DistributedMickeyAI.py delete mode 100644 toontown/classicchars/DistributedMinnie.py delete mode 100644 toontown/classicchars/DistributedMinnieAI.py delete mode 100644 toontown/classicchars/DistributedPluto.py delete mode 100644 toontown/classicchars/DistributedPlutoAI.py delete mode 100644 toontown/classicchars/DistributedPoliceChip.py delete mode 100644 toontown/classicchars/DistributedPoliceChipAI.py delete mode 100644 toontown/classicchars/DistributedSockHopDaisy.py delete mode 100644 toontown/classicchars/DistributedSockHopDaisyAI.py delete mode 100644 toontown/classicchars/DistributedSuperGoofy.py delete mode 100644 toontown/classicchars/DistributedSuperGoofyAI.py delete mode 100644 toontown/classicchars/DistributedVampireMickey.py delete mode 100644 toontown/classicchars/DistributedVampireMickeyAI.py delete mode 100644 toontown/classicchars/DistributedWesternPluto.py delete mode 100644 toontown/classicchars/DistributedWesternPlutoAI.py delete mode 100644 toontown/classicchars/DistributedWitchMinnie.py delete mode 100644 toontown/classicchars/DistributedWitchMinnieAI.py delete mode 100644 toontown/classicchars/__init__.py delete mode 100644 toontown/safezone/DLPlayground.py diff --git a/astron/dclass/united.dc b/astron/dclass/united.dc index 5eedd98d..3f3ee41c 100644 --- a/astron/dclass/united.dc +++ b/astron/dclass/united.dc @@ -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; diff --git a/config/general.prc b/config/general.prc index adfc8f04..7c9b4082 100644 --- a/config/general.prc +++ b/config/general.prc @@ -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 diff --git a/otp/distributed/DCClassImports.py b/otp/distributed/DCClassImports.py index aaf09b3a..8b6c09a8 100644 --- a/otp/distributed/DCClassImports.py +++ b/otp/distributed/DCClassImports.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * -hashVal = 188749006 +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 diff --git a/otp/otpbase/OTPGlobals.py b/otp/otpbase/OTPGlobals.py index 88becfe3..69095663 100644 --- a/otp/otpbase/OTPGlobals.py +++ b/otp/otpbase/OTPGlobals.py @@ -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' diff --git a/otp/otpbase/OTPLocalizerEnglish.py b/otp/otpbase/OTPLocalizerEnglish.py index 5414cb35..139785d2 100644 --- a/otp/otpbase/OTPLocalizerEnglish.py +++ b/otp/otpbase/OTPLocalizerEnglish.py @@ -2769,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.' diff --git a/toontown/building/DistributedTutorialInterior.py b/toontown/building/DistributedTutorialInterior.py index 08120ae3..22796310 100644 --- a/toontown/building/DistributedTutorialInterior.py +++ b/toontown/building/DistributedTutorialInterior.py @@ -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 diff --git a/toontown/char/Char.py b/toontown/char/Char.py deleted file mode 100644 index 01f48ec4..00000000 --- a/toontown/char/Char.py +++ /dev/null @@ -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) diff --git a/toontown/char/CharDNA.py b/toontown/char/CharDNA.py deleted file mode 100644 index f48e2bfa..00000000 --- a/toontown/char/CharDNA.py +++ /dev/null @@ -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) diff --git a/toontown/char/DistributedChar.py b/toontown/char/DistributedChar.py deleted file mode 100644 index e397e7ab..00000000 --- a/toontown/char/DistributedChar.py +++ /dev/null @@ -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 diff --git a/toontown/char/__init__.py b/toontown/char/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/toontown/classicchars/CCharChatter.py b/toontown/classicchars/CCharChatter.py deleted file mode 100644 index df31d8b1..00000000 --- a/toontown/classicchars/CCharChatter.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/CCharPaths.py b/toontown/classicchars/CCharPaths.py deleted file mode 100644 index 8f4edef1..00000000 --- a/toontown/classicchars/CCharPaths.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/CharStateDatas.py b/toontown/classicchars/CharStateDatas.py deleted file mode 100644 index 1dd01b81..00000000 --- a/toontown/classicchars/CharStateDatas.py +++ /dev/null @@ -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) diff --git a/toontown/classicchars/CharStateDatasAI.py b/toontown/classicchars/CharStateDatasAI.py deleted file mode 100644 index 94461d26..00000000 --- a/toontown/classicchars/CharStateDatasAI.py +++ /dev/null @@ -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')) - - diff --git a/toontown/classicchars/DistributedCCharBase.py b/toontown/classicchars/DistributedCCharBase.py deleted file mode 100644 index 68265ac2..00000000 --- a/toontown/classicchars/DistributedCCharBase.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedCCharBaseAI.py b/toontown/classicchars/DistributedCCharBaseAI.py deleted file mode 100644 index 4e3f937f..00000000 --- a/toontown/classicchars/DistributedCCharBaseAI.py +++ /dev/null @@ -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 - - diff --git a/toontown/classicchars/DistributedChip.py b/toontown/classicchars/DistributedChip.py deleted file mode 100644 index f0a1d9d6..00000000 --- a/toontown/classicchars/DistributedChip.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedChipAI.py b/toontown/classicchars/DistributedChipAI.py deleted file mode 100644 index f211d17b..00000000 --- a/toontown/classicchars/DistributedChipAI.py +++ /dev/null @@ -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) - - diff --git a/toontown/classicchars/DistributedDaisy.py b/toontown/classicchars/DistributedDaisy.py deleted file mode 100644 index 2cc7945b..00000000 --- a/toontown/classicchars/DistributedDaisy.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedDaisyAI.py b/toontown/classicchars/DistributedDaisyAI.py deleted file mode 100644 index f2b333df..00000000 --- a/toontown/classicchars/DistributedDaisyAI.py +++ /dev/null @@ -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 - - - - - diff --git a/toontown/classicchars/DistributedDale.py b/toontown/classicchars/DistributedDale.py deleted file mode 100644 index ec707263..00000000 --- a/toontown/classicchars/DistributedDale.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedDaleAI.py b/toontown/classicchars/DistributedDaleAI.py deleted file mode 100644 index 212c6247..00000000 --- a/toontown/classicchars/DistributedDaleAI.py +++ /dev/null @@ -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 - - diff --git a/toontown/classicchars/DistributedDonald.py b/toontown/classicchars/DistributedDonald.py deleted file mode 100644 index 8fa908cd..00000000 --- a/toontown/classicchars/DistributedDonald.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedDonaldAI.py b/toontown/classicchars/DistributedDonaldAI.py deleted file mode 100644 index d3c2d5bb..00000000 --- a/toontown/classicchars/DistributedDonaldAI.py +++ /dev/null @@ -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 - - diff --git a/toontown/classicchars/DistributedDonaldDock.py b/toontown/classicchars/DistributedDonaldDock.py deleted file mode 100644 index a0417607..00000000 --- a/toontown/classicchars/DistributedDonaldDock.py +++ /dev/null @@ -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') diff --git a/toontown/classicchars/DistributedDonaldDockAI.py b/toontown/classicchars/DistributedDonaldDockAI.py deleted file mode 100644 index e062502c..00000000 --- a/toontown/classicchars/DistributedDonaldDockAI.py +++ /dev/null @@ -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 - - diff --git a/toontown/classicchars/DistributedFrankenDonald.py b/toontown/classicchars/DistributedFrankenDonald.py deleted file mode 100644 index 10a35e8d..00000000 --- a/toontown/classicchars/DistributedFrankenDonald.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedFrankenDonaldAI.py b/toontown/classicchars/DistributedFrankenDonaldAI.py deleted file mode 100644 index 393a3475..00000000 --- a/toontown/classicchars/DistributedFrankenDonaldAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedDonaldAI import DistributedDonaldAI - -class DistributedFrankenDonaldAI(DistributedDonaldAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedFrankenDonaldAI") - diff --git a/toontown/classicchars/DistributedGoofy.py b/toontown/classicchars/DistributedGoofy.py deleted file mode 100644 index d3a3296c..00000000 --- a/toontown/classicchars/DistributedGoofy.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedGoofyAI.py b/toontown/classicchars/DistributedGoofyAI.py deleted file mode 100644 index 8509c74b..00000000 --- a/toontown/classicchars/DistributedGoofyAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedCCharBaseAI import DistributedCCharBaseAI - -class DistributedGoofyAI(DistributedCCharBaseAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGoofyAI") - diff --git a/toontown/classicchars/DistributedGoofySpeedway.py b/toontown/classicchars/DistributedGoofySpeedway.py deleted file mode 100644 index 3512e170..00000000 --- a/toontown/classicchars/DistributedGoofySpeedway.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedGoofySpeedwayAI.py b/toontown/classicchars/DistributedGoofySpeedwayAI.py deleted file mode 100644 index 140b7cbb..00000000 --- a/toontown/classicchars/DistributedGoofySpeedwayAI.py +++ /dev/null @@ -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 - - diff --git a/toontown/classicchars/DistributedJailbirdDale.py b/toontown/classicchars/DistributedJailbirdDale.py deleted file mode 100644 index 1a4ca87c..00000000 --- a/toontown/classicchars/DistributedJailbirdDale.py +++ /dev/null @@ -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) diff --git a/toontown/classicchars/DistributedJailbirdDaleAI.py b/toontown/classicchars/DistributedJailbirdDaleAI.py deleted file mode 100644 index dc04995d..00000000 --- a/toontown/classicchars/DistributedJailbirdDaleAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedDaleAI import DistributedDaleAI - -class DistributedJailbirdDaleAI(DistributedDaleAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedJailbirdDaleAI") - diff --git a/toontown/classicchars/DistributedMickey.py b/toontown/classicchars/DistributedMickey.py deleted file mode 100644 index 9aed6e65..00000000 --- a/toontown/classicchars/DistributedMickey.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedMickeyAI.py b/toontown/classicchars/DistributedMickeyAI.py deleted file mode 100644 index ad437a63..00000000 --- a/toontown/classicchars/DistributedMickeyAI.py +++ /dev/null @@ -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 - - - - diff --git a/toontown/classicchars/DistributedMinnie.py b/toontown/classicchars/DistributedMinnie.py deleted file mode 100644 index 6f013608..00000000 --- a/toontown/classicchars/DistributedMinnie.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedMinnieAI.py b/toontown/classicchars/DistributedMinnieAI.py deleted file mode 100644 index 42afd127..00000000 --- a/toontown/classicchars/DistributedMinnieAI.py +++ /dev/null @@ -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 - - diff --git a/toontown/classicchars/DistributedPluto.py b/toontown/classicchars/DistributedPluto.py deleted file mode 100644 index 2bffb289..00000000 --- a/toontown/classicchars/DistributedPluto.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedPlutoAI.py b/toontown/classicchars/DistributedPlutoAI.py deleted file mode 100644 index bf322a21..00000000 --- a/toontown/classicchars/DistributedPlutoAI.py +++ /dev/null @@ -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 - - diff --git a/toontown/classicchars/DistributedPoliceChip.py b/toontown/classicchars/DistributedPoliceChip.py deleted file mode 100644 index b51e9133..00000000 --- a/toontown/classicchars/DistributedPoliceChip.py +++ /dev/null @@ -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) diff --git a/toontown/classicchars/DistributedPoliceChipAI.py b/toontown/classicchars/DistributedPoliceChipAI.py deleted file mode 100644 index 64ebb43f..00000000 --- a/toontown/classicchars/DistributedPoliceChipAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedChipAI import DistributedChipAI - -class DistributedPoliceChipAI(DistributedChipAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPoliceChipAI") - diff --git a/toontown/classicchars/DistributedSockHopDaisy.py b/toontown/classicchars/DistributedSockHopDaisy.py deleted file mode 100644 index d129727e..00000000 --- a/toontown/classicchars/DistributedSockHopDaisy.py +++ /dev/null @@ -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() diff --git a/toontown/classicchars/DistributedSockHopDaisyAI.py b/toontown/classicchars/DistributedSockHopDaisyAI.py deleted file mode 100644 index 41567ff4..00000000 --- a/toontown/classicchars/DistributedSockHopDaisyAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedDaisyAI import DistributedDaisyAI - -class DistributedSockHopDaisyAI(DistributedDaisyAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedSockHopDaisyAI") - diff --git a/toontown/classicchars/DistributedSuperGoofy.py b/toontown/classicchars/DistributedSuperGoofy.py deleted file mode 100644 index 67b9b494..00000000 --- a/toontown/classicchars/DistributedSuperGoofy.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedSuperGoofyAI.py b/toontown/classicchars/DistributedSuperGoofyAI.py deleted file mode 100644 index e968224f..00000000 --- a/toontown/classicchars/DistributedSuperGoofyAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedGoofySpeedwayAI import DistributedGoofySpeedwayAI - -class DistributedSuperGoofyAI(DistributedGoofySpeedwayAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedSuperGoofyAI") - diff --git a/toontown/classicchars/DistributedVampireMickey.py b/toontown/classicchars/DistributedVampireMickey.py deleted file mode 100644 index bc4ebec4..00000000 --- a/toontown/classicchars/DistributedVampireMickey.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedVampireMickeyAI.py b/toontown/classicchars/DistributedVampireMickeyAI.py deleted file mode 100644 index ddb5cc18..00000000 --- a/toontown/classicchars/DistributedVampireMickeyAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedMickeyAI import DistributedMickeyAI - -class DistributedVampireMickeyAI(DistributedMickeyAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedVampireMickeyAI") - diff --git a/toontown/classicchars/DistributedWesternPluto.py b/toontown/classicchars/DistributedWesternPluto.py deleted file mode 100644 index eb697422..00000000 --- a/toontown/classicchars/DistributedWesternPluto.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedWesternPlutoAI.py b/toontown/classicchars/DistributedWesternPlutoAI.py deleted file mode 100644 index 8496c17a..00000000 --- a/toontown/classicchars/DistributedWesternPlutoAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedPlutoAI import DistributedPlutoAI - -class DistributedWesternPlutoAI(DistributedPlutoAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedWesternPlutoAI") - diff --git a/toontown/classicchars/DistributedWitchMinnie.py b/toontown/classicchars/DistributedWitchMinnie.py deleted file mode 100644 index 4fb6b431..00000000 --- a/toontown/classicchars/DistributedWitchMinnie.py +++ /dev/null @@ -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 diff --git a/toontown/classicchars/DistributedWitchMinnieAI.py b/toontown/classicchars/DistributedWitchMinnieAI.py deleted file mode 100644 index 9b9036b1..00000000 --- a/toontown/classicchars/DistributedWitchMinnieAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.classicchars.DistributedMickeyAI import DistributedMickeyAI - -class DistributedWitchMinnieAI(DistributedMickeyAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedWitchMinnieAI") - diff --git a/toontown/classicchars/__init__.py b/toontown/classicchars/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/toontown/hood/BRHoodAI.py b/toontown/hood/BRHoodAI.py index 7ab0b993..88d79993 100644 --- a/toontown/hood/BRHoodAI.py +++ b/toontown/hood/BRHoodAI.py @@ -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) @@ -36,9 +30,4 @@ class BRHoodAI(HoodAI.HoodAI): def createTrolley(self): 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() + self.trolley.start() \ No newline at end of file diff --git a/toontown/hood/DDHoodAI.py b/toontown/hood/DDHoodAI.py index 89060da5..6a84791e 100644 --- a/toontown/hood/DDHoodAI.py +++ b/toontown/hood/DDHoodAI.py @@ -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) @@ -40,9 +35,4 @@ class DDHoodAI(HoodAI.HoodAI): def createBoat(self): 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() + self.boat.start() \ No newline at end of file diff --git a/toontown/hood/DGHoodAI.py b/toontown/hood/DGHoodAI.py index b46a403d..0b553ac6 100644 --- a/toontown/hood/DGHoodAI.py +++ b/toontown/hood/DGHoodAI.py @@ -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]): diff --git a/toontown/hood/DLHoodAI.py b/toontown/hood/DLHoodAI.py index 43678fbc..2b7a93ed 100644 --- a/toontown/hood/DLHoodAI.py +++ b/toontown/hood/DLHoodAI.py @@ -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) @@ -35,9 +30,4 @@ class DLHoodAI(HoodAI.HoodAI): def createTrolley(self): 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() + self.trolley.start() \ No newline at end of file diff --git a/toontown/hood/GSHoodAI.py b/toontown/hood/GSHoodAI.py index 970b77ef..726737ca 100644 --- a/toontown/hood/GSHoodAI.py +++ b/toontown/hood/GSHoodAI.py @@ -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) @@ -146,9 +142,4 @@ 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() + taskMgr.doMethodLater(10, self.cycleLeaderBoards, 'leaderBoardSwitch') \ No newline at end of file diff --git a/toontown/hood/MMHoodAI.py b/toontown/hood/MMHoodAI.py index 53b8e6eb..3755109c 100644 --- a/toontown/hood/MMHoodAI.py +++ b/toontown/hood/MMHoodAI.py @@ -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) @@ -38,9 +31,4 @@ class MMHoodAI(HoodAI.HoodAI): def createTrolley(self): 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() + self.trolley.start() \ No newline at end of file diff --git a/toontown/hood/OZHoodAI.py b/toontown/hood/OZHoodAI.py index 021c6188..9c7e80de 100644 --- a/toontown/hood/OZHoodAI.py +++ b/toontown/hood/OZHoodAI.py @@ -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()): diff --git a/toontown/hood/TTHoodAI.py b/toontown/hood/TTHoodAI.py index 4da83fd3..5509b953 100644 --- a/toontown/hood/TTHoodAI.py +++ b/toontown/hood/TTHoodAI.py @@ -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]): diff --git a/toontown/makeatoon/MakeAToon.py b/toontown/makeatoon/MakeAToon.py index c2cb7fa9..42e62b99 100644 --- a/toontown/makeatoon/MakeAToon.py +++ b/toontown/makeatoon/MakeAToon.py @@ -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 diff --git a/toontown/minigame/DistributedPatternGame.py b/toontown/minigame/DistributedPatternGame.py index 4322186f..21969338 100644 --- a/toontown/minigame/DistributedPatternGame.py +++ b/toontown/minigame/DistributedPatternGame.py @@ -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,18 +205,12 @@ 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) self.toonAnimSpeedMult[anim] = float(self.__numPingPongFrames(numFrames)) / float(self.stdNumDanceStepPingPongFrames) @@ -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 diff --git a/toontown/minigame/DistributedTugOfWarGame.py b/toontown/minigame/DistributedTugOfWarGame.py index 4a6d30cb..d1a3a56e 100644 --- a/toontown/minigame/DistributedTugOfWarGame.py +++ b/toontown/minigame/DistributedTugOfWarGame.py @@ -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 diff --git a/toontown/quest/QuestParser.py b/toontown/quest/QuestParser.py index 0ab429cd..2a95cb06 100644 --- a/toontown/quest/QuestParser.py +++ b/toontown/quest/QuestParser.py @@ -14,8 +14,6 @@ import tokenize import BlinkingArrows from otp.speedchat import SpeedChatGlobals from toontown.ai import DistributedBlackCatMgr -from toontown.char import Char -from toontown.char import CharDNA from toontown.chat.ChatGlobals import * from toontown.suit import Suit from toontown.suit import SuitDNA @@ -136,7 +134,6 @@ class NPCMoviePlayer(DirectObject.DirectObject): self.npc = npc self.privateVarDict = {} self.toonHeads = {} - self.chars = [] self.uniqueId = 'scriptMovie_' + str(self.scriptId) + '_' + str(toon.getDoId()) + '_' + str(npc.getDoId()) self.setVar('toon', self.toon) self.setVar('npc', self.npc) @@ -177,9 +174,6 @@ class NPCMoviePlayer(DirectObject.DirectObject): for toonHeadFrame in self.toonHeads.values(): toonHeadFrame.destroy() - while self.chars: - self.__unloadChar(self.chars[0]) - del self.toonHeads del self.privateVarDict del self.chapterDict @@ -188,13 +182,6 @@ class NPCMoviePlayer(DirectObject.DirectObject): del self.timeoutTrack return - def __unloadChar(self, char): - char.removeActive() - if char.style.name == 'mk' or char.style.name == 'mn': - char.stopEarTask() - char.delete() - self.chars.remove(char) - def timeout(self, fFinish = 0): if self.timeoutTrack: if fFinish: @@ -293,41 +280,11 @@ class NPCMoviePlayer(DirectObject.DirectObject): chapterList = [] self.currentEvent = nextEvent continue - elif command == 'CC_CHAT_CONFIRM': - if uponTimeout: - self.notify.error('CC_CHAT_CONFIRM not allowed in an UPON_TIMEOUT') - avatarName = line[1] - avatar = self.getVar(avatarName) - nextEvent = avatar.uniqueName('doneChatPage') - iList.append(Func(self.acceptOnce, nextEvent, self.playNextChapter, [nextEvent])) - iList.append(self.parseCCChatConfirm(line)) - self.closePreviousChapter(iList) - chapterList = [] - self.currentEvent = nextEvent - continue - elif command == 'CC_CHAT_TO_CONFIRM': - if uponTimeout: - self.notify.error('CC_CHAT_TO_CONFIRM not allowed in an UPON_TIMEOUT') - avatarName = line[1] - avatar = self.getVar(avatarName) - nextEvent = avatar.uniqueName('doneChatPage') - iList.append(Func(self.acceptOnce, nextEvent, self.playNextChapter, [nextEvent])) - iList.append(self.parseCCChatToConfirm(line)) - self.closePreviousChapter(iList) - chapterList = [] - self.currentEvent = nextEvent - continue if self.isLocalToon: if command == 'LOAD': self.parseLoad(line) elif command == 'LOAD_SFX': self.parseLoadSfx(line) - elif command == 'LOAD_CHAR': - self.parseLoadChar(line) - elif command == 'LOAD_CLASSIC_CHAR': - self.parseLoadClassicChar(line) - elif command == 'UNLOAD_CHAR': - iList.append(self.parseUnloadChar(line)) elif command == 'LOAD_SUIT': self.parseLoadSuit(line) elif command == 'SET': @@ -486,44 +443,6 @@ class NPCMoviePlayer(DirectObject.DirectObject): sfx = base.loadSfx(fileName) self.setVar(varName, sfx) - def parseLoadChar(self, line): - token, name, charType = line - char = Char.Char() - dna = CharDNA.CharDNA() - dna.newChar(charType) - char.setDNA(dna) - if charType == 'mk' or charType == 'mn': - char.startEarTask() - char.nametag.manage(base.marginManager) - char.addActive() - char.hideName() - self.setVar(name, char) - - def parseLoadClassicChar(self, line): - token, name = line - char = Char.Char() - dna = CharDNA.CharDNA() - if self.toon.getStyle().gender == 'm': - charType = 'mk' - else: - charType = 'mn' - dna.newChar(charType) - char.setDNA(dna) - char.startEarTask() - char.nametag.manage(base.marginManager) - char.addActive() - char.hideName() - self.setVar(name, char) - self.chars.append(char) - - def parseUnloadChar(self, line): - token, name = line - char = self.getVar(name) - track = Sequence() - track.append(Func(self.__unloadChar, char)) - track.append(Func(self.delVar, name)) - return track - def parseLoadSuit(self, line): token, name, suitType = line suit = Suit.Suit() @@ -703,33 +622,6 @@ class NPCMoviePlayer(DirectObject.DirectObject): quitButton, extraChatFlags, dialogueList = self.parseExtraChatArgs(line[4:]) return Func(avatar.setLocalPageChat, chatString, quitButton, extraChatFlags, dialogueList) - def parseCCChatConfirm(self, line): - lineLength = len(line) - avatarName = line[1] - avatar = self.getVar(avatarName) - if self.toon.getStyle().gender == 'm': - chatString = eval('TTLocalizer.' + line[2] % 'Mickey') - else: - chatString = eval('TTLocalizer.' + line[2] % 'Minnie') - quitButton, extraChatFlags, dialogueList = self.parseExtraChatArgs(line[3:]) - return Func(avatar.setLocalPageChat, chatString, quitButton, extraChatFlags, dialogueList) - - def parseCCChatToConfirm(self, line): - lineLength = len(line) - avatarKey = line[1] - avatar = self.getVar(avatarKey) - toAvatarKey = line[2] - toAvatar = self.getVar(toAvatarKey) - localizerAvatarName = toAvatar.getName().capitalize() - toAvatarName = eval('TTLocalizer.' + localizerAvatarName) - if self.toon.getStyle().gender == 'm': - chatString = eval('TTLocalizer.' + line[3] % 'Mickey') - else: - chatString = eval('TTLocalizer.' + line[3] % 'Minnie') - chatString = chatString.replace('%s', toAvatarName) - quitButton, extraChatFlags, dialogueList = self.parseExtraChatArgs(line[4:]) - return Func(avatar.setLocalPageChat, chatString, quitButton, extraChatFlags, dialogueList) - def parsePlaySfx(self, line): if len(line) == 2: token, sfxName = line diff --git a/toontown/safezone/BRPlayground.py b/toontown/safezone/BRPlayground.py index ff2aefb8..4a9fb253 100644 --- a/toontown/safezone/BRPlayground.py +++ b/toontown/safezone/BRPlayground.py @@ -1,10 +1,6 @@ from direct.task.Task import Task -import random - -from toontown.classicchars import CCharPaths from toontown.safezone import Playground -from toontown.toonbase import TTLocalizer - +import random class BRPlayground(Playground.Playground): def enter(self, requestStatus): @@ -15,9 +11,6 @@ class BRPlayground(Playground.Playground): Playground.Playground.exit(self) taskMgr.remove('BR-wind') - def showPaths(self): - self.showPathPoints(CCharPaths.getPaths(TTLocalizer.Pluto)) - def __windTask(self, task): base.playSfx(random.choice(self.loader.windSound)) time = random.random() * 8.0 + 1 diff --git a/toontown/safezone/DGPlayground.py b/toontown/safezone/DGPlayground.py index 52c843e4..6e72d2f8 100644 --- a/toontown/safezone/DGPlayground.py +++ b/toontown/safezone/DGPlayground.py @@ -1,10 +1,6 @@ from direct.task import Task -import random - -from toontown.classicchars import CCharPaths from toontown.safezone import Playground -from toontown.toonbase import TTLocalizer - +import random class DGPlayground(Playground.Playground): def enter(self, requestStatus): @@ -15,9 +11,6 @@ class DGPlayground(Playground.Playground): Playground.Playground.exit(self) taskMgr.remove('DG-birds') - def showPaths(self): - self.showPathPoints(CCharPaths.getPaths(TTLocalizer.Goofy)) - def __birds(self, task): base.playSfx(random.choice(self.loader.birdSound)) time = random.random() * 20.0 + 1 diff --git a/toontown/safezone/DLPlayground.py b/toontown/safezone/DLPlayground.py deleted file mode 100644 index e950478e..00000000 --- a/toontown/safezone/DLPlayground.py +++ /dev/null @@ -1,8 +0,0 @@ -from toontown.classicchars import CCharPaths -from toontown.safezone import Playground -from toontown.toonbase import TTLocalizer - - -class DLPlayground(Playground.Playground): - def showPaths(self): - self.showPathPoints(CCharPaths.getPaths(TTLocalizer.Donald)) diff --git a/toontown/safezone/DLSafeZoneLoader.py b/toontown/safezone/DLSafeZoneLoader.py index 11ad88ee..248586e1 100644 --- a/toontown/safezone/DLSafeZoneLoader.py +++ b/toontown/safezone/DLSafeZoneLoader.py @@ -1,11 +1,11 @@ -from toontown.safezone import DLPlayground +from toontown.safezone import Playground from toontown.safezone import SafeZoneLoader class DLSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): def __init__(self, hood, parentFSM, doneEvent): SafeZoneLoader.SafeZoneLoader.__init__(self, hood, parentFSM, doneEvent) - self.playgroundClass = DLPlayground.DLPlayground + self.playgroundClass = Playground.Playground self.musicFile = 'phase_8/audio/bgm/DL_nbrhood.ogg' self.activityMusicFile = 'phase_8/audio/bgm/DL_SZ_activity.ogg' self.dnaFile = 'phase_8/dna/donalds_dreamland_sz.pdna' diff --git a/toontown/safezone/GSPlayground.py b/toontown/safezone/GSPlayground.py index ce6f1ac2..9107cac1 100644 --- a/toontown/safezone/GSPlayground.py +++ b/toontown/safezone/GSPlayground.py @@ -1,7 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals import Playground -from toontown.launcher import DownloadForceAcknowledge from toontown.building import Elevator from toontown.toontowngui import TTDialog from toontown.toonbase import TTLocalizer @@ -107,9 +106,4 @@ class GSPlayground(Playground.Playground): self.doneStatus = doneStatus messenger.send(self.doneEvent) else: - self.notify.error('Unknown mode: ' + where + ' in handleStartingBlockDone') - - def showPaths(self): - from toontown.classicchars import CCharPaths - from toontown.toonbase import TTLocalizer - self.showPathPoints(CCharPaths.getPaths(TTLocalizer.Goofy, 1)) + self.notify.error('Unknown mode: ' + where + ' in handleStartingBlockDone') \ No newline at end of file diff --git a/toontown/safezone/MMPlayground.py b/toontown/safezone/MMPlayground.py index 5dd4a805..f0eaeb46 100644 --- a/toontown/safezone/MMPlayground.py +++ b/toontown/safezone/MMPlayground.py @@ -1,10 +1,7 @@ -from toontown.classicchars import CCharPaths from direct.fsm import ClassicFSM, State -import random from toontown.safezone import Playground -from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals - +import random class MMPlayground(Playground.Playground): def __init__(self, loader, parentFSM, doneEvent): @@ -12,9 +9,6 @@ class MMPlayground(Playground.Playground): self.activityFsm = ClassicFSM.ClassicFSM('Activity', [State.State('off', self.enterOff, self.exitOff, ['OnPiano']), State.State('OnPiano', self.enterOnPiano, self.exitOnPiano, ['off'])], 'off', 'off') self.activityFsm.enterInitialState() - def showPaths(self): - self.showPathPoints(CCharPaths.getPaths(TTLocalizer.Minnie)) - def enterOff(self): return None diff --git a/toontown/safezone/OZPlayground.py b/toontown/safezone/OZPlayground.py index 1166e42b..cfb79420 100644 --- a/toontown/safezone/OZPlayground.py +++ b/toontown/safezone/OZPlayground.py @@ -175,8 +175,3 @@ class OZPlayground(Playground.Playground): self.fsm.request('walk') else: self.notify.error('Unknown mode: ' + mode + ' in handlePicnicBasketDone') - - def showPaths(self): - from toontown.classicchars import CCharPaths - from toontown.toonbase import TTLocalizer - self.showPathPoints(CCharPaths.getPaths(TTLocalizer.Chip)) diff --git a/toontown/safezone/Playground.py b/toontown/safezone/Playground.py index 8a3e26c6..a417814d 100644 --- a/toontown/safezone/Playground.py +++ b/toontown/safezone/Playground.py @@ -327,27 +327,6 @@ class Playground(Place.Place): def hidePaths(self): self.hideDebugPointText() - def showPathPoints(self, paths, waypoints = None): - self.hideDebugPointText() - lines = LineSegs() - lines.setColor(1, 0, 0, 1) - from toontown.classicchars import CCharPaths - for name, pointDef in paths.items(): - self.showDebugPointText(name, pointDef[0]) - for connectTo in pointDef[1]: - toDef = paths[connectTo] - fromP = pointDef[0] - toP = toDef[0] - lines.moveTo(fromP[0], fromP[1], fromP[2] + 2.0) - wpList = CCharPaths.getWayPoints(name, connectTo, paths, waypoints) - for wp in wpList: - lines.drawTo(wp[0], wp[1], wp[2] + 2.0) - self.showDebugPointText('*', wp) - - lines.drawTo(toP[0], toP[1], toP[2] + 2.0) - - self.debugText.attachNewNode(lines.create()) - def hideDebugPointText(self): if hasattr(self, 'debugText'): children = self.debugText.getChildren() diff --git a/toontown/safezone/TTPlayground.py b/toontown/safezone/TTPlayground.py index a5f8e0aa..41e3d56c 100644 --- a/toontown/safezone/TTPlayground.py +++ b/toontown/safezone/TTPlayground.py @@ -1,10 +1,6 @@ from direct.task.Task import Task -import random - -from toontown.classicchars import CCharPaths from toontown.safezone import Playground -from toontown.toonbase import TTLocalizer - +import random class TTPlayground(Playground.Playground): def enter(self, requestStatus): @@ -15,9 +11,6 @@ class TTPlayground(Playground.Playground): Playground.Playground.exit(self) taskMgr.remove('TT-birds') - def showPaths(self): - self.showPathPoints(CCharPaths.getPaths(TTLocalizer.Mickey)) - def __birds(self, task): base.playSfx(random.choice(self.loader.birdSound)) time = random.random() * 20.0 + 1 diff --git a/toontown/toon/NPCToons.py b/toontown/toon/NPCToons.py index c5636427..8a3892d2 100644 --- a/toontown/toon/NPCToons.py +++ b/toontown/toon/NPCToons.py @@ -11544,6 +11544,25 @@ NPCToonDict = {20000: (-1, 'm', 0, NPC_REGULAR), + 7010: (-1, + lnames[7010], + ('dss', + 'ms', + 's', + 'm', + 13, + 0, + 13, + 13, + 4, + 4, + 4, + 4, + 1, + 4), + 'm', + 0, + NPC_REGULAR), # Magic Cat SOS # 5 Stars, Sound SOS, Bikehorn 255 damage. "The Bikehorn of Death". 91917: (-1, diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index ce7b0714..a8ce56c6 100644 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -56,24 +56,7 @@ GM_NAMES = ('TOON COUNCIL', 'RESISTANCE RANGER', 'GC') ProductPrefix = 'TT' -Mickey = 'Mickey' -VampireMickey = 'VampireMickey' -Minnie = 'Minnie' -WitchMinnie = 'WitchMinnie' -Donald = 'Donald' -DonaldDock = 'DonaldDock' -FrankenDonald = 'FrankenDonald' -Daisy = 'Daisy' -SockHopDaisy = 'SockHopDaisy' -Goofy = 'Goofy' -SuperGoofy = 'SuperGoofy' -Pluto = 'Pluto' -WesternPluto = 'WesternPluto' Flippy = 'Flippy' -Chip = 'Chip' -Dale = 'Dale' -JailbirdDale = 'JailbirdDale' -PoliceChip = 'PoliceChip' lTheBrrrgh = 'The Brrrgh' lDaisyGardens = 'Daisy Gardens' lDonaldsDock = "Donald's Dock" @@ -174,7 +157,6 @@ lNo = 'No' SleepAutoReply = '%s is sleeping right now.' lHQOfficerF = 'HQ Officer' lHQOfficerM = 'HQ Officer' -MickeyMouse = 'Mickey Mouse' AIStartDefaultDistrict = 'Sillyville' Cog = 'Cog' Cogs = 'Cogs' @@ -2129,15 +2111,15 @@ ToonHealJokes = [['What goes TICK-TICK-TICK-WOOF?', 'A watchdog! '], ['Why are elephants big and gray?', "Because if they were small and yellow they'd be canaries."], ['If athletes get tennis elbow what do astronauts get?', 'Missile toe.'], ['Did you hear about the man who hated Santa?', 'He suffered from Claustrophobia.'], - ['Why did ' + Donald + ' sprinkle sugar on his pillow?', 'Because he wanted to have sweet dreams.'], - ['Why did ' + Goofy + ' take his comb to the dentist?', 'Because it had lost all its teeth.'], - ['Why did ' + Goofy + ' wear his shirt in the bath?', 'Because the label said wash and wear.'], + ['Why did Joey sprinkle sugar on his pillow?', 'Because he wanted to have sweet dreams.'], + ['Why did Goshi take his comb to the dentist?', 'Because it had lost all its teeth.'], + ['Why did Denial wear his shirt in the bath?', 'Because the label said wash and wear.'], ['Why did the dirty chicken cross the road?', 'For some fowl purpose.'], ["Why didn't the skeleton go to the party?", 'He had no body to go with.'], ['Why did the burglar take a shower?', 'To make a clean getaway.'], ['Why does a sheep have a woolly coat?', "Because he'd look silly in a plastic one."], ['Why do potatoes argue all the time?', "They can't see eye to eye."], - ['Why did ' + Pluto + ' sleep with a banana peel?', 'So he could slip out of bed in the morning.'], + ['Why did Quackity sleep with a banana peel?', 'So he could slip out of bed in the morning.'], ['Why did the mouse wear brown sneakers?', 'His white ones were in the wash.'], ['Why are false teeth like stars?', 'They come out at night.'], ['Why are Saturday and Sunday so strong?', 'Because the others are weekdays.'], @@ -2147,7 +2129,7 @@ ToonHealJokes = [['What goes TICK-TICK-TICK-WOOF?', 'A watchdog! '], ['What do you get if you cross a dog with a phone?', 'A golden receiver.'], ['What do you get if you cross an elephant with a shark?', 'Swimming trunks with sharp teeth.'], ['What did the tablecloth say to the table?', "Don't move, I've got you covered."], - ['Did you hear about the time ' + Goofy + ' ate a candle?', 'He wanted a light snack.'], + ['Did you hear about the time Nick ate a candle?', 'He wanted a light snack.'], ['What did the balloon say to the pin?', 'Hi Buster.'], ['What did the big chimney say to the little chimney?', "You're too young to smoke."], ['What did the carpet say to the floor?', 'I got you covered.'], @@ -2214,8 +2196,7 @@ ToonHealJokes = [['What goes TICK-TICK-TICK-WOOF?', 'A watchdog! '], ['What do you get if you cross a hyena with a mynah bird?', 'An animal that laughs at its own jokes.'], ['What do you get if you cross a railway engine with a stick of gum?', 'A chew-chew train.'], ['What would you get if you crossed an elephant with a computer?', 'A big know-it-all.'], - ['What would you get if you crossed an elephant with a skunk?', 'A big stinker.'], - ['Why did ' + MickeyMouse + ' take a trip to outer space?', 'He wanted to find ' + Pluto + '.']] + ['What would you get if you crossed an elephant with a skunk?', 'A big stinker.']] MovieHealLaughterMisses = ('hmm', 'heh', 'ha', @@ -3123,7 +3104,7 @@ KnockKnockJokes = [['Who', "Bad echo in here, isn't there?"], ['Cozy', "Cozy who's knocking will you?"], ['Sam', 'Sam person who knocked on the door last time.'], ['Fozzie', 'Fozzie hundredth time, my name is ' + Flippy + '.'], - ['Deduct', Donald + ' Deduct.'], + ['Deduct', 'Donald Deduct.'], ['Max', 'Max no difference, just open the door.'], ['N.E.', 'N.E. body you like, let me in.'], ['Amos', 'Amos-quito bit me.'], @@ -3219,684 +3200,6 @@ KnockKnockJokes = [['Who', "Bad echo in here, isn't there?"], ['Ida', "It's not Ida who, it's Idaho."], ['Zippy', 'Mrs. Zippy.'], ['Yukon', 'Yukon go away and come back another time.']] -SharedChatterGreetings = ['Hi, %!', - 'Yoo-hoo %, nice to see you.', - "I'm glad you're here today!", - 'Well, hello there, %.'] -SharedChatterComments = ["That's a great name, %.", - 'I like your name.', - 'Watch out for the ' + Cogs + '.', - 'Looks like the trolley is coming!', - 'I need to play a trolley game to get some pies!', - 'Sometimes I play trolley games just to eat the fruit pie!', - 'Whew, I just stopped a bunch of ' + Cogs + '. I need a rest!', - 'Yikes, some of those ' + Cogs + ' are big guys!', - "You look like you're having fun.", - "Oh boy, I'm having a good day.", - "I like what you're wearing.", - "I think I'll go fishing this afternoon.", - 'Have fun in my neighborhood.', - 'I hope you are enjoying your stay in Toontown!', - "I heard it's snowing at the Brrrgh.", - 'Have you ridden the trolley today?', - 'I like to meet new people.', - 'Wow, there are lots of ' + Cogs + ' in the Brrrgh.', - 'I love to play tag. Do you?', - 'Trolley games are fun to play.', - 'I like to make people laugh.', - "It's fun helping my friends.", - "A-hem, are you lost? Don't forget your map is in your shticker Book.", - 'Try not to get tied up in the ' + Cogs + "' Red Tape.", - 'I hear ' + Daisy + ' has planted some new flowers in her garden.', - 'If you press the Page Up key, you can look up!', - 'If you help take over Cog buildings, you can earn a bronze star!', - 'If you press the Tab key, you can see different views of your surroundings!', - 'If you press the Ctrl key, you can jump!'] -SharedChatterGoodbyes = ['I have to go now, bye!', - "I think I'll go play a trolley game.", - "Well, so long. I'll be seeing you, %!", - "I'd better hurry and get to work stopping those " + Cogs + '.', - "It's time for me to get going.", - 'Sorry, but I have to go.', - 'Good-bye.', - 'See you later, %!', - "I think I'm going to go practice tossing cupcakes.", - "I'm going to join a group and stop some " + Cogs + '.', - 'It was nice to see you today, %.', - "I have a lot to do today. I'd better get busy."] -MickeyChatter = (['Welcome to ' + lToontownCentral + '.', 'Hi, my name is ' + Mickey + ". What's yours?"], ['Hey, have you seen ' + Donald + '?', - "I'm going to go watch the fog roll in at " + lDonaldsDock + '.', - 'If you see my pal ' + Goofy + ', say hi to him for me.', - 'I hear ' + Daisy + ' has planted some new flowers in her garden.'], ["I'm going to MelodyLand to see " + Minnie + '!', - "Gosh, I'm late for my date with " + Minnie + '!', - "Looks like it's time for " + Pluto + "'s dinner.", - "I think I'll go swimming at " + lDonaldsDock + '.', - "It's time for a nap. I'm going to Dreamland."]) -WinterMickeyCChatter = (["Hi, I'm Merry Mickey!", - 'Welcome to Tinseltown... I mean, Toontown!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %'], ['Sing your seasonal cheer at Joy Buzzers to the World and Joy is sure to return the favor!', - 'Golly, these halls sure are decked!', - 'Sing your seasonal cheer at Joy Buzzers to the World and Joy is sure to return the favor!', - 'Just look at those tree lights! What a sight!', - 'Sing your seasonal cheer at Joy Buzzers to the World and Joy is sure to return the favor!', - 'Not a creature is stirring, except this mouse!', - 'Sing your seasonal cheer at Joy Buzzers to the World and Joy is sure to return the favor!', - 'I love this time of year!', - 'Sing your seasonal cheer at Joy Buzzers to the World and Joy is sure to return the favor!', - "I'm feeling jolly, how about you?", - 'Sing your seasonal cheer at Joy Buzzers to the World and Joy is sure to return the favor!', - 'Know any good carols?', - 'Sing your seasonal cheer at Joy Buzzers to the World and Joy is sure to return the favor!', - 'Oh boy! I love Winter Holiday!', - 'Sing your seasonal cheer at Joy Buzzers to the World and Joy is sure to return the favor!', - "I think I'll trade my gloves for mittens!"], ['Have a happy Winter Holiday!', - 'Warm wishes to you!', - 'Shucks, sorry you have to go. So long!', - "I'm going caroling with Minnie!"]) -ValentinesMickeyChatter = (["Hi, I'm Mickey!", - 'Welcome to ValenToontown Central!', - "Happy ValenToon's Day!", - "Happy ValenToon's Day, %"], ['Love is in the air! And butterflies!', - 'Those hearts are good for Laff boosts!', - 'I hope Minnie likes what I got her!', - "The Cattlelog has lots of ValenToon's Day gifts!", - "Throw a ValenToon's Day party!", - 'Show the Cogs you love them with a pie in the face!', - "I'm taking Minnie out to the Kooky Cafe!", - 'Will Minnie want chocolates or flowers?'], ['I loved having you visit!', "Tell Minnie I'll pick her up soon!"]) -WinterMickeyDChatter = (["Hi, I'm Merry Mickey!", - 'Welcome to Tinseltown... I mean, Toontown!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %'], ['Golly, these halls sure are decked!', - 'Just look at those tree lights! What a sight!', - 'Not a creature is stirring, except this mouse!', - 'I love this time of year!', - "I'm feeling jolly, how about you?", - 'Know any good carols?', - 'Oh boy! I love Winter Holiday!', - "I think I'll trade my gloves for mittens!"], ['Have a happy Winter Holiday!', - 'Warm wishes to you!', - 'Shucks, sorry you have to go. So long!', - "I'm going caroling with Minnie!"]) -VampireMickeyChatter = (['Welcome to ' + lToontownCentral + '.', - 'Hi, my name is ' + Mickey + ". What's yours?", - 'Happy Halloween!', - 'Happy Halloween, %!', - 'Welcome to Tombtown... I mean Toontown!'], ['If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - "It's fun to dress up for Halloween!", - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - 'Do you like my costume?', - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - '%, watch out for Bloodsucker Cogs!', - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - "Aren't the Halloween decorations great?", - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - 'Beware of black cats!', - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - 'Did you see the Toon with the pumpkin head?', - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - 'Boo! Did I scare you?', - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - "Don't forget to brush your fangs!", - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - "I'm a vampire, but not a Bloodsucker!", - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - "I hope you're enjoying our Halloween fun!", - 'If you think playing tricks is All Fun and Games, go see Lazy Hal for a treat!', - 'Vampires are really popular this year!'], ["I'm going to check out the cool Halloween decorations.", - "I'm going to MelodyLand to surprise " + Minnie + '!', - "I'm going to sneak up on another Toon! Shhh!", - "I'm going trick-or-treating!", - 'Shhh, sneak with me.']) -FieldOfficeMickeyChatter = ['Have you heard about the new Mover & Shaker Field Offices?'] -MinnieChatter = (['Welcome to Melodyland.', 'Hi, my name is ' + Minnie + ". What's yours?"], ['The hills are alive with the sound of music!', - 'You have a cool outfit, %.', - 'Hey, have you seen ' + Mickey + '?', - 'If you see my friend ' + Goofy + ', say hi to him for me.', - 'Wow, there are lots of ' + Cogs + ' near ' + Donald + "'s Dreamland.", - "I heard it's foggy at the " + lDonaldsDock + '.', - 'Be sure and try the maze in ' + lDaisyGardens + '.', - "I think I'll go catch some tunes.", - 'Hey %, look at that over there.', - 'I love the sound of music.', - "I bet you didn't know Melodyland is also called TuneTown! Hee Hee!", - 'I love to play the Matching Game. Do you?', - 'I like to make people giggle.', - 'Boy, trotting around in heels all day is hard on your feet!', - 'Nice shirt, %.', - 'Is that a Jellybean on the ground?'], ["Gosh, I'm late for my date with %s!" % Mickey, "Looks like it's time for %s's dinner." % Pluto, "It's time for a nap. I'm going to Dreamland."]) -WinterMinnieCChatter = (["Hi, I'm Merry Minnie!", - 'Welcome to the land of carols!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %!'], ["You'll get more than a Shave and a Haircut For a Song if you carol to Barbara Seville!", - 'Belt out a tune, Toon!', - "You'll get more than a Shave and a Haircut For a Song if you carol to Barbara Seville!", - 'Show us how to croon, Toon!', - "You'll get more than a Shave and a Haircut For a Song if you carol to Barbara Seville!", - 'Can you carry a melody here in Melodyland?', - "You'll get more than a Shave and a Haircut For a Song if you carol to Barbara Seville!", - 'Those lamps look warm in their scarves!', - "You'll get more than a Shave and a Haircut For a Song if you carol to Barbara Seville!", - "The sing's the thing!", - "You'll get more than a Shave and a Haircut For a Song if you carol to Barbara Seville!", - "I'll always like you, for better or verse!", - "You'll get more than a Shave and a Haircut For a Song if you carol to Barbara Seville!", - 'Everything looks better with a wreath!'], ['Have a fun Winter Holiday!', 'Happy Trails!', 'Mickey is taking me caroling!']) -WinterMinnieDChatter = (["Hi, I'm Merry Minnie!", - 'Welcome to the land of carols!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %!'], ['Belt out a tune, Toon!', - 'Show us how to croon, Toon!', - 'Can you carry a melody here in Melodyland?', - 'Those lamps look warm in their scarves!', - "The sing's the thing!", - "You can't go wrong with a song!", - "I'll always like you, for better or verse!", - 'Everything looks better with a wreath!'], ['Have a fun Winter Holiday!', 'Happy Trails!', 'Mickey is taking me caroling!']) -ValentinesMinnieChatter = (["Hello, I'm Minnie!", "Happy ValenToon's Day!", "Happy ValenToon's Day, %"], ['I hope Mickey got me chocolates or flowers!', - 'Those hearts are good for Laff boosts!', - 'I want to go to a ValenToon Party!', - 'I hope Mickey takes me to the Kooky Cafe!', - 'Mickey is such a good ValenToon!', - 'What did you get your ValenToon?', - "Mickey has never missed a ValenToon's Day!"], ['It was sweet having you visit!']) -WitchMinnieChatter = (['Welcome to Magicland... I mean Melodyland!', - "Hi, my name is Magic Minnie! What's yours?", - "Hello, I think you're enchanting!", - 'Happy Halloween!', - 'Happy Halloween, %!'], ['I hear Tabitha has treats for Really Kool Katz who can play tricks!', - "It's a magical day, don't you think?", - 'I hear Tabitha has treats for Really Kool Katz who can play tricks!', - 'Now where did I put my spell book', - 'I hear Tabitha has treats for Really Kool Katz who can play tricks!', - 'Abra-Cadabra!', - 'I hear Tabitha has treats for Really Kool Katz who can play tricks!', - 'Toontown looks positively spooky today!', - 'I hear Tabitha has treats for Really Kool Katz who can play tricks!', - 'Are you seeing stars too?', - 'I hear Tabitha has treats for Really Kool Katz who can play tricks!', - 'Purple is really my color!', - 'I hear Tabitha has treats for Really Kool Katz who can play tricks!', - 'I hope your Halloween is bewitching!', - 'I hear Tabitha has treats for Really Kool Katz who can play tricks!', - 'Beware of musical spiders!', - 'I hear Tabitha has treats for Really Kool Katz who can play tricks!', - 'I hope you are enjoying our Halloween fun!'], ["I'm going to disappear now!", 'Time for me to vanish!', 'Mickey is taking me Trick-or-Treating!']) -FieldOfficeMinnieChatter = ['Everyone is talking about the new Mover & Shaker Field Offices!'] -DaisyChatter = (['Welcome to my garden!', "Hello, I'm " + Daisy + ". What's your name?", "It's so nice to see you %!"], ['My prize winning flower is at the center of the garden maze.', - 'I just love strolling through the maze.', - "I haven't seen " + Goofy + ' all day.', - 'I wonder where ' + Goofy + ' is.', - 'Have you seen ' + Donald + "? I can't find him anywhere.", - 'If you see my friend ' + Minnie + ', please say "Hello" to her for me.', - 'The better gardening tools you have the better plants you can grow.', - 'There are far too many ' + Cogs + ' near ' + lDonaldsDock + '.', - 'Watering your garden every day keeps your plants happy.', - 'To grow a Pink Daisy plant a yellow and red Jellybean together.', - 'Yellow daisies are easy to grow, just plant a yellow Jellybean.', - 'If you see sand under a plant it needs water or it will wilt!'], ["I'm going to Melody Land to see %s!" % Minnie, - "I'm late for my picnic with %s!" % Donald, - "I think I'll go swimming at " + lDonaldsDock + '.', - "Oh, I'm a little sleepy. I think I'll go to Dreamland."]) -ValentinesDaisyChatter = (["Hi, I'm Daisy!", "Happy ValenToon's Day!", "Happy ValenToon's Day, %"], ["I hope Donald doesn't get me another Amore Eel!", - 'Donald is taking me out to the Deep-see Diner!', - 'I certainly have enough roses!', - 'Those hearts are good for Laff boosts!', - "I'd love to go to a ValenToon's Day party!", - 'This is the garden where love grows!', - "Donald better not sleep through ValenToon's Day again!", - 'Maybe Donald and I can double-date with Mickey and Minnie!'], ["Tell Donald I'll be waiting for him!", "Have a nice ValenToon's Day!"]) -WinterDaisyCChatter = (['Welcome to the only garden that grows in the winter!', 'Happy Winter Holiday!', 'Happy Winter Holiday, %!'], ['Shoshanna at Pine Needle Crafts is a real sap for songs, so why not craft her a carol?', - 'My garden needs more mistletoe!', - 'Shoshanna at Pine Needle Crafts is a real sap for songs, so why not craft her a carol?', - 'I need to plant holly for next year!', - 'Shoshanna at Pine Needle Crafts is a real sap for songs, so why not craft her a carol?', - "I'm going to ask Goofy to build me a gingerbread house!", - 'Shoshanna at Pine Needle Crafts is a real sap for songs, so why not craft her a carol?', - 'Those lights on the lamps are lovely!', - 'Shoshanna at Pine Needle Crafts is a real sap for songs, so why not craft her a carol?', - 'That is some jolly holly!', - 'Shoshanna at Pine Needle Crafts is a real sap for songs, so why not craft her a carol?', - 'My snowman keeps melting!', - 'Shoshanna at Pine Needle Crafts is a real sap for songs, so why not craft her a carol?', - 'That duck is decked out!', - 'Shoshanna at Pine Needle Crafts is a real sap for songs, so why not craft her a carol?', - 'I grew all these lights myself!'], ['Have a jolly Winter Holiday!', - 'Happy planting!', - 'Tell Donald to stop by with presents!', - 'Donald is taking me caroling!']) -WinterDaisyDChatter = (['Welcome to the only garden that grows in the winter!', 'Happy Winter Holiday!', 'Happy Winter Holiday, %!'], ['My garden needs more mistletoe!', - 'I need to plant holly for next year!', - "I'm going to ask Goofy to build me a gingerbread house!", - 'Those lights on the lamps are lovely!', - 'That is some jolly holly!', - 'My snowman keeps melting!', - 'That duck is decked out!', - 'I grew all these lights myself!'], ['Have a jolly Winter Holiday!', - 'Happy planting!', - 'Tell Donald to stop by with presents!', - 'Donald is taking me caroling!']) -HalloweenDaisyChatter = (['Welcome to Daisy Ghosts... I mean Gardens!', 'Happy Halloween!', 'Happy Halloween, %!'], ['Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'Wanna dance?', - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - "I'm a duck with a poodle skirt!", - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'The pirate tree needs water.', - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'Trick-or-Tree!', - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'Do you notice anything strange about the trees?', - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'I should grow some pumpkins!', - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'WHO notices something different about the lamps?', - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'Halloween really grows on me!', - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'Twig-or-Treat!', - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - "Owl bet you didn't notice the spooky lamps!", - 'Visit my friend Leif Pyle if you have a trick and Rake Inn the treats!', - 'I hope you are enjoying our Halloween fun!'], ['Donald is taking me Trick-or-Treating!', "I'm going to check out the fun Halloween decorations."]) -FieldOfficeDaisyChatter = ['Those Mover & Shaker Field Offices are popping up like weeds!'] -ChipChatter = (['Welcome to %s!' % lOutdoorZone, - "Hello, I'm " + Chip + ". What's your name?", - "No, I'm " + Chip + '.', - "It's so nice to see you %!", - 'We are Chip and Dale!'], ['I like golf.', 'We have the best acorns in Toontown.', 'The golf holes with volcanoes are the most challenging for me.'], ["We're going to the " + lTheBrrrgh + ' and play with %s.' % Pluto, - "We'll visit %s and fix him." % Donald, - "I think I'll go swimming at " + lDonaldsDock + '.', - "Oh, I'm a little sleepy. I think I'll go to Dreamland."]) -ValentinesChipChatter = (["I'm Chip!", "Happy ValenToon's Day!", "Happy ValenToon's Day, %!"], ["What did you get me for ValenToon's Day, Dale?", - 'Those hearts are good for Laff boosts!', - 'Will you be my ValenToon, Dale?', - "What did you get the Cogs for ValenToon's Day?", - "I love ValenToon's Day!"], ['Come back any time!']) -WinterChipChatter = (['Happy Winter Holiday!', 'Dressed as chipmunks!', 'Happy Winter Holiday, %!'], ['Happy Winter Holiday, Dale!', - 'All this water could freeze any minute!', - 'We should switch the golf balls with snowballs!', - 'If only chipmunks knew how to sing!', - 'Did you remember to store nuts for the winter?', - 'Did you get the Cogs a present?'], ['Go nuts this Winter Holiday!', 'Have a joyful winter Holiday!']) -HalloweenChipChatter = (['Play some MiniGhoul... I mean Golf!', 'Happy Halloween!', 'Happy Halloween, %!'], ["We're nuts about Halloween!", - "You're under arrest", - "You can't outrun the long arm of the law", - "I'm a Bobby!", - 'I hope you are enjoying our Halloween fun!', - 'Play golf and get a Howl-In-One.', - 'Candy corns are sweeter than acorns.', - 'I hope you are enjoying our Halloween fun!'], ['%, watch out for Bloodsucker Cogs!']) -DaleChatter = (["It's so nice to see you %!", - "Hello, I'm " + Dale + ". What's your name?", - "Hi I'm " + Chip + '.', - 'Welcome to %s!' % lOutdoorZone, - 'We are Chip and Dale!'], ['I like picnics.', 'Acorns are tasty, try some.', 'Those windmills can be hard too.'], ['Hihihi ' + Pluto + ' is fun to play with.', - "Yeah, let's fix %s." % Donald, - 'A swim sounds refreshing.', - "I'm getting tired and could use a nap."]) -ValentinesDaleChatter = (["I'm Dale!", "Happy ValenToon's Day!", "Happy ValenToon's Day, %!"], ['Same thing as last year. Nothing!', - 'I miss the nuts!', - 'Will you be my ValenToon, Chip?', - 'A pie in the face', - "Yeah, it's all right."], ['Come back any time!']) -WinterDaleChatter = (['Merry chipmunks!', - "Hi, we're two merry elves!", - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %!'], ['Happy Winter Holiday, Chip!', - 'Better not be on the geyser when it happens!', - 'And the golf clubs with icicles!', - 'Whoever heard of singing chipmunks?', - 'I told YOU to do that!', - 'Yes, a cream pie!'], ['And bring some back for us!', 'Have a joyful Winter Holiday!']) -HalloweenDaleChatter = (['Happy Halloween, %!', 'Play some MiniGhoul... I mean Golf!', 'Happy Halloween!'], ["We're nuts about Halloween!", - 'Great, I could use a rest!', - 'But your arms are short!', - 'I thought you were a Chip!', - 'Play golf and get a Howl-In-One', - 'Candy corns are sweeter than acorns.', - 'I hope you are enjoying our Halloween fun!'], ['%, watch out for Bloodsucker Cogs!']) -GoofyChatter = (['Welcome to ' + lDaisyGardens + '.', 'Hi, my name is ' + Goofy + ". What's yours?", "Gawrsh, it's nice to see you %!"], ['Boy it sure is easy to get lost in the garden maze!', - 'Be sure and try the maze here.', - "I haven't seen " + Daisy + ' all day.', - 'I wonder where ' + Daisy + ' is.', - 'Hey, have you seen ' + Donald + '?', - 'If you see my friend ' + Mickey + ', say hi to him for me.', - "D'oh! I forgot to fix " + Mickey + "'s breakfast!", - 'Gawrsh there sure are a lot of ' + Cogs + ' near ' + lDonaldsDock + '.', - 'It looks like ' + Daisy + ' has planted some new flowers in her garden.', - 'At the Brrrgh branch of my Gag Shop, Hypno-Goggles are on sale for only 1 Jellybean!', - "Goofy's Gag Shops offer the best jokes, tricks, and funnybone-ticklers in all of Toontown!", - "At Goofy's Gag Shops, every pie in the face is guaranteed to make a laugh or you get your Jellybeans back!"], ["I'm going to Melody Land to see %s!" % Mickey, - "Gosh, I'm late for my game with %s!" % Donald, - "I think I'll go swimming at " + lDonaldsDock + '.', - "It's time for a nap. I'm going to Dreamland."]) -WinterGoofyChatter = (["I'm Goofy about the holidays!", - 'Welcome to Snowball Speedway!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %!'], ['Who needs reindeer when you have a fast kart?', - 'Gawrsh! Is it Winter Holiday already?', - 'I need my earmuffs!', - "I haven't done any shopping yet!", - "Don't drive your kart on ice!", - 'Seems like it was Winter Holiday only a year ago!', - 'Treat your kart to a present and spruce it up!', - 'These karts are better than any old sleigh!'], ['Have a cheery Winter Holiday!', 'Drive safe, now!', 'Watch out for flying reindeer!']) -ValentinesGoofyChatter = (["I'm Goofy about ValenToon's Day!", "Happy ValenToon's Day!", "Happy ValenToon's Day, %!"], ["Gawrsh! Is it ValenToon's Day already?", - 'I LOVE kart racing!', - 'Be sweet to each other out there!', - 'Show your sweetie a new kart!', - 'Toons love their karts!', - 'Make some new friends on the track!'], ['Drive safe, now!', 'Show some love out there!']) -GoofySpeedwayChatter = (['Welcome to ' + lGoofySpeedway + '.', 'Hi, my name is ' + Goofy + ". What's yours?", "Gawrsh, it's nice to see you %!"], ['Boy, I saw a terrific race earlier.', - 'Watch out for banana peels on the race track!', - 'Have you upgraded your kart lately?', - 'We just got in some new rims at the kart shop.', - 'Hey, have you seen ' + Donald + '?', - 'If you see my friend ' + Mickey + ', say hi to him for me.', - "D'oh! I forgot to fix " + Mickey + "'s breakfast!", - 'Gawrsh there sure are a lot of ' + Cogs + ' near ' + lDonaldsDock + '.', - 'At the Brrrgh branch of my Gag Shop, Hypno-Goggles are on sale for only 1 Jellybean!', - "Goofy's Gag Shops offer the best jokes, tricks, and funnybone-ticklers in all of Toontown!", - "At Goofy's Gag Shops, every pie in the face is guaranteed to make a laugh or you get your Jellybeans back!"], ["I'm going to Melody Land to see %s!" % Mickey, - "Gosh, I'm late for my game with %s!" % Donald, - "I think I'll go swimming at " + lDonaldsDock + '.', - "It's time for a nap. I'm going to Dreamland."]) -SuperGoofyChatter = (['Welcome to my Super Speedway!', - "Hi, I'm Super Goof! What's your name?", - 'Happy Halloween!', - 'Happy Halloween, %!'], ['I am feeling kind of batty today!', - 'Anybody see my cape around? Oh, there it is!', - "Gawrsh! I don't know my own strength!", - 'Did somebody call for a superhero?', - "Beware Cogs, I'll save Halloween!", - "There's nothing scarier than me in a kart!", - "I bet you don't know who I am with this mask on!", - "It's fun to dress up for Halloween!", - 'I hope you are enjoying our Halloween fun!'], ['Gotta fly!', - 'Hi-Ho and away I go!', - "Should I fly or drive to Donald's Dock?", - 'Gawrsh, have a Happy Halloween!']) -DonaldChatter = (['Welcome to Dreamland.', "Hi, my name is %s. What's yours?" % Donald], ['Sometimes this place gives me the creeps.', - 'Be sure and try the maze in ' + lDaisyGardens + '.', - "Oh boy, I'm having a good day.", - 'Hey, have you seen ' + Mickey + '?', - 'If you see my buddy ' + Goofy + ', say hi to him for me.', - "I think I'll go fishing this afternoon.", - 'Wow, there are lots of ' + Cogs + ' at ' + lDonaldsDock + '.', - "Hey, didn't I take you on a boat ride at " + lDonaldsDock + '?', - "I haven't seen " + Daisy + ' all day.', - 'I hear ' + Daisy + ' has planted some new flowers in her garden.', - 'Quack.'], ["I'm going to Melody Land to see %s!" % Minnie, - "Gosh, I'm late for my date with %s!" % Daisy, - "I think I'll go swimming at my dock.", - "I think I'll take my boat for a spin at my dock."]) -WinterDreamlandCChatter = (["Hi, I'm Dozing Donald!", - 'Welcome to Holiday Dreamland!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %!'], ['Willow says that learning a little Sleep Voice Training is a real present, sing her a tune and find out why!', - 'I wish I was nestled all snug in my bed!', - 'Willow says that learning a little Sleep Voice Training is a real present, sing her a tune and find out why!', - "I'm dreaming of a white Toontown!", - 'Willow says that learning a little Sleep Voice Training is a real present, sing her a tune and find out why!', - 'I meant to leave out milk and cookies!', - 'Willow says that learning a little Sleep Voice Training is a real present, sing her a tune and find out why!', - 'When I wake up, I better see lots of presents!', - 'Willow says that learning a little Sleep Voice Training is a real present, sing her a tune and find out why!', - "I hope I don't sleep through the holidays!", - 'Willow says that learning a little Sleep Voice Training is a real present, sing her a tune and find out why!', - "I love a long winter's nap!", - 'Willow says that learning a little Sleep Voice Training is a real present, sing her a tune and find out why!', - 'The trees on the streets are covered in night lights!'], ['To all, a good night!', 'Sweet dreams!', 'When I wake up I am going caroling!']) -WinterDreamlandDChatter = (["Hi, I'm Dozing Donald!", - 'Welcome to Holiday Dreamland!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %!'], ['I wish I was nestled all snug in my bed!', - "I'm dreaming of a white Toontown!", - 'I meant to leave out milk and cookies!', - 'When I wake up, I better see lots of presents!', - "I hope I don't sleep through the holidays!", - "I love a long winter's nap!", - 'The trees on the streets are covered in night lights!'], ['To all, a good night!', 'Sweet dreams!', 'When I wake up I am going caroling!']) -HalloweenDreamlandChatter = (['Happy Halloween!', 'Happy Halloween, %!', "Hi, I'm FrankenDonald!"], ['If you can play a trick on my friend Max, then you can Relax To The Max with a treat!', - 'Am I awake or dreaming?', - 'If you can play a trick on my friend Max, then you can Relax To The Max with a treat!', - "I'm so scared, I can't fall asleep!", - 'If you can play a trick on my friend Max, then you can Relax To The Max with a treat!', - 'So this is what Dreamland looks like!', - 'If you can play a trick on my friend Max, then you can Relax To The Max with a treat!', - "Boy, I'm sleepy!", - 'If you can play a trick on my friend Max, then you can Relax To The Max with a treat!', - "I hope I don't sleep through Halloween this year!", - 'If you can play a trick on my friend Max, then you can Relax To The Max with a treat!', - 'I hope you are enjoying our Halloween fun!'], ['Sleep with the lights on tonight!', 'When I wake up, I am going Trick-or-Treating!']) -ValentinesDreamlandChatter = (["Hello, I'm (yawn) Donald!", "Happy ValenToon's Day!", "Happy ValenToon's Day, %!"], ["I hope I don't sleep through ValenToon's Day!", - "I'm dreaming of Daisy!", - "I had a nightmare that I missed ValenToon's Day!", - 'Those hearts are good for Laff boosts!', - "Throw a ValenToon's Day party!", - 'Show the Cogs you love them with a pie in the face!', - "I couldn't dream of a nicer holiday than ValenToon's Day!", - 'I love sleeping!'], ['Nite-nite!', "Wake me when it's ValenToon's Day!"]) -FieldOfficeDreamlandChatter = ['I dreamed about something called a Field Office...'] -HalloweenDonaldChatter = (['Welcome to my Halloween harbor!', - 'Come aboard, if you have treats!', - 'Happy Halloween!', - 'Happy Halloween, %!'], ['If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - "I'm dressed as a sailor!", - 'If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - 'Pumpkins make great lanterns!', - 'If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - "I've never seen palm trees with hairy legs before!", - 'If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - "Maybe I'll be a pirate next Halloween!", - 'If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - 'I think the best treats are starfish!', - 'If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - "I'll take you Trick-or-Treating around the harbor!", - 'If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - 'I hope those spiders stay in the trees!', - 'If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - 'What do you call a ghost in the water? A BOO-y!', - 'If playing tricks is making you feel Rudderly Ridiculous, then go see Rudy for a treat!', - 'I hope you are enjoying our Halloween fun!'], ['Set sail for scares!', 'Happy haunting!', "I'm going to check out the spooky Halloween decorations."]) -ValentinesDonaldChatter = (["Ahoy, I'm Donald!", "Happy ValenToon's Day!", "Happy ValenToon's Day, %!"], ["Was I supposed to take Daisy somewhere for ValenToon's Day?", - "Just once more around the dock, then I'll get Daisy something.", - "What would Daisy like for ValenToon's Day?", - 'Those hearts in the water are good for Laff boosts!', - "Throw a ValenToon's Day party!", - 'Show the Cogs you love them with a pie in the face!', - "I'll have to catch an Amore Eel for Daisy!"], ['Aloha!', 'Give the Cogs my best!']) -WinterDonaldCChatter = (["Welcome to Donald's Boat and Sleigh Dock!", - 'All aboard for the Winter Holiday cruise!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %!'], ['I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - 'How do you like my duck-orations?', - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - 'What is snow doing on the lamp posts?', - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - 'This water better not ice over!', - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - 'How did they get the lights up in those trees?', - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - 'This boat is better than a sleigh! or is it?', - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - "I don't need reindeer to pull this boat!", - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - "I'm glad I'm not a turkey this time of year!", - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - 'My present to you? Free boat rides!', - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!', - "I hope I don't get a lump of coal again!", - 'I hear that Dante has Gifts With A Porpoise, share a song and he may have a gift for you too!'], ['All ashore for holiday fun!', 'Remember to tip your boat driver on the way out!', 'Enjoy your holiday!']) -WinterDonaldDChatter = (["Welcome to Donald's Boat and Sleigh Dock!", - 'All aboard for the Winter Holiday cruise!', - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %!'], ['How do you like my duck-orations?', - 'What is snow doing on the lamp posts?', - 'This water better not ice over!', - 'How did they get the lights up in those trees?', - 'This boat is better than a sleigh! or is it?', - "I don't need reindeer to pull this boat!", - "I'm glad I'm not a turkey this time of year!", - 'My present to you? Free boat rides!', - "I hope I don't get a lump of coal again!"], ['All ashore for holiday fun!', 'Remember to tip your boat driver on the way out!', 'Enjoy your holiday!']) -WesternPlutoChatter = (["Boo! Don't be scared, it's just me ... Pluto!", 'Happy Halloween, pardner!', 'Happy Halloween, %!'], ["Frosty Fred has treats for tricks, they make him feel like there's Snowplace Like Home!", - 'I do tricks for treats!', - "Frosty Fred has treats for tricks, they make him feel like there's Snowplace Like Home!", - "Mickey's taking me Trick-or-Treating later!", - "Frosty Fred has treats for tricks, they make him feel like there's Snowplace Like Home!", - 'It feels more like Winter Holiday than Halloween!', - "Frosty Fred has treats for tricks, they make him feel like there's Snowplace Like Home!", - "Bark! That's 'Trick-or-Treat' in dog!", - "Frosty Fred has treats for tricks, they make him feel like there's Snowplace Like Home!", - 'I hope you are enjoying our Halloween fun!', - "Frosty Fred has treats for tricks, they make him feel like there's Snowplace Like Home!", - 'I like to chase Black Cat Toons!', - "Frosty Fred has treats for tricks, they make him feel like there's Snowplace Like Home!", - "There's a snake in my boot!"], ["I'm going to go dig up a treat!", "I'm going to see if Mickey has some treats!", "I'm going to scare Donald!"]) -WinterPlutoCChatter = (["Hi, I'm Pluto!", - "Welcome to the Brrgh, where it's winter all year!", - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %'], ["Eddie could use a good tune, because Snowman's Land is a lonely place for a Yeti!", - 'I chewed on an icicle and got frost-bite!', - "Eddie could use a good tune, because Snowman's Land is a lonely place for a Yeti!", - 'This is like living in a snow globe!', - "Eddie could use a good tune, because Snowman's Land is a lonely place for a Yeti!", - 'I wish I was beside a warm fire!', - "Eddie could use a good tune, because Snowman's Land is a lonely place for a Yeti!", - 'Arf! Arf! I need a scarf!', - "Eddie could use a good tune, because Snowman's Land is a lonely place for a Yeti!", - "At least my nose isn't red and glowing!"], ['Have a fun Winter Holiday!', 'Come back any time you want snow!', 'Mickey is taking me caroling!']) -WinterPlutoDChatter = (["Hi, I'm Pluto!", - "Welcome to the Brrgh, where it's winter all year!", - 'Happy Winter Holiday!', - 'Happy Winter Holiday, %'], ['I chewed on an icicle and got frost-bite!', - 'This is like living in a snow globe!', - 'I wish I was beside a warm fire!', - 'Arf! Arf! I need a scarf!', - "At least my nose isn't red and glowing!"], ['Have a fun Winter Holiday!', 'Come back any time you want snow!', 'Mickey is taking me caroling!']) -AFMickeyChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ["Welcome to the Gardens! I'm " + Daisy + '!', - "I'm " + Daisy + ', and I love to garden!', - "April Toons' Week is the silliest week of the year!", - "What, you've never seen a duck with mouse ears?", - "Hi, I'm " + Daisy + '! Quack!', - "It's tough quacking like a duck!", - "I'm not feeling like myself today!", - 'Have you heard your Doodle talk yet?', - 'Gravity has taken a holiday at the Estates!'], ["Have a wacky April Toons' Week!", 'Tell Mickey I said hi!']) -AFMinnieChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ['Welcome to ' + lTheBrrrgh + "! I'm " + Pluto + '!', - "Hi, I'm " + Pluto + "! What's your name?", - "What, you've never seen a dog with mouse ears?", - "I'm not feeling like myself today!", - "Does anyone have a doggie biscuit? I'm hungry!", - 'Bark! My name is ' + Pluto + '!', - "Isn't this silly?", - "Don't make me chase you around!", - "April Toons' Week is the silliest week of the year!", - 'Have you heard your Doodle talk yet?', - 'Gravity has taken a holiday at the Estates!'], ["Have a wacky April Toons' Week!", 'I have to go chase cars now! Bye!']) -AFDaisyChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ['Welcome to ' + lToontownCentral + "! I'm " + Mickey + ' Mouse!', - "Hi, I'm " + Mickey + '! The happiest mouse in Toontown!', - 'If you see ' + Daisy + ', tell her ' + Mickey + ' said hi!', - "What, you've never seen a mouse with feathers?", - "Isn't this silly?", - "I'm not feeling like myself today!", - "April Toons' Week is the silliest week of the year!", - 'Have you heard your Doodle talk yet?', - 'Gravity has taken a holiday at the Estates!'], ['Bye! Tell them ' + Mickey + ' sent you!', 'If you go to ' + lDaisyGardens + ', say hi to her for me!']) -AFGoofySpeedwayChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ["Welcome to Dreamland! I'm " + Donald + '!', - "Hello, I'm " + Donald + '! Is it nap time yet?', - 'A duck needs his beauty rest, you know!', - "What, you've never seen a duck with dog ears?", - 'Gawrsh! I mean -- Quack!', - 'This would make a great race track ... um, I mean place to nap!', - "I'm not feeling like myself today!", - "April Toons' Week is the silliest week of the year!", - 'Have you heard your Doodle talk yet?', - 'Gravity has taken a holiday at the Estates!'], ['If you see ' + Goofy + ', tell him ' + Donald + ' says hi!', 'Bye, and good night!']) -AFDonaldChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ["Welcome to the Speedway! I'm " + Goofy + '!', - "I'm " + Goofy + ", and I'm dreaming I'm " + Donald + '!', - "I've heard of sleep walking, but sleep kart driving?", - 'Gawrsh! It sure is silly being ' + Goofy + '!', - 'How can I watch the races with my eyes closed?', - 'I better grab a nap before my next race!', - "April Toons' Week is the silliest week of the year!", - "I'm not feeling like myself today!", - 'Have you heard your Doodle talk yet?', - 'Gravity has taken a holiday at the Estates!'], ["Have a wacky April Toons' Week!", 'I need to work on my karts! Bye!']) -AFDonaldDockChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ["Everybody gets April Toons' Week off but me!", - "I'm the only one who has to work this week!", - 'I only get time off when I sleep!', - 'All my friends are pretending to be somebody else!', - 'Round and round in this boat, all day long!', - 'I heard Daisy is pretending to be Mickey!', - "The silliest week of the year, and I'm missing it!", - 'Have you heard your Doodle talk yet?', - 'Gravity has taken a holiday at the Estates!'], ["Have a wacky April Toons' Week!", 'Play a joke on the Cogs for me!']) -AFPlutoChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ["Welcome to Melodyland! I'm " + Minnie + '!', - 'Hi, my name is ' + Minnie + ' Mouse!', - "I'm as happy as a mouse can be!", - "What, you've never seen a mouse with dog ears?", - 'I love when ' + Mickey + ' and I go for walks!', - 'What, you never heard a mouse talk before?', - "April Toons' Week is the silliest week of the year!", - 'Have you heard your Doodle talk yet?', - 'Gravity has taken a holiday at the Estates!'], ["Have a wacky April Toons' Week!", 'If you see ' + Pluto + ', tell him ' + Minnie + ' says hi!']) -AFChipChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ["Hi, I'm " + Dale + '!', - 'How are you today, ' + Chip + '?', - 'I always thought you were ' + Dale + ', ' + Chip + '.', - "You're sure you're " + Chip + ' and not ' + Dale + ', ' + Chip + '?', - "April Toons' Week is the silliest week of the year!"], ['Bye from ' + Chip + ' and ' + Dale + '!']) -AFDaleChatter = (["Happy April Toons' Week!", "Happy April Toons' Week, %!"], ["Hi, I'm " + Chip + '!', - 'Very well ' + Dale + ', thanks!', - "Nope, I'm " + Chip + ', ' + Dale + '.', - 'Yes, ' + Dale + ", I'm " + Chip + ', not ' + Dale + '.', - 'It sure is, ' + Chip + '! I mean, ' + Dale + '.'], ['Or ' + Dale + ' and ' + Chip + '!']) -CLGoofySpeedwayChatter = (['Welcome to ' + lGoofySpeedway + '.', - 'Hi, my name is ' + Goofy + ". What's yours?", - "Gawrsh, it's nice to see you %!", - "Hi there! Pardon my dusty clothes I've been busy fixin' that broken Leaderboard."], ['We better get this Leaderboard working soon, Grand Prix Weekend is coming up!', - "Does anybody want to buy a slightly used kart? It's only been through the Leaderboard once!", - 'Grand Prix Weekend is coming, better get to practicing.', - 'Grand Prix Weekend will be here on Friday, May 22 through Monday, May 25!', - "I'm gonna need a ladder to get that kart down.", - 'That Toon really wanted to get on the Leaderboard!', - 'Boy, I saw a terrific race earlier.', - 'Watch out for banana peels on the race track!', - 'Have you upgraded your kart lately?', - 'We just got in some new rims at the kart shop.', - 'Hey, have you seen ' + Donald + '?', - 'If you see my friend ' + Mickey + ', say hi to him for me.', - "D'oh! I forgot to fix " + Mickey + "'s breakfast!", - 'Gawrsh there sure are a lot of ' + Cogs + ' near ' + lDonaldsDock + '.', - 'At the Brrrgh branch of my Gag Shop, Hypno-Goggles are on sale for only 1 Jellybean!', - "Goofy's Gag Shops offer the best jokes, tricks, and funnybone-ticklers in all of Toontown!", - "At Goofy's Gag Shops, every pie in the face is guaranteed to make a laugh or you get your Jellybeans back!"], ['I better go get my kart a new paint job for the upcoming Grand Prix Weekend.', - "Gosh, I better get workin' on this broken Leaderboard!", - "Hope I'll see y'all on Grand Prix Weekend! Goodbye!", - "It's time for a nap. I'm going to Dreamland to dream about winnin' the Grand Prix."]) -GPGoofySpeedwayChatter = (['Welcome to ' + lGoofySpeedway + '.', - 'Welcome to Grand Prix Weekend!', - 'Hi, my name is ' + Goofy + ". What's yours?", - "Gawrsh, it's nice to see you %!"], ['Are you excited about the Grand Prix Weekend?', - 'Grand Prix Weekend really drives up those scores!', - 'Get more tickets by racing practice laps.', - "Gawrsh, you're a fast racer!", - 'Boy, I saw a terrific race earlier.', - 'Watch out for banana peels on the race track!', - 'Have you upgraded your kart lately?', - 'We just got in some new rims at the kart shop.', - 'Hey, have you seen ' + Donald + '? He said he was gonna come watch the Grand Prix!', - 'If you see my friend ' + Mickey + ", tell him he's missing some great racing!", - "D'oh! I forgot to fix " + Mickey + "'s breakfast!", - 'Gawrsh there sure are a lot of ' + Cogs + ' near ' + lDonaldsDock + '.', - 'At the Brrrgh branch of my Gag Shop, Hypno-Goggles are on sale for only 1 Jellybean!', - "Goofy's Gag Shops offer the best jokes, tricks, and funnybone-ticklers in all of Toontown!", - "At Goofy's Gag Shops, every pie in the face is guaranteed to make a laugh or you get your Jellybeans back!"], ['Good luck in the Grand Prix!', - "I'm going to catch the next race in the Grand Prix!", - 'Gawrsh I think the next race is about to start!', - 'Gosh, I better go check on the new Leaderboard and make sure it is working right!']) SillyPhase1Chatter = ["If you haven't seen the Silly Meter, head to Toon Hall!", 'Toontown is getting sillier by the day!', "Cause silly surges in battle to boost Toontown's silly levels!", @@ -3921,13 +3224,6 @@ SillyPhase4Chatter = ['Fire hydrants make your Squirt Gags squirtier!', 'Objects on the street can help you in battle!', "I just know we'll get the Silly Meter back up soon!", 'Enjoy the sillier Toontown!'] -for chatter in [MickeyChatter, - DonaldChatter, - MinnieChatter, - GoofyChatter]: - chatter[0].extend(SharedChatterGreetings) - chatter[1].extend(SharedChatterComments) - chatter[2].extend(SharedChatterGoodbyes) BoringTopic = 'Boring' EmceeDialoguePhase1Topic = 'EmceeDialoguePhase1' @@ -5048,7 +4344,7 @@ TownBattleSOSPetSearchTitle = 'Searching for doodle\n%s...' TownBattleSOSPetInfoTitle = '%s is %s' TownBattleSOSPetInfoOK = lOK TrolleyHFAMessage = 'You may not board the trolley until your Laff meter is smiling.' -TrolleyTFAMessage = 'You may not board the trolley until ' + Mickey + ' says so.' +TrolleyTFAMessage = 'You may not board the trolley until Joey says so.' TrolleyHopOff = 'Hop off' FishingExit = 'Exit' FishingCast = 'Cast' @@ -5082,54 +4378,7 @@ FishPokerPair = 'Pair' TutorialGreeting1 = 'Hi %s!' TutorialGreeting2 = 'Hi %s!\nCome over here!' TutorialGreeting3 = 'Hi %s!\nCome over here!\nUse the arrow keys!' -TutorialMickeyWelcome = 'Welcome to Toontown!' -TutorialFlippyIntro = 'Let me introduce you to my friend %s...' % Flippy -TutorialFlippyHi = 'Hi, %s!' -TutorialQT1 = 'You can talk by using this.' -TutorialQT2 = 'You can talk by using this.\nClick it, then choose "Hi".' -TutorialChat1 = 'You can talk using either of these buttons.' -TutorialChat2 = 'The blue button lets you chat with the keyboard.' -TutorialChat3 = "Be careful! Most other players won't understand what you say you when you use the keyboard." -TutorialChat4 = 'The green button opens the %s.' -TutorialChat5 = 'Everyone can understand you if you use the %s.' -TutorialChat6 = 'Try saying "Hi".' -TutorialBodyClick1 = 'Very good!' -TutorialBodyClick2 = 'Pleased to meet you! Want to be friends?' -TutorialBodyClick3 = 'To make friends with %s, click on him...' % Flippy -TutorialHandleBodyClickSuccess = 'Good Job!' -TutorialHandleBodyClickFail = 'Not quite. Try clicking right on %s...' % Flippy -TutorialFriendsButton = "Now click the 'Friends' button under %s's picture in the right hand corner." % Flippy -TutorialHandleFriendsButton = "And then click on the 'Yes' button.." -TutorialOK = lOK -TutorialYes = lYes -TutorialNo = lNo -TutorialFriendsPrompt = 'Would you like to make friends with %s?' % Flippy -TutorialFriendsPanelMickeyChat = "%s has agreed to be your friend. Click 'Ok' to finish up." % Flippy -TutorialFriendsPanelYes = '%s said yes!' % Flippy -TutorialFriendsPanelNo = "That's not very friendly!" -TutorialFriendsPanelCongrats = 'Congratulations! You made your first friend.' -TutorialFlippyChat1 = 'Come see me when you are ready for your first ToonTask!' -TutorialFlippyChat2 = "I'll be in ToonHall!" -TutorialAllFriendsButton = 'You can view all your friends by clicking the friends button. Try it out...' -TutorialEmptyFriendsList = "Right now your list is empty because %s isn't a real player." % Flippy -TutorialCloseFriendsList = "Click the 'Close'\nbutton to make the\nlist go away" -TutorialShtickerButton = 'The button in the lower, right corner opens your Shticker Book. Try it...' -TutorialBook1 = 'The book contains lots of useful information like this map of Toontown.' -TutorialBook2 = 'You can also check the progress of your ToonTasks.' -TutorialBook3 = 'When you are done click the book button again to make it close' -TutorialLaffMeter1 = 'You will also need this...' -TutorialLaffMeter2 = "You will also need this...\nIt's your Laff meter." -TutorialLaffMeter3 = 'When ' + Cogs + ' attack you, it gets lower.' -TutorialLaffMeter4 = 'When you are in playgrounds like this one, it goes back up.' -TutorialLaffMeter5 = 'When you complete ToonTasks, you will get rewards, like increasing your Laff limit.' -TutorialLaffMeter6 = 'Be careful! If the ' + Cogs + ' defeat you, you will lose all your gags.' -TutorialLaffMeter7 = 'To get more gags, play trolley games.' -TutorialTrolley1 = 'Follow me to the trolley!' -TutorialTrolley2 = 'Hop on board!' -TutorialBye1 = 'Play some games!' -TutorialBye2 = 'Play some games!\nBuy some gags!' -TutorialBye3 = 'Go see %s when you are done!' % Flippy -TutorialForceAcknowledgeMessage = 'You are going the wrong way! Go find %s!' % Mickey +TutorialForceAcknowledgeMessage = 'You are going the wrong way! Go find Flippy!' PetTutorialTitle1 = 'The Doodle Panel' PetTutorialTitle2 = 'Doodle SpeedChat' PetTutorialTitle3 = 'Doodle Cattlelog' @@ -5190,8 +4439,8 @@ TugOfWarGameReady = 'Ready...' TugOfWarGameEnd = 'Good game!' TugOfWarGameTie = 'You tied!' TugOfWarPowerMeter = 'Power meter' -PatternGameTitle = 'Match %s' % Minnie -PatternGameInstructions = Minnie + ' will show you a dance sequence. ' + 'Try to repeat ' + Minnie + "'s dance just the way you see it using the arrow keys!" +PatternGameTitle = 'Match Blinky' +PatternGameInstructions = 'Little Blinky will show you a dance sequence. ' + "Try to repeat Little Blinky's dance just the way you see it using the arrow keys!" PatternGameWatch = 'Watch these dance steps...' PatternGameGo = 'GO!' PatternGameRight = 'Good, %s!' @@ -5303,8 +4552,6 @@ GagShopPlayerDisconnected = '%s has disconnected' GagShopPlayerExited = '%s has exited' GagShopPlayerPlayAgain = 'Play Again' GagShopPlayerBuying = 'Buying' -GenderShopQuestionMickey = 'To make a boy toon, click on me!' -GenderShopQuestionMinnie = 'To make a girl toon, click on me!' GenderShopFollow = 'Follow me!' GenderShopSeeYou = 'See you later!' GenderShopBoyButtonText = 'Boy' @@ -5392,17 +4639,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') NumToColor = ['White', 'Peach', 'Bright Red', @@ -7573,6 +6809,7 @@ NPCToonNames = {20000: 'Tutorial Tom', 7007: 'Dewin Tymme', 7008: 'Ima Cagedtoon', 7009: 'Jimmy Thelock', + 7010: 'Little Blinky', # Start with 91913. 91917: 'Magic Cat', 91918: 'Trap Cat'} @@ -8326,10 +7563,10 @@ TipDict = {TIP_NONE: ('',), 'If you wait too long to attack a lured Cog, it will wake up. Higher level lures last longer.', 'There are fishing ponds on every street in Toontown. Some streets have unique fish.'), TIP_MINIGAME: ('After you fill up your Jellybean jar, any Jellybeans you get from Trolley Games automatically spill over into your bank.', - 'You can use the arrow keys instead of the mouse in the "Match Minnie" Trolley Game.', + 'You can use the arrow keys instead of the mouse in the "Match Blinky" Trolley Game.', 'In the Cannon Game you can use the arrow keys to move your cannon and press the "Control" key to fire.', 'In the Ring Game, bonus points are awarded when the entire group successfully swims through its rings.', - 'A perfect game of Match Minnie will double your points.', + 'A perfect game of Match Blinky will double your points.', 'In the Tug-of-War you are awarded more Jellybeans if you play against a tougher Cog.', 'Trolley Game difficulty varies by neighborhood; ' + lToontownCentral + ' has the easiest and ' + lDonaldsDreamland + ' has the hardest.', 'Certain Trolley Games can only be played in a group.'), diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index b27c73ac..bc9c45ae 100644 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -514,20 +514,6 @@ TrophyStarColors = (Vec4(0.9, 0.6, 0.2, 1), Vec4(0.8, 0.8, 0.8, 1), Vec4(1, 1, 0, 1), Vec4(1, 1, 0, 1)) -MickeySpeed = 5.0 -VampireMickeySpeed = 1.15 -MinnieSpeed = 3.2 -WitchMinnieSpeed = 1.8 -DonaldSpeed = 3.68 -FrankenDonaldSpeed = 0.9 -DaisySpeed = 2.3 -GoofySpeed = 5.2 -SuperGoofySpeed = 1.6 -PlutoSpeed = 5.5 -WesternPlutoSpeed = 3.2 -ChipSpeed = 3 -DaleSpeed = 3.5 -DaleOrbitDistance = 3 SuitWalkSpeed = 4.8 PieThrowArc = 0 PieThrowLinear = 1 From e837ad96f4030528f576e6a6a070cd3a78540caf Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Mar 2015 21:27:49 +0300 Subject: [PATCH 18/21] Remove Trap Cat SOS --- toontown/battle/MovieNPCSOS.py | 36 +++++-------------------- toontown/toon/NPCToons.py | 25 ----------------- toontown/toonbase/TTLocalizerEnglish.py | 4 +-- 3 files changed, 8 insertions(+), 57 deletions(-) diff --git a/toontown/battle/MovieNPCSOS.py b/toontown/battle/MovieNPCSOS.py index 98ea1046..e8cd8756 100644 --- a/toontown/battle/MovieNPCSOS.py +++ b/toontown/battle/MovieNPCSOS.py @@ -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] diff --git a/toontown/toon/NPCToons.py b/toontown/toon/NPCToons.py index 8a3892d2..7fe7d3d8 100644 --- a/toontown/toon/NPCToons.py +++ b/toontown/toon/NPCToons.py @@ -11583,27 +11583,6 @@ NPCToonDict = {20000: (-1, 10), 'm', 0, - NPC_REGULAR), -# Trap Cat SOS -# 1 Star, Sound SOS, Opera 1 damage. "We are team trap!". -91918: (-1, - lnames[91918], - ('dss', - 'l', - 's', - 'm', - 20, - 0, - 20, - 2, - 66, - 3, - 12, - 3, - 12, - 11), - 'm', - 0, NPC_REGULAR)} if config.GetBool('want-new-toonhall', 1): @@ -11729,10 +11708,6 @@ HQnpcFriends = {2001: (ToontownBattleGlobals.HEAL_TRACK, 0, 255, 5), - 91918: (ToontownBattleGlobals.SOUND_TRACK, - 6, - 1, - 0), 4219: (ToontownBattleGlobals.SOUND_TRACK, 5, 50, diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index a8ce56c6..292a368b 100644 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -6810,9 +6810,7 @@ NPCToonNames = {20000: 'Tutorial Tom', 7008: 'Ima Cagedtoon', 7009: 'Jimmy Thelock', 7010: 'Little Blinky', -# Start with 91913. -91917: 'Magic Cat', -91918: 'Trap Cat'} + 91917: 'Magic Cat'} zone2TitleDict = {2513: ('Toon Hall', ''), 2514: ('Toontown Bank', ''), 2516: ('Toontown School House', ''), From 72cd51bf93c2f28c43d20ab10808c0acc2e56b9f Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 15:05:19 -0400 Subject: [PATCH 19/21] Added Cog Level Gui, time to polish it... --- .../databases/air_cache/pets_401000001.pets | 47 ++++ toontown/shtiker/OptionsPage.py | 112 ++++++++- toontown/suit/BossCog.py | 47 ++-- toontown/suit/DistributedSuitBase.py | 5 +- toontown/suit/Suit.py | 74 +++--- toontown/suit/SuitBase.py | 14 ++ toontown/toonbase/TTLocalizerEnglish.py | 1 + .../toonbase/TTLocalizerEnglishProperty.py | 1 + toontown/toonbase/ToonBase.py | 2 + toontown/town/TownBattle.py | 63 +++++- toontown/town/TownBattleCogPanel.py | 213 ++++++++++++++++++ 11 files changed, 530 insertions(+), 49 deletions(-) create mode 100644 astron/databases/air_cache/pets_401000001.pets create mode 100644 toontown/town/TownBattleCogPanel.py diff --git a/astron/databases/air_cache/pets_401000001.pets b/astron/databases/air_cache/pets_401000001.pets new file mode 100644 index 00000000..517093d2 --- /dev/null +++ b/astron/databases/air_cache/pets_401000001.pets @@ -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. \ No newline at end of file diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index 4ea1b8af..b5c6ed56 100644 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -117,7 +117,7 @@ speedChatStyles = ( (210 / 255.0, 200 / 255.0, 180 / 255.0) ) ) -PageMode = PythonUtil.Enum('Options, Codes') +PageMode = PythonUtil.Enum('Options, Codes, MoreOptions') class OptionsPage(ShtikerPage.ShtikerPage): @@ -128,9 +128,11 @@ class OptionsPage(ShtikerPage.ShtikerPage): self.optionsTabPage = None self.codesTabPage = None + self.moreOptionsTabPage = None self.title = None self.optionsTab = None self.codesTab = None + self.moreOptionsTab = None def load(self): ShtikerPage.ShtikerPage.load(self) @@ -139,6 +141,8 @@ class OptionsPage(ShtikerPage.ShtikerPage): self.optionsTabPage.hide() self.codesTabPage = CodesTabPage(self) self.codesTabPage.hide() + self.moreOptionsTabPage = MoreOptionsTabPage(self) + self.moreOptionsTabPage.hide() self.title = DirectLabel( parent=self, relief=None, text=TTLocalizer.OptionsPageTitle, @@ -158,7 +162,7 @@ class OptionsPage(ShtikerPage.ShtikerPage): image1_color=clickColor, image2_color=rolloverColor, image3_color=diabledColor, text_fg=Vec4(0.2, 0.1, 0, 1), command=self.setMode, extraArgs=[PageMode.Options], - pos=(-0.36, 0, 0.77)) + pos=(-0.64, 0, 0.77)) self.codesTab = DirectButton( parent=self, relief=None, text=TTLocalizer.OptionsPageCodesTab, text_scale=TTLocalizer.OPoptionsTab, text_align=TextNode.ALeft, @@ -168,7 +172,17 @@ class OptionsPage(ShtikerPage.ShtikerPage): image_color=normalColor, image1_color=clickColor, image2_color=rolloverColor, image3_color=diabledColor, text_fg=Vec4(0.2, 0.1, 0, 1), command=self.setMode, - extraArgs=[PageMode.Codes], pos=(0.11, 0, 0.77)) + extraArgs=[PageMode.Codes], pos=(-0.12, 0, 0.77)) + self.moreOptionsTab = DirectButton( + parent=self, relief=None, text=TTLocalizer.MoreOptionsPageTitle, + text_scale=TTLocalizer.OPmoreOptionsTab, text_align=TextNode.ALeft, + text_pos=(-0.035, 0.0, 0.0), + image=gui.find('**/tabs/polySurface2'), image_pos=(0.12, 1, -0.91), + image_hpr=(0, 0, -90), image_scale=(0.033, 0.033, 0.035), + image_color=normalColor, image1_color=clickColor, + image2_color=rolloverColor, image3_color=diabledColor, + text_fg=Vec4(0.2, 0.1, 0, 1), command=self.setMode, + extraArgs=[PageMode.MoreOptions], pos=(0.42, 0, 0.77)) gui.removeNode() def enter(self): @@ -220,13 +234,24 @@ class OptionsPage(ShtikerPage.ShtikerPage): self.optionsTabPage.enter() self.codesTab['state'] = DGG.NORMAL self.codesTabPage.exit() + self.moreOptionsTab['state'] = DGG.NORMAL + self.moreOptionsTabPage.exit() elif mode == PageMode.Codes: self.title['text'] = TTLocalizer.CdrPageTitle self.optionsTab['state'] = DGG.NORMAL self.optionsTabPage.exit() + self.moreOptionsTab['state'] = DGG.NORMAL + self.moreOptionsTabPage.exit() self.codesTab['state'] = DGG.DISABLED self.codesTabPage.enter() - + elif mode == PageMode.MoreOptions: + self.title['text'] = TTLocalizer.MoreOptionsPageTitle + self.optionsTab['state'] = DGG.NORMAL + self.optionsTabPage.exit() + self.codesTab['state'] = DGG.NORMAL + self.codesTabPage.exit() + self.moreOptionsTab['state'] = DGG.DISABLED + self.moreOptionsTabPage.enter() class OptionsTabPage(DirectFrame): notify = directNotify.newCategory('OptionsTabPage') @@ -676,3 +701,82 @@ class CodesTabPage(DirectFrame): self.codeInput['state'] = DGG.NORMAL self.codeInput['focus'] = 1 self.submitButton['state'] = DGG.NORMAL + +class MoreOptionsTabPage(DirectFrame): + notify = directNotify.newCategory('MoreOptionsTabPage') + + def __init__(self, parent = aspect2d): + self.parent = parent + self.currentSizeIndex = None + + DirectFrame.__init__(self, parent=self.parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0)) + + self.load() + + def destroy(self): + self.parent = None + + DirectFrame.destroy(self) + + def load(self): + guiButton = loader.loadModel('phase_3/models/gui/quit_button') + gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') + titleHeight = 0.61 + textStartHeight = 0.45 + textRowHeight = 0.145 + leftMargin = -0.72 + buttonbase_xcoord = 0.35 + buttonbase_ycoord = 0.45 + button_image_scale = (0.7, 1, 1) + button_textpos = (0, -0.02) + options_text_scale = 0.052 + disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0) + self.speed_chat_scale = 0.055 + self.CogLevel_toggleButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord), command=self.__doToggleCogLevelGui) + self.CogLevel_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight)) + gui.removeNode() + guiButton.removeNode() + + def enter(self): + self.show() + self.settingsChanged = 0 + self.__setCogLevelGuiButton() + + def exit(self): + self.ignore('confirmDone') + self.hide() + + def unload(self): + self.CogLevel_Label.destroy() + del self.CogLevel_Label + self.CogLevel_toggleButton.destroy() + del self.CogLevel_toggleButton + + def __doToggleCogLevelGui(self): + messenger.send('wakeup') + if base.wantCogLevelGui: + base.wantCogLevelGui = False + settings['want-Cog-Level-GUI'] = False + else: + base.wantCogLevelGui = True + settings['want-Cog-Level-GUI'] = True + self.settingsChanged = 1 + self.__setCogLevelGuiButton() + + def __setCogLevelGuiButton(self): + if base.wantCogLevelGui: + self.CogLevel_Label['text'] = 'Cog Level GUI In-Battle:' + self.CogLevel_toggleButton['text'] = 'On' + else: + self.CogLevel_Label['text'] = 'Cog Level GUI In-Battle:' + self.CogLevel_toggleButton['text'] = 'Off' + + def __doToggleAntialiasing(self): + # To toggle anti-aliasing in the future. + pass + + def __setAntialiasingGuiButton(self): + # More anti-aliasing stuff. + pass + + diff --git a/toontown/suit/BossCog.py b/toontown/suit/BossCog.py index 2cd3e7dc..8e57397b 100644 --- a/toontown/suit/BossCog.py +++ b/toontown/suit/BossCog.py @@ -181,22 +181,32 @@ class BossCog(Avatar.Avatar): health = 1.0 - float(self.bossDamage) / float(self.bossMaxDamage) if health > 0.95: condition = 0 - elif health > 0.7: + elif health > 0.9: condition = 1 - elif health > 0.3: + elif health > 0.8: condition = 2 + elif health > 0.7: + condition = 3#Yellow + elif health > 0.6: + condition = 4 + elif health > 0.5: + condition = 5 + elif health > 0.3: + condition = 6#Orange + elif health > 0.15: + condition = 7 elif health > 0.05: - condition = 3 + condition = 8#Red elif health > 0.0: - condition = 4 + condition = 9#Blinking Red else: - condition = 5 + condition = 10 if self.healthCondition != condition: - if condition == 4: + if condition == 9: blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1)) taskMgr.add(blinkTask, self.uniqueName('blink-task')) - elif condition == 5: - if self.healthCondition == 4: + elif condition == 10: + if self.healthCondition == 9: taskMgr.remove(self.uniqueName('blink-task')) blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1)) taskMgr.add(blinkTask, self.uniqueName('blink-task')) @@ -204,19 +214,22 @@ class BossCog(Avatar.Avatar): self.healthBar.setColor(self.healthColors[condition], 1) self.healthBarGlow.setColor(self.healthGlowColors[condition], 1) self.healthCondition = condition - return - + def __blinkRed(self, task): - self.healthBar.setColor(self.healthColors[3], 1) - self.healthBarGlow.setColor(self.healthGlowColors[3], 1) - if self.healthCondition == 5: + if not self.healthBar: + return + self.healthBar.setColor(self.healthColors[8], 1) + self.healthBarGlow.setColor(self.healthGlowColors[8], 1) + if self.healthCondition == 10: self.healthBar.setScale(1.17) return Task.done def __blinkGray(self, task): - self.healthBar.setColor(self.healthColors[4], 1) - self.healthBarGlow.setColor(self.healthGlowColors[4], 1) - if self.healthCondition == 5: + if not self.healthBar: + return + self.healthBar.setColor(self.healthColors[9], 1) + self.healthBarGlow.setColor(self.healthGlowColors[9], 1) + if self.healthCondition == 10: self.healthBar.setScale(1.0) return Task.done @@ -224,7 +237,7 @@ class BossCog(Avatar.Avatar): if self.healthBar: self.healthBar.removeNode() self.healthBar = None - if self.healthCondition == 4 or self.healthCondition == 5: + if self.healthCondition == 9 or self.healthCondition == 10: taskMgr.remove(self.uniqueName('blink-task')) self.healthCondition = 0 return diff --git a/toontown/suit/DistributedSuitBase.py b/toontown/suit/DistributedSuitBase.py index 68c40f53..186479e5 100644 --- a/toontown/suit/DistributedSuitBase.py +++ b/toontown/suit/DistributedSuitBase.py @@ -125,6 +125,9 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa def getHP(self): return self.currHP + def getMaxHP(self): + return self.maxHP + def setHP(self, hp): if hp > self.maxHP: self.currHP = self.maxHP @@ -461,4 +464,4 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa except: level = '???' - return '%s\n%s\nLevel %s' % (self.getName(), self.doId, level) \ No newline at end of file + return '%s\n%s\nLevel %s' % (self.getName(), self.doId, level) diff --git a/toontown/suit/Suit.py b/toontown/suit/Suit.py index 1272df50..2d337f98 100644 --- a/toontown/suit/Suit.py +++ b/toontown/suit/Suit.py @@ -318,16 +318,26 @@ def attachSuitHead(node, suitName): class Suit(Avatar.Avatar): __module__ = __name__ - healthColors = (Vec4(0, 1, 0, 1), - Vec4(1, 1, 0, 1), - Vec4(1, 0.5, 0, 1), - Vec4(1, 0, 0, 1), - Vec4(0.3, 0.3, 0.3, 1)) - healthGlowColors = (Vec4(0.25, 1, 0.25, 0.5), - Vec4(1, 1, 0.25, 0.5), - Vec4(1, 0.5, 0.25, 0.5), - Vec4(1, 0.25, 0.25, 0.5), - Vec4(0.3, 0.3, 0.3, 0)) + healthColors = (Vec4(0, 1, 0, 1),# 0 Green + Vec4(0.5, 1, 0, 1),#1 Green-Yellow + Vec4(0.75, 1, 0, 1),#2 Yellow-Green + Vec4(1, 1, 0, 1),#3 Yellow + Vec4(1, 0.866, 0, 1),#4 Yellow-Orange + Vec4(1, 0.6, 0, 1),#5 Orange-Yellow + Vec4(1, 0.5, 0, 1),#6 Orange + Vec4(1, 0.25, 0, 1.0),#7 Red-Orange + Vec4(1, 0, 0, 1),#8 Red + Vec4(0.3, 0.3, 0.3, 1))#9 Grey + healthGlowColors = (Vec4(0.25, 1, 0.25, 0.5),#Green + Vec4(0.5, 1, 0.25, .5),#1 Green-Yellow + Vec4(0.75, 1, 0.25, .5),#2 Yellow-Green + Vec4(1, 1, 0.25, 0.5),#Yellow + Vec4(1, 0.866, 0.25, .5),#4 Yellow-Orange + Vec4(1, 0.6, 0.25, .5),#5 Orange-Yellow + Vec4(1, 0.5, 0.25, 0.5),#6 Orange + Vec4(1, 0.25, 0.25, 0.5),#7 Red-Orange + Vec4(1, 0.25, 0.25, 0.5),#8 Red + Vec4(0.3, 0.3, 0.3, 0))#9 Grey medallionColors = {'c': Vec4(0.863, 0.776, 0.769, 1.0), 's': Vec4(0.843, 0.745, 0.745, 1.0), 'l': Vec4(0.749, 0.776, 0.824, 1.0), @@ -629,22 +639,32 @@ class Suit(Avatar.Avatar): health = float(self.currHP) / float(self.maxHP) if health > 0.95: condition = 0 - elif health > 0.7: + elif health > 0.9: condition = 1 - elif health > 0.3: + elif health > 0.8: condition = 2 + elif health > 0.7: + condition = 3#Yellow + elif health > 0.6: + condition = 4 + elif health > 0.5: + condition = 5 + elif health > 0.3: + condition = 6#Orange + elif health > 0.15: + condition = 7 elif health > 0.05: - condition = 3 + condition = 8#Red elif health > 0.0: - condition = 4 + condition = 9#Blinking Red else: - condition = 5 + condition = 10 if self.healthCondition != condition or forceUpdate: - if condition == 4: + if condition == 9: blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1)) taskMgr.add(blinkTask, self.uniqueName('blink-task')) - elif condition == 5: - if self.healthCondition == 4: + elif condition == 10: + if self.healthCondition == 9: taskMgr.remove(self.uniqueName('blink-task')) blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1)) taskMgr.add(blinkTask, self.uniqueName('blink-task')) @@ -654,18 +674,20 @@ class Suit(Avatar.Avatar): self.healthCondition = condition def __blinkRed(self, task): - self.healthBar.setColor(self.healthColors[3], 1) - self.healthBarGlow.setColor(self.healthGlowColors[3], 1) - if self.healthCondition == 5: + if not self.healthBar: + return Task.done + self.healthBar.setColor(self.healthColors[8], 1) + self.healthBarGlow.setColor(self.healthGlowColors[8], 1) + if self.healthCondition == 7: self.healthBar.setScale(1.17) return Task.done def __blinkGray(self, task): if not self.healthBar: - return - self.healthBar.setColor(self.healthColors[4], 1) - self.healthBarGlow.setColor(self.healthGlowColors[4], 1) - if self.healthCondition == 5: + return Task.done + self.healthBar.setColor(self.healthColors[9], 1) + self.healthBarGlow.setColor(self.healthGlowColors[9], 1) + if self.healthCondition == 10: self.healthBar.setScale(1.0) return Task.done @@ -673,7 +695,7 @@ class Suit(Avatar.Avatar): if self.healthBar: self.healthBar.removeNode() self.healthBar = None - if self.healthCondition == 4 or self.healthCondition == 5: + if self.healthCondition == 9 or self.healthCondition == 10: taskMgr.remove(self.uniqueName('blink-task')) self.healthCondition = 0 return diff --git a/toontown/suit/SuitBase.py b/toontown/suit/SuitBase.py index a26deb37..852d76aa 100644 --- a/toontown/suit/SuitBase.py +++ b/toontown/suit/SuitBase.py @@ -29,6 +29,20 @@ class SuitBase: if hasattr(self, 'legList'): del self.legList + def getCurrHp(self): + if hasattr(self, 'currHP') and self.currHP: + return self.currHP + else: + self.notify.error('currHP is None') + return 'unknown' + + def getMaxHp(self): + if hasattr(self, 'maxHP') and self.maxHP: + return self.maxHP + else: + self.notify.error('maxHP is None') + return 'unknown' + def getStyleName(self): if hasattr(self, 'dna') and self.dna: return self.dna.name diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index ce7b0714..e92c6353 100644 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -4605,6 +4605,7 @@ MapPageYouAreAtHome = 'You are at\nyour estate' MapPageYouAreAtSomeonesHome = 'You are at %s estate' MapPageGoTo = 'Go To\n%s' OptionsPageTitle = 'Options' +MoreOptionsPageTitle = 'More Options' OptionsTabTitle = 'Options\n& Codes' OptionsPagePurchase = 'Subscribe' OptionsPageExitToontown = 'Exit Toontown' diff --git a/toontown/toonbase/TTLocalizerEnglishProperty.py b/toontown/toonbase/TTLocalizerEnglishProperty.py index 36cfcace..0b67b6b0 100644 --- a/toontown/toonbase/TTLocalizerEnglishProperty.py +++ b/toontown/toonbase/TTLocalizerEnglishProperty.py @@ -245,6 +245,7 @@ TPstartFrame = 0.12 TPendFrame = 0.12 SBpageTab = 0.75 OPoptionsTab = 0.07 +OPmoreOptionsTab = 0.06 OPCodesInstructionPanelTextPos = (0, -0.01) OPCodesInstructionPanelTextWordWrap = 6 OPCodesResultPanelTextPos = (0, 0.35) diff --git a/toontown/toonbase/ToonBase.py b/toontown/toonbase/ToonBase.py index 009cac9c..c920b797 100644 --- a/toontown/toonbase/ToonBase.py +++ b/toontown/toonbase/ToonBase.py @@ -235,6 +235,8 @@ class ToonBase(OTPBase.OTPBase): self.filters = CommonFilters(self.win, self.cam) + self.wantCogLevelGui = settings.get('want-Cog-Level-GUI', True) + def openMainWindow(self, *args, **kw): result = OTPBase.OTPBase.openMainWindow(self, *args, **kw) self.setCursorAndIcon() diff --git a/toontown/town/TownBattle.py b/toontown/town/TownBattle.py index dbc3a8d2..01368c57 100644 --- a/toontown/town/TownBattle.py +++ b/toontown/town/TownBattle.py @@ -10,6 +10,7 @@ import TownBattleSOSPanel import TownBattleSOSPetSearchPanel import TownBattleSOSPetInfoPanel import TownBattleToonPanel +import TownBattleCogPanel from toontown.toontowngui import TTDialog from direct.directnotify import DirectNotifyGlobal from toontown.battle import BattleBase @@ -129,6 +130,10 @@ class TownBattle(StateData.StateData): TownBattleToonPanel.TownBattleToonPanel(1), TownBattleToonPanel.TownBattleToonPanel(2), TownBattleToonPanel.TownBattleToonPanel(3)) + self.cogPanels = (TownBattleCogPanel.TownBattleCogPanel(0), + TownBattleCogPanel.TownBattleCogPanel(1), + TownBattleCogPanel.TownBattleCogPanel(2), + TownBattleCogPanel.TownBattleCogPanel(3)) self.timer = ToontownTimer.ToontownTimer() self.timer.posInTopRightCorner() self.timer.setScale(0.4) @@ -152,7 +157,11 @@ class TownBattle(StateData.StateData): for toonPanel in self.toonPanels: toonPanel.cleanup() + for cogPanel in self.cogPanels: + cogPanel.cleanup() + del self.toonPanels + del self.cogPanels self.timer.destroy() del self.timer del self.toons @@ -255,6 +264,40 @@ class TownBattle(StateData.StateData): self.notify.error('Bad number of toons: %s' % num) return None + def __enterCogPanels(self, num): + for cogPanel in self.cogPanels: + cogPanel.hide() + cogPanel.updateHealthBar() + cogPanel.setPos(0, 0, 0.75) + + if num == 1: + self.cogPanels[0].setX(self.oddPos[1]) + self.cogPanels[0].show() + elif num == 2: + self.cogPanels[0].setX(self.evenPos[1]) + self.cogPanels[0].show() + self.cogPanels[1].setX(self.evenPos[2]) + self.cogPanels[1].show() + elif num == 3: + self.cogPanels[0].setX(self.oddPos[0]) + self.cogPanels[0].show() + self.cogPanels[1].setX(self.oddPos[1]) + self.cogPanels[1].show() + self.cogPanels[2].setX(self.oddPos[2]) + self.cogPanels[2].show() + elif num == 4: + self.cogPanels[0].setX(self.evenPos[0]) + self.cogPanels[0].show() + self.cogPanels[1].setX(self.evenPos[1]) + self.cogPanels[1].show() + self.cogPanels[2].setX(self.evenPos[2]) + self.cogPanels[2].show() + self.cogPanels[3].setX(self.evenPos[3]) + self.cogPanels[3].show() + else: + self.notify.error('Bad number of toons: %s' % num) + return None + def updateChosenAttacks(self, battleIndices, tracks, levels, targets): self.notify.debug('updateChosenAttacks bi=%s tracks=%s levels=%s targets=%s' % (battleIndices, tracks, @@ -310,6 +353,9 @@ class TownBattle(StateData.StateData): for toonPanel in self.toonPanels: toonPanel.hide() + for cogPanel in self.cogPanels: + cogPanel.hide() + self.toonAttacks = [(-1, 0, 0), (-1, 0, 0), (-1, 0, 0), @@ -322,6 +368,8 @@ class TownBattle(StateData.StateData): def exitOff(self): if self.isLoaded: self.__enterPanels(self.numToons, self.localNum) + if base.wantCogLevelGui: + self.__enterCogPanels(self.numCogs) self.timer.show() self.track = -1 self.level = -1 @@ -442,8 +490,16 @@ class TownBattle(StateData.StateData): cogFireCostIndex += 1 creditLevel = maxSuitLevel + resetActivateMode = 0 if numCogs == self.numCogs and creditLevel == self.creditLevel and luredIndices == self.luredIndices and trappedIndices == self.trappedIndices and toonIds == self.toons: - resetActivateMode = 0 + for i in xrange(len(cogs)): + if cogs[i].getHP() == self.cogPanels[i].getDisplayedCurrHp(): + if cogs[i].getMaxHP() == self.cogPanels[i].getDisplayedMaxHp(): + if cogs[i] == self.cogPanels[i].getSuit(): + continue + else: + resetActivateMode = 1 + break else: resetActivateMode = 1 self.notify.debug('adjustCogsAndToons() resetActivateMode: %s' % resetActivateMode) @@ -460,6 +516,11 @@ class TownBattle(StateData.StateData): for i in xrange(len(toons)): self.toonPanels[i].setLaffMeter(toons[i]) + if base.wantCogLevelGui: + self.__enterCogPanels(self.numCogs) + for i in xrange(len(cogs)): + self.cogPanels[i].setSuit(cogs[i]) + if currStateName == 'ChooseCog': self.chooseCogPanel.adjustCogs(self.numCogs, self.luredIndices, self.trappedIndices, self.track) elif currStateName == 'ChooseToon': diff --git a/toontown/town/TownBattleCogPanel.py b/toontown/town/TownBattleCogPanel.py new file mode 100644 index 00000000..213243ad --- /dev/null +++ b/toontown/town/TownBattleCogPanel.py @@ -0,0 +1,213 @@ +from pandac.PandaModules import * +from toontown.battle import BattleProps +from toontown.toonbase import ToontownGlobals +from toontown.toonbase.ToontownBattleGlobals import * +from direct.directnotify import DirectNotifyGlobal +import string +from toontown.suit import Suit +from direct.gui.DirectGui import * +from pandac.PandaModules import * +from toontown.toonbase import TTLocalizer +from direct.task.Task import Task + +class TownBattleCogPanel(DirectFrame): + notify = DirectNotifyGlobal.directNotify.newCategory('TownBattleCogPanel') + healthColors = (Vec4(0, 1, 0, 1),# 0 Green + Vec4(0.5, 1, 0, 1),#1 Green-Yellow + Vec4(0.75, 1, 0, 1),#2 Yellow-Green + Vec4(1, 1, 0, 1),#3 Yellow + Vec4(1, 0.866, 0, 1),#4 Yellow-Orange + Vec4(1, 0.6, 0, 1),#5 Orange-Yellow + Vec4(1, 0.5, 0, 1),#6 Orange + Vec4(1, 0.25, 0, 1.0),#7 Red-Orange + Vec4(1, 0, 0, 1),#8 Red + Vec4(0.3, 0.3, 0.3, 1))#9 Grey + healthGlowColors = (Vec4(0.25, 1, 0.25, 0.5),#Green + Vec4(0.5, 1, 0.25, .5),#1 Green-Yellow + Vec4(0.75, 1, 0.25, .5),#2 Yellow-Green + Vec4(1, 1, 0.25, 0.5),#Yellow + Vec4(1, 0.866, 0.25, .5),#4 Yellow-Orange + Vec4(1, 0.6, 0.25, .5),#5 Orange-Yellow + Vec4(1, 0.5, 0.25, 0.5),#6 Orange + Vec4(1, 0.25, 0.25, 0.5),#7 Red-Orange + Vec4(1, 0.25, 0.25, 0.5),#8 Red + Vec4(0.3, 0.3, 0.3, 0))#9 Grey + + def __init__(self, id): + gui = loader.loadModel('phase_3.5/models/gui/battle_gui') + DirectFrame.__init__(self, relief=None, image=gui.find('**/ToonBtl_Status_BG'), image_color=Vec4(0.5, 0.5, 0.5, 0.7)) + self.setScale(0.8) + self.initialiseoptions(TownBattleCogPanel) + self.levelText = DirectLabel(parent=self, text='', pos=(-0.06, 0, -0.075), text_scale=0.055) + self.healthBar = None + self.healthBarGlow = None + self.hpChangeEvent = None + self.blinkTask = None + self.suit = None + self.head = None + self.maxHP = None + self.currHP = None + self.hpChangeEvent = None + self.generateHealthBar() + self.hide() + gui.removeNode() + return + + def setSuit(self, suit): + if self.suit == suit: + messenger.send(self.suit.uniqueName('hpChange')) + return + self.suit = suit + self.setLevelText(self.suit.getActualLevel()) + if self.head: + self.head.removeNode() + self.setSuitHead(self.suit.getStyleName()) + self.setMaxHp(self.suit.getMaxHP()) + self.setHp(self.suit.getHP()) + self.hpChangeEvent = self.suit.uniqueName('hpChange') + if self.blinkTask: + taskMgr.remove(self.blinkTask) + self.blinkTask = None + self.accept(self.hpChangeEvent, self.updateHealthBar) + self.updateHealthBar() + self.healthBar.show() + + def getSuit(self, suit): + return self.suit + + def setLevelText(self, level): + self.levelText['text'] = 'Level '+ str(level) + + def setSuitHead(self, suitName): + self.head = Suit.attachSuitHead(self, suitName) + self.head.setX(0.1) + self.head.setZ(0.01) + + def generateHealthBar(self): + model = loader.loadModel('phase_3.5/models/gui/matching_game_gui') + button = model.find('**/minnieCircle') + model.removeNode() + button.setScale(0.5) + button.setH(180.0) + button.setColor(self.healthColors[0]) + button.reparentTo(self) + button.setX(-0.08) + button.setZ(0.02) + self.healthBar = button + glow = BattleProps.globalPropPool.getProp('glow') + glow.reparentTo(self.healthBar) + glow.setScale(0.28) + glow.setPos(-0.005, 0.01, 0.015) + glow.setColor(self.healthGlowColors[0]) + button.flattenLight() + self.healthBarGlow = glow + self.healthBar.hide() + self.healthCondition = 0 + + def updateHealthBar(self): + if not self.suit: + return + self.setHp(self.suit.getHP()) + health = float(self.currHP) / float(self.maxHP) + if health > 0.95: + condition = 0 + elif health > 0.9: + condition = 1 + elif health > 0.8: + condition = 2 + elif health > 0.7: + condition = 3#Yellow + elif health > 0.6: + condition = 4 + elif health > 0.5: + condition = 5 + elif health > 0.3: + condition = 6#Orange + elif health > 0.15: + condition = 7 + elif health > 0.05: + condition = 8#Red + elif health > 0.0: + condition = 9#Blinking Red + else: + condition = 10 + if self.healthCondition != condition: + if condition == 9: + self.blinkTask = self.uniqueName('blink-task') + blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1)) + taskMgr.add(blinkTask, self.blinkTask) + elif condition == 10: + if self.healthCondition == 9: + self.blinkTask = self.uniqueName('blink-task') + taskMgr.remove(self.blinkTask) + self.blinkTask = None + blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.25), Task(self.__blinkGray), Task.pause(0.1)) + taskMgr.add(blinkTask, self.blinkTask) + else: + if self.blinkTask: + taskMgr.remove(self.blinkTask) + self.blinkTask = None + self.healthBar.setColor(self.healthColors[condition], 1) + self.healthBarGlow.setColor(self.healthGlowColors[condition], 1) + self.healthCondition = condition + + def __blinkRed(self, task): + if not self.blinkTask or not self.healthBar: + return Task.done + self.healthBar.setColor(self.healthColors[8], 1) + self.healthBarGlow.setColor(self.healthGlowColors[8], 1) + if self.healthCondition == 7: + self.healthBar.setScale(1.17) + return Task.done + + def __blinkGray(self, task): + if not self.blinkTask or not self.healthBar: + return Task.done + self.healthBar.setColor(self.healthColors[9], 1) + self.healthBarGlow.setColor(self.healthGlowColors[9], 1) + if self.healthCondition == 10: + self.healthBar.setScale(1.0) + return Task.done + + def removeHealthBar(self): + if self.healthCondition == 9 or self.healthCondition == 10: + if self.blinkTask: + taskMgr.remove(self.blinkTask) + self.blinkTask = None + if self.healthBar: + self.healthBar.removeNode() + self.healthBar = None + self.healthCondition = 0 + return + + def getDisplayedCurrHp(self): + return self.currHP + + def getDisplayedMaxHp(self): + return self.maxHP + + def setMaxHp(self, hp): + self.maxHP = hp + + def setHp(self, hp): + self.currHP = hp + + def show(self): + DirectFrame.show(self) + + def cleanup(self): + self.ignoreAll() + self.removeHealthBar() + if self.head is not None: + self.head.removeNode() + del self.head + self.levelText.destroy() + del self.levelText + del self.healthBar + if self.healthBarGlow is not None: + self.healthBarGlow.removeNode() + del self.healthBarGlow + del self.suit + del self.maxHP + del self.currHP + DirectFrame.destroy(self) From 4e50e8a485cbbc3472810141e4d7c9ba12fe8429 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 16:55:15 -0400 Subject: [PATCH 20/21] Improved scale of cog heads in Level Gui. --- toontown/town/TownBattleCogPanel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/toontown/town/TownBattleCogPanel.py b/toontown/town/TownBattleCogPanel.py index 213243ad..dab9ffda 100644 --- a/toontown/town/TownBattleCogPanel.py +++ b/toontown/town/TownBattleCogPanel.py @@ -82,6 +82,7 @@ class TownBattleCogPanel(DirectFrame): self.head = Suit.attachSuitHead(self, suitName) self.head.setX(0.1) self.head.setZ(0.01) + self.head.setScale(0.087) def generateHealthBar(self): model = loader.loadModel('phase_3.5/models/gui/matching_game_gui') From 47361ccb0492fcc42350eb0ce55993fa4fda9929 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sun, 29 Mar 2015 18:16:26 -0400 Subject: [PATCH 21/21] Some pet stuff. --- toontown/friends/TTUFriendsManagerUD.py | 2 +- toontown/pets/DistributedPetAI.py | 6 ++++ toontown/pets/DistributedPetProxyAI.py | 1 + toontown/pets/Pet.py | 4 +-- toontown/pets/PetAvatarPanel.py | 2 ++ toontown/pets/PetConstants.py | 3 +- toontown/pets/PetDCImportsAI.py | 1 - toontown/pets/PetDNA.py | 30 ++++++++++++-------- toontown/pets/PetLookerAI.py | 10 +++---- toontown/pets/PetManagerAI.py | 26 ++++++++--------- toontown/pets/PetMoverAI.py | 28 +++++++++++++------ toontown/pets/PetTraits.py | 9 ++++-- toontown/pets/PetUtil.py | 8 ++++-- toontown/pets/PetshopGUI.py | 37 ++++++++++++++++--------- 14 files changed, 105 insertions(+), 62 deletions(-) diff --git a/toontown/friends/TTUFriendsManagerUD.py b/toontown/friends/TTUFriendsManagerUD.py index 4bc68240..168458ab 100644 --- a/toontown/friends/TTUFriendsManagerUD.py +++ b/toontown/friends/TTUFriendsManagerUD.py @@ -261,7 +261,7 @@ class TTUFriendsManagerUD(DistributedObjectGlobalUD): def getPetDetails(self, avId): senderId = self.air.getAvatarIdFromSender() def handlePet(dclass, fields): - if dclass != self.air.dclassesByName['DistributedPetUD']: + 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")] diff --git a/toontown/pets/DistributedPetAI.py b/toontown/pets/DistributedPetAI.py index 8a848a70..06301364 100644 --- a/toontown/pets/DistributedPetAI.py +++ b/toontown/pets/DistributedPetAI.py @@ -956,6 +956,9 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke self.__petMovieStart(avId) def enableLockMover(self): + if not hasattr(self, 'brain'): + return + if self.lockMoverEnabled == 0: self.brain._startMovie() self.lockMoverEnabled += 1 @@ -964,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: diff --git a/toontown/pets/DistributedPetProxyAI.py b/toontown/pets/DistributedPetProxyAI.py index ae83e489..1b9f91b9 100644 --- a/toontown/pets/DistributedPetProxyAI.py +++ b/toontown/pets/DistributedPetProxyAI.py @@ -356,6 +356,7 @@ class DistributedPetProxyAI(DistributedObjectAI.DistributedObjectAI): def generate(self): DistributedObjectAI.DistributedObjectAI.generate(self) self.traits = PetTraits.PetTraits(self.traitSeed, self.safeZone) + print self.traits.traits for i in xrange(len(self.traitList)): value = self.traitList[i] if value == 0.0: diff --git a/toontown/pets/Pet.py b/toontown/pets/Pet.py index d37d14f2..7f5c9498 100644 --- a/toontown/pets/Pet.py +++ b/toontown/pets/Pet.py @@ -9,7 +9,6 @@ from direct.actor import Actor from direct.task import Task from toontown.pets import PetDNA from PetDNA import HeadParts, EarParts, NoseParts, TailParts, BodyTypes, BodyTextures, AllPetColors, getColors, ColorScales, PetEyeColors, EarTextures, TailTextures, getFootTexture, getEarTexture, GiraffeTail, LeopardTail, PetGenders -from toontown.toonbase.BitmaskGlobals import PieBitmask from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from direct.showbase import PythonUtil @@ -30,7 +29,6 @@ Component2IconDict = {'boredom': 'Bored', from toontown.nametag import * from toontown.nametag.NametagGlobals import * -from toontown.nametag.NametagGroup import * class Pet(Avatar.Avatar): notify = DirectNotifyGlobal.directNotify.newCategory('Pet') @@ -268,7 +266,7 @@ class Pet(Avatar.Avatar): def initializeBodyCollisions(self, collIdStr): Avatar.Avatar.initializeBodyCollisions(self, collIdStr) if not self.ghostMode: - self.collNode.setCollideMask(self.collNode.getIntoCollideMask() | PieBitmask) + self.collNode.setCollideMask(self.collNode.getIntoCollideMask() | ToontownGlobals.PieBitmask) def amplifyColor(self, color, scale): color = color * scale diff --git a/toontown/pets/PetAvatarPanel.py b/toontown/pets/PetAvatarPanel.py index 0792e893..19e985a3 100644 --- a/toontown/pets/PetAvatarPanel.py +++ b/toontown/pets/PetAvatarPanel.py @@ -273,6 +273,8 @@ class PetAvatarPanel(AvatarPanel.AvatarPanel): self.notify.debug('__fillPetInfo(): doId=%s' % avatar.doId) self.petView = self.frame.attachNewNode('petView') self.petView.setPos(0, 0, 5.4) + if hasattr(avatar, 'announceGenerate'): + avatar.announceGenerate() self.petModel = Pet.Pet(forGui=1) self.petModel.setDNA(avatar.getDNA()) self.petModel.fitAndCenterHead(3.575, forGui=1) diff --git a/toontown/pets/PetConstants.py b/toontown/pets/PetConstants.py index 72c4c9e2..02480b7c 100644 --- a/toontown/pets/PetConstants.py +++ b/toontown/pets/PetConstants.py @@ -58,4 +58,5 @@ ZoneToCostRange = {ToontownGlobals.ToontownCentral: (100, 500), ToontownGlobals.DaisyGardens: (1000, 2500), ToontownGlobals.MinniesMelodyland: (1500, 3000), ToontownGlobals.TheBrrrgh: (2500, 4000), - ToontownGlobals.DonaldsDreamland: (3000, 5000)} + ToontownGlobals.DonaldsDreamland: (3000, 5000), + ToontownGlobals.FunnyFarm: (3700, 5800)} diff --git a/toontown/pets/PetDCImportsAI.py b/toontown/pets/PetDCImportsAI.py index 1c92bbeb..fb2b5c86 100644 --- a/toontown/pets/PetDCImportsAI.py +++ b/toontown/pets/PetDCImportsAI.py @@ -1,3 +1,2 @@ if hasattr(simbase, 'wantPets') and simbase.wantPets: import DistributedPetAI - import DistributedPetUD diff --git a/toontown/pets/PetDNA.py b/toontown/pets/PetDNA.py index 46be0712..0983e579 100644 --- a/toontown/pets/PetDNA.py +++ b/toontown/pets/PetDNA.py @@ -2,7 +2,6 @@ from toontown.toon import ToonDNA from pandac.PandaModules import VBase4 from toontown.toonbase import TTLocalizer, ToontownGlobals from direct.showbase import PythonUtil -import random NumFields = 9 Fields = {'head': 0, 'ears': 1, @@ -85,7 +84,14 @@ PetRarities = {'body': {ToontownGlobals.ToontownCentral: {'threeStripe': 50, 'tigerStripe': 20, 'turtle': 25, 'giraffe': 20, - 'leopard': 10}}} + 'leopard': 10}, + ToontownGlobals.FunnyFarm: {'leopard': 20, + 'giraffe': 20, + 'dots': 10, + 'tigerStripe': 25, + 'turtle': 25} + + }} BodyTextures = {'dots': 'phase_4/maps/BeanbodyDots6.jpg', 'threeStripe': 'phase_4/maps/Beanbody3stripes6.jpg', 'tigerStripe': 'phase_4/maps/BeanbodyZebraStripes6.jpg', @@ -180,17 +186,17 @@ PetEyeColors = (VBase4(0.29, 0.29, 0.69, 1.0), VBase4(0.49, 0.99, 0.49, 1.0)) PetGenders = [0, 1] -def getRandomPetDNA(seed = 0, zoneId = ToontownGlobals.DonaldsDreamland): - random.seed(seed + zoneId) - head = random.choice(range(-1, len(HeadParts))) - ears = random.choice(range(-1, len(EarParts))) - nose = random.choice(range(-1, len(NoseParts))) - tail = random.choice(range(-1, len(TailParts))) +def getRandomPetDNA(zoneId = ToontownGlobals.DonaldsDreamland): + from random import choice + head = choice(range(-1, len(HeadParts))) + ears = choice(range(-1, len(EarParts))) + nose = choice(range(-1, len(NoseParts))) + tail = choice(range(-1, len(TailParts))) body = getSpecies(zoneId) - color = random.choice(range(0, len(getColors(body)))) - colorScale = random.choice(range(0, len(ColorScales))) - eyes = random.choice(range(0, len(PetEyeColors))) - gender = random.choice(range(0, len(PetGenders))) + color = choice(range(0, len(getColors(body)))) + colorScale = choice(range(0, len(ColorScales))) + eyes = choice(range(0, len(PetEyeColors))) + gender = choice(range(0, len(PetGenders))) return [head, ears, nose, diff --git a/toontown/pets/PetLookerAI.py b/toontown/pets/PetLookerAI.py index b9bede67..6cbdd42d 100644 --- a/toontown/pets/PetLookerAI.py +++ b/toontown/pets/PetLookerAI.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal from direct.showbase import DirectObject from otp.ai.AIZoneData import AIZoneData -from toontown.toonbase.BitmaskGlobals import PetLookatPetBitmask, PetLookatNonPetBitmask +from toontown.toonbase import ToontownGlobals from toontown.pets import PetConstants def getStartLookingAtOtherEvent(lookingAvId): @@ -83,11 +83,11 @@ class PetLookerAI: lookSphereNode.addSolid(lookSphere) lookSphereNode.setFromCollideMask(BitMask32.allOff()) if isPet: - intoCollideMask = PetLookatPetBitmask - fromCollideMask = PetLookatPetBitmask | PetLookatNonPetBitmask + intoCollideMask = ToontownGlobals.PetLookatPetBitmask + fromCollideMask = ToontownGlobals.PetLookatPetBitmask | ToontownGlobals.PetLookatNonPetBitmask else: - intoCollideMask = PetLookatNonPetBitmask - fromCollideMask = PetLookatPetBitmask + intoCollideMask = ToontownGlobals.PetLookatNonPetBitmask + fromCollideMask = ToontownGlobals.PetLookatPetBitmask lookSphereNode.setIntoCollideMask(intoCollideMask) lookSphereNode.setFromCollideMask(fromCollideMask) self.lookSphereNodePath = self.__collNode.attachNewNode(lookSphereNode) diff --git a/toontown/pets/PetManagerAI.py b/toontown/pets/PetManagerAI.py index da991ce3..96b30aad 100644 --- a/toontown/pets/PetManagerAI.py +++ b/toontown/pets/PetManagerAI.py @@ -1,10 +1,7 @@ -from direct.directnotify import DirectNotifyGlobal from direct.fsm.FSM import FSM import PetUtil, PetDNA -from toontown.hood import ZoneUtil -from toontown.building import PetshopBuildingAI -from toontown.toonbase import ToontownGlobals, TTLocalizer -import random +from toontown.toonbase import ToontownGlobals +from toontown.toonbase import TTLocalizer import cPickle, time, random, os MINUTE = 60 @@ -15,8 +12,9 @@ def getDayId(): return int(time.time() // DAY) class PetManagerAI: - NUM_DAILY_PETS = 5 + NUM_DAILY_PETS = 5 # per hood cachePath = config.GetString('air-pet-cache', 'astron/databases/air_cache/') + def __init__(self, air): self.air = air self.cacheFile = '%spets_%d.pets' % (self.cachePath, self.air.districtId) @@ -29,28 +27,28 @@ class PetManagerAI: self.generateSeeds() else: - self.generateSeeds() - + self.generateSeeds() + def generateSeeds(self): seeds = range(0, 255) random.shuffle(seeds) self.seeds = {} for hood in (ToontownGlobals.ToontownCentral, ToontownGlobals.DonaldsDock, ToontownGlobals.DaisyGardens, - ToontownGlobals.MinniesMelodyland, ToontownGlobals.TheBrrrgh, ToontownGlobals.DonaldsDreamland): + ToontownGlobals.MinniesMelodyland, ToontownGlobals.TheBrrrgh, ToontownGlobals.DonaldsDreamland, + ToontownGlobals.FunnyFarm): self.seeds[hood] = [seeds.pop() for _ in xrange(self.NUM_DAILY_PETS)] self.seeds['day'] = getDayId() with open(self.cacheFile, 'wb') as f: - f.write(cPickle.dumps(self.seeds)) + f.write(cPickle.dumps(self.seeds)) - def getAvailablePets(self, seed, safezoneId): if self.seeds.get('day', -1) != getDayId(): self.generateSeeds() - return self.seeds.get(safezoneId, [seed]) + return list(set(self.seeds.get(safezoneId, [seed]))) def createNewPetFromSeed(self, avId, seed, nameIndex, gender, safeZoneId): av = self.air.doId2do[avId] @@ -83,4 +81,6 @@ class PetManagerAI: if pet in self.air.doId2do: self.air.doId2do[pet].requestDelete() - av.b_setPetId(0) \ No newline at end of file + av.b_setPetId(0) + # XXX to do: check for current pet and destroy it if generated + diff --git a/toontown/pets/PetMoverAI.py b/toontown/pets/PetMoverAI.py index f0502e51..b5a2066f 100644 --- a/toontown/pets/PetMoverAI.py +++ b/toontown/pets/PetMoverAI.py @@ -9,6 +9,8 @@ estateCenter = (0, -40) houseRadius = 15 houses = ((60, 10), (42, 75), (-37, 35), (80, -80), (-70, -120), (-55, -40)) +dist = 2 + def inCircle(x, y, c=estateCenter, r=estateRadius): center_x, center_y = c square_dist = (center_x - x) ** 2 + (center_y - y) ** 2 @@ -77,6 +79,15 @@ def generatePath(start, end): if not houseCollision(next, end): points.append(end) return points + +def angle(A, B): + ax = A.getX() + ay = A.getY() + + bx = B.getX() + by = B.getY() + + return math.atan2(by-ay, bx-ax) class PetMoverAI(FSM): def __init__(self, pet): @@ -96,10 +107,7 @@ class PetMoverAI(FSM): taskMgr.remove(self.pet.uniqueName('next-state')) def __moveFromStill(self, task=None): - choices = ["Wander"] - # if self.pet._getNearbyAvatarDict(): - # choices.append("Chase") - + choices = ["Wander"] nextState = random.choice(choices) self.request(nextState) @@ -113,9 +121,9 @@ class PetMoverAI(FSM): def walkToPoint(self, target): here = self.pet.getPos() - dist = Vec3((here - target)).length() - dist = dist * 0.9 - self.__seq = Sequence(Func(self.pet.lookAt, target), self.pet.posInterval(dist / self.fwdSpeed, target, here), + dist = Vec3(here - target).length() + + self.__seq = Sequence(Func(self.pet.lookAt, target), Func(self.pet.setP, 0), self.pet.posInterval(dist / self.fwdSpeed, target, here), Func(self.__stateComplete)) self.__seq.start() @@ -156,8 +164,12 @@ class PetMoverAI(FSM): target = hidden.attachNewNode('target') target.setPos(self.getPoint()) - self.walkToPoint(target.getPos()) + pos = target.getPos() + theta = angle(self.pet.getPos(), pos) * (math.pi / 180) + dx = dist * math.cos(theta) + dy = dist * math.sin(theta) + self.walkToPoint(Point3(pos.getX() - dx, pos.getY() - dy, pos.getZ())) def exitChase(self): if self.__chaseCallback: diff --git a/toontown/pets/PetTraits.py b/toontown/pets/PetTraits.py index 538b1ecf..1ce07ef4 100644 --- a/toontown/pets/PetTraits.py +++ b/toontown/pets/PetTraits.py @@ -120,7 +120,8 @@ class PetTraits: ToontownGlobals.DaisyGardens: (0.4, 0.75), ToontownGlobals.MinniesMelodyland: (0.5, 0.8), ToontownGlobals.TheBrrrgh: (0.6, 0.85), - ToontownGlobals.DonaldsDreamland: (0.7, 0.9)} + ToontownGlobals.DonaldsDreamland: (0.7, 0.9), + ToontownGlobals.FunnyFarm: (0.8, 0.9)} class StdDecDistrib(TraitDistribution): TraitType = TraitDistribution.TraitTypes.DECREASING @@ -129,7 +130,8 @@ class PetTraits: ToontownGlobals.DaisyGardens: (0.25, 0.6), ToontownGlobals.MinniesMelodyland: (0.2, 0.5), ToontownGlobals.TheBrrrgh: (0.15, 0.4), - ToontownGlobals.DonaldsDreamland: (0.1, 0.3)} + ToontownGlobals.DonaldsDreamland: (0.1, 0.3), + ToontownGlobals.FunnyFarm: (0.05, 0.2)} class ForgetfulnessDistrib(TraitDistribution): TraitType = TraitDistribution.TraitTypes.DECREASING @@ -138,7 +140,8 @@ class PetTraits: ToontownGlobals.DaisyGardens: (0.0, 0.8), ToontownGlobals.MinniesMelodyland: (0.0, 0.7), ToontownGlobals.TheBrrrgh: (0.0, 0.6), - ToontownGlobals.DonaldsDreamland: (0.0, 0.5)} + ToontownGlobals.DonaldsDreamland: (0.0, 0.5), + ToontownGlobals.FunnyFarm: (0.0, 0.4)} TraitDescs = (('forgetfulness', ForgetfulnessDistrib(), True), ('boredomThreshold', StdIncDistrib(), True), diff --git a/toontown/pets/PetUtil.py b/toontown/pets/PetUtil.py index 454482c9..254387a0 100644 --- a/toontown/pets/PetUtil.py +++ b/toontown/pets/PetUtil.py @@ -1,12 +1,16 @@ from toontown.pets import PetDNA, PetTraits, PetConstants -from toontown.toonbase import TTLocalizer from direct.showbase import PythonUtil +from toontown.toonbase import TTLocalizer +import random def getPetInfoFromSeed(seed, safezoneId): - dnaArray = PetDNA.getRandomPetDNA(seed, safezoneId) + S = random.getstate() + random.seed(seed) + dnaArray = PetDNA.getRandomPetDNA(safezoneId) gender = PetDNA.getGender(dnaArray) nameString = TTLocalizer.getRandomPetName(gender=gender, seed=seed) traitSeed = PythonUtil.randUint31() + random.setstate(S) return (nameString, dnaArray, traitSeed) diff --git a/toontown/pets/PetshopGUI.py b/toontown/pets/PetshopGUI.py index b9360b4e..d1bd11d9 100644 --- a/toontown/pets/PetshopGUI.py +++ b/toontown/pets/PetshopGUI.py @@ -1,22 +1,23 @@ -from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * -from direct.showbase.DirectObject import DirectObject from pandac.PandaModules import * -import random -import string - +from direct.directnotify import DirectNotifyGlobal +from direct.showbase.DirectObject import DirectObject +from toontown.toonbase import ToontownGlobals +from toontown.toonbase import TTLocalizer +from toontown.toonbase import ToontownTimer +from direct.task import Task +from otp.namepanel import NameTumbler +from otp.otpbase import OTPGlobals +from otp.otpbase import OTPLocalizer from toontown.fishing import FishSellGUI -from toontown.hood import ZoneUtil from toontown.pets import Pet, PetConstants from toontown.pets import PetDNA +from toontown.pets import PetUtil from toontown.pets import PetDetail from toontown.pets import PetTraits -from toontown.pets import PetUtil -from toontown.toonbase import TTLocalizer -from toontown.toonbase import ToontownGlobals -from toontown.toonbase import ToontownTimer - - +from toontown.hood import ZoneUtil +import string +import random Dialog_MainMenu = 0 Dialog_AdoptPet = 1 Dialog_ChoosePet = 2 @@ -46,6 +47,7 @@ class PetshopGUI(DirectObject): self.bNo = DirectButton(self, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), relief=None, text=TTLocalizer.TutorialNo, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.15, 0.0, -0.1), command=lambda : messenger.send(doneEvent, [0])) buttons.removeNode() gui.removeNode() + return class NamePicker(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('PetshopGUI.NamePicker') @@ -91,6 +93,7 @@ class PetshopGUI(DirectObject): cancelIcon = model.find('**/CancelIcon') self.cancelButton = DirectButton(parent=self, relief=None, pos=(-0.04, 0, -0.47), image=cancelImageList, geom=cancelIcon, scale=modelScale, pressEffect=False, command=lambda : messenger.send(doneEvent, [-1])) self.randomName() + return def destroy(self): self.petModel.delete() @@ -192,6 +195,7 @@ class PetshopGUI(DirectObject): if not base.localAvatar.hasPet(): self.returnPetButton['state'] = DGG.DISABLED model.removeNode() + return class AdoptPetDlg(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('PetshopGUI.AdoptPetDlg') @@ -224,6 +228,7 @@ class PetshopGUI(DirectObject): self.cancelButton = DirectButton(parent=self, relief=None, image=cancelImageList, geom=cancelIcon, scale=modelScale, text=('', TTLocalizer.PetshopGoBack), text_pos=(-5.8, 4.4), text_scale=0.7, pressEffect=False, command=lambda : messenger.send(doneEvent, [0])) self.okButton = DirectButton(parent=self, relief=None, image=okImageList, geom=checkIcon, scale=modelScale, text=('', TTLocalizer.PetshopAdopt), text_pos=(5.8, 4.4), text_scale=0.7, pressEffect=False, command=lambda : messenger.send(doneEvent, [1])) model.removeNode() + return def destroy(self): self.ignore(localAvatar.uniqueName('moneyChange')) @@ -276,6 +281,7 @@ class PetshopGUI(DirectObject): self.PetPanel = None self.petModel.delete() DirectFrame.destroy(self) + return class ChoosePetDlg(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('PetshopGUI.ChoosePetDlg') @@ -309,6 +315,7 @@ class PetshopGUI(DirectObject): self.petSeeds = petSeeds self.makePetList() self.showPet() + return def makePetList(self): self.numPets = len(self.petSeeds) @@ -317,7 +324,7 @@ class PetshopGUI(DirectObject): self.petName = [] self.petDesc = [] self.petCost = [] - for i in xrange(self.numPets): + for i in range(self.numPets): random.seed(self.petSeeds[i]) zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId()) name, dna, traitSeed = PetUtil.getPetInfoFromSeed(self.petSeeds[i], zoneId) @@ -372,6 +379,7 @@ class PetshopGUI(DirectObject): self.okButton['state'] = DGG.DISABLED else: self.okButton['state'] = DGG.NORMAL + return def __moneyChange(self, money): self.moneyDisplay['text'] = str(base.localAvatar.getTotalMoney()) @@ -393,6 +401,7 @@ class PetshopGUI(DirectObject): self.timer.posInTopRightCorner() self.timer.countdown(PetConstants.PETCLERK_TIMER, self.__timerExpired) self.doDialog(Dialog_MainMenu) + return def __timerExpired(self): messenger.send(self.eventDict['guiDone'], [True]) @@ -413,6 +422,7 @@ class PetshopGUI(DirectObject): if self.dialog != None: self.dialog.destroy() self.dialog = None + return def popDialog(self): self.dialogStack.pop() @@ -495,6 +505,7 @@ class PetshopGUI(DirectObject): self.notify.warning('Tried to go home, but place is None.') return place.goHomeNow(base.localAvatar.lastHood) + return def __handleReturnPetDlg(self, exitVal): if exitVal == 0: