Пример #1
0
 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
Пример #2
0
 def Execute(self):
     if (VS.GetGameTime() - self.gametime > 10):
         self.escortee.setFgDirective('F')
     if self.you.isNull():
         VS.IOmessage(
             0, "escort", self.mplay,
             "#ff0000You were to protect your escort. Mission failed.")
         VS.terminateMission(0)
         return
     self.escortee.setFlightgroupLeader(self.you)
     #print 'name: '+self.escortee.getFlightgroupLeader().getName()
     #self.escortee.SetVelocity(self.you.GetVelocity())
     if (self.escortee.isNull()):
         VS.IOmessage(
             0, "escort", self.mplay,
             "#ff0000You were to protect your escort. Mission failed.")
         universe.punish(self.you, self.faction, self.difficulty)
         if (self.var_to_set != ''):
             quest.removeQuest(self.you.isPlayerStarship(), self.var_to_set,
                               -1)
         VS.terminateMission(0)
         return
     if (not self.adjsys.Execute()):
         if (self.arrived):
             self.adjsys.SignificantUnit().setSpeed(0.0)
             self.adjsys.SignificantUnit().SetVelocity((0.0, 0.0, 0.0))
         return
     if (not self.arrived):
         self.arrived = 1
         self.adjsys = go_somewhere_significant(
             self.you, 1, self.distfrombase + 15 * self.escortee.rSize(),
             self.difficulty <= 1, self.faction)
         self.role = self.adjsys.SignificantUnit().getCombatRole()
         self.adjsys.SignificantUnit().setCombatRole("INERT")
         self.adjsys.Print("You must escort your starship to the %s",
                           "defend", "docked around the %s", 0)
     elif (self.you.getDistance(self.escortee) < 2000):
         self.you.addCredits(self.creds)
         VS.AdjustRelation(self.you.getFactionName(), self.faction,
                           self.difficulty * .01, 1)
         VS.IOmessage(
             0, "escort", self.mplay,
             "#00ff00Excellent work! You have completed this mission!")
         self.escortee.setFgDirective('b')
         self.escortee.setFlightgroupLeader(self.escortee)
         self.escortee.performDockingOperations(
             self.adjsys.SignificantUnit(), 0)
         self.adjsys.SignificantUnit().setCombatRole(self.role)
         if (self.var_to_set != ''):
             quest.removeQuest(self.you.isPlayerStarship(), self.var_to_set,
                               1)
         VS.terminateMission(1)
 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,1)
         print "removed %d" % removenum
         mpart=VS.GetMasterPartList()
         newcarg=mpart.GetCargo(self.cargoname)
         newcarg.SetQuantity(removenum)
         #self.base.addCargo(newcarg)
         has=self.you.hasCargo(self.cargoname)
         print "has cargo "+str(has)
         if (has):
             has=self.you.removeCargo(self.cargoname,has,1)
             print "removedagain %d"%has
             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
Пример #4
0
 def Execute (self):
     if (VS.GetGameTime()-self.gametime>10):
         self.escortee.setFgDirective('F')
     if self.you.isNull():
         VS.IOmessage (0,"escort",self.mplay,"#ff0000You were to protect your escort. Mission failed.")
         VS.terminateMission(0)
         return
     self.escortee.setFlightgroupLeader(self.you)
     #print 'name: '+self.escortee.getFlightgroupLeader().getName()
     #self.escortee.SetVelocity(self.you.GetVelocity())
     if (self.escortee.isNull()):
         VS.IOmessage (0,"escort",self.mplay,"#ff0000You were to protect your escort. Mission failed.")
         universe.punish(self.you,self.faction,self.difficulty)
         if (self.var_to_set!=''):
             quest.removeQuest (self.you.isPlayerStarship(),self.var_to_set,-1)
         VS.terminateMission(0)
         return   
     if (not self.adjsys.Execute()):
         if (self.arrived):
             self.adjsys.SignificantUnit().setSpeed(0.0)
             self.adjsys.SignificantUnit().SetVelocity((0.0,0.0,0.0))
         return
     if (not self.arrived):
         self.arrived=1
         self.adjsys=go_somewhere_significant (self.you,1,self.distfrombase+15*self.escortee.rSize(),self.difficulty<=1,self.faction)
         self.role = self.adjsys.SignificantUnit().getCombatRole()
         self.adjsys.SignificantUnit().setCombatRole("INERT");
         self.adjsys.Print ("You must escort your starship to the %s","defend","docked around the %s", 0)
     elif (self.you.getDistance(self.escortee)<2000):
         self.you.addCredits(self.creds)
         VS.AdjustRelation(self.you.getFactionName(),self.faction,self.difficulty*.01,1)
         VS.IOmessage (0,"escort",self.mplay,"#00ff00Excellent work! You have completed this mission!")
         self.escortee.setFgDirective('b')
         self.escortee.setFlightgroupLeader(self.escortee)
         self.escortee.performDockingOperations(self.adjsys.SignificantUnit(),0)
         self.adjsys.SignificantUnit().setCombatRole(self.role);
         if (self.var_to_set!=''):
             quest.removeQuest (self.you.isPlayerStarship(),self.var_to_set,1)
         VS.terminateMission(1)