Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
quest_intro Namespace Reference

Data Structures

class  quest_introduction_factory
 
class  quest_introduction
 

Functions

def buyDrive
 
def haveDrive
 
def okayDrawJenek
 
def getJenekConversation
 
def interactWithJenek
 

Variables

string TRIGGER_SAVE = "IntroJP"
 
int TRIGGER_VALUE = 1
 
list TRIGGER_MESSAGE = ["[Reminder]","Jenek on Wiley may have a jump drive going cheap."]
 
int DEFAULT_VALUE = 0
 
int REFUSED_VALUE = 2
 
int DONE_VALUE = 3
 
int JP_DRV_PRICE = 7000
 
int DRV_SUCCESS = 1
 
int DRV_FAIL = 2
 
int JP_DISTANCE = 10000
 
string FIXER_NAME = "IntroFixer"
 
string FIXER_TEXT = "#\nimport quest_intro\nconversation = quest_intro.getJenekConversation()"
 

Function Documentation

def quest_intro.buyDrive ( )

Definition at line 75 of file quest_intro.py.

References haveDrive().

75 
76 def buyDrive():
77  if haveDrive():
78  return DRV_FAIL
79  elif VS.getPlayer().getCredits()>=JP_DRV_PRICE:
80 #deducts the required sum
81  VS.getPlayer().addCredits(-JP_DRV_PRICE)
82 #adds the jumpdrive temporarily (will be removed if player upgrades)
83  VS.getPlayer().upgrade("jump_drive",0,0,1,0)
84 #adds the jumpdrive to cargo, making it a permenant upgrade
85  VS.getPlayer().addCargo(VS.GetMasterPartList().GetCargo("jump_drive"))
86  print "TEST: Bought Jump Drive"
87  Director.eraseSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,0)
88  Director.pushSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,DONE_VALUE)
89  return DRV_SUCCESS
90  return 0
def quest_intro.getJenekConversation ( )
Returns the conversation object for the Jenek fixer.

Definition at line 110 of file quest_intro.py.

References locale.str().

112  """Returns the conversation object for the Jenek fixer."""
113  con = Conversation(FIXER_NAME, ['#\nimport quest_intro\nresult = quest_intro.okayDrawJenek()'])
114 
115  roo = RootNode()
116  roo.addSubNode(SubNode( "knownjenek",
117  [str(TRIGGER_SAVE) + '#' + str(TRIGGER_VALUE)],
118  ["#\nimport quest_intro\nquest_intro.interactWithJenek(\"jenek\")"],
119  "bases/fixers/merchant.spr",
120  "Talk to Jenek about the jump drive." ))
121  roo.addSubNode(SubNode( "unknownjenek",
122  list(),
123  ["#\nimport quest_intro\nquest_intro.interactWithJenek(\"jenek\")"],
124  "bases/fixers/merchant.spr",
125  "Talk to Jenek." ))
126  con.addNode(roo)
127 
128  jen = Node()
129  jen.addSubNode(SubNode( "Ahh, that's right. You're here about the jump drive!",
130  [str(TRIGGER_SAVE) + '#' + str(TRIGGER_VALUE)],
131  ["bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"nojump\")|Sorry, what else do you have?",
132  "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|Yeah, I'm interested."],
133  "bases/fixers/merchant.spr",
134  "Talk to Jenek about the jump drive." ))
135  jen.addSubNode(SubNode( "So you're interested in the jump drive now?",
136  [str(TRIGGER_SAVE) + '#' + str(REFUSED_VALUE)],
137  ["bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"nojump\")|Sorry.",
138  "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|Yeah, I'm interested."],
139  "bases/fixers/merchant.spr",
140  "Talk to Jenek about the jump drive." ))
141  jen.addSubNode(SubNode( "Well, what are you waiting for? Go and give it a spin!",
142  ["#\nimport quest_intro\nresult = quest_intro.haveDrive()"] ))
143  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  list(),
145  ["bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"forgetjump\")|Sorry, I have no idea what you are talking about!",
146  "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|I completely forgot myself! Of course I'm interested."],
147  "bases/fixers/merchant.spr",
148  "Talk to Jenek." ))
149  con.addNode(jen,"jenek")
150 
151  forg = Node()
152  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  list(),
154  ["bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"nojump\")|Sorry, don't suppose you've got anything else?",
155  "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"yesjump\")|Yeah, I'm interested."] ))
156  con.addNode(forg, "forgetjump")
157 
158  yes = Node()
159  yes.addSubNode(SubNode( "Great! I can let you have one for just %s. Do you want it now?"%str(JP_DRV_PRICE),
160  list(),
161  ["bases/fixers/no.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"rejectdrive\")|Maybe later.",
162  "bases/fixers/yes.spr|#\nimport quest_intro\nquest_intro.interactWithJenek(\"takedrive\")|Okay."] ))
163  con.addNode(yes, "yesjump")
164 
165  no = Node()
166  no.addSubNode(SubNode( "If it's not about the jump drive I don't have the time. Come back later." ))
167  con.addNode(no, "nojump")
168 
169  tak = Node()
170  tak.addSubNode(SubNode( "I'll send some mechanics to fit it for you now. Nice to see you again!",
171  ["#\nimport quest_intro\nresult = quest_intro.buyDrive()==%s"%str(DRV_SUCCESS)] ))
172  tak.addSubNode(SubNode( "You idiot, you already have a jumpdrive!",
173  ["#\nimport quest_intro\nresult = quest_intro.buyDrive()==%s"%str(DRV_FAIL)] ))
174  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) ))
175  con.addNode(tak, "takedrive")
176 
177  rej = Node()
178  rej.addSubNode(SubNode( "Fine. I may not be around for much longer though." ))
179  con.addNode(rej, "rejectdrive")
180 
181  return con
def quest_intro.haveDrive ( )
Does the player already have a jumpdrive?

Definition at line 91 of file quest_intro.py.

91 
92 def haveDrive():
93  """Does the player already have a jumpdrive?"""
94  if VS.getPlayer().GetJumpStatus()>-2:
95 # when -2 is returned by GetJumpStatus, the player doesn't have a jumpdrive
96  print "TEST: You have a jump drive already!"
97  return 1
98  return 0
def quest_intro.interactWithJenek (   ref = "Root")
Iterates the conversation, allowing for extra events to be launched
during the conversation.

Definition at line 182 of file quest_intro.py.

References getJenekConversation().

183 def interactWithJenek(ref="Root"):
184  """Iterates the conversation, allowing for extra events to be launched
185  during the conversation."""
186  if ref == "nojump" or ref == "rejectdrive":
187  Director.eraseSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,0)
188  Director.pushSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,REFUSED_VALUE)
189  getJenekConversation().iterate(ref)
def quest_intro.okayDrawJenek ( )
Checks if the player is docked to the right planet, and the fixer is still \'around\'.

Definition at line 99 of file quest_intro.py.

References quest.checkSaveValue().

99 
100 def okayDrawJenek():
101  """Checks if the player is docked to the right planet, and the fixer is still \'around\'."""
102  if not quest.checkSaveValue(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,DONE_VALUE):
103  iter = VS.getUnitList()
104  while iter.notDone():
105  if iter.current().isPlanet() and (VS.getPlayer().isDocked(iter.current()) or iter.current().isDocked(VS.getPlayer())):
106 #Not sure why both have to be checked, it seems to second gives a more consistantly correct response
107  return iter.current().getName() == 'Wiley'
108  iter.advance()
109  return 0

Variable Documentation

int DEFAULT_VALUE = 0

Definition at line 11 of file quest_intro.py.

int DONE_VALUE = 3

Definition at line 13 of file quest_intro.py.

int DRV_FAIL = 2

Definition at line 18 of file quest_intro.py.

int DRV_SUCCESS = 1

Definition at line 17 of file quest_intro.py.

string FIXER_NAME = "IntroFixer"

Definition at line 22 of file quest_intro.py.

string FIXER_TEXT = "#\nimport quest_intro\nconversation = quest_intro.getJenekConversation()"

Definition at line 23 of file quest_intro.py.

int JP_DISTANCE = 10000

Definition at line 20 of file quest_intro.py.

int JP_DRV_PRICE = 7000

Definition at line 15 of file quest_intro.py.

int REFUSED_VALUE = 2

Definition at line 12 of file quest_intro.py.

list TRIGGER_MESSAGE = ["[Reminder]","Jenek on Wiley may have a jump drive going cheap."]

Definition at line 9 of file quest_intro.py.

string TRIGGER_SAVE = "IntroJP"

Definition at line 7 of file quest_intro.py.

int TRIGGER_VALUE = 1

Definition at line 8 of file quest_intro.py.