コード例 #1
0
 def read_data(self, filename):
     global spells
     f = open(filename, 'r+b')
     f.seek(self.pointer)
     if spells is None:
         spells = get_ranked_spells(filename, magic_only=True)
     self.spells, self.learnrates = [], []
     for _ in range(5):
         learnrate = ord(f.read(1))
         spell = ord(f.read(1))
         if spell != 0xFF and learnrate != 0:
             self.spells.append(get_spell(spell))
             self.learnrates.append(learnrate)
     self.bonus = ord(f.read(1))
     f.close()
コード例 #2
0
 def read_data(self, filename):
     global spells
     f = open(filename, 'r+b')
     f.seek(self.pointer)
     if spells is None:
         spells = get_ranked_spells(filename, magic_only=True)
     self.spells, self.learnrates = [], []
     for i in xrange(5):
         learnrate = ord(f.read(1))
         spell = ord(f.read(1))
         if spell != 0xFF and learnrate != 0:
             self.spells.append(get_spell(spell))
             self.learnrates.append(learnrate)
     self.bonus = ord(f.read(1))
     f.close()
コード例 #3
0
    def read_stats(self, filename):
        global all_spells

        f = open(filename, 'r+b')
        f.seek(self.pointer)
        self.itemtype = ord(f.read(1))

        # throwable = self.itemtype & 0x10
        # usable_battle = self.itemtype & 0x20
        # usable_field = self.itemtype & 0x40

        self.equippable = read_multi(f, length=2)
        self.heavy = bool(self.equippable & 0x8000)

        stats = list(f.read(len(ITEM_STATS)))
        self.features = dict(list(zip(ITEM_STATS, stats)))

        # move flags for "randomly cast" and "destroy if used"
        # so breakeffect can use the full range of spells
        if not self.is_consumable:
            break_flags = self.features["breakeffect"] & 0xC0
            self.features["otherproperties"] |= break_flags >> 4
            self.features["breakeffect"] &= ~0xC0

        self.price = read_multi(f, length=2)

        if all_spells is None:
            all_spells = get_ranked_spells(filename)
            all_spells = [s for s in all_spells if s.valid]

        f.seek(0x2CE408 + (8 * self.itemid))
        self.weapon_animation = list(f.read(8))

        f.seek(0x12B300 + (13 * self.itemid))
        self.dataname = list(f.read(13))

        # unhardcoded tintinabar patch moves the tintinabar flag
        if self.features["fieldeffect"] & 0x80:
            self.features["fieldeffect"] &= ~0x80
            self.features["special2"] |= 0x80

        f.close()