def run(self, status: Status):
        if not self.config['starters_npcs']['npcs']:
            return status.done()

        status.step("Apply 'ActorAndLevelLoader' patch...")
        patcher = Patcher(self.rom, self.static_data)
        if not patcher.is_applied('ActorAndLevelLoader'):
            patcher.apply('ActorAndLevelLoader')

        status.step("Updating special recruitment table...")

        actor_list: ActorListBin = FileType.SIR0.unwrap_obj(
            FileType.SIR0.deserialize(
                self.rom.getFileByName('BALANCE/actor_list.bin')),
            ActorListBin)

        binary = get_binary_from_rom_ppmdu(
            self.rom, self.static_data.binaries['overlay/overlay_0011.bin'])
        sp_list = HardcodedRecruitmentTables.get_monster_species_list(
            binary, self.static_data)

        for i, actor in enumerate(actor_list.list):
            if i in ACTOR_TO_RECRUIT_MAPPING:
                for bi in ACTOR_TO_RECRUIT_MAPPING[i]:
                    sp_list[bi] = actor.entid

        HardcodedRecruitmentTables.set_monster_species_list(
            sp_list, binary, self.static_data)
        set_binary_in_rom_ppmdu(
            self.rom, self.static_data.binaries['overlay/overlay_0011.bin'],
            binary)

        status.done()
Esempio n. 2
0
 def get_recruitment_list(self) -> Tuple[List[int], List[int], List[int]]:
     """Returns the recruitment lists: species, levels, locations"""
     ov11 = self.project.get_binary(BinaryName.OVERLAY_11)
     static_data = self.project.get_rom_module().get_static_data()
     species = HardcodedRecruitmentTables.get_monster_species_list(ov11, static_data)
     level = HardcodedRecruitmentTables.get_monster_levels_list(ov11, static_data)
     location = HardcodedRecruitmentTables.get_monster_locations_list(ov11, static_data)
     return species, level, location
Esempio n. 3
0
 def update(ov11):
     static_data = self.project.get_rom_module().get_static_data()
     HardcodedRecruitmentTables.set_monster_species_list(
         species, ov11, static_data)
     HardcodedRecruitmentTables.set_monster_levels_list(
         level, ov11, static_data)
     HardcodedRecruitmentTables.set_monster_locations_list(
         location, ov11, static_data)
Esempio n. 4
0
#  You should have received a copy of the GNU General Public License
#  along with SkyTemple.  If not, see <https://www.gnu.org/licenses/>.
# mypy: ignore-errors
import os

from ndspy.rom import NintendoDSRom

from skytemple_files.common.util import get_ppmdu_config_for_rom, get_binary_from_rom_ppmdu
from skytemple_files.hardcoded.recruitment_tables import HardcodedRecruitmentTables

base_dir = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')
rom_us = NintendoDSRom.fromFile(os.path.join(base_dir, 'skyworkcopy_us.nds'))
ppmdu_us = get_ppmdu_config_for_rom(rom_us)
ov11_us = get_binary_from_rom_ppmdu(rom_us, ppmdu_us.binaries['overlay/overlay_0011.bin'])

species = HardcodedRecruitmentTables.get_monster_species_list(ov11_us, ppmdu_us)
level = HardcodedRecruitmentTables.get_monster_levels_list(ov11_us, ppmdu_us)
location = HardcodedRecruitmentTables.get_monster_locations_list(ov11_us, ppmdu_us)

for i, (e_species, e_level, e_location) in enumerate(zip(species, level, location)):
    print(i, e_species, e_level, e_location)
    
# Try setting and see if still same.
HardcodedRecruitmentTables.set_monster_species_list(species, ov11_us, ppmdu_us)
assert species == HardcodedRecruitmentTables.get_monster_species_list(ov11_us, ppmdu_us)

HardcodedRecruitmentTables.set_monster_levels_list(level, ov11_us, ppmdu_us)
assert level == HardcodedRecruitmentTables.get_monster_levels_list(ov11_us, ppmdu_us)

HardcodedRecruitmentTables.set_monster_locations_list(location, ov11_us, ppmdu_us)
assert location == HardcodedRecruitmentTables.get_monster_locations_list(ov11_us, ppmdu_us)