4 from fixers
import Conversation, Node, RootNode, SubNode
7 TRIGGER_SAVE =
"IntroJP"
9 TRIGGER_MESSAGE = [
"[Reminder]",
"Jenek on Wiley may have a jump drive going cheap."]
22 FIXER_NAME =
"IntroFixer"
23 FIXER_TEXT =
"#\nimport quest_intro\nconversation = quest_intro.getJenekConversation()"
27 quest.quest_factory.__init__ (self,
"quest_introduction")
37 Director.eraseSaveData(self.playa.isPlayerStarship(),TRIGGER_SAVE,0)
38 Director.pushSaveData(self.playa.isPlayerStarship(),TRIGGER_SAVE,DEFAULT_VALUE)
43 """Updates the jumppoint list \'self.jps\' used by \'self.checkDistances()\'."""
46 iter = VS.getUnitList()
48 if iter.current().isJumppoint():
49 self.jps.append(iter.current())
53 """Determines whether \'self.playa\' (the player) is close enough to
54 a jumppoint to trigger the IOMessage."""
57 if self.playa.getDistance(jp) <= JP_DISTANCE:
63 VS.IOmessage (0,TRIGGER_MESSAGE[0],
"all",TRIGGER_MESSAGE[1])
64 Director.eraseSaveData(self.playa.isPlayerStarship(),TRIGGER_SAVE,0)
65 Director.pushSaveData(self.playa.isPlayerStarship(),TRIGGER_SAVE,TRIGGER_VALUE)
67 Director.eraseSaveData(self.playa.isPlayerStarship(),TRIGGER_SAVE,0)
68 fixers.eraseCFixer(self.playa.isPlayerStarship(), FIXER_NAME)
78 elif VS.getPlayer().getCredits()>=JP_DRV_PRICE:
80 VS.getPlayer().addCredits(-JP_DRV_PRICE)
82 VS.getPlayer().upgrade(
"jump_drive",0,0,1,0)
84 VS.getPlayer().addCargo(VS.GetMasterPartList().GetCargo(
"jump_drive"))
85 print "TEST: Bought Jump Drive"
86 Director.eraseSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,0)
87 Director.pushSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,DONE_VALUE)
92 """Does the player already have a jumpdrive?"""
93 if VS.getPlayer().GetJumpStatus()>-2:
95 print "TEST: You have a jump drive already!"
100 """Checks if the player is docked to the right planet, and the fixer is still \'around\'."""
102 iter = VS.getUnitList()
103 while iter.notDone():
104 if iter.current().isPlanet()
and (VS.getPlayer().isDocked(iter.current())
or iter.current().isDocked(VS.getPlayer())):
106 return iter.current().getName() ==
'Wiley'
111 """Returns the conversation object for the Jenek fixer."""
112 con = Conversation(FIXER_NAME, [
'#\nimport quest_intro\nresult = quest_intro.okayDrawJenek()'])
115 roo.addSubNode(SubNode(
"knownjenek",
116 [
str(TRIGGER_SAVE) +
'#' +
str(TRIGGER_VALUE)],
117 [
"#\nimport quest_intro\nquest_intro.interactWithJenek(\"jenek\")"],
118 "bases/fixers/merchant.spr",
119 "Talk to Jenek about the jump drive." ))
120 roo.addSubNode(SubNode(
"unknownjenek",
122 [
"#\nimport quest_intro\nquest_intro.interactWithJenek(\"jenek\")"],
123 "bases/fixers/merchant.spr",
128 jen.addSubNode(SubNode(
"Ahh, that's right. You're here about the jump drive!",
129 [
str(TRIGGER_SAVE) +
'#' +
str(TRIGGER_VALUE)],
130 [
"bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"nojump\")|Sorry, what else do you have?",
131 "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|Yeah, I'm interested."],
132 "bases/fixers/merchant.spr",
133 "Talk to Jenek about the jump drive." ))
134 jen.addSubNode(SubNode(
"So you're interested in the jump drive now?",
135 [
str(TRIGGER_SAVE) +
'#' +
str(REFUSED_VALUE)],
136 [
"bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"nojump\")|Sorry.",
137 "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|Yeah, I'm interested."],
138 "bases/fixers/merchant.spr",
139 "Talk to Jenek about the jump drive." ))
140 jen.addSubNode(SubNode(
"Well, what are you waiting for? Go and give it a spin!",
141 [
"#\nimport quest_intro\nresult = quest_intro.haveDrive()"] ))
142 jen.addSubNode(SubNode(
"You're back! Quite a party that was the other night, if it wasn't for my reminder I would have forgotten you! You still interested in that jump drive I've got?",
144 [
"bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"forgetjump\")|Sorry, I have no idea what you are talking about!",
145 "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|I completely forgot myself! Of course I'm interested."],
146 "bases/fixers/merchant.spr",
148 con.addNode(jen,
"jenek")
151 forg.addSubNode(SubNode(
"Well, I can't say I'm surprised ... not with the amount of Tripezian Premium you downed! Anyway, I've come across a few \'spare\' jump drives, and your ship, last you spoke about it, was one short. Are you still as interested as you were then?",
153 [
"bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"nojump\")|Sorry, don't suppose you've got anything else?",
154 "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|Yeah, I'm interested."] ))
155 con.addNode(forg,
"forgetjump")
158 yes.addSubNode(SubNode(
"Great! I can let you have one for just %s. Do you want it now?"%
str(JP_DRV_PRICE),
160 [
"bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"rejectdrive\")|Maybe later.",
161 "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"takedrive\")|Okay."] ))
162 con.addNode(yes,
"yesjump")
165 no.addSubNode(SubNode(
"If it's not about the jump drive I don't have the time. Come back later." ))
166 con.addNode(no,
"nojump")
169 tak.addSubNode(SubNode(
"I'll send some mechanics to fit it for you now. Nice to see you again!",
170 [
"#\nimport quest_intro\nresult = quest_intro.buyDrive()==%s"%
str(DRV_SUCCESS)] ))
171 tak.addSubNode(SubNode(
"You idiot, you already have a jumpdrive!",
172 [
"#\nimport quest_intro\nresult = quest_intro.buyDrive()==%s"%
str(DRV_FAIL)] ))
173 tak.addSubNode(SubNode(
"Sorry, it looks like your account is a little dry. Come back when you've got %s credit."%
str(JP_DRV_PRICE) ))
174 con.addNode(tak,
"takedrive")
177 rej.addSubNode(SubNode(
"Fine. I may not be around for much longer though." ))
178 con.addNode(rej,
"rejectdrive")
183 """Iterates the conversation, allowing for extra events to be launched
184 during the conversation."""
185 if ref ==
"nojump" or ref ==
"rejectdrive":
186 Director.eraseSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,0)
187 Director.pushSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,REFUSED_VALUE)