This commit is contained in:
Loudrob 2015-03-23 08:57:28 -04:00
commit fbbaf9c4e3
9 changed files with 63 additions and 98 deletions

View file

@ -896,7 +896,7 @@ dclass DistributedToon : DistributedPlayer {
setTrackAccess(uint16[] = [0,0,0,0,1,1,0]) required broadcast ownrecv db;
setTrackProgress(int8 = -1, uint32 = 0) required ownrecv db;
setTrackBonusLevel(int8[] = [-1,-1,-1,-1,-1,-1,-1]) required broadcast ownrecv db;
setInventory(blob = [0*7, 0*7, 0*7, 0*7, 1, 0*6, 1, 0*6, 0*7]) required ownrecv db;
setInventory(blob = [0*7, 0*7, 0*7, 0*7, 0, 0*6, 0, 0*6, 0*7]) required ownrecv db;
setMaxNPCFriends(uint16 = 16) required ownrecv db;
setNPCFriendsDict(FriendEntry[] = []) required ownrecv db;
setDefaultShard(uint32 = 0) required ownrecv broadcast db;

View file

@ -37,5 +37,5 @@ want-glove-npc #t
# Developer options:
show-population #t
force-skip-tutorial #t
force-skip-tutorial #f
want-instant-parties #t

View file

@ -11,7 +11,6 @@ QuestToNpcIdIndex = 2
QuestRewardIdIndex = 3
QuestProgressIndex = 4
class QuestManagerAI:
notify = directNotify.newCategory('QuestManagerAI')

View file

@ -53,6 +53,7 @@ class Movie(DirectObject.DirectObject):
self.hasBeenReset = 0
self.reset()
self.rewardHasBeenReset = 0
self.tutRewardDialog = None
self.resetReward()
return
@ -299,47 +300,29 @@ class Movie(DirectObject.DirectObject):
self.rewardHasBeenReset = 0
self.rewardPanel = RewardPanel.RewardPanel(name)
self.rewardCallback = callback
self.questList = self.rewardPanel.getQuestIntervalList(base.localAvatar, [0,
1,
1,
0], [base.localAvatar], base.localAvatar.quests[0], [], [base.localAvatar.getDoId()])
self.questList = self.rewardPanel.getQuestIntervalList(base.localAvatar, [0, 1, 1, 0], [base.localAvatar], base.localAvatar.quests[0], [], [base.localAvatar.getDoId()])
camera.setPosHpr(0, 8, base.localAvatar.getHeight() * 0.66, 179, 15, 0)
self.playTutorialReward_1()
self.rewardPanel.initGagFrame(base.localAvatar, [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0], noSkip=True)
self.playTutorialReward_1(None, self.toonRewardDicts[0]['earnedExp'])
def playTutorialReward_1(self):
self.tutRewardDialog_1 = TTDialog.TTDialog(text=TTLocalizer.MovieTutorialReward1, command=self.playTutorialReward_2, style=TTDialog.Acknowledge, fadeScreen=None, pos=(0.65, 0, 0.5), scale=0.8)
self.tutRewardDialog_1.hide()
self._deleteTrack()
self.track = Sequence(name='tutorial-reward-1')
self.track.append(Func(self.rewardPanel.initGagFrame, base.localAvatar, [0,
0,
0,
0,
0,
0,
0], [0,
0,
0,
0], noSkip=True))
self.track += self.rewardPanel.getTrackIntervalList(base.localAvatar, THROW_TRACK, 0, 1, 0)
self.track.append(Func(self.tutRewardDialog_1.show))
self.track.start()
def playTutorialReward_1(self, result, earnedXp, tutTrack=0):
if self.tutRewardDialog:
self.tutRewardDialog.cleanup()
elif tutTrack >= len(earnedXp):
self.playTutorialReward_2()
return
def playTutorialReward_2(self, value):
self.tutRewardDialog_1.cleanup()
self.tutRewardDialog_2 = TTDialog.TTDialog(text=TTLocalizer.MovieTutorialReward2, command=self.playTutorialReward_3, style=TTDialog.Acknowledge, fadeScreen=None, pos=(0.65, 0, 0.5), scale=0.8)
self.tutRewardDialog_2.hide()
self._deleteTrack()
self.track = Sequence(name='tutorial-reward-2')
self.track.append(Wait(1.0))
self.track += self.rewardPanel.getTrackIntervalList(base.localAvatar, SQUIRT_TRACK, 0, 1, 0)
self.track.append(Func(self.tutRewardDialog_2.show))
self.track.start()
return
xp = earnedXp[tutTrack]
def playTutorialReward_3(self, value):
self.tutRewardDialog_2.cleanup()
if xp > 0:
self.tutRewardDialog = TTDialog.TTDialog(text=TTLocalizer.MovieTutorialReward1 % (xp, TTLocalizer.BattleGlobalTracks[tutTrack].capitalize()), command=self.playTutorialReward_1, extraArgs=[earnedXp, tutTrack + 1], style=TTDialog.Acknowledge, fadeScreen=None, pos=(0.65, 0, 0.5), scale=0.8)
sequence = Sequence()
sequence += self.rewardPanel.getTrackIntervalList(base.localAvatar, tutTrack, 0, xp, 0)
sequence.start()
else:
self.playTutorialReward_1(None, earnedXp, tutTrack + 1)
def playTutorialReward_2(self, value=None):
from toontown.toon import Toon
from toontown.toon import ToonDNA
@ -355,40 +338,28 @@ class Movie(DirectObject.DirectObject):
self.tutorialTom = Toon.Toon()
dna = ToonDNA.ToonDNA()
dnaList = ('dls', 'ms', 'm', 'm', 7, 0, 7, 7, 2, 6, 2, 6, 2, 16)
dna.newToonFromProperties(*dnaList)
dna.newToonFromProperties(*('dls', 'ms', 'm', 'm', 7, 0, 7, 7, 2, 6, 2, 6, 2, 16))
self.tutorialTom.setDNA(dna)
self.tutorialTom.setName(TTLocalizer.NPCToonNames[20000])
self.tutorialTom.setPickable(0)
self.tutorialTom.setPlayerType(NametagGlobals.CCNonPlayer)
self.tutorialTom.uniqueName = uniqueName
if base.config.GetString('language', 'english') == 'japanese':
self.tomDialogue03 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward01.ogg')
self.tomDialogue04 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward02.ogg')
self.tomDialogue05 = base.loadSfx('phase_3.5/audio/dial/CC_tom_movie_tutorial_reward03.ogg')
self.musicVolume = base.config.GetFloat('tutorial-music-volume', 0.5)
else:
self.tomDialogue03 = None
self.tomDialogue04 = None
self.tomDialogue05 = None
self.musicVolume = 0.9
music = base.cr.playGame.place.loader.battleMusic
if self.questList:
self.track1 = Sequence(Wait(1.0), Func(self.rewardPanel.initQuestFrame, base.localAvatar, copy.deepcopy(base.localAvatar.quests)), Wait(1.0), Sequence(*self.questList), Wait(1.0), Func(self.rewardPanel.hide), Func(camera.setPosHpr, render, 34, 19.88, 3.48, -90, -2.36, 0), Func(base.localAvatar.animFSM.request, 'neutral'), Func(base.localAvatar.setPosHpr, 40.31, 22.0, -0.47, 150.0, 360.0, 0.0), Wait(0.5), Func(self.tutorialTom.reparentTo, render), Func(self.tutorialTom.show), Func(self.tutorialTom.setPosHpr, 40.29, 17.9, -0.47, 11.31, 0.0, 0.07), Func(self.tutorialTom.animFSM.request, 'TeleportIn'), Wait(1.517), Func(self.tutorialTom.animFSM.request, 'neutral'), Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat1), Func(self.tutorialTom.addActive), Func(music.setVolume, self.musicVolume), Func(self.tutorialTom.setLocalPageChat, TTLocalizer.MovieTutorialReward3, 0, None, [self.tomDialogue03]), name='tutorial-reward-3a')
self.track2 = Sequence(Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat2), Func(self.tutorialTom.setLocalPageChat, TTLocalizer.MovieTutorialReward4, 1, None, [self.tomDialogue04]), Func(self.tutorialTom.setPlayRate, 1.5, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.5), Func(self.tutorialTom.loop, 'right-hand'), name='tutorial-reward-3b')
self.track3 = Parallel(Sequence(Func(self.tutorialTom.setPlayRate, -1.8, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.8), Func(self.tutorialTom.animFSM.request, 'neutral'), name='tutorial-reward-3ca'), Sequence(Wait(0.5), Func(self.tutorialTom.setChatAbsolute, TTLocalizer.MovieTutorialReward5, CFSpeech | CFTimeout, self.tomDialogue05), Wait(1.0), Func(self.tutorialTom.animFSM.request, 'TeleportOut'), Wait(self.tutorialTom.getDuration('teleport')), Wait(1.0), Func(self.playTutorialReward_4, 0), name='tutorial-reward-3cb'), name='tutorial-reward-3c')
self.track1 = Sequence(Wait(1.0), Func(self.rewardPanel.initQuestFrame, base.localAvatar, copy.deepcopy(base.localAvatar.quests)), Wait(1.0), Sequence(*self.questList), Wait(1.0), Func(self.rewardPanel.hide), Func(camera.setPosHpr, render, 34, 19.88, 3.48, -90, -2.36, 0), Func(base.localAvatar.animFSM.request, 'neutral'), Func(base.localAvatar.setPosHpr, 40.31, 22.0, -0.47, 150.0, 360.0, 0.0), Wait(0.5), Func(self.tutorialTom.reparentTo, render), Func(self.tutorialTom.show), Func(self.tutorialTom.setPosHpr, 40.29, 17.9, -0.47, 11.31, 0.0, 0.07), Func(self.tutorialTom.animFSM.request, 'TeleportIn'), Wait(1.517), Func(self.tutorialTom.animFSM.request, 'neutral'), Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat1), Func(self.tutorialTom.addActive), Func(music.setVolume, self.musicVolume), Func(self.tutorialTom.setLocalPageChat, TTLocalizer.MovieTutorialReward3, 0, None, [None]), name='tutorial-reward-3a')
self.track2 = Sequence(Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat2), Func(self.tutorialTom.setLocalPageChat, TTLocalizer.MovieTutorialReward4, 1, None, [None]), Func(self.tutorialTom.setPlayRate, 1.5, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.5), Func(self.tutorialTom.loop, 'right-hand'), name='tutorial-reward-3b')
self.track3 = Parallel(Sequence(Func(self.tutorialTom.setPlayRate, -1.8, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.8), Func(self.tutorialTom.animFSM.request, 'neutral'), name='tutorial-reward-3ca'), Sequence(Wait(0.5), Func(self.tutorialTom.setChatAbsolute, TTLocalizer.MovieTutorialReward5, CFSpeech | CFTimeout), Wait(1.0), Func(self.tutorialTom.animFSM.request, 'TeleportOut'), Wait(self.tutorialTom.getDuration('teleport')), Wait(1.0), Func(self.playTutorialReward_3, 0), name='tutorial-reward-3cb'), name='tutorial-reward-3c')
self.track1.start()
else:
self.playTutorialReward_4(0)
return
self.playTutorialReward_3()
def playTutorialReward_4(self, value):
def playTutorialReward_3(self, value=None):
base.localAvatar.setH(270)
self.tutorialTom.removeActive()
self.tutorialTom.delete()
self.questList = None
self.rewardCallback()
return
def stop(self):
if self.track:

View file

@ -432,12 +432,12 @@ class NPCMoviePlayer(DirectObject.DirectObject):
iList.append(self.parseFunction(line))
elif command == 'BLACK_CAT_LISTEN':
iList.append(self.parseBlackCatListen(line))
elif command == 'SHOW_THROW_SQUIRT_PREVIEW':
elif command == 'SHOW_PREVIEW':
if uponTimeout:
self.notify.error('SHOW_THROW_SQUIRT_PREVIEW not allowed in an UPON_TIMEOUT')
nextEvent = 'doneThrowSquirtPreview'
self.notify.error('SHOW_PREVIEW not allowed in an UPON_TIMEOUT')
nextEvent = 'donePreview'
iList.append(Func(self.acceptOnce, nextEvent, self.playNextChapter, [nextEvent]))
iList.append(self.parseThrowSquirtPreview(line))
iList.append(self.parsePreview(line))
self.closePreviousChapter(iList)
chapterList = []
self.currentEvent = nextEvent
@ -989,14 +989,14 @@ class NPCMoviePlayer(DirectObject.DirectObject):
return Func(disableBlackCatListen)
def parseThrowSquirtPreview(self, line):
oldTrackAccess = [None]
def parsePreview(self, line):
self.oldTrackAccess = None
def grabCurTrackAccess(oldTrackAccess = oldTrackAccess):
oldTrackAccess[0] = copy.deepcopy(base.localAvatar.getTrackAccess())
def grabCurTrackAccess():
self.oldTrackAccess = copy.deepcopy(base.localAvatar.getTrackAccess())
def restoreTrackAccess(oldTrackAccess = oldTrackAccess):
base.localAvatar.setTrackAccess(oldTrackAccess[0])
def restoreTrackAccess():
base.localAvatar.setTrackAccess(self.oldTrackAccess)
minGagLevel = ToontownBattleGlobals.MIN_LEVEL_INDEX + 1
maxGagLevel = ToontownBattleGlobals.MAX_LEVEL_INDEX + 1
@ -1007,15 +1007,14 @@ class NPCMoviePlayer(DirectObject.DirectObject):
if newGagLevel == curGagLevel:
return
curGagLevel = newGagLevel
base.localAvatar.setTrackAccess([0,
0,
0,
0,
curGagLevel,
curGagLevel,
0])
access = []
return Sequence(Func(grabCurTrackAccess), LerpFunctionInterval(updateGagLevel, fromData=1, toData=7, duration=0.3), WaitInterval(3.5), LerpFunctionInterval(updateGagLevel, fromData=7, toData=1, duration=0.3), Func(restoreTrackAccess), Func(messenger.send, 'doneThrowSquirtPreview'))
for i in xrange(len(self.oldTrackAccess)):
access[i] = 1 if self.oldTrackAccess[i] > 0 else 0
base.localAvatar.setTrackAccess(access)
return Sequence(Func(grabCurTrackAccess), LerpFunctionInterval(updateGagLevel, fromData=1, toData=7, duration=0.3), WaitInterval(3.5), LerpFunctionInterval(updateGagLevel, fromData=7, toData=1, duration=0.3), Func(restoreTrackAccess), Func(messenger.send, 'donePreview'))
searchPath = DSearchPath()
if __debug__:

View file

@ -80,15 +80,6 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame):
def show(self):
if self.tutorialFlag:
self.tutArrows.arrowsOn(-0.43, -0.12, 180, -0.43, -0.24, 180, onTime=1.0, offTime=0.2)
if self.numItem(THROW_TRACK, 0) == 0:
self.tutArrows.arrow1.reparentTo(hidden)
else:
self.tutArrows.arrow1.reparentTo(self.battleFrame, 1)
if self.numItem(SQUIRT_TRACK, 0) == 0:
self.tutArrows.arrow2.reparentTo(hidden)
else:
self.tutArrows.arrow2.reparentTo(self.battleFrame, 1)
self.tutText.show()
self.tutText.reparentTo(self.battleFrame, 1)
DirectFrame.show(self)
@ -121,7 +112,6 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame):
def hide(self):
if self.tutorialFlag:
self.tutArrows.arrowsOff()
self.tutText.hide()
DirectFrame.hide(self)
@ -1182,7 +1172,6 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame):
self.fireButton = DirectButton(parent=self.battleFrame, relief=None, pos=(0.73, 0, -0.242), text=TTLocalizer.InventoryFire, text_scale=TTLocalizer.INfireButton, text_pos=(0, -0.02), text_fg=Vec4(1, 1, 1, 1), textMayChange=0, image=(self.upButton, self.downButton, self.rolloverButton), image_scale=1.05, image_color=(0, 0.6, 1, 1), command=self.__handleFire)
self.tutText = DirectFrame(parent=self.battleFrame, relief=None, pos=(0.05, 0, -0.1133), scale=0.143, image=DGG.getDefaultDialogGeom(), image_scale=5.125, image_pos=(0, 0, -0.65), image_color=ToontownGlobals.GlobalDialogColor, text_scale=TTLocalizer.INclickToAttack, text=TTLocalizer.InventoryClickToAttack, textMayChange=0)
self.tutText.hide()
self.tutArrows = BlinkingArrows.BlinkingArrows(parent=self.battleFrame)
battleModels.removeNode()
self.battleFrame.hide()
return

View file

@ -4849,8 +4849,7 @@ NPCForceAcknowledgeMessage7 = "Don't forget to make a friend!\n\n\n\n\n\n\nClick
NPCForceAcknowledgeMessage8 = 'Great! You made a new friend!\n\n\n\n\n\n\n\n\nYou should go back at Toon Headquarters now.'
NPCForceAcknowledgeMessage9 = 'Good job using the phone!\n\n\n\n\n\n\n\n\nReturn to Toon Headquarters to claim your reward.'
ToonSleepString = '. . . ZZZ . . .'
MovieTutorialReward1 = 'You received 1 Throw point! When you get 10, you will get a new gag!'
MovieTutorialReward2 = 'You received 1 Squirt point! When you get 10, you will get a new gag!'
MovieTutorialReward1 = 'You received %s %s point! When you get 10, you will get a new gag!'
MovieTutorialReward3 = 'Good job! You completed your first ToonTask!'
MovieTutorialReward4 = 'Go to Toon Headquarters for your reward!'
MovieTutorialReward5 = 'Have fun!'
@ -5547,7 +5546,7 @@ QuestScript110_2 = 'The book is full of good stuff.'
QuestScript110_3 = "Open it, and I'll show you."
QuestScript110_4 = "The map shows where you've been."
QuestScript110_5 = 'Turn the page to see your gags...'
QuestScript110_6 = 'Uh oh! You have no gags! I will assign you a task.'
QuestScript110_6 = 'You can see your gags here.'
QuestScript110_7 = 'Turn the page to see your tasks.'
QuestScript110_8 = 'Take a ride on the trolley, and earn jelly beans to buy gags!'
QuestScript110_9 = 'To get to the trolley, go out the door behind me and head for the playground.'
@ -5565,7 +5564,7 @@ QuestScriptGagShop_1 = 'Welcome to the Gag Shop!'
QuestScriptGagShop_1a = 'This is where Toons come to buy gags to use against the Cogs.'
QuestScriptGagShop_3 = 'To buy gags, click on the gag buttons. Try getting some now!'
QuestScriptGagShop_4 = 'Good! You can use these gags in battle against the Cogs.'
QuestScriptGagShop_5 = "Here's a peek at the advanced throw and squirt gags..."
QuestScriptGagShop_5 = "Here's a peek at the advanced gags..."
QuestScriptGagShop_6 = "When you're done buying gags, click this button to return to the Playground."
QuestScriptGagShop_7 = 'Normally you can use this button to play another Trolley Game...'
QuestScriptGagShop_8 = "...but there's no time for another game right now. You're needed in Toon HQ!"

View file

@ -14,3 +14,9 @@ class DistributedBattleTutorialAI(DistributedBattleAI):
def startRewardTimer(self):
pass # We don't want a reward timer in the tutorial.
def exitReward(self):
av = simbase.air.doId2do.get(self.air.getAvatarIdFromSender())
if av:
av.b_setQuests([[101, 1, 1000, 100, 1]])

View file

@ -165,12 +165,14 @@ class TutorialManagerAI(DistributedObjectAI):
av.b_setRewardHistory(0, [])
av.b_setHp(15)
av.b_setMaxHp(15)
av.inventory.zeroInv(killUber=True)
av.inventory.addItem(ToontownBattleGlobals.THROW_TRACK, 0)
av.inventory.addItem(ToontownBattleGlobals.SQUIRT_TRACK, 0)
av.d_setInventory(av.inventory.makeNetString())
access = av.getTrackAccess()
for i in xrange(len(access)):
if access[i] == 1:
av.inventory.addItem(i, 0)
av.d_setInventory(av.inventory.makeNetString())
av.experience.zeroOutExp()
av.d_setExperience(av.experience.makeNetString())