Example #1
0
 def restore(self, bp):
     self.planet = bp.get_par("Planet")
     state = bp.get_par("State").split('(', 1)
     self.state = int(state[0].strip())
     self.owner = o_.from_str(bp.get_par("Owner"))
     self.type = t_.from_str(bp.get_par("Type"))
     self.count = MinMax.from_str(bp.get_par("Count"), int)
     self.speed = MinMax.from_str(bp.get_par("Speed"), int)
     self.weapon = w_.from_str(bp.get_par("Weapon"))
     self.cargohook = int(bp.get_par("CargoHook"))
     self.emptyspace = int(bp.get_par("EmptySpace"))
     if self._script.version < 7:
         self.friendship = f_.from_str(bp.get_par("Friendship"))
     self.add_player = str_to_bool(bp.get_par("AddPlayer"))
     if self._script.version < 7:
         self.rating = MinMax.from_str(bp.get_par("Rating"), int)
         self.score = MinMax.from_str(bp.get_par("Score"), int)
     status = bp.get_block("Status")
     self.status = Status(MinMax.from_str(status.get_par("Trader"), int),
                          MinMax.from_str(status.get_par("Warrior"), int),
                          MinMax.from_str(status.get_par("Pirate"), int))
     del status
     self.search_distance = int(bp.get_par("SearchDist"))
     self.dialog = bp.get_par("Dialog")
     self.strength = MinMax.from_str(bp.get_par("Strength"), float)
     self.ruins = bp.get_par("Ruins")
Example #2
0
 def __init__(self, script, name):
     super().__init__(script, name)
     self.count: int = 0
     self.owner: o_ = o_(0)
     self.type: t_ = t_(0)
     self.is_player: bool = False
     self.speed: MinMax[int] = MinMax(0, 0)
     self.weapon: w_ = w_(0)
     self.cargohook: int = 0
     self.emptyspace: int = 0
     self.rating: MinMax[int] = MinMax(0, 0)
     self.status: Status = Status(MinMax(0, 0),
                                  MinMax(0, 0),
                                  MinMax(0, 0),)
     self.score: MinMax[int] = MinMax(0, 0)
     self.strength: MinMax[float] = MinMax(0.0, 0.0)
     self.ruins: str = ""
Example #3
0
 def load(self, s):
     self.count = s.get_int()
     self.owner = o_(s.get_uint())
     self.type = t_(s.get_uint())
     self.is_player = s.get_bool()
     self.speed = MinMax(s.get_int(), s.get_int())
     self.weapon = w_(s.get_uint())
     self.cargohook = s.get_int()
     self.emptyspace = s.get_int()
     if self._script.version < 7:
         self.rating = MinMax(s.get_int(), s.get_int())
     self.status = Status(MinMax(s.get_int(), s.get_int()),
                          MinMax(s.get_int(), s.get_int()),
                          MinMax(s.get_int(), s.get_int()))
     if self._script.version < 7:
         self.score = MinMax(s.get_int(), s.get_int())
     self.strength = MinMax(s.get_single(), s.get_single())
     self.ruins = s.get_widestr()
Example #4
0
 def restore(self, bp):
     self.count = int(bp.get_par("Count"))
     self.owner = o_.from_str(bp.get_par("Owner"))
     self.type = t_.from_str(bp.get_par("Type"))
     self.is_player = str_to_bool(bp.get_par("IsPlayer"))
     self.speed = MinMax.from_str(bp.get_par("Speed"), int)
     self.weapon = w_.from_str(bp.get_par("Weapon"))
     self.cargohook = int(bp.get_par("CargoHook"))
     self.emptyspace = int(bp.get_par("EmptySpace"))
     if self._script.version < 7:
         self.rating = MinMax.from_str(bp.get_par("Rating"), int)
     status = bp.get_block("Status")
     self.status = Status(MinMax.from_str(status.get_par("Trader"), int),
                          MinMax.from_str(status.get_par("Warrior"), int),
                          MinMax.from_str(status.get_par("Pirate"), int))
     del status
     if self._script.version < 7:
         self.score = MinMax.from_str(bp.get_par("Score"), int)
     self.strength = MinMax.from_str(bp.get_par("Strength"), float)
     self.ruins = bp.get_par("Ruins")
Example #5
0
 def __init__(self, script, name):
     super().__init__(script, name)
     self.planet: str = ""
     self.state: int = 0
     self.owner: o_ = o_(0)
     self.type: t_ = t_(0)
     self.count: MinMax[int] = MinMax(0, 0)
     self.speed: MinMax[int] = MinMax(0, 0)
     self.weapon: w_ = w_(0)
     self.cargohook: int = 0
     self.emptyspace: int = 0
     self.friendship: f_ = f_(0)
     self.add_player: bool = False
     self.rating: MinMax[int] = MinMax(0, 0)
     self.score: MinMax[int] = MinMax(0, 0)
     self.status: Status = Status(MinMax(0, 0),
                                  MinMax(0, 0),
                                  MinMax(0, 0), )
     self.search_distance: int = 0
     self.dialog: str = ""
     self.strength: MinMax[float] = MinMax(0.0, 0.0)
     self.ruins: str = ""
Example #6
0
 def load(self, s):
     self.planet = s.get_widestr()
     self.state = s.get_int()
     self.owner = o_(s.get_uint())
     self.type = t_(s.get_uint())
     self.count = MinMax(s.get_int(), s.get_int())
     self.speed = MinMax(s.get_int(), s.get_int())
     self.weapon = w_(s.get_uint())
     self.cargohook = s.get_int()
     self.emptyspace = s.get_int()
     if self._script.version < 7:
         self.friendship = f_(s.get_uint())
     self.add_player = s.get_bool()
     if self._script.version < 7:
         self.rating = MinMax(s.get_int(), s.get_int())
         self.score = MinMax(s.get_int(), s.get_int())
     self.status = Status(MinMax(s.get_int(), s.get_int()),
                          MinMax(s.get_int(), s.get_int()),
                          MinMax(s.get_int(), s.get_int()))
     self.search_distance = s.get_int()
     self.dialog = s.get_widestr()
     self.strength = MinMax(s.get_single(), s.get_single())
     self.ruins = s.get_widestr()