def ShipValue(shipname, used): """Value a ship according to whether it is used or new.""" carg = VS.GetMasterPartList().GetCargo(shipname) price = carg.GetPrice() if used: price *= USED_VALUE return price
def takeCargoAndTerminate(self, you, remove): removenum = 0 #if you terminate without remove, you are SKREWED self.base.setCombatRole(self.role) if (remove): removenum = you.removeCargo(self.cargoname, self.quantity, bool(1)) debug.debug("removed %d" % removenum) mpart = VS.GetMasterPartList() newcarg = mpart.GetCargo(self.cargoname) newcarg.SetQuantity(removenum) #self.base.addCargo(newcarg)#not for resale has = self.you.hasCargo(self.cargoname) if (has): has = self.you.removeCargo(self.cargoname, has, bool(1)) newcarg.SetMissionFlag(0) newcarg.SetQuantity(has) self.you.addCargo( newcarg ) #It seems that removing and then adding it again is the only way... if ((removenum >= self.quantity) or (self.quantity == 0) or removenum >= 1): VS.IOmessage(0, "cargo mission", self.mplay, "#00ff00Excellent work pilot.") VS.IOmessage( 0, "cargo mission", self.mplay, "#00ff00You have been rewarded for your effort as agreed.") VS.IOmessage(0, "cargo mission", self.mplay, "#00ff00Your excellent work will be remembered.") you.addCredits(self.cred) VS.AdjustRelation(you.getFactionName(), self.faction, .01 * self.difficulty, 1) self.SetVar(1) VS.terminateMission(1) return else: VS.IOmessage( 0, "cargo mission", self.mplay, "#ff0000You did not follow through on your end of the deal.") if (self.difficulty < 1): VS.IOmessage(0, "cargo mission", self.mplay, "#ff0000Your pay will be reduced") VS.IOmessage( 0, "cargo mission", self.mplay, "#ff0000And we will consider if we will accept you on future missions." ) addcred = (float(removenum) / (float(self.quantity * (1 + self.difficulty)))) * self.cred you.addCredits(addcred) else: VS.IOmessage(0, "cargo mission", self.mplay, "#ff0000You will not be paid!") universe.punish(self.you, self.faction, self.difficulty) self.SetVar(-1) VS.terminateMission(0) return
def buyDrive(): if haveDrive(): return DRV_FAIL elif VS.getPlayer().getCredits()>=JP_DRV_PRICE: #deducts the required sum VS.getPlayer().addCredits(-JP_DRV_PRICE) #adds the jumpdrive temporarily (will be removed if player upgrades) VS.getPlayer().upgrade("jump_drive",0,0,1,0) #adds the jumpdrive to cargo, making it a permenant upgrade VS.getPlayer().addCargo(VS.GetMasterPartList().GetCargo("jump_drive")) print "TEST: Bought Jump Drive" Director.eraseSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,0) Director.pushSaveData(VS.getPlayer().isPlayerStarship(),TRIGGER_SAVE,DONE_VALUE) return DRV_SUCCESS return 0
def GetRandomArmor(diff): return VS.GetMasterPartList().GetCargo( armorBuildName(1 + diff * (GetDiffInt(diff) * (armorMaxLevel - 1) // 5)))
def loadCargo(): playa.addCargo(VS.GetMasterPartList().GetCargo("PolyDuranium"))