create table npc_weapons (attack_speed number, min_damage number, max_damage number);
set feedback off
insert into npc_weapons(attack_speed, min_damage, max_damage) values(1.8, 190, 200);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 30, 40);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 35, 40);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 35, 45);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 40, 45);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 45, 50);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 50, 55);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 55, 65);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 70, 75);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 80, 90);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 90, 110);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 120, 130);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 130, 140);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 140, 150);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 150, 160);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 160, 170);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 170, 180);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 180, 190);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 190, 200);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 200, 210);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 210, 220);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 220, 230);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 230, 240);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 240, 250);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 250, 260);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 260, 270);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 270, 280);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 280, 290);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 290, 300);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 300, 310);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 305, 320);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 310, 330);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 315, 340);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 320, 350);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 325, 360);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 330, 370);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 335, 380);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 340, 390);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 345, 400);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 350, 410);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 355, 420);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 360, 430);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 365, 440);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 370, 450);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 375, 460);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 380, 470);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 385, 480);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 390, 490);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 395, 500);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 400, 510);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 405, 520);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 410, 530);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 415, 540);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 420, 550);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 425, 560);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 430, 570);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 440, 590);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 445, 600);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 450, 610);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 455, 620);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 465, 640);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 470, 650);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 475, 660);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 480, 670);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 485, 680);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 495, 700);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 500, 710);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 510, 730);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 520, 750);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 535, 780);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 545, 800);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 555, 820);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 570, 850);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 585, 880);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 595, 900);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 610, 930);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 620, 950);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 625, 960);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 630, 970);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 640, 990);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 645, 1000);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 655, 1020);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 670, 1050);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 675, 1060);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 685, 1080);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 690, 1090);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 715, 1140);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 720, 1150);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 725, 1160);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 745, 1200);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 750, 1210);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 770, 1250);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 775, 1260);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 785, 1280);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 795, 1300);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 820, 1350);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 830, 1370);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 845, 1400);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 875, 1460);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 895, 1500);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 920, 1550);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 935, 1580);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 940, 1590);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 945, 1600);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 995, 1700);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1020, 1750);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1045, 1800);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1095, 1900);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1120, 1950);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1145, 2000);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1245, 2200);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1270, 2250);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1395, 2500);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1520, 2750);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1645, 3000);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 1800, 3310);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 2270, 4250);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(2, 2645, 5000);
insert into npc_weapons(attack_speed, min_damage, max_damage) values(4, 250, 260);
commit;
set feedback on
create table loot_weapons(object_id, attack_speed, min_damage, max_damage, owner_id) as
select w.object_id, w.attack_speed, w.min_damage, w.max_damage,
       (select owner_id from tangible_objects t where t.object_id = w.object_id)
from weapon_objects w, npc_weapons c
where w.attack_speed = c.attack_speed and
      w.min_damage = c.min_damage and
      w.max_damage = c.max_damage;

update objects
set load_with = null, deleted = 1, deleted_date = sysdate
where object_id in (select object_id from loot_weapons);
commit;
