-- Wailing Caverns boss loot for the 3.3.5a content set.
-- Item IDs, names, source item levels, and boss ownership match the original
-- Classic/Wrath data. Runtime drops scale their item level to the player.

INSERT INTO dungeon (dungeon_id, display_name) VALUES
  ('wailing-caverns', 'Wailing Caverns');

INSERT INTO loot_table (loot_table_id, rolls_min, rolls_max) VALUES
  ('wc-kresh', 1, 1),
  ('wc-lady-anacondra', 1, 1),
  ('wc-lord-cobrahn', 1, 1),
  ('wc-deviate-faerie-dragon', 1, 1),
  ('wc-lord-pythas', 1, 1),
  ('wc-skum', 1, 1),
  ('wc-lord-serpentis', 1, 1),
  ('wc-verdan-the-everliving', 1, 1),
  ('wc-mutanus-the-devourer', 1, 1);

INSERT INTO boss_template (
  boss_key,
  creature_entry,
  display_name,
  dungeon_id,
  loot_table_id
) VALUES
  ('kresh', 3653, 'Kresh', 'wailing-caverns', 'wc-kresh'),
  ('lady-anacondra', 3671, 'Lady Anacondra', 'wailing-caverns', 'wc-lady-anacondra'),
  ('lord-cobrahn', 3669, 'Lord Cobrahn', 'wailing-caverns', 'wc-lord-cobrahn'),
  ('deviate-faerie-dragon', 5912, 'Deviate Faerie Dragon', 'wailing-caverns', 'wc-deviate-faerie-dragon'),
  ('lord-pythas', 3670, 'Lord Pythas', 'wailing-caverns', 'wc-lord-pythas'),
  ('skum', 3674, 'Skum', 'wailing-caverns', 'wc-skum'),
  ('lord-serpentis', 3673, 'Lord Serpentis', 'wailing-caverns', 'wc-lord-serpentis'),
  ('verdan-the-everliving', 5775, 'Verdan the Everliving', 'wailing-caverns', 'wc-verdan-the-everliving'),
  ('mutanus-the-devourer', 3654, 'Mutanus the Devourer', 'wailing-caverns', 'wc-mutanus-the-devourer');

INSERT INTO item_template (
  item_id,
  item_key,
  display_name,
  quality,
  inventory_slot,
  armor_type,
  weapon_type,
  source_item_level,
  scalable,
  source_url
) VALUES
  (13245, 'kreshs-back', 'Kresh''s Back', 'rare', 'off-hand', 'shield', NULL, 20, 1, 'https://www.wowhead.com/classic/item=13245'),
  (6447, 'worn-turtle-shell-shield', 'Worn Turtle Shell Shield', 'common', 'off-hand', 'shield', NULL, 20, 1, 'https://www.wowhead.com/classic/item=6447'),
  (10412, 'belt-of-the-fang', 'Belt of the Fang', 'rare', 'waist', 'leather', NULL, 21, 1, 'https://www.wowhead.com/classic/item=10412'),
  (5404, 'serpents-shoulders', 'Serpent''s Shoulders', 'rare', 'shoulder', 'leather', NULL, 23, 1, 'https://www.wowhead.com/classic/item=5404'),
  (6465, 'robe-of-the-moccasin', 'Robe of the Moccasin', 'uncommon', 'chest', 'cloth', NULL, 22, 1, 'https://www.wowhead.com/classic/item=6465'),
  (6460, 'cobrahns-grasp', 'Cobrahn''s Grasp', 'rare', 'waist', 'mail', NULL, 24, 1, 'https://www.wowhead.com/classic/item=6460'),
  (10410, 'leggings-of-the-fang', 'Leggings of the Fang', 'rare', 'legs', 'leather', NULL, 23, 1, 'https://www.wowhead.com/classic/item=10410'),
  (5243, 'firebelcher', 'Firebelcher', 'rare', 'ranged', NULL, 'wand', 20, 1, 'https://www.wowhead.com/classic/item=5243'),
  (6632, 'feyscale-cloak', 'Feyscale Cloak', 'uncommon', 'back', 'cloth', NULL, 20, 1, 'https://www.wowhead.com/classic/item=6632'),
  (6472, 'stinging-viper', 'Stinging Viper', 'rare', 'main-hand', NULL, 'mace', 24, 1, 'https://www.wowhead.com/classic/item=6472'),
  (6473, 'armor-of-the-fang', 'Armor of the Fang', 'rare', 'chest', 'leather', NULL, 23, 1, 'https://www.wowhead.com/classic/item=6473'),
  (6449, 'glowing-lizardscale-cloak', 'Glowing Lizardscale Cloak', 'rare', 'back', 'cloth', NULL, 22, 1, 'https://www.wowhead.com/classic/item=6449'),
  (6448, 'tail-spike', 'Tail Spike', 'uncommon', 'one-hand', NULL, 'dagger', 22, 1, 'https://www.wowhead.com/classic/item=6448'),
  (10411, 'footpads-of-the-fang', 'Footpads of the Fang', 'rare', 'feet', 'leather', NULL, 23, 1, 'https://www.wowhead.com/classic/item=10411'),
  (6459, 'savage-trodders', 'Savage Trodders', 'rare', 'feet', 'mail', NULL, 23, 1, 'https://www.wowhead.com/classic/item=6459'),
  (5970, 'serpent-gloves', 'Serpent Gloves', 'rare', 'hands', 'cloth', NULL, 23, 1, 'https://www.wowhead.com/classic/item=5970'),
  (6469, 'venomstrike', 'Venomstrike', 'rare', 'ranged', NULL, 'bow', 24, 1, 'https://www.wowhead.com/classic/item=6469'),
  (6629, 'sporid-cape', 'Sporid Cape', 'uncommon', 'back', 'cloth', NULL, 23, 1, 'https://www.wowhead.com/classic/item=6629'),
  (6631, 'living-root', 'Living Root', 'rare', 'two-hand', NULL, 'staff', 25, 1, 'https://www.wowhead.com/classic/item=6631'),
  (6630, 'seedcloud-buckler', 'Seedcloud Buckler', 'rare', 'off-hand', 'shield', NULL, 25, 1, 'https://www.wowhead.com/classic/item=6630'),
  (6627, 'mutant-scale-breastplate', 'Mutant Scale Breastplate', 'rare', 'chest', 'mail', NULL, 28, 1, 'https://www.wowhead.com/classic/item=6627'),
  (6463, 'deep-fathom-ring', 'Deep Fathom Ring', 'rare', 'finger', NULL, NULL, 26, 1, 'https://www.wowhead.com/classic/item=6463'),
  (6461, 'slime-encrusted-pads', 'Slime-Encrusted Pads', 'rare', 'shoulder', 'cloth', NULL, 27, 1, 'https://www.wowhead.com/classic/item=6461');

-- Original 3.3.5a item_template attributes, armor, spell bonuses, shield
-- block values, and equip ratings. Numeric stat IDs from the world database
-- have deliberately been translated to readable names here.
INSERT INTO item_stat (item_id, stat_key, stat_value) VALUES
  (13245, 'armor', 471),
  (13245, 'defenseRating', 6),
  (13245, 'blockValue', 9),
  (6447, 'armor', 513),
  (6447, 'blockValue', 9),
  (10412, 'agility', 5),
  (10412, 'stamina', 6),
  (10412, 'armor', 49),
  (5404, 'agility', 9),
  (5404, 'armor', 68),
  (6465, 'stamina', 6),
  (6465, 'spirit', 6),
  (6465, 'armor', 40),
  (6465, 'spellPower', 7),
  (6460, 'strength', 8),
  (6460, 'agility', 3),
  (6460, 'armor', 111),
  (10410, 'strength', 5),
  (10410, 'agility', 9),
  (10410, 'stamina', 4),
  (10410, 'armor', 79),
  (6632, 'stamina', 4),
  (6632, 'armor', 19),
  (6632, 'spellPower', 5),
  (6473, 'strength', 8),
  (6473, 'stamina', 8),
  (6473, 'armor', 91),
  (6449, 'agility', 6),
  (6449, 'stamina', 2),
  (6449, 'armor', 20),
  (6448, 'strength', 4),
  (6448, 'agility', 3),
  (10411, 'agility', 6),
  (10411, 'stamina', 6),
  (10411, 'armor', 62),
  (6459, 'stamina', 9),
  (6459, 'armor', 134),
  (5970, 'intellect', 6),
  (5970, 'armor', 25),
  (5970, 'spellPower', 7),
  (6629, 'stamina', 5),
  (6629, 'spirit', 4),
  (6629, 'armor', 20),
  (6631, 'stamina', 2),
  (6631, 'spirit', 12),
  (6631, 'spellPower', 6),
  (6630, 'intellect', 6),
  (6630, 'spirit', 3),
  (6630, 'armor', 566),
  (6630, 'blockValue', 11),
  (6627, 'strength', 13),
  (6627, 'stamina', 5),
  (6627, 'armor', 211),
  (6463, 'intellect', 3),
  (6463, 'stamina', 3),
  (6463, 'spirit', 6),
  (6461, 'armor', 34),
  (6461, 'healthPer5', 3.75);

INSERT INTO item_weapon (item_id, damage_min, damage_max, damage_school, speed_ms) VALUES
  (5243, 24, 45, 'fire', 1700),
  (6472, 30, 57, 'physical', 2800),
  (6448, 18, 34, 'physical', 1800),
  (6469, 26, 50, 'physical', 2400),
  (6631, 49, 74, 'physical', 2900);

-- Weights are relative within a table. Every boss table rolls exactly once,
-- guaranteeing a usable item while preserving each boss's recognizable pool.
INSERT INTO loot_table_entry (
  loot_table_id,
  item_id,
  weight,
  min_quantity,
  max_quantity
) VALUES
  ('wc-kresh', 13245, 20, 1, 1),
  ('wc-kresh', 6447, 80, 1, 1),
  ('wc-lady-anacondra', 10412, 20, 1, 1),
  ('wc-lady-anacondra', 5404, 80, 1, 1),
  ('wc-lord-cobrahn', 6465, 50, 1, 1),
  ('wc-lord-cobrahn', 6460, 20, 1, 1),
  ('wc-lord-cobrahn', 10410, 30, 1, 1),
  ('wc-deviate-faerie-dragon', 5243, 50, 1, 1),
  ('wc-deviate-faerie-dragon', 6632, 50, 1, 1),
  ('wc-lord-pythas', 6472, 50, 1, 1),
  ('wc-lord-pythas', 6473, 50, 1, 1),
  ('wc-skum', 6449, 50, 1, 1),
  ('wc-skum', 6448, 50, 1, 1),
  ('wc-lord-serpentis', 10411, 25, 1, 1),
  ('wc-lord-serpentis', 6459, 25, 1, 1),
  ('wc-lord-serpentis', 5970, 25, 1, 1),
  ('wc-lord-serpentis', 6469, 25, 1, 1),
  ('wc-verdan-the-everliving', 6629, 34, 1, 1),
  ('wc-verdan-the-everliving', 6631, 33, 1, 1),
  ('wc-verdan-the-everliving', 6630, 33, 1, 1),
  ('wc-mutanus-the-devourer', 6627, 34, 1, 1),
  ('wc-mutanus-the-devourer', 6463, 33, 1, 1),
  ('wc-mutanus-the-devourer', 6461, 33, 1, 1);
