1 from go_to_adjacent_systems
import *
2 from go_somewhere_significant
import *
15 VS.IOmessage (0,
"cargo mission",
"briefing",
"Your mission for today will be to run some %s cargo" % self.
cargoname)
17 self.adjsys.initbriefing()
21 brief_you=self.adjsys.loopbriefing()
23 VS.IOmessage(0,
"cargo mission",
"briefing",
"Once there, you must drop the cargo off at a specified unit")
29 self.adjsys.endbriefing()
33 quest.removeQuest (self.you.isPlayerStarship(),self.
var_to_set,val)
36 carg=VS.getRandCargo(self.
quantity,category)
37 if (carg.GetQuantity()==0
or category==
''):
38 carg = VS.getRandCargo(self.
quantity,
"")
40 while i<50
and (carg.GetCategory()[:10]==
"Contraband" or carg.GetCategory()[:8]==
"upgrades"):
42 carg = VS.getRandCargo(self.
quantity,
"")
45 carg.SetMissionFlag(1)
48 def __init__ (self,factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category,jumps=(),var_to_set=
''):
49 Director.Mission.__init__(self);
61 self.
you=VS.getPlayer()
68 name = self.you.getName ()
69 if (
not self.you.isNull()):
76 for i
in range(self.you.numCargo()):
77 tmpcarg=self.you.GetCargoIndex(i)
78 if (tmpcarg.GetCategory()==category
and tmpcarg.GetMissionFlag())
or self.
cargoname==tmpcarg.GetContent():
79 print category, tmpcarg.GetCategory()
83 newquantity = self.you.addCargo(carg)
88 if found
and tmpcarg.GetMissionFlag():
90 self.
quantity=int(tmpcarg.GetQuantity())
95 print (
"already have "+
str(int(tmpcarg.GetQuantity()))+
" non-mission cargo of this kind "+self.
cargoname)
101 VS.IOmessage (2,
"cargo mission",self.
mplay,
"#ff0000Unable to find suitable %s cargo that is not already loaded. Mission canceled."%category)
102 VS.terminateMission (0)
105 VS.IOmessage (2,
"cargo mission",self.
mplay,
"#ff0000Unable to establish communications. Mission failed.")
106 VS.terminateMission (0)
113 VS.IOmessage (2,
"cargo mission",self.
mplay,
"#ff0000You do not have space to add our %s cargo to your ship. Mission failed."%self.
cargoname)
114 VS.terminateMission(0)
118 VS.IOmessage (2,
"cargo mission",self.
mplay,
"#ff0000You do not have space to add our cargo to the mission. Mission failed.")
119 VS.terminateMission(0)
122 VS.IOmessage (0,
"cargo mission",self.
mplay,
"Your mission is as follows:" )
123 self.adjsys.Print(
"You should start in the system named %s",
"Then jump to %s",
"Finally, jump to %s, your final destination",
"cargo mission",1)
124 VS.IOmessage (2,
"cargo mission",self.
mplay,
"Give the cargo to a %s unit or planet." % (self.
faction))
125 VS.IOmessage (3,
"cargo mission",self.
mplay,
"You will receive %d of the %s cargo" % (self.
quantity,self.
cargoname))
127 VS.IOmessage (4,
"cargo mission",self.
mplay,
"You will earn %.2f credits when you deliver our cargo." % (creds))
128 VS.IOmessage (4,
"cargo mission",self.
mplay,
"#00ff00Good luck!")
133 self.base.setCombatRole(self.
role)
137 mpart=VS.GetMasterPartList()
139 newcarg.SetQuantity(removenum)
143 has=self.you.removeCargo(self.
cargoname,has,1)
144 newcarg.SetMissionFlag(0)
145 newcarg.SetQuantity(has)
146 self.you.addCargo(newcarg)
148 VS.IOmessage (0,
"cargo mission",self.
mplay,
"#00ff00Excellent work pilot.")
149 VS.IOmessage (0,
"cargo mission",self.
mplay,
"#00ff00You have been rewarded for your effort as agreed.")
150 VS.IOmessage (0,
"cargo mission",self.
mplay,
"#00ff00Your excellent work will be remembered.")
151 you.addCredits(self.
cred)
154 VS.terminateMission(1)
157 VS.IOmessage (0,
"cargo mission",self.
mplay,
"#ff0000You did not follow through on your end of the deal.")
159 VS.IOmessage (0,
"cargo mission",self.
mplay,
"#ff0000Your pay will be reduced")
160 VS.IOmessage (0,
"cargo mission",self.
mplay,
"#ff0000And we will consider if we will accept you on future missions.")
162 you.addCredits(addcred)
164 VS.IOmessage (0,
"cargo mission",self.
mplay,
"#ff0000You will not be paid!")
167 VS.terminateMission(0)
178 if (self.you.isNull()
or (self.
arrived and self.base.isNull())):
179 VS.IOmessage (0,
"cargo mission",self.
mplay,
"#ff0000You were unable to deliver cargo. Mission failed.")
181 VS.terminateMission(0)
183 if (
not self.adjsys.Execute()
and not (self.
arrived and self.
base and self.base.isDocked(self.
you))):
186 self.adjsys.Execute=self.adjsys.HaveArrived
187 if (self.base.isDocked(self.
you)):
201 self.adjsys.Print(
"You must visit the %%s %s" % (capstr),
"cargo mission",
", docked around the %s",0)
202 VS.IOmessage(0,
"cargo mission",self.mplay,
"Once there, %s and we will transport the cargo off of your ship." % (dockstr))
203 self.base=self.adjsys.SignificantUnit()
204 self.role=self.base.getCombatRole()
205 self.base.setCombatRole(
"INERT")
206 def initrandom (factionname, missiondifficulty,creds_per_jump, launchoncapship, sysmin, sysmax, time_to_complete, category,jumps=(),var_to_set=
''):
208 return cargo_mission(factionname,numsys, 15, missiondifficulty,creds_per_jump*float(1+numsys),launchoncapship, 10.0, category,jumps,var_to_set)