示例#1
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Begin", str(self.begin))
     nbp.add("End", str(self.end))
     nbp.add("Relations", str(self.relations))
     nbp.add("WarWeight", str(self.war_weight))
     bp.add(str(self.name), nbp)
示例#2
0
    def restore_blockpar(self, root: str) -> BlockPar:
        bp = BlockPar()

        keys = self.get(root, '0')
        values = self.get(root, '1')
        for i in range(len(keys.entries)):
            bp.add(keys.get_widestr(i), values.get_widestr(i))

        keys = self.get(root, '2')
        values = self.get(root, '3')
        for i in range(len(keys.entries)):
            bp.add(keys.get_widestr(i),
                   self.restore_blockpar(values.get_widestr(i)))

        return bp
示例#3
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Planet", str(self.planet))
     nbp.add("State", str(self.state) + \
                      '(' + str(self._script.states[self.state].name) + ')')
     nbp.add("Owner", str(self.owner))
     nbp.add("Type", str(self.type))
     nbp.add("Count", str(self.count))
     nbp.add("Speed", str(self.speed))
     nbp.add("Weapon", str(self.weapon))
     nbp.add("CargoHook", str(self.cargohook))
     nbp.add("EmptySpace", str(self.emptyspace))
     if self._script.version < 7:
         nbp.add("Friendship", str(self.friendship))
     nbp.add("AddPlayer", str(self.add_player))
     if self._script.version < 7:
         nbp.add("Rating", str(self.rating))
         nbp.add("Score", str(self.score))
     st = BlockPar(sort=False)
     st.add("Trader", str(self.status.trader))
     st.add("Warrior", str(self.status.warrior))
     st.add("Pirate", str(self.status.pirate))
     nbp.add("Status", st)
     nbp.add("SearchDist", str(self.search_distance))
     nbp.add("Dialog", str(self.dialog))
     nbp.add("Strength", str(self.strength))
     nbp.add("Ruins", str(self.ruins))
     bp.add(str(self.name), nbp)
示例#4
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Place", str(self.place))
     nbp.add("Class", str(self.kind))
     nbp.add("Type", str(self.type))
     nbp.add("Size", str(self.size))
     nbp.add("Level", str(self.level))
     nbp.add("Radius", str(self.radius))
     nbp.add("Owner", str(self.owner))
     nbp.add("Useless", str(self.useless))
     bp.add(str(self.name), nbp)
示例#5
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Star", str(self.star))
     nbp.add("Type", str(self.type))
     if self.type is not pt_.FREE:
         nbp.add("Object", str(self.object))
     if self.type is pt_.FREE:
         nbp.add("Angle", str(self.angle))
     if self.type in (pt_.FREE, pt_.TO_STAR, pt_.FROM_SHIP):
         nbp.add("Distance", str(self.distance))
     if self.type is not pt_.IN_PLANET:
         nbp.add("Radius", str(self.radius))
     if self.type in (pt_.TO_STAR, pt_.FROM_SHIP):
         nbp.add("Angle", str(self.angle))
     bp.add(str(self.name), nbp)
示例#6
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Count", str(self.count))
     nbp.add("Owner", str(self.owner))
     nbp.add("Type", str(self.type))
     nbp.add("IsPlayer", str(self.is_player))
     nbp.add("Speed", str(self.speed))
     nbp.add("Weapon", str(self.weapon))
     nbp.add("CargoHook", str(self.cargohook))
     nbp.add("EmptySpace", str(self.emptyspace))
     if self._script.version < 7:
         nbp.add("Rating", str(self.rating))
     st = BlockPar(sort=False)
     st.add("Trader", str(self.status.trader))
     st.add("Warrior", str(self.status.warrior))
     st.add("Pirate", str(self.status.pirate))
     nbp.add("Status", st)
     if self._script.version < 7:
         nbp.add("Score", str(self.score))
     nbp.add("Strength", str(self.strength))
     nbp.add("Ruins", str(self.ruins))
     bp.add(str(self.name), nbp)
示例#7
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Race", str(self.race))
     nbp.add("Owner", str(self.owner))
     nbp.add("Economy", str(self.economy))
     nbp.add("Government", str(self.government))
     nbp.add("Range", str(self.range))
     nbp.add("Dialog", str(self.dialog))
     bp.add(str(self.name), nbp)
示例#8
0
 def dump(self, bp):
     nbp =BlockPar(sort=False)
     nbp.add("EndStar", str(self._script.stars[self.end_star].name) + \
                        ' (' + str(self.end_star) + ')')
     if self._script.version < 7:
         nbp.add("Angle", str(self.angle))
     nbp.add("Distance", str(self.distance))
     if self._script.version < 7:
         nbp.add("Relation", str(self.relation))
         nbp.add("Deviation", str(self.deviation))
     nbp.add("IsHole", str(self.is_hole))
     bp.add(str(self.name), nbp)
示例#9
0
    def dump(self, bp):
        nbp = BlockPar(sort=False)
        nbp.add("Constellation", str(self.constellation))
        if self._script.version < 7:
            nbp.add("IsSubspace", str(self.is_subspace))
        nbp.add("NoKling", str(self.no_kling))
        nbp.add("NoComeKling", str(self.no_come_kling))

        nnbp = BlockPar(sort=False)
        for sl in self.starlinks:
            sl.dump(nnbp)
        nbp.add("StarLinks", nnbp)

        nnbp = BlockPar(sort=False)
        for p in self.planets:
            p.dump(nnbp)
        nbp.add("Planets", nnbp)

        nnbp = BlockPar(sort=False)
        for s in self.ships:
            s.dump(nnbp)
        nbp.add("Ships", nnbp)

        bp.add(str(self.name), nbp)
示例#10
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Type", str(self.type))
     nbp.add("Value", str(self.value))
     bp.add(str(self.name), nbp)
示例#11
0
    def dump(self, f):
        """
        :type f: io.TextIO
        """
        bp = BlockPar(sort=False)

        bp.add("Version", str(self.version))

        nbp = BlockPar(sort=False)
        for e in self.globalvars:
            e.dump(nbp)
        bp.add("GlobalVars", nbp)

        bp.add("GlobalCode", self.globalcode)

        nbp = BlockPar(sort=False)
        for e in self.localvars:
            e.dump(nbp)
        bp.add("LocalVars", nbp)

        bp.add("Constellations", str(self.constellations))

        nbp = BlockPar(sort=False)
        for e in self.stars:
            e.dump(nbp)
        bp.add("Stars", nbp)

        nbp = BlockPar(sort=False)
        for e in self.places:
            e.dump(nbp)
        bp.add("Places", nbp)

        nbp = BlockPar(sort=False)
        for e in self.items:
            e.dump(nbp)
        bp.add("Items", nbp)

        nbp = BlockPar(sort=False)
        for e in self.groups:
            e.dump(nbp)
        bp.add("Groups", nbp)

        nbp = BlockPar(sort=False)
        for e in self.grouplinks:
            e.dump(nbp)
        bp.add("GroupLinks", nbp)

        bp.add("InitCode", self.initcode)

        bp.add("TurnCode", self.turncode)

        bp.add("DialogBegin", self.dialogbegincode)

        nbp = BlockPar(sort=False)
        for i, e in enumerate(self.states):
            e.dump(nbp)
        bp.add("States", nbp)

        nbp = BlockPar(sort=False)
        for e in self.dialogs:
            e.dump(nbp)
        bp.add("Dialogs", nbp)

        nbp = BlockPar(sort=False)
        for e in self.dialog_msgs:
            e.dump(nbp)
        bp.add("DialogMsgs", nbp)

        nbp = BlockPar(sort=False)
        for e in self.dialog_answers:
            e.dump(nbp)
        bp.add("DialogAnswers", nbp)

        bp.save_txt(f)
        del bp
示例#12
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Command", str(self.command))
     nbp.add("Answer", str(self.answer))
     nbp.add("Code", self.code)
     bp.add(str(self.name), nbp)
示例#13
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Name", str(self.command))
     nbp.add("Code", self.code)
     bp[str(self.name)] = nbp
示例#14
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Code", self.code)
     bp.add(str(self.name), nbp)
示例#15
0
 def dump(self, bp):
     nbp = BlockPar(sort=False)
     nbp.add("Type", str(self.type))
     if self.type not in (mt_.NONE, mt_.FREE):
         nbp.add("Object", str(self.object))
     attack = BlockPar(sort=False)
     for i, a in enumerate(self.attack):
         attack.add(str(i), str(a))
     nbp.add("Attack", attack)
     nbp.add("TakeItem", str(self.take_item))
     nbp.add("TakeAll", str(self.take_all))
     nbp.add("OutMsg", str(self.out_msg))
     nbp.add("InMsg", str(self.in_msg))
     nbp.add("Ether", str(self.ether))
     nbp.add("Code", self.code)
     bp.add(str(self.name), nbp)