9 if name==
'directions_mission':
13 elif name==
'bounty_leader':
15 elif name==
'bounty_troop':
19 elif name==
'cargo_mission':
21 elif name==
'wrong_escort':
23 elif name==
'cleansweep':
25 elif name==
'cleansweep_escort':
29 elif name==
'escort_local':
31 elif name==
'escort_mission':
33 elif name==
'patrol_ambush':
35 elif name==
'patrol_enemies':
45 elif name==
'tripatrol':
47 elif name==
'ambush_scan':
50 print 'Unsupported mission type'
53 return mission.isValid()
64 def __init__(self, nextarg=None, value=NoDefault()):
70 def set(self, newvalue):
78 if isinstance(self.
value, NoDefault):
79 self.
warn(
"No default exists for unset argument")
81 elif isinstance(self.
value, Default):
86 valid = valid
or arg.isValid()
95 self.warnings.append(text)
99 print "\'%s\' Argument Warning: "%self.
NAME + warning
106 if isinstance(self.
value,long)
or isinstance(self.
value,int):
108 self.
warn(
"Value %s is not a positive integer"%
str(self.
value))
111 self.
warn(
"Value %s is not an integer, much less positive."%
str(self.
value))
117 NAME=
"PositiveIntList"
120 if isinstance(self.
value,list):
121 for val
in self.
value:
122 if isinstance(val,long)
or isinstance(val,int):
124 self.
warn(
"Value %s is not a positive integer"%
str(val))
127 self.
warn(
"Value %s is not an integer, much less positive."%
str(val))
130 self.
warn(
"Value %s is not a list, much less a list of integers."%
str(self.
value))
136 NAME=
"PositiveFraction"
139 if not isinstance(self.
value,float)
or self.
value < 0
or self.
value > 1:
142 self.
warn(
"Value %s is not a positive fraction"%
str(self.
value))
151 if not isinstance(self.
value,str):
158 NAME=
"PositiveNumber"
161 if not (isinstance(self.
value,float)
or isinstance(self.
value,int))
or self.
value < 0:
162 self.
warn(
"Value is not a positive number")
171 if isinstance(self.
value,long)
or isinstance(self.
value,int):
176 self.
warn(
"Value %s is not an integer, much less 0"%
str(self.
value))
184 v = ( VS.universe.has_key(self.
value) )
186 self.
warn(
"System %s does not exist in universe"%self.
value)
195 for sys
in self.
value:
196 v = ( VS.universe.has_key(sys) )
198 self.
warn(
"System %s does not exist in universe"%sys)
207 self.
warn(
"No way to test destination exists")
216 campvar=self.value.find(
"_mission")
217 if campvar!=-1
and self.
value[0:campvar]
in campaign_name:
219 elif self.value.find(
"visited_") == 0:
221 if temparg.isValid():
223 elif self.
value==
"menesch_dead" or self.
value==
"jones_dead" or self.
value==
"awacs_escort":
233 if self.
value not in VS._factions:
234 self.
warn(
"'%s' is not a valid faction"%self.
value)
242 if type(self.
value)!=type(())
and type(self.
value)!=type([]):
245 for value
in self.
value:
246 if value
not in VS._factions:
247 self.
warn(
"'%s' is not a valid faction"%value)
256 if type(self.
value)!=type(())
and type(self.
value)!=type([]):
264 NAME=
"ShipFactionPair"
267 if not isinstance(self.
value,tuple):
268 self.
warn(
"is not a tuple")
270 if len(self.
value) != 2:
271 self.
warn(
"%s does not have a length of 2")
273 if self.
value[0]
not in faction_ships.stattable.keys():
274 self.
warn(
"%s is not a valid shiptype")%
str(self.
value[0])
276 if self.
value[1]
not in VS._factions:
277 self.
warn(
"%s is not a valid faction")%
str(self.
value[1])
286 if type(self.
value)==type(
""):
288 for val
in self.
value:
289 if val
not in VS._factions:
290 self.
warn(
"%s is not a valid faction"%val)
299 if self.
value not in faction_ships.stattable.keys():
309 if type(self.
value)==type(
""):
311 for val
in self.
value:
312 if val
not in faction_ships.stattable.keys():
313 self.
warn(
"%s is not a valid shiptype"%val)
320 for value
in self.
value:
322 if temparg.isValid():
332 if not isinstance(self.
value,list):
335 for item
in self.
value:
336 if not isinstance(item,str):
337 if isinstance(item,tuple):
339 if not isinstance(item[0],str)
and isinstance(item[1],type(
bool(
True))):
340 self.
warn(
"item is not a (str,bool) pair")
343 if not (isinstance(item[0],str)
and isinstance(item[1],type(
bool(
True)))
and isinstance(item[2],str)):
344 self.
warn(
"item %s is not a (str,bool,str) triplet"%
str(item))
349 self.
warn(
"item %s has too many entries"%
str(item))
352 self.
warn(
"is not a list of strings")
366 self.
warn(
"is not a boolean type")
388 givenargs =
not len(newargs) == 0
391 if len(newargs) > len(self.
args):
392 raise RuntimeError(
"More arguments given than this object supports")
394 for i
in range(len(newargs)):
395 self.
args[i].set(newargs[i])
405 print "Mission Warning: " + text
408 MISSION_ARGS=[
SaveVar(),
SystemTuple(
System()),
PositiveNumber(),
FactionList(),
PositiveInt(
PositiveIntList()),
ShipType(
ShipTypeList(
Empty()),
Default()),
DynFG(
None,
Default()),
TextList(
None,
Default()),
SystemTuple(
None,
Default()),
Destination(
None,
Default()),
Boolean(
None,
Default())]
411 MISSION_ARGS=[
PositiveInt(),
PositiveInt(),
PositiveInt(),
Boolean(),
PositiveInt(),
Faction(),
SystemTuple(
None,
Default()),
SaveVar(
None,
Default()),
DynFG(
None,
Default()),
ShipType(
Empty(),
Default()),
Boolean(
None,
Default()),
DynFG(
None,
Default()),
ShipType(
ShipFactionPair(
Empty()),
Default()),
TextList(
None,
Default()),
Argument(
None,
Default())]
414 MISSION_ARGS=[
PositiveInt(),
PositiveInt(),
PositiveInt(),
Boolean(),
PositiveInt(),
Faction(),
SystemTuple(
None,
Default()),
SaveVar(
None,
Default()),
DynFG(
None,
Default()),
ShipType(
Empty(),
Default()),
Boolean(
None,
Default()),
DynFG(
None,
Default()),
ShipType(
ShipFactionPair(
Empty()),
Default()),
TextList(
None,
Default()),
Argument(
None,
Default()),
PositiveInt(
None,
Default()),
PositiveInt(
None,
Default()),
PositiveInt(
None,
Default())]
417 MISSION_ARGS=[
PositiveInt(),
PositiveInt(),
PositiveInt(),
Boolean(),
PositiveInt(),
Faction(),
SystemTuple(
None,
Default()),
SaveVar(
None,
Default()),
DynFG(
None,
Default()),
ShipType(
Empty(),
Default()),
Boolean(
None,
Default()),
TextList(
None,
Default())]
420 MISSION_ARGS=[
Faction(),
PositiveInt(),
PositiveInt(),
PositiveInt(),
PositiveInt(),
Boolean(),
PositiveInt(),
Argument(),
SystemTuple(
None,
Default()),
SaveVar(
None,
Default())]
423 MISSION_ARGS=[
PositiveInt(),
PositiveInt(),
PositiveNumber(),
PositiveInt(),
SystemTuple(),
SaveVar(),
PositiveInt(),
PositiveInt(),
PositiveFraction(),
PositiveFraction(),
Faction(
FactionList()),
Boolean(),
Boolean()]
426 MISSION_ARGS=[
PositiveInt(),
PositiveInt(),
PositiveNumber(),
PositiveInt(),
SystemTuple(),
SaveVar(),
PositiveInt(),
PositiveInt(),
PositiveFraction(),
PositiveFraction(),
Faction(),
Boolean(),
Boolean(),
Faction(),
TextList(
None,
Default()),
PositiveInt(
None,
Default()),
TextList(
None,
Default())]
429 MISSION_ARGS=[
Faction(),
PositiveInt(),
PositiveInt(),
PositiveNumber(),
PositiveNumber(),
PositiveInt(),
Boolean(),
Boolean(),
Faction(
None,
Default()),
SystemTuple(
None,
Default()),
SaveVar(
None,
Default()),
DynFG(
None,
Default()),
ShipType(
Empty(),
Default()),
ShipType(
Empty(),
Default()),
PositiveInt(
None,
Default()),
TextList(
None,
Default())]
431 MISSION_ARGS=[
ShipType(
Empty()),
Faction(),
System(),
ShipType(),
Faction(),
PositiveInt(),
Faction(),
SystemTuple(),
SaveVar(
Empty(),
Default()),
TextList(
None,
Default())]
437 MISSION_ARGS=[
Faction(),
PositiveInt(),
PositiveInt(),
PositiveInt(),
PositiveNumber(),
PositiveInt(),
Boolean(),
Faction(
Empty(),
Default()),
SystemTuple(
Empty(),
Default()),
SaveVar(
Empty(),
Default()),
DynFG(
Empty(),
Default()),
ShipType(
Empty(),
Default()),
DynFG(
Empty(),
Default()),
ShipType(
Empty(),
Default()),
TextList(
String(),
Default())]
440 MISSION_ARGS=[
Faction(),
PositiveInt(),
PositiveNumber(),
PositiveNumber(),
PositiveNumber(),
PositiveInt(),
ZeroInt(),
PositiveInt(),
SystemTuple(),
SaveVar(
Empty(),
Default()),
DynFG(
Empty(),
Default()),
ShipType(
Empty(),
Default())]
443 MISSION_ARGS=[
Faction(),
PositiveInt(),
PositiveNumber(),
PositiveNumber(),
PositiveInt(),
SystemTuple(),
SaveVar(
Empty(),
Default()),
DynFG(
Empty(),
Default()),
ShipType(
None,
Default()),
SystemTuple(
None,
Default()),
FactionTuple(
None,
Default()),
DynFGTuple(
None,
Default()),
ShipTypeList(
None,
Default()),
TextListTuple(
String(),
Default()),
SaveVar(
Empty(),
Default())]
446 MISSION_ARGS=[
PositiveInt(),
PositiveNumber(),
PositiveInt(),
SaveVar(),
SystemTuple(),
PositiveInt(),
Faction(),
PositiveInt(),
ShipType(
Empty(),
Default()),
DynFG(
Empty(),
Default()),
TextList(
String(),
Default()),
SystemTuple(
Empty(),
Default()),
Destination(
Empty(),
Default())]
449 MISSION_ARGS=[
PositiveInt(),
PositiveInt(),
PositiveNumber(),
PositiveInt(),
SystemTuple(),
SaveVar(),
PositiveInt(),
PositiveInt(),
PositiveFraction(),
PositiveFraction(),
Faction(),
Boolean()]
458 MISSION_ARGS=[
PositiveInt(),
PositiveInt(),
Faction(),
PositiveInt(),
Faction(),
DynFG(
Empty(),
Default()),
SystemTuple(
Empty(),
Default()),
SaveVar(
Empty(),
Default())]
461 MISSION_ARGS=[
SaveVar(),
PositiveInt(),
SystemTuple(),
PositiveNumber(),
PositiveNumber(),
Faction(),
Faction(),
DynFG(),
DynFG(),
PositiveInt(
None,
Default()),
ShipType(
Empty(),
Default()),
ShipType(
Empty(),
Default()),
DynFG(
None,
Default()),
DynFG(
None,
Default()),
TextList(
None,
Default()),
TextList(
None,
Default()),
TextList(
None,
Default())]
464 MISSION_ARGS=[
PositiveInt(),
PositiveInt(),
PositiveNumber(),
PositiveInt(),
SystemTuple(),
SaveVar(),
PositiveInt(),
PositiveInt(),
PositiveFraction(),
PositiveFraction(),
Faction(
FactionList()),
Boolean(),
Boolean(),
TextList()]
466 MISSION_ARGS=[
SaveVar(),
SystemTuple(
System()),
PositiveNumber(),
FactionList(),
PositiveInt(
PositiveIntList()),
ShipType(
ShipTypeList(
Empty()),
Default()),
DynFG(
None,
Default()),
TextList(
None,
Default()),
SystemTuple(
None,
Default()),
Destination(
None,
Default()),
Boolean(
None,
Default()),
String(),
TextList(
None,
Default())]