EVENT_FLAG_MAPPING =
{
  {
    bit = 0,
    status = 0,
    codes =
    {
      {
        code = "defeat_roxanne",
        setting = nil
      },
      {
        code = "stone_badge",
        setting = "badges_off"
      }
    }
  },
  {
    bit = 1,
    status = 0,
    codes =
    {
      {
        code = "defeat_brawly",
        setting = nil
      },
      {
        code = "knuckle_badge",
        setting = "badges_off"
      }
    }
  },
  {
    bit = 2,
    status = 0,
    codes =
    {
      {
        code = "defeat_wattson",
        setting = nil
      },
      {
        code = "dynamo_badge",
        setting = "badges_off"
      }
    }
  },
  {
    bit = 3,
    status = 0,
    codes =
    {
      {
        code = "defeat_flannery",
        setting = nil
      },
      {
        code = "heat_badge",
        setting = "badges_off"
      }
    }
  },
  {
    bit = 4,
    status = 0,
    codes =
    {
      {
        code = "defeat_norman",
        setting = nil
      },
      {
        code = "balance_badge",
        setting = "badges_off"
      }
    }
  },
  {
    bit = 5,
    status = 0,
    codes =
    {
      {
        code = "defeat_winona",
        setting = nil
      },
      {
        code = "feather_badge",
        setting = "badges_off"
      }
    }
  },
  {
    bit = 6,
    status = 0,
    codes =
    {
      {
        code = "defeat_tate_and_liza",
        setting = nil
      },
      {
        code = "mind_badge",
        setting = "badges_off"
      }
    }
  },
  {
    bit = 7,
    status = 0,
    codes =
    {
      {
        code = "defeat_juan",
        setting = nil
      },
      {
        code = "rain_badge",
        setting = "badges_off"
      }
    }
  },
  {
    bit = 8,
    status = 0,
    codes =
    {
      {
        code = "talk_mr_stone",
        setting = nil
      }
    }
  },
  {
    bit = 9,
    status = 0,
    codes =
    {
      {
        code = "deliver_letter",
        setting = nil
      }
    }
  },
  {
    bit = 10,
    status = 0,
    codes =
    {
      {
        code = "rescue_stern",
        setting = nil
      }
    }
  },
  {
    bit = 11,
    status = 0,
    codes =
    {
      {
        code = "defeat_shelly",
        setting = nil
      }
    }
  },
  {
    bit = 12,
    status = 0,
    codes =
    {
      {
        code = "magma_steals_meteorite",
        setting = nil
      }
    }
  },
  {
    bit = 13,
    status = 0,
    codes =
    {
      {
        code = "release_groudon",
        setting = nil
      }
    }
  },
  {
    bit = 14,
    status = 0,
    codes =
    {
      {
        code = "aqua_steals_submarine",
        setting = nil
      }
    }
  },
  {
    bit = 15,
    status = 0,
    codes =
    {
      {
        code = "defeat_matt",
        setting = nil
      }
    }
  },
  {
    bit = 16,
    status = 0,
    codes =
    {
      {
        code = "defeat_maxie_space_center",
        setting = nil
      }
    }
  },
  {
    bit = 17,
    status = 0,
    codes =
    {
      {
        code = "release_kyogre",
        setting = nil
      }
    }
  },
  {
    bit = 19,
    status = 0,
    codes =
    {
      {
        code = "steven_gives_dive",
        setting = nil
      }
    }
  },
  {
    bit = 20,
    status = 0,
    codes =
    {
      {
        code = "defeat_champion",
        setting = nil
      }
    }
  },
  {
    bit = 21,
    status = 0,
    codes =
    {
      {
        code = "harbor_mail",
        setting = nil
      }
    }
  },
  {
    bit = 22,
    status = 0,
    codes =
    {
      {
        code = "undo_regi_seal",
        setting = nil
      }
    }
  },
  {
    bit = 23,
    status = 0,
    codes =
    {
      {
        code = "return_devon_goods",
        setting = nil
      }
    }
  },
  {
    bit = 24,
    status = 0,
    codes =
    {
      {
        code = "talk_to_dock",
        setting = nil
      }
    }
  },
  {
    bit = 25,
    status = 0,
    codes =
    {
      {
        code = "defeat_maxie_mt_chimney",
        setting = nil
      }
    }
  },
  {
    bit = 26,
    status = 0,
    codes =
    {
      {
        code = "wingull_quest_1",
        setting = nil
      }
    }
  },
  {
    bit = 27,
    status = 0,
    codes =
    {
      {
        code = "wingull_quest_2",
        setting = nil
      }
    }
  },
  {
    bit = 28,
    status = 0,
    codes =
    {
      {
        code = "meet_flower_shop_owner",
        setting = nil
      }
    }
  }
}

KEY_ITEM_FLAG_MAPPING =
{
  {
    bit = 0,
    status = 0,
    codes =
    {
      {
        code = "hm01_cut",
        setting = "hms_off"
      }
    }
  },
  {
    bit = 1,
    status = 0,
    codes =
    {
      {
        code = "hm02_fly",
        setting = "hms_off"
      }
    }
  },
  {
    bit = 2,
    status = 0,
    codes =
    {
      {
        code = "hm03_surf",
        setting = "hms_off"
      }
    }
  },
  {
    bit = 3,
    status = 0,
    codes =
    {
      {
        code = "hm04_strength",
        setting = "hms_off"
      }
    }
  },
  {
    bit = 4,
    status = 0,
    codes =
    {
      {
        code = "hm05_flash",
        setting = "hms_off"
      }
    }
  },
  {
    bit = 5,
    status = 0,
    codes =
    {
      {
        code = "hm06_rock_smash",
        setting = "hms_off"
      }
    }
  },
  {
    bit = 6,
    status = 0,
    codes =
    {
      {
        code = "hm07_waterfall",
        setting = "hms_off"
      }
    }
  },
  {
    bit = 7,
    status = 0,
    codes =
    {
      {
        code = "hm08_dive",
        setting = "hms_off"
      }
    }
  },
  {
    bit = 8,
    status = 0,
    codes =
    {
      {
        code = "acro_bike",
        setting = "bikes_off"
      },
      {
        code = "mach_bike",
        setting = "bikes_off"
      }
    }
  },
  {
    bit = 9,
    status = 0,
    codes =
    {
      {
        code = "wailmer_pail",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 10,
    status = 0,
    codes =
    {
      {
        code = "devon_goods",
        setting = "key_items_off"
      },
      {
        code = "recover_devon_goods",
        setting = nil
      }
    }
  },
  {
    bit = 11,
    status = 0,
    codes =
    {
      {
        code = "letter",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 12,
    status = 0,
    codes =
    {
      {
        code = "meteorite",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 13,
    status = 0,
    codes =
    {
      {
        code = "go_goggles",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 14,
    status = 0,
    codes =
    {
      {
        code = "basement_key",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 15,
    status = 0,
    codes =
    {
      {
        code = "itemfinder",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 16,
    status = 0,
    codes =
    {
      {
        code = "devon_scope",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 17,
    status = 0,
    codes =
    {
      {
        code = "magma_emblem",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 18,
    status = 0,
    codes =
    {
      {
        code = "pokeblock_case",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 19,
    status = 0,
    codes =
    {
      {
        code = "ss_ticket",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 20,
    status = 0,
    codes =
    {
      {
        code = "room_2_key",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 21,
    status = 0,
    codes =
    {
      {
        code = "room_1_key",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 22,
    status = 0,
    codes =
    {
      {
        code = "room_4_key",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 23,
    status = 0,
    codes =
    {
      {
        code = "room_6_key",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 24,
    status = 0,
    codes =
    {
      {
        code = "scanner",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 25,
    status = 0,
    codes =
    {
      {
        code = "storage_key",
        setting = "key_items_off"
      }
    }
  },
  {
    bit = 26,
    status = 0,
    codes =
    {
      {
        code = "old_rod",
        setting = "rods_off"
      }
    }
  },
  {
    bit = 27,
    status = 0,
    codes =
    {
      {
        code = "good_rod",
        setting = "rods_off"
      }
    }
  },
  {
    bit = 28,
    status = 0,
    codes =
    {
      {
        code = "super_rod",
        setting = "rods_off"
      }
    }
  },
  {
    bit = 29,
    status = 0,
    codes =
    {
      {
        code = "eon_ticket",
        setting = "tickets_off"
      }
    }
  },
  {
    bit = 30,
    status = 0,
    codes =
    {
      {
        code = "aurora_ticket",
        setting = "tickets_off"
      }
    }
  },
  {
    bit = 31,
    status = 0,
    codes =
    {
      {
        code = "mystic_ticket",
        setting = "tickets_off"
      }
    }
  },
  {
    bit = 32,
    status = 0,
    codes =
    {
      {
        code = "old_sea_map",
        setting = "tickets_off"
      }
    }
  }
}

LEGENDARY_FLAG_MAPPING =
{
  {
    bit = 0,
    status = 0,
    name = "Groudon",
    locations = {"@Dungeons/Terra Cave/Defeat Groudon","@Dungeons/Terra Cave/Catch Groudon"}
  },
  {
    bit = 1,
    status = 0,
    name = "Kyogre",
    locations = {"@Dungeons/Marine Cave/Defeat Kyogre","@Dungeons/Marine Cave/Catch Kyogre"}
  },
  {
    bit = 2,
    status = 0,
    name = "Rayquaza",
    locations = {"@Dungeons/Sky Pillar/Defeat Rayquaza","@Dungeons/Sky Pillar/Catch Rayquaza"}
  },
  {
    bit = 3,
    status = 0,
    name = "Latias",
    locations = {"@Islands/Southern Island/Defeat Latias","@Islands/Southern Island/Catch Latias"}
  },
  {
    bit = 4,
    status = 0,
    name = "Latios",
    locations = {"@Routes/Any Route/Defeat Latios","@Routes/Any Route/Catch Latios"}
  },
  {
    bit = 5,
    status = 0,
    name = "Regirock",
    locations = {"@Dungeons/Desert Ruins/Defeat Regirock","@Dungeons/Desert Ruins/Catch Regirock"}
  },
  {
    bit = 6,
    status = 0,
    name = "Regice",
    locations = {"@Dungeons/Island Cave/Defeat Regice","@Dungeons/Island Cave/Catch Regice"}
  },
  {
    bit = 7,
    status = 0,
    name = "Registeel",
    locations = {"@Dungeons/Ancient Tomb/Defeat Registeel","@Dungeons/Ancient Tomb/Catch Registeel"}
  },
  {
    bit = 8,
    status = 0,
    name = "Mew",
    locations = {"@Islands/Faraway Island/Defeat Mew","@Islands/Faraway Island/Catch Mew"}
  },
  {
    bit = 9,
    status = 0,
    name = "Deoxys",
    locations = {"@Islands/Birth Island/Defeat Deoxys","@Islands/Birth Island/Catch Deoxys"}
  },
  {
    bit = 10,
    status = 0,
    name = "Ho-Oh",
    locations = {"@Islands/Navel Rock/Defeat Ho-Oh","@Islands/Navel Rock/Catch Ho-Oh"}
  },
  {
    bit = 11,
    status = 0,
    name = "Lugia",
    locations = {"@Islands/Navel Rock/Defeat Lugia","@Islands/Navel Rock/Catch Lugia"}
  }
}
