User:HertzDevil/Reverse-engineering notes

From Fire Emblem Heroes Wiki
Jump to: navigation, search


Growth percentages[edit | edit source]

The game internally stores growth rates of all Heroes and generic units as percentages. Only multiples of 5% are ever used; however, growth rates are defined for growth percentages that are not multiples of 5 (this has been verified by a debugger). The growth percentage is multiplied by an additional rarity factor:

1★ 2★ 3★ 4★ 5★
0.86 0.93 1.00 1.07 1.14

The truncated result produces the following master growth table:

GP 1★ 2★ 3★ 4★ 5★
-4 0 0 0 0 0
-3 4 4 5 5 5
-2 8 9 10 10 11
-1 12 13 15 16 17
0 17 18 20 21 22
1 21 23 25 26 28
2 25 27 30 32 34
3 30 32 35 37 39
4 34 37 40 42 45
5 38 41 45 48 51
6 43 46 50 53 57
7 47 51 55 58 62
8 51 55 60 64 68
9 55 60 65 69 74
10 60 65 70 74 79
11 64 69 75 80 85
12 68 74 80 85 91
13 73 79 85 90 96

This table is used directly for the randomization of stat growth tables (see below). Stat growth values can be derived from this table by GrowthValue = trunc(0.39 × GrowthPercent), or directly calculated by GrowthValue = trunc(0.39 × trunc((GrowthPoint × 5 + 20) × (0.79 + 0.07 × Rarity))).

Enemy stats for derived maps[edit | edit source]

Certain game modes (Chain Challenge, Squad Assault, Blessed Gardens) derive their maps from existing story / paralogue maps. Chain Challenge scenarios use base maps at their respective difficulties, whereas the other two game modes always use base maps at Lunatic. Their stats are determined as follows:

  • First, if the unit's rarity is increased, then the usual base stat changes for playable Heroes apply, using the base stats defined in either hero_definition or enemy_definition.
  • Each stat is increased by trunc((newGP × (newLv - 1) - oldGP × (origLv - 1)) ÷ 100), where origLv is the unit's original level, newLvorigLv is the new level, oldGP is the growth percentage at the unit's old rarity, and newGPoldGP is the growth percentage at the new rarity. Levels above 40 are defined as follows:
Game mode Difficulty Levels
Chain Challenge Lunatic, single-chapter Story 40/41/42/43/45
Hard, double-chapter Story 40/40/41/41/43/42/42/43/43/45
Lunatic, double-chapter Story 45/45/46/46/48/47/47/48/48/50
Lunatic, single-chapter Paralogue 40/42/45
Hard, double-chapter Paralogue 40/41/43/42/43/45
Lunatic, double-chapter Paralogue 45/46/48/47/48/50
Squad Assault Lunatic 50/50/50/50/50
Blessed Gardens Lunatic 45
Infernal 50
Blessed Grounds Odd-numbered Grounds 45
Even-numbered Grounds 50
Tempest Trials Lunatic, Lv. 40 40/41/42/43/44/45/45
A few special cases:
  • If only the level is changed, the formula reduces to trunc(GP × (newLv - origLv) ÷ 100).
  • If only the rarity is changed, the formula reduces to trunc((newGP - oldGP) × (Lv - 1) ÷ 100).
  • If both rarity and level are unchanged, no stat boosts occur at this stage.
  • The HP of all enemies is further calculated as trunc(HP × HPFactor), where HPFactor is a global multiplier that depends only on the game mode:
Game mode Difficulty HP factor
Chain Challenge Normal, single-chapter 1.1
Hard, single-chapter 1.2
Lunatic, single-chapter 1.3
Normal, double-chapter Story 1.1 for first half, 1.2 for second half
Hard, double-chapter Story 1.2 for first half, 1.3 for second half
Lunatic, double-chapter Story 1.3 for first half, 1.4 for second half
Normal, double-chapter Paralogue 1.1
Hard, double-chapter Paralogue 1.2
Lunatic, double-chapter Paralogue 1.3
Squad Assault Lunatic 1.3
Blessed Gardens Normal 0.8
Hard 0.8
Lunatic 1.1
Infernal 1.5
Blessed Grounds Odd-numbered Grounds 1.1
Even-numbered Grounds 1.5
Tempest Trials Normal, Lv. 8 0.90/0.90/0.90
Normal, Lv. 14 0.90/0.90/0.95
Normal, Lv. 20 0.95/0.95/1.00
Hard, Lv. 25 1.00/1.00/1.00/1.05
Hard, Lv. 30 1.00/1.00/1.05/1.05/1.10
Lunatic, Lv. 35 1.00/1.05/1.10/1.15/1.20
Lunatic, Lv. 40 1.00/1.05/1.10/1.15/1.20/1.25/1.30
  • Skills are promoted as follows:
    • While skill_definition::next_skill points to a valid skill name, and the unit's rarity is higher than or equal to skill_definition::promotion_rarity, the current skill is replaced by skill_definition::next_skill; this continues until no more promotions can be made. Skills are never demoted, and promotion takes place even if the unit's rarity does not change between the base map and the derived map. Empty skill slots in the base map are never occupied in derived maps.
    • Additionally, only skills with skill_definition::promotion_tier nonzero and also less than or equal to a per-map tier are allowed to promote. Currently this tier number is always 1 on scenarios for derived maps, so Staff weapons, Assists, and Specials are never promoted (see table below). (Then how does Loki's Gravity promote to Thökk on Ruler of Flame CC Hard? Investigate)
    • As an exception, if a weapon skill belongs to the unit's default skill chain, the unit's default weapon at the new rarity is used. Added skills that are unlockable such as Wing Sword are not considered.
    • For the purposes of promotion, enemy units behave as if their default weapon at 5★ is enemy_definition::top_weapon. (Investigate this too)

(Random enemy stats, like those in Tempest Trials and Training Tower, have not been determined. HP factors for Tempest Trials are shown for convenience.)

next_skill exists if and only if both promotion_rarity and promotion_tier are nonzero. The table below lists the skill types that have canonical upgrades:

Skills promotion_rarity promotion_tier
Rank 1 non-staff weapons (excluding exclusive skills e.g. Icon Class Red Sword.png Wing Sword) 3 1
Rank 1 staff weapons (Icon Class Colorless Staff.png Assault) 3 2
Rank 2 non-staff weapons 4 1
Rank 3 non-staff weapons 5 1
Rank 2 staff weapons 5 2
Rank 1 staff Assists (Icon Skill Assist.png Heal) 3 2
Rank 2 staff Assists (Icon Skill Assist.png Mend, Icon Skill Assist.png Reconcile) 4 2
Rank 3 staff Assists 5 2
Rank 1 offensive / defensive Specials 4 2
Rank 1 Passives (excluding single-rank skills e.g. Lunge.png Lunge) 4 1
Rank 2 Passives 5 2

Growth vectors[edit | edit source]

The file Common/SRPG/Grow.bin.lz contains the seemingly random growth vectors used in the game. The decompressed file contains 2496 XOR-encrypted 64-bit little-endian bit vectors starting from address 0x30, where the n-th bit indicates whether a given stat should increase when the hero reaches level n. An example of reading the vectors directly from the binary file:

#!/usr/bin/env ruby

# this cipher is hardcoded inside and appears exactly once
CIPHER = [0x0C, 0xE6, 0xBB, 0x0C, 0x1D, 0x0F, 0x1E, 0xA8]'Common', 'SRPG', 'Grow.bin'), 'rb') do |f| 0x30
  (39 * 64).times do |vec_id|
    bytes =
    bytes_xor = {|x, y| x ^ y}
    bits = {|i| bytes_xor[i / 8][i % 8]}
    puts vec_id.to_s + ': ' + bits.join

For example, Brave Lyn's neutral growth vectors are: (the used portions are shown in boldface)

Stat Vector ID
HP 00100011 01100010 10110110 11100100 01001100 10000000 00000000 00000000 29
Atk 00011111 11001111 01110110 10101101 10101110 00000000 00000000 00000000 26
Spd 00001111 00110111 01011101 11111110 11010100 10000000 00000000 00000000 39
Def 00001010 00000000 01110010 00111111 00010000 00000000 00000000 00000000 00
Res 00011111 00001110 01110010 10011101 01110100 10000000 00000000 00000000 33

Here ID is the lowest 6 bits of the vec_id field, as there are 64 possible variations for each stat growth amount between 1 and 39. This growth vector ID, together with the growth amount determined by the hero's rarity and the stat's GP, uniquely identifies the growth vector used by that stat. It is possible to infer missing entries from the complete stat tables as long as exactly one out of 64 variations correlates with the given entries, or even guess the vector ID if one or two of the given stats are incorrect.

Growth vector IDs change with the hero's IVs: (they warp around 00-63)

Hero Rarity Variation HP Atk Spd Def Res
Lyn: Brave Lady 5 Bane 23 20 33 58 27
Lyn: Brave Lady 5 Neutral 29 26 39 00 33
Lyn: Brave Lady 5 Boon 35 32 45 05 38

the hero's rarity:

Hero Rarity Variation HP Atk Spd Def Res
Olivia: Blushing Beauty 1 Neutral 41 20 38 31 35
Olivia: Blushing Beauty 2 Neutral 44 23 42 34 38
Olivia: Blushing Beauty 3 Neutral 48 27 47 38 42
Olivia: Blushing Beauty 4 Neutral 51 30 51 41 45
Olivia: Blushing Beauty 5 Neutral 54 34 55 45 49

and a single byte (hero_definition::base_vector_id) from the structs under Common/SRPG/Person that hold hero data:

Hero Rarity Variation BVID HP Atk Spd Def Res
Robin: High Deliverer 5 Neutral 43 15 53 60 03 56
Robin: Mystery Tactician 5 Neutral BF 11 49 56 63 52
Lucina: Future Witness 5 Neutral C2 22 02 15 57 46
Marth: Enigmatic Blade 5 Neutral 12 38 18 31 09 62

Deriving growth vector IDs[edit | edit source]

Growth vector IDs can be calculated as the sum of the following terms, keeping only the 6 lowest bits (i.e. modulo 64):

  • 3 × (5-star level 1 neutral base stat);
  • A constant offset depending on the stat being calculated for, which increases "randomness":
HP Atk Spd Def Res
-35 -28 -21 -14 -7
  • The growth percentage corresponding to the Hero's rarity and the stat's GP;
  • The hero's base vector ID (hero_definition::base_vector_id). It is currently unknown if the highest 2 bits are computationally meaningful since the modulo operation discards them.

Brave Lyn's base vector ID is 0x9D. The growth vector IDs for her neutral stats can be computed as follows:

  • HP: (3 × 16 + (−35) + 51 + 157) mod 64 = 221 mod 64 = 29
  • Atk: (3 × 7 + (−28) + 68 + 157) mod 64 = 218 mod 64 = 26
  • Spd: (3 × 9 + (−21) + 68 + 157) mod 64 = 231 mod 64 = 39
  • Def: (3 × 5 + (−14) + 34 + 157) mod 64 = 192 mod 64 = 0
  • Res: (3 × 6 + (−7) + 57 + 157) mod 64 = 225 mod 64 = 33

This matches her vector IDs given at the top. This has been verified to match all pre-existing 5-star stat tables on this wiki.

Identical stat growths[edit | edit source]

Due to the modulo operation it is theoretically possible that two completely different stats on the same hero use the same growth vector: (currently this is limited to HP/Atk base being 7 higher than Def/Res and GPs being the same)

Hero Stat A Base GP Stat B Base GP GVID Growth Vector
Chrom: Gifted Leader Atk Bane 11 8 Res Boon 6 8 1 01100110 11000111 11100001 11110110 11111101
Tiki: Dragon Scion HP Bane 14 7 Def Neutral 8 7 22 00101111 01111011 00111100 01010110 10111100
Tiki: Dragon Scion HP Neutral 15 8 Def Boon 9 8 28 01001001 11000111 10110011 11111101 11110110

Basic data types[edit | edit source]

Main article: User:HertzDevil/Reverse-engineering notes/Basic data types

Enumeration types[edit | edit source]

Main article: User:HertzDevil/Reverse-engineering notes/Enumeration types
enum class weapon_index : uint8_t;
enum class move_index : uint8_t;
enum class tome_element : uint8_t;
enum class legendary_element : uint8_t;
enum class shard_color : uint8_t;
enum class badge_color : uint8_t;

Player hero definitions[edit | edit source]

The files at Common/SRPG/Person/ define data for the heroes which can be obtained by players.

List parameters: using hero_definition_list = obj_list<hero_definition, 0xDE51AB793C3AB9E1>;

stats_tuple[edit | edit source]

struct alignas(8) stats_tuple {
  int16_t hp;        // XOR cipher: 32 D6
  int16_t atk;       // XOR cipher: A0 14
  int16_t spd;       // XOR cipher: 5E A5
  int16_t def;       // XOR cipher: 66 85
  int16_t res;       // XOR cipher: E5 AE
  int16_t _unknown1;
  int16_t _unknown2;
  int16_t _unknown3;

A tuple representing the five stat values. The meaning of the tuple depends on the context.

legendary_info[edit | edit source]

struct legendary_info {
  stats_tuple bonus_effect;
  legendary_element element; // XOR cipher: 05
  uint8_t bst;               // XOR cipher: 0F
  bool is_duel;              // XOR cipher: 80
  // 5 bytes of padding

The struct that defines the Legendary effect of a Legendary Hero.

  • bonus_effect: Bonus stats granted to blessed allies when this Legendary effect is active
  • element: The active season of this Legendary effect.
  • bst: Stat total used by the Legendary Hero in modes like Arena.
  • is_duel: If true, the Legendary Hero may receive stat total boosts in modes like Arena.

hero_definition[edit | edit source]

struct hero_definition {
  crypt_string<ID> id_tag;
  crypt_string<ID> roman;
  crypt_string<ID> face_name;
  crypt_string<ID> face_name2;
  file_ptr_t<legendary_info> legendary;
  time_t timestamp;                     // XOR cipher: 9B 48 B6 E9 42 E7 C1 BD
  uint32_t id_num;                      // XOR cipher: 18 4E 6E 5F
  uint32_t sort_value;                  // XOR cipher: 9B 34 80 2A
  weapon_index weapon_type;             // XOR cipher: 06
  magic_element tome_class;             // XOR cipher: 35
  move_index move_type;                 // XOR cipher: 2A
  uint8_t series;                       // XOR cipher: 43
  bool regular_hero;                    // XOR cipher: A1
  bool permanent_hero;                  // XOR cipher: C7
  uint8_t base_vector_id;               // XOR cipher: 3D
  bool refresher;                       // XOR cipher: FF
  uint8_t _unknown2;
  // 7 bytes of padding
  stats_tuple base_stats;
  stats_tuple growth_rates;
  crypt_string<ID> skills[5][14];

Complete definition of a hero.

  • id_tag: Internal string identifier of the hero. Begins with PID_.
  • roman: Internal Romanized name of the hero. Used for example to derive file names of voice files.
  • face_name: The directory name at Common/Face/ that contains portraits for the hero.
  • face_name2: Appears to be always identical to face_name. Purpose unknown.
  • legendary: If non-null, this hero is a Legendary Hero and has the element / effects given in the pointed-to struct.
  • timestamp: A POSIX timestamp relative to the hero's release date; half a month into the future for heroes released before Version 2.0.0, 1 month into the future for heroes released since Version 2.0.0. This hero would appear in the Training Tower if timestamp is not -1 and the current time is past timestamp. (Needs confirmation)
  • id_num: The internal ID of the hero. This is the same as the InternalID field of Template:Hero_Infobox/SortOrder.
  • sort_value: A decimal value used to order characters within the same series. The main character has a value of 100100. The largest one or two digits usually indicate which in-game region / part the character comes from. Examples:
Value Region(s) / Part(s)
1 Askr, Altea, Echoes Act 1, Chalphy, Lenster (Thracia 776), Pherae (Binding Blade), main characters (Blazing Blade), Renais,
2 Talys, Echoes Act 2, Ostia (Binding Blade), Frelia,
3 Archanea, Echoes Act 3, Velthomer, Araphen, Ostia (Blazing Blade), Grado,
4 Macedon, Etruria, Jehanna,
  • weapon_type: The color / weapon class of the hero.
  • tome_class: The element type for tome users. Purpose unknown, as for example Fire users can learn Flux and vice versa.
  • move_type: Move type of the hero.
  • series: The game the character originates from.
Value Encrypted Series
0 0x43 Heroes
1 0x42 Shadow Dragon and the Blade of Light / Mystery of the Emblem / Shadow Dragon / New Mystery of the Emblem
2 0x41 Gaiden / Echoes
3 0x40 Genealogy of the Holy War
4 0x47 Thracia 776
5 0x46 The Binding Blade
6 0x45 The Blazing Blade
7 0x44 The Sacred Stones
8 0x4B Path of Radiance
9 0x4A Radiant Dawn
10 0x49 Awakening
11 0x48 Fates
  • regular_hero: True if the hero is available in the random pool.
  • permanent_hero: True if the hero cannot be sent home nor merged.
  • base_vector_id: The byte that determines where to start counting the growth vectors of the hero.
  • refresher: True if the hero can learn Sing or Dance. At most one such unit can be present in a brigade, even when Sing or Dance is not equipped.
  • base_stats: Level 1 neutral stats at 3★.
  • growth_rates: Neutral growth rates as percentages at 3★. Equivalent to GP × 5 + 20.
  • skills: A two-dimensional array where non-null entries point to internal skill identifiers (ones that begin with SID_). The n-th row of the array represents learnable skills of the hero at rarity n. The column index indicates the skill category:
Index Category
0 Default Weapon
1 Default Assist
2 Default Special
6 Unlocked Weapon
7 Unlocked Assist
8 Unlocked Special
9 Unlocked Passive A
10 Unlocked Passive B
11 Unlocked Passive C
3, 4, 5, 12, 13 Unknown
Unlocked skills do not always match their categories, but this only occurs on 5 of the launch heroes.

Enemy definitions[edit | edit source]

The files at Common/SRPG/Enemy/ define data for enemy-only units. This means enemies have base stats and GPs too.

List parameters: using enemy_definition_list = obj_list<enemy_definition, 0x62CA95119CC5345C>;
struct enemy_definition {
  crypt_string<ID> id_tag;
  crypt_string<ID> roman;
  crypt_string<ID> face_name;
  crypt_string<ID> face_name2;
  crypt_string<ID> top_weapon;
  time_t timestamp;            // XOR cipher: 9B 48 B6 E9 42 E7 C1 BD
  uint32_t id_num;             // XOR cipher: D4 41 2F 42
  uint8_t weapon_type;         // XOR cipher: E4
  uint8_t tome_class;          // XOR cipher: 81
  uint8_t move_type;           // XOR cipher: 0D
  bool _unknown1;              // XOR cipher: C5
  bool is_boss;                // XOR cipher: 6A
  // 7 bytes of padding
  stats_tuple base_stats;
  stats_tuple growth_rates;
  • top_weapon: If non-null, points to the identifier for the weapon equipped by this unit when promoted to 5★ in derived maps. For example Veronica's points to Élivágar, and all generic enemies have this field null.
  • is_boss: True if this unit is an enemy boss, false if this unit is a generic unit.
  • base_stats: Hypothetical base stats for the enemy at 3★. Used in derived maps for rarity promotion.
  • growth_rates: Hypothetical growth rates for the enemy at 3★. Used in derived maps for leveling up.

Other fields have the same meaning as in hero_definition.

Terrain definitions[edit | edit source]

The file Common/SRPG/Terrain.bin defines all 31 terrains used in the game. These only handle the gameplay aspects; animation background is defined elsewhere. Movement costs are defined in Common/SRPG/Move.bin.lz.

List parameters: using terrain_definition_list = obj_list<terrain_definition, 0x22252DA3A87C933C>;

terrain_definition[edit | edit source]

struct terrain_definition {
  uint32_t index;           // XOR cipher: AB A1 E0 DA
  int32_t base_terrain;     // XOR cipher: D2 7D D0 6F
  int32_t foe_base_terrain; // XOR cipher: D2 7D D0 6F
  int8_t side;              // XOR cipher: 21
  uint8_t terrain_group;    // XOR cipher: CB
  bool inaccessible;        // XOR cipher: 16
  uint8_t hp;               // XOR cipher: BA
  bool is_wall;             // XOR cipher: A8
  bool is_liquid;           // XOR cipher: 7C
  bool is_bridge;           // XOR cipher: 08
  bool is_trench;           // XOR cipher: 30
  bool is_fortress;         // XOR cipher: DA
  bool is_rd_terrain;       // XOR cipher: CD
  uint8_t mit_mod;          // XOR cipher: AA
  uint8_t regen_hp;         // XOR cipher: 7D
  • index: The index of the terrain.
  • base_terrain: The terrain index to use when this terrain is destroyed by an ally, or -1 if this terrain is not breakable by allies.
  • foe_base_terrain: The terrain index to use when this terrain is destroyed by a foe, or -1 if this terrain is not breakable by foes. Used in Rival Domains and Grand Conquests.
  • side: 0 if the terrain belongs to the player, 1 if enemy, -1 otherwise.
  • terrain_group: Purpose unknown. Might have been used for animation backgrounds?
  • inaccessible: True if the terrain cannot be entered by any unit. Certain tiles such as the banners from Tactics Drills are inaccessible but not wall terrains.
  • hp: Number of hits the terrain can take before it is destroyed.
  • is_wall: True for wall terrains, false otherwise. Wall terrains use different tile graphics depending on whether adjacent tiles are also walls (except breakable ice and crates because these tilemaps have identical graphics for all directions).
  • is_liquid: True for water bodies and lava, false otherwise. Purpose unknown.
  • is_bridge: True for bridge terrains, false otherwise. Purpose unknown.
  • is_trench: True for trench terrains, false otherwise.
  • is_fortress: Whether destroying this terrain causes a victory or loss. Used for player and enemy fortresses.
  • is_rd_terrain: True for the special terrains used in Rival Domains and Grand Conquests, false otherwise. Purpose unknown (since it can be derived from other struct members).
  • mit_mod: Mitigation modifier as a percentage; 30 for defensive terrain, 0 otherwise.
  • regen_hp: Amount of HP regenerated on each turn; 10 for fortresses and camps, 0 otherwise.

Terrain types[edit | edit source]

Index Terrain terrain_group
0 Outdoor 0
1 Indoor 1
2 Desert 2
3 Forest 3
4 Mountain 0
5 River 11
6 Sea 4
7 Lava 5
8 Wall 0
9 Outdoor breakable wall 0
10 Outdoor breakable wall (2x) 0
11 Indoor breakable wall / crate 1
12 Indoor breakable wall / crate (2x) 1
13 Desert breakable wall 2
14 Desert breakable wall (2x) 2
15 Bridge 6
16 Outdoor defensive terrain 7
17 Defensive forest 8
18 Indoor defensive terrain 9
19 Bridge breakable wall 6
20 Bridge breakable wall (2x) 6
21 Inaccessible 0
22 Outdoor trench 0
23 Indoor trench 1
24 Outdoor defensive trench 7
25 Indoor defensive trench 9
26 Indoor water 1
27 Player fortress 10
28 Enemy fortress 10
29 Player camp 10
30 Enemy camp 10
31 Outdoor player camp (Relay Defense) 10
32 Indoor player camp (Relay Defense) 10
33 Player structure 0
34 Enemy structure 0

Field graphics definitions[edit | edit source]

The files atCommon/SRPG/Field/ define the graphical assets maps use.

List parameters: using field_gfx_list = obj_list<field_gfx_definition, 0x1D90083CCADFBC58>;

gfx_resource_t[edit | edit source]

struct gfx_resource {
  crypt_string<ID> kind;
  crypt_string<NONE> filename;

A single graphical asset.

  • kind: A descriptive string for the asset.
  • filename: If non-null, points to the asset's filename relative to Common/Field/Common. Otherwise this asset has no visible sprites.

field_gfx_definition[edit | edit source]

struct field_gfx_definition {
  crypt_string<ID> map_id;
  file_ptr_t<gfx_resource> wall;
  file_ptr_t<gfx_resource> backdrop;
  file_ptr_t<gfx_resource> overlay[2];
  crypt_string<NONE> anim;

Mapping from a map to its graphical assets.

  • map_id: The internal identifier of the map. Additionally, CHIP0 is used for all generic outdoor maps, and CHIP1 for indoor maps.
  • wall: The sprites for wall terrains. Walls are only drawn if at least one wall tile is breakable; otherwise, wall graphics are directly embedded in the map image.
  • backdrop: The sprite for the map's backdrop.
  • overlay: The sprites for the map's overlays. Up to 2 can be defined.
  • anim: A descriptive string representing the battle animation background.

Map definitions[edit | edit source]

The files at Common/SRPGMap/ define data for permanent maps, including final Tempest Trials maps. Maps for game mode variants, such as those for Chain Challenges, are not stored here.

map_position[edit | edit source]

struct map_position {
  uint16_t x; // XOR cipher: 32 B3
  uint16_t y; // XOR cipher: B2 28

Coordinates representing a point on a map.

  • x: X position, 0 for the leftmost column.
  • y: Y position, 0 for the bottom-most row.

unit_data[edit | edit source]

struct unit_data {
  crypt_string<ID> id_tag;
  crypt_string<ID> skills[7];
  crypt_string<ID> accessory;
  map_position pos;
  uint8_t rarity;               // XOR cipher: 61
  uint8_t lv;                   // XOR cipher: 2A
  int8_t cooldown_count;        // XOR cipher: 1E
  uint8_t _unknown1;
  stats_tuple stats;
  int8_t start_turn;            // XOR cipher: CF
  int8_t movement_group;        // XOR cipher: F4
  int8_t movement_delay;        // XOR cipher: 95
  bool break_terrain;           // XOR cipher: 71
  bool tether;                  // XOR cipher: B8
  uint8_t true_lv;              // XOR cipher: 85
  bool is_enemy;                // XOR cipher: D0
  // 1 byte of padding
  crypt_string<ID> spawn_check;
  int8_t spawn_count;           // XOR cipher: 0A
  int8_t spawn_turns;           // XOR cipher: 0A
  int8_t spawn_target_remain;   // XOR cipher: 2D
  int8_t spawn_target_kills;    // XOR cipher: 5B
  // 4 bytes of padding

Definition of a single unit placed on the map.

  • id_tag: Internal string identifier of the unit. Begins with PID_ for heroes, and EID_ for enemy-only units.
  • skills: If non-null, the entries point to the internal skill identifiers for the following slots respectively, in that order: Weapon, Assist, Special, Passive A, Passive B, Passive C, Sacred Seal.
  • accessory: If non-null, points to the internal string identifier of the accessory equipped by the unit (begins with DAID_).
  • pos: Initial coordinates of the unit.
  • rarity: Rarity of the unit.
  • lv: Displayed level of the unit.
  • cooldown_count: The initial Special cooldown count of the unit, or -1 to use the default value.
  • stats: Base stats of the unit when all skills are unequipped.
  • start_turn: The first turn by which the unit starts moving regardless of the movement group it belongs to, or -1 if the unit does not move until an opponent engages any unit of the unit's movement group.
  • movement_group: An index shared between units which start moving together; engaging any unit causes all units with the same movement_group value to start moving (unless movement_delay is set and that particular unit is not engaged). A value of -1 means the unit belongs to its own group.
  • movement_delay: Once the unit's movement group starts moving, waits for up to movement_delay turns until this unit is engaged, or moves immediately if this value is equal to -1.
  • break_terrain: Whether the unit considers breakable terrain as breakable.
  • tether: (Whether the unit returns to its initial position if it cannot find any moves to make.)
  • true_lv: Internal level of the unit. The + is shown if this is higher than the displayed level.
  • is_enemy: True if the unit is a foe, false if ally. For permanent maps this remained unused until the introduction of Tactics Drills.
  • spawn_check: If non-null, points to an internal unit string identifier used to check whether a reinforcement should be spawned.
  • spawn_count: If this unit appears as a reinforcement, the number of units that can be spawned; otherwise this field is -1 and the unit appears initially.
  • spawn_turns: Number of turns to wait before the unit is allowed to spawn (i.e. the unit will spawn as early as the end of Turn spawn_turns enemy phase or the start of Turn (spawn_turns + 1) player phase), or -1 if the unit can spawn on any turn.
  • spawn_target_remain: If not -1, this unit spawns only when the number of units with internal identifier spawn_check is equal to spawn_target_remain. (Existing map files only use 0 so far.)
  • spawn_target_kills: If not -1, this unit spawns only when at least spawn_target_kills units with internal identifier spawn_check are defeated.

field_definition[edit | edit source]

struct field_definition {
  crypt_string<ID> id;
  uint32_t width;                             // XOR cipher: 5F D7 7C 6B
  uint32_t height;                            // XOR cipher: D5 12 AA 2B
  int8_t base_terrain;                        // XOR cipher: 41
  // 7 bytes of padding
  uint8_t terrain[/* height */][/* width */]; // XOR cipher: A1

Terrain data of a map. Graphical information is stored outside map files.

  • id: Internal string identifier of the map. For permanent maps this is just the filename without the extension and the difficulty (e.g. S2115).
  • width: Width of the map.
  • height: Height of the map.
  • base_terrain: Default terrain index of the map. If this is not -1, special defaults (CHIP0 and CHIP1) for field graphics representing this terrain are used, otherwise the map would have its own entry in the files under Common/SRPG/Field/. Used in maps for Rival Domains and Tactics Drills.
  • terrain: Terrain indices, starting from the bottom to the top, then from left to right within each row. This ordering is consistent with map_position.

map_definition[edit | edit source]

struct map_definition {
  uint32_t _unknown1;
  uint32_t highest_score;                // XOR cipher: B1 50 E2 A9
  file_ptr_t<field_definition> field;
  file_ptr_t<map_position[]> player_pos;
  file_ptr_t<unit_data[]> units;
  uint32_t player_count;                 // XOR cipher: 9A C7 63 9D
  uint32_t unit_count;                   // XOR cipher: EE 10 67 AC
  uint8_t turns_to_win;                  // XOR cipher: FD
  bool last_enemy_phase;                 // XOR cipher: C7
  uint8_t turns_to_defend;               // XOR cipher: EC
  // 5 bytes of padding

Top-level definition of a map. One instance appears in each map file at $20.

  • highest_score: What appears to be the maximum score among all units where the score matches the displayed stat sum only for the few easiest maps. Purpose unknown.
  • field: Terrain definition of this map.
  • player_pos: List of coordinates for the player's team, in the order they are placed. Each element is followed by 4 bytes of padding. For Tactics Drills maps this list is empty.
  • units: List of units on the map, including all reinforcements.
  • player_count: Length of the player_pos array.
  • unit_count: Length of the units array.
  • turns_to_win: If non-zero, the maximum number of turns under which the player must win the map.
  • last_enemy_phase: Whether the enemy phase occurs on the last turn if turns_to_win is given. Only used for Tactics Drills maps.
  • turns_to_defend: If non-zero, the number of turns the player must defend in order to win the map.

BGM assignments[edit | edit source]

The files at Common/SRPG/StageBgm/ define which songs maps and enemy battles use. Files under the Occupation/ subdirectory are for Grand Conquests, but they specify to use the "Default" music, which is actually the list of random BGM, stored in Preset/00_first.bin.lz.

file_name_pair_t<T>[edit | edit source]

template <typename T>
struct file_name_pair_t {
  uint32_t ptr_offset;
  uint32_t name_offset;

bgm_assignment[edit | edit source]

struct bgm_assignment {
  // ...

Weapon class definitions[edit | edit source]

The file assets/Common/SRPG/Weapon.bin defines the weapon classes used by units. Weapon skills only indicate which weapon classes can equip them; common weapon attributes are defined in the weapon classes rather than the weapon skills.

List parameters: using skill_list = obj_list<weapon_class_definition, 0xA7BA17EB6D664C4F>;
struct weapon_class_definition {
  crypt_string<ID> id_tag;
  crypt_string<NONE> sprite_base[2];
  crypt_string<ID> base_weapon;
  weapon_index index;                // XOR cipher: 0C 41 D3 90
  uint8_t color;                     // XOR cipher: 2C
  uint8_t range;                     // XOR cipher: 8B
  uint8_t _unknown1;                 // XOR cipher: D0
  uint8_t equip_group;               // XOR cipher: B7
  bool res_damage;                   // XOR cipher: 07
  bool is_staff;                     // XOR cipher: 78
  bool is_dagger;                    // XOR cipher: D7
  bool is_breath;                    // XOR cipher: 11
  bool is_beast;                     // XOR cipher: B0
  // 3 bytes of padding
  • id_tag: Internal string identifier of the weapon class, e.g. WID_赤弓 for  Red bow.
  • sprite_base: Filename prefixes of the weapon sprites used for this weapon class, e.g. wep_bw and wep_ar for bow classes.
  • base_weapon: Internal string identifier of the base weapon skill, e.g. SID_鉄の弓 (Icon Skill Weapon.png Iron Bow for all bow classes.
  • index: Internal index of the weapon class.
  • color: Color of the weapon class.
Value Encrypted Color
0 0x2C Colorless
1 0x2D Red
2 0x2E Blue
3 0x2F Green
  • range: Default attack range of the weapon class. Only SLID_周囲戦闘_敵射程, used by Close Guard 3.png Close Guard 3 and Distant Guard 3.png Distant Guard 3, check this value.
  • equip_group: Group index of the weapon class as classified according to the skill menu used during skill inheritance.
  • res_damage: Uses the foe's Res to calculate damage if true, uses Def otherwise.
  • is_staff: If true, allows skill_definition::class_params to grant the effect of Wrathful Staff 3.png Wrathful Staff 3 or Dazzling Staff 3.png Dazzling Staff 3.
  • is_dagger: If true, allows skill_definition::class_params to inflict stat penalties on foes.
  • is_breath: If true, allows skill_definition::class_params to calculate damage using the lower of foe's Def or Res.
  • is_beast: If true, allows the unit to transform into a beast and receive stats from skill_definition::class_params.

Only one of is_staff, is_dagger, is_breath, and is_beast can be used by skills, in that order of precedence.

Skill definitions[edit | edit source]

All skills, including refined weapons and exclusive skill refinements, are defined in the files at Common/SRPG/Skill/.

List parameters: using skill_list = obj_list<skill_definition, 0x7FECC7074ADEE9AD>;
struct skill_definition {
  crypt_string<ID> id_tag;
  crypt_string<ID> refine_base;
  crypt_string<ID> name_id;
  crypt_string<ID> desc_id;
  crypt_string<ID> refine_id;
  crypt_string<ID> beast_effect_id;
  crypt_string<ID> prerequisites[2];
  crypt_string<ID> next_skill;
  crypt_string<NONE> sprites[4];
  stats_tuple stats;
  stats_tuple class_params;
  stats_tuple skill_params;
  stats_tuple refine_stats;
  uint32_t num_id;                   // XOR cipher: 23 3A A5 C6
  uint32_t sort_id;                  // XOR cipher: AC F8 DB 8D
  uint32_t icon_id;                  // XOR cipher: 73 21 DF C6
  uint32_t wep_equip;                // XOR cipher: 28 98 B9 35
  uint32_t mov_equip;                // XOR cipher: EB 18 28 AB
  uint32_t sp_cost;                  // XOR cipher: 69 F6 31 C0
  uint8_t category;                  // XOR cipher: BC
  magic_element tome_class;          // XOR cipher: F1
  bool exclusive;                    // XOR cipher: CC
  bool enemy_only;                   // XOR cipher: 4F
  uint8_t range;                     // XOR cipher: 56
  uint8_t might;                     // XOR cipher: D2
  int8_t cooldown_count;             // XOR cipher: 56
  bool assist_cd;                    // XOR cipher: F2
  bool healing;                      // XOR cipher: 95
  uint8_t skill_range;               // XOR cipher: 09
  uint16_t score;                    // XOR cipher: 32 A2
  uint8_t promotion_tier;            // XOR cipher: E0
  uint8_t promotion_rarity;          // XOR cipher: 75
  bool refined;                      // XOR cipher: 02
  uint8_t refine_sort_id;            // XOR cipher: FC
  uint32_t wep_effective;            // XOR cipher: 43 3D BE 23
  uint32_t mov_effective;            // XOR cipher: EB DA 3F 82
  uint32_t wep_shield;               // XOR cipher: 43 B7 BA AA
  uint32_t mov_shield;               // XOR cipher: 5B F2 BE 0E
  uint32_t wep_weakness;             // XOR cipher: AF 02 5A 00
  uint32_t mov_weakness;             // XOR cipher: 19 B8 69 B2
  uint32_t wep_adaptive;             // XOR cipher: 29 26 4E 49
  uint32_t mov_adaptive;             // XOR cipher: 2E EF 6C EE
  uint32_t timing_id;                // XOR cipher: 48 66 77 9C
  uint32_t ability_id;               // XOR cipher: 25 73 B0 72
  uint32_t limit1_id;                // XOR cipher: 32 B8 BD 0E
  int16_t limit1_params[2];          // XOR cipher: 90 A5
  uint32_t limit2_id;                // XOR cipher: 32 B8 BD 0E
  int16_t limit2_params[2];          // XOR cipher: 90 A5
  uint32_t target_wep;               // XOR cipher: D7 C9 9F 40
  uint32_t target_mov;               // XOR cipher: 22 D1 64 6C
  crypt_string<ID> passive_next;
  time_t timestamp;                  // XOR cipher: 51 9F FE 3B F9 39 3F ED
  uint8_t _unknown1;                 // XOR cipher: 10
  uint8_t min_lv;                    // XOR cipher: 90
  uint8_t max_lv;                    // XOR cipher: 24
  uint8_t _unknown2;                 // XOR cipher: 19
  uint8_t _unknown3;                 // XOR cipher: BD
  // 3 bytes of padding
  //crypt_string<ID> id_tag2;
  //crypt_string<ID> next_seal;
  //crypt_string<ID> prev_seal;
  //uint16_t ss_coin;                  // XOR cipher: 40 C5
  //badge_color ss_badge_type;         // XOR cipher: 0F D5
  //uint16_t ss_badge;                 // XOR cipher: EC 8C
  //uint16_t ss_great_badge;           // XOR cipher: FF CC
  • id_tag: Full internal string identifier of the skill, e.g. SID_ジークリンデ_共 for Sieglinde W.png Sieglinde.
  • refine_base: Internal string identifier of the unrefined version of the weapon, e.g. SID_ジークリンデ.
  • name_id: Internal string identifier of the skill name resource, e.g. MSID_ジークリンデ.
  • desc_id: Internal string identifier of the skill description resource, e.g. MSID_H_ジークリンデ改.
  • refine_id: Internal string identifier of the skill that gives rise to the refined skill effect, e.g. SID_強化共有R.
  • refine_id: Internal string identifier of the skill that activates while the unit is transformed into a beast, e.g. SID_化身効果・奥義強化.
  • prerequisites: Internal string identifiers of skills required to learn the current skill.
  • next_skill: Internal string identifier of the canonical upgrade of the current skill. It is defined if and only if promotion_rarity is not zero.
  • sprites: Filenames of the sprites used by the weapon, in this order: bow, weapon / arrow, map animation, AoE Special map animation.
  • stats: Permanent stat bonuses of the skill. For weapons this does not include might.
  • class_params: A set of extra parameters that are used only for skill effects common to weapon classes for which weapon_class_definition::is_staff, is_dagger, or is_breath is true:
    • is_staff: If class_params.hp = 1, damage from unit's staff will be calculated the same as other weapons; If class_params.hp = 2, foe cannot counterattack.
    • is_dagger: After combat, if unit attacked, inflicts stat+class_params on target and foes within class_params.hp spaces of target through their next actions.
    • is_breath: If class_params.hp = 1, and if target_mov foe uses target_wep, calculates damage using the lower of foe's Def or Res.
  • skill_params: Various skill parameters packed into a stat tuple. These do not necessarily represent stat values. Their meanings depend on the skill abilities.
  • refine_stats: Stat bonuses of the skill's refinement, as shown on the weapon description.
  • num_id: A unique increasing index for every skill, added to 0x10000000 for refined weapons.
  • sort_id: The internal sort value used in places such as the skill inheritance menu to order skills within the same category according to their skill families.
  • icon_id: The icon index of the skill, referring to the files UI/Skill_Passive*.png.
  • wep_equip: A bitmask indexed by weapon_index, with bits set for weapon classes that can equip the current skill.
  • mov_equip: A bitmask indexed by move_index, with bits set for movement classes that can equip the current skill.
  • sp_cost: SP required to learn the given skill.
  • category: Category of the skill.
Value Encrypted Category
0 0xBC Weapon
1 0xBD Assist
2 0xBE Special
3 0xBF Passive A
4 0xB8 Passive B
5 0xB9 Passive C
6 0xBA Sacred Seal
7 0xBB Refined weapon skill effect
8 0xB4 Beast transformation effect
  • tome_class: The element type for tome weapon skills.
  • exclusive: True if the skill cannot be inherited.
  • enemy_only: True if the skill can only be equipped by enemies.
  • range: Range of the skill for weapons and Assists, 0 for other skills.
  • might: Might for weapon skills, including bonuses that come from refinements, 0 for other skills.
  • cooldown_count: Cooldown count of the skill. The total cooldown count of a unit is the sum of cooldown_count for all equipped skills. Skills that accelerate Special trigger have a negative value.
  • assist_cd: True if the skill grants Special cooldown count-1 to the unit after this Assist is used.
  • healing: True if the skill is a healing Assist skill.
  • skill_range: Range of the skill effect that comes with the given skill, e.g. 1 for Hone skills and weapons that give equivalent skill effects.
  • score: A value that roughly corresponds to the SP cost of the skill. Might have been used for Arena matches.
  • promotion_tier: 2 for a few low-tier Specials and staff weapons / Assists, 0 for highest-tier skills, and 1 for everything else. Used by derived maps to determine how far skills are allowed to promote.
  • promotion_rarity: If non-zero, this skill would be promoted on derived maps if the unit's rarity is greater than or equal to this value.
  • refined: True if the skill is a refined weapon.
  • refine_sort_id: Internal sort value for refined weapons: 1 and 2 for skills, 101 – 104 for Atk/Spd/Def/Res refinements, 0 otherwise.
  • wep_effective: A bitmask indexed by weapon_index, representing weapon class effectivenesses this skill grants. Only meaningful on weapon skills.
  • mov_effective: A bitmask indexed by move_index, representing movement class effectivenesses this skill grants. Only meaningful on weapon skills.
  • wep_shield: A bitmask indexed by weapon_index, representing weapon class effectivenesses this skill protects from. Used by Icon Skill Weapon.png Breath of Blight.
  • mov_shield: A bitmask indexed by move_index, representing movement class effectivenesses this skill protects from.
  • wep_weakness: A bitmask indexed by weapon_index, representing weapon class weaknesses this skill grants. Used by Icon Class Red Tome.png Loptous.
  • mov_weakness: A bitmask indexed by move_index, representing movement class weaknesses this skill grants. Currently unused.
  • wep_adaptive: A bitmask indexed by weapon_index, representing weapon classes that receive damage from this skill calculated using the lower of Def or Res. Used by breaths. Only meaningful on weapon skills.
  • mov_adaptive: A bitmask indexed by move_index, representing movement classes that receive damage from this skill calculated using the lower of Def or Res. Currently unused. Only meaningful on weapon skills.
  • timing_id: An index into the string table in Common/SRPG/SkillTiming.bin indicating the moment where the skill triggers.
  • ability_id: An index into the string table in Common/SRPG/SkillAbility.bin indicating the skill effect type. A skill can only contain one skill effect (refined weapons have an extra skill effect if refine_id is non-null).
  • limit1_id: An index into the string table in Common/SRPG/SkillTiming.bin indicating the skill's activation restriction.
  • limit1_params: Restriction-dependent parameters.
  • limit2_id, limit2_params: An additional activation restriction on the given skill. Both must be satisfied for the skill to activate.
  • target_wep: A bitmask indexed by weapon_index, representing the target's weapon classes required for the skill's effect to activate. If zero, works on all weapon classes.
  • target_mov: A bitmask indexed by move_index, representing the target's movement classes required for the skill's effect to activate. If zero, works on all movement classes.
  • passive_next: Like next_skill, except that this field is null for weapons, Spur Atk 2.png Spur Atk 2 does not point to Spur Atk 3.png Spur Atk 3, and similarly for the three other Spur passives. (Death Blow 3.png Death Blow 3 pointed to Death Blow 4.png Death Blow 4 even before the CYL2 update.)
  • timestamp: A POSIX timestamp relative to the skill's release date; half a month into the future for skills released before Version 2.0.0, 1 month into the future for skills released since Version 2.0.0. This skill would appear in the Training Tower if timestamp is not -1 and the current time is past timestamp. (Needs confirmation)
  • min_lv, max_lv: If non-zero, represent the lowest and highest levels respectively that allow random units to equip the given skill. (Needs confirmation)

Grand Conquest world definitions[edit | edit source]

The files in Common/Occupation/World/ define the worlds used during Grand Conquests.

gc_area[edit | edit source]

struct gc_area {
  uint32_t node_id;                               // XOR cipher: 00 4F 9C 4B
  uint32_t x;                                     // XOR cipher: 3A 6F 42 5E
  uint32_t y;                                     // XOR cipher: 30 DB 1E 0F
  bool is_base;                                   // XOR cipher: 10
  uint8_t army;                                   // XOR cipher: 01
  uint16_t area_no;                               // XOR cipher: 83 F7
  crypt_string<GC> area_bonuses[2];
  crypt_string<GC> adjacent_area_bonus;
  crypt_string<GC> map_id;
  uint32_t neighbour_count;                       // XOR cipher: B0 B6 5D 6E
  uint32_t neighbours[/* neighbour_count | 1 */]; // XOR cipher: 5E 6E 8E 09

Definition of an area node.

  • node_id: Internal index used to refer this area.
  • x, y: Physical coordinates of the area in pixels.
  • is_base: Whether this area is the base of the army it belongs.
  • army: The army initially controlling this area.
Value Encrypted Army
0 0x01 Alfonse (red)
1 0x00 Sharena (blue)
2 0x03 Anna (green)
  • area_no: The area number.
  • area_bonuses: If non-null, point to strings representing bonuses granted by this area. Valid bonuses are:
String Description
歩行能力強化 Grants Atk/Spd/Def/Res+4 to infantry units.
歩行奥義 Grants Special cooldown charge +1 per attack to infantry units during combat.
(Only highest value applied. Does not stack.)
重装能力強化 Grants Atk/Spd/Def/Res+4 to armored units.
重装移動強化 At start of turn, armored units can move 1 extra space.
(That turn only. Does not stack.)
騎馬能力強化 Grants Atk/Spd/Def/Res+4 to cavalry units.
騎馬追撃 If cavalry units initiate combat, units make a guaranteed follow-up attack.
飛行能力強化 Grants Atk/Spd/Def/Res+4 to flying units.
飛行先導 Units can move to a space adjacent to a flying ally within 2 spaces.
  • adjacent_area_bonus: If non-null, points to a string representing bonuses granted to adjacent areas of the controlling army.
  • map_id: Internal string identifier of the map used by this area.
  • neighbour_count: Number of areas connected to this area.
  • neighbours: An array of integers referring to neighbour areas by their node_id values. Always contains an odd number of entries; invalid entries have a value of 2947461234 (encrypted: 2C DE 20 A6).

gc_world_definition[edit | edit source]

struct gc_world_definition {
  crypt_string<GC> image;
  uint64_t _unknown1;
  uint64_t area_count;                                     // XOR cipher: 4B 88 65 71 3B 36 F5 EF
  file_ptr_t<file_ptr_t<gc_area>[/* area_count */]> areas;

Definition of a Grand Conquest world. Each Grand Conquest consists of 3 world definition files from xxxxA.bin to xxxxC.bin, corresponding to the 3 battles.

  • image: Filename of the world background image, relative to Common/Occupation/BG/.
  • area_count: Number of areas in this world.
  • areas: Array of pointers to area definitions.

Weapon refinement options[edit | edit source]

The files at Common/SRPG/WeaponRefine/ list all weapon refinement options.

List parameters: using refine_option_list = obj_list<refine_option, 0x45162C00432CFD73>;

refine_res_t[edit | edit source]

struct alignas(4) refine_res_t {
  uint16_t res_type; // XOR cipher: 9C 43
  uint16_t count;    // XOR cipher: 44 74

Data for resources used or given by a weapon refinement.

  • res_type: The resource type.
Value Encrypted Type
0 0x439C None
1 0x439D Arena Medal
2 0x439E Refining Stone
3 0x439F Divine Dew
  • count: Number of resource units used or given.

refine_data[edit | edit source]

struct refine_option {
  crypt_string<ID> orig;
  crypt_string<ID> refined;
  refine_res_t use[2];
  refine_res_t give;
  // 4 bytes of padding

Information for a weapon refinement option. SP costs are looked up at skill_definition::sp_cost of the skill corresponding to refined.

  • orig: Internal string identifier of the original weapon.
  • refined: Internal string identifier of the refined weapon.
  • use: Resources used by the given refinement. The first entry's type is either Refining Stone or Divine Dew, the second always Arena Medal.
  • give: Resources given by the given refinement, Divine Dew for exclusive weapons, no resources otherwise.

Quest information[edit | edit source]

The files at assets/Common/Mission/ specify data for Quests & Missions.

List parameters: using quest_group_list = obj_list<quest_group, 0x034E1E0B704C545B>;

quest_unit_match[edit | edit source]

struct quest_unit_match {
  crypt_string<ID> hero_id;
  int32_t color;              // XOR cipher: 65 AD 72 4D
  int32_t wep_type;           // XOR cipher: AC 5B 43 66
  int32_t mov_type;           // XOR cipher: 6F 43 29 E6
  int16_t lv;                 // XOR cipher: 3F 4F
  uint16_t _unknown1;         // XOR cipher: DE C8
  legendary_element blessing; // XOR cipher: B4 7D
  legendary_element blessed;  // XOR cipher: B2 76
  // 4 bytes of padding

Information about player or enemy units required for a given quest.

  • hero_id: If non-null, points to the internal string identifier of the Hero to be used / defeated.
  • color: Color requirement of the Hero.
Value Color
0 Red
1 Blue
2 Green
3 Colorless
-1 Any
  • wep_type: If not -1, a weapon_index value that requires the unit's weapon class index (hero_definition::weapon_type for playable units) to be the given value.
  • mov_type: If not -1, a move_index value that requires the unit's movement class index (hero_definition::move_type for playable units) to be the given value.
  • lv: If not -1, requires the unit's level to be lv or above.
  • blessing: If not 0, requires that the unit has a blessing with the given element conferred, or is a Legendary Hero of the given element.
  • blessed: If not 0, requires that the unit has a blessing with the given element conferred.

quest_definition[edit | edit source]

struct quest_definition {
  crypt_string<ID> quest_id;
  crypt_string<ID> common_id;
  uint32_t times;                    // XOR cipher: 0D 7A F1 2C
  uint32_t trigger;                  // XOR cipher: DF 48 33 E3
  crypt_string<ID> map_group;
  uint32_t game_mode;                // XOR cipher: BA C0 0C 1C
  int32_t difficulty;                // XOR cipher: BB 84 05 F3
  uint32_t _unknown1;                // XOR cipher: 35 39 26 54
  int32_t survive;                   // XOR cipher: DE 41 B1 C2
  uint64_t _unknown2;                // XOR cipher: 5B 00 00 00 00 00 00 00
  uint32_t game_mode2;               // XOR cipher: A9 19 8E 41
  // 4 bytes of padding
  crypt_string<ID> map_id;
  quest_unit_match unit_reqs;
  quest_unit_match foe_reqs;
  file_ptr_t<reward_payload> reward;
  uint32_t payload_size;             // XOR cipher: 62 D6 5A 74
  // 4 bytes of padding

Information for a single quest entry.

  • quest_id: A unique string identifier for the quest. Recurring quests are composed of separate quest definitions that contain a different day or week number in this field (e.g. CHAIN_ARENA_377_A1).
  • common_id: If non-null, points to a separate string identifier shared between common quests across different quest groups, that is used to derive the quest descriptions (e.g. CHAIN_ARENA_A1).
  • times: Number of times the quest has to be fulfilled to obtain its rewards.
  • trigger: The event type that triggers the quest to check if it is fulfilled.
Value Count
1 On foe defeat
2 On scenario clear
3 On Arena Assault clear
4 On Tap Battle floor clear
5 On Tap Battle boss clear
  • map_group: Internal string identifier of the map or event required for the given quest, without the difficulty.
  • game_mode, game_mode2: Game mode for the given quest. The two fields are identical.
Value Quest type
0 None (defeat a foe)
1 Normal map
3 Special map
5 Training Tower
6 Arena Duel
7 Voting Gauntlet
8 Tempest Trials
11 Arena Assault
12 Tap Battle
14 Grand Conquests
  • difficulty: If not -1, the minimum difficulty requirement of the given quest.
Value Maps Arena Duels Arena Assault
1 Hard Intermediate Number of
battles to win
2 Lunatic Advanced
3 Infernal -
  • survive: If not -1, the number of allies that have to survive upon clearing a map (always 4).
  • map_id: Like map_group, but with the map difficulty embedded. Only present on quests that require an exact difficulty.
  • unit_reqs: Requirements for the units that can be used to fulfill the given requirement.
  • foe_reqs: Requirements for the units that can be used to fulfill the given requirement.
  • reward: Pointer to the encrypted reward payload.
  • payload_size: Size of the encrypted reward payload.

quest_list[edit | edit source]

struct quest_list {
  crypt_string<ID> difficulty;
  file_ptr_t<quest_definition[]> quests;
  uint32_t quest_count;                  // XOR cipher: BF 5A B7 E7

All quests from a group at a given difficulty.

  • difficulty: If non-null, points to one of NORMAL, HARD, and LUNATIC. Used for quest lists that have multiple difficulties.
  • quests: Pointer to the array of quest definitions.
  • quest_count: Number of quests defined in the given list.

quest_group[edit | edit source]

struct quest_group {
  crypt_string<ID> id_tag;
  crypt_string<ID> group;
  file_ptr_t<quest_list[]> lists;
  time_t start;                   // XOR cipher: 60 F6 37 C5 36 A2 0D DC
  time_t finish;                  // XOR cipher: E9 56 BD FA 2A 69 AD C8
  uint8_t _unknown1[24];
  uint32_t difficulties;          // XOR cipher: 54 4E B2 EE
  uint32_t sort_id;               // XOR cipher: FC 4C 39 7A
  uint32_t _unknown2;
  • id_tag: Internal string identifier used for the quest title (e.g. CHAIN_ARENA_TITLE).
  • group: Internal string identifier of the quest group (e.g. CHAIN_ARENA_377).
  • lists: Pointer to the array of quest lists.
  • start: The time this quest group becomes available.
  • finish: The time this quest group becomes unavailable.
  • difficulties: Number of quest lists this group has.
  • sort_id: Internal sort value used to order cleared / uncleared quest groups.
  • _unknown2: A unique index for each quest group.