local Data = require("core.Data")

Data.define_prototype("asset")
Data.add(
   "core.asset",
   {
      interface = {
         source = "interface",
         x = 0,
         y = 0,
         width = 1440,
         height = 800,
         file = "<_builtin_>/graphic/interface.bmp",
         load_type = "buffer",
      },
      select_key = {
         source = "interface",
         x = 0,
         y = 30,
         width = 24,
         height = 18,
      },
      tip_icon = {
         source = "interface",
         x = 96,
         y = 360,
         width = 24,
         height = 16,
      },
      topic_icon = {
         source = "interface",
         x = 120,
         y = 360,
         width = 24,
         height = 16,
      },
      input_caret = {
         source = "interface",
         x = 0,
         y = 336,
         width = 12,
         height = 24,
      },
      gold_coin = {
         source = "interface",
         x = 0,
         y = 392,
         width = 24,
         height = 24,
      },
      equipped = {
         source = "interface",
         x = 12,
         y = 348,
         width = 12,
         height = 12,
      },
      label_input = {
         source = "interface",
         x = 128,
         y = 288,
         width = 128,
         height = 32,
      },
      minimap_position = {
         source = "interface",
         x = 15,
         y = 338,
         width = 6,
         height = 6,
      },
      interest_icon = {
         source = "interface",
         x = 16,
         y = 360,
         width = 16,
         height = 16,
      },
      casino_title_decoration_left = {
         source = "interface",
         x = 192,
         y = 360,
         width = 24,
         height = 16,
      },
      casino_title_decoration_right = {
         source = "interface",
         x = 216,
         y = 360,
         width = 24,
         height = 16,
      },
      map_name_icon = {
         source = "interface",
         x = 208,
         y = 376,
         width = 16,
         height = 16,
      },
      ime_status_english = {
         source = "interface",
         x = 24,
         y = 336,
         width = 24,
         height = 24,
      },
      ime_status_japanese = {
         source = "interface",
         x = 48,
         y = 336,
         width = 24,
         height = 24,
      },
      ime_status_none = {
         source = "interface",
         x = 72,
         y = 336,
         width = 24,
         height = 24,
      },
      character_shadow = {
         source = "interface",
         x = 240,
         y = 384,
         width = 32,
         height = 16,
         file = "<core>/graphic/interface_ex9.png",
         load_type = "startup",
      },
      camera = {
         source = "interface",
         x = 240,
         y = 410,
         width = 24,
         height = 16,
      },
      hp_bar_frame = {
         source = "interface",
         x = 312,
         y = 504,
         width = 104,
         height = 15,
      },
      furious_icon = {
         source = "interface",
         x = 32,
         y = 608,
         width = 16,
         height = 16,
      },
      conquered_nefia_icon = {
         source = "interface",
         x = 32,
         y = 624,
         width = 16,
         height = 16,
      },
      invaded_nefia_icon = {
         source = "interface",
         x = 48,
         y = 624,
         width = 16,
         height = 16,
      },
      buff_icon_none = {
         source = "interface",
         x = 320,
         y = 160,
         width = 32,
         height = 32,
      },
      quickmenu_action = {
         source = "interface",
         x = 360,
         y = 144,
         width = 48,
         height = 48,
      },
      quickmenu_submenu = {
         source = "interface",
         x = 360,
         y = 192,
         width = 48,
         height = 48,
      },
      inheritance_mark = {
         source = "interface",
         x = 384,
         y = 360,
         width = 24,
         height = 24,
      },
      character_level_icon = {
         source = "interface",
         x = 48,
         y = 392,
         width = 24,
         height = 24,
      },
      platinum_coin = {
         source = "interface",
         x = 24,
         y = 392,
         width = 24,
         height = 24,
      },
      title_label_frame = {
         source = "interface",
         x = 496,
         y = 581,
         width = 192,
         height = 18,
      },
      label_more = {
         source = "interface",
         x = 552,
         y = 504,
         width = 120,
         height = 22,
      },
      label_more_scratch = {
         source = "interface",
         x = 672,
         y = 504,
         width = 120,
         height = 24,
      },
      direction_arrow = {
         source = "interface",
         x = 212,
         y = 432,
         width = 28,
         height = 28,
      },
      hourglass = {
         source = "interface",
         x = 72,
         y = 392,
         width = 24,
         height = 24,
      },
      failure_to_cast_effect = {
         source = "item",
         x = 480,
         y = 0,
         width = 48,
         height = 48,
      },
      swarm_effect = {
         source = "item",
         x = 816,
         y = 0,
         width = 48,
         height = 48,
      },
      breaking_effect = {
         source = "item",
         x = 864,
         y = 0,
         width = 48,
         height = 48,
      },
      emotion_icons = {
         source = "interface",
         x = 32,
         y = 608,
         width = 16,
         height = 16,
         count_x = 100,
      },
      blend_ingredient = {
         source = "interface",
         x = 336,
         y = 360,
         width = 24,
         height = 24,
      },
      recipe_difficulty = {
         source = "interface",
         x = 64,
         y = 624,
         width = 16,
         height = 16,
         count_x = 5,
      },
      card_front = {
         source = "interface",
         x = 672,
         y = 216,
         width = 64,
         height = 96,
      },
      card_back = {
         source = "interface",
         x = 736,
         y = 216,
         width = 64,
         height = 96,
      },
      card_scratch = {
         source = "interface",
         x = 608,
         y = 216,
         width = 64,
         height = 96,
      },
      card_suit = {
         source = "interface",
         x = 192,
         y = 672,
         width = 24,
         height = 32,
         count_x = 5,
         file = "<core>/graphic/interface_ex7.png",
         load_type = "startup",
      },
      card_rank = {
         source = "interface",
         x = 312,
         y = 672,
         width = 24,
         height = 32,
         count_x = 13,
         file = "<core>/graphic/interface_ex8.png",
         load_type = "startup",
      },
      card_pile = {
         source = "interface",
         x = 528,
         y = 216,
         width = 80,
         height = 112,
      },
      anim_bash = {
         source = "interface",
         x = 816,
         y = 432,
         width = 48,
         height = 48,
         count_x = 4,
      },
      anim_slash = {
         source = "interface",
         x = 1008,
         y = 432,
         width = 48,
         height = 48,
         count_x = 4,
      },
      arrow_left = {
         source = "interface",
         x = 312,
         y = 336,
         width = 24,
         height = 24,
      },
      arrow_right = {
         source = "interface",
         x = 336,
         y = 336,
         width = 24,
         height = 24,
      },
      ally_health_bar = {
         source = "interface",
         x = 432,
         y = 517,
         width = 48,
         height = 3,
      },
      shadow_deco = {
         source = "interface",
         x = 0,
         y = 656,
         width = 48,
         height = 48,
         count_x = 4,
         count_y = 3,
      },
      shadow = {
         source = "interface",
         x = 0,
         y = 656,
         width = 24,
         height = 24,
         count_x = 8,
         count_y = 6,
         file = "<core>/graphic/interface_ex1.png",
         load_type = "startup",
      },
      shadow_spot = {
         source = "interface",
         x = 144,
         y = 656,
         width = 24,
         height = 24,
         count_x = 2,
         count_y = 6,
         file = "<core>/graphic/interface_ex2.png",
         load_type = "startup",
      },
      shadow_edges = {
         source = "interface",
         x = 144,
         y = 752,
         width = 48,
         height = 48,
         count_x = 18,
         file = "<core>/graphic/interface_ex3.png",
         load_type = "startup",
      },
      politics_law = {
         source = "interface",
         x = 288,
         y = 360,
         width = 24,
         height = 24,
         count_x = 2,
      },
      radar_deco = {
         source = "interface",
         x = 64,
         y = 288,
         width = 50,
         height = 32,
      },
      inventory_icon = {
         source = "interface",
         x = 288,
         y = 48,
         width = 48,
         height = 48,
         count_x = 22,
      },
      message_symbol = {
         source = "interface",
         x = 600,
         y = 360,
         width = 16,
         height = 16,
         count_x = 4,
      },
      message_window = {
         source = "interface",
         x = 496,
         y = 528,
         width = 192,
         height = 5,
      },
      message_window_contents = {
         source = "interface",
         x = 496,
         y = 536,
         width = 192,
         height = 64,
      },
      message_window_border = {
         source = "interface",
         x = 496,
         y = 528,
         width = 192,
         height = 8,
      },
      mef_subref = {
         source = "interface",
         x = 144,
         y = 624,
         width = 32,
         height = 32,
         count_x = 13,
      },
      light = {
         source = "interface",
         x = 192,
         y = 704,
         width = 48,
         height = 48,
         count_x = 14,
      },
      body_part_icon = {
         source = "interface",
         x = 600,
         y = 336,
         width = 24,
         height = 24,
         count_x = 11,
      },
      trait_icon = {
         source = "interface",
         x = 384,
         y = 336,
         width = 24,
         height = 24,
         count_x = 6,
      },
      attribute_icon = {
         source = "interface",
         x = 0,
         y = 376,
         width = 16,
         height = 16,
         count_x = 10,
      },
      hud_bar = {
         source = "interface",
         x = 0,
         y = 440,
         width = 192,
         height = 24,
      },
      hud_minimap = {
         source = "interface",
         x = 120,
         y = 504,
         width = 136,
         height = 88,
      },
      weather_particle = {
         source = "interface",
         x = 0,
         y = 600,
         width = 8,
         height = 8,
         count_x = 4,
         count_y = 6,
      },
      minimap_scratch = {
         source = "interface",
         x = 688,
         y = 528,
         width = 120,
         height = 84,
      },
      window = {
         source = "interface",
         x = 0,
         y = 48,
         width = 264,
         height = 192,
      },
      window_frame = {
         source = "interface",
         x = 0,
         y = 240,
         width = 16,
         height = 16,
      },
      hp_bar_ally = {
         source = "interface",
         x = 432,
         y = 517,
         width = 48,
         height = 3,
      },
      hp_bar_other = {
         source = "interface",
         x = 432,
         y = 513,
         width = 48,
         height = 3,
      },
      spot_light = {
         source = "interface",
         x = 800,
         y = 112,
         width = 144,
         height = 144,
      },
      hud_hp_bar = {
         source = "interface",
         x = 312,
         y = 520,
         width = 100,
         height = 6,
      },
      hud_mp_bar = {
         source = "interface",
         x = 432,
         y = 520,
         width = 100,
         height = 6,
      },
      attributes_bar = {
         source = "interface",
         x = 0,
         y = 440,
         width = 64,
         height = 16,
      },
      date_label_frame = {
         source = "interface",
         x = 448,
         y = 376,
         width = 128,
         height = 24,
      },
      clock = {
         source = "interface",
         x = 448,
         y = 408,
         width = 120,
         height = 96,
      },
      clock_hand = {
         source = "interface",
         x = 0,
         y = 288,
         width = 48,
         height = 48,
      },
      status_ailment_bar = {
         source = "interface",
         x = 0,
         y = 416,
         width = 80,
         height = 15,
      },
      caption = {
         source = "interface",
         x = 672,
         y = 477,
         width = 128,
         height = 25,
      },
      list_scratch = {
         source = "interface",
         x = 264,
         y = 96,
         width = 480,
         height = 19,
      },
      list_bullet = {
         source = "interface",
         x = 48,
         y = 360,
         width = 16,
         height = 16,
      },
      item_enchant_mark = {
         source = "interface",
         x = 96,
         y = 336,
         width = 24,
         height = 24,
         count_x = 9,
      },
      scene_title = {
         source = "interface",
         x = 456,
         y = 144,
         width = 344,
         height = 72,
         file = "<core>/graphic/interface_ex4.png",
         load_type = "startup",
      },

      deco_cm = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_cm.bmp",
      },

      -- Map 0 atlas for clouds only
      map = {
         source = "map",
         x = 0,
         y = 0,
         width = 1584,
         height = 1200,
         file = "<_builtin_>/graphic/map0.bmp",
         load_type = "buffer",
      },
      cloud1 = {
         source = "map",
         x = 288,
         y = 1040,
         width = 208,
         height = 160,
      },
      cloud2 = {
         source = "map",
         x = 0,
         y = 976,
         width = 288,
         height = 224,
      },

      -- Blending menu
      deco_blend = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_blend.bmp",
      },
      deco_blend_a = {
         source = "interface",
         x = 960,
         y = 288,
         width = 480,
         height = 68,
      },
      deco_blend_b = {
         source = "interface",
         x = 1040,
         y = 96,
         width = 160,
         height = 70,
      },
      deco_blend_c = {
         source = "interface",
         x = 960,
         y = 96,
         width = 80,
         height = 90,
      },

      -- Inventory menu
      deco_inv = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_inv.bmp",
      },
      deco_inv_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 144,
         height = 48,
      },
      deco_inv_b = {
         source = "interface",
         x = 960,
         y = 144,
         width = 48,
         height = 72,
      },
      deco_inv_c = {
         source = "interface",
         x = 1008,
         y = 144,
         width = 48,
         height = 72,
      },
      deco_inv_d = {
         source = "interface",
         x = 960,
         y = 216,
         width = 48,
         height = 72,
      },

      -- Help menu
      deco_help = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_help.bmp",
      },
      deco_help_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 48,
         height = 48,
      },
      deco_help_b = {
         source = "interface",
         x = 960,
         y = 144,
         width = 96,
         height = 120,
      },

      -- Appearance menu
      deco_mirror = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_mirror.bmp",
      },
      deco_mirror_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 48,
         height = 120,
      },

      -- Town menu
      deco_politics = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_politics.bmp",
      },
      deco_politics_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 128,
         height = 128,
      },
      deco_politics_b = {
         source = "interface",
         x = 960,
         y = 288,
         width = 144,
         height = 24,
      },

      -- Quest board menu
      deco_board = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_board.bmp",
      },
      deco_board_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 128,
         height = 128,
      },
      deco_board_b = {
         source = "interface",
         x = 960,
         y = 240,
         width = 48,
         height = 84,
      },

      -- Equipment menu
      deco_wear = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_wear.bmp",
      },
      deco_wear_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 96,
         height = 120,
      },
      deco_wear_b = {
         source = "interface",
         x = 960,
         y = 216,
         width = 72,
         height = 144,
      },

      -- Feats menu
      deco_feat = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_feat.bmp",
      },
      deco_feat_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 48,
         height = 192,
      },
      deco_feat_b = {
         source = "interface",
         x = 1008,
         y = 96,
         width = 48,
         height = 144,
      },
      deco_feat_c = {
         source = "interface",
         x = 960,
         y = 288,
         width = 96,
         height = 72,
      },
      deco_feat_d = {
         source = "interface",
         x = 1008,
         y = 240,
         width = 96,
         height = 48,
      },

      -- Skills menu
      deco_skill = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_skill.bmp",
      },
      deco_skill_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 72,
         height = 144,
      },
      deco_skill_b = {
         source = "interface",
         x = 1032,
         y = 96,
         width = 102,
         height = 48,
      },

      -- Spells menu
      deco_spell = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_spell.bmp",
      },
      deco_spell_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 72,
         height = 144,
      },
      deco_spell_b = {
         source = "interface",
         x = 1032,
         y = 96,
         width = 72,
         height = 96,
      },

      character = {
         source = "character",
         x = 0,
         y = 0,
         width = 1584,
         height = 1200,
         file = "<_builtin_>/graphic/character.bmp",
         load_type = "buffer",
      },
      buff_icon = {
         source = "character",
         x = 0,
         y = 1120,
         width = 32,
         height = 32,
         count_x = 29,
      },

      -- Card menu
      deco_card = {
         source = "interface",
         x = 960,
         y = 96,
         width = 240,
         height = 264,
         file = "<_builtin_>/graphic/deco_card.bmp",
      },
      deco_card_a = {
         source = "interface",
         x = 960,
         y = 96,
         width = 128,
         height = 128,
      },
   }
)

-- ATX backgrounds
local function atx_background(name, width, height)
   return {
      source = "atx_background",
      x = 0,
      y = 0,
      width = width,
      height = height,
      file = "<_builtin_>/graphic/" .. name .. ".bmp",
   }
end

local function background_card(name)
   return {
      source = "atx_background",
      x = 0,
      y = 0,
      width = 180,
      height = 300,
      file = "<_builtin_>/graphic/" .. name .. ".bmp",
   }
end

Data.add(
   "core.asset",
   {
      atx_background = {
         source = "atx_background",
         x = 0,
         y = 0,
         width = 240,
         height = 160,
      },

      g1 = background_card("g1"),
      g2 = background_card("g2"),
      g3 = background_card("g3"),
      g4 = background_card("g4"),
      g5 = background_card("g5"),
      g6 = background_card("g6"),
      g7 = background_card("g7"),
      g8 = background_card("g8"),

      bg21 = atx_background("bg21", 240, 160),
      bg20 = atx_background("bg20", 240, 160),
      bg19 = atx_background("bg19", 240, 160),
      bg18 = atx_background("bg18", 240, 160),
      bg13 = atx_background("bg13", 240, 160),
      bg17 = atx_background("bg17", 240, 160),
      bg15 = atx_background("bg15", 240, 160),
      bg16 = atx_background("bg16", 240, 160),
      bg14 = atx_background("bg14", 240, 160),

      bg1 = atx_background("bg1", 640, 480),
      bg10 = atx_background("bg10", 640, 480),
      bg11 = atx_background("bg11", 640, 480),
      bg12 = atx_background("bg12", 640, 480),
      bg2 = atx_background("bg2", 640, 480),
      bg22 = atx_background("bg22", 640, 480),
      bg23 = atx_background("bg23", 640, 480),
      bg24 = atx_background("bg24", 640, 480),
      bg25 = atx_background("bg25", 640, 480),
      bg26 = atx_background("bg26", 640, 480),
      bg27 = atx_background("bg27", 640, 480),
      bg29 = atx_background("bg29", 640, 480),
      bg3 = atx_background("bg3", 640, 480),
      bg30 = atx_background("bg30", 640, 480),
      bg31 = atx_background("bg31", 640, 480),
      bg32 = atx_background("bg32", 640, 480),
      bg33 = atx_background("bg33", 640, 480),
      bg34 = atx_background("bg34", 640, 480),
      bg35 = atx_background("bg35", 640, 480),
      bg36 = atx_background("bg36", 640, 480),
      bg4 = atx_background("bg4", 640, 480),
      bg5 = atx_background("bg5", 640, 480),
      bg6 = atx_background("bg6", 640, 480),
      bg7 = atx_background("bg7", 640, 480),
      bg8 = atx_background("bg8", 640, 480),
      bg9 = atx_background("bg9", 640, 480),

      bg_altar = atx_background("bg_altar", 600, 400),
      bg_card = atx_background("bg_card", 800, 600),
      bg_night = atx_background("bg_night", 640, 480),
      title = atx_background("title", 800, 600),
      void = atx_background("void", 800, 600),
      paper = atx_background("paper", 400, 300),
      book = atx_background("book", 736, 448),
   }
)

-- Backgrounds
local function background(name, width, height)
   return {
      source = "background",
      x = 0,
      y = 0,
      width = width,
      height = height,
      file = "<_builtin_>/graphic/" .. name .. ".bmp",
      load_type = "buffer_deferred",
   }
end

Data.add(
   "core.asset",
   {
      background = {
         source = "background",
         x = 0,
         y = 0,
         width = 640,
         height = 480,
      },

      bg_re10 = background("bg_re10", 360, 200),
      bg_re11 = background("bg_re11", 310, 180),
      bg_re12 = background("bg_re12", 280, 160),
      bg_re13 = background("bg_re13", 360, 239),
      bg_re14 = background("bg_re14", 380, 245),
      bg_re15 = background("bg_re15", 320, 211),
      bg_re1 = background("bg_re1", 360, 140),
      bg_re2 = background("bg_re2", 260, 173),
      bg_re3 = background("bg_re3", 380, 195),
      bg_re4 = background("bg_re4", 360, 140),
      bg_re5 = background("bg_re5", 380, 180),
      bg_re6 = background("bg_re6", 360, 180),
      bg_re7 = background("bg_re7", 400, 200),
      bg_re8 = background("bg_re8", 320, 160),
      bg_re9 = background("bg_re9", 320, 180),
   }
)

Data.add(
   "core.asset",
   {
      ie_sheet = {
         source = "background",
         x = 0,
         y = 0,
         width = 700,
         height = 400,
         file = "<_builtin_>/graphic/ie_sheet.bmp",
         load_type = "buffer_deferred",
      },
      ie_chat = {
         source = "background",
         x = 0,
         y = 0,
         width = 600,
         height = 380,
         file = "<_builtin_>/graphic/ie_chat.bmp",
         load_type = "buffer_deferred",
      },
      ie_scroll = {
         source = "background",
         x = 0,
         y = 0,
         width = 600,
         height = 380,
         file = "<_builtin_>/graphic/ie_scroll.bmp",
         load_type = "buffer_deferred",
      },
      interface2 = {
         source = "background",
         x = 0,
         y = 0,
         width = 600,
         height = 380,
         file = "<_builtin_>/graphic/interface2.bmp",
         load_type = "buffer_deferred",
      }
   }
)
