424 lines
17 KiB
Lua

local start = microtime(true)
local db = sqlite("dk")
db:create_table("babble",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"posted TEXT NOT NULL DEFAULT '00:00:00'",
"author INTEGER NOT NULL",
"babble TEXT NOT NULL"
)
db:create_table("control",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"game_name TEXT NOT NULL DEFAULT 'Dragon Knight'",
"game_size INTEGER NOT NULL DEFAULT 250",
"game_open INTEGER NOT NULL DEFAULT 1",
"game_url TEXT NOT NULL DEFAULT ''",
"admin_email TEXT NOT NULL DEFAULT ''",
"class_1_name TEXT NOT NULL DEFAULT ''",
"class_2_name TEXT NOT NULL DEFAULT ''",
"class_3_name TEXT NOT NULL DEFAULT ''",
"verify_email INTEGER NOT NULL DEFAULT 0",
"show_news INTEGER NOT NULL DEFAULT 0",
"show_babble INTEGER NOT NULL DEFAULT 0",
"show_online INTEGER NOT NULL DEFAULT 0"
)
db:insert("control", {
game_name = "Dragon Knight",
game_size = 250,
game_open = 1,
game_url = "",
admin_email = "",
class_1_name = "Mage",
class_2_name = "Warrior",
class_3_name = "Paladin",
verify_email = 1,
show_news = 1,
show_babble = 1,
show_online = 1
})
db:create_table("drops",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"name TEXT NOT NULL",
"level INTEGER NOT NULL DEFAULT 0",
"type INTEGER NOT NULL DEFAULT 0",
"attribute_1 TEXT NOT NULL DEFAULT ''",
"attribute_2 TEXT NOT NULL DEFAULT ''"
)
db:insert("drops", {
{"Life Pebble", 1, 1, "maxhp,10", ""},
{"Life Stone", 10, 1, "maxhp,25", ""},
{"Life Rock", 25, 1, "maxhp,50", ""},
{"Magic Pebble", 1, 1, "maxmp,10", ""},
{"Magic Stone", 10, 1, "maxmp,25", ""},
{"Magic Rock", 25, 1, "maxmp,50", ""},
{"Dragon's Scale", 10, 1, "defensepower,25", ""},
{"Dragon's Plate", 30, 1, "defensepower,50", ""},
{"Dragon's Claw", 10, 1, "attackpower,25", ""},
{"Dragon's Tooth", 30, 1, "attackpower,50", ""},
{"Dragon's Tear", 35, 1, "strength,50", ""},
{"Dragon's Wing", 35, 1, "dexterity,50", ""},
{"Demon's Sin", 35, 1, "maxhp,-50", "strength,50"},
{"Demon's Fall", 35, 1, "maxmp,-50", "strength,50"},
{"Demon's Lie", 45, 1, "maxhp,-100", "strength,100"},
{"Demon's Hate", 45, 1, "maxmp,-100", "strength,100"},
{"Angel's Joy", 25, 1, "maxhp,25", "strength,25"},
{"Angel's Rise", 30, 1, "maxhp,50", "strength,50"},
{"Angel's Truth", 35, 1, "maxhp,75", "strength,75"},
{"Angel's Love", 40, 1, "maxhp,100", "strength,100"},
{"Seraph's Joy", 25, 1, "maxmp,25", "dexterity,25"},
{"Seraph's Rise", 30, 1, "maxmp,50", "dexterity,50"},
{"Seraph's Truth", 35, 1, "maxmp,75", "dexterity,75"},
{"Seraph's Love", 40, 1, "maxmp,100", "dexterity,100"},
{"Ruby", 50, 1, "maxhp,150", ""},
{"Pearl", 50, 1, "maxmp,150", ""},
{"Emerald", 50, 1, "strength,150", ""},
{"Topaz", 50, 1, "dexterity,150", ""},
{"Obsidian", 50, 1, "attackpower,150", ""},
{"Diamond", 50, 1, "defensepower,150", ""},
{"Memory Drop", 5, 1, "expbonus,10", ""},
{"Fortune Drop", 5, 1, "goldbonus,10", ""}
}, {"name", "level", "type", "attribute_1", "attribute_2"})
db:create_table("forum",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"author INTEGER NOT NULL",
"parent INTEGER NOT NULL DEFAULT 0",
"replies INTEGER NOT NULL DEFAULT 0",
"title TEXT NOT NULL",
"content TEXT NOT NULL",
"posted DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP",
"latest DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP"
)
db:create_table("items",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"type INTEGER NOT NULL DEFAULT 0",
"name TEXT NOT NULL",
"value INTEGER NOT NULL DEFAULT 0",
"attribute INTEGER NOT NULL DEFAULT 0",
"special TEXT NOT NULL DEFAULT ''"
)
db:insert("items", {
{1, "Stick", 10, 2, ""},
{1, "Branch", 30, 4, ""},
{1, "Club", 40, 5, ""},
{1, "Dagger", 90, 8, ""},
{1, "Hatchet", 150, 12, ""},
{1, "Axe", 200, 16, ""},
{1, "Brand", 300, 25, ""},
{1, "Poleaxe", 500, 35, ""},
{1, "Broadsword", 800, 45, ""},
{1, "Battle Axe", 1200, 50, ""},
{1, "Claymore", 2000, 60, ""},
{1, "Dark Axe", 3000, 100, "expbonus,-5"},
{1, "Dark Sword", 4500, 125, "expbonus,-10"},
{1, "Bright Sword", 6000, 100, "expbonus,10"},
{1, "Magic Sword", 10000, 150, "maxmp,50"},
{1, "Destiny Blade", 50000, 250, "strength,50"},
{2, "Skivvies", 25, 2, "goldbonus,10"},
{2, "Clothes", 50, 5, ""},
{2, "Leather Armor", 75, 10, ""},
{2, "Hard Leather Armor", 150, 25, ""},
{2, "Chain Mail", 300, 30, ""},
{2, "Bronze Plate", 900, 50, ""},
{2, "Iron Plate", 2000, 100, ""},
{2, "Magic Armor", 4000, 125, "maxmp,50"},
{2, "Dark Armor", 5000, 150, "expbonus,-10"},
{2, "Bright Armor", 10000, 175, "expbonus,10"},
{2, "Destiny Raiment", 50000, 200, "dexterity,50"},
{3, "Reed Shield", 50, 2, ""},
{3, "Buckler", 100, 4, ""},
{3, "Small Shield", 500, 10, ""},
{3, "Large Shield", 2500, 30, ""},
{3, "Silver Shield", 10000, 60, ""},
{3, "Destiny Aegis", 25000, 100, "maxhp,50"}
}, {"type", "name", "value", "attribute", "special"})
db:create_table("monsters",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"name TEXT NOT NULL",
"max_hp INTEGER NOT NULL DEFAULT 1",
"max_dmg INTEGER NOT NULL DEFAULT 0",
"armor INTEGER NOT NULL DEFAULT 0",
"level INTEGER NOT NULL DEFAULT 0",
"max_exp INTEGER NOT NULL DEFAULT 0",
"max_gold INTEGER NOT NULL DEFAULT 0",
"immune INTEGER NOT NULL DEFAULT 0"
)
db:insert("monsters", {
{"Blue Slime", 4, 3, 1, 1, 1, 1, 0},
{"Red Slime", 6, 5, 1, 1, 2, 1, 0},
{"Critter", 6, 5, 2, 1, 4, 2, 0},
{"Creature", 10, 8, 2, 2, 4, 2, 0},
{"Shadow", 10, 9, 3, 2, 6, 2, 1},
{"Drake", 11, 10, 3, 2, 8, 3, 0},
{"Shade", 12, 10, 3, 3, 10, 3, 1},
{"Drakelor", 14, 12, 4, 3, 10, 3, 0},
{"Silver Slime", 15, 100, 200, 30, 15, 1000, 2},
{"Scamp", 16, 13, 5, 4, 15, 5, 0},
{"Raven", 16, 13, 5, 4, 18, 6, 0},
{"Scorpion", 18, 14, 6, 5, 20, 7, 0},
{"Illusion", 20, 15, 6, 5, 20, 7, 1},
{"Nightshade", 22, 16, 6, 6, 24, 8, 0},
{"Drakemal", 22, 18, 7, 6, 24, 8, 0},
{"Shadow Raven", 24, 18, 7, 6, 26, 9, 1},
{"Ghost", 24, 20, 8, 6, 28, 9, 0},
{"Frost Raven", 26, 20, 8, 7, 30, 10, 0},
{"Rogue Scorpion", 28, 22, 9, 7, 32, 11, 0},
{"Ghoul", 29, 24, 9, 7, 34, 11, 0},
{"Magician", 30, 24, 10, 8, 36, 12, 0},
{"Rogue", 30, 25, 12, 8, 40, 13, 0},
{"Drakefin", 32, 26, 12, 8, 40, 13, 0},
{"Shimmer", 32, 26, 14, 8, 45, 15, 1},
{"Fire Raven", 34, 28, 14, 9, 45, 15, 0},
{"Dybbuk", 34, 28, 14, 9, 50, 17, 0},
{"Knave", 36, 30, 15, 9, 52, 17, 0},
{"Goblin", 36, 30, 15, 10, 54, 18, 0},
{"Skeleton", 38, 30, 18, 10, 58, 19, 0},
{"Dark Slime", 38, 32, 18, 10, 62, 21, 0},
{"Silver Scorpion", 30, 160, 350, 40, 63, 2000, 2},
{"Mirage", 40, 32, 20, 11, 64, 21, 1},
{"Sorceror", 41, 33, 22, 11, 68, 23, 0},
{"Imp", 42, 34, 22, 12, 70, 23, 0},
{"Nymph", 43, 35, 22, 12, 70, 23, 0},
{"Scoundrel", 43, 35, 22, 12, 75, 25, 0},
{"Megaskeleton", 44, 36, 24, 13, 78, 26, 0},
{"Grey Wolf", 44, 36, 24, 13, 82, 27, 0},
{"Phantom", 46, 38, 24, 14, 85, 28, 1},
{"Specter", 46, 38, 24, 14, 90, 30, 0},
{"Dark Scorpion", 48, 40, 26, 15, 95, 32, 1},
{"Warlock", 48, 40, 26, 15, 100, 33, 1},
{"Orc", 49, 42, 28, 15, 104, 35, 0},
{"Sylph", 49, 42, 28, 15, 106, 35, 0},
{"Wraith", 50, 45, 30, 16, 108, 36, 0},
{"Hellion", 50, 45, 30, 16, 110, 37, 0},
{"Bandit", 52, 45, 30, 16, 114, 38, 0},
{"Ultraskeleton", 52, 46, 32, 16, 116, 39, 0},
{"Dark Wolf", 54, 47, 36, 17, 120, 40, 1},
{"Troll", 56, 48, 36, 17, 120, 40, 0},
{"Werewolf", 56, 48, 38, 17, 124, 41, 0},
{"Hellcat", 58, 50, 38, 18, 128, 43, 0},
{"Spirit", 58, 50, 38, 18, 132, 44, 0},
{"Nisse", 60, 52, 40, 19, 132, 44, 0},
{"Dawk", 60, 54, 40, 19, 136, 45, 0},
{"Figment", 64, 55, 42, 19, 140, 47, 1},
{"Hellhound", 66, 56, 44, 20, 140, 47, 0},
{"Wizard", 66, 56, 44, 20, 144, 48, 0},
{"Uruk", 68, 58, 44, 20, 146, 49, 0},
{"Siren", 68, 400, 800, 50, 10000, 50, 2},
{"Megawraith", 70, 60, 46, 21, 155, 52, 0},
{"Dawkin", 70, 60, 46, 21, 155, 52, 0},
{"Grey Bear", 70, 62, 48, 21, 160, 53, 0},
{"Haunt", 72, 62, 48, 22, 160, 53, 0},
{"Hellbeast", 74, 64, 50, 22, 165, 55, 0},
{"Fear", 76, 66, 52, 23, 165, 55, 0},
{"Beast", 76, 66, 52, 23, 170, 57, 0},
{"Ogre", 78, 68, 54, 23, 170, 57, 0},
{"Dark Bear", 80, 70, 56, 24, 175, 58, 1},
{"Fire", 80, 72, 56, 24, 175, 58, 0},
{"Polgergeist", 84, 74, 58, 25, 180, 60, 0},
{"Fright", 86, 76, 58, 25, 180, 60, 0},
{"Lycan", 88, 78, 60, 25, 185, 62, 0},
{"Terra Elemental", 88, 80, 62, 25, 185, 62, 1},
{"Necromancer", 90, 80, 62, 26, 190, 63, 0},
{"Ultrawraith", 90, 82, 64, 26, 190, 63, 0},
{"Dawkor", 92, 82, 64, 26, 195, 65, 0},
{"Werebear", 92, 84, 65, 26, 195, 65, 0},
{"Brute", 94, 84, 65, 27, 200, 67, 0},
{"Large Beast", 96, 88, 66, 27, 200, 67, 0},
{"Horror", 96, 88, 68, 27, 210, 70, 0},
{"Flame", 100, 90, 70, 28, 210, 70, 0},
{"Lycanthor", 100, 90, 70, 28, 210, 70, 0},
{"Wyrm", 100, 92, 72, 28, 220, 73, 0},
{"Aero Elemental", 104, 94, 74, 29, 220, 73, 1},
{"Dawkare", 106, 96, 76, 29, 220, 73, 0},
{"Large Brute", 108, 98, 78, 29, 230, 77, 0},
{"Frost Wyrm", 110, 100, 80, 30, 230, 77, 0},
{"Knight", 110, 102, 80, 30, 240, 80, 0},
{"Lycanthra", 112, 104, 82, 30, 240, 80, 0},
{"Terror", 115, 108, 84, 31, 250, 83, 0},
{"Blaze", 118, 108, 84, 31, 250, 83, 0},
{"Aqua Elemental", 120, 110, 90, 31, 260, 87, 1},
{"Fire Wyrm", 120, 110, 90, 32, 260, 87, 0},
{"Lesser Wyvern", 122, 110, 92, 32, 270, 90, 0},
{"Doomer", 124, 112, 92, 32, 270, 90, 0},
{"Armor Knight", 130, 115, 95, 33, 280, 93, 0},
{"Wyvern", 134, 120, 95, 33, 290, 97, 0},
{"Nightmare", 138, 125, 100, 33, 300, 100, 0},
{"Fira Elemental", 140, 125, 100, 34, 310, 103, 1},
{"Megadoomer", 140, 128, 105, 34, 320, 107, 0},
{"Greater Wyvern", 145, 130, 105, 34, 335, 112, 0},
{"Advocate", 148, 132, 108, 35, 350, 117, 0},
{"Strong Knight", 150, 135, 110, 35, 365, 122, 0},
{"Liche", 150, 135, 110, 35, 380, 127, 0},
{"Ultradoomer", 155, 140, 115, 36, 395, 132, 0},
{"Fanatic", 160, 140, 115, 36, 410, 137, 0},
{"Green Dragon", 160, 140, 115, 36, 425, 142, 0},
{"Fiend", 160, 145, 120, 37, 445, 148, 0},
{"Greatest Wyvern", 162, 150, 120, 37, 465, 155, 0},
{"Lesser Devil", 164, 150, 120, 37, 485, 162, 0},
{"Liche Master", 168, 155, 125, 38, 505, 168, 0},
{"Zealot", 168, 155, 125, 38, 530, 177, 0},
{"Serafiend", 170, 155, 125, 38, 555, 185, 0},
{"Pale Knight", 175, 160, 130, 39, 580, 193, 0},
{"Blue Dragon", 180, 160, 130, 39, 605, 202, 0},
{"Obsessive", 180, 160, 135, 40, 630, 210, 0},
{"Devil", 184, 164, 135, 40, 666, 222, 0},
{"Liche Prince", 190, 168, 138, 40, 660, 220, 0},
{"Cherufiend", 195, 170, 140, 41, 690, 230, 0},
{"Red Dragon", 200, 180, 145, 41, 720, 240, 0},
{"Greater Devil", 200, 180, 145, 41, 750, 250, 0},
{"Renegade", 205, 185, 150, 42, 780, 260, 0},
{"Archfiend", 210, 190, 150, 42, 810, 270, 0},
{"Liche Lord", 210, 190, 155, 42, 850, 283, 0},
{"Greatest Devil", 215, 195, 160, 43, 890, 297, 0},
{"Dark Knight", 220, 200, 160, 43, 930, 310, 0},
{"Giant", 220, 200, 165, 43, 970, 323, 0},
{"Shadow Dragon", 225, 200, 170, 44, 1010, 337, 0},
{"Liche King", 225, 205, 170, 44, 1050, 350, 0},
{"Incubus", 230, 205, 175, 44, 1100, 367, 1},
{"Traitor", 230, 205, 175, 45, 1150, 383, 0},
{"Demon", 240, 210, 180, 45, 1200, 400, 0},
{"Dark Dragon", 245, 215, 180, 45, 1250, 417, 1},
{"Insurgent", 250, 220, 190, 46, 1300, 433, 0},
{"Leviathan", 255, 225, 190, 46, 1350, 450, 0},
{"Grey Daemon", 260, 230, 190, 46, 1400, 467, 0},
{"Succubus", 265, 240, 200, 47, 1460, 487, 1},
{"Demon Prince", 270, 240, 200, 47, 1520, 507, 0},
{"Black Dragon", 275, 250, 205, 47, 1580, 527, 1},
{"Nihilist", 280, 250, 205, 47, 1640, 547, 0},
{"Behemoth", 285, 260, 210, 48, 1700, 567, 0},
{"Demagogue", 290, 260, 210, 48, 1760, 587, 0},
{"Demon Lord", 300, 270, 220, 48, 1820, 607, 0},
{"Red Daemon", 310, 280, 230, 48, 1880, 627, 0},
{"Colossus", 320, 300, 240, 49, 1940, 647, 0},
{"Demon King", 330, 300, 250, 49, 2000, 667, 0},
{"Dark Daemon", 340, 320, 260, 49, 2200, 733, 1},
{"Titan", 360, 340, 270, 50, 2400, 800, 0},
{"Black Daemon", 400, 400, 280, 50, 3000, 1000, 1},
{"Lucifuge", 600, 600, 400, 50, 10000, 10000, 2}
}, {"name", "max_hp", "max_dmg", "armor", "level", "max_exp", "max_gold", "immune"})
db:create_table("news",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"author TEXT NOT NULL DEFAULT 'Guild Master'",
"postdate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP",
"content TEXT NOT NULL"
)
db:insert("news", {content = "This is the first news post. Please use the admin control panel to add another one and make this one go away."})
db:create_table("spells",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"name TEXT NOT NULL",
"mp INTEGER NOT NULL DEFAULT 0",
"power INTEGER NOT NULL DEFAULT 0",
"type INTEGER NOT NULL DEFAULT 0"
)
db:insert("spells", {
{"Heal", 5, 10, 1},
{"Revive", 10, 25, 1},
{"Life", 25, 50, 1},
{"Breath", 50, 100, 1},
{"Gaia", 75, 150, 1},
{"Hurt", 5, 15, 2},
{"Pain", 12, 35, 2},
{"Maim", 25, 70, 2},
{"Rend", 40, 100, 2},
{"Chaos", 50, 130, 2},
{"Sleep", 10, 5, 3},
{"Dream", 30, 9, 3},
{"Nightmare", 60, 13, 3},
{"Craze", 10, 10, 4},
{"Rage", 20, 25, 4},
{"Fury", 30, 50, 4},
{"Ward", 10, 10, 5},
{"Fend", 20, 25, 5},
{"Barrier", 30, 50, 5}
}, {"name", "mp", "power", "type"})
db:create_table("towns",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"name TEXT NOT NULL",
"lat INTEGER NOT NULL DEFAULT 0",
"lon INTEGER NOT NULL DEFAULT 0",
"inn_price INTEGER NOT NULL DEFAULT 0",
"map_price INTEGER NOT NULL DEFAULT 0",
"tp_cost INTEGER NOT NULL DEFAULT 0",
"items TEXT NOT NULL"
)
db:insert("towns", {
{"Midworld", 0, 0, 5, 0, 0, "1,2,3,17,18,19,28,29"},
{"Roma", 30, 30, 10, 25, 5, "2,3,4,18,19,29"},
{"Bris", 70, -70, 25, 50, 15, "2,3,4,5,18,19,20,29.30"},
{"Kalle", -100, 100, 40, 100, 30, "5,6,8,10,12,21,22,23,29,30"},
{"Narcissa", -130, -130, 60, 500, 50, "4,7,9,11,13,21,22,23,29,30,31"},
{"Hambry", 170, 170, 90, 1000, 80, "10,11,12,13,14,23,24,30,31"},
{"Gilead", 200, -200, 100, 3000, 110, "12,13,14,15,24,25,26,32"},
{"Endworld", -250, -250, 125, 9000, 160, "16,27,33"}
}, {"name", "lat", "lon", "inn_price", "map_price", "tp_cost", "items"})
db:create_table("users",
"id INTEGER PRIMARY KEY AUTOINCREMENT",
"username TEXT NOT NULL",
"password TEXT NOT NULL",
"email TEXT NOT NULL",
"verified INTEGER NOT NULL DEFAULT 0",
"verify_token TEXT NOT NULL DEFAULT ''",
"registered DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP",
"last_login DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP",
"auth INTEGER NOT NULL DEFAULT 0",
"lat INTEGER NOT NULL DEFAULT 0",
"lon INTEGER NOT NULL DEFAULT 0",
"class_id INTEGER NOT NULL DEFAULT 1",
"currently TEXT NOT NULL DEFAULT 'In Town'",
"fighting INTEGER NOT NULL default 0",
"monster_id INTEGER NOT NULL default 0",
"monster_hp INTEGER NOT NULL default 0",
"monster_sleep INTEGER NOT NULL default 0",
"monster_immune INTEGER NOT NULL default 0",
"uber_dmg INTEGER NOT NULL default 0",
"uber_def INTEGER NOT NULL default 0",
"hp INTEGER NOT NULL default 15",
"mp INTEGER NOT NULL default 0",
"tp INTEGER NOT NULL default 10",
"max_hp INTEGER NOT NULL default 15",
"max_mp INTEGER NOT NULL default 0",
"max_tp INTEGER NOT NULL default 10",
"level INTEGER NOT NULL default 1",
"gold INTEGER NOT NULL default 100",
"exp INTEGER NOT NULL default 0",
"gold_bonus INTEGER NOT NULL default 0",
"exp_bonus INTEGER NOT NULL default 0",
"strength INTEGER NOT NULL default 5",
"dexterity INTEGER NOT NULL default 5",
"attack INTEGER NOT NULL default 5",
"defense INTEGER NOT NULL default 5",
"weapon_id INTEGER NOT NULL default 0",
"armor_id INTEGER NOT NULL default 0",
"shield_id INTEGER NOT NULL default 0",
"slot_1_id INTEGER NOT NULL default 0",
"slot_2_id INTEGER NOT NULL default 0",
"slot_3_id INTEGER NOT NULL default 0",
"weapon_name TEXT NOT NULL default 'None'",
"armor_name TEXT NOT NULL default 'None'",
"shield_name TEXT NOT NULL default 'None'",
"slot_1_name TEXT NOT NULL default 'None'",
"slot_2_name TEXT NOT NULL default 'None'",
"slot_3_name TEXT NOT NULL default 'None'",
"drop_code INTEGER NOT NULL default 0",
"spells TEXT NOT NULL default '0'",
"maps TEXT NOT NULL default '0'"
)
local time = math.roundto(microtime(true) - start, 4)
return "Complete! Took "..time.." seconds!"