· 6 years ago · Apr 24, 2019, 11:44 PM
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.
19create or replace function fn_bits_lookup(table_name text, lookup_value integer)
20returns table (id integer, name text) as $$
21declare
22 i integer;
23 row record;
24begin
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;
32end;
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
39create or replace function fn_dice_parse(dice text)
40returns table (rolls integer, die integer, modifier integer, result integer) as $$
41declare
42 parsed text[];
43begin
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;
68end;
69$$ language PLpgSQL;
70
71-- Utils
72
73create table if not exists weapon_types (
74 id integer primary key not null,
75 name text,
76 description text
77);
78insert into weapon_types(id, name, description) values (-1, 'TYPE_HIT', 'Default');
79insert into weapon_types(id, name, description) values (0, 'TYPE_SMITE', 'Bludgeon (smite)');
80insert into weapon_types(id, name, description) values (1, 'TYPE_STAB', 'Pierce (stab)');
81insert into weapon_types(id, name, description) values (2, 'TYPE_WHIP', 'Slash (whip)');
82insert into weapon_types(id, name, description) values (3, 'TYPE_SLASH', 'Slash (slash)');
83insert into weapon_types(id, name, description) values (4, 'TYPE_SMASH', 'Bludgeon (smash)');
84insert into weapon_types(id, name, description) values (5, 'TYPE_CLEAVE', 'Slash (cleave)');
85insert into weapon_types(id, name, description) values (6, 'TYPE_CRUSH', 'Bludgeon (crush)');
86insert into weapon_types(id, name, description) values (7, 'TYPE_BLUDGEON', 'Bludgeon (pound)');
87insert into weapon_types(id, name, description) values (8, 'TYPE_CLAW', 'Mob (claw)');
88insert into weapon_types(id, name, description) values (9, 'TYPE_BITE', 'Mob (bite)');
89insert into weapon_types(id, name, description) values (10, 'TYPE_STING', 'Mob (sting)');
90insert into weapon_types(id, name, description) values (11, 'TYPE_PIERCE', 'Pierce (pierce)');
91
92-- Resistance, Immunity, Susceptibility
93create table if not exists ris_bits (
94 id integer primary key not null,
95 name text
96);
97insert into ris_bits(id, name) values (1 << 0, 'IMM_FIRE');
98insert into ris_bits(id, name) values (1 << 1, 'IMM_COLD');
99insert into ris_bits(id, name) values (1 << 2, 'IMM_ELEC');
100insert into ris_bits(id, name) values (1 << 3, 'IMM_ENERGY');
101insert into ris_bits(id, name) values (1 << 4, 'IMM_BLUNT');
102insert into ris_bits(id, name) values (1 << 5, 'IMM_PIERCE');
103insert into ris_bits(id, name) values (1 << 6, 'IMM_SLASH');
104insert into ris_bits(id, name) values (1 << 7, 'IMM_ACID');
105insert into ris_bits(id, name) values (1 << 8, 'IMM_POISON');
106insert into ris_bits(id, name) values (1 << 9, 'IMM_DRAIN');
107insert into ris_bits(id, name) values (1 << 10, 'IMM_SLEEP');
108insert into ris_bits(id, name) values (1 << 11, 'IMM_CHARM');
109insert into ris_bits(id, name) values (1 << 12, 'IMM_HOLD');
110insert into ris_bits(id, name) values (1 << 13, 'IMM_NONMAG');
111insert into ris_bits(id, name) values (1 << 14, 'IMM_PLUS1');
112insert into ris_bits(id, name) values (1 << 15, 'IMM_PLUS2');
113insert into ris_bits(id, name) values (1 << 16, 'IMM_PLUS3');
114insert into ris_bits(id, name) values (1 << 17, 'IMM_PLUS4');
115
116create table if not exists sexes (
117 id integer primary key not null,
118 name text
119);
120insert into sexes(id, name) values (0, 'SEX_NEUTRAL');
121insert into sexes(id, name) values (1, 'SEX_MALE');
122insert 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);
130create table if not exists alignments (
131 name text primary key not null,
132 bottom integer,
133 top integer
134);
135insert into alignments(name, bottom, top) values ('ALIGN_REALLY_VILE', -2147483648, -1000);
136insert into alignments(name, bottom, top) values ('ALIGN_VILE', -999, -900);
137insert into alignments(name, bottom, top) values ('ALIGN_VERY_EVIL', -899, -700);
138insert into alignments(name, bottom, top) values ('ALIGN_EVIL', -699, -350);
139insert into alignments(name, bottom, top) values ('ALIGN_WICKED', -349, -100);
140insert into alignments(name, bottom, top) values ('ALIGN_NEUTRAL', -99, 99);
141insert into alignments(name, bottom, top) values ('ALIGN_NICE', 100, 349);
142insert into alignments(name, bottom, top) values ('ALIGN_GOOD', 350, 699);
143insert into alignments(name, bottom, top) values ('ALIGN_VERY_GOOD', 700, 899);
144insert into alignments(name, bottom, top) values ('ALIGN_HOLY', 900, 999);
145insert into alignments(name, bottom, top) values ('ALIGN_REALLY_HOLY', 1000, 2147483647);
146
147create table if not exists races (
148 id integer primary key not null,
149 name text,
150 playable boolean
151);
152insert into races(id, name, playable) values (0, 'RACE_HALFBREED', 1);
153insert into races(id, name, playable) values (1, 'RACE_HUMAN', 1);
154insert into races(id, name, playable) values (2, 'RACE_ELVEN', 1);
155insert into races(id, name, playable) values (3, 'RACE_DWARF', 1);
156insert into races(id, name, playable) values (4, 'RACE_HALFLING', 1);
157insert into races(id, name, playable) values (5, 'RACE_GNOME', 1);
158insert into races(id, name, playable) values (6, 'RACE_REPTILE', 0);
159insert into races(id, name, playable) values (7, 'RACE_SPECIAL', 0);
160insert into races(id, name, playable) values (8, 'RACE_LYCANTH', 0);
161insert into races(id, name, playable) values (9, 'RACE_DRAGON', 0);
162insert into races(id, name, playable) values (10, 'RACE_UNDEAD', 0);
163insert into races(id, name, playable) values (11, 'RACE_ORC', 0);
164insert into races(id, name, playable) values (12, 'RACE_INSECT', 0);
165insert into races(id, name, playable) values (13, 'RACE_ARACHNID', 0);
166insert into races(id, name, playable) values (14, 'RACE_DINOSAUR', 0);
167insert into races(id, name, playable) values (15, 'RACE_FISH', 0);
168insert into races(id, name, playable) values (16, 'RACE_BIRD', 0);
169insert into races(id, name, playable) values (17, 'RACE_GIANT', 0);
170insert into races(id, name, playable) values (18, 'RACE_PREDATOR', 0);
171insert into races(id, name, playable) values (19, 'RACE_PARASITE', 0);
172insert into races(id, name, playable) values (20, 'RACE_SLIME', 0);
173insert into races(id, name, playable) values (21, 'RACE_DEMON', 0);
174insert into races(id, name, playable) values (22, 'RACE_SNAKE', 0);
175insert into races(id, name, playable) values (23, 'RACE_HERBIV', 0);
176insert into races(id, name, playable) values (24, 'RACE_TREE', 0);
177insert into races(id, name, playable) values (25, 'RACE_VEGGIE', 0);
178insert into races(id, name, playable) values (26, 'RACE_ELEMENT', 0);
179insert into races(id, name, playable) values (27, 'RACE_PLANAR', 0);
180insert into races(id, name, playable) values (28, 'RACE_DEVIL', 0);
181insert into races(id, name, playable) values (29, 'RACE_GHOST', 0);
182insert into races(id, name, playable) values (30, 'RACE_GOBLIN', 0);
183insert into races(id, name, playable) values (31, 'RACE_TROLL', 0);
184insert into races(id, name, playable) values (32, 'RACE_VEGMAN', 0);
185insert into races(id, name, playable) values (33, 'RACE_MFLAYER', 0);
186insert into races(id, name, playable) values (34, 'RACE_PRIMATE', 0);
187insert into races(id, name, playable) values (35, 'RACE_ANIMAL', 0);
188insert into races(id, name, playable) values (36, 'RACE_FAERY', 0);
189insert into races(id, name, playable) values (37, 'RACE_PLANT', 0);
190
191create table if not exists class_bits (
192 id integer primary key not null,
193 name text
194);
195insert into class_bits(id, name) values (1 << 0, 'CLASS_MAGIC_USER');
196insert into class_bits(id, name) values (1 << 1, 'CLASS_CLERIC');
197insert into class_bits(id, name) values (1 << 2, 'CLASS_WARRIOR');
198insert into class_bits(id, name) values (1 << 3, 'CLASS_THIEF');
199insert into class_bits(id, name) values (1 << 4, 'CLASS_RANGER');
200insert into class_bits(id, name) values (1 << 5, 'CLASS_DRUID');
201
202create table if not exists hate_bits (
203 id integer primary key not null,
204 name text
205);
206insert into hate_bits(id, name) values (1 << 0, 'HATE_SEX');
207insert into hate_bits(id, name) values (1 << 1, 'HATE_RACE');
208insert into hate_bits(id, name) values (1 << 2, 'HATE_CHAR');
209insert into hate_bits(id, name) values (1 << 3, 'HATE_CLASS');
210insert into hate_bits(id, name) values (1 << 4, 'HATE_EVIL');
211insert into hate_bits(id, name) values (1 << 5, 'HATE_GOOD');
212insert into hate_bits(id, name) values (1 << 6, 'HATE_VNUM');
213insert into hate_bits(id, name) values (1 << 7, 'HATE_RICH');
214
215create table if not exists fear_bits (
216 id integer primary key not null,
217 name text
218);
219insert into fear_bits(id, name) values (1 << 0, 'FEAR_SEX');
220insert into fear_bits(id, name) values (1 << 1, 'FEAR_RACE');
221insert into fear_bits(id, name) values (1 << 2, 'FEAR_CHAR');
222insert into fear_bits(id, name) values (1 << 3, 'FEAR_CLASS');
223insert into fear_bits(id, name) values (1 << 4, 'FEAR_EVIL');
224insert into fear_bits(id, name) values (1 << 5, 'FEAR_GOOD');
225insert into fear_bits(id, name) values (1 << 6, 'FEAR_VNUM');
226insert into fear_bits(id, name) values (1 << 7, 'FEAR_RICH');
227
228-- Zones
229
230create table if not exists zone_reset_modes (
231 id integer primary key not null,
232 name text
233);
234insert into zone_reset_modes(id, name) values (0, 'Never');
235insert into zone_reset_modes(id, name) values (1, 'When Empty');
236insert into zone_reset_modes(id, name) values (2, 'Always');
237
238-- Mobiles
239
240create table if not exists act_bits (
241 id integer primary key not null,
242 name text
243);
244insert into act_bits(id, name) values (1 << 0, 'ACT_SPEC');
245insert into act_bits(id, name) values (1 << 1, 'ACT_SENTINEL');
246insert into act_bits(id, name) values (1 << 2, 'ACT_SCAVENGER');
247insert into act_bits(id, name) values (1 << 3, 'ACT_ISNPC');
248insert into act_bits(id, name) values (1 << 4, 'ACT_NICE_THIEF');
249insert into act_bits(id, name) values (1 << 5, 'ACT_AGGRESSIVE');
250insert into act_bits(id, name) values (1 << 6, 'ACT_STAY_ZONE');
251insert into act_bits(id, name) values (1 << 7, 'ACT_WIMPY');
252insert into act_bits(id, name) values (1 << 8, 'ACT_ANNOYING');
253insert into act_bits(id, name) values (1 << 9, 'ACT_HATEFUL');
254insert into act_bits(id, name) values (1 << 10, 'ACT_AFRAID');
255insert into act_bits(id, name) values (1 << 11, 'ACT_IMMORTAL');
256insert into act_bits(id, name) values (1 << 12, 'ACT_HUNTING');
257insert into act_bits(id, name) values (1 << 13, 'ACT_DEADLY');
258insert into act_bits(id, name) values (1 << 14, 'ACT_POLYSELF');
259insert into act_bits(id, name) values (1 << 15, 'ACT_POLYOTHER');
260insert into act_bits(id, name) values (1 << 16, 'ACT_GUARDIAN');
261insert into act_bits(id, name) values (1 << 17, 'ACT_USE_ITEM');
262insert into act_bits(id, name) values (1 << 18, 'ACT_FIGHTER_MOVES');
263insert into act_bits(id, name) values (1 << 19, 'ACT_FOOD_PROVIDE');
264insert into act_bits(id, name) values (1 << 20, 'ACT_PROTECTOR');
265insert into act_bits(id, name) values (1 << 21, 'ACT_MOUNT');
266insert into act_bits(id, name) values (1 << 22, 'ACT_SWITCH');
267
268create table if not exists aff_bits (
269 id integer primary key not null,
270 name text
271);
272insert into aff_bits(id, name) values (1 << 0, 'AFF_BLIND');
273insert into aff_bits(id, name) values (1 << 1, 'AFF_INVISIBLE');
274insert into aff_bits(id, name) values (1 << 2, 'AFF_DETECT_EVIL');
275insert into aff_bits(id, name) values (1 << 3, 'AFF_DETECT_INVISIBLE');
276insert into aff_bits(id, name) values (1 << 4, 'AFF_DETECT_MAGIC');
277insert into aff_bits(id, name) values (1 << 5, 'AFF_SENSE_LIFE');
278insert into aff_bits(id, name) values (1 << 6, 'AFF_SILENCED');
279insert into aff_bits(id, name) values (1 << 7, 'AFF_SANCTUARY');
280insert into aff_bits(id, name) values (1 << 8, 'AFF_GROUP');
281--insert into aff_bits(id, name) values (1 << 9, 'AFF_UNDEF_2');
282insert into aff_bits(id, name) values (1 << 10, 'AFF_CURSE');
283insert into aff_bits(id, name) values (1 << 11, 'AFF_FLYING');
284insert into aff_bits(id, name) values (1 << 12, 'AFF_POISON');
285insert into aff_bits(id, name) values (1 << 13, 'AFF_PROTECT_EVIL');
286insert into aff_bits(id, name) values (1 << 14, 'AFF_PARALYSIS');
287insert into aff_bits(id, name) values (1 << 15, 'AFF_INFRAVISION');
288insert into aff_bits(id, name) values (1 << 16, 'AFF_WATERBREATH');
289insert into aff_bits(id, name) values (1 << 17, 'AFF_SLEEP');
290insert into aff_bits(id, name) values (1 << 18, 'AFF_DRUG_FREE');
291insert into aff_bits(id, name) values (1 << 19, 'AFF_SNEAK');
292insert into aff_bits(id, name) values (1 << 20, 'AFF_HIDE');
293insert into aff_bits(id, name) values (1 << 21, 'AFF_FEAR');
294insert into aff_bits(id, name) values (1 << 22, 'AFF_CHARM');
295insert into aff_bits(id, name) values (1 << 23, 'AFF_FOLLOW');
296--insert into aff_bits(id, name) values (1 << 24, 'AFF_UNDEF_1');
297insert into aff_bits(id, name) values (1 << 25, 'AFF_TRUE_SIGHT');
298insert into aff_bits(id, name) values (1 << 26, 'AFF_SCRYING');
299insert into aff_bits(id, name) values (1 << 27, 'AFF_FIRESHIELD');
300insert 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
305create table if not exists positions (
306 id integer primary key not null,
307 name text
308);
309insert into positions(id, name) values (0, 'POSITION_DEAD');
310insert into positions(id, name) values (1, 'POSITION_MORTALLYW');
311insert into positions(id, name) values (2, 'POSITION_INCAP');
312insert into positions(id, name) values (3, 'POSITION_STUNNED');
313insert into positions(id, name) values (4, 'POSITION_SLEEPING');
314insert into positions(id, name) values (5, 'POSITION_RESTING');
315insert into positions(id, name) values (6, 'POSITION_SITTING');
316insert into positions(id, name) values (7, 'POSITION_FIGHTING');
317insert into positions(id, name) values (8, 'POSITION_STANDING');
318insert into positions(id, name) values (9, 'POSITION_MOUNTED');
319
320-- Objects
321
322create table if not exists item_types (
323 id integer primary key not null,
324 name text
325);
326insert into item_types(id, name) values (0, 'NONE');
327insert into item_types(id, name) values (1, 'ITEM_LIGHT');
328insert into item_types(id, name) values (2, 'ITEM_SCROLL');
329insert into item_types(id, name) values (3, 'ITEM_WAND');
330insert into item_types(id, name) values (4, 'ITEM_STAFF');
331insert into item_types(id, name) values (5, 'ITEM_WEAPON');
332insert into item_types(id, name) values (6, 'ITEM_FIREWEAPON');
333insert into item_types(id, name) values (7, 'ITEM_MISSILE');
334insert into item_types(id, name) values (8, 'ITEM_TREASURE');
335insert into item_types(id, name) values (9, 'ITEM_ARMOR');
336insert into item_types(id, name) values (10, 'ITEM_POTION');
337insert into item_types(id, name) values (11, 'ITEM_WORN');
338insert into item_types(id, name) values (12, 'ITEM_OTHER');
339insert into item_types(id, name) values (13, 'ITEM_TRASH');
340insert into item_types(id, name) values (14, 'ITEM_TRAP');
341insert into item_types(id, name) values (15, 'ITEM_CONTAINER');
342insert into item_types(id, name) values (16, 'ITEM_NOTE');
343insert into item_types(id, name) values (17, 'ITEM_DRINKCON');
344insert into item_types(id, name) values (18, 'ITEM_KEY');
345insert into item_types(id, name) values (19, 'ITEM_FOOD');
346insert into item_types(id, name) values (20, 'ITEM_MONEY');
347insert into item_types(id, name) values (21, 'ITEM_PEN');
348insert into item_types(id, name) values (22, 'ITEM_BOAT');
349insert into item_types(id, name) values (23, 'ITEM_AUDIO');
350insert 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.
354create table if not exists skills (
355 id integer primary key not null,
356 name text
357);
358insert into skills(id, name) values (-1, 'TYPE_UNDEFINED');
359
360insert into skills(id, name) values (45, 'SKILL_SNEAK');
361insert into skills(id, name) values (46, 'SKILL_HIDE');
362insert into skills(id, name) values (47, 'SKILL_STEAL');
363insert into skills(id, name) values (48, 'SKILL_BACKSTAB');
364insert into skills(id, name) values (49, 'SKILL_PICK_LOCK');
365insert into skills(id, name) values (50, 'SKILL_KICK');
366insert into skills(id, name) values (51, 'SKILL_BASH');
367insert into skills(id, name) values (52, 'SKILL_RESCUE');
368
369insert into skills(id, name) values (149, 'SKILL_DOOR_BASH');
370insert into skills(id, name) values (150, 'SKILL_READ_MAGIC');
371insert into skills(id, name) values (151, 'SKILL_SCRIBE');
372insert into skills(id, name) values (152, 'SKILL_BREW');
373insert into skills(id, name) values (153, 'SKILL_PUNCH');
374insert into skills(id, name) values (154, 'SKILL_TWO_HANDED');
375insert into skills(id, name) values (155, 'SKILL_TWO_WEAPON');
376insert into skills(id, name) values (156, 'SKILL_BANDAGE');
377insert into skills(id, name) values (157, 'SKILL_SEARCH');
378insert into skills(id, name) values (158, 'SKILL_SWIMMING');
379insert into skills(id, name) values (159, 'SKILL_ENDURANCE');
380insert into skills(id, name) values (160, 'SKILL_BARE_HAND');
381insert into skills(id, name) values (161, 'SKILL_BLIND_FIGHTING');
382insert into skills(id, name) values (162, 'SKILL_PARRY');
383insert into skills(id, name) values (163, 'SKILL_APRAISE');
384insert into skills(id, name) values (164, 'SKILL_SPEC_SMITE');
385insert into skills(id, name) values (165, 'SKILL_SPEC_STAB');
386insert into skills(id, name) values (166, 'SKILL_SPEC_WHIP');
387insert into skills(id, name) values (167, 'SKILL_SPEC_SLASH');
388insert into skills(id, name) values (168, 'SKILL_SPEC_SMASH');
389insert into skills(id, name) values (169, 'SKILL_SPEC_CLEAVE');
390insert into skills(id, name) values (170, 'SKILL_SPEC_CRUSH');
391insert into skills(id, name) values (171, 'SKILL_SPEC_BLUDGE');
392insert into skills(id, name) values (172, 'SKILL_SPEC_PIERCE');
393insert into skills(id, name) values (173, 'SKILL_PEER');
394insert into skills(id, name) values (174, 'SKILL_DETECT_NOISE');
395insert into skills(id, name) values (175, 'SKILL_DODGE');
396insert into skills(id, name) values (176, 'SKILL_BARTER');
397insert into skills(id, name) values (177, 'SKILL_KNOCK_OUT');
398insert into skills(id, name) values (178, 'SKILL_SPELLCRAFT');
399insert into skills(id, name) values (179, 'SKILL_MEDITATION');
400insert into skills(id, name) values (180, 'SKILL_TRACK');
401insert into skills(id, name) values (181, 'SKILL_FIND_TRAP');
402insert into skills(id, name) values (182, 'SKILL_DISARM_TRAP');
403insert into skills(id, name) values (183, 'SKILL_DISARM');
404insert into skills(id, name) values (184, 'SKILL_BASH_W_SHIELD');
405insert 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
416create table if not exists spells (
417 id integer primary key not null,
418 name text
419);
420insert into spells(id, name) values (-1, 'TYPE_UNDEFINED');
421insert into spells(id, name) values (0, 'SPELL_RESERVED_DBC');
422insert into spells(id, name) values (1, 'SPELL_ARMOR');
423insert into spells(id, name) values (2, 'SPELL_TELEPORT');
424insert into spells(id, name) values (3, 'SPELL_BLESS');
425insert into spells(id, name) values (4, 'SPELL_BLINDNESS');
426insert into spells(id, name) values (5, 'SPELL_BURNING_HANDS');
427insert into spells(id, name) values (6, 'SPELL_CALL_LIGHTNING');
428insert into spells(id, name) values (7, 'SPELL_CHARM_PERSON');
429insert into spells(id, name) values (8, 'SPELL_CHILL_TOUCH');
430insert into spells(id, name) values (9, 'SPELL_CLONE');
431insert into spells(id, name) values (10, 'SPELL_COLOUR_SPRAY');
432insert into spells(id, name) values (11, 'SPELL_CONTROL_WEATHER');
433insert into spells(id, name) values (12, 'SPELL_CREATE_FOOD');
434insert into spells(id, name) values (13, 'SPELL_CREATE_WATER');
435insert into spells(id, name) values (14, 'SPELL_CURE_BLIND');
436insert into spells(id, name) values (15, 'SPELL_CURE_CRITIC');
437insert into spells(id, name) values (16, 'SPELL_CURE_LIGHT');
438insert into spells(id, name) values (17, 'SPELL_CURSE');
439insert into spells(id, name) values (18, 'SPELL_DETECT_EVIL');
440insert into spells(id, name) values (19, 'SPELL_DETECT_INVISIBLE');
441insert into spells(id, name) values (20, 'SPELL_DETECT_MAGIC');
442insert into spells(id, name) values (21, 'SPELL_DETECT_POISON');
443insert into spells(id, name) values (22, 'SPELL_DISPEL_EVIL');
444insert into spells(id, name) values (23, 'SPELL_EARTHQUAKE');
445insert into spells(id, name) values (24, 'SPELL_ENCHANT_WEAPON');
446insert into spells(id, name) values (25, 'SPELL_ENERGY_DRAIN');
447insert into spells(id, name) values (26, 'SPELL_FIREBALL');
448insert into spells(id, name) values (27, 'SPELL_HARM');
449insert into spells(id, name) values (28, 'SPELL_HEAL');
450insert into spells(id, name) values (29, 'SPELL_INVISIBLE');
451insert into spells(id, name) values (30, 'SPELL_LIGHTNING_BOLT');
452insert into spells(id, name) values (31, 'SPELL_LOCATE_OBJECT');
453insert into spells(id, name) values (32, 'SPELL_MAGIC_MISSILE');
454insert into spells(id, name) values (33, 'SPELL_POISON');
455insert into spells(id, name) values (34, 'SPELL_PROTECT_FROM_EVIL');
456insert into spells(id, name) values (35, 'SPELL_REMOVE_CURSE');
457insert into spells(id, name) values (36, 'SPELL_SANCTUARY');
458insert into spells(id, name) values (37, 'SPELL_SHOCKING_GRASP');
459insert into spells(id, name) values (38, 'SPELL_SLEEP');
460insert into spells(id, name) values (39, 'SPELL_STRENGTH');
461insert into spells(id, name) values (40, 'SPELL_SUMMON');
462insert into spells(id, name) values (41, 'SPELL_VENTRILOQUATE');
463insert into spells(id, name) values (42, 'SPELL_WORD_OF_RECALL');
464insert into spells(id, name) values (43, 'SPELL_REMOVE_POISON');
465insert into spells(id, name) values (44, 'SPELL_SENCE_LIFE');
466
467insert into spells(id, name) values (53, 'SPELL_IDENTIFY');
468insert into spells(id, name) values (54, 'SPELL_INFRAVISION');
469insert into spells(id, name) values (55, 'SPELL_CAUSE_LIGHT');
470insert into spells(id, name) values (56, 'SPELL_CAUSE_CRITICAL');
471insert into spells(id, name) values (57, 'SPELL_FLAMESTRIKE');
472insert into spells(id, name) values (58, 'SPELL_DISPEL_GOOD');
473insert into spells(id, name) values (59, 'SPELL_WEAKNESS');
474insert into spells(id, name) values (60, 'SPELL_DISPEL_MAGIC');
475insert into spells(id, name) values (61, 'SPELL_KNOCK');
476insert into spells(id, name) values (62, 'SPELL_KNOW_ALIGNMENT');
477insert into spells(id, name) values (63, 'SPELL_ANIMATE_DEAD');
478insert into spells(id, name) values (64, 'SPELL_PARALYSIS');
479insert into spells(id, name) values (65, 'SPELL_REMOVE_PARALYSIS');
480insert into spells(id, name) values (66, 'SPELL_FEAR');
481insert into spells(id, name) values (67, 'SPELL_ACID_BLAST');
482insert into spells(id, name) values (68, 'SPELL_WATER_BREATH');
483insert into spells(id, name) values (69, 'SPELL_FLY');
484insert into spells(id, name) values (70, 'SPELL_CONE_OF_COLD');
485insert into spells(id, name) values (71, 'SPELL_METEOR_SWARM');
486insert into spells(id, name) values (72, 'SPELL_ICE_STORM');
487insert into spells(id, name) values (73, 'SPELL_SHIELD');
488insert into spells(id, name) values (74, 'SPELL_MON_SUM_1');
489insert into spells(id, name) values (75, 'SPELL_MON_SUM_2');
490insert into spells(id, name) values (76, 'SPELL_MON_SUM_3');
491insert into spells(id, name) values (77, 'SPELL_MON_SUM_4');
492insert into spells(id, name) values (78, 'SPELL_MON_SUM_5');
493insert into spells(id, name) values (79, 'SPELL_MON_SUM_6');
494insert into spells(id, name) values (80, 'SPELL_MON_SUM_7');
495insert into spells(id, name) values (81, 'SPELL_FIRESHIELD');
496insert into spells(id, name) values (82, 'SPELL_CHARM_MONSTER');
497insert into spells(id, name) values (83, 'SPELL_CURE_SERIOUS');
498insert into spells(id, name) values (84, 'SPELL_CAUSE_SERIOUS');
499insert into spells(id, name) values (85, 'SPELL_REFRESH');
500insert into spells(id, name) values (86, 'SPELL_SECOND_WIND');
501insert into spells(id, name) values (87, 'SPELL_TURN');
502insert into spells(id, name) values (88, 'SPELL_SUCCOR');
503insert into spells(id, name) values (89, 'SPELL_LIGHT');
504insert into spells(id, name) values (90, 'SPELL_CONT_LIGHT');
505insert into spells(id, name) values (91, 'SPELL_CALM');
506insert into spells(id, name) values (92, 'SPELL_STONE_SKIN');
507insert into spells(id, name) values (93, 'SPELL_CONJURE_ELEMENTAL');
508insert into spells(id, name) values (94, 'SPELL_TRUE_SIGHT');
509insert into spells(id, name) values (95, 'SPELL_MINOR_CREATE');
510insert into spells(id, name) values (96, 'SPELL_FAERIE_FIRE');
511insert into spells(id, name) values (97, 'SPELL_FAERIE_FOG');
512insert into spells(id, name) values (98, 'SPELL_CACAODEMON');
513insert into spells(id, name) values (99, 'SPELL_POLY_SELF');
514insert into spells(id, name) values (100, 'SPELL_MANA');
515insert into spells(id, name) values (101, 'SPELL_ASTRAL_WALK');
516insert into spells(id, name) values (102, 'SPELL_FLY_GROUP');
517insert into spells(id, name) values (103, 'SPELL_AID');
518insert into spells(id, name) values (104, 'SPELL_SHELTER');
519insert into spells(id, name) values (105, 'SPELL_DRAGON_BREATH');
520insert into spells(id, name) values (106, 'SPELL_GOODBERRY');
521insert into spells(id, name) values (107, 'SPELL_VISIONS');
522insert into spells(id, name) values (108, 'SPELL_MAJOR_TRACK');
523insert into spells(id, name) values (109, 'SPELL_GOLEM');
524insert into spells(id, name) values (110, 'SPELL_FAMILIAR');
525insert into spells(id, name) values (111, 'SPELL_CHANGESTAFF');
526insert into spells(id, name) values (112, 'SPELL_HOLY_WORD');
527insert into spells(id, name) values (113, 'SPELL_UNHOLY_WORD');
528insert into spells(id, name) values (114, 'SPELL_PWORD_KILL');
529insert into spells(id, name) values (115, 'SPELL_PWORD_BLIND');
530insert into spells(id, name) values (116, 'SPELL_CHAIN_LIGHTNING');
531insert into spells(id, name) values (117, 'SPELL_SCARE');
532
533insert into spells(id, name) values (119, 'SPELL_COMMAND');
534insert into spells(id, name) values (120, 'SPELL_CHANGE_FORM');
535insert into spells(id, name) values (121, 'SPELL_FEEBLEMIND');
536insert into spells(id, name) values (122, 'SPELL_SHILLELAGH');
537
538insert into spells(id, name) values (124, 'SPELL_FLAME_BLADE');
539insert into spells(id, name) values (125, 'SPELL_ANIMAL_GROWTH');
540insert into spells(id, name) values (126, 'SPELL_INSECT_GROWTH');
541insert into spells(id, name) values (127, 'SPELL_CREEPING_DEATH');
542insert into spells(id, name) values (128, 'SPELL_COMMUNE');
543insert into spells(id, name) values (129, 'SPELL_ANIMAL_SUM_1');
544insert into spells(id, name) values (130, 'SPELL_ANIMAL_SUM_2');
545insert into spells(id, name) values (131, 'SPELL_ANIMAL_SUM_3');
546insert into spells(id, name) values (132, 'SPELL_FIRE_SERVANT');
547insert into spells(id, name) values (133, 'SPELL_EARTH_SERVANT');
548insert into spells(id, name) values (134, 'SPELL_WATER_SERVANT');
549insert into spells(id, name) values (135, 'SPELL_WIND_SERVANT');
550insert into spells(id, name) values (136, 'SPELL_REINCARNATE');
551insert into spells(id, name) values (137, 'SPELL_CHARM_VEGGIE');
552insert into spells(id, name) values (138, 'SPELL_VEGGIE_GROWTH');
553insert into spells(id, name) values (139, 'SPELL_TREE');
554insert into spells(id, name) values (140, 'SPELL_ANIMATE_ROCK');
555insert into spells(id, name) values (141, 'SPELL_TREE_TRAVEL');
556insert into spells(id, name) values (142, 'SPELL_TRAVELLING');
557insert into spells(id, name) values (143, 'SPELL_ANIMAL_FRIENDSHIP');
558insert into spells(id, name) values (144, 'SPELL_INVIS_TO_ANIMALS');
559insert into spells(id, name) values (145, 'SPELL_SLOW_POISON');
560insert into spells(id, name) values (146, 'SPELL_ENTANGLE');
561insert into spells(id, name) values (147, 'SPELL_SNARE');
562insert into spells(id, name) values (148, 'SPELL_GUST_OF_WIND');
563insert into spells(id, name) values (149, 'SPELL_BARKSKIN');
564insert into spells(id, name) values (150, 'SPELL_SUNRAY');
565insert into spells(id, name) values (151, 'SPELL_WARP_WEAPON');
566insert into spells(id, name) values (152, 'SPELL_HEAT_STUFF');
567insert into spells(id, name) values (153, 'SPELL_FIND_TRAPS');
568insert into spells(id, name) values (154, 'SPELL_FIRESTORM');
569insert into spells(id, name) values (155, 'SPELL_HASTE');
570insert into spells(id, name) values (156, 'SPELL_SLOW');
571insert into spells(id, name) values (157, 'SPELL_DUST_DEVIL');
572insert into spells(id, name) values (158, 'SPELL_KNOW_MONSTER');
573insert into spells(id, name) values (159, 'SPELL_TRANSPORT_VIA_PLANT');
574insert into spells(id, name) values (160, 'SPELL_SPEAK_WITH_PLANT');
575insert into spells(id, name) values (161, 'SPELL_SILENCE');
576insert into spells(id, name) values (162, 'SPELL_SENDING');
577insert into spells(id, name) values (163, 'SPELL_TELEPORT_WO_ERROR');
578insert into spells(id, name) values (164, 'SPELL_PORTAL');
579insert into spells(id, name) values (165, 'SPELL_DRAGON_RIDE');
580insert into spells(id, name) values (166, 'SPELL_MOUNT');
581
582insert into spells(id, name) values (199, 'SPELL_GREEN_SLIME');
583insert into spells(id, name) values (200, 'SPELL_GEYSER');
584insert into spells(id, name) values (201, 'SPELL_FIRE_BREATH');
585insert into spells(id, name) values (202, 'SPELL_GAS_BREATH');
586insert into spells(id, name) values (203, 'SPELL_FROST_BREATH');
587insert into spells(id, name) values (204, 'SPELL_ACID_BREATH');
588insert into spells(id, name) values (205, 'SPELL_LIGHTNING_BREATH');
589
590create table if not exists damage_types (
591 id integer primary key not null,
592 name text
593);
594insert into damage_types(id, name) values (-1, 'TYPE_UNDEFINED');
595insert into damage_types(id, name) values (206, 'TYPE_HIT');
596insert into damage_types(id, name) values (207, 'TYPE_BLUDGEON');
597insert into damage_types(id, name) values (208, 'TYPE_PIERCE');
598insert into damage_types(id, name) values (209, 'TYPE_SLASH');
599insert into damage_types(id, name) values (210, 'TYPE_WHIP');
600insert into damage_types(id, name) values (211, 'TYPE_CLAW');
601insert into damage_types(id, name) values (212, 'TYPE_BITE');
602insert into damage_types(id, name) values (213, 'TYPE_STING');
603insert into damage_types(id, name) values (214, 'TYPE_CRUSH');
604insert into damage_types(id, name) values (215, 'TYPE_CLEAVE');
605insert into damage_types(id, name) values (216, 'TYPE_STAB');
606insert into damage_types(id, name) values (217, 'TYPE_SMASH');
607insert into damage_types(id, name) values (218, 'TYPE_SMITE');
608insert into damage_types(id, name) values (220, 'TYPE_SUFFERING');
609insert 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)
613create 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);
622insert 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');
624insert 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');
626insert 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');
628insert 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');
630insert 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');
632insert 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');
634insert 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');
636insert 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');
638insert 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');
640insert 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');
642insert 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');
644insert 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');
646insert 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');
648insert 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');
650insert 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');
652insert 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');
654insert 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');
656insert 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');
658insert 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');
660insert 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');
662insert 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');
664insert 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');
666insert 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');
668insert 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');
670insert 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');
672insert 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');
674insert 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');
676insert 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');
678insert 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');
680insert 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');
682insert 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');
684insert 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');
686insert 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');
688insert 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');
690insert 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');
692insert 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');
694insert 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');
696insert 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');
698insert 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');
700insert 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');
702insert 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');
704insert 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');
706insert 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');
708insert 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');
710insert 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');
712insert 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');
714insert 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
718create 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);
725insert into drinks(id, name, drunkness, fullness, thirst)
726 values (-1, 'ERROR', 0, 0, 0);
727insert into drinks(id, name, drunkness, fullness, thirst)
728 values (0, 'LIQ_WATER', 0, 1, 10);
729insert into drinks(id, name, drunkness, fullness, thirst)
730 values (1, 'LIQ_BEER', 3, 2, 5);
731insert into drinks(id, name, drunkness, fullness, thirst)
732 values (2, 'LIQ_WINE', 5, 2, 5);
733insert into drinks(id, name, drunkness, fullness, thirst)
734 values (3, 'LIQ_ALE', 2, 2, 5);
735insert into drinks(id, name, drunkness, fullness, thirst)
736 values (4, 'LIQ_DARKALE', 1, 2, 5);
737insert into drinks(id, name, drunkness, fullness, thirst)
738 values (5, 'LIQ_WHISKY', 6, 1, 4);
739insert into drinks(id, name, drunkness, fullness, thirst)
740 values (6, 'LIQ_LEMONADE', 0, 1, 8);
741insert into drinks(id, name, drunkness, fullness, thirst)
742 values (7, 'LIQ_FIREBRT', 10, 0, 0);
743insert into drinks(id, name, drunkness, fullness, thirst)
744 values (8, 'LIQ_LOCALSPC', 3, 3, 3);
745insert into drinks(id, name, drunkness, fullness, thirst)
746 values (9, 'LIQ_SLIME', 0, 4, -8);
747insert into drinks(id, name, drunkness, fullness, thirst)
748 values (10, 'LIQ_MILK', 0, 3, 6);
749insert into drinks(id, name, drunkness, fullness, thirst)
750 values (11, 'LIQ_TEA', 0, 1, 6);
751insert into drinks(id, name, drunkness, fullness, thirst)
752 values (12, 'LIQ_COFFE', 0, 1, 6);
753insert into drinks(id, name, drunkness, fullness, thirst)
754 values (13, 'LIQ_BLOOD', 0, 2, -1);
755insert into drinks(id, name, drunkness, fullness, thirst)
756 values (14, 'LIQ_SALTWATER', 0, 1, -2);
757insert into drinks(id, name, drunkness, fullness, thirst)
758 values (15, 'LIQ_COKE', 0, 1, 5);
759
760create table if not exists trap_eff_bits (
761 id integer primary key not null,
762 name text
763);
764insert into trap_eff_bits(id, name) values (1 << 0, 'TRAP_EFF_MOVE');
765insert into trap_eff_bits(id, name) values (1 << 1, 'TRAP_EFF_OBJECT');
766insert into trap_eff_bits(id, name) values (1 << 2, 'TRAP_EFF_ROOM');
767insert into trap_eff_bits(id, name) values (1 << 3, 'TRAP_EFF_NORTH');
768insert into trap_eff_bits(id, name) values (1 << 4, 'TRAP_EFF_EAST');
769insert into trap_eff_bits(id, name) values (1 << 5, 'TRAP_EFF_SOUTH');
770insert into trap_eff_bits(id, name) values (1 << 6, 'TRAP_EFF_WEST');
771insert into trap_eff_bits(id, name) values (1 << 7, 'TRAP_EFF_UP');
772insert 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
775create table if not exists trap_damage_types (
776 id integer primary key not null,
777 name text
778);
779insert into trap_damage_types(id, name) values (-3, 'TRAP_DAM_SLEEP');
780insert into trap_damage_types(id, name) values (-2, 'TRAP_DAM_TELEPORT');
781insert into trap_damage_types(id, name) values (10, 'TRAP_DAM_ENERGY');
782insert into trap_damage_types(id, name) values (26, 'TRAP_DAM_FIRE');
783insert into trap_damage_types(id, name) values (203, 'TRAP_DAM_COLD');
784insert into trap_damage_types(id, name) values (206, 'TRAP_DAM_ACID');
785insert into trap_damage_types(id, name) values (207, 'TRAP_DAM_BLUNT');
786insert into trap_damage_types(id, name) values (208, 'TRAP_DAM_PIERCE');
787insert into trap_damage_types(id, name) values (209, 'TRAP_DAM_SLASH');
788
789create table if not exists container_bits (
790 id integer primary key not null,
791 name text
792);
793insert into container_bits(id, name) values (1 << 0, 'CONT_CLOSEABLE');
794insert into container_bits(id, name) values (1 << 1, 'CONT_PICKPROOF');
795insert into container_bits(id, name) values (1 << 2, 'CONT_CLOSED');
796insert into container_bits(id, name) values (1 << 3, 'CONT_LOCKED');
797
798create table if not exists equip_positions (
799 id integer primary key not null,
800 name text
801);
802insert into equip_positions(id, name) values (0, 'WEAR_LIGHT');
803insert into equip_positions(id, name) values (1, 'WEAR_FINGER_R');
804insert into equip_positions(id, name) values (2, 'WEAR_FINGER_L');
805insert into equip_positions(id, name) values (3, 'WEAR_NECK_1');
806insert into equip_positions(id, name) values (4, 'WEAR_NECK_2');
807insert into equip_positions(id, name) values (5, 'WEAR_BODY');
808insert into equip_positions(id, name) values (6, 'WEAR_HEAD');
809insert into equip_positions(id, name) values (7, 'WEAR_LEGS');
810insert into equip_positions(id, name) values (8, 'WEAR_FEET');
811insert into equip_positions(id, name) values (9, 'WEAR_HANDS');
812insert into equip_positions(id, name) values (10, 'WEAR_ARMS');
813insert into equip_positions(id, name) values (11, 'WEAR_SHIELD');
814insert into equip_positions(id, name) values (12, 'WEAR_ABOUT');
815insert into equip_positions(id, name) values (13, 'WEAR_WAISTE');
816insert into equip_positions(id, name) values (14, 'WEAR_WRIST_R');
817insert into equip_positions(id, name) values (15, 'WEAR_WRIST_L');
818insert into equip_positions(id, name) values (16, 'WIELD');
819insert into equip_positions(id, name) values (17, 'HOLD');
820insert into equip_positions(id, name) values (18, 'WIELD_TWOH');
821
822create table if not exists item_extra_bits (
823 id integer primary key not null,
824 name text
825);
826insert into item_extra_bits(id, name) values (1 << 0, 'ITEM_GLOW');
827insert 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, '');
831insert into item_extra_bits(id, name) values (1 << 5, 'ITEM_INVISIBLE');
832insert into item_extra_bits(id, name) values (1 << 6, 'ITEM_MAGIC');
833insert into item_extra_bits(id, name) values (1 << 7, 'ITEM_NODROP');
834insert into item_extra_bits(id, name) values (1 << 8, 'ITEM_BLESS');
835insert into item_extra_bits(id, name) values (1 << 9, 'ITEM_ANTI_GOOD');
836insert into item_extra_bits(id, name) values (1 << 10, 'ITEM_ANTI_EVIL');
837insert into item_extra_bits(id, name) values (1 << 11, 'ITEM_ANTI_NEUTRAL');
838insert into item_extra_bits(id, name) values (1 << 12, 'ITEM_ANTI_CLERIC');
839insert into item_extra_bits(id, name) values (1 << 13, 'ITEM_ANTI_MAGE');
840insert into item_extra_bits(id, name) values (1 << 14, 'ITEM_ANTI_THIEF');
841insert into item_extra_bits(id, name) values (1 << 15, 'ITEM_ANTI_FIGHTER');
842insert into item_extra_bits(id, name) values (1 << 16, 'ITEM_ANTI_RANGER');
843insert into item_extra_bits(id, name) values (1 << 17, 'ITEM_PARISH');
844
845create table if not exists item_wear_bits (
846 id integer primary key not null,
847 name text
848);
849insert into item_wear_bits(id, name) values (1 << 0, 'ITEM_TAKE');
850insert into item_wear_bits(id, name) values (1 << 1, 'ITEM_WEAR_FINGER');
851insert into item_wear_bits(id, name) values (1 << 2, 'ITEM_WEAR_NECK');
852insert into item_wear_bits(id, name) values (1 << 3, 'ITEM_WEAR_BODY');
853insert into item_wear_bits(id, name) values (1 << 4, 'ITEM_WEAR_HEAD');
854insert into item_wear_bits(id, name) values (1 << 5, 'ITEM_WEAR_LEGS');
855insert into item_wear_bits(id, name) values (1 << 6, 'ITEM_WEAR_FEET');
856insert into item_wear_bits(id, name) values (1 << 7, 'ITEM_WEAR_HANDS');
857insert into item_wear_bits(id, name) values (1 << 8, 'ITEM_WEAR_ARMS');
858insert into item_wear_bits(id, name) values (1 << 9, 'ITEM_WEAR_SHIELD');
859insert into item_wear_bits(id, name) values (1 << 10, 'ITEM_WEAR_ABOUT');
860insert into item_wear_bits(id, name) values (1 << 11, 'ITEM_WEAR_WAISTE');
861insert into item_wear_bits(id, name) values (1 << 12, 'ITEM_WEAR_WRIST');
862insert into item_wear_bits(id, name) values (1 << 13, 'ITEM_WIELD');
863insert into item_wear_bits(id, name) values (1 << 14, 'ITEM_WOLD');
864insert into item_wear_bits(id, name) values (1 << 15, 'ITEM_WIELD_TWOH');
865
866create table if not exists item_applies (
867 id integer primary key not null,
868 name text
869);
870insert into item_applies(id, name) values (0, 'APPLY_NONE');
871insert into item_applies(id, name) values (1, 'APPLY_STR');
872insert into item_applies(id, name) values (2, 'APPLY_DEX');
873insert into item_applies(id, name) values (3, 'APPLY_INT');
874insert into item_applies(id, name) values (4, 'APPLY_WIS');
875insert into item_applies(id, name) values (5, 'APPLY_CON');
876insert into item_applies(id, name) values (6, 'APPLY_SEX');
877insert into item_applies(id, name) values (7, 'APPLY_CLASS');
878insert into item_applies(id, name) values (8, 'APPLY_LEVEL');
879insert into item_applies(id, name) values (9, 'APPLY_AGE');
880insert into item_applies(id, name) values (10, 'APPLY_CHAR_WEIGHT');
881insert into item_applies(id, name) values (11, 'APPLY_CHAR_HEIGHT');
882insert into item_applies(id, name) values (12, 'APPLY_MANA');
883insert into item_applies(id, name) values (13, 'APPLY_HIT');
884insert into item_applies(id, name) values (14, 'APPLY_MOVE');
885insert into item_applies(id, name) values (15, 'APPLY_GOLD');
886insert into item_applies(id, name) values (16, 'APPLY_EXP');
887insert into item_applies(id, name) values (17, 'APPLY_ARMOR');
888insert into item_applies(id, name) values (18, 'APPLY_HITROLL');
889insert into item_applies(id, name) values (19, 'APPLY_DAMROLL');
890insert into item_applies(id, name) values (20, 'APPLY_SAVING_PARA');
891insert into item_applies(id, name) values (21, 'APPLY_SAVING_ROD');
892insert into item_applies(id, name) values (22, 'APPLY_SAVING_PETRI');
893insert into item_applies(id, name) values (23, 'APPLY_SAVING_BREATH');
894insert into item_applies(id, name) values (24, 'APPLY_SAVING_SPELL');
895insert into item_applies(id, name) values (25, 'APPLY_SAVE_ALL');
896insert into item_applies(id, name) values (26, 'APPLY_IMMUNE');
897insert into item_applies(id, name) values (27, 'APPLY_SUSC');
898insert into item_applies(id, name) values (28, 'APPLY_M_IMMUNE');
899insert into item_applies(id, name) values (29, 'APPLY_SPELL_AFFECT');
900insert into item_applies(id, name) values (30, 'APPLY_WEAPON_SPELL');
901insert into item_applies(id, name) values (31, 'APPLY_EAT_SPELL');
902insert into item_applies(id, name) values (32, 'APPLY_BACKSTAB');
903insert into item_applies(id, name) values (33, 'APPLY_KICK');
904insert into item_applies(id, name) values (34, 'APPLY_SNEAK');
905insert into item_applies(id, name) values (35, 'APPLY_HIDE');
906insert into item_applies(id, name) values (36, 'APPLY_BASH');
907insert into item_applies(id, name) values (37, 'APPLY_PICK');
908insert into item_applies(id, name) values (38, 'APPLY_STEAL');
909insert into item_applies(id, name) values (39, 'APPLY_TRACK');
910insert into item_applies(id, name) values (40, 'APPLY_HITNDAM');
911
912-- Rooms
913
914create table if not exists exit_directions (
915 id integer primary key not null,
916 name text
917);
918insert into exit_directions(id, name) values (0, 'NORTH');
919insert into exit_directions(id, name) values (1, 'EAST');
920insert into exit_directions(id, name) values (2, 'SOUTH');
921insert into exit_directions(id, name) values (3, 'WEST');
922insert into exit_directions(id, name) values (4, 'UP');
923insert into exit_directions(id, name) values (5, 'DOWN');
924
925create table if not exists exit_bits (
926 id integer primary key not null,
927 name text
928);
929insert into exit_bits(id, name) values (1 << 0, 'EX_ISDOOR');
930insert into exit_bits(id, name) values (1 << 1, 'EX_CLOSED');
931insert into exit_bits(id, name) values (1 << 2, 'EX_LOCKED');
932insert into exit_bits(id, name) values (1 << 3, 'EX_SECRET');
933insert into exit_bits(id, name) values (1 << 4, 'EX_TRAPPED');
934insert into exit_bits(id, name) values (1 << 5, 'EX_PICKPROOF');
935insert into exit_bits(id, name) values (1 << 6, 'EX_ALIAS');
936
937create table if not exists door_states (
938 id integer primary key not null,
939 name text
940);
941insert into door_states(id, name) values (0, 'OPEN');
942-- Actually clears EX_CLOSED and EX_LOCKED from exit
943insert into door_states(id, name) values (1, 'CLOSED');
944-- Actually clears EX_LOCKED and sets EX_CLOSED on exit
945insert into door_states(id, name) values (2, 'LOCKED');
946-- Actually sets EX_CLOSED and EX_LOCKED on exit
947
948create table if not exists room_bits (
949 id integer primary key not null,
950 name text
951);
952insert into room_bits(id, name) values (1 << 0, 'DARK');
953insert into room_bits(id, name) values (1 << 1, 'DEATH');
954insert into room_bits(id, name) values (1 << 2, 'NO_MOB');
955insert into room_bits(id, name) values (1 << 3, 'INDOORS');
956insert into room_bits(id, name) values (1 << 4, 'PEACEFUL');
957insert into room_bits(id, name) values (1 << 5, 'NO_STEAL');
958insert into room_bits(id, name) values (1 << 6, 'NO_SUM');
959insert into room_bits(id, name) values (1 << 7, 'NO_MAGIC');
960insert into room_bits(id, name) values (1 << 8, 'TUNNEL');
961insert into room_bits(id, name) values (1 << 9, 'PRIVATE');
962insert into room_bits(id, name) values (1 << 10, 'SOUND');
963
964create table if not exists sector_types (
965 id integer primary key not null,
966 name text
967);
968insert into sector_types(id, name) values (-1, 'SECT_TELE');
969insert into sector_types(id, name) values (0, 'SECT_INSIDE');
970insert into sector_types(id, name) values (1, 'SECT_CITY');
971insert into sector_types(id, name) values (2, 'SECT_FIELD');
972insert into sector_types(id, name) values (3, 'SECT_FOREST');
973insert into sector_types(id, name) values (4, 'SECT_HILLS');
974insert into sector_types(id, name) values (5, 'SECT_MOUNTAIN');
975insert into sector_types(id, name) values (6, 'SECT_WATER_SWIM');
976insert into sector_types(id, name) values (7, 'SECT_WATER_NOSWIM');
977insert into sector_types(id, name) values (8, 'SECT_AIR');
978insert into sector_types(id, name) values (9, 'SECT_UNDERWATER');
979
980-- These set various bits in combinations
981create table if not exists exit_types (
982 id integer primary key not null,
983 name text
984);
985insert into exit_types(id, name) values (0, 'Open Passage');
986insert into exit_types(id, name) values (1, 'Normal');
987insert into exit_types(id, name) values (2, 'Pickproof');
988insert into exit_types(id, name) values (3, 'Secret');
989insert into exit_types(id, name) values (4, 'Secret Pickproof');
990insert into exit_types(id, name) values (5, 'Open Passage with Alias');
991insert into exit_types(id, name) values (6, 'Normal with Alias');
992insert into exit_types(id, name) values (7, 'Pickproof with Alias');
993insert into exit_types(id, name) values (8, 'Secret with Alias');
994insert 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.
1000create 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
1013create 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
1026create table if not exists extra_descriptions (
1027 id SERIAL primary key not null,
1028 description text,
1029 keywords text
1030);
1031
1032create 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
1039create 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
1048create 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
1092create 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
1097create 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
1103create 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
1120create 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
1130create 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
1135create 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
1141create 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
1193create 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.
1201create 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
1217create 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
1233create 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);
1237create unique index if not exists ix_zones_resets on zones_resets(zone_id, reset_id);
1238
1239create 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);
1243create unique index if not exists ix_resets_fears on resets_fears(reset_id, fear_id);
1244
1245create 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);
1249create unique index if not exists ix_resets_hates on resets_hates(reset_id, hate_id);