quixadhal

first draft of wileymud schema

Apr 24th, 2019
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Note:  Postgres supports INSERT ... RETURNING column-name, now
  2. -- so you can easily get the actual sequence used for a new row
  3. -- without needing to trust currval( <table-name>_id_seq );
  4. --
  5. -- currval() may be wrong if you have triggers or other
  6. -- processes advancing the sequence outside of your current
  7. -- session.
  8. --
  9. -- create table test (id serial primary key, name text);
  10. --
  11. -- my $result = $db->selectall_arrayref(qq!
  12. --    INSERT INTO test (name) VALUES (?) RETURNING id;
  13. --      ;!, { Slice => {} }, $arg );
  14. --  my $id = $result->[0]{id};
  15. --  $db->commit;
  16.  
  17. -- A utility function to let us easily find matching rows in the many
  18. -- bit lookup tables of the form id, name, where id is a bit value.
  19. create or replace function fn_bits_lookup(table_name text, lookup_value integer)
  20. returns table (id integer, name text) as $$
  21. declare
  22.     i integer;
  23.     row record;
  24. begin
  25.     for row in execute format('select * from %s', table_name) loop
  26.         if (lookup_value & row.id) > 0 then
  27.             id := row.id;
  28.             name := row.name;
  29.             return next;
  30.         end if;
  31.     end loop;
  32. end;
  33. $$ language PLpgSQL;
  34. -- select * from fn_bits_lookup('exit_states', 37);
  35.  
  36.  
  37. -- A utility function to split a dice roll text string into a row
  38. -- containing rolls, die-size, and modifier
  39. create or replace function fn_dice_parse(dice text)
  40. returns table (rolls integer, die integer, modifier integer, result integer) as $$
  41. declare
  42.     parsed text[];
  43. begin
  44.     parsed := regexp_matches(dice, '^\s*(\d+)d(\d+)([+-]\d+)?\s*$');
  45.     rolls := parsed[1]::integer;
  46.     die := parsed[2]::integer;
  47.     modifier := parsed[3]::integer;
  48.     if (rolls is null and die is null and modifier is null) then
  49.         parsed := regexp_matches(dice, '^\s*([+-]?\d+)\s*$');
  50.         modifier := parsed[1]::integer;
  51.         result := modifier;
  52.         if (modifier is null) then
  53.             return;
  54.         end if;
  55.     else
  56.         if (modifier is null) then
  57.             result := 0;
  58.         else
  59.             result := modifier;
  60.         end if;
  61.         if (rolls > 0 and die > 0) then
  62.             for i in 1..rolls loop
  63.                 result := result + floor(random() * die) + 1;
  64.             end loop;
  65.         end if;
  66.     end if;
  67.     return next;
  68. end;
  69. $$ language PLpgSQL;
  70.  
  71. -- Utils
  72.  
  73. create table if not exists weapon_types (
  74.     id              integer primary key not null,
  75.     name            text,
  76.     description     text
  77. );
  78. insert into weapon_types(id, name, description) values (-1, 'TYPE_HIT', 'Default');
  79. insert into weapon_types(id, name, description) values (0, 'TYPE_SMITE', 'Bludgeon (smite)');
  80. insert into weapon_types(id, name, description) values (1, 'TYPE_STAB', 'Pierce (stab)');
  81. insert into weapon_types(id, name, description) values (2, 'TYPE_WHIP', 'Slash (whip)');
  82. insert into weapon_types(id, name, description) values (3, 'TYPE_SLASH', 'Slash (slash)');
  83. insert into weapon_types(id, name, description) values (4, 'TYPE_SMASH', 'Bludgeon (smash)');
  84. insert into weapon_types(id, name, description) values (5, 'TYPE_CLEAVE', 'Slash (cleave)');
  85. insert into weapon_types(id, name, description) values (6, 'TYPE_CRUSH', 'Bludgeon (crush)');
  86. insert into weapon_types(id, name, description) values (7, 'TYPE_BLUDGEON', 'Bludgeon (pound)');
  87. insert into weapon_types(id, name, description) values (8, 'TYPE_CLAW', 'Mob (claw)');
  88. insert into weapon_types(id, name, description) values (9, 'TYPE_BITE', 'Mob (bite)');
  89. insert into weapon_types(id, name, description) values (10, 'TYPE_STING', 'Mob (sting)');
  90. insert into weapon_types(id, name, description) values (11, 'TYPE_PIERCE', 'Pierce (pierce)');
  91.  
  92. -- Resistance, Immunity, Susceptibility
  93. create table if not exists ris_bits (
  94.     id              integer primary key not null,
  95.     name            text
  96. );
  97. insert into ris_bits(id, name) values (1 << 0,  'IMM_FIRE');
  98. insert into ris_bits(id, name) values (1 << 1,  'IMM_COLD');
  99. insert into ris_bits(id, name) values (1 << 2,  'IMM_ELEC');
  100. insert into ris_bits(id, name) values (1 << 3,  'IMM_ENERGY');
  101. insert into ris_bits(id, name) values (1 << 4,  'IMM_BLUNT');
  102. insert into ris_bits(id, name) values (1 << 5,  'IMM_PIERCE');
  103. insert into ris_bits(id, name) values (1 << 6,  'IMM_SLASH');
  104. insert into ris_bits(id, name) values (1 << 7,  'IMM_ACID');
  105. insert into ris_bits(id, name) values (1 << 8,  'IMM_POISON');
  106. insert into ris_bits(id, name) values (1 << 9,  'IMM_DRAIN');
  107. insert into ris_bits(id, name) values (1 << 10, 'IMM_SLEEP');
  108. insert into ris_bits(id, name) values (1 << 11, 'IMM_CHARM');
  109. insert into ris_bits(id, name) values (1 << 12, 'IMM_HOLD');
  110. insert into ris_bits(id, name) values (1 << 13, 'IMM_NONMAG');
  111. insert into ris_bits(id, name) values (1 << 14, 'IMM_PLUS1');
  112. insert into ris_bits(id, name) values (1 << 15, 'IMM_PLUS2');
  113. insert into ris_bits(id, name) values (1 << 16, 'IMM_PLUS3');
  114. insert into ris_bits(id, name) values (1 << 17, 'IMM_PLUS4');
  115.  
  116. create table if not exists sexes (
  117.     id              integer primary key not null,
  118.     name            text
  119. );
  120. insert into sexes(id, name) values (0, 'SEX_NEUTRAL');
  121. insert into sexes(id, name) values (1, 'SEX_MALE');
  122. insert into sexes(id, name) values (2, 'SEX_FEMALE');
  123.  
  124. -- what IS your alignment?  select name from alignments where 1200 between bottom and top;
  125. -- are you EVIL?  select 'ALIGN_EVIL' in (select name from alignments where -350 <= top);
  126. -- are you GOOD?  select 'ALIGN_GOOD' in (select name from alignments where 350 >= bottom);
  127. -- are you NEUTRAL?
  128. -- select 'ALIGN_GOOD' not in (select name from alignments where 112 >= bottom)
  129. --    and 'ALIGN_EVIL' not in (select name from alignments where 112 <= top);
  130. create table if not exists alignments (
  131.     name            text primary key not null,
  132.     bottom          integer,
  133.     top             integer
  134. );
  135. insert into alignments(name, bottom, top) values ('ALIGN_REALLY_VILE', -2147483648, -1000);
  136. insert into alignments(name, bottom, top) values ('ALIGN_VILE', -999, -900);
  137. insert into alignments(name, bottom, top) values ('ALIGN_VERY_EVIL', -899, -700);
  138. insert into alignments(name, bottom, top) values ('ALIGN_EVIL', -699, -350);
  139. insert into alignments(name, bottom, top) values ('ALIGN_WICKED', -349, -100);
  140. insert into alignments(name, bottom, top) values ('ALIGN_NEUTRAL', -99, 99);
  141. insert into alignments(name, bottom, top) values ('ALIGN_NICE', 100, 349);
  142. insert into alignments(name, bottom, top) values ('ALIGN_GOOD', 350, 699);
  143. insert into alignments(name, bottom, top) values ('ALIGN_VERY_GOOD', 700, 899);
  144. insert into alignments(name, bottom, top) values ('ALIGN_HOLY', 900, 999);
  145. insert into alignments(name, bottom, top) values ('ALIGN_REALLY_HOLY', 1000, 2147483647);
  146.  
  147. create table if not exists races (
  148.     id              integer primary key not null,
  149.     name            text,
  150.     playable        boolean
  151. );
  152. insert into races(id, name, playable) values (0, 'RACE_HALFBREED', 1);
  153. insert into races(id, name, playable) values (1, 'RACE_HUMAN', 1);
  154. insert into races(id, name, playable) values (2, 'RACE_ELVEN', 1);
  155. insert into races(id, name, playable) values (3, 'RACE_DWARF', 1);
  156. insert into races(id, name, playable) values (4, 'RACE_HALFLING', 1);
  157. insert into races(id, name, playable) values (5, 'RACE_GNOME', 1);
  158. insert into races(id, name, playable) values (6, 'RACE_REPTILE', 0);
  159. insert into races(id, name, playable) values (7, 'RACE_SPECIAL', 0);
  160. insert into races(id, name, playable) values (8, 'RACE_LYCANTH', 0);
  161. insert into races(id, name, playable) values (9, 'RACE_DRAGON', 0);
  162. insert into races(id, name, playable) values (10, 'RACE_UNDEAD', 0);
  163. insert into races(id, name, playable) values (11, 'RACE_ORC', 0);
  164. insert into races(id, name, playable) values (12, 'RACE_INSECT', 0);
  165. insert into races(id, name, playable) values (13, 'RACE_ARACHNID', 0);
  166. insert into races(id, name, playable) values (14, 'RACE_DINOSAUR', 0);
  167. insert into races(id, name, playable) values (15, 'RACE_FISH', 0);
  168. insert into races(id, name, playable) values (16, 'RACE_BIRD', 0);
  169. insert into races(id, name, playable) values (17, 'RACE_GIANT', 0);
  170. insert into races(id, name, playable) values (18, 'RACE_PREDATOR', 0);
  171. insert into races(id, name, playable) values (19, 'RACE_PARASITE', 0);
  172. insert into races(id, name, playable) values (20, 'RACE_SLIME', 0);
  173. insert into races(id, name, playable) values (21, 'RACE_DEMON', 0);
  174. insert into races(id, name, playable) values (22, 'RACE_SNAKE', 0);
  175. insert into races(id, name, playable) values (23, 'RACE_HERBIV', 0);
  176. insert into races(id, name, playable) values (24, 'RACE_TREE', 0);
  177. insert into races(id, name, playable) values (25, 'RACE_VEGGIE', 0);
  178. insert into races(id, name, playable) values (26, 'RACE_ELEMENT', 0);
  179. insert into races(id, name, playable) values (27, 'RACE_PLANAR', 0);
  180. insert into races(id, name, playable) values (28, 'RACE_DEVIL', 0);
  181. insert into races(id, name, playable) values (29, 'RACE_GHOST', 0);
  182. insert into races(id, name, playable) values (30, 'RACE_GOBLIN', 0);
  183. insert into races(id, name, playable) values (31, 'RACE_TROLL', 0);
  184. insert into races(id, name, playable) values (32, 'RACE_VEGMAN', 0);
  185. insert into races(id, name, playable) values (33, 'RACE_MFLAYER', 0);
  186. insert into races(id, name, playable) values (34, 'RACE_PRIMATE', 0);
  187. insert into races(id, name, playable) values (35, 'RACE_ANIMAL', 0);
  188. insert into races(id, name, playable) values (36, 'RACE_FAERY', 0);
  189. insert into races(id, name, playable) values (37, 'RACE_PLANT', 0);
  190.  
  191. create table if not exists class_bits (
  192.     id              integer primary key not null,
  193.     name            text
  194. );
  195. insert into class_bits(id, name) values (1 << 0, 'CLASS_MAGIC_USER');
  196. insert into class_bits(id, name) values (1 << 1, 'CLASS_CLERIC');
  197. insert into class_bits(id, name) values (1 << 2, 'CLASS_WARRIOR');
  198. insert into class_bits(id, name) values (1 << 3, 'CLASS_THIEF');
  199. insert into class_bits(id, name) values (1 << 4, 'CLASS_RANGER');
  200. insert into class_bits(id, name) values (1 << 5, 'CLASS_DRUID');
  201.  
  202. create table if not exists hate_bits (
  203.     id              integer primary key not null,
  204.     name            text
  205. );
  206. insert into hate_bits(id, name) values (1 << 0, 'HATE_SEX');
  207. insert into hate_bits(id, name) values (1 << 1, 'HATE_RACE');
  208. insert into hate_bits(id, name) values (1 << 2, 'HATE_CHAR');
  209. insert into hate_bits(id, name) values (1 << 3, 'HATE_CLASS');
  210. insert into hate_bits(id, name) values (1 << 4, 'HATE_EVIL');
  211. insert into hate_bits(id, name) values (1 << 5, 'HATE_GOOD');
  212. insert into hate_bits(id, name) values (1 << 6, 'HATE_VNUM');
  213. insert into hate_bits(id, name) values (1 << 7, 'HATE_RICH');
  214.  
  215. create table if not exists fear_bits (
  216.     id              integer primary key not null,
  217.     name            text
  218. );
  219. insert into fear_bits(id, name) values (1 << 0, 'FEAR_SEX');
  220. insert into fear_bits(id, name) values (1 << 1, 'FEAR_RACE');
  221. insert into fear_bits(id, name) values (1 << 2, 'FEAR_CHAR');
  222. insert into fear_bits(id, name) values (1 << 3, 'FEAR_CLASS');
  223. insert into fear_bits(id, name) values (1 << 4, 'FEAR_EVIL');
  224. insert into fear_bits(id, name) values (1 << 5, 'FEAR_GOOD');
  225. insert into fear_bits(id, name) values (1 << 6, 'FEAR_VNUM');
  226. insert into fear_bits(id, name) values (1 << 7, 'FEAR_RICH');
  227.  
  228. -- Zones
  229.  
  230. create table if not exists zone_reset_modes (
  231.     id              integer primary key not null,
  232.     name            text
  233. );
  234. insert into zone_reset_modes(id, name) values (0, 'Never');
  235. insert into zone_reset_modes(id, name) values (1, 'When Empty');
  236. insert into zone_reset_modes(id, name) values (2, 'Always');
  237.  
  238. -- Mobiles
  239.  
  240. create table if not exists act_bits (
  241.     id              integer primary key not null,
  242.     name            text
  243. );
  244. insert into act_bits(id, name) values (1 << 0,  'ACT_SPEC');
  245. insert into act_bits(id, name) values (1 << 1,  'ACT_SENTINEL');
  246. insert into act_bits(id, name) values (1 << 2,  'ACT_SCAVENGER');
  247. insert into act_bits(id, name) values (1 << 3,  'ACT_ISNPC');
  248. insert into act_bits(id, name) values (1 << 4,  'ACT_NICE_THIEF');
  249. insert into act_bits(id, name) values (1 << 5,  'ACT_AGGRESSIVE');
  250. insert into act_bits(id, name) values (1 << 6,  'ACT_STAY_ZONE');
  251. insert into act_bits(id, name) values (1 << 7,  'ACT_WIMPY');
  252. insert into act_bits(id, name) values (1 << 8,  'ACT_ANNOYING');
  253. insert into act_bits(id, name) values (1 << 9,  'ACT_HATEFUL');
  254. insert into act_bits(id, name) values (1 << 10, 'ACT_AFRAID');
  255. insert into act_bits(id, name) values (1 << 11, 'ACT_IMMORTAL');
  256. insert into act_bits(id, name) values (1 << 12, 'ACT_HUNTING');
  257. insert into act_bits(id, name) values (1 << 13, 'ACT_DEADLY');
  258. insert into act_bits(id, name) values (1 << 14, 'ACT_POLYSELF');
  259. insert into act_bits(id, name) values (1 << 15, 'ACT_POLYOTHER');
  260. insert into act_bits(id, name) values (1 << 16, 'ACT_GUARDIAN');
  261. insert into act_bits(id, name) values (1 << 17, 'ACT_USE_ITEM');
  262. insert into act_bits(id, name) values (1 << 18, 'ACT_FIGHTER_MOVES');
  263. insert into act_bits(id, name) values (1 << 19, 'ACT_FOOD_PROVIDE');
  264. insert into act_bits(id, name) values (1 << 20, 'ACT_PROTECTOR');
  265. insert into act_bits(id, name) values (1 << 21, 'ACT_MOUNT');
  266. insert into act_bits(id, name) values (1 << 22, 'ACT_SWITCH');
  267.  
  268. create table if not exists aff_bits (
  269.     id              integer primary key not null,
  270.     name            text
  271. );
  272. insert into aff_bits(id, name) values (1 << 0,  'AFF_BLIND');
  273. insert into aff_bits(id, name) values (1 << 1,  'AFF_INVISIBLE');
  274. insert into aff_bits(id, name) values (1 << 2,  'AFF_DETECT_EVIL');
  275. insert into aff_bits(id, name) values (1 << 3,  'AFF_DETECT_INVISIBLE');
  276. insert into aff_bits(id, name) values (1 << 4,  'AFF_DETECT_MAGIC');
  277. insert into aff_bits(id, name) values (1 << 5,  'AFF_SENSE_LIFE');
  278. insert into aff_bits(id, name) values (1 << 6,  'AFF_SILENCED');
  279. insert into aff_bits(id, name) values (1 << 7,  'AFF_SANCTUARY');
  280. insert into aff_bits(id, name) values (1 << 8,  'AFF_GROUP');
  281. --insert into aff_bits(id, name) values (1 << 9,  'AFF_UNDEF_2');
  282. insert into aff_bits(id, name) values (1 << 10, 'AFF_CURSE');
  283. insert into aff_bits(id, name) values (1 << 11, 'AFF_FLYING');
  284. insert into aff_bits(id, name) values (1 << 12, 'AFF_POISON');
  285. insert into aff_bits(id, name) values (1 << 13, 'AFF_PROTECT_EVIL');
  286. insert into aff_bits(id, name) values (1 << 14, 'AFF_PARALYSIS');
  287. insert into aff_bits(id, name) values (1 << 15, 'AFF_INFRAVISION');
  288. insert into aff_bits(id, name) values (1 << 16, 'AFF_WATERBREATH');
  289. insert into aff_bits(id, name) values (1 << 17, 'AFF_SLEEP');
  290. insert into aff_bits(id, name) values (1 << 18, 'AFF_DRUG_FREE');
  291. insert into aff_bits(id, name) values (1 << 19, 'AFF_SNEAK');
  292. insert into aff_bits(id, name) values (1 << 20, 'AFF_HIDE');
  293. insert into aff_bits(id, name) values (1 << 21, 'AFF_FEAR');
  294. insert into aff_bits(id, name) values (1 << 22, 'AFF_CHARM');
  295. insert into aff_bits(id, name) values (1 << 23, 'AFF_FOLLOW');
  296. --insert into aff_bits(id, name) values (1 << 24, 'AFF_UNDEF_1');
  297. insert into aff_bits(id, name) values (1 << 25, 'AFF_TRUE_SIGHT');
  298. insert into aff_bits(id, name) values (1 << 26, 'AFF_SCRYING');
  299. insert into aff_bits(id, name) values (1 << 27, 'AFF_FIRESHIELD');
  300. insert into aff_bits(id, name) values (1 << 28, 'AFF_RIDE');
  301. --insert into aff_bits(id, name) values (1 << 29, 'AFF_UNDEF_6');
  302. --insert into aff_bits(id, name) values (1 << 30, 'AFF_UNDEF_7');
  303. --insert into aff_bits(id, name) values (1 << 31, 'AFF_UNDEF_8');
  304.  
  305. create table if not exists positions (
  306.     id              integer primary key not null,
  307.     name            text
  308. );
  309. insert into positions(id, name) values (0, 'POSITION_DEAD');
  310. insert into positions(id, name) values (1, 'POSITION_MORTALLYW');
  311. insert into positions(id, name) values (2, 'POSITION_INCAP');
  312. insert into positions(id, name) values (3, 'POSITION_STUNNED');
  313. insert into positions(id, name) values (4, 'POSITION_SLEEPING');
  314. insert into positions(id, name) values (5, 'POSITION_RESTING');
  315. insert into positions(id, name) values (6, 'POSITION_SITTING');
  316. insert into positions(id, name) values (7, 'POSITION_FIGHTING');
  317. insert into positions(id, name) values (8, 'POSITION_STANDING');
  318. insert into positions(id, name) values (9, 'POSITION_MOUNTED');
  319.  
  320. -- Objects
  321.  
  322. create table if not exists item_types (
  323.     id              integer primary key not null,
  324.     name            text
  325. );
  326. insert into item_types(id, name) values (0, 'NONE');
  327. insert into item_types(id, name) values (1, 'ITEM_LIGHT');
  328. insert into item_types(id, name) values (2, 'ITEM_SCROLL');
  329. insert into item_types(id, name) values (3, 'ITEM_WAND');
  330. insert into item_types(id, name) values (4, 'ITEM_STAFF');
  331. insert into item_types(id, name) values (5, 'ITEM_WEAPON');
  332. insert into item_types(id, name) values (6, 'ITEM_FIREWEAPON');
  333. insert into item_types(id, name) values (7, 'ITEM_MISSILE');
  334. insert into item_types(id, name) values (8, 'ITEM_TREASURE');
  335. insert into item_types(id, name) values (9, 'ITEM_ARMOR');
  336. insert into item_types(id, name) values (10, 'ITEM_POTION');
  337. insert into item_types(id, name) values (11, 'ITEM_WORN');
  338. insert into item_types(id, name) values (12, 'ITEM_OTHER');
  339. insert into item_types(id, name) values (13, 'ITEM_TRASH');
  340. insert into item_types(id, name) values (14, 'ITEM_TRAP');
  341. insert into item_types(id, name) values (15, 'ITEM_CONTAINER');
  342. insert into item_types(id, name) values (16, 'ITEM_NOTE');
  343. insert into item_types(id, name) values (17, 'ITEM_DRINKCON');
  344. insert into item_types(id, name) values (18, 'ITEM_KEY');
  345. insert into item_types(id, name) values (19, 'ITEM_FOOD');
  346. insert into item_types(id, name) values (20, 'ITEM_MONEY');
  347. insert into item_types(id, name) values (21, 'ITEM_PEN');
  348. insert into item_types(id, name) values (22, 'ITEM_BOAT');
  349. insert into item_types(id, name) values (23, 'ITEM_AUDIO');
  350. insert into item_types(id, name) values (24, 'ITEM_BOARD');
  351.  
  352. -- This SHOULD be a single table, but apparently there is overlap, so we need
  353. -- to have separate tables for skills, spells, and damage_types... for now.
  354. create table if not exists skills (
  355.     id              integer primary key not null,
  356.     name            text
  357. );
  358. insert into skills(id, name) values (-1, 'TYPE_UNDEFINED');
  359.  
  360. insert into skills(id, name) values (45, 'SKILL_SNEAK');
  361. insert into skills(id, name) values (46, 'SKILL_HIDE');
  362. insert into skills(id, name) values (47, 'SKILL_STEAL');
  363. insert into skills(id, name) values (48, 'SKILL_BACKSTAB');
  364. insert into skills(id, name) values (49, 'SKILL_PICK_LOCK');
  365. insert into skills(id, name) values (50, 'SKILL_KICK');
  366. insert into skills(id, name) values (51, 'SKILL_BASH');
  367. insert into skills(id, name) values (52, 'SKILL_RESCUE');
  368.  
  369. insert into skills(id, name) values (149, 'SKILL_DOOR_BASH');
  370. insert into skills(id, name) values (150, 'SKILL_READ_MAGIC');
  371. insert into skills(id, name) values (151, 'SKILL_SCRIBE');
  372. insert into skills(id, name) values (152, 'SKILL_BREW');
  373. insert into skills(id, name) values (153, 'SKILL_PUNCH');
  374. insert into skills(id, name) values (154, 'SKILL_TWO_HANDED');
  375. insert into skills(id, name) values (155, 'SKILL_TWO_WEAPON');
  376. insert into skills(id, name) values (156, 'SKILL_BANDAGE');
  377. insert into skills(id, name) values (157, 'SKILL_SEARCH');
  378. insert into skills(id, name) values (158, 'SKILL_SWIMMING');
  379. insert into skills(id, name) values (159, 'SKILL_ENDURANCE');
  380. insert into skills(id, name) values (160, 'SKILL_BARE_HAND');
  381. insert into skills(id, name) values (161, 'SKILL_BLIND_FIGHTING');
  382. insert into skills(id, name) values (162, 'SKILL_PARRY');
  383. insert into skills(id, name) values (163, 'SKILL_APRAISE');
  384. insert into skills(id, name) values (164, 'SKILL_SPEC_SMITE');
  385. insert into skills(id, name) values (165, 'SKILL_SPEC_STAB');
  386. insert into skills(id, name) values (166, 'SKILL_SPEC_WHIP');
  387. insert into skills(id, name) values (167, 'SKILL_SPEC_SLASH');
  388. insert into skills(id, name) values (168, 'SKILL_SPEC_SMASH');
  389. insert into skills(id, name) values (169, 'SKILL_SPEC_CLEAVE');
  390. insert into skills(id, name) values (170, 'SKILL_SPEC_CRUSH');
  391. insert into skills(id, name) values (171, 'SKILL_SPEC_BLUDGE');
  392. insert into skills(id, name) values (172, 'SKILL_SPEC_PIERCE');
  393. insert into skills(id, name) values (173, 'SKILL_PEER');
  394. insert into skills(id, name) values (174, 'SKILL_DETECT_NOISE');
  395. insert into skills(id, name) values (175, 'SKILL_DODGE');
  396. insert into skills(id, name) values (176, 'SKILL_BARTER');
  397. insert into skills(id, name) values (177, 'SKILL_KNOCK_OUT');
  398. insert into skills(id, name) values (178, 'SKILL_SPELLCRAFT');
  399. insert into skills(id, name) values (179, 'SKILL_MEDITATION');
  400. insert into skills(id, name) values (180, 'SKILL_TRACK');
  401. insert into skills(id, name) values (181, 'SKILL_FIND_TRAP');
  402. insert into skills(id, name) values (182, 'SKILL_DISARM_TRAP');
  403. insert into skills(id, name) values (183, 'SKILL_DISARM');
  404. insert into skills(id, name) values (184, 'SKILL_BASH_W_SHIELD');
  405. insert into skills(id, name) values (185, 'SKILL_RIDE');
  406. -- conflicting ones here?
  407. -- insert into skills(id, name) values (171, 'SKILL_SIGN');
  408. -- insert into skills(id, name) values (174, 'SKILL_DODGE');
  409. -- insert into skills(id, name) values (176, 'SKILL_RETREAT');
  410. -- insert into skills(id, name) values (179, 'SKILL_FEIGN_DEATH');
  411. -- insert into skills(id, name) values (182, 'SKILL_SPRING_LEAP');
  412. -- insert into skills(id, name) values (185, 'SKILL_EVALUATE');
  413. -- insert into skills(id, name) values (186, 'SKILL_SPY');
  414. -- insert into skills(id, name) values (188, 'SKILL_SWIM');
  415.  
  416. create table if not exists spells (
  417.     id              integer primary key not null,
  418.     name            text
  419. );
  420. insert into spells(id, name) values (-1, 'TYPE_UNDEFINED');
  421. insert into spells(id, name) values (0, 'SPELL_RESERVED_DBC');
  422. insert into spells(id, name) values (1, 'SPELL_ARMOR');
  423. insert into spells(id, name) values (2, 'SPELL_TELEPORT');
  424. insert into spells(id, name) values (3, 'SPELL_BLESS');
  425. insert into spells(id, name) values (4, 'SPELL_BLINDNESS');
  426. insert into spells(id, name) values (5, 'SPELL_BURNING_HANDS');
  427. insert into spells(id, name) values (6, 'SPELL_CALL_LIGHTNING');
  428. insert into spells(id, name) values (7, 'SPELL_CHARM_PERSON');
  429. insert into spells(id, name) values (8, 'SPELL_CHILL_TOUCH');
  430. insert into spells(id, name) values (9, 'SPELL_CLONE');
  431. insert into spells(id, name) values (10, 'SPELL_COLOUR_SPRAY');
  432. insert into spells(id, name) values (11, 'SPELL_CONTROL_WEATHER');
  433. insert into spells(id, name) values (12, 'SPELL_CREATE_FOOD');
  434. insert into spells(id, name) values (13, 'SPELL_CREATE_WATER');
  435. insert into spells(id, name) values (14, 'SPELL_CURE_BLIND');
  436. insert into spells(id, name) values (15, 'SPELL_CURE_CRITIC');
  437. insert into spells(id, name) values (16, 'SPELL_CURE_LIGHT');
  438. insert into spells(id, name) values (17, 'SPELL_CURSE');
  439. insert into spells(id, name) values (18, 'SPELL_DETECT_EVIL');
  440. insert into spells(id, name) values (19, 'SPELL_DETECT_INVISIBLE');
  441. insert into spells(id, name) values (20, 'SPELL_DETECT_MAGIC');
  442. insert into spells(id, name) values (21, 'SPELL_DETECT_POISON');
  443. insert into spells(id, name) values (22, 'SPELL_DISPEL_EVIL');
  444. insert into spells(id, name) values (23, 'SPELL_EARTHQUAKE');
  445. insert into spells(id, name) values (24, 'SPELL_ENCHANT_WEAPON');
  446. insert into spells(id, name) values (25, 'SPELL_ENERGY_DRAIN');
  447. insert into spells(id, name) values (26, 'SPELL_FIREBALL');
  448. insert into spells(id, name) values (27, 'SPELL_HARM');
  449. insert into spells(id, name) values (28, 'SPELL_HEAL');
  450. insert into spells(id, name) values (29, 'SPELL_INVISIBLE');
  451. insert into spells(id, name) values (30, 'SPELL_LIGHTNING_BOLT');
  452. insert into spells(id, name) values (31, 'SPELL_LOCATE_OBJECT');
  453. insert into spells(id, name) values (32, 'SPELL_MAGIC_MISSILE');
  454. insert into spells(id, name) values (33, 'SPELL_POISON');
  455. insert into spells(id, name) values (34, 'SPELL_PROTECT_FROM_EVIL');
  456. insert into spells(id, name) values (35, 'SPELL_REMOVE_CURSE');
  457. insert into spells(id, name) values (36, 'SPELL_SANCTUARY');
  458. insert into spells(id, name) values (37, 'SPELL_SHOCKING_GRASP');
  459. insert into spells(id, name) values (38, 'SPELL_SLEEP');
  460. insert into spells(id, name) values (39, 'SPELL_STRENGTH');
  461. insert into spells(id, name) values (40, 'SPELL_SUMMON');
  462. insert into spells(id, name) values (41, 'SPELL_VENTRILOQUATE');
  463. insert into spells(id, name) values (42, 'SPELL_WORD_OF_RECALL');
  464. insert into spells(id, name) values (43, 'SPELL_REMOVE_POISON');
  465. insert into spells(id, name) values (44, 'SPELL_SENCE_LIFE');
  466.  
  467. insert into spells(id, name) values (53, 'SPELL_IDENTIFY');
  468. insert into spells(id, name) values (54, 'SPELL_INFRAVISION');
  469. insert into spells(id, name) values (55, 'SPELL_CAUSE_LIGHT');
  470. insert into spells(id, name) values (56, 'SPELL_CAUSE_CRITICAL');
  471. insert into spells(id, name) values (57, 'SPELL_FLAMESTRIKE');
  472. insert into spells(id, name) values (58, 'SPELL_DISPEL_GOOD');
  473. insert into spells(id, name) values (59, 'SPELL_WEAKNESS');
  474. insert into spells(id, name) values (60, 'SPELL_DISPEL_MAGIC');
  475. insert into spells(id, name) values (61, 'SPELL_KNOCK');
  476. insert into spells(id, name) values (62, 'SPELL_KNOW_ALIGNMENT');
  477. insert into spells(id, name) values (63, 'SPELL_ANIMATE_DEAD');
  478. insert into spells(id, name) values (64, 'SPELL_PARALYSIS');
  479. insert into spells(id, name) values (65, 'SPELL_REMOVE_PARALYSIS');
  480. insert into spells(id, name) values (66, 'SPELL_FEAR');
  481. insert into spells(id, name) values (67, 'SPELL_ACID_BLAST');
  482. insert into spells(id, name) values (68, 'SPELL_WATER_BREATH');
  483. insert into spells(id, name) values (69, 'SPELL_FLY');
  484. insert into spells(id, name) values (70, 'SPELL_CONE_OF_COLD');
  485. insert into spells(id, name) values (71, 'SPELL_METEOR_SWARM');
  486. insert into spells(id, name) values (72, 'SPELL_ICE_STORM');
  487. insert into spells(id, name) values (73, 'SPELL_SHIELD');
  488. insert into spells(id, name) values (74, 'SPELL_MON_SUM_1');
  489. insert into spells(id, name) values (75, 'SPELL_MON_SUM_2');
  490. insert into spells(id, name) values (76, 'SPELL_MON_SUM_3');
  491. insert into spells(id, name) values (77, 'SPELL_MON_SUM_4');
  492. insert into spells(id, name) values (78, 'SPELL_MON_SUM_5');
  493. insert into spells(id, name) values (79, 'SPELL_MON_SUM_6');
  494. insert into spells(id, name) values (80, 'SPELL_MON_SUM_7');
  495. insert into spells(id, name) values (81, 'SPELL_FIRESHIELD');
  496. insert into spells(id, name) values (82, 'SPELL_CHARM_MONSTER');
  497. insert into spells(id, name) values (83, 'SPELL_CURE_SERIOUS');
  498. insert into spells(id, name) values (84, 'SPELL_CAUSE_SERIOUS');
  499. insert into spells(id, name) values (85, 'SPELL_REFRESH');
  500. insert into spells(id, name) values (86, 'SPELL_SECOND_WIND');
  501. insert into spells(id, name) values (87, 'SPELL_TURN');
  502. insert into spells(id, name) values (88, 'SPELL_SUCCOR');
  503. insert into spells(id, name) values (89, 'SPELL_LIGHT');
  504. insert into spells(id, name) values (90, 'SPELL_CONT_LIGHT');
  505. insert into spells(id, name) values (91, 'SPELL_CALM');
  506. insert into spells(id, name) values (92, 'SPELL_STONE_SKIN');
  507. insert into spells(id, name) values (93, 'SPELL_CONJURE_ELEMENTAL');
  508. insert into spells(id, name) values (94, 'SPELL_TRUE_SIGHT');
  509. insert into spells(id, name) values (95, 'SPELL_MINOR_CREATE');
  510. insert into spells(id, name) values (96, 'SPELL_FAERIE_FIRE');
  511. insert into spells(id, name) values (97, 'SPELL_FAERIE_FOG');
  512. insert into spells(id, name) values (98, 'SPELL_CACAODEMON');
  513. insert into spells(id, name) values (99, 'SPELL_POLY_SELF');
  514. insert into spells(id, name) values (100, 'SPELL_MANA');
  515. insert into spells(id, name) values (101, 'SPELL_ASTRAL_WALK');
  516. insert into spells(id, name) values (102, 'SPELL_FLY_GROUP');
  517. insert into spells(id, name) values (103, 'SPELL_AID');
  518. insert into spells(id, name) values (104, 'SPELL_SHELTER');
  519. insert into spells(id, name) values (105, 'SPELL_DRAGON_BREATH');
  520. insert into spells(id, name) values (106, 'SPELL_GOODBERRY');
  521. insert into spells(id, name) values (107, 'SPELL_VISIONS');
  522. insert into spells(id, name) values (108, 'SPELL_MAJOR_TRACK');
  523. insert into spells(id, name) values (109, 'SPELL_GOLEM');
  524. insert into spells(id, name) values (110, 'SPELL_FAMILIAR');
  525. insert into spells(id, name) values (111, 'SPELL_CHANGESTAFF');
  526. insert into spells(id, name) values (112, 'SPELL_HOLY_WORD');
  527. insert into spells(id, name) values (113, 'SPELL_UNHOLY_WORD');
  528. insert into spells(id, name) values (114, 'SPELL_PWORD_KILL');
  529. insert into spells(id, name) values (115, 'SPELL_PWORD_BLIND');
  530. insert into spells(id, name) values (116, 'SPELL_CHAIN_LIGHTNING');
  531. insert into spells(id, name) values (117, 'SPELL_SCARE');
  532.  
  533. insert into spells(id, name) values (119, 'SPELL_COMMAND');
  534. insert into spells(id, name) values (120, 'SPELL_CHANGE_FORM');
  535. insert into spells(id, name) values (121, 'SPELL_FEEBLEMIND');
  536. insert into spells(id, name) values (122, 'SPELL_SHILLELAGH');
  537.  
  538. insert into spells(id, name) values (124, 'SPELL_FLAME_BLADE');
  539. insert into spells(id, name) values (125, 'SPELL_ANIMAL_GROWTH');
  540. insert into spells(id, name) values (126, 'SPELL_INSECT_GROWTH');
  541. insert into spells(id, name) values (127, 'SPELL_CREEPING_DEATH');
  542. insert into spells(id, name) values (128, 'SPELL_COMMUNE');
  543. insert into spells(id, name) values (129, 'SPELL_ANIMAL_SUM_1');
  544. insert into spells(id, name) values (130, 'SPELL_ANIMAL_SUM_2');
  545. insert into spells(id, name) values (131, 'SPELL_ANIMAL_SUM_3');
  546. insert into spells(id, name) values (132, 'SPELL_FIRE_SERVANT');
  547. insert into spells(id, name) values (133, 'SPELL_EARTH_SERVANT');
  548. insert into spells(id, name) values (134, 'SPELL_WATER_SERVANT');
  549. insert into spells(id, name) values (135, 'SPELL_WIND_SERVANT');
  550. insert into spells(id, name) values (136, 'SPELL_REINCARNATE');
  551. insert into spells(id, name) values (137, 'SPELL_CHARM_VEGGIE');
  552. insert into spells(id, name) values (138, 'SPELL_VEGGIE_GROWTH');
  553. insert into spells(id, name) values (139, 'SPELL_TREE');
  554. insert into spells(id, name) values (140, 'SPELL_ANIMATE_ROCK');
  555. insert into spells(id, name) values (141, 'SPELL_TREE_TRAVEL');
  556. insert into spells(id, name) values (142, 'SPELL_TRAVELLING');
  557. insert into spells(id, name) values (143, 'SPELL_ANIMAL_FRIENDSHIP');
  558. insert into spells(id, name) values (144, 'SPELL_INVIS_TO_ANIMALS');
  559. insert into spells(id, name) values (145, 'SPELL_SLOW_POISON');
  560. insert into spells(id, name) values (146, 'SPELL_ENTANGLE');
  561. insert into spells(id, name) values (147, 'SPELL_SNARE');
  562. insert into spells(id, name) values (148, 'SPELL_GUST_OF_WIND');
  563. insert into spells(id, name) values (149, 'SPELL_BARKSKIN');
  564. insert into spells(id, name) values (150, 'SPELL_SUNRAY');
  565. insert into spells(id, name) values (151, 'SPELL_WARP_WEAPON');
  566. insert into spells(id, name) values (152, 'SPELL_HEAT_STUFF');
  567. insert into spells(id, name) values (153, 'SPELL_FIND_TRAPS');
  568. insert into spells(id, name) values (154, 'SPELL_FIRESTORM');
  569. insert into spells(id, name) values (155, 'SPELL_HASTE');
  570. insert into spells(id, name) values (156, 'SPELL_SLOW');
  571. insert into spells(id, name) values (157, 'SPELL_DUST_DEVIL');
  572. insert into spells(id, name) values (158, 'SPELL_KNOW_MONSTER');
  573. insert into spells(id, name) values (159, 'SPELL_TRANSPORT_VIA_PLANT');
  574. insert into spells(id, name) values (160, 'SPELL_SPEAK_WITH_PLANT');
  575. insert into spells(id, name) values (161, 'SPELL_SILENCE');
  576. insert into spells(id, name) values (162, 'SPELL_SENDING');
  577. insert into spells(id, name) values (163, 'SPELL_TELEPORT_WO_ERROR');
  578. insert into spells(id, name) values (164, 'SPELL_PORTAL');
  579. insert into spells(id, name) values (165, 'SPELL_DRAGON_RIDE');
  580. insert into spells(id, name) values (166, 'SPELL_MOUNT');
  581.  
  582. insert into spells(id, name) values (199, 'SPELL_GREEN_SLIME');
  583. insert into spells(id, name) values (200, 'SPELL_GEYSER');
  584. insert into spells(id, name) values (201, 'SPELL_FIRE_BREATH');
  585. insert into spells(id, name) values (202, 'SPELL_GAS_BREATH');
  586. insert into spells(id, name) values (203, 'SPELL_FROST_BREATH');
  587. insert into spells(id, name) values (204, 'SPELL_ACID_BREATH');
  588. insert into spells(id, name) values (205, 'SPELL_LIGHTNING_BREATH');
  589.  
  590. create table if not exists damage_types (
  591.     id              integer primary key not null,
  592.     name            text
  593. );
  594. insert into damage_types(id, name) values (-1, 'TYPE_UNDEFINED');
  595. insert into damage_types(id, name) values (206, 'TYPE_HIT');
  596. insert into damage_types(id, name) values (207, 'TYPE_BLUDGEON');
  597. insert into damage_types(id, name) values (208, 'TYPE_PIERCE');
  598. insert into damage_types(id, name) values (209, 'TYPE_SLASH');
  599. insert into damage_types(id, name) values (210, 'TYPE_WHIP');
  600. insert into damage_types(id, name) values (211, 'TYPE_CLAW');
  601. insert into damage_types(id, name) values (212, 'TYPE_BITE');
  602. insert into damage_types(id, name) values (213, 'TYPE_STING');
  603. insert into damage_types(id, name) values (214, 'TYPE_CRUSH');
  604. insert into damage_types(id, name) values (215, 'TYPE_CLEAVE');
  605. insert into damage_types(id, name) values (216, 'TYPE_STAB');
  606. insert into damage_types(id, name) values (217, 'TYPE_SMASH');
  607. insert into damage_types(id, name) values (218, 'TYPE_SMITE');
  608. insert into damage_types(id, name) values (220, 'TYPE_SUFFERING');
  609. insert into damage_types(id, name) values (221, 'TYPE_HUNGER');
  610.  
  611. -- These are for the "use" command, so while there are ways to put spells onto other items,
  612. -- only potions/scrolls/wands/staffs can be used. (quaff, recite, use, use)
  613. create table if not exists item_spells (
  614.     id              integer primary key not null,
  615.     name            text,
  616.     minimum_level   integer,
  617.     allow_potion    boolean default 'f',
  618.     allow_scroll    boolean default 'f',
  619.     allow_wand      boolean default 'f',
  620.     allow_staff     boolean default 'f'
  621. );
  622. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  623.        values (-1, 'TYPE_UNDEFINED', 0, 't', 't', 't', 't');
  624. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  625.        values (0, 'SPELL_RESERVED_DBC', 0, 'f', 'f', 'f', 'f');
  626. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  627.        values (1, 'SPELL_ARMOR', 1, 't', 't', 't', 'f');
  628. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  629.        values (2, 'SPELL_TELEPORT', 1, 't', 't', 't', 't');
  630. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  631.        values (3, 'SPELL_BLESS', 1, 't', 't', 't', 'f');
  632. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  633.        values (4, 'SPELL_BLINDNESS', 1, 't', 't', 't', 't');
  634. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  635.        values (5, 'SPELL_BURNING_HANDS', 5, 'f', 'f', 'f', 'f');
  636. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  637.        values (6, 'SPELL_CALL_LIGHTNING', 12, 't', 't', 'f', 't');
  638. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  639.        values (7, 'SPELL_CHARM_PERSON', 1, 'f', 't', 'f', 't');
  640. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  641.        values (8, 'SPELL_CHILL_TOUCH', 3, 'f', 'f', 'f', 'f');
  642. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  643.        values (9, 'SPELL_CLONE', 1, 't', 't', 't', 'f');
  644. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  645.        values (10, 'SPELL_COLOUR_SPRAY', 11, 'f', 't', 't', 'f');
  646. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  647.        values (11, 'SPELL_CONTROL_WEATHER', 1, 'f', 'f', 'f', 'f');
  648. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  649.        values (12, 'SPELL_CREATE_FOOD', 1, 'f', 'f', 'f', 'f');
  650. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  651.        values (13, 'SPELL_CREATE_WATER', 1, 'f', 'f', 'f', 'f');
  652. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  653.        values (14, 'SPELL_CURE_BLIND', 1, 't', 'f', 'f', 't');
  654. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  655.        values (15, 'SPELL_CURE_CRITIC', 1, 't', 'f', 'f', 't');
  656. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  657.        values (16, 'SPELL_CURE_LIGHT', 1, 't', 'f', 'f', 't');
  658. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  659.        values (17, 'SPELL_CURSE', 1, 't', 't', 'f', 't');
  660. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  661.        values (18, 'SPELL_DETECT_EVIL', 1, 't', 'f', 'f', 't');
  662. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  663.        values (19, 'SPELL_DETECT_INVISIBLE', 1, 't', 'f', 'f', 't');
  664. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  665.        values (20, 'SPELL_DETECT_MAGIC', 1, 't', 'f', 'f', 't');
  666. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  667.        values (21, 'SPELL_DETECT_POISON', 1, 't', 't', 'f', 'f');
  668. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  669.        values (22, 'SPELL_DISPEL_EVIL', 10, 't', 't', 't', 't');
  670. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  671.        values (23, 'SPELL_EARTHQUAKE', 7, 'f', 't', 'f', 't');
  672. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  673.        values (24, 'SPELL_ENCHANT_WEAPON', 1, 'f', 't', 'f', 'f');
  674. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  675.        values (25, 'SPELL_ENERGY_DRAIN', 13, 't', 't', 't', 't');
  676. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  677.        values (26, 'SPELL_FIREBALL', 15, 'f', 't', 't', 'f');
  678. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  679.        values (27, 'SPELL_HARM', 15, 't', 'f', 'f', 't');
  680. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  681.        values (28, 'SPELL_HEAL', 1, 't', 'f', 'f', 't');
  682. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  683.        values (29, 'SPELL_INVISIBLE', 1, 't', 't', 't', 't');
  684. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  685.        values (30, 'SPELL_LIGHTNING_BOLT', 9, 'f', 't', 't', 'f');
  686. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  687.        values (31, 'SPELL_LOCATE_OBJECT', 1, 'f', 'f', 'f', 'f');
  688. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  689.        values (32, 'SPELL_MAGIC_MISSILE', 1, 'f', 't', 't', 'f');
  690. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  691.        values (33, 'SPELL_POISON', 1, 't', 'f', 'f', 't');
  692. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  693.        values (34, 'SPELL_PROTECT_FROM_EVIL', 1, 't', 't', 't', 't');
  694. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  695.        values (35, 'SPELL_REMOVE_CURSE', 1, 't', 't', 'f', 't');
  696. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  697.        values (36, 'SPELL_SANCTUARY', 1, 't', 't', 'f', 't');
  698. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  699.        values (37, 'SPELL_SHOCKING_GRASP', 7, 'f', 'f', 'f', 'f');
  700. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  701.        values (38, 'SPELL_SLEEP', 1, 't', 't', 't', 't');
  702. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  703.        values (39, 'SPELL_STRENGTH', 1, 't', 't', 'f', 't');
  704. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  705.        values (40, 'SPELL_SUMMON', 1, 't', 'f', 'f', 'f');
  706. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  707.        values (41, 'SPELL_VENTRILOQUATE', 1, 't', 'f', 'f', 'f');
  708. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  709.        values (42, 'SPELL_WORD_OF_RECALL', 1, 't', 't', 't', 't');
  710. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  711.        values (43, 'SPELL_REMOVE_POISON', 1, 't', 'f', 'f', 't');
  712. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  713.        values (44, 'SPELL_SENCE_LIFE', 1, 't', 'f', 'f', 't');
  714. insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
  715.        values (53, 'SPELL_IDENTIFY', 1, 'f', 't', 'f', 'f');
  716.  
  717.  
  718. create table if not exists drinks (
  719.     id              integer primary key not null,
  720.     name            text,
  721.     drunkness       integer,
  722.     fullness        integer,
  723.     thirst          integer
  724. );
  725. insert into drinks(id, name, drunkness, fullness, thirst)
  726.        values (-1, 'ERROR', 0, 0, 0);
  727. insert into drinks(id, name, drunkness, fullness, thirst)
  728.        values (0, 'LIQ_WATER', 0, 1, 10);
  729. insert into drinks(id, name, drunkness, fullness, thirst)
  730.        values (1, 'LIQ_BEER', 3, 2, 5);
  731. insert into drinks(id, name, drunkness, fullness, thirst)
  732.        values (2, 'LIQ_WINE', 5, 2, 5);
  733. insert into drinks(id, name, drunkness, fullness, thirst)
  734.        values (3, 'LIQ_ALE', 2, 2, 5);
  735. insert into drinks(id, name, drunkness, fullness, thirst)
  736.        values (4, 'LIQ_DARKALE', 1, 2, 5);
  737. insert into drinks(id, name, drunkness, fullness, thirst)
  738.        values (5, 'LIQ_WHISKY', 6, 1, 4);
  739. insert into drinks(id, name, drunkness, fullness, thirst)
  740.        values (6, 'LIQ_LEMONADE', 0, 1, 8);
  741. insert into drinks(id, name, drunkness, fullness, thirst)
  742.        values (7, 'LIQ_FIREBRT', 10, 0, 0);
  743. insert into drinks(id, name, drunkness, fullness, thirst)
  744.        values (8, 'LIQ_LOCALSPC', 3, 3, 3);
  745. insert into drinks(id, name, drunkness, fullness, thirst)
  746.        values (9, 'LIQ_SLIME', 0, 4, -8);
  747. insert into drinks(id, name, drunkness, fullness, thirst)
  748.        values (10, 'LIQ_MILK', 0, 3, 6);
  749. insert into drinks(id, name, drunkness, fullness, thirst)
  750.        values (11, 'LIQ_TEA', 0, 1, 6);
  751. insert into drinks(id, name, drunkness, fullness, thirst)
  752.        values (12, 'LIQ_COFFE', 0, 1, 6);
  753. insert into drinks(id, name, drunkness, fullness, thirst)
  754.        values (13, 'LIQ_BLOOD', 0, 2, -1);
  755. insert into drinks(id, name, drunkness, fullness, thirst)
  756.        values (14, 'LIQ_SALTWATER', 0, 1, -2);
  757. insert into drinks(id, name, drunkness, fullness, thirst)
  758.        values (15, 'LIQ_COKE', 0, 1, 5);
  759.  
  760. create table if not exists trap_eff_bits (
  761.     id              integer primary key not null,
  762.     name            text
  763. );
  764. insert into trap_eff_bits(id, name) values (1 << 0,  'TRAP_EFF_MOVE');
  765. insert into trap_eff_bits(id, name) values (1 << 1,  'TRAP_EFF_OBJECT');
  766. insert into trap_eff_bits(id, name) values (1 << 2,  'TRAP_EFF_ROOM');
  767. insert into trap_eff_bits(id, name) values (1 << 3,  'TRAP_EFF_NORTH');
  768. insert into trap_eff_bits(id, name) values (1 << 4,  'TRAP_EFF_EAST');
  769. insert into trap_eff_bits(id, name) values (1 << 5,  'TRAP_EFF_SOUTH');
  770. insert into trap_eff_bits(id, name) values (1 << 6,  'TRAP_EFF_WEST');
  771. insert into trap_eff_bits(id, name) values (1 << 7,  'TRAP_EFF_UP');
  772. insert into trap_eff_bits(id, name) values (1 << 8,  'TRAP_EFF_DOWN');
  773.  
  774. -- These are from the more generic damage types or spell numbers
  775. create table if not exists trap_damage_types (
  776.     id              integer primary key not null,
  777.     name            text
  778. );
  779. insert into trap_damage_types(id, name) values (-3,  'TRAP_DAM_SLEEP');
  780. insert into trap_damage_types(id, name) values (-2,  'TRAP_DAM_TELEPORT');
  781. insert into trap_damage_types(id, name) values (10,  'TRAP_DAM_ENERGY');
  782. insert into trap_damage_types(id, name) values (26,  'TRAP_DAM_FIRE');
  783. insert into trap_damage_types(id, name) values (203, 'TRAP_DAM_COLD');
  784. insert into trap_damage_types(id, name) values (206, 'TRAP_DAM_ACID');
  785. insert into trap_damage_types(id, name) values (207, 'TRAP_DAM_BLUNT');
  786. insert into trap_damage_types(id, name) values (208, 'TRAP_DAM_PIERCE');
  787. insert into trap_damage_types(id, name) values (209, 'TRAP_DAM_SLASH');
  788.  
  789. create table if not exists container_bits (
  790.     id              integer primary key not null,
  791.     name            text
  792. );
  793. insert into container_bits(id, name) values (1 << 0,  'CONT_CLOSEABLE');
  794. insert into container_bits(id, name) values (1 << 1,  'CONT_PICKPROOF');
  795. insert into container_bits(id, name) values (1 << 2,  'CONT_CLOSED');
  796. insert into container_bits(id, name) values (1 << 3,  'CONT_LOCKED');
  797.  
  798. create table if not exists equip_positions (
  799.     id              integer primary key not null,
  800.     name            text
  801. );
  802. insert into equip_positions(id, name) values (0, 'WEAR_LIGHT');
  803. insert into equip_positions(id, name) values (1, 'WEAR_FINGER_R');
  804. insert into equip_positions(id, name) values (2, 'WEAR_FINGER_L');
  805. insert into equip_positions(id, name) values (3, 'WEAR_NECK_1');
  806. insert into equip_positions(id, name) values (4, 'WEAR_NECK_2');
  807. insert into equip_positions(id, name) values (5, 'WEAR_BODY');
  808. insert into equip_positions(id, name) values (6, 'WEAR_HEAD');
  809. insert into equip_positions(id, name) values (7, 'WEAR_LEGS');
  810. insert into equip_positions(id, name) values (8, 'WEAR_FEET');
  811. insert into equip_positions(id, name) values (9, 'WEAR_HANDS');
  812. insert into equip_positions(id, name) values (10, 'WEAR_ARMS');
  813. insert into equip_positions(id, name) values (11, 'WEAR_SHIELD');
  814. insert into equip_positions(id, name) values (12, 'WEAR_ABOUT');
  815. insert into equip_positions(id, name) values (13, 'WEAR_WAISTE');
  816. insert into equip_positions(id, name) values (14, 'WEAR_WRIST_R');
  817. insert into equip_positions(id, name) values (15, 'WEAR_WRIST_L');
  818. insert into equip_positions(id, name) values (16, 'WIELD');
  819. insert into equip_positions(id, name) values (17, 'HOLD');
  820. insert into equip_positions(id, name) values (18, 'WIELD_TWOH');
  821.  
  822. create table if not exists item_extra_bits (
  823.     id              integer primary key not null,
  824.     name            text
  825. );
  826. insert into item_extra_bits(id, name) values (1 << 0,  'ITEM_GLOW');
  827. insert into item_extra_bits(id, name) values (1 << 1,  'ITEM_HUM');
  828. --insert into item_extra_bits(id, name) values (1 << 2,  '');
  829. --insert into item_extra_bits(id, name) values (1 << 3,  '');
  830. --insert into item_extra_bits(id, name) values (1 << 4,  '');
  831. insert into item_extra_bits(id, name) values (1 << 5,  'ITEM_INVISIBLE');
  832. insert into item_extra_bits(id, name) values (1 << 6,  'ITEM_MAGIC');
  833. insert into item_extra_bits(id, name) values (1 << 7,  'ITEM_NODROP');
  834. insert into item_extra_bits(id, name) values (1 << 8,  'ITEM_BLESS');
  835. insert into item_extra_bits(id, name) values (1 << 9,  'ITEM_ANTI_GOOD');
  836. insert into item_extra_bits(id, name) values (1 << 10, 'ITEM_ANTI_EVIL');
  837. insert into item_extra_bits(id, name) values (1 << 11, 'ITEM_ANTI_NEUTRAL');
  838. insert into item_extra_bits(id, name) values (1 << 12, 'ITEM_ANTI_CLERIC');
  839. insert into item_extra_bits(id, name) values (1 << 13, 'ITEM_ANTI_MAGE');
  840. insert into item_extra_bits(id, name) values (1 << 14, 'ITEM_ANTI_THIEF');
  841. insert into item_extra_bits(id, name) values (1 << 15, 'ITEM_ANTI_FIGHTER');
  842. insert into item_extra_bits(id, name) values (1 << 16, 'ITEM_ANTI_RANGER');
  843. insert into item_extra_bits(id, name) values (1 << 17, 'ITEM_PARISH');
  844.  
  845. create table if not exists item_wear_bits (
  846.     id              integer primary key not null,
  847.     name            text
  848. );
  849. insert into item_wear_bits(id, name) values (1 << 0,  'ITEM_TAKE');
  850. insert into item_wear_bits(id, name) values (1 << 1,  'ITEM_WEAR_FINGER');
  851. insert into item_wear_bits(id, name) values (1 << 2,  'ITEM_WEAR_NECK');
  852. insert into item_wear_bits(id, name) values (1 << 3,  'ITEM_WEAR_BODY');
  853. insert into item_wear_bits(id, name) values (1 << 4,  'ITEM_WEAR_HEAD');
  854. insert into item_wear_bits(id, name) values (1 << 5,  'ITEM_WEAR_LEGS');
  855. insert into item_wear_bits(id, name) values (1 << 6,  'ITEM_WEAR_FEET');
  856. insert into item_wear_bits(id, name) values (1 << 7,  'ITEM_WEAR_HANDS');
  857. insert into item_wear_bits(id, name) values (1 << 8,  'ITEM_WEAR_ARMS');
  858. insert into item_wear_bits(id, name) values (1 << 9,  'ITEM_WEAR_SHIELD');
  859. insert into item_wear_bits(id, name) values (1 << 10, 'ITEM_WEAR_ABOUT');
  860. insert into item_wear_bits(id, name) values (1 << 11, 'ITEM_WEAR_WAISTE');
  861. insert into item_wear_bits(id, name) values (1 << 12, 'ITEM_WEAR_WRIST');
  862. insert into item_wear_bits(id, name) values (1 << 13, 'ITEM_WIELD');
  863. insert into item_wear_bits(id, name) values (1 << 14, 'ITEM_WOLD');
  864. insert into item_wear_bits(id, name) values (1 << 15, 'ITEM_WIELD_TWOH');
  865.  
  866. create table if not exists item_applies (
  867.     id              integer primary key not null,
  868.     name            text
  869. );
  870. insert into item_applies(id, name) values (0,  'APPLY_NONE');
  871. insert into item_applies(id, name) values (1,  'APPLY_STR');
  872. insert into item_applies(id, name) values (2,  'APPLY_DEX');
  873. insert into item_applies(id, name) values (3,  'APPLY_INT');
  874. insert into item_applies(id, name) values (4,  'APPLY_WIS');
  875. insert into item_applies(id, name) values (5,  'APPLY_CON');
  876. insert into item_applies(id, name) values (6,  'APPLY_SEX');
  877. insert into item_applies(id, name) values (7,  'APPLY_CLASS');
  878. insert into item_applies(id, name) values (8,  'APPLY_LEVEL');
  879. insert into item_applies(id, name) values (9,  'APPLY_AGE');
  880. insert into item_applies(id, name) values (10, 'APPLY_CHAR_WEIGHT');
  881. insert into item_applies(id, name) values (11, 'APPLY_CHAR_HEIGHT');
  882. insert into item_applies(id, name) values (12, 'APPLY_MANA');
  883. insert into item_applies(id, name) values (13, 'APPLY_HIT');
  884. insert into item_applies(id, name) values (14, 'APPLY_MOVE');
  885. insert into item_applies(id, name) values (15, 'APPLY_GOLD');
  886. insert into item_applies(id, name) values (16, 'APPLY_EXP');
  887. insert into item_applies(id, name) values (17, 'APPLY_ARMOR');
  888. insert into item_applies(id, name) values (18, 'APPLY_HITROLL');
  889. insert into item_applies(id, name) values (19, 'APPLY_DAMROLL');
  890. insert into item_applies(id, name) values (20, 'APPLY_SAVING_PARA');
  891. insert into item_applies(id, name) values (21, 'APPLY_SAVING_ROD');
  892. insert into item_applies(id, name) values (22, 'APPLY_SAVING_PETRI');
  893. insert into item_applies(id, name) values (23, 'APPLY_SAVING_BREATH');
  894. insert into item_applies(id, name) values (24, 'APPLY_SAVING_SPELL');
  895. insert into item_applies(id, name) values (25, 'APPLY_SAVE_ALL');
  896. insert into item_applies(id, name) values (26, 'APPLY_IMMUNE');
  897. insert into item_applies(id, name) values (27, 'APPLY_SUSC');
  898. insert into item_applies(id, name) values (28, 'APPLY_M_IMMUNE');
  899. insert into item_applies(id, name) values (29, 'APPLY_SPELL_AFFECT');
  900. insert into item_applies(id, name) values (30, 'APPLY_WEAPON_SPELL');
  901. insert into item_applies(id, name) values (31, 'APPLY_EAT_SPELL');
  902. insert into item_applies(id, name) values (32, 'APPLY_BACKSTAB');
  903. insert into item_applies(id, name) values (33, 'APPLY_KICK');
  904. insert into item_applies(id, name) values (34, 'APPLY_SNEAK');
  905. insert into item_applies(id, name) values (35, 'APPLY_HIDE');
  906. insert into item_applies(id, name) values (36, 'APPLY_BASH');
  907. insert into item_applies(id, name) values (37, 'APPLY_PICK');
  908. insert into item_applies(id, name) values (38, 'APPLY_STEAL');
  909. insert into item_applies(id, name) values (39, 'APPLY_TRACK');
  910. insert into item_applies(id, name) values (40, 'APPLY_HITNDAM');
  911.  
  912. -- Rooms
  913.  
  914. create table if not exists exit_directions (
  915.     id              integer primary key not null,
  916.     name            text
  917. );
  918. insert into exit_directions(id, name) values (0, 'NORTH');
  919. insert into exit_directions(id, name) values (1, 'EAST');
  920. insert into exit_directions(id, name) values (2, 'SOUTH');
  921. insert into exit_directions(id, name) values (3, 'WEST');
  922. insert into exit_directions(id, name) values (4, 'UP');
  923. insert into exit_directions(id, name) values (5, 'DOWN');
  924.  
  925. create table if not exists exit_bits (
  926.     id              integer primary key not null,
  927.     name            text
  928. );
  929. insert into exit_bits(id, name) values (1 << 0, 'EX_ISDOOR');
  930. insert into exit_bits(id, name) values (1 << 1, 'EX_CLOSED');
  931. insert into exit_bits(id, name) values (1 << 2, 'EX_LOCKED');
  932. insert into exit_bits(id, name) values (1 << 3, 'EX_SECRET');
  933. insert into exit_bits(id, name) values (1 << 4, 'EX_TRAPPED');
  934. insert into exit_bits(id, name) values (1 << 5, 'EX_PICKPROOF');
  935. insert into exit_bits(id, name) values (1 << 6, 'EX_ALIAS');
  936.  
  937. create table if not exists door_states (
  938.     id              integer primary key not null,
  939.     name            text
  940. );
  941. insert into door_states(id, name) values (0, 'OPEN');
  942. -- Actually clears EX_CLOSED and EX_LOCKED from exit
  943. insert into door_states(id, name) values (1, 'CLOSED');
  944. -- Actually clears EX_LOCKED and sets EX_CLOSED on exit
  945. insert into door_states(id, name) values (2, 'LOCKED');
  946. -- Actually sets EX_CLOSED and EX_LOCKED on exit
  947.  
  948. create table if not exists room_bits (
  949.     id              integer primary key not null,
  950.     name            text
  951. );
  952. insert into room_bits(id, name) values (1 << 0,  'DARK');
  953. insert into room_bits(id, name) values (1 << 1,  'DEATH');
  954. insert into room_bits(id, name) values (1 << 2,  'NO_MOB');
  955. insert into room_bits(id, name) values (1 << 3,  'INDOORS');
  956. insert into room_bits(id, name) values (1 << 4,  'PEACEFUL');
  957. insert into room_bits(id, name) values (1 << 5,  'NO_STEAL');
  958. insert into room_bits(id, name) values (1 << 6,  'NO_SUM');
  959. insert into room_bits(id, name) values (1 << 7,  'NO_MAGIC');
  960. insert into room_bits(id, name) values (1 << 8,  'TUNNEL');
  961. insert into room_bits(id, name) values (1 << 9,  'PRIVATE');
  962. insert into room_bits(id, name) values (1 << 10, 'SOUND');
  963.  
  964. create table if not exists sector_types (
  965.     id              integer primary key not null,
  966.     name            text
  967. );
  968. insert into sector_types(id, name) values (-1, 'SECT_TELE');
  969. insert into sector_types(id, name) values (0,  'SECT_INSIDE');
  970. insert into sector_types(id, name) values (1,  'SECT_CITY');
  971. insert into sector_types(id, name) values (2,  'SECT_FIELD');
  972. insert into sector_types(id, name) values (3,  'SECT_FOREST');
  973. insert into sector_types(id, name) values (4,  'SECT_HILLS');
  974. insert into sector_types(id, name) values (5,  'SECT_MOUNTAIN');
  975. insert into sector_types(id, name) values (6,  'SECT_WATER_SWIM');
  976. insert into sector_types(id, name) values (7,  'SECT_WATER_NOSWIM');
  977. insert into sector_types(id, name) values (8,  'SECT_AIR');
  978. insert into sector_types(id, name) values (9,  'SECT_UNDERWATER');
  979.  
  980. -- These set various bits in combinations
  981. create table if not exists exit_types (
  982.     id              integer primary key not null,
  983.     name            text
  984. );
  985. insert into exit_types(id, name) values (0, 'Open Passage');
  986. insert into exit_types(id, name) values (1, 'Normal');
  987. insert into exit_types(id, name) values (2, 'Pickproof');
  988. insert into exit_types(id, name) values (3, 'Secret');
  989. insert into exit_types(id, name) values (4, 'Secret Pickproof');
  990. insert into exit_types(id, name) values (5, 'Open Passage with Alias');
  991. insert into exit_types(id, name) values (6, 'Normal with Alias');
  992. insert into exit_types(id, name) values (7, 'Pickproof with Alias');
  993. insert into exit_types(id, name) values (8, 'Secret with Alias');
  994. insert into exit_types(id, name) values (9, 'Secret Pickproof with Alias');
  995.  
  996. -- Here we start the more complex relations
  997.  
  998. -- For these tables, if the individual bit entries are not null
  999. -- they are the value used by that type.
  1000. create table if not exists fears (
  1001.     id              SERIAL primary key not null,
  1002.     flags           integer not null,
  1003.     sex             integer references sexes(id),   -- references sex id
  1004.     race            integer references races(id),   -- references race id
  1005.     player          text,       -- would reference player name
  1006.     class           integer,    -- bit flags for all classes feared
  1007.     evil            integer,    -- hates <= X alignment
  1008.     good            integer,    -- hates >= X alignment
  1009.     vnum            integer,    -- references mobile vnum
  1010.     rich            integer     -- hate anyone with >= X gold
  1011. );
  1012.  
  1013. create table if not exists hates (
  1014.     id              SERIAL primary key not null,
  1015.     flags           integer not null,
  1016.     sex             integer references sexes(id),   -- references sex id
  1017.     race            integer references races(id),   -- references race id
  1018.     player          text,       -- would reference player name
  1019.     class           integer,    -- bit flags for all classes hated
  1020.     evil            integer,    -- fears <= X alignment
  1021.     good            integer,    -- fears >= X alignment
  1022.     vnum            integer,    -- references mobile vnum
  1023.     rich            integer     -- fear anyone with >= X gold
  1024. );
  1025.  
  1026. create table if not exists extra_descriptions (
  1027.     id              SERIAL primary key not null,
  1028.     description     text,
  1029.     keywords        text
  1030. );
  1031.  
  1032. create table if not exists applies (
  1033.     id              SERIAL primary key not null,
  1034.     location        integer not null references item_applies(id),
  1035.     modifier        integer
  1036. );
  1037.  
  1038. -- The raw zone data
  1039. create table if not exists zones (
  1040.     id              integer primary key not null,       -- called vnum in code
  1041.     name            text not null,
  1042.     reset_mode      integer not null references zone_reset_modes(id),
  1043.     reset_time      integer,
  1044.     top_vnum        integer
  1045. );
  1046.  
  1047. -- The raw object data
  1048. create table if not exists objects (
  1049.     id                  integer primary key not null,       -- called vnum in code
  1050.     name                text not null,                      -- called short_description in code
  1051.     description         text not null,                      -- called long description in code
  1052.     action_description  text,
  1053.     keywords            text not null,
  1054.     item_type           integer references item_types(id),
  1055.     extra_flags         integer not null default 0,         -- bit flags from item_extra_bits
  1056.     wear_flags          integer not null default 0,         -- bit flags from item_wear_bits
  1057.     weight              integer,
  1058.     value               integer,
  1059.     rent_cost           integer,
  1060.  
  1061.     value_one           integer,
  1062.     value_two           integer,
  1063.     value_three         integer,
  1064.     value_four          integer,
  1065.  
  1066.     -- The values below are all derived from item_type and values 1 to 4
  1067.  
  1068.     duration            integer,    -- used for ITEM_LIGHT, -1 means infinite
  1069.     charges             integer,    -- used for ITEM_WAND, ITEM_STAFF, ITEM_TRAP, ITEM_DRINKCON
  1070.     max_charges         integer,    -- used for ITEM_WAND, ITEM_STAFF, ITEM_DRINKCON
  1071.     spell_level         integer,    -- used for ITEM_SCROLL, ITEM_WAND, ITEM_STAFF, ITEM_POTION
  1072.     spell_one           integer references item_spells(id),
  1073.     spell_two           integer references item_spells(id),
  1074.     spell_three         integer references item_spells(id),
  1075.     weapon_damage_rolls integer,    -- used for ITEM_WEAPON
  1076.     weapon_damage_dice  integer,    -- used for ITEM_WEAPON
  1077.     weapon_damage_type  integer references weapon_types(id),
  1078.     armor_class         integer,    -- used for ITEM_ARMOR
  1079.     original_ac         integer,    -- used for ITEM_ARMOR
  1080.     trap_effect         integer,    -- bit flags from trap_eff_bits
  1081.     trap_damage_type    integer references trap_damage_types(id),
  1082.     trap_level          integer,    -- used for ITEM_TRAP
  1083.     container_flags     integer,    -- bit flags from container_bits
  1084.     max_weight          integer,    -- used for ITEM_CONTAINER
  1085.     key_id              integer,    -- vnum of object, -1 for no key and not lockable
  1086.     poisoned            integer,    -- used for ITEM_DRINKCON and ITEM_FOOD, >0 means poisoned
  1087.     key_type            integer,    -- ITEM_KEY key_type must match the one in exits
  1088.     fullness            integer,    -- ITEM_FOOD how many hours of fullness
  1089.     gold                integer     -- ITEM_MONEY gold coins in stack
  1090. );
  1091.  
  1092. create table if not exists objects_extra_descriptions (
  1093.     object_id       integer not null references objects(id),
  1094.     description_id  integer not null references extra_descriptions(id)
  1095. );
  1096.  
  1097. create table if not exists objects_applies (
  1098.     object_id       integer not null references objects(id),
  1099.     apply_id        integer not null references applies(id)
  1100. );
  1101.  
  1102. -- The raw room data
  1103. create table if not exists rooms (
  1104.     id                  integer primary key not null,           -- called vnum in code
  1105.     name                text not null,                          -- called title in code
  1106.     description         text not null,
  1107.     zone                integer not null references zones(id),
  1108.     flags               integer not null default 0,             -- bit flags from room_bits
  1109.     sector_type         integer not null references sector_types(id),
  1110.     teleport_delay      integer,                                -- ticks before player is teleported
  1111.     teleport_room       integer references rooms(id),           -- target room vnum player is teleported to
  1112.     teleport_look       boolean,                                -- do a look after the teleport happens
  1113.     teleport_movement   integer references sector_types(id),    -- sector type to use for move cost
  1114.     river_delay         integer,                                -- ticks before player is moved
  1115.     river_direction     integer references exit_directions(id), -- exit player moves through
  1116.     sound_one           text,   -- ambient sounds
  1117.     sound_two           text    -- ambient sounds
  1118. );
  1119.  
  1120. create table if not exists exits (
  1121.     id              SERIAL primary key not null,
  1122.     direction       integer not null references exit_directions(id),
  1123.     description     text,
  1124.     keywords        text,
  1125.     exit_type       integer references exit_types(id),
  1126.     exit_key        integer, -- key_type, also used in objects via item_type KEY
  1127.     exit_target     integer references rooms(id)
  1128. );
  1129.  
  1130. create table if not exists rooms_exits (
  1131.     room_id         integer not null references rooms(id),
  1132.     exit_id         integer not null references exits(id)
  1133. );
  1134.  
  1135. create table if not exists rooms_extra_descriptions (
  1136.     room_id         integer not null references rooms(id),
  1137.     description_id  integer not null references extra_descriptions(id)
  1138. );
  1139.  
  1140. -- The raw mobile data
  1141. create table if not exists mobiles (
  1142.     id                  integer primary key not null,       -- called vnum in code
  1143.     name                text not null,                      -- called short_description in code
  1144.     description         text not null,                      -- called long description in code
  1145.     action_description  text,                               -- called description in code
  1146.     keywords            text not null,
  1147.     act_flags           integer,                            -- bit flags for act_bits
  1148.     aff_flags           integer,                            -- bit flags for aff_bits
  1149.     alignment           integer,                            -- alignments
  1150.     mob_type            char(1),                            -- one of [SMWDC]
  1151.  
  1152.     hit_dice            integer,                            -- called level in code
  1153.     thac0               integer,
  1154.     armor_class         integer,
  1155.     hit_points          text,                               -- dice roll or plain integer
  1156.     damage              text,                               -- dice roll or plain integer, null for C type
  1157.     attack_count        integer,                            -- multi-attacks for MWC types
  1158.  
  1159.     race                integer references races(id),
  1160.     sex                 integer references sexes(id),
  1161.     class               integer,                            -- bit flags for class_bits
  1162.     height              text,                               -- dice roll or default integer
  1163.     weight              text,                               -- dice roll or default integer
  1164.     gold                text,                               -- dice roll or plain integer
  1165.     experience          text,                               -- dice roll or plain integer
  1166.  
  1167.     resistances         integer,                            -- bit flags for ris_bits
  1168.     immunities          integer,                            -- bit flags for ris_bits
  1169.     susceptibilities    integer,                            -- bit flags for ris_bits
  1170.  
  1171.     strength            text,                               -- dice roll or plain integer, default for SMW types
  1172.     extra_strength      text,                               -- dice roll or plain integer, default for SMW types
  1173.     dexterity           text,                               -- dice roll or plain integer, default for SMW types
  1174.     constitution        text,                               -- dice roll or plain integer, default for SMW types
  1175.     intelligence        text,                               -- dice roll or plain integer, default for SMW types
  1176.     wisdom              text,                               -- dice roll or plain integer, default for SMW types
  1177.  
  1178.     save_paralysis      integer,                            -- default for SMW types
  1179.     save_rod            integer,                            -- default for SMW types
  1180.     save_petrification  integer,                            -- default for SMW types
  1181.     save_breath         integer,                            -- default for SMW types
  1182.     save_spell          integer,                            -- default for SMW types
  1183.  
  1184.     load_position       integer references positions(id),
  1185.     default_position    integer references positions(id),
  1186.     sound_one           text,                               -- ambient sounds
  1187.     sound_two           text                                -- ambient sounds
  1188. );
  1189.  
  1190. -- For C type mobiles, there will be attack_count rows to
  1191. -- describe the attacks the mobile does.  The serial id is just
  1192. -- to keep the order of attacks the same, as a sort key
  1193. create table if not exists mobiles_attacks (
  1194.     id              SERIAL primary key not null,
  1195.     mobile_id       integer not null references mobiles(id),
  1196.     damage          text,                                   -- dice roll or plain integer
  1197.     damage_type     integer references damage_types(id)
  1198. );
  1199.  
  1200. -- Type C mobiles have skills.
  1201. create table if not exists mobiles_skills (
  1202.     id              SERIAL primary key not null,
  1203.     mobile_id       integer not null references mobiles(id),
  1204.     skill_id        integer,
  1205.     learned         integer,
  1206.     recognized      integer
  1207. );
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216. -- Resets within each zone will reference rooms, objects, and mobiles
  1217. create table if not exists resets (
  1218.     id              SERIAL primary key not null,
  1219.     command         char(1) not null,
  1220.     if_flag         boolean,
  1221.     max_existing    integer,
  1222.     equip_position  integer references equip_positions(id),
  1223.     exit_direction  integer references exit_directions(id),
  1224.     door_state      integer references door_states(id),
  1225.     room_id         integer references rooms(id),
  1226.     object_id       integer references objects(id),
  1227.     mobile_id       integer references mobiles(id),
  1228.     target_room     integer references rooms(id),
  1229.     target_object   integer references objects(id),
  1230.     target_mobile   integer references mobiles(id)
  1231. );
  1232.  
  1233. create table if not exists zones_resets (
  1234.     zone_id         integer not null references zones(id),
  1235.     reset_id        integer not null references resets(id)
  1236. );
  1237. create unique index if not exists ix_zones_resets on zones_resets(zone_id, reset_id);
  1238.  
  1239. create table if not exists resets_fears (
  1240.     reset_id        integer not null references resets(id),
  1241.     fear_id         integer not null references fears(id)
  1242. );
  1243. create unique index if not exists ix_resets_fears on resets_fears(reset_id, fear_id);
  1244.  
  1245. create table if not exists resets_hates (
  1246.     reset_id        integer not null references resets(id),
  1247.     hate_id         integer not null references hates(id)
  1248. );
  1249. create unique index if not exists ix_resets_hates on resets_hates(reset_id, hate_id);
Advertisement
Add Comment
Please, Sign In to add comment