23 numcargo = un.numCargo()
25 for i
in range(numcargo):
26 carg = un.GetCargoIndex(i)
27 if (len(cat)==0
or catInCatList(carg.GetCategory(),cat)):
28 carg.SetPrice (pr*carg.GetPrice())
29 carg.SetQuantity (int(qr*carg.GetQuantity()))
32 un.removeCargo (carg.GetCategory(),carg.GetQuantity(),1)
41 while (
not un.isNull()):
42 if (un.isPlayerStarship()==-1):
43 isplanet = un.isPlanet()
44 if ( (isplanet
and planets)
or ((
not isplanet)
and ships)):
50 mylen = Director.getSaveDataLength(player,key)
52 Director.putSaveData(player,key,0,val)
54 Director.pushSaveData(player,key,val)
57 """returns a tuple in the format ("[lastsystem]",(system1,system2,system3,...))"""
58 if preferredfaction==
'':
59 preferredfaction=VS.GetGalaxyProperty(currentsystem,
"faction")
60 max=VS.GetNumAdjacentSystems(currentsystem)
61 if ((sysaway<=0)
or (max<=0)):
63 return (currentsystem,jumps)
66 numadj=VS.GetNumAdjacentSystems(currentsystem)
67 for i
in range(numadj):
68 cursys=VS.GetAdjacentSystem(currentsystem,i)
69 if preferredfaction!=
None:
70 if VS.GetGalaxyProperty(cursys,
"faction")!=preferredfaction:
72 if ((cursys
in jumps)
or (cursys == VS.getSystemFile())):
74 syslist.append(cursys)
86 max=VS.GetNumAdjacentSystems(tothissystem);
88 list.append(VS.GetAdjacentSystem(tothissystem,i))
102 i.advanceNJumppoint(0)
104 jp_list.append(i.current())
109 num=un.isPlayerStarship()
116 VS.AdjustRelation(you.getFactionName(),faction,difficulty*-.01,1)
118 VS.IOmessage (0,
"mission",
getMessagePlayer(you),
"#ff0000Your idiocy will be punished.")
119 VS.IOmessage (0,
"mission",
getMessagePlayer(you),
"#ff0000You had better run for what little life you have left.")
120 for i
in range(difficulty):
123 newunit.setFgDirective(
"B")
124 newunit.SetTarget(you)
126 def _tmpint(str,default):
134 iter= VS.getUnitList()
135 iter.advanceNSignificant(0)
136 while (iter.notDone()):
138 debug.debug(
'Found sig unit: '+un.getName()+
' ('+un.getFullname()+
')')
139 if not un.isSignificant():
140 debug.error(
'Unit '+un.getName()+
' ('+un.getFullname()+
') is not significant!')
141 ret.append(iter.current())
142 iter.advanceSignificant()
146 numjmp=VS.GetNumAdjacentSystems(cursys)
147 return _tmpint(VS.GetGalaxyProperty(cursys,
"num_planets"),3)+_tmpint(VS.GetGalaxyProperty(cursys,
"num_moons"),4)+_tmpint(VS.GetGalaxyProperty(cursys,
"num_gas_giants"),2)+_tmpint(VS.GetGalaxyProperty(cursys,
"num_starbases"),1)+numjmp
169 def greet(greetingText,enemy=None,you=None):
170 for i
in range(len(greetingText)):
173 if type(greetingText[i])==tuple:
174 if not len(greetingText[i]):
176 if len(greetingText[i])>1
and greetingText[i][1]:
178 if len(greetingText[i])>2
and greetingText[i][2]
and you:
179 VS.playSound(greetingText[i][2],(0.,0.,0.),(0.,0.,0.))
181 you.communicateTo(enemy,-1)
184 text=greetingText[i][0]
186 fromname=enemy.getFlightgroupName()+
", "+enemy.getName()+
"#000000"
188 fromname=
"[Unidentified]"
193 VS.IOmessage (8+i*4,color+fromname,toname,
"#ff0000"+text+
"#000000")
196 iter = VS.getUnitList()
197 while iter.notDone():
198 if VS.getPlayer().isDocked(iter.current())
or iter.current().isDocked(VS.getPlayer()):
199 return iter.current()
201 return iter.current()
206 return (un.getName(),un.getFullname())
216 if not sys
in closed:
224 sys=VS.getSystemFile()
225 if (VS.GetGalaxyProperty(
"Sol/Sol",
"jumps")!=
"" and VS.GetGalaxyProperty(
"Sol/Sol",
"faction")!=
""):
232 upgrades=faction_ships.earnable_upgrades[level]
240 debug.debug(
"getting significant for upgrade addage")
242 for upgrade
in upgrades:
244 debug.debug(
"Upgrade list not big enough to add to tech")
249 cp = VS.getCurrentPlayer()
250 siz = Director.getSaveStringLength(cp,
"master_part_list_content")
252 for index
in range (siz):
253 if (Director.getSaveString(cp,
"master_part_list_content",index)==upgrade[0]):
256 debug.debug(
"added UPGRADE AS FOLLOWS to tech level ")
258 Director.pushSaveString(cp,
"master_part_list_content",
str(upgrade[0]))
259 Director.pushSaveString(cp,
"master_part_list_category",
str(upgrade[1]))
260 Director.pushSaveString(cp,
"master_part_list_price",
str(upgrade[2]))
261 Director.pushSaveString(cp,
"master_part_list_mass",
str(upgrade[3]))
262 Director.pushSaveString(cp,
"master_part_list_volume",
str(upgrade[4]))
264 Director.pushSaveString(cp,
"master_part_list_description",
str(upgrade[5]))
266 Director.pushSaveString(cp,
"master_part_list_description",
"No description")
267 if (bas
and addToBase):
268 debug.debug(
" adding "+
str(upgrade[0]) +
" to base "+bas.getName())
269 cargo=VS.Cargo(
str(upgrade[0]),
str(upgrade[1]),float(upgrade[2]),1,float(upgrade[3]),float(upgrade[4]))
270 bas.forceAddCargo(cargo)