Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Note: Postgres supports INSERT ... RETURNING column-name, now
- -- so you can easily get the actual sequence used for a new row
- -- without needing to trust currval( <table-name>_id_seq );
- --
- -- currval() may be wrong if you have triggers or other
- -- processes advancing the sequence outside of your current
- -- session.
- --
- -- create table test (id serial primary key, name text);
- --
- -- my $result = $db->selectall_arrayref(qq!
- -- INSERT INTO test (name) VALUES (?) RETURNING id;
- -- ;!, { Slice => {} }, $arg );
- -- my $id = $result->[0]{id};
- -- $db->commit;
- -- A utility function to let us easily find matching rows in the many
- -- bit lookup tables of the form id, name, where id is a bit value.
- create or replace function fn_bits_lookup(table_name text, lookup_value integer)
- returns table (id integer, name text) as $$
- declare
- i integer;
- row record;
- begin
- for row in execute format('select * from %s', table_name) loop
- if (lookup_value & row.id) > 0 then
- id := row.id;
- name := row.name;
- return next;
- end if;
- end loop;
- end;
- $$ language PLpgSQL;
- -- select * from fn_bits_lookup('exit_states', 37);
- -- A utility function to split a dice roll text string into a row
- -- containing rolls, die-size, and modifier
- create or replace function fn_dice_parse(dice text)
- returns table (rolls integer, die integer, modifier integer, result integer) as $$
- declare
- parsed text[];
- begin
- parsed := regexp_matches(dice, '^\s*(\d+)d(\d+)([+-]\d+)?\s*$');
- rolls := parsed[1]::integer;
- die := parsed[2]::integer;
- modifier := parsed[3]::integer;
- if (rolls is null and die is null and modifier is null) then
- parsed := regexp_matches(dice, '^\s*([+-]?\d+)\s*$');
- modifier := parsed[1]::integer;
- result := modifier;
- if (modifier is null) then
- return;
- end if;
- else
- if (modifier is null) then
- result := 0;
- else
- result := modifier;
- end if;
- if (rolls > 0 and die > 0) then
- for i in 1..rolls loop
- result := result + floor(random() * die) + 1;
- end loop;
- end if;
- end if;
- return next;
- end;
- $$ language PLpgSQL;
- -- Utils
- create table if not exists weapon_types (
- id integer primary key not null,
- name text,
- description text
- );
- insert into weapon_types(id, name, description) values (-1, 'TYPE_HIT', 'Default');
- insert into weapon_types(id, name, description) values (0, 'TYPE_SMITE', 'Bludgeon (smite)');
- insert into weapon_types(id, name, description) values (1, 'TYPE_STAB', 'Pierce (stab)');
- insert into weapon_types(id, name, description) values (2, 'TYPE_WHIP', 'Slash (whip)');
- insert into weapon_types(id, name, description) values (3, 'TYPE_SLASH', 'Slash (slash)');
- insert into weapon_types(id, name, description) values (4, 'TYPE_SMASH', 'Bludgeon (smash)');
- insert into weapon_types(id, name, description) values (5, 'TYPE_CLEAVE', 'Slash (cleave)');
- insert into weapon_types(id, name, description) values (6, 'TYPE_CRUSH', 'Bludgeon (crush)');
- insert into weapon_types(id, name, description) values (7, 'TYPE_BLUDGEON', 'Bludgeon (pound)');
- insert into weapon_types(id, name, description) values (8, 'TYPE_CLAW', 'Mob (claw)');
- insert into weapon_types(id, name, description) values (9, 'TYPE_BITE', 'Mob (bite)');
- insert into weapon_types(id, name, description) values (10, 'TYPE_STING', 'Mob (sting)');
- insert into weapon_types(id, name, description) values (11, 'TYPE_PIERCE', 'Pierce (pierce)');
- -- Resistance, Immunity, Susceptibility
- create table if not exists ris_bits (
- id integer primary key not null,
- name text
- );
- insert into ris_bits(id, name) values (1 << 0, 'IMM_FIRE');
- insert into ris_bits(id, name) values (1 << 1, 'IMM_COLD');
- insert into ris_bits(id, name) values (1 << 2, 'IMM_ELEC');
- insert into ris_bits(id, name) values (1 << 3, 'IMM_ENERGY');
- insert into ris_bits(id, name) values (1 << 4, 'IMM_BLUNT');
- insert into ris_bits(id, name) values (1 << 5, 'IMM_PIERCE');
- insert into ris_bits(id, name) values (1 << 6, 'IMM_SLASH');
- insert into ris_bits(id, name) values (1 << 7, 'IMM_ACID');
- insert into ris_bits(id, name) values (1 << 8, 'IMM_POISON');
- insert into ris_bits(id, name) values (1 << 9, 'IMM_DRAIN');
- insert into ris_bits(id, name) values (1 << 10, 'IMM_SLEEP');
- insert into ris_bits(id, name) values (1 << 11, 'IMM_CHARM');
- insert into ris_bits(id, name) values (1 << 12, 'IMM_HOLD');
- insert into ris_bits(id, name) values (1 << 13, 'IMM_NONMAG');
- insert into ris_bits(id, name) values (1 << 14, 'IMM_PLUS1');
- insert into ris_bits(id, name) values (1 << 15, 'IMM_PLUS2');
- insert into ris_bits(id, name) values (1 << 16, 'IMM_PLUS3');
- insert into ris_bits(id, name) values (1 << 17, 'IMM_PLUS4');
- create table if not exists sexes (
- id integer primary key not null,
- name text
- );
- insert into sexes(id, name) values (0, 'SEX_NEUTRAL');
- insert into sexes(id, name) values (1, 'SEX_MALE');
- insert into sexes(id, name) values (2, 'SEX_FEMALE');
- -- what IS your alignment? select name from alignments where 1200 between bottom and top;
- -- are you EVIL? select 'ALIGN_EVIL' in (select name from alignments where -350 <= top);
- -- are you GOOD? select 'ALIGN_GOOD' in (select name from alignments where 350 >= bottom);
- -- are you NEUTRAL?
- -- select 'ALIGN_GOOD' not in (select name from alignments where 112 >= bottom)
- -- and 'ALIGN_EVIL' not in (select name from alignments where 112 <= top);
- create table if not exists alignments (
- name text primary key not null,
- bottom integer,
- top integer
- );
- insert into alignments(name, bottom, top) values ('ALIGN_REALLY_VILE', -2147483648, -1000);
- insert into alignments(name, bottom, top) values ('ALIGN_VILE', -999, -900);
- insert into alignments(name, bottom, top) values ('ALIGN_VERY_EVIL', -899, -700);
- insert into alignments(name, bottom, top) values ('ALIGN_EVIL', -699, -350);
- insert into alignments(name, bottom, top) values ('ALIGN_WICKED', -349, -100);
- insert into alignments(name, bottom, top) values ('ALIGN_NEUTRAL', -99, 99);
- insert into alignments(name, bottom, top) values ('ALIGN_NICE', 100, 349);
- insert into alignments(name, bottom, top) values ('ALIGN_GOOD', 350, 699);
- insert into alignments(name, bottom, top) values ('ALIGN_VERY_GOOD', 700, 899);
- insert into alignments(name, bottom, top) values ('ALIGN_HOLY', 900, 999);
- insert into alignments(name, bottom, top) values ('ALIGN_REALLY_HOLY', 1000, 2147483647);
- create table if not exists races (
- id integer primary key not null,
- name text,
- playable boolean
- );
- insert into races(id, name, playable) values (0, 'RACE_HALFBREED', 1);
- insert into races(id, name, playable) values (1, 'RACE_HUMAN', 1);
- insert into races(id, name, playable) values (2, 'RACE_ELVEN', 1);
- insert into races(id, name, playable) values (3, 'RACE_DWARF', 1);
- insert into races(id, name, playable) values (4, 'RACE_HALFLING', 1);
- insert into races(id, name, playable) values (5, 'RACE_GNOME', 1);
- insert into races(id, name, playable) values (6, 'RACE_REPTILE', 0);
- insert into races(id, name, playable) values (7, 'RACE_SPECIAL', 0);
- insert into races(id, name, playable) values (8, 'RACE_LYCANTH', 0);
- insert into races(id, name, playable) values (9, 'RACE_DRAGON', 0);
- insert into races(id, name, playable) values (10, 'RACE_UNDEAD', 0);
- insert into races(id, name, playable) values (11, 'RACE_ORC', 0);
- insert into races(id, name, playable) values (12, 'RACE_INSECT', 0);
- insert into races(id, name, playable) values (13, 'RACE_ARACHNID', 0);
- insert into races(id, name, playable) values (14, 'RACE_DINOSAUR', 0);
- insert into races(id, name, playable) values (15, 'RACE_FISH', 0);
- insert into races(id, name, playable) values (16, 'RACE_BIRD', 0);
- insert into races(id, name, playable) values (17, 'RACE_GIANT', 0);
- insert into races(id, name, playable) values (18, 'RACE_PREDATOR', 0);
- insert into races(id, name, playable) values (19, 'RACE_PARASITE', 0);
- insert into races(id, name, playable) values (20, 'RACE_SLIME', 0);
- insert into races(id, name, playable) values (21, 'RACE_DEMON', 0);
- insert into races(id, name, playable) values (22, 'RACE_SNAKE', 0);
- insert into races(id, name, playable) values (23, 'RACE_HERBIV', 0);
- insert into races(id, name, playable) values (24, 'RACE_TREE', 0);
- insert into races(id, name, playable) values (25, 'RACE_VEGGIE', 0);
- insert into races(id, name, playable) values (26, 'RACE_ELEMENT', 0);
- insert into races(id, name, playable) values (27, 'RACE_PLANAR', 0);
- insert into races(id, name, playable) values (28, 'RACE_DEVIL', 0);
- insert into races(id, name, playable) values (29, 'RACE_GHOST', 0);
- insert into races(id, name, playable) values (30, 'RACE_GOBLIN', 0);
- insert into races(id, name, playable) values (31, 'RACE_TROLL', 0);
- insert into races(id, name, playable) values (32, 'RACE_VEGMAN', 0);
- insert into races(id, name, playable) values (33, 'RACE_MFLAYER', 0);
- insert into races(id, name, playable) values (34, 'RACE_PRIMATE', 0);
- insert into races(id, name, playable) values (35, 'RACE_ANIMAL', 0);
- insert into races(id, name, playable) values (36, 'RACE_FAERY', 0);
- insert into races(id, name, playable) values (37, 'RACE_PLANT', 0);
- create table if not exists class_bits (
- id integer primary key not null,
- name text
- );
- insert into class_bits(id, name) values (1 << 0, 'CLASS_MAGIC_USER');
- insert into class_bits(id, name) values (1 << 1, 'CLASS_CLERIC');
- insert into class_bits(id, name) values (1 << 2, 'CLASS_WARRIOR');
- insert into class_bits(id, name) values (1 << 3, 'CLASS_THIEF');
- insert into class_bits(id, name) values (1 << 4, 'CLASS_RANGER');
- insert into class_bits(id, name) values (1 << 5, 'CLASS_DRUID');
- create table if not exists hate_bits (
- id integer primary key not null,
- name text
- );
- insert into hate_bits(id, name) values (1 << 0, 'HATE_SEX');
- insert into hate_bits(id, name) values (1 << 1, 'HATE_RACE');
- insert into hate_bits(id, name) values (1 << 2, 'HATE_CHAR');
- insert into hate_bits(id, name) values (1 << 3, 'HATE_CLASS');
- insert into hate_bits(id, name) values (1 << 4, 'HATE_EVIL');
- insert into hate_bits(id, name) values (1 << 5, 'HATE_GOOD');
- insert into hate_bits(id, name) values (1 << 6, 'HATE_VNUM');
- insert into hate_bits(id, name) values (1 << 7, 'HATE_RICH');
- create table if not exists fear_bits (
- id integer primary key not null,
- name text
- );
- insert into fear_bits(id, name) values (1 << 0, 'FEAR_SEX');
- insert into fear_bits(id, name) values (1 << 1, 'FEAR_RACE');
- insert into fear_bits(id, name) values (1 << 2, 'FEAR_CHAR');
- insert into fear_bits(id, name) values (1 << 3, 'FEAR_CLASS');
- insert into fear_bits(id, name) values (1 << 4, 'FEAR_EVIL');
- insert into fear_bits(id, name) values (1 << 5, 'FEAR_GOOD');
- insert into fear_bits(id, name) values (1 << 6, 'FEAR_VNUM');
- insert into fear_bits(id, name) values (1 << 7, 'FEAR_RICH');
- -- Zones
- create table if not exists zone_reset_modes (
- id integer primary key not null,
- name text
- );
- insert into zone_reset_modes(id, name) values (0, 'Never');
- insert into zone_reset_modes(id, name) values (1, 'When Empty');
- insert into zone_reset_modes(id, name) values (2, 'Always');
- -- Mobiles
- create table if not exists act_bits (
- id integer primary key not null,
- name text
- );
- insert into act_bits(id, name) values (1 << 0, 'ACT_SPEC');
- insert into act_bits(id, name) values (1 << 1, 'ACT_SENTINEL');
- insert into act_bits(id, name) values (1 << 2, 'ACT_SCAVENGER');
- insert into act_bits(id, name) values (1 << 3, 'ACT_ISNPC');
- insert into act_bits(id, name) values (1 << 4, 'ACT_NICE_THIEF');
- insert into act_bits(id, name) values (1 << 5, 'ACT_AGGRESSIVE');
- insert into act_bits(id, name) values (1 << 6, 'ACT_STAY_ZONE');
- insert into act_bits(id, name) values (1 << 7, 'ACT_WIMPY');
- insert into act_bits(id, name) values (1 << 8, 'ACT_ANNOYING');
- insert into act_bits(id, name) values (1 << 9, 'ACT_HATEFUL');
- insert into act_bits(id, name) values (1 << 10, 'ACT_AFRAID');
- insert into act_bits(id, name) values (1 << 11, 'ACT_IMMORTAL');
- insert into act_bits(id, name) values (1 << 12, 'ACT_HUNTING');
- insert into act_bits(id, name) values (1 << 13, 'ACT_DEADLY');
- insert into act_bits(id, name) values (1 << 14, 'ACT_POLYSELF');
- insert into act_bits(id, name) values (1 << 15, 'ACT_POLYOTHER');
- insert into act_bits(id, name) values (1 << 16, 'ACT_GUARDIAN');
- insert into act_bits(id, name) values (1 << 17, 'ACT_USE_ITEM');
- insert into act_bits(id, name) values (1 << 18, 'ACT_FIGHTER_MOVES');
- insert into act_bits(id, name) values (1 << 19, 'ACT_FOOD_PROVIDE');
- insert into act_bits(id, name) values (1 << 20, 'ACT_PROTECTOR');
- insert into act_bits(id, name) values (1 << 21, 'ACT_MOUNT');
- insert into act_bits(id, name) values (1 << 22, 'ACT_SWITCH');
- create table if not exists aff_bits (
- id integer primary key not null,
- name text
- );
- insert into aff_bits(id, name) values (1 << 0, 'AFF_BLIND');
- insert into aff_bits(id, name) values (1 << 1, 'AFF_INVISIBLE');
- insert into aff_bits(id, name) values (1 << 2, 'AFF_DETECT_EVIL');
- insert into aff_bits(id, name) values (1 << 3, 'AFF_DETECT_INVISIBLE');
- insert into aff_bits(id, name) values (1 << 4, 'AFF_DETECT_MAGIC');
- insert into aff_bits(id, name) values (1 << 5, 'AFF_SENSE_LIFE');
- insert into aff_bits(id, name) values (1 << 6, 'AFF_SILENCED');
- insert into aff_bits(id, name) values (1 << 7, 'AFF_SANCTUARY');
- insert into aff_bits(id, name) values (1 << 8, 'AFF_GROUP');
- --insert into aff_bits(id, name) values (1 << 9, 'AFF_UNDEF_2');
- insert into aff_bits(id, name) values (1 << 10, 'AFF_CURSE');
- insert into aff_bits(id, name) values (1 << 11, 'AFF_FLYING');
- insert into aff_bits(id, name) values (1 << 12, 'AFF_POISON');
- insert into aff_bits(id, name) values (1 << 13, 'AFF_PROTECT_EVIL');
- insert into aff_bits(id, name) values (1 << 14, 'AFF_PARALYSIS');
- insert into aff_bits(id, name) values (1 << 15, 'AFF_INFRAVISION');
- insert into aff_bits(id, name) values (1 << 16, 'AFF_WATERBREATH');
- insert into aff_bits(id, name) values (1 << 17, 'AFF_SLEEP');
- insert into aff_bits(id, name) values (1 << 18, 'AFF_DRUG_FREE');
- insert into aff_bits(id, name) values (1 << 19, 'AFF_SNEAK');
- insert into aff_bits(id, name) values (1 << 20, 'AFF_HIDE');
- insert into aff_bits(id, name) values (1 << 21, 'AFF_FEAR');
- insert into aff_bits(id, name) values (1 << 22, 'AFF_CHARM');
- insert into aff_bits(id, name) values (1 << 23, 'AFF_FOLLOW');
- --insert into aff_bits(id, name) values (1 << 24, 'AFF_UNDEF_1');
- insert into aff_bits(id, name) values (1 << 25, 'AFF_TRUE_SIGHT');
- insert into aff_bits(id, name) values (1 << 26, 'AFF_SCRYING');
- insert into aff_bits(id, name) values (1 << 27, 'AFF_FIRESHIELD');
- insert into aff_bits(id, name) values (1 << 28, 'AFF_RIDE');
- --insert into aff_bits(id, name) values (1 << 29, 'AFF_UNDEF_6');
- --insert into aff_bits(id, name) values (1 << 30, 'AFF_UNDEF_7');
- --insert into aff_bits(id, name) values (1 << 31, 'AFF_UNDEF_8');
- create table if not exists positions (
- id integer primary key not null,
- name text
- );
- insert into positions(id, name) values (0, 'POSITION_DEAD');
- insert into positions(id, name) values (1, 'POSITION_MORTALLYW');
- insert into positions(id, name) values (2, 'POSITION_INCAP');
- insert into positions(id, name) values (3, 'POSITION_STUNNED');
- insert into positions(id, name) values (4, 'POSITION_SLEEPING');
- insert into positions(id, name) values (5, 'POSITION_RESTING');
- insert into positions(id, name) values (6, 'POSITION_SITTING');
- insert into positions(id, name) values (7, 'POSITION_FIGHTING');
- insert into positions(id, name) values (8, 'POSITION_STANDING');
- insert into positions(id, name) values (9, 'POSITION_MOUNTED');
- -- Objects
- create table if not exists item_types (
- id integer primary key not null,
- name text
- );
- insert into item_types(id, name) values (0, 'NONE');
- insert into item_types(id, name) values (1, 'ITEM_LIGHT');
- insert into item_types(id, name) values (2, 'ITEM_SCROLL');
- insert into item_types(id, name) values (3, 'ITEM_WAND');
- insert into item_types(id, name) values (4, 'ITEM_STAFF');
- insert into item_types(id, name) values (5, 'ITEM_WEAPON');
- insert into item_types(id, name) values (6, 'ITEM_FIREWEAPON');
- insert into item_types(id, name) values (7, 'ITEM_MISSILE');
- insert into item_types(id, name) values (8, 'ITEM_TREASURE');
- insert into item_types(id, name) values (9, 'ITEM_ARMOR');
- insert into item_types(id, name) values (10, 'ITEM_POTION');
- insert into item_types(id, name) values (11, 'ITEM_WORN');
- insert into item_types(id, name) values (12, 'ITEM_OTHER');
- insert into item_types(id, name) values (13, 'ITEM_TRASH');
- insert into item_types(id, name) values (14, 'ITEM_TRAP');
- insert into item_types(id, name) values (15, 'ITEM_CONTAINER');
- insert into item_types(id, name) values (16, 'ITEM_NOTE');
- insert into item_types(id, name) values (17, 'ITEM_DRINKCON');
- insert into item_types(id, name) values (18, 'ITEM_KEY');
- insert into item_types(id, name) values (19, 'ITEM_FOOD');
- insert into item_types(id, name) values (20, 'ITEM_MONEY');
- insert into item_types(id, name) values (21, 'ITEM_PEN');
- insert into item_types(id, name) values (22, 'ITEM_BOAT');
- insert into item_types(id, name) values (23, 'ITEM_AUDIO');
- insert into item_types(id, name) values (24, 'ITEM_BOARD');
- -- This SHOULD be a single table, but apparently there is overlap, so we need
- -- to have separate tables for skills, spells, and damage_types... for now.
- create table if not exists skills (
- id integer primary key not null,
- name text
- );
- insert into skills(id, name) values (-1, 'TYPE_UNDEFINED');
- insert into skills(id, name) values (45, 'SKILL_SNEAK');
- insert into skills(id, name) values (46, 'SKILL_HIDE');
- insert into skills(id, name) values (47, 'SKILL_STEAL');
- insert into skills(id, name) values (48, 'SKILL_BACKSTAB');
- insert into skills(id, name) values (49, 'SKILL_PICK_LOCK');
- insert into skills(id, name) values (50, 'SKILL_KICK');
- insert into skills(id, name) values (51, 'SKILL_BASH');
- insert into skills(id, name) values (52, 'SKILL_RESCUE');
- insert into skills(id, name) values (149, 'SKILL_DOOR_BASH');
- insert into skills(id, name) values (150, 'SKILL_READ_MAGIC');
- insert into skills(id, name) values (151, 'SKILL_SCRIBE');
- insert into skills(id, name) values (152, 'SKILL_BREW');
- insert into skills(id, name) values (153, 'SKILL_PUNCH');
- insert into skills(id, name) values (154, 'SKILL_TWO_HANDED');
- insert into skills(id, name) values (155, 'SKILL_TWO_WEAPON');
- insert into skills(id, name) values (156, 'SKILL_BANDAGE');
- insert into skills(id, name) values (157, 'SKILL_SEARCH');
- insert into skills(id, name) values (158, 'SKILL_SWIMMING');
- insert into skills(id, name) values (159, 'SKILL_ENDURANCE');
- insert into skills(id, name) values (160, 'SKILL_BARE_HAND');
- insert into skills(id, name) values (161, 'SKILL_BLIND_FIGHTING');
- insert into skills(id, name) values (162, 'SKILL_PARRY');
- insert into skills(id, name) values (163, 'SKILL_APRAISE');
- insert into skills(id, name) values (164, 'SKILL_SPEC_SMITE');
- insert into skills(id, name) values (165, 'SKILL_SPEC_STAB');
- insert into skills(id, name) values (166, 'SKILL_SPEC_WHIP');
- insert into skills(id, name) values (167, 'SKILL_SPEC_SLASH');
- insert into skills(id, name) values (168, 'SKILL_SPEC_SMASH');
- insert into skills(id, name) values (169, 'SKILL_SPEC_CLEAVE');
- insert into skills(id, name) values (170, 'SKILL_SPEC_CRUSH');
- insert into skills(id, name) values (171, 'SKILL_SPEC_BLUDGE');
- insert into skills(id, name) values (172, 'SKILL_SPEC_PIERCE');
- insert into skills(id, name) values (173, 'SKILL_PEER');
- insert into skills(id, name) values (174, 'SKILL_DETECT_NOISE');
- insert into skills(id, name) values (175, 'SKILL_DODGE');
- insert into skills(id, name) values (176, 'SKILL_BARTER');
- insert into skills(id, name) values (177, 'SKILL_KNOCK_OUT');
- insert into skills(id, name) values (178, 'SKILL_SPELLCRAFT');
- insert into skills(id, name) values (179, 'SKILL_MEDITATION');
- insert into skills(id, name) values (180, 'SKILL_TRACK');
- insert into skills(id, name) values (181, 'SKILL_FIND_TRAP');
- insert into skills(id, name) values (182, 'SKILL_DISARM_TRAP');
- insert into skills(id, name) values (183, 'SKILL_DISARM');
- insert into skills(id, name) values (184, 'SKILL_BASH_W_SHIELD');
- insert into skills(id, name) values (185, 'SKILL_RIDE');
- -- conflicting ones here?
- -- insert into skills(id, name) values (171, 'SKILL_SIGN');
- -- insert into skills(id, name) values (174, 'SKILL_DODGE');
- -- insert into skills(id, name) values (176, 'SKILL_RETREAT');
- -- insert into skills(id, name) values (179, 'SKILL_FEIGN_DEATH');
- -- insert into skills(id, name) values (182, 'SKILL_SPRING_LEAP');
- -- insert into skills(id, name) values (185, 'SKILL_EVALUATE');
- -- insert into skills(id, name) values (186, 'SKILL_SPY');
- -- insert into skills(id, name) values (188, 'SKILL_SWIM');
- create table if not exists spells (
- id integer primary key not null,
- name text
- );
- insert into spells(id, name) values (-1, 'TYPE_UNDEFINED');
- insert into spells(id, name) values (0, 'SPELL_RESERVED_DBC');
- insert into spells(id, name) values (1, 'SPELL_ARMOR');
- insert into spells(id, name) values (2, 'SPELL_TELEPORT');
- insert into spells(id, name) values (3, 'SPELL_BLESS');
- insert into spells(id, name) values (4, 'SPELL_BLINDNESS');
- insert into spells(id, name) values (5, 'SPELL_BURNING_HANDS');
- insert into spells(id, name) values (6, 'SPELL_CALL_LIGHTNING');
- insert into spells(id, name) values (7, 'SPELL_CHARM_PERSON');
- insert into spells(id, name) values (8, 'SPELL_CHILL_TOUCH');
- insert into spells(id, name) values (9, 'SPELL_CLONE');
- insert into spells(id, name) values (10, 'SPELL_COLOUR_SPRAY');
- insert into spells(id, name) values (11, 'SPELL_CONTROL_WEATHER');
- insert into spells(id, name) values (12, 'SPELL_CREATE_FOOD');
- insert into spells(id, name) values (13, 'SPELL_CREATE_WATER');
- insert into spells(id, name) values (14, 'SPELL_CURE_BLIND');
- insert into spells(id, name) values (15, 'SPELL_CURE_CRITIC');
- insert into spells(id, name) values (16, 'SPELL_CURE_LIGHT');
- insert into spells(id, name) values (17, 'SPELL_CURSE');
- insert into spells(id, name) values (18, 'SPELL_DETECT_EVIL');
- insert into spells(id, name) values (19, 'SPELL_DETECT_INVISIBLE');
- insert into spells(id, name) values (20, 'SPELL_DETECT_MAGIC');
- insert into spells(id, name) values (21, 'SPELL_DETECT_POISON');
- insert into spells(id, name) values (22, 'SPELL_DISPEL_EVIL');
- insert into spells(id, name) values (23, 'SPELL_EARTHQUAKE');
- insert into spells(id, name) values (24, 'SPELL_ENCHANT_WEAPON');
- insert into spells(id, name) values (25, 'SPELL_ENERGY_DRAIN');
- insert into spells(id, name) values (26, 'SPELL_FIREBALL');
- insert into spells(id, name) values (27, 'SPELL_HARM');
- insert into spells(id, name) values (28, 'SPELL_HEAL');
- insert into spells(id, name) values (29, 'SPELL_INVISIBLE');
- insert into spells(id, name) values (30, 'SPELL_LIGHTNING_BOLT');
- insert into spells(id, name) values (31, 'SPELL_LOCATE_OBJECT');
- insert into spells(id, name) values (32, 'SPELL_MAGIC_MISSILE');
- insert into spells(id, name) values (33, 'SPELL_POISON');
- insert into spells(id, name) values (34, 'SPELL_PROTECT_FROM_EVIL');
- insert into spells(id, name) values (35, 'SPELL_REMOVE_CURSE');
- insert into spells(id, name) values (36, 'SPELL_SANCTUARY');
- insert into spells(id, name) values (37, 'SPELL_SHOCKING_GRASP');
- insert into spells(id, name) values (38, 'SPELL_SLEEP');
- insert into spells(id, name) values (39, 'SPELL_STRENGTH');
- insert into spells(id, name) values (40, 'SPELL_SUMMON');
- insert into spells(id, name) values (41, 'SPELL_VENTRILOQUATE');
- insert into spells(id, name) values (42, 'SPELL_WORD_OF_RECALL');
- insert into spells(id, name) values (43, 'SPELL_REMOVE_POISON');
- insert into spells(id, name) values (44, 'SPELL_SENCE_LIFE');
- insert into spells(id, name) values (53, 'SPELL_IDENTIFY');
- insert into spells(id, name) values (54, 'SPELL_INFRAVISION');
- insert into spells(id, name) values (55, 'SPELL_CAUSE_LIGHT');
- insert into spells(id, name) values (56, 'SPELL_CAUSE_CRITICAL');
- insert into spells(id, name) values (57, 'SPELL_FLAMESTRIKE');
- insert into spells(id, name) values (58, 'SPELL_DISPEL_GOOD');
- insert into spells(id, name) values (59, 'SPELL_WEAKNESS');
- insert into spells(id, name) values (60, 'SPELL_DISPEL_MAGIC');
- insert into spells(id, name) values (61, 'SPELL_KNOCK');
- insert into spells(id, name) values (62, 'SPELL_KNOW_ALIGNMENT');
- insert into spells(id, name) values (63, 'SPELL_ANIMATE_DEAD');
- insert into spells(id, name) values (64, 'SPELL_PARALYSIS');
- insert into spells(id, name) values (65, 'SPELL_REMOVE_PARALYSIS');
- insert into spells(id, name) values (66, 'SPELL_FEAR');
- insert into spells(id, name) values (67, 'SPELL_ACID_BLAST');
- insert into spells(id, name) values (68, 'SPELL_WATER_BREATH');
- insert into spells(id, name) values (69, 'SPELL_FLY');
- insert into spells(id, name) values (70, 'SPELL_CONE_OF_COLD');
- insert into spells(id, name) values (71, 'SPELL_METEOR_SWARM');
- insert into spells(id, name) values (72, 'SPELL_ICE_STORM');
- insert into spells(id, name) values (73, 'SPELL_SHIELD');
- insert into spells(id, name) values (74, 'SPELL_MON_SUM_1');
- insert into spells(id, name) values (75, 'SPELL_MON_SUM_2');
- insert into spells(id, name) values (76, 'SPELL_MON_SUM_3');
- insert into spells(id, name) values (77, 'SPELL_MON_SUM_4');
- insert into spells(id, name) values (78, 'SPELL_MON_SUM_5');
- insert into spells(id, name) values (79, 'SPELL_MON_SUM_6');
- insert into spells(id, name) values (80, 'SPELL_MON_SUM_7');
- insert into spells(id, name) values (81, 'SPELL_FIRESHIELD');
- insert into spells(id, name) values (82, 'SPELL_CHARM_MONSTER');
- insert into spells(id, name) values (83, 'SPELL_CURE_SERIOUS');
- insert into spells(id, name) values (84, 'SPELL_CAUSE_SERIOUS');
- insert into spells(id, name) values (85, 'SPELL_REFRESH');
- insert into spells(id, name) values (86, 'SPELL_SECOND_WIND');
- insert into spells(id, name) values (87, 'SPELL_TURN');
- insert into spells(id, name) values (88, 'SPELL_SUCCOR');
- insert into spells(id, name) values (89, 'SPELL_LIGHT');
- insert into spells(id, name) values (90, 'SPELL_CONT_LIGHT');
- insert into spells(id, name) values (91, 'SPELL_CALM');
- insert into spells(id, name) values (92, 'SPELL_STONE_SKIN');
- insert into spells(id, name) values (93, 'SPELL_CONJURE_ELEMENTAL');
- insert into spells(id, name) values (94, 'SPELL_TRUE_SIGHT');
- insert into spells(id, name) values (95, 'SPELL_MINOR_CREATE');
- insert into spells(id, name) values (96, 'SPELL_FAERIE_FIRE');
- insert into spells(id, name) values (97, 'SPELL_FAERIE_FOG');
- insert into spells(id, name) values (98, 'SPELL_CACAODEMON');
- insert into spells(id, name) values (99, 'SPELL_POLY_SELF');
- insert into spells(id, name) values (100, 'SPELL_MANA');
- insert into spells(id, name) values (101, 'SPELL_ASTRAL_WALK');
- insert into spells(id, name) values (102, 'SPELL_FLY_GROUP');
- insert into spells(id, name) values (103, 'SPELL_AID');
- insert into spells(id, name) values (104, 'SPELL_SHELTER');
- insert into spells(id, name) values (105, 'SPELL_DRAGON_BREATH');
- insert into spells(id, name) values (106, 'SPELL_GOODBERRY');
- insert into spells(id, name) values (107, 'SPELL_VISIONS');
- insert into spells(id, name) values (108, 'SPELL_MAJOR_TRACK');
- insert into spells(id, name) values (109, 'SPELL_GOLEM');
- insert into spells(id, name) values (110, 'SPELL_FAMILIAR');
- insert into spells(id, name) values (111, 'SPELL_CHANGESTAFF');
- insert into spells(id, name) values (112, 'SPELL_HOLY_WORD');
- insert into spells(id, name) values (113, 'SPELL_UNHOLY_WORD');
- insert into spells(id, name) values (114, 'SPELL_PWORD_KILL');
- insert into spells(id, name) values (115, 'SPELL_PWORD_BLIND');
- insert into spells(id, name) values (116, 'SPELL_CHAIN_LIGHTNING');
- insert into spells(id, name) values (117, 'SPELL_SCARE');
- insert into spells(id, name) values (119, 'SPELL_COMMAND');
- insert into spells(id, name) values (120, 'SPELL_CHANGE_FORM');
- insert into spells(id, name) values (121, 'SPELL_FEEBLEMIND');
- insert into spells(id, name) values (122, 'SPELL_SHILLELAGH');
- insert into spells(id, name) values (124, 'SPELL_FLAME_BLADE');
- insert into spells(id, name) values (125, 'SPELL_ANIMAL_GROWTH');
- insert into spells(id, name) values (126, 'SPELL_INSECT_GROWTH');
- insert into spells(id, name) values (127, 'SPELL_CREEPING_DEATH');
- insert into spells(id, name) values (128, 'SPELL_COMMUNE');
- insert into spells(id, name) values (129, 'SPELL_ANIMAL_SUM_1');
- insert into spells(id, name) values (130, 'SPELL_ANIMAL_SUM_2');
- insert into spells(id, name) values (131, 'SPELL_ANIMAL_SUM_3');
- insert into spells(id, name) values (132, 'SPELL_FIRE_SERVANT');
- insert into spells(id, name) values (133, 'SPELL_EARTH_SERVANT');
- insert into spells(id, name) values (134, 'SPELL_WATER_SERVANT');
- insert into spells(id, name) values (135, 'SPELL_WIND_SERVANT');
- insert into spells(id, name) values (136, 'SPELL_REINCARNATE');
- insert into spells(id, name) values (137, 'SPELL_CHARM_VEGGIE');
- insert into spells(id, name) values (138, 'SPELL_VEGGIE_GROWTH');
- insert into spells(id, name) values (139, 'SPELL_TREE');
- insert into spells(id, name) values (140, 'SPELL_ANIMATE_ROCK');
- insert into spells(id, name) values (141, 'SPELL_TREE_TRAVEL');
- insert into spells(id, name) values (142, 'SPELL_TRAVELLING');
- insert into spells(id, name) values (143, 'SPELL_ANIMAL_FRIENDSHIP');
- insert into spells(id, name) values (144, 'SPELL_INVIS_TO_ANIMALS');
- insert into spells(id, name) values (145, 'SPELL_SLOW_POISON');
- insert into spells(id, name) values (146, 'SPELL_ENTANGLE');
- insert into spells(id, name) values (147, 'SPELL_SNARE');
- insert into spells(id, name) values (148, 'SPELL_GUST_OF_WIND');
- insert into spells(id, name) values (149, 'SPELL_BARKSKIN');
- insert into spells(id, name) values (150, 'SPELL_SUNRAY');
- insert into spells(id, name) values (151, 'SPELL_WARP_WEAPON');
- insert into spells(id, name) values (152, 'SPELL_HEAT_STUFF');
- insert into spells(id, name) values (153, 'SPELL_FIND_TRAPS');
- insert into spells(id, name) values (154, 'SPELL_FIRESTORM');
- insert into spells(id, name) values (155, 'SPELL_HASTE');
- insert into spells(id, name) values (156, 'SPELL_SLOW');
- insert into spells(id, name) values (157, 'SPELL_DUST_DEVIL');
- insert into spells(id, name) values (158, 'SPELL_KNOW_MONSTER');
- insert into spells(id, name) values (159, 'SPELL_TRANSPORT_VIA_PLANT');
- insert into spells(id, name) values (160, 'SPELL_SPEAK_WITH_PLANT');
- insert into spells(id, name) values (161, 'SPELL_SILENCE');
- insert into spells(id, name) values (162, 'SPELL_SENDING');
- insert into spells(id, name) values (163, 'SPELL_TELEPORT_WO_ERROR');
- insert into spells(id, name) values (164, 'SPELL_PORTAL');
- insert into spells(id, name) values (165, 'SPELL_DRAGON_RIDE');
- insert into spells(id, name) values (166, 'SPELL_MOUNT');
- insert into spells(id, name) values (199, 'SPELL_GREEN_SLIME');
- insert into spells(id, name) values (200, 'SPELL_GEYSER');
- insert into spells(id, name) values (201, 'SPELL_FIRE_BREATH');
- insert into spells(id, name) values (202, 'SPELL_GAS_BREATH');
- insert into spells(id, name) values (203, 'SPELL_FROST_BREATH');
- insert into spells(id, name) values (204, 'SPELL_ACID_BREATH');
- insert into spells(id, name) values (205, 'SPELL_LIGHTNING_BREATH');
- create table if not exists damage_types (
- id integer primary key not null,
- name text
- );
- insert into damage_types(id, name) values (-1, 'TYPE_UNDEFINED');
- insert into damage_types(id, name) values (206, 'TYPE_HIT');
- insert into damage_types(id, name) values (207, 'TYPE_BLUDGEON');
- insert into damage_types(id, name) values (208, 'TYPE_PIERCE');
- insert into damage_types(id, name) values (209, 'TYPE_SLASH');
- insert into damage_types(id, name) values (210, 'TYPE_WHIP');
- insert into damage_types(id, name) values (211, 'TYPE_CLAW');
- insert into damage_types(id, name) values (212, 'TYPE_BITE');
- insert into damage_types(id, name) values (213, 'TYPE_STING');
- insert into damage_types(id, name) values (214, 'TYPE_CRUSH');
- insert into damage_types(id, name) values (215, 'TYPE_CLEAVE');
- insert into damage_types(id, name) values (216, 'TYPE_STAB');
- insert into damage_types(id, name) values (217, 'TYPE_SMASH');
- insert into damage_types(id, name) values (218, 'TYPE_SMITE');
- insert into damage_types(id, name) values (220, 'TYPE_SUFFERING');
- insert into damage_types(id, name) values (221, 'TYPE_HUNGER');
- -- These are for the "use" command, so while there are ways to put spells onto other items,
- -- only potions/scrolls/wands/staffs can be used. (quaff, recite, use, use)
- create table if not exists item_spells (
- id integer primary key not null,
- name text,
- minimum_level integer,
- allow_potion boolean default 'f',
- allow_scroll boolean default 'f',
- allow_wand boolean default 'f',
- allow_staff boolean default 'f'
- );
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (-1, 'TYPE_UNDEFINED', 0, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (0, 'SPELL_RESERVED_DBC', 0, 'f', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (1, 'SPELL_ARMOR', 1, 't', 't', 't', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (2, 'SPELL_TELEPORT', 1, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (3, 'SPELL_BLESS', 1, 't', 't', 't', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (4, 'SPELL_BLINDNESS', 1, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (5, 'SPELL_BURNING_HANDS', 5, 'f', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (6, 'SPELL_CALL_LIGHTNING', 12, 't', 't', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (7, 'SPELL_CHARM_PERSON', 1, 'f', 't', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (8, 'SPELL_CHILL_TOUCH', 3, 'f', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (9, 'SPELL_CLONE', 1, 't', 't', 't', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (10, 'SPELL_COLOUR_SPRAY', 11, 'f', 't', 't', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (11, 'SPELL_CONTROL_WEATHER', 1, 'f', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (12, 'SPELL_CREATE_FOOD', 1, 'f', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (13, 'SPELL_CREATE_WATER', 1, 'f', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (14, 'SPELL_CURE_BLIND', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (15, 'SPELL_CURE_CRITIC', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (16, 'SPELL_CURE_LIGHT', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (17, 'SPELL_CURSE', 1, 't', 't', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (18, 'SPELL_DETECT_EVIL', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (19, 'SPELL_DETECT_INVISIBLE', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (20, 'SPELL_DETECT_MAGIC', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (21, 'SPELL_DETECT_POISON', 1, 't', 't', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (22, 'SPELL_DISPEL_EVIL', 10, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (23, 'SPELL_EARTHQUAKE', 7, 'f', 't', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (24, 'SPELL_ENCHANT_WEAPON', 1, 'f', 't', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (25, 'SPELL_ENERGY_DRAIN', 13, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (26, 'SPELL_FIREBALL', 15, 'f', 't', 't', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (27, 'SPELL_HARM', 15, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (28, 'SPELL_HEAL', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (29, 'SPELL_INVISIBLE', 1, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (30, 'SPELL_LIGHTNING_BOLT', 9, 'f', 't', 't', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (31, 'SPELL_LOCATE_OBJECT', 1, 'f', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (32, 'SPELL_MAGIC_MISSILE', 1, 'f', 't', 't', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (33, 'SPELL_POISON', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (34, 'SPELL_PROTECT_FROM_EVIL', 1, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (35, 'SPELL_REMOVE_CURSE', 1, 't', 't', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (36, 'SPELL_SANCTUARY', 1, 't', 't', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (37, 'SPELL_SHOCKING_GRASP', 7, 'f', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (38, 'SPELL_SLEEP', 1, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (39, 'SPELL_STRENGTH', 1, 't', 't', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (40, 'SPELL_SUMMON', 1, 't', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (41, 'SPELL_VENTRILOQUATE', 1, 't', 'f', 'f', 'f');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (42, 'SPELL_WORD_OF_RECALL', 1, 't', 't', 't', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (43, 'SPELL_REMOVE_POISON', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (44, 'SPELL_SENCE_LIFE', 1, 't', 'f', 'f', 't');
- insert into item_spells(id, name, minimum_level, allow_potion, allow_scroll, allow_wand, allow_staff)
- values (53, 'SPELL_IDENTIFY', 1, 'f', 't', 'f', 'f');
- create table if not exists drinks (
- id integer primary key not null,
- name text,
- drunkness integer,
- fullness integer,
- thirst integer
- );
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (-1, 'ERROR', 0, 0, 0);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (0, 'LIQ_WATER', 0, 1, 10);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (1, 'LIQ_BEER', 3, 2, 5);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (2, 'LIQ_WINE', 5, 2, 5);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (3, 'LIQ_ALE', 2, 2, 5);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (4, 'LIQ_DARKALE', 1, 2, 5);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (5, 'LIQ_WHISKY', 6, 1, 4);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (6, 'LIQ_LEMONADE', 0, 1, 8);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (7, 'LIQ_FIREBRT', 10, 0, 0);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (8, 'LIQ_LOCALSPC', 3, 3, 3);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (9, 'LIQ_SLIME', 0, 4, -8);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (10, 'LIQ_MILK', 0, 3, 6);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (11, 'LIQ_TEA', 0, 1, 6);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (12, 'LIQ_COFFE', 0, 1, 6);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (13, 'LIQ_BLOOD', 0, 2, -1);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (14, 'LIQ_SALTWATER', 0, 1, -2);
- insert into drinks(id, name, drunkness, fullness, thirst)
- values (15, 'LIQ_COKE', 0, 1, 5);
- create table if not exists trap_eff_bits (
- id integer primary key not null,
- name text
- );
- insert into trap_eff_bits(id, name) values (1 << 0, 'TRAP_EFF_MOVE');
- insert into trap_eff_bits(id, name) values (1 << 1, 'TRAP_EFF_OBJECT');
- insert into trap_eff_bits(id, name) values (1 << 2, 'TRAP_EFF_ROOM');
- insert into trap_eff_bits(id, name) values (1 << 3, 'TRAP_EFF_NORTH');
- insert into trap_eff_bits(id, name) values (1 << 4, 'TRAP_EFF_EAST');
- insert into trap_eff_bits(id, name) values (1 << 5, 'TRAP_EFF_SOUTH');
- insert into trap_eff_bits(id, name) values (1 << 6, 'TRAP_EFF_WEST');
- insert into trap_eff_bits(id, name) values (1 << 7, 'TRAP_EFF_UP');
- insert into trap_eff_bits(id, name) values (1 << 8, 'TRAP_EFF_DOWN');
- -- These are from the more generic damage types or spell numbers
- create table if not exists trap_damage_types (
- id integer primary key not null,
- name text
- );
- insert into trap_damage_types(id, name) values (-3, 'TRAP_DAM_SLEEP');
- insert into trap_damage_types(id, name) values (-2, 'TRAP_DAM_TELEPORT');
- insert into trap_damage_types(id, name) values (10, 'TRAP_DAM_ENERGY');
- insert into trap_damage_types(id, name) values (26, 'TRAP_DAM_FIRE');
- insert into trap_damage_types(id, name) values (203, 'TRAP_DAM_COLD');
- insert into trap_damage_types(id, name) values (206, 'TRAP_DAM_ACID');
- insert into trap_damage_types(id, name) values (207, 'TRAP_DAM_BLUNT');
- insert into trap_damage_types(id, name) values (208, 'TRAP_DAM_PIERCE');
- insert into trap_damage_types(id, name) values (209, 'TRAP_DAM_SLASH');
- create table if not exists container_bits (
- id integer primary key not null,
- name text
- );
- insert into container_bits(id, name) values (1 << 0, 'CONT_CLOSEABLE');
- insert into container_bits(id, name) values (1 << 1, 'CONT_PICKPROOF');
- insert into container_bits(id, name) values (1 << 2, 'CONT_CLOSED');
- insert into container_bits(id, name) values (1 << 3, 'CONT_LOCKED');
- create table if not exists equip_positions (
- id integer primary key not null,
- name text
- );
- insert into equip_positions(id, name) values (0, 'WEAR_LIGHT');
- insert into equip_positions(id, name) values (1, 'WEAR_FINGER_R');
- insert into equip_positions(id, name) values (2, 'WEAR_FINGER_L');
- insert into equip_positions(id, name) values (3, 'WEAR_NECK_1');
- insert into equip_positions(id, name) values (4, 'WEAR_NECK_2');
- insert into equip_positions(id, name) values (5, 'WEAR_BODY');
- insert into equip_positions(id, name) values (6, 'WEAR_HEAD');
- insert into equip_positions(id, name) values (7, 'WEAR_LEGS');
- insert into equip_positions(id, name) values (8, 'WEAR_FEET');
- insert into equip_positions(id, name) values (9, 'WEAR_HANDS');
- insert into equip_positions(id, name) values (10, 'WEAR_ARMS');
- insert into equip_positions(id, name) values (11, 'WEAR_SHIELD');
- insert into equip_positions(id, name) values (12, 'WEAR_ABOUT');
- insert into equip_positions(id, name) values (13, 'WEAR_WAISTE');
- insert into equip_positions(id, name) values (14, 'WEAR_WRIST_R');
- insert into equip_positions(id, name) values (15, 'WEAR_WRIST_L');
- insert into equip_positions(id, name) values (16, 'WIELD');
- insert into equip_positions(id, name) values (17, 'HOLD');
- insert into equip_positions(id, name) values (18, 'WIELD_TWOH');
- create table if not exists item_extra_bits (
- id integer primary key not null,
- name text
- );
- insert into item_extra_bits(id, name) values (1 << 0, 'ITEM_GLOW');
- insert into item_extra_bits(id, name) values (1 << 1, 'ITEM_HUM');
- --insert into item_extra_bits(id, name) values (1 << 2, '');
- --insert into item_extra_bits(id, name) values (1 << 3, '');
- --insert into item_extra_bits(id, name) values (1 << 4, '');
- insert into item_extra_bits(id, name) values (1 << 5, 'ITEM_INVISIBLE');
- insert into item_extra_bits(id, name) values (1 << 6, 'ITEM_MAGIC');
- insert into item_extra_bits(id, name) values (1 << 7, 'ITEM_NODROP');
- insert into item_extra_bits(id, name) values (1 << 8, 'ITEM_BLESS');
- insert into item_extra_bits(id, name) values (1 << 9, 'ITEM_ANTI_GOOD');
- insert into item_extra_bits(id, name) values (1 << 10, 'ITEM_ANTI_EVIL');
- insert into item_extra_bits(id, name) values (1 << 11, 'ITEM_ANTI_NEUTRAL');
- insert into item_extra_bits(id, name) values (1 << 12, 'ITEM_ANTI_CLERIC');
- insert into item_extra_bits(id, name) values (1 << 13, 'ITEM_ANTI_MAGE');
- insert into item_extra_bits(id, name) values (1 << 14, 'ITEM_ANTI_THIEF');
- insert into item_extra_bits(id, name) values (1 << 15, 'ITEM_ANTI_FIGHTER');
- insert into item_extra_bits(id, name) values (1 << 16, 'ITEM_ANTI_RANGER');
- insert into item_extra_bits(id, name) values (1 << 17, 'ITEM_PARISH');
- create table if not exists item_wear_bits (
- id integer primary key not null,
- name text
- );
- insert into item_wear_bits(id, name) values (1 << 0, 'ITEM_TAKE');
- insert into item_wear_bits(id, name) values (1 << 1, 'ITEM_WEAR_FINGER');
- insert into item_wear_bits(id, name) values (1 << 2, 'ITEM_WEAR_NECK');
- insert into item_wear_bits(id, name) values (1 << 3, 'ITEM_WEAR_BODY');
- insert into item_wear_bits(id, name) values (1 << 4, 'ITEM_WEAR_HEAD');
- insert into item_wear_bits(id, name) values (1 << 5, 'ITEM_WEAR_LEGS');
- insert into item_wear_bits(id, name) values (1 << 6, 'ITEM_WEAR_FEET');
- insert into item_wear_bits(id, name) values (1 << 7, 'ITEM_WEAR_HANDS');
- insert into item_wear_bits(id, name) values (1 << 8, 'ITEM_WEAR_ARMS');
- insert into item_wear_bits(id, name) values (1 << 9, 'ITEM_WEAR_SHIELD');
- insert into item_wear_bits(id, name) values (1 << 10, 'ITEM_WEAR_ABOUT');
- insert into item_wear_bits(id, name) values (1 << 11, 'ITEM_WEAR_WAISTE');
- insert into item_wear_bits(id, name) values (1 << 12, 'ITEM_WEAR_WRIST');
- insert into item_wear_bits(id, name) values (1 << 13, 'ITEM_WIELD');
- insert into item_wear_bits(id, name) values (1 << 14, 'ITEM_WOLD');
- insert into item_wear_bits(id, name) values (1 << 15, 'ITEM_WIELD_TWOH');
- create table if not exists item_applies (
- id integer primary key not null,
- name text
- );
- insert into item_applies(id, name) values (0, 'APPLY_NONE');
- insert into item_applies(id, name) values (1, 'APPLY_STR');
- insert into item_applies(id, name) values (2, 'APPLY_DEX');
- insert into item_applies(id, name) values (3, 'APPLY_INT');
- insert into item_applies(id, name) values (4, 'APPLY_WIS');
- insert into item_applies(id, name) values (5, 'APPLY_CON');
- insert into item_applies(id, name) values (6, 'APPLY_SEX');
- insert into item_applies(id, name) values (7, 'APPLY_CLASS');
- insert into item_applies(id, name) values (8, 'APPLY_LEVEL');
- insert into item_applies(id, name) values (9, 'APPLY_AGE');
- insert into item_applies(id, name) values (10, 'APPLY_CHAR_WEIGHT');
- insert into item_applies(id, name) values (11, 'APPLY_CHAR_HEIGHT');
- insert into item_applies(id, name) values (12, 'APPLY_MANA');
- insert into item_applies(id, name) values (13, 'APPLY_HIT');
- insert into item_applies(id, name) values (14, 'APPLY_MOVE');
- insert into item_applies(id, name) values (15, 'APPLY_GOLD');
- insert into item_applies(id, name) values (16, 'APPLY_EXP');
- insert into item_applies(id, name) values (17, 'APPLY_ARMOR');
- insert into item_applies(id, name) values (18, 'APPLY_HITROLL');
- insert into item_applies(id, name) values (19, 'APPLY_DAMROLL');
- insert into item_applies(id, name) values (20, 'APPLY_SAVING_PARA');
- insert into item_applies(id, name) values (21, 'APPLY_SAVING_ROD');
- insert into item_applies(id, name) values (22, 'APPLY_SAVING_PETRI');
- insert into item_applies(id, name) values (23, 'APPLY_SAVING_BREATH');
- insert into item_applies(id, name) values (24, 'APPLY_SAVING_SPELL');
- insert into item_applies(id, name) values (25, 'APPLY_SAVE_ALL');
- insert into item_applies(id, name) values (26, 'APPLY_IMMUNE');
- insert into item_applies(id, name) values (27, 'APPLY_SUSC');
- insert into item_applies(id, name) values (28, 'APPLY_M_IMMUNE');
- insert into item_applies(id, name) values (29, 'APPLY_SPELL_AFFECT');
- insert into item_applies(id, name) values (30, 'APPLY_WEAPON_SPELL');
- insert into item_applies(id, name) values (31, 'APPLY_EAT_SPELL');
- insert into item_applies(id, name) values (32, 'APPLY_BACKSTAB');
- insert into item_applies(id, name) values (33, 'APPLY_KICK');
- insert into item_applies(id, name) values (34, 'APPLY_SNEAK');
- insert into item_applies(id, name) values (35, 'APPLY_HIDE');
- insert into item_applies(id, name) values (36, 'APPLY_BASH');
- insert into item_applies(id, name) values (37, 'APPLY_PICK');
- insert into item_applies(id, name) values (38, 'APPLY_STEAL');
- insert into item_applies(id, name) values (39, 'APPLY_TRACK');
- insert into item_applies(id, name) values (40, 'APPLY_HITNDAM');
- -- Rooms
- create table if not exists exit_directions (
- id integer primary key not null,
- name text
- );
- insert into exit_directions(id, name) values (0, 'NORTH');
- insert into exit_directions(id, name) values (1, 'EAST');
- insert into exit_directions(id, name) values (2, 'SOUTH');
- insert into exit_directions(id, name) values (3, 'WEST');
- insert into exit_directions(id, name) values (4, 'UP');
- insert into exit_directions(id, name) values (5, 'DOWN');
- create table if not exists exit_bits (
- id integer primary key not null,
- name text
- );
- insert into exit_bits(id, name) values (1 << 0, 'EX_ISDOOR');
- insert into exit_bits(id, name) values (1 << 1, 'EX_CLOSED');
- insert into exit_bits(id, name) values (1 << 2, 'EX_LOCKED');
- insert into exit_bits(id, name) values (1 << 3, 'EX_SECRET');
- insert into exit_bits(id, name) values (1 << 4, 'EX_TRAPPED');
- insert into exit_bits(id, name) values (1 << 5, 'EX_PICKPROOF');
- insert into exit_bits(id, name) values (1 << 6, 'EX_ALIAS');
- create table if not exists door_states (
- id integer primary key not null,
- name text
- );
- insert into door_states(id, name) values (0, 'OPEN');
- -- Actually clears EX_CLOSED and EX_LOCKED from exit
- insert into door_states(id, name) values (1, 'CLOSED');
- -- Actually clears EX_LOCKED and sets EX_CLOSED on exit
- insert into door_states(id, name) values (2, 'LOCKED');
- -- Actually sets EX_CLOSED and EX_LOCKED on exit
- create table if not exists room_bits (
- id integer primary key not null,
- name text
- );
- insert into room_bits(id, name) values (1 << 0, 'DARK');
- insert into room_bits(id, name) values (1 << 1, 'DEATH');
- insert into room_bits(id, name) values (1 << 2, 'NO_MOB');
- insert into room_bits(id, name) values (1 << 3, 'INDOORS');
- insert into room_bits(id, name) values (1 << 4, 'PEACEFUL');
- insert into room_bits(id, name) values (1 << 5, 'NO_STEAL');
- insert into room_bits(id, name) values (1 << 6, 'NO_SUM');
- insert into room_bits(id, name) values (1 << 7, 'NO_MAGIC');
- insert into room_bits(id, name) values (1 << 8, 'TUNNEL');
- insert into room_bits(id, name) values (1 << 9, 'PRIVATE');
- insert into room_bits(id, name) values (1 << 10, 'SOUND');
- create table if not exists sector_types (
- id integer primary key not null,
- name text
- );
- insert into sector_types(id, name) values (-1, 'SECT_TELE');
- insert into sector_types(id, name) values (0, 'SECT_INSIDE');
- insert into sector_types(id, name) values (1, 'SECT_CITY');
- insert into sector_types(id, name) values (2, 'SECT_FIELD');
- insert into sector_types(id, name) values (3, 'SECT_FOREST');
- insert into sector_types(id, name) values (4, 'SECT_HILLS');
- insert into sector_types(id, name) values (5, 'SECT_MOUNTAIN');
- insert into sector_types(id, name) values (6, 'SECT_WATER_SWIM');
- insert into sector_types(id, name) values (7, 'SECT_WATER_NOSWIM');
- insert into sector_types(id, name) values (8, 'SECT_AIR');
- insert into sector_types(id, name) values (9, 'SECT_UNDERWATER');
- -- These set various bits in combinations
- create table if not exists exit_types (
- id integer primary key not null,
- name text
- );
- insert into exit_types(id, name) values (0, 'Open Passage');
- insert into exit_types(id, name) values (1, 'Normal');
- insert into exit_types(id, name) values (2, 'Pickproof');
- insert into exit_types(id, name) values (3, 'Secret');
- insert into exit_types(id, name) values (4, 'Secret Pickproof');
- insert into exit_types(id, name) values (5, 'Open Passage with Alias');
- insert into exit_types(id, name) values (6, 'Normal with Alias');
- insert into exit_types(id, name) values (7, 'Pickproof with Alias');
- insert into exit_types(id, name) values (8, 'Secret with Alias');
- insert into exit_types(id, name) values (9, 'Secret Pickproof with Alias');
- -- Here we start the more complex relations
- -- For these tables, if the individual bit entries are not null
- -- they are the value used by that type.
- create table if not exists fears (
- id SERIAL primary key not null,
- flags integer not null,
- sex integer references sexes(id), -- references sex id
- race integer references races(id), -- references race id
- player text, -- would reference player name
- class integer, -- bit flags for all classes feared
- evil integer, -- hates <= X alignment
- good integer, -- hates >= X alignment
- vnum integer, -- references mobile vnum
- rich integer -- hate anyone with >= X gold
- );
- create table if not exists hates (
- id SERIAL primary key not null,
- flags integer not null,
- sex integer references sexes(id), -- references sex id
- race integer references races(id), -- references race id
- player text, -- would reference player name
- class integer, -- bit flags for all classes hated
- evil integer, -- fears <= X alignment
- good integer, -- fears >= X alignment
- vnum integer, -- references mobile vnum
- rich integer -- fear anyone with >= X gold
- );
- create table if not exists extra_descriptions (
- id SERIAL primary key not null,
- description text,
- keywords text
- );
- create table if not exists applies (
- id SERIAL primary key not null,
- location integer not null references item_applies(id),
- modifier integer
- );
- -- The raw zone data
- create table if not exists zones (
- id integer primary key not null, -- called vnum in code
- name text not null,
- reset_mode integer not null references zone_reset_modes(id),
- reset_time integer,
- top_vnum integer
- );
- -- The raw object data
- create table if not exists objects (
- id integer primary key not null, -- called vnum in code
- name text not null, -- called short_description in code
- description text not null, -- called long description in code
- action_description text,
- keywords text not null,
- item_type integer references item_types(id),
- extra_flags integer not null default 0, -- bit flags from item_extra_bits
- wear_flags integer not null default 0, -- bit flags from item_wear_bits
- weight integer,
- value integer,
- rent_cost integer,
- value_one integer,
- value_two integer,
- value_three integer,
- value_four integer,
- -- The values below are all derived from item_type and values 1 to 4
- duration integer, -- used for ITEM_LIGHT, -1 means infinite
- charges integer, -- used for ITEM_WAND, ITEM_STAFF, ITEM_TRAP, ITEM_DRINKCON
- max_charges integer, -- used for ITEM_WAND, ITEM_STAFF, ITEM_DRINKCON
- spell_level integer, -- used for ITEM_SCROLL, ITEM_WAND, ITEM_STAFF, ITEM_POTION
- spell_one integer references item_spells(id),
- spell_two integer references item_spells(id),
- spell_three integer references item_spells(id),
- weapon_damage_rolls integer, -- used for ITEM_WEAPON
- weapon_damage_dice integer, -- used for ITEM_WEAPON
- weapon_damage_type integer references weapon_types(id),
- armor_class integer, -- used for ITEM_ARMOR
- original_ac integer, -- used for ITEM_ARMOR
- trap_effect integer, -- bit flags from trap_eff_bits
- trap_damage_type integer references trap_damage_types(id),
- trap_level integer, -- used for ITEM_TRAP
- container_flags integer, -- bit flags from container_bits
- max_weight integer, -- used for ITEM_CONTAINER
- key_id integer, -- vnum of object, -1 for no key and not lockable
- poisoned integer, -- used for ITEM_DRINKCON and ITEM_FOOD, >0 means poisoned
- key_type integer, -- ITEM_KEY key_type must match the one in exits
- fullness integer, -- ITEM_FOOD how many hours of fullness
- gold integer -- ITEM_MONEY gold coins in stack
- );
- create table if not exists objects_extra_descriptions (
- object_id integer not null references objects(id),
- description_id integer not null references extra_descriptions(id)
- );
- create table if not exists objects_applies (
- object_id integer not null references objects(id),
- apply_id integer not null references applies(id)
- );
- -- The raw room data
- create table if not exists rooms (
- id integer primary key not null, -- called vnum in code
- name text not null, -- called title in code
- description text not null,
- zone integer not null references zones(id),
- flags integer not null default 0, -- bit flags from room_bits
- sector_type integer not null references sector_types(id),
- teleport_delay integer, -- ticks before player is teleported
- teleport_room integer references rooms(id), -- target room vnum player is teleported to
- teleport_look boolean, -- do a look after the teleport happens
- teleport_movement integer references sector_types(id), -- sector type to use for move cost
- river_delay integer, -- ticks before player is moved
- river_direction integer references exit_directions(id), -- exit player moves through
- sound_one text, -- ambient sounds
- sound_two text -- ambient sounds
- );
- create table if not exists exits (
- id SERIAL primary key not null,
- direction integer not null references exit_directions(id),
- description text,
- keywords text,
- exit_type integer references exit_types(id),
- exit_key integer, -- key_type, also used in objects via item_type KEY
- exit_target integer references rooms(id)
- );
- create table if not exists rooms_exits (
- room_id integer not null references rooms(id),
- exit_id integer not null references exits(id)
- );
- create table if not exists rooms_extra_descriptions (
- room_id integer not null references rooms(id),
- description_id integer not null references extra_descriptions(id)
- );
- -- The raw mobile data
- create table if not exists mobiles (
- id integer primary key not null, -- called vnum in code
- name text not null, -- called short_description in code
- description text not null, -- called long description in code
- action_description text, -- called description in code
- keywords text not null,
- act_flags integer, -- bit flags for act_bits
- aff_flags integer, -- bit flags for aff_bits
- alignment integer, -- alignments
- mob_type char(1), -- one of [SMWDC]
- hit_dice integer, -- called level in code
- thac0 integer,
- armor_class integer,
- hit_points text, -- dice roll or plain integer
- damage text, -- dice roll or plain integer, null for C type
- attack_count integer, -- multi-attacks for MWC types
- race integer references races(id),
- sex integer references sexes(id),
- class integer, -- bit flags for class_bits
- height text, -- dice roll or default integer
- weight text, -- dice roll or default integer
- gold text, -- dice roll or plain integer
- experience text, -- dice roll or plain integer
- resistances integer, -- bit flags for ris_bits
- immunities integer, -- bit flags for ris_bits
- susceptibilities integer, -- bit flags for ris_bits
- strength text, -- dice roll or plain integer, default for SMW types
- extra_strength text, -- dice roll or plain integer, default for SMW types
- dexterity text, -- dice roll or plain integer, default for SMW types
- constitution text, -- dice roll or plain integer, default for SMW types
- intelligence text, -- dice roll or plain integer, default for SMW types
- wisdom text, -- dice roll or plain integer, default for SMW types
- save_paralysis integer, -- default for SMW types
- save_rod integer, -- default for SMW types
- save_petrification integer, -- default for SMW types
- save_breath integer, -- default for SMW types
- save_spell integer, -- default for SMW types
- load_position integer references positions(id),
- default_position integer references positions(id),
- sound_one text, -- ambient sounds
- sound_two text -- ambient sounds
- );
- -- For C type mobiles, there will be attack_count rows to
- -- describe the attacks the mobile does. The serial id is just
- -- to keep the order of attacks the same, as a sort key
- create table if not exists mobiles_attacks (
- id SERIAL primary key not null,
- mobile_id integer not null references mobiles(id),
- damage text, -- dice roll or plain integer
- damage_type integer references damage_types(id)
- );
- -- Type C mobiles have skills.
- create table if not exists mobiles_skills (
- id SERIAL primary key not null,
- mobile_id integer not null references mobiles(id),
- skill_id integer,
- learned integer,
- recognized integer
- );
- -- Resets within each zone will reference rooms, objects, and mobiles
- create table if not exists resets (
- id SERIAL primary key not null,
- command char(1) not null,
- if_flag boolean,
- max_existing integer,
- equip_position integer references equip_positions(id),
- exit_direction integer references exit_directions(id),
- door_state integer references door_states(id),
- room_id integer references rooms(id),
- object_id integer references objects(id),
- mobile_id integer references mobiles(id),
- target_room integer references rooms(id),
- target_object integer references objects(id),
- target_mobile integer references mobiles(id)
- );
- create table if not exists zones_resets (
- zone_id integer not null references zones(id),
- reset_id integer not null references resets(id)
- );
- create unique index if not exists ix_zones_resets on zones_resets(zone_id, reset_id);
- create table if not exists resets_fears (
- reset_id integer not null references resets(id),
- fear_id integer not null references fears(id)
- );
- create unique index if not exists ix_resets_fears on resets_fears(reset_id, fear_id);
- create table if not exists resets_hates (
- reset_id integer not null references resets(id),
- hate_id integer not null references hates(id)
- );
- 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