Esempio n. 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")
Esempio n. 2
0
 def restore(self, bp):
     self.end_star = int(bp.get_par("EndStar"))
     if self._script.version < 7:
         self.angle = int(bp.get_par("Angle"))
     self.distance = MinMax.from_str(bp.get_par("Distance"), int)
     if self._script.version < 7:
         self.relation = MinMax.from_str(bp.get_par("Relation"), int)
         self.deviation = int(bp.get_par("Deviation"))
     self.is_hole = str_to_bool(bp.get_par("IsHole"))
Esempio n. 3
0
    def restore(self, bp):
        self.constellation = int(bp.get_par("Constellation"))
        if self._script.version < 7:
            self.is_subspace = str_to_bool(bp.get_par("IsSubspace"))
        self.no_kling = str_to_bool(bp.get_par("NoKling"))
        self.no_come_kling = str_to_bool(bp.get_par("NoComeKling"))

        for subblock in bp.get_block("StarLinks"):
            e = StarLink(self._script, subblock.name)
            e.restore(subblock.content)
            self.starlinks.append(e)

        for subblock in bp.get_block("Planets"):
            e = Planet(self._script, subblock.name)
            e.restore(subblock.content)
            self.planets.append(e)

        for subblock in bp.get_block("Ships"):
            e = Ship(self._script, subblock.name)
            e.restore(subblock.content)
            self.ships.append(e)
Esempio n. 4
0
 def restore(self, source):
     end_star = source.get_par("EndStar")
     start = end_star.find('(') + 1
     end = end_star.find(')')
     self.end_star = int(end_star[start:end])
     if self._script.version < 7:
         self.angle = int(source.get_par("Angle"))
     self.distance = MinMax.from_str(source.get_par("Distance"), int)
     if self._script.version < 7:
         self.relation = MinMax.from_str(source.get_par("Relation"), int)
         self.deviation = int(source.get_par("Deviation"))
     self.is_hole = str_to_bool(source.get_par("IsHole"))
Esempio n. 5
0
    def restore(self, bp):
        self.type = mt_.from_str(bp.get_par("Type"))
        if self.type not in (mt_.NONE, mt_.FREE):
            self.object = bp.get_par("Object")
        for par in bp.get_block("Attack"):
            self.attack.append(par.content)
        self.take_item = bp.get_par("TakeItem")
        self.take_all = str_to_bool(bp.get_par("TakeAll"))
        self.out_msg = bp.get_par("OutMsg")
        self.in_msg = bp.get_par("InMsg")
        self.ether = bp.get_par("Ether")

        self.code = bp.get_par("Code")
Esempio n. 6
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")