def __init__( self, num_significants_to_patrol, distance_from_base, creds, savevar, systems, delay, faction, numenemies, dyntype='', dynfg='', greetingText=[ "Hello there, smuggler. Prepare to die!", "The price on your head is big enough that I missed my lunch" ], directions=[], destination=''): ambush.ambush.__init__(self, savevar, systems, delay, faction, numenemies, dyntype, dynfg, greetingText, directions, destination) self.jnum = 0 self.cred = creds self.patrolpoints = [] self.objectives = [] self.distance = distance_from_base you = VS.getPlayer() self.quantity = num_significants_to_patrol name = you.getName() self.mplay = universe.getMessagePlayer(you) self.AdjustFaction = False
def __init__(self, numsystemsaway, num_significants_to_patrol, scan_object_distance, creds, jumps=(), donevar='', scan_objects=None): Director.Mission.__init__(self) if scan_objects is None or type(scan_objects) != dict or len( scan_objects) == 0: scan_objects = None else: scan_objects.setdefault("exceptall", []) scan_objects.setdefault("except", []) scan_objects.setdefault("addall", []) scan_objects.setdefault("add", []) self.scan_objects = scan_objects #If not None, do not randomly select significants, instead select them from this dictionary. self.donevar = donevar self.jnum = 0 self.cred = creds self.patrolpoints = [] self.objectives = [] self.distance = scan_object_distance self.you = VS.getPlayer() self.quantity = num_significants_to_patrol name = self.you.getName() self.mplay = universe.getMessagePlayer(self.you) VS.IOmessage(0, "patrol", self.mplay, "Greetings, %s. You must patrol a system for us :" % name) self.adjsys = go_to_adjacent_systems(self.you, numsystemsaway, jumps) self.adjsys.Print("From the %s system,", "Carefully go to %s.", "You should shortly arrive in the %s: patrol it.", "patrol", 1)
def Print(self,beginstr,midstr,endstr,fro,wait=0): msgply=universe.getMessagePlayer(self.you) if (len(self.jumps)>0): VS.IOmessage(wait,fro,msgply,beginstr % (formatSystemName(VS.getSystemFile()))) for i in range(len(self.jumps)-1): VS.IOmessage(wait,fro,msgply,midstr % (formatSystemName(self.jumps[i]))) VS.IOmessage(wait,fro,msgply,endstr % (formatSystemName(self.jumps[len(self.jumps)-1])))
def __init__ (self, minnumsystemsaway, maxnumsystemsaway, creds, run_away, shipdifficulty, tempfaction, jumps=(), var_to_set='', namefg='', dyntype="", displayLocation=1, greetingText=['It appears we have something in common, privateer.','My name may be on your list, but now your name is on mine.'], dockable_unit=False): Director.Mission.__init__ (self) self.firsttime=VS.GetGameTime() self.newship=dyntype self.namefg=namefg self.mplay="all" self.var_to_set = var_to_set self.istarget=0 self.obj=0 self.curiter=0 self.arrived=0 self.faction = tempfaction self.difficulty = shipdifficulty self.runaway=run_away self.greetingText=greetingText self.cred=creds mysys=VS.getSystemFile() sysfile = VS.getSystemFile() self.you=VS.getPlayer() #debug.debug("VS.Unit()") self.enemy=VS.Unit() self.adjsys=go_to_adjacent_systems (self.you,vsrandom.randrange(minnumsystemsaway,maxnumsystemsaway+1),jumps) self.dockable_unit=dockable_unit self.mplay=universe.getMessagePlayer(self.you) self.displayLocation=displayLocation if (self.you): VS.IOmessage (0,"bounty mission",self.mplay,"[Computer] Bounty Mission Objective: (%.2f Credits)" % self.cred) self.adjsys.Print("From %s system","Procede to %s","Search for target at %s, your final destination","bounty mission",1) VS.IOmessage (1,"bounty mission",self.mplay,"Target is a %s unit." % (self.faction)) else: default.info("aboritng bounty constructor...") VS.terminateMission (0)
def __init__(self, savevar, jumps=(), destination=''): Director.Mission.__init__(self) debug.info("Directions Mission: Starting") global isambushrunning self.var = savevar self.savedCargo = self.getCargo(VS.getPlayer()) debug.debug("self.savedCargo: %s" % (str(self.savedCargo))) if (self.var, self.savedCargo) in isambushrunning: #VS.terminateMission(0) debug.info( "Directions Mission: Stopping: directions already running! (before mission restore)" ) isambushrunning[(self.var, self.savedCargo)] = True self.jumps = jumps debug.debug("Directions Mission: self.cp = %s" % (VS.getCurrentPlayer())) self.cp = VS.getCurrentPlayer() self.you = VS.Unit() self.base = VS.Unit() self.arrived = 0 self.destination = destination self.mplay = "all" self.dir_privateSetupPlayer(self.cp) self.mplay = universe.getMessagePlayer(self.you) self.obj = 0 name = self.you.getName()
def __init__ (self, creds, faction, quantity, category, returntobase, var_when_done=''): Director.Mission.__init__ (self) self.newship="" self.mplay="all" self.obj=0 self.enemy=VS.Unit() self.curiter=0 self.content="" self.quantity=quantity self.arrived=0 self.faction = faction self.cred=creds self.category=category self.donevar=var_when_done sysfile = VS.getSystemFile() self.newship=faction_ships.getRandomFighter('merchant') self.you=VS.getPlayer() self.pos=self.you.Position() self.gosig=go_somewhere_significant(self.you,0,10000.) self.mplay=universe.getMessagePlayer(self.you) if (self.you): VS.IOmessage (0,"plunder mission",self.mplay,"Your mission is to destroy a %s merchant unit." % (self.newship)) VS.IOmessage (1,"plunder mission",self.mplay,"It is orbiting around the %s planet in the system." % (unit.getUnitFullName(self.gosig.SignificantUnit()))) VS.IOmessage (2,"plunder mission",self.mplay,"After it is destroyed, pick up all %s cargo that got ejected."%self.category) VS.IOmessage (3,"plunder mission",self.mplay,"Then return to a %s base with your cargo. #00ff00Good luck!"%self.faction) else: print("aboritng plunder constructor...") VS.terminateMission (0)
def __init__(self, factionname, numsystemsaway, enemyquantity, distance_from_base, escape_distance, creds, defendthis, defend_base, protectivefactionname='', jumps=(), var_to_set='', dynamic_flightgroup='', dynamic_type='', dynamic_defend_fg='', waves=0, greetingText=[ 'We will defeat your assets in this battle, privateer...', 'Have no doubt!' ]): Director.Mission.__init__(self) self.dedicatedattack = vsrandom.randrange(0, 2) self.arrived = 0 self.waves = waves self.greetingText = greetingText self.protectivefaction = protectivefactionname self.var_to_set = var_to_set self.quantity = 0 self.mplay = "all" self.defendbase = defend_base self.dynatkfg = dynamic_flightgroup self.dynatktype = dynamic_type self.dyndeffg = dynamic_defend_fg self.attackers = [] self.objective = 0 self.targetiter = 0 self.ship_check_count = 0 self.defend = defendthis self.defend_base = defend_base self.faction = factionname self.escdist = escape_distance minsigdist = unit.minimumSigDistApart() if (minsigdist * .5 < self.escdist): self.escdist = minsigdist self.cred = creds self.respawn = 0 self.quantity = enemyquantity self.savedquantity = enemyquantity self.distance_from_base = distance_from_base self.defendee = VS.Unit() self.difficulty = 1 self.you = VS.getPlayer() name = self.you.getName() self.mplay = universe.getMessagePlayer(self.you) self.adjsys = go_to_adjacent_systems(self.you, numsystemsaway, jumps) self.adjsys.Print("You are in the %s system,", "Proceed swiftly to %s.", "Your arrival point is %s.", "defend", 1) VS.IOmessage(2, "defend", self.mplay, "And there eliminate any %s starships." % self.faction)
def __init__ (self,minnumsystemsaway, maxnumsystemsaway, creds, run_away, shipdifficulty, tempfaction,jumps=(),var_to_set='',dynfg='',dyntype="",displayLocation=1,greetingText=['It appears we have something in common, privateer.','My name may be on your list, but now your name is on mine.'],dockable_unit=False): Director.Mission.__init__ (self) self.firsttime=VS.GetGameTime() self.newship=dyntype self.dynfg=dynfg self.mplay="all" self.var_to_set = var_to_set self.istarget=0 self.obj=0 self.curiter=0 self.arrived=0 self.faction = tempfaction self.difficulty = shipdifficulty self.runaway=run_away self.greetingText=greetingText self.cred=creds mysys=VS.getSystemFile() sysfile = VS.getSystemFile() self.you=VS.getPlayer() self.enemy=VS.Unit() self.adjsys=go_to_adjacent_systems (self.you,vsrandom.randrange(minnumsystemsaway,maxnumsystemsaway+1),jumps) self.dockable_unit=dockable_unit self.mplay=universe.getMessagePlayer(self.you) self.displayLocation=displayLocation if (self.you): VS.IOmessage (0,"bounty mission",self.mplay,"[Computer] Bounty Mission Objective: (%.2f Credits)" % self.cred) self.adjsys.Print("From %s system","Procede to %s","Search for target at %s, your final destination","bounty mission",1) VS.IOmessage (1,"bounty mission",self.mplay,"Target is a %s unit." % (self.faction)) else: print "aboritng bounty constructor..." VS.terminateMission (0)
def __init__(self, helpship, helpfac, helpsystem, attackship, attackfac, numgood, goodfac, jumps, var_to_set='', helptext=[]): Director.Mission.__init__(self) self.firsttime = VS.GetGameTime() self.lastjump = "Gemini/Blockade_Point_Tango" if (jumps): if (len(jumps)): self.lastjump = jumps[-1] self.jumpingtime = VS.GetGameTime() self.newshiphelp = helpship self.newshipattack = attackship self.newshipgood = '' self.mplay = "all" self.var_to_set = var_to_set self.istarget = 0 self.obj = 0 self.curiter = 0 self.arrived = 0 self.helpfaction = helpfac self.helpsystem = helpsystem self.goodfaction = goodfac self.attackfaction = attackfac self.numgood = numgood self.runaway = False self.greetingText = helptext self.cred = 0 mysys = VS.getSystemFile() sysfile = VS.getSystemFile() self.you = VS.getPlayer() self.enemy = VS.Unit() self.helperpos = (0, 0, 0) self.helper = VS.Unit() self.adjsys = go_to_adjacent_systems(self.you, 0, jumps) self.mplay = universe.getMessagePlayer(self.you) self.displayLocation = True if (self.you): VS.IOmessage( 0, "defend mission", self.mplay, "[Computer] Defend Mission Objective: (%.2f Credits)" % self.cred) self.adjsys.Print( "From %s system", "Procede to %s", "Search for target at %s, your final destination", "defend mission", 1) VS.IOmessage(1, "defend mission", self.mplay, "Target is a %s unit." % (self.attackfaction)) else: debug.info("aborting defend_drone constructor...") VS.terminateMission(0)
def Print(self, beginstr, midstr, endstr, fro, wait=0): msgply = universe.getMessagePlayer(self.you) if (len(self.jumps) > 0): VS.IOmessage(wait, fro, msgply, beginstr % (formatSystemName(VS.getSystemFile()))) for i in range(len(self.jumps) - 1): VS.IOmessage(wait, fro, msgply, midstr % (formatSystemName(self.jumps[i]))) VS.IOmessage( wait, fro, msgply, endstr % (formatSystemName(self.jumps[len(self.jumps) - 1])))
def __init__ (self, num_significants_to_patrol, distance_from_base, creds, savevar,systems,delay,faction,numenemies,dyntype='',dynfg='',greetingText=["Hello there, smuggler. Prepare to die!", "The price on your head is big enough that I missed my lunch"],directions=[],destination=''): ambush.ambush.__init__(self,savevar,systems,delay,faction,numenemies,dyntype,dynfg,greetingText,directions,destination) self.jnum=0 self.cred=creds self.patrolpoints = [] self.objectives = [] self.distance = distance_from_base you = VS.getPlayer() self.quantity=num_significants_to_patrol name = you.getName () self.mplay=universe.getMessagePlayer(you) self.AdjustFaction=False
def __init__ (self,numsystemsaway, num_significants_to_patrol, distance_from_base, creds, jumps=(), donevar=''): Director.Mission.__init__(self) self.donevar=donevar self.jnum=0 self.cred=creds self.patrolpoints = [] self.objectives = [] self.distance = distance_from_base self.you = VS.getPlayer() self.quantity=num_significants_to_patrol name = self.you.getName () self.mplay=universe.getMessagePlayer(self.you) VS.IOmessage (0,"patrol",self.mplay,"You must patrol a system for us :") self.adjsys = go_to_adjacent_systems(self.you,numsystemsaway,jumps) self.adjsys.Print("From the %s system,","Carefully go to %s.","You should shortly arrive in the %s: patrol it.","patrol",1)
def __init__ (self, creds,numsysaway, fac,numenemy,enfac,enfg='', jumps=(),var_when_done=''): Director.Mission.__init__ (self) self.arrived=0 self.faction = fac self.enfaction=enfac self.enflightgroup=enfg self.cred=creds self.donevar=var_when_done self.you = VS.getPlayer() self.mplay=universe.getMessagePlayer(self.you) self.adjsys = go_to_adjacent_systems.go_to_adjacent_systems(self.you,numsysaway,jumps) self.numenemy=numenemy self.eject=None self.enemy=None self.numejectors=0 self.obj=0
def __init__(self, creds, faction, quantity, category, returntobase, var_when_done=''): Director.Mission.__init__(self) self.newship = "" self.mplay = "all" self.obj = 0 self.enemy = VS.Unit() self.curiter = 0 self.content = "" self.quantity = quantity self.arrived = 0 self.faction = faction self.cred = creds self.category = category self.donevar = var_when_done sysfile = VS.getSystemFile() self.newship = faction_ships.getRandomFighter('merchant') self.you = VS.getPlayer() self.pos = self.you.Position() self.gosig = go_somewhere_significant(self.you, 0, 10000.) self.mplay = universe.getMessagePlayer(self.you) if (self.you): VS.IOmessage( 0, "plunder mission", self.mplay, "Your mission is to destroy a %s merchant unit." % (self.newship)) VS.IOmessage( 1, "plunder mission", self.mplay, "It is orbiting around the %s planet in the system." % (unit.getUnitFullName(self.gosig.SignificantUnit()))) VS.IOmessage( 2, "plunder mission", self.mplay, "After it is destroyed, pick up all %s cargo that got ejected." % self.category) VS.IOmessage( 3, "plunder mission", self.mplay, "Then return to a %s base with your cargo. #00ff00Good luck!" % self.faction) else: print "aboritng plunder constructor..." VS.terminateMission(0)
def __init__ (self,factionname,numsystemsaway, enemyquantity, distance_from_base, escape_distance, creds, defendthis, defend_base,protectivefactionname='',jumps=(),var_to_set='',dynamic_flightgroup='',dynamic_type='', dynamic_defend_fg='',waves=0, greetingText=['We will defeat your assets in this battle, privateer...','Have no doubt!']): Director.Mission.__init__(self) self.dedicatedattack=vsrandom.randrange(0,2) self.arrived=0 self.waves=waves; self.greetingText=greetingText self.protectivefaction = protectivefactionname self.var_to_set=var_to_set self.quantity=0 self.mplay="all" self.defendbase = defend_base self.dynatkfg = dynamic_flightgroup self.dynatktype = dynamic_type self.dyndeffg = dynamic_defend_fg self.attackers = [] self.objective= 0 self.targetiter = 0 self.ship_check_count=0 self.defend = defendthis self.defend_base = defend_base self.faction = factionname self.escdist = escape_distance minsigdist=unit.minimumSigDistApart() if (minsigdist*.5<self.escdist): self.escdist = minsigdist self.cred=creds self.respawn=0 self.quantity=enemyquantity self.savedquantity=enemyquantity self.distance_from_base=distance_from_base self.defendee=VS.Unit() self.difficulty=1 self.you=VS.getPlayer() self.younum=VS.getCurrentPlayer() name = self.you.getName () self.mplay=universe.getMessagePlayer(self.you) self.adjsys = go_to_adjacent_systems(self.you,numsystemsaway,jumps) self.adjsys.Print("You are in the %s system,","Proceed swiftly to %s.","Your arrival point is %s.","defend",1) VS.IOmessage (2,"defend",self.mplay,"And there eliminate any %s starships." % self.faction) self.key=str(VS.getCurrentPlayer())+str(factionname)+str(numsystemsaway)+str(enemyquantity)+str(distance_from_base)+str(escape_distance)+str(creds)+str(defendthis)+str(defend_base)+str(protectivefactionname)+str(jumps)+str(var_to_set)+str(dynamic_flightgroup)+str(dynamic_type)+str(dynamic_defend_fg)+str(waves)+str(greetingText); global running_defend_missions running_defend_missions[self.key]=0 self.run_def_mis=0
def __init__(self, factionname, numsystemsaway, enemyquantity, waves, distance_from_base, creds, incoming, protectivefactionname='', jumps=(), var_to_set='', dynamic_attack_fg='', dynamic_type='', dynamic_defend_fg='', dynamic_defend_type='', greetingText=['Escort: give up while you still can...', 'If you let us ravage our target then we grant you passage today.']): Director.Mission.__init__(self) self.greetingText = greetingText self.dedicatedattack = vsrandom.randrange(0, 2)*vsrandom.randrange(0, 2) if (VS.GetRelation(factionname, protectivefactionname) >= 0.0): self.dedicatedattack = 1 self.arrived = 0 self.launchedfriend = 0 self.protectivefaction = protectivefactionname self.var_to_set = var_to_set self.quantity = 0 self.mplay = "all" self.gametime = VS.GetGameTime() self.waves = waves self.incoming = incoming self.dynatkfg = dynamic_attack_fg self.dynatktype = dynamic_type self.dyndeffg = dynamic_defend_fg self.dyndeftype = dynamic_defend_type self.attackers = [] self.objective = 0 self.targetiter = 0 self.ship_check_count = 0 self.faction = factionname self.jp = VS.Unit() self.cred = creds self.quantity = enemyquantity self.savedquantity = enemyquantity self.distance_from_base = distance_from_base self.defendee = VS.Unit() self.difficulty = 1 self.you = VS.getPlayer() self.respawn = 0 name = self.you.getName() self.successdelay = 0 self.mplay = universe.getMessagePlayer(self.you) self.adjsys = go_to_adjacent_systems(self.you, numsystemsaway, jumps) VS.IOmessage(0, "escort mission", self.mplay, "Good Day, %s. Your mission is as follows:" % name) self.adjsys.Print("You are in the %s system,", "Proceed swiftly to %s.", "Your arrival point is %s.", "escort mission", 1)
def __init__ (self,helpship,helpfac,helpsystem,attackship,attackfac,numgood,goodfac,jumps,var_to_set='',helptext=[]): Director.Mission.__init__ (self) self.firsttime=VS.GetGameTime() self.lastjump="Gemini/Blockade_Point_Tango" if (jumps): if (len(jumps)): self.lastjump=jumps[-1] self.jumpingtime=VS.GetGameTime() self.newshiphelp=helpship self.newshipattack=attackship self.newshipgood='' self.mplay="all" self.var_to_set = var_to_set self.istarget=0 self.obj=0 self.curiter=0 self.arrived=0 self.helpfaction = helpfac self.helpsystem = helpsystem self.goodfaction = goodfac self.attackfaction = attackfac self.numgood=numgood self.runaway=False self.greetingText=helptext self.cred=0 mysys=VS.getSystemFile() sysfile = VS.getSystemFile() self.you=VS.getPlayer() self.enemy=VS.Unit() self.helperpos=(0,0,0) self.helper=VS.Unit() self.adjsys=go_to_adjacent_systems (self.you,0,jumps) self.mplay=universe.getMessagePlayer(self.you) self.displayLocation=True if (self.you): VS.IOmessage (0,"defend mission",self.mplay,"[Computer] Defend Mission Objective: (%.2f Credits)" % self.cred) self.adjsys.Print("From %s system","Procede to %s","Search for target at %s, your final destination","defend mission",1) VS.IOmessage (1,"defend mission",self.mplay,"Target is a %s unit." % (self.attackfaction)) else: debug.info("aborting defend_drone constructor...") VS.terminateMission (0)
def __init__ (self,factionname,numsystemsaway, enemyquantity, waves, distance_from_base, creds, incoming, protectivefactionname='',jumps=(),var_to_set='',dynamic_flightgroup='',dynamic_type='', dynamic_defend_fg='',dynamic_defend_type='',greetingText=['Escort: give up while you still can...','If you let us ravage our target then we grant you passage today.']): Director.Mission.__init__(self) self.greetingText=greetingText self.dedicatedattack=vsrandom.randrange(0,2)*vsrandom.randrange(0,2) if (VS.GetRelation(factionname,protectivefactionname)>=0.0): self.dedicatedattack=1 self.arrived=0 self.todock=VS.Unit() self.launchedfriend=0 self.protectivefaction = protectivefactionname self.var_to_set=var_to_set self.quantity=0 self.mplay="all" self.gametime=VS.GetGameTime() self.waves=waves self.incoming=incoming self.dynatkfg = dynamic_flightgroup self.dynatktype = dynamic_type self.dyndeffg = dynamic_defend_fg self.dyndeftype = dynamic_defend_type self.attackers = [] self.objective= 0 self.targetiter = 0 self.ship_check_count=0 self.faction = factionname self.jp=VS.Unit() self.cred=creds self.quantity=enemyquantity self.savedquantity=enemyquantity self.distance_from_base=distance_from_base self.defendee=VS.Unit() self.difficulty=1 self.you=VS.getPlayer() self.respawn=0 name = self.you.getName () self.successdelay=0 self.objectivezero=0 self.mplay=universe.getMessagePlayer(self.you) self.adjsys = go_to_adjacent_systems(self.you,numsystemsaway,jumps) VS.IOmessage (0,"escort mission",self.mplay,"Your mission is as follows:") self.adjsys.Print("You are in the %s system,","Proceed swiftly to %s.","Your arrival point is %s.","escort mission",1)
def __init__ (self,savevar,jumps=(),destination=''): Director.Mission.__init__(self); print('Directions: Starting') global isambushrunning self.var=savevar self.savedCargo=self.getCargo(VS.getPlayer()) # print self.savedCargo if (self.var,self.savedCargo) in isambushrunning: #VS.terminateMission(0) print('Directions: Stopping: directions already running! (before mission restore)') isambushrunning[(self.var,self.savedCargo)]=True self.jumps=jumps self.cp=VS.getCurrentPlayer() self.you=VS.Unit() self.base=VS.Unit() self.arrived=0 self.destination=destination self.mplay="all" self.dir_privateSetupPlayer(self.cp) self.mplay=universe.getMessagePlayer(self.you) self.obj=0 name = self.you.getName ()
def __init__ (self, numsystemsaway, num_significants_to_patrol, scan_object_distance, creds, jumps=(), donevar='', scan_objects=None): Director.Mission.__init__(self) if scan_objects is None or type(scan_objects) != dict or len(scan_objects) == 0: scan_objects = None else: scan_objects.setdefault("exceptall", []) scan_objects.setdefault("except", []) scan_objects.setdefault("addall", []) scan_objects.setdefault("add", []) self.scan_objects = scan_objects #If not None, do not randomly select significants, instead select them from this dictionary. self.donevar=donevar self.jnum=0 self.cred=creds self.patrolpoints = [] self.objectives = [] self.distance = scan_object_distance self.you = VS.getPlayer() self.quantity=num_significants_to_patrol name = self.you.getName () self.mplay=universe.getMessagePlayer(self.you) VS.IOmessage (0,"patrol",self.mplay,"Greetings, %s. You must patrol a system for us :" % name) self.adjsys = go_to_adjacent_systems(self.you,numsystemsaway,jumps) self.adjsys.Print("From the %s system,","Carefully go to %s.","You should shortly arrive in the %s: patrol it.","patrol",1)
def __init__(self, savevar, jumps=(), destination=''): Director.Mission.__init__(self); debug.info("Directions Mission: Starting") global isambushrunning self.var = savevar self.savedCargo = self.getCargo(VS.getPlayer()) debug.debug("self.savedCargo: %s" % (str(self.savedCargo))) if (self.var, self.savedCargo) in isambushrunning: #VS.terminateMission(0) debug.info("Directions Mission: Stopping: directions already running! (before mission restore)") isambushrunning[(self.var, self.savedCargo)] = True self.jumps = jumps debug.debug("Directions Mission: self.cp = %s" %(VS.getCurrentPlayer())) self.cp = VS.getCurrentPlayer() self.you = VS.Unit() self.base = VS.Unit() self.arrived = 0 self.destination = destination self.mplay = "all" self.dir_privateSetupPlayer(self.cp) self.mplay = universe.getMessagePlayer(self.you) self.obj = 0 name = self.you.getName()
def __init__(self, numsystemsaway, num_significants_to_patrol, distance_from_base, creds, jumps=(), donevar=''): Director.Mission.__init__(self) self.donevar = donevar self.jnum = 0 self.cred = creds self.patrolpoints = [] self.objectives = [] self.distance = distance_from_base self.you = VS.getPlayer() self.quantity = num_significants_to_patrol name = self.you.getName() self.mplay = universe.getMessagePlayer(self.you) VS.IOmessage(0, "patrol", self.mplay, "You must patrol a system for us :") self.adjsys = go_to_adjacent_systems(self.you, numsystemsaway, jumps) self.adjsys.Print("From the %s system,", "Carefully go to %s.", "You should shortly arrive in the %s: patrol it.", "patrol", 1)
def __init__ (self,factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category,jumps=(),var_to_set=''): Director.Mission.__init__(self); self.you=VS.Unit() self.base=VS.Unit() self.role="ESCORTCAP" self.arrived=0 self.var_to_set=var_to_set self.mplay="all" # self.mission_time=VS.GetGameTime()+time_to_complete*100*float(1+numsystemsaway) self.capship= launchoncapship self.faction=factionname self.cred=creds self.difficulty=missiondifficulty self.you=VS.getPlayer() self.adjsys=go_to_adjacent_systems(self.you,numsystemsaway,jumps) self.quantity=cargoquantity self.mplay=universe.getMessagePlayer(self.you) if (self.quantity<1): self.quantity=1 carg=VS.getRandCargo(self.quantity,category) if (carg.GetQuantity()==0 or category==''): carg = VS.getRandCargo(self.quantity,"") #oh no... could be starships... i=0 while i<50 and carg.GetCategory()[:10]=="Contraband": print "contraband==bad" carg = VS.getRandCargo(self.quantity,"") i+=1 tempquantity=self.quantity self.cargoname=carg.GetContent() name = self.you.getName () carg.SetMissionFlag(1) if (not self.you.isNull()): tmpcarg=self.you.GetCargo(self.cargoname) DoAddCargo=True try: if VS.loading_active_missions: DoAddCargo=False except: pass if False and tmpcarg.GetMissionFlag() and tmpcarg.GetQuantity()>2: quantum=int(tmpcarg.GetQuantity()/3) quantum=self.you.removeCargo(carg.GetContent(),quantum,True)#use it if player has it carg.SetQuantity(1+quantum) self.quantity=self.you.addCargo(carg) elif DoAddCargo: self.quantity = self.you.addCargo(carg) #I add some cargo else: VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000Unable to establish communications. Mission failed.") VS.terminateMission (0) return # creds_deducted = (carg.GetPrice()*float(self.quantity)*vsrandom.random()+1) # self.cred += creds_deducted if (tempquantity>0): self.cred*=float(self.quantity)/float(tempquantity) else: VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000You do not have space to add our %s cargo to your ship. Mission failed."%self.cargoname) self.aborted=True VS.terminateMission(0) return if (self.quantity==0): VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000You do not have space to add our cargo to the mission. Mission failed.") self.aborted=True VS.terminateMission(0) return VS.IOmessage (0,"cargo mission",self.mplay,"Your mission is as follows:" ) 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) VS.IOmessage (2,"cargo mission",self.mplay,"Give the cargo to a %s unit or planet." % (self.faction)) VS.IOmessage (3,"cargo mission",self.mplay,"You will receive %d of the %s cargo" % (self.quantity,self.cargoname)) # VS.IOmessage (4,"cargo mission",self.mplay,"We will deduct %.2f credits from your account for the cargo needed." % (creds_deducted)) VS.IOmessage (4,"cargo mission",self.mplay,"You will earn %.2f credits when you deliver our cargo." % (creds)) VS.IOmessage (4,"cargo mission",self.mplay,"#00ff00Good luck!")
def __init__(self, factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category, jumps=(), var_to_set=''): Director.Mission.__init__(self) self.you = VS.Unit() self.base = VS.Unit() self.role = "ESCORTCAP" self.arrived = 0 self.var_to_set = var_to_set self.mplay = "all" # self.mission_time=VS.GetGameTime()+time_to_complete*100*float(1+numsystemsaway) self.capship = launchoncapship self.faction = factionname self.cred = creds self.difficulty = missiondifficulty self.you = VS.getPlayer() self.adjsys = go_to_adjacent_systems(self.you, numsystemsaway, jumps) self.quantity = cargoquantity self.mplay = universe.getMessagePlayer(self.you) if (self.quantity < 1): self.quantity = 1 carg = VS.getRandCargo(self.quantity, category) if (carg.GetQuantity() == 0 or category == ''): carg = VS.getRandCargo(self.quantity, "") #oh no... could be starships... i = 0 while i < 50 and carg.GetCategory()[:10] == "Contraband": debug.info("contraband==bad") carg = VS.getRandCargo(self.quantity, "") i += 1 tempquantity = self.quantity self.cargoname = carg.GetContent() name = self.you.getName() carg.SetMissionFlag(1) if (not self.you.isNull()): tmpcarg = self.you.GetCargo(self.cargoname) if tmpcarg.GetMissionFlag() and tmpcarg.GetQuantity() > 2: quantum = int(tmpcarg.GetQuantity() / 3) quantum = self.you.removeCargo(carg.GetContent(), quantum, True) #use it if player has it carg.SetQuantity(1 + quantum) self.quantity = self.you.addCargo(carg) else: self.quantity = self.you.addCargo(carg) #I add some cargo else: VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000Unable to establish communications. Mission failed.") VS.terminateMission(0) return # creds_deducted = (carg.GetPrice()*float(self.quantity)*vsrandom.random()+1) # self.cred += creds_deducted if (tempquantity > 0): self.cred *= float(self.quantity) / float(tempquantity) else: VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000You do not have space to add our %s cargo to your ship. Mission failed." % self.cargoname) VS.terminateMission(0) return if (self.quantity == 0): VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000You do not have space to add our cargo to the mission. Mission failed." ) VS.terminateMission(0) return VS.IOmessage(0, "cargo mission", self.mplay, "Good Day, %s. Your mission is as follows:" % (name)) 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) VS.IOmessage(2, "cargo mission", self.mplay, "Give the cargo to a %s unit or planet." % (self.faction)) VS.IOmessage( 3, "cargo mission", self.mplay, "You will receive %d of the %s cargo" % (self.quantity, self.cargoname)) # VS.IOmessage (4,"cargo mission",self.mplay,"We will deduct %.2f credits from your account for the cargo needed." % (creds_deducted)) VS.IOmessage( 4, "cargo mission", self.mplay, "You will earn %.2f credits when you deliver our cargo." % (creds)) VS.IOmessage(4, "cargo mission", self.mplay, "#00ff00Good luck!")
def __init__(self, factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category, jumps=(), var_to_set=''): Director.Mission.__init__(self) self.you = VS.Unit() self.base = VS.Unit() self.role = "ESCORTCAP" self.arrived = 0 self.var_to_set = var_to_set self.mplay = "all" # self.mission_time=VS.GetGameTime()+time_to_complete*100*float(1+numsystemsaway) self.capship = launchoncapship self.faction = factionname self.cred = creds self.difficulty = missiondifficulty self.you = VS.getPlayer() self.adjsys = go_to_adjacent_systems(self.you, numsystemsaway, jumps) self.quantity = cargoquantity self.mplay = universe.getMessagePlayer(self.you) if (self.quantity < 1): self.quantity = 1 carg = VS.getRandCargo(self.quantity, category) if (carg.GetQuantity() == 0 or category == ''): carg = VS.getRandCargo(self.quantity, "") #oh no... could be starships... i = 0 while i < 50 and carg.GetCategory()[:10] == "Contraband": print "contraband==bad" carg = VS.getRandCargo(self.quantity, "") i += 1 tempquantity = self.quantity self.cargoname = carg.GetContent() name = self.you.getName() carg.SetMissionFlag(1) if (not self.you.isNull()): tmpcarg = self.you.GetCargo(self.cargoname) if tmpcarg.GetMissionFlag() and tmpcarg.GetQuantity() > 2: quantum = int(tmpcarg.GetQuantity() / 3) quantum = self.you.removeCargo(carg.GetContent(), quantum, True) #use it if player has it carg.SetQuantity(1 + quantum) self.quantity = self.you.addCargo(carg) else: self.quantity = self.you.addCargo(carg) #I add some cargo else: VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000Es ist unmoeglich die Kommunikation aufzubauen. Mission gescheitert." ) VS.terminateMission(0) return # creds_deducted = (carg.GetPrice()*float(self.quantity)*vsrandom.random()+1) # self.cred += creds_deducted if (tempquantity > 0): self.cred *= float(self.quantity) / float(tempquantity) else: VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000Du hast nicht genug Platz, um unsere %s Fracht in Deinem Schiff aufzunehmen. Mission gescheitert." % self.cargoname) VS.terminateMission(0) return if (self.quantity == 0): VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000Du hast nicht genug Platz, um unsere Fracht in Deinem Schiff aufzunehmen. Mission gescheitert." ) VS.terminateMission(0) return VS.IOmessage(0, "cargo mission", self.mplay, "Guten Tag, %s. Deine Mission ist folgende:" % (name)) self.adjsys.Print( "Du solltest in dem System mit dem Namen %s starten,", "dann springe nach %s,", "Zum Schluss springe nach %s, Deinem Ziel.", "cargo mission", 1) VS.IOmessage( 2, "cargo mission", self.mplay, "Uebergebe die Fracht an eine %s-Einheit oder einen %s-Planeten." % (self.faction), (self.faction)) VS.IOmessage( 3, "cargo mission", self.mplay, "Du wirst %d von der %s Fracht erhalten." % (self.quantity, self.cargoname)) # VS.IOmessage (4,"cargo mission",self.mplay,"We will deduct %.2f credits from your account for the cargo needed." % (creds_deducted)) VS.IOmessage( 4, "cargo mission", self.mplay, "Du wirst %.2f Kredite verdienen, wenn Du unsere Fracht lieferst." % (creds)) VS.IOmessage(4, "cargo mission", self.mplay, "#00ff00Viel Glueck!")
def __init__ (self,factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category,jumps=(),var_to_set=''): Director.Mission.__init__(self); self.you=VS.Unit() self.base=VS.Unit() self.role="ESCORTCAP" self.arrived=0 self.var_to_set=var_to_set self.mplay="all" # self.mission_time=VS.GetGameTime()+time_to_complete*100*float(1+numsystemsaway) self.capship= launchoncapship self.faction=factionname self.cred=creds self.difficulty=missiondifficulty self.you=VS.getPlayer() self.adjsys=go_to_adjacent_systems(self.you,numsystemsaway,jumps) self.quantity=cargoquantity self.mplay=universe.getMessagePlayer(self.you) if (self.quantity<1): self.quantity=1 carg=VS.getRandCargo(self.quantity,category) if (carg.GetQuantity()==0 or category==''): carg = VS.getRandCargo(self.quantity,"") #oh no... could be starships... i=0 while i<50 and carg.GetCategory()[:10]=="Contraband": print "contraband==bad" carg = VS.getRandCargo(self.quantity,"") i+=1 tempquantity=self.quantity self.cargoname=carg.GetContent() name = self.you.getName () carg.SetMissionFlag(1) if (not self.you.isNull()): tmpcarg=self.you.GetCargo(self.cargoname) if tmpcarg.GetMissionFlag() and tmpcarg.GetQuantity()>2: quantum=int(tmpcarg.GetQuantity()/3) quantum=self.you.removeCargo(carg.GetContent(),quantum,True)#use it if player has it carg.SetQuantity(1+quantum) self.quantity=self.you.addCargo(carg) else: self.quantity = self.you.addCargo(carg) #I add some cargo else: VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000Es ist unmoeglich die Kommunikation aufzubauen. Mission gescheitert.") VS.terminateMission (0) return # creds_deducted = (carg.GetPrice()*float(self.quantity)*vsrandom.random()+1) # self.cred += creds_deducted if (tempquantity>0): self.cred*=float(self.quantity)/float(tempquantity) else: VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000Du hast nicht genug Platz, um unsere %s Fracht in Deinem Schiff aufzunehmen. Mission gescheitert."%self.cargoname) VS.terminateMission(0) return if (self.quantity==0): VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000Du hast nicht genug Platz, um unsere Fracht in Deinem Schiff aufzunehmen. Mission gescheitert.") VS.terminateMission(0) return VS.IOmessage (0,"cargo mission",self.mplay,"Guten Tag, %s. Deine Mission ist folgende:" % (name)) self.adjsys.Print("Du solltest in dem System mit dem Namen %s starten,","dann springe nach %s,","Zum Schluss springe nach %s, Deinem Ziel.","cargo mission",1) VS.IOmessage (2,"cargo mission",self.mplay,"Uebergebe die Fracht an eine %s-Einheit oder einen %s-Planeten." % (self.faction),(self.faction)) VS.IOmessage (3,"cargo mission",self.mplay,"Du wirst %d von der %s Fracht erhalten." % (self.quantity,self.cargoname)) # VS.IOmessage (4,"cargo mission",self.mplay,"We will deduct %.2f credits from your account for the cargo needed." % (creds_deducted)) VS.IOmessage (4,"cargo mission",self.mplay,"Du wirst %.2f Kredite verdienen, wenn Du unsere Fracht lieferst." % (creds)) VS.IOmessage (4,"cargo mission",self.mplay,"#00ff00Viel Glueck!")
def Print(self,visitstr,fro,dockstr="\0%s",time=0): if (self.capship): visitstr+=(dockstr % (self.orbitee)) thename=unit.getUnitFullName(self.significantun,True) VS.IOmessage(time,fro,universe.getMessagePlayer(self.you),visitstr % (thename) )
def __init__(self, factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category, jumps=(), var_to_set=''): Director.Mission.__init__(self) self.you = VS.Unit() self.base = VS.Unit() self.role = "ESCORTCAP" self.arrived = 0 self.var_to_set = var_to_set self.mplay = "all" # self.mission_time=VS.GetGameTime()+time_to_complete*100*float(1+numsystemsaway) self.capship = launchoncapship self.faction = factionname self.cred = creds self.difficulty = missiondifficulty self.you = VS.getPlayer() self.adjsys = go_to_adjacent_systems(self.you, numsystemsaway, jumps) self.quantity = cargoquantity self.mplay = universe.getMessagePlayer(self.you) if (self.quantity < 1): self.quantity = 1 tempquantity = self.quantity name = self.you.getName() if (not self.you.isNull()): j = 0 while j < 15: #if j>10: # category = '' carg = self.GetSomeCargo(category) found = False for i in range(self.you.numCargo()): tmpcarg = self.you.GetCargoIndex(i) if (tmpcarg.GetCategory() == category and tmpcarg.GetMissionFlag() ) or self.cargoname == tmpcarg.GetContent(): print(category, tmpcarg.GetCategory()) found = True break if not found: newquantity = self.you.addCargo(carg) #I add some cargo if newquantity > 0: print("It wasnt found %s" % self.cargoname) self.quantity = newquantity break if found and tmpcarg.GetMissionFlag( ): #self.cargoname==tmpcarg.GetContent(): self.cargoname = tmpcarg.GetContent() self.quantity = int(tmpcarg.GetQuantity()) tempquantity = self.quantity print(("already have " + str(self.quantity) + " cargo of this kind " + self.cargoname)) break # Else, let's look for another cargo of this kind print(("already have " + str(int(tmpcarg.GetQuantity())) + " non-mission cargo of this kind " + self.cargoname)) j += 1 else: # While loop's condition failed... i.e. j got too big. if not category: category = 'generic' VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000Unable to find suitable %s cargo that is not already loaded. Mission canceled." % category) VS.terminateMission(0) return else: VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000Unable to establish communications. Mission failed.") VS.terminateMission(0) return # creds_deducted = (carg.GetPrice()*float(self.quantity)*vsrandom.random()+1) # self.cred += creds_deducted if (tempquantity > 0): self.cred *= float(self.quantity) / float(tempquantity) else: VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000You do not have space to add our %s cargo to your ship. Mission failed." % self.cargoname) VS.terminateMission(0) return if (self.quantity == 0): VS.IOmessage( 2, "cargo mission", self.mplay, "#ff0000You do not have space to add our cargo to the mission. Mission failed." ) VS.terminateMission(0) return VS.IOmessage(0, "cargo mission", self.mplay, "Your mission is as follows:") 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) VS.IOmessage(2, "cargo mission", self.mplay, "Give the cargo to a %s unit or planet." % (self.faction)) VS.IOmessage( 3, "cargo mission", self.mplay, "You will receive %d of the %s cargo" % (self.quantity, self.cargoname)) # VS.IOmessage (4,"cargo mission",self.mplay,"We will deduct %.2f credits from your account for the cargo needed." % (creds_deducted)) VS.IOmessage( 4, "cargo mission", self.mplay, "You will earn %.2f credits when you deliver our cargo." % (creds)) VS.IOmessage(4, "cargo mission", self.mplay, "#00ff00Good luck!")
def __init__ (self,factionname, numsystemsaway, cargoquantity, missiondifficulty, creds, launchoncapship, time_to_complete, category,jumps=(),var_to_set=''): Director.Mission.__init__(self); self.you=VS.Unit() self.base=VS.Unit() self.role="ESCORTCAP" self.arrived=0 self.var_to_set=var_to_set self.mplay="all" # self.mission_time=VS.GetGameTime()+time_to_complete*100*float(1+numsystemsaway) self.capship= launchoncapship self.faction=factionname self.cred=creds self.difficulty=missiondifficulty self.you=VS.getPlayer() self.adjsys=go_to_adjacent_systems(self.you,numsystemsaway,jumps) self.quantity=cargoquantity self.mplay=universe.getMessagePlayer(self.you) if (self.quantity<1): self.quantity=1 tempquantity=self.quantity name = self.you.getName () if (not self.you.isNull()): j=0 while j<15: #if j>10: # category = '' carg = self.GetSomeCargo(category) found=False for i in range(self.you.numCargo()): tmpcarg=self.you.GetCargoIndex(i) if (tmpcarg.GetCategory()==category and tmpcarg.GetMissionFlag()) or self.cargoname==tmpcarg.GetContent(): print category, tmpcarg.GetCategory() found=True break if not found: newquantity = self.you.addCargo(carg) #I add some cargo if newquantity>0: print "It wasnt found %s"%self.cargoname self.quantity=newquantity break if found and tmpcarg.GetMissionFlag(): #self.cargoname==tmpcarg.GetContent(): self.cargoname=tmpcarg.GetContent() self.quantity=int(tmpcarg.GetQuantity()) tempquantity=self.quantity print ("already have "+str(self.quantity)+" cargo of this kind "+self.cargoname) break # Else, let's look for another cargo of this kind print ("already have "+str(int(tmpcarg.GetQuantity()))+" non-mission cargo of this kind "+self.cargoname) j+=1 else: # While loop's condition failed... i.e. j got too big. if not category: category='generic' VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000Unable to find suitable %s cargo that is not already loaded. Mission canceled."%category) VS.terminateMission (0) return else: VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000Unable to establish communications. Mission failed.") VS.terminateMission (0) return # creds_deducted = (carg.GetPrice()*float(self.quantity)*vsrandom.random()+1) # self.cred += creds_deducted if (tempquantity>0): self.cred*=float(self.quantity)/float(tempquantity) else: VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000You do not have space to add our %s cargo to your ship. Mission failed."%self.cargoname) VS.terminateMission(0) return if (self.quantity==0): VS.IOmessage (2,"cargo mission",self.mplay,"#ff0000You do not have space to add our cargo to the mission. Mission failed.") VS.terminateMission(0) return VS.IOmessage (0,"cargo mission",self.mplay,"Your mission is as follows:" ) 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) VS.IOmessage (2,"cargo mission",self.mplay,"Give the cargo to a %s unit or planet." % (self.faction)) VS.IOmessage (3,"cargo mission",self.mplay,"You will receive %d of the %s cargo" % (self.quantity,self.cargoname)) # VS.IOmessage (4,"cargo mission",self.mplay,"We will deduct %.2f credits from your account for the cargo needed." % (creds_deducted)) VS.IOmessage (4,"cargo mission",self.mplay,"You will earn %.2f credits when you deliver our cargo." % (creds)) VS.IOmessage (4,"cargo mission",self.mplay,"#00ff00Good luck!")