Added track shop in makeatoon - still have to make it give the player gags by default.

This commit is contained in:
Daniel 2015-03-23 00:44:12 +02:00
parent 6ed9a8b04e
commit aa5fee87dc
14 changed files with 209 additions and 69 deletions

View file

@ -3676,7 +3676,7 @@ dclass ClientServicesManager : DistributedObjectGlobal {
requestAvatars() clsend;
setAvatars(PotentialToon[]);
createAvatar(blob dna, uint8 index) clsend;
createAvatar(blob dna, uint8 thirdTrack, uint8 index) clsend;
createAvatarResp(uint32 avId);
setNameTyped(uint32 avId, string name) clsend;

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import *
hashVal = 924483511
hashVal = 930195805
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

View file

@ -20,7 +20,7 @@ class BodyShop(StateData.StateData):
self.speciesChoice = 0
return
def enter(self, toon, shopsVisited = []):
def enter(self, toon):
base.disableMouse()
self.toon = toon
self.dna = self.toon.getStyle()
@ -33,11 +33,6 @@ class BodyShop(StateData.StateData):
self.torsoChoice = ToonDNA.toonTorsoTypes.index(self.dna.torso) % 3
self.legStart = 0
self.legChoice = ToonDNA.toonLegTypes.index(self.dna.legs)
if CLOTHESSHOP in shopsVisited:
self.clothesPicked = 1
else:
self.clothesPicked = 0
self.clothesPicked = 1
if gender == 'm' or ToonDNA.GirlBottoms[self.dna.botTex][1] == ToonDNA.SHORTS:
torsoStyle = 's'
torsoPool = ToonDNA.toonTorsoTypes[:3]
@ -168,10 +163,7 @@ class BodyShop(StateData.StateData):
def __swapTorso(self, offset):
gender = self.toon.style.getGender()
if not self.clothesPicked:
length = len(ToonDNA.toonTorsoTypes[6:])
torsoOffset = 6
elif gender == 'm':
if gender == 'm':
length = len(ToonDNA.toonTorsoTypes[:3])
torsoOffset = 0
if self.dna.armColor not in ToonDNA.defaultBoyColorList:

View file

@ -26,7 +26,7 @@ class ColorShop(StateData.StateData):
return colorList
def enter(self, toon, shopsVisited = []):
def enter(self, toon):
base.disableMouse()
self.toon = toon
self.dna = toon.getStyle()

View file

@ -14,7 +14,6 @@ class GenderShop(StateData.StateData):
def __init__(self, makeAToon, doneEvent):
StateData.StateData.__init__(self, doneEvent)
self.shopsVisited = []
self.toon = None
self.gender = 'm'
self.makeAToon = makeAToon

View file

@ -7,14 +7,8 @@ from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import *
from direct.task import Task
from pandac.PandaModules import *
import random
import BodyShop
import ColorShop
import GenderShop
import random, BodyShop, ColorShop, GenderShop, MakeClothesGUI, TrackShop, NameShop
from MakeAToonGlobals import *
import MakeClothesGUI
import NameShop
from otp.avatar import Avatar
from toontown.char import Char
from toontown.char import CharDNA
@ -50,6 +44,7 @@ class MakeAToon(StateData.StateData):
self.slide = 0
self.nameList = []
self.warp = 0
self.visitedGenderShop = 0
for av in avList:
if av.position == index:
self.warp = 1
@ -60,8 +55,9 @@ class MakeAToon(StateData.StateData):
State.State('GenderShop', self.enterGenderShop, self.exitGenderShop, ['BodyShop']),
State.State('BodyShop', self.enterBodyShop, self.exitBodyShop, ['GenderShop', 'ColorShop']),
State.State('ColorShop', self.enterColorShop, self.exitColorShop, ['BodyShop', 'ClothesShop']),
State.State('ClothesShop', self.enterClothesShop, self.exitClothesShop, ['ColorShop', 'NameShop']),
State.State('NameShop', self.enterNameShop, self.exitNameShop, ['ClothesShop']),
State.State('ClothesShop', self.enterClothesShop, self.exitClothesShop, ['ColorShop', 'TrackShop']),
State.State('TrackShop', self.enterTrackShop, self.exitTrackShop, ['ClothesShop', 'NameShop']),
State.State('NameShop', self.enterNameShop, self.exitNameShop, ['TrackShop']),
State.State('Done', self.enterDone, self.exitDone, [])], 'Init', 'Done')
self.parentFSM = parentFSM
self.parentFSM.getStateNamed('createAvatar').addChild(self.fsm)
@ -69,14 +65,9 @@ class MakeAToon(StateData.StateData):
self.bs = BodyShop.BodyShop('BodyShop-done')
self.cos = ColorShop.ColorShop('ColorShop-done')
self.cls = MakeClothesGUI.MakeClothesGUI('ClothesShop-done')
self.ns = NameShop.NameShop(self, 'NameShop-done', avList, index, self.isPaid)
self.ts = TrackShop.TrackShop('TrackShop-done')
self.ns = NameShop.NameShop(self, 'NameShop-done', avList, index, self.isPaid, )
self.shop = GENDERSHOP
self.shopsVisited = []
if self.warp:
self.shopsVisited = [GENDERSHOP,
BODYSHOP,
COLORSHOP,
CLOTHESSHOP]
self.music = None
self.soundBack = None
self.fsm.enterInitialState()
@ -308,11 +299,13 @@ class MakeAToon(StateData.StateData):
self.bs.unload()
self.cos.unload()
self.cls.unload()
self.ts.unload()
self.ns.unload()
del self.gs
del self.bs
del self.cos
del self.cls
del self.ts
del self.ns
self.guiTopBar.destroy()
self.guiBottomBar.destroy()
@ -405,7 +398,6 @@ class MakeAToon(StateData.StateData):
def __handleCancel(self):
self.doneStatus = 'cancel'
self.shopsVisited = []
base.transitions.fadeOut(finishIval=EventInterval(self.doneEvent))
def toggleSlide(self):
@ -419,6 +411,8 @@ class MakeAToon(StateData.StateData):
self.fsm.request('ColorShop')
elif self.shop == COLORSHOP:
self.fsm.request('ClothesShop')
elif self.shop == CLOTHESSHOP:
self.fsm.request('TrackShop')
else:
self.fsm.request('NameShop')
@ -430,8 +424,10 @@ class MakeAToon(StateData.StateData):
self.fsm.request('BodyShop')
elif self.shop == CLOTHESSHOP:
self.fsm.request('ColorShop')
else:
elif self.shop == TRACKSHOP:
self.fsm.request('ClothesShop')
elif self.shop == NAMESHOP:
self.fsm.request('TrackShop')
def charSez(self, char, statement, dialogue = None):
import pdb
@ -446,14 +442,14 @@ class MakeAToon(StateData.StateData):
def enterGenderShop(self):
self.shop = GENDERSHOP
if GENDERSHOP not in self.shopsVisited:
self.shopsVisited.append(GENDERSHOP)
if self.visitedGenderShop:
self.dropRoom(self.genderWalls, self.genderProps)
else:
self.genderWalls.reparentTo(self.squishJoint)
self.genderProps.reparentTo(self.propJoint)
self.roomSquishActor.pose('squish', 0)
self.guiNextButton['state'] = DGG.DISABLED
else:
self.dropRoom(self.genderWalls, self.genderProps)
self.visitedGenderShop = True
self.guiTopBar['text'] = TTLocalizer.CreateYourToonTitle
self.guiTopBar['text_fg'] = (1, 0.92, 0.2, 1)
self.guiTopBar['text_scale'] = TTLocalizer.MATenterGenderShop
@ -491,9 +487,7 @@ class MakeAToon(StateData.StateData):
self.guiTopBar['text_scale'] = TTLocalizer.MATenterBodyShop
self.accept('BodyShop-done', self.__handleBodyShopDone)
self.dropRoom(self.bodyWalls, self.bodyProps)
self.bs.enter(self.toon, self.shopsVisited)
if BODYSHOP not in self.shopsVisited:
self.shopsVisited.append(BODYSHOP)
self.bs.enter(self.toon)
self.bodyShopOpening()
def exitBodyShop(self):
@ -528,9 +522,7 @@ class MakeAToon(StateData.StateData):
self.dropRoom(self.colorWalls, self.colorProps)
self.toon.setPos(self.toonPosition)
self.colorShopOpening()
self.cos.enter(self.toon, self.shopsVisited)
if COLORSHOP not in self.shopsVisited:
self.shopsVisited.append(COLORSHOP)
self.cos.enter(self.toon)
def exitColorShop(self):
self.squishRoom(self.colorWalls)
@ -568,8 +560,6 @@ class MakeAToon(StateData.StateData):
self.toon.setHpr(self.toonHpr)
self.clothesShopOpening()
self.cls.enter(self.toon)
if CLOTHESSHOP not in self.shopsVisited:
self.shopsVisited.append(CLOTHESSHOP)
def exitClothesShop(self):
self.squishRoom(self.clothesWalls)
@ -587,13 +577,49 @@ class MakeAToon(StateData.StateData):
self.cls.hideButtons()
self.goToLastShop()
def trackShopOpening(self):
self.guiNextButton.show()
self.guiLastButton.show()
self.ts.load()
self.ts.showButtons()
def enterTrackShop(self):
self.shop = TRACKSHOP
self.guiTopBar['text'] = TTLocalizer.PickTrackTitle
self.guiTopBar['text_fg'] = (0.607, 0.06, 0.117, 1)
self.guiTopBar['text_scale'] = TTLocalizer.MATenterTrackShop
self.accept('TrackShop-done', self.__handleTrackShopDone)
self.dropRoom(self.genderWalls, self.genderProps)
self.toon.setScale(self.toonScale)
self.spotlight.setPos(2, -1.95, 0.41)
self.toon.setPos(Point3(1.5, -4, 0))
self.toon.setH(120)
self.rotateLeftButton.hide()
self.rotateRightButton.hide()
self.trackShopOpening()
self.ts.enter()
def exitTrackShop(self):
self.squishRoom(self.genderWalls)
self.squishProp(self.genderProps)
self.ts.exit()
self.ignore('TrackShop-done')
def __handleTrackShopDone(self):
self.guiNextButton.hide()
self.guiLastButton.hide()
self.ts.hideButtons()
self.ns.thirdTrack = self.ts.index
if self.ts.doneStatus == 'next':
self.goToNextShop()
else:
self.goToLastShop()
def nameShopOpening(self, task):
self.guiCheckButton.show()
self.guiLastButton.show()
if self.warp:
self.guiLastButton.hide()
if NAMESHOP not in self.shopsVisited:
self.shopsVisited.append(NAMESHOP)
return Task.done
def enterNameShop(self):
@ -603,11 +629,6 @@ class MakeAToon(StateData.StateData):
self.guiTopBar['text_scale'] = TTLocalizer.MATenterNameShop
self.accept('NameShop-done', self.__handleNameShopDone)
self.dropRoom(self.nameWalls, self.nameProps)
self.spotlight.setPos(2, -1.95, 0.41)
self.toon.setPos(Point3(1.5, -4, 0))
self.toon.setH(120)
self.rotateLeftButton.hide()
self.rotateRightButton.hide()
if self.progressing:
waittime = self.leftTime
else:

View file

@ -2,7 +2,8 @@ GENDERSHOP = 1
BODYSHOP = 2
COLORSHOP = 3
CLOTHESSHOP = 4
NAMESHOP = 5
TRACKSHOP = 5
NAMESHOP = 6
halfButtonScale = (0.6, 0.6, 0.6)
halfButtonHoverScale = (0.7, 0.7, 0.7)
halfButtonInvertScale = (-0.6, 0.6, 0.6)

View file

@ -36,7 +36,6 @@ class NameShop(StateData.StateData):
self.isPaid = isPaid
self.avList = avList
self.index = index
self.shopsVisited = []
self.avId = -1
self.avExists = 0
self.names = ['',
@ -553,9 +552,6 @@ class NameShop(StateData.StateData):
return problem
return None
def setShopsVisited(self, list):
self.shopsVisited = list
def __handleDone(self):
if self.fsm.getCurrentState().getName() == 'TypeAName':
self.__typedAName()
@ -949,7 +945,7 @@ class NameShop(StateData.StateData):
self.newDNA = style.makeNetString()
self.requestingSkipTutorial = skipTutorial
if not self.avExists or self.avExists and self.avId == 'deleteMe':
base.cr.csm.sendCreateAvatar(style, '', self.index)
base.cr.csm.sendCreateAvatar(style, self.thirdTrack, self.index)
self.accept('nameShopCreateAvatarDone', self.handleCreateAvatarResponse)
else:
self.checkNameTyped()

View file

@ -0,0 +1,109 @@
from pandac.PandaModules import *
from direct.fsm import StateData
from direct.gui.DirectGui import *
from MakeAToonGlobals import *
from toontown.toonbase import TTLocalizer, ToontownGlobals
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase.ToontownBattleGlobals import AvPropsNew
class TrackShop(StateData.StateData):
notify = DirectNotifyGlobal.directNotify.newCategory('TrackShop')
def __init__(self, doneEvent):
StateData.StateData.__init__(self, doneEvent)
self.loaded = False
self.index = 0
return
def enter(self):
base.disableMouse()
self.acceptOnce('last', self.__handleBackward)
self.acceptOnce('next', self.__handleForward)
def showButtons(self):
self.quest.show()
self.label.show()
self.leftButton.show()
self.rightButton.show()
self.track.show()
def hideButtons(self):
self.quest.hide()
self.label.hide()
self.leftButton.hide()
self.rightButton.hide()
self.track.hide()
def exit(self):
self.ignore('last')
self.ignore('next')
self.hideButtons()
def load(self):
if self.loaded:
return
self.loaded = True
self.questGui = loader.loadModel('phase_3.5/models/gui/stickerbook_gui')
self.inventoryGui = loader.loadModel('phase_3.5/models/gui/inventory_icons')
self.buttonGui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
self.shuffleArrowUp = self.buttonGui.find('**/tt_t_gui_mat_shuffleArrowUp')
self.shuffleArrowDown = self.buttonGui.find('**/tt_t_gui_mat_shuffleArrowDown')
self.inventoryModels = {}
for track in [0, 1, 2, 3, 6]:
self.inventoryModels[track] = self.inventoryGui.find('**/' + AvPropsNew[track][0])
self.quest = DirectFrame(aspect2d, relief=None, image=self.questGui.find('**/questCard'),
pos=(-0.62, 0, 0), image_scale=1.5)
self.label = DirectLabel(aspect2d, relief=None, text=TTLocalizer.PickTrackNotice,
text_fg=(0, 1, 0, 1), text_scale=0.12, text_font=ToontownGlobals.getToonFont(),
pos=(-0.62, 0, 0.45), text_shadow=(0, 0.392, 0, 1))
self.leftButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
pos=(-1.2, 0, -0.05), command=self.handleSetIndex, extraArgs=[-1])
self.rightButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
pos=(-0.05, 0, -0.05), scale=-1, command=self.handleSetIndex, extraArgs=[1])
self.track = DirectLabel(aspect2d, relief=None, text='',
text_scale=0.11, text_font=ToontownGlobals.getSignFont(),
pos=(-0.64, 0, -0.08), text_shadow=(1, 1, 1, 1))
self.updateGuiByIndex()
# Create GUI
return
def unload(self):
for element in [self.quest, self.label, self.leftButton, self.rightButton, self.track]:
if element:
element.destroy()
del element
self.index = 0
self.loaded = False
def handleSetIndex(self, offset):
newIndex = self.index + offset
if newIndex == 4:
self.index = 6
elif newIndex == 5:
self.index = 3
elif newIndex > -1 and newIndex < len(ToontownGlobals.PropIdToColor):
self.index = newIndex
self.updateGuiByIndex()
def updateGuiByIndex(self):
self.track['text'] = TTLocalizer.PropIdToName[self.index]
self.track['text_fg'] = ToontownGlobals.PropIdToColor[self.index]
def __handleForward(self):
self.doneStatus = 'next'
messenger.send(self.doneEvent)
def __handleBackward(self):
self.doneStatus = 'last'
messenger.send(self.doneEvent)

View file

@ -6,7 +6,6 @@ OL.SpeedChatStaticText = OL.SpeedChatStaticTextToontown.copy()
for key in OL.SpeedChatStaticTextCommon.iterkeys():
OL.SpeedChatStaticText[key] = OL.SpeedChatStaticTextCommon[key]
commitmantst = 'kptmptest - removable'
InterfaceFont = 'phase_3/models/fonts/ImpressBT.ttf'
ToonFont = 'phase_3/models/fonts/ImpressBT.ttf'
SuitFont = 'phase_3/models/fonts/vtRemingtonPortable.ttf'
@ -9746,6 +9745,8 @@ LanguageSelectorAvailable = 'Available languages:'
LanguageSelectorBack = 'Back'
LanguageSelectorConfirm = 'Are you sure you want to change your language to %s? This will close your game.'
LanguageSelectorSameLanguage = "You're already using that language!"
PickTrackTitle = 'Pick your third track!'
PickTrackNotice = 'Choose a track!'
# Buffs
@ -9783,6 +9784,10 @@ def getPetName(uniqueID):
except:
return PetNameDictionary[0]
def getPropNameById(id):
if id == 0:
return MovieNPCSOSTo
def getRandomPetName(gender = None, seed = None):
if seed is not None:
random.seed(seed)
@ -9802,3 +9807,5 @@ def getPetNameId(name):
return key
return 0
PropIdToName = [InventoryHealString, MovieNPCSOSTrap, MovieNPCSOSLure, MovieNPCSOSSound, MovieNPCSOSThrow, MovieNPCSOSSquirt, MovieNPCSOSDrop]

View file

@ -133,6 +133,7 @@ MATenterGenderShop = 0.18
MATenterBodyShop = 0.18
MATenterColorShop = 0.18
MATenterClothesShop = 0.16
MATenterTrackShop = 0.16
MATenterNameShop = 0.15
MATclothesGUIshirt_scale = 0.06
MATclothesGUIshirt_posL = 0.01

View file

@ -396,10 +396,6 @@ MinigamePlayerMatrix = {
3: (CannonGameId, MazeGameId, TugOfWarGameId, PatternGameId, RaceGameId, TagGameId, VineGameId, RingGameId, IceGameId, CogThiefGameId, TwoDGameId, DivingGameId, PairingGameId, CatchGameId, TargetGameId, PhotoGameId),
4: (CannonGameId, MazeGameId, TugOfWarGameId, PatternGameId, RaceGameId, TagGameId, VineGameId, RingGameId, IceGameId, CogThiefGameId, TwoDGameId, DivingGameId, PairingGameId, CatchGameId, TargetGameId, PhotoGameId),
}
MinigameReleaseDates = {IceGameId: (2008, 8, 5),
PhotoGameId: (2008, 8, 13),
TwoDGameId: (2008, 8, 20),
CogThiefGameId: (2008, 8, 27)}
KeyboardTimeout = 300
phaseMap = {Tutorial: 4,
ToontownCentral: 4,
@ -1683,3 +1679,13 @@ BMovementSpeedMultiplier = 1.3
BGagAccuracy = 1
BGagAccuracyMultiplier = 1.3
PropIdToColor = [
(0.772, 0.353, 0.91, 1),
(0.91, 0.9, 0.353, 1),
(0.2, 0.741, 0.207, 1),
(0.24, 0.364, 0.921, 1),
(0.93, 0.623, 0.196, 1),
(0.96, 0.356, 0.839, 1),
(0.196, 0.917, 0.929, 1)
]

View file

@ -51,8 +51,8 @@ class ClientServicesManager(DistributedObjectGlobal):
self.cr.handleAvatarsList(avList)
# --- AVATAR CREATION/DELETION ---
def sendCreateAvatar(self, avDNA, _, index):
self.sendUpdate('createAvatar', [avDNA.makeNetString(), index])
def sendCreateAvatar(self, avDNA, thirdTrack, index):
self.sendUpdate('createAvatar', [avDNA.makeNetString(), thirdTrack, index])
def createAvatarResp(self, avId):
messenger.send('nameShopCreateAvatarDone', [avId])

View file

@ -465,9 +465,9 @@ class LoginAccountFSM(OperationFSM):
class CreateAvatarFSM(OperationFSM):
notify = directNotify.newCategory('CreateAvatarFSM')
def enterStart(self, dna, index):
def enterStart(self, dna, thirdTrack, index):
# Basic sanity-checking:
if index >= 6:
if index < 0 or index >= 6:
self.demand('Kill', 'Invalid index specified!')
return
@ -475,8 +475,13 @@ class CreateAvatarFSM(OperationFSM):
self.demand('Kill', 'Invalid DNA specified!')
return
if thirdTrack < 0 or thirdTrack == 4 or thirdTrack == 5 or thirdTrack >= 7:
self.demand('Kill', 'Invalid third track specified!')
return
self.index = index
self.dna = dna
self.thirdTrack = thirdTrack
# Okay, we're good to go, let's query their account.
self.demand('RetrieveAccount')
@ -511,12 +516,15 @@ class CreateAvatarFSM(OperationFSM):
colorString = TTLocalizer.NumToColor[dna.headColor]
animalType = TTLocalizer.AnimalToSpecies[dna.getAnimal()]
name = ' '.join((colorString, animalType))
trackAccess = [0, 0, 0, 0, 1, 1, 0]
trackAccess[self.thirdTrack] = 1
toonFields = {
'setName': (name,),
'WishNameState': ('OPEN',),
'WishName': ('',),
'setDNAString': (self.dna,),
'setDISLid': (self.target,)
'setDISLid': (self.target,),
'setTrackAccess': (trackAccess,)
}
self.csm.air.dbInterface.createObject(
self.csm.air.dbId,
@ -1121,8 +1129,8 @@ class ClientServicesManagerUD(DistributedObjectGlobalUD):
self.notify.debug('Received avatar list request from %d' % (self.air.getMsgSender()))
self.runAccountFSM(GetAvatarsFSM)
def createAvatar(self, dna, index):
self.runAccountFSM(CreateAvatarFSM, dna, index)
def createAvatar(self, dna, thirdTrack, index):
self.runAccountFSM(CreateAvatarFSM, dna, thirdTrack, index)
def deleteAvatar(self, avId):
self.runAccountFSM(DeleteAvatarFSM, avId)