commit 153ff6d787dfd6116af32d6ad0aa4517a60acbc3 Author: Sky Johnson Date: Thu May 8 23:22:17 2025 -0500 first commit diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..acd6b19 --- /dev/null +++ b/config.lua @@ -0,0 +1,21 @@ +server = { + port = 3117, + debug = false, + log_level = "info", + http_logging = false +} + +runner = { + pool_size = 0 -- 0 defaults to GOMAXPROCS +} + +dirs = { + routes = "routes", + static = "public", + fs = "fs", + data = "data", + override = "override", + libs = { + "libs" + } +} \ No newline at end of file diff --git a/data/dk.db b/data/dk.db new file mode 100644 index 0000000..7a22b1d Binary files /dev/null and b/data/dk.db differ diff --git a/moonshark b/moonshark new file mode 100755 index 0000000..b29a060 Binary files /dev/null and b/moonshark differ diff --git a/routes/install/first/get.lua b/routes/install/first/get.lua new file mode 100644 index 0000000..eb2cdbf --- /dev/null +++ b/routes/install/first/get.lua @@ -0,0 +1,14 @@ +http.set_content_type("text/html") +return [[ + + + Dragon Knight Installation + + + + Dragon Knight Installation: Page One

+ Installation for Dragon Knight is a simple two-step process: set up the database tables, then create the admin user. After that, you're done.

+ + + +]] \ No newline at end of file diff --git a/routes/install/second/get.lua b/routes/install/second/get.lua new file mode 100644 index 0000000..724a8d6 --- /dev/null +++ b/routes/install/second/get.lua @@ -0,0 +1,273 @@ +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", { + id = 1, + 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 ''" +) + +local drops_data = { + {id = 1, name = "Life Pebble", level = 1, type = 1, attribute_1 = "maxhp,10", attribute_2 = ""}, + {id = 2, name = "Life Stone", level = 10, type = 1, attribute_1 = "maxhp,25", attribute_2 = ""}, + {id = 3, name = "Life Rock", level = 25, type = 1, attribute_1 = "maxhp,50", attribute_2 = ""}, + {id = 4, name = "Magic Pebble", level = 1, type = 1, attribute_1 = "maxmp,10", attribute_2 = ""}, + {id = 5, name = "Magic Stone", level = 10, type = 1, attribute_1 = "maxmp,25", attribute_2 = ""}, + {id = 6, name = "Magic Rock", level = 25, type = 1, attribute_1 = "maxmp,50", attribute_2 = ""}, + {id = 7, name = "Dragon's Scale", level = 10, type = 1, attribute_1 = "defensepower,25", attribute_2 = ""}, + {id = 8, name = "Dragon's Plate", level = 30, type = 1, attribute_1 = "defensepower,50", attribute_2 = ""}, + {id = 9, name = "Dragon's Claw", level = 10, type = 1, attribute_1 = "attackpower,25", attribute_2 = ""}, + {id = 10, name = "Dragon's Tooth", level = 30, type = 1, attribute_1 = "attackpower,50", attribute_2 = ""}, + {id = 11, name = "Dragon's Tear", level = 35, type = 1, attribute_1 = "strength,50", attribute_2 = ""}, + {id = 12, name = "Dragon's Wing", level = 35, type = 1, attribute_1 = "dexterity,50", attribute_2 = ""}, + {id = 13, name = "Demon's Sin", level = 35, type = 1, attribute_1 = "maxhp,-50", attribute_2 = "strength,50"}, + {id = 14, name = "Demon's Fall", level = 35, type = 1, attribute_1 = "maxmp,-50", attribute_2 = "strength,50"}, + {id = 15, name = "Demon's Lie", level = 45, type = 1, attribute_1 = "maxhp,-100", attribute_2 = "strength,100"}, + {id = 16, name = "Demon's Hate", level = 45, type = 1, attribute_1 = "maxmp,-100", attribute_2 = "strength,100"}, + {id = 17, name = "Angel's Joy", level = 25, type = 1, attribute_1 = "maxhp,25", attribute_2 = "strength,25"}, + {id = 18, name = "Angel's Rise", level = 30, type = 1, attribute_1 = "maxhp,50", attribute_2 = "strength,50"}, + {id = 19, name = "Angel's Truth", level = 35, type = 1, attribute_1 = "maxhp,75", attribute_2 = "strength,75"}, + {id = 20, name = "Angel's Love", level = 40, type = 1, attribute_1 = "maxhp,100", attribute_2 = "strength,100"}, + {id = 21, name = "Seraph's Joy", level = 25, type = 1, attribute_1 = "maxmp,25", attribute_2 = "dexterity,25"}, + {id = 22, name = "Seraph's Rise", level = 30, type = 1, attribute_1 = "maxmp,50", attribute_2 = "dexterity,50"}, + {id = 23, name = "Seraph's Truth", level = 35, type = 1, attribute_1 = "maxmp,75", attribute_2 = "dexterity,75"}, + {id = 24, name = "Seraph's Love", level = 40, type = 1, attribute_1 = "maxmp,100", attribute_2 = "dexterity,100"}, + {id = 25, name = "Ruby", level = 50, type = 1, attribute_1 = "maxhp,150", attribute_2 = ""}, + {id = 26, name = "Pearl", level = 50, type = 1, attribute_1 = "maxmp,150", attribute_2 = ""}, + {id = 27, name = "Emerald", level = 50, type = 1, attribute_1 = "strength,150", attribute_2 = ""}, + {id = 28, name = "Topaz", level = 50, type = 1, attribute_1 = "dexterity,150", attribute_2 = ""}, + {id = 29, name = "Obsidian", level = 50, type = 1, attribute_1 = "attackpower,150", attribute_2 = ""}, + {id = 30, name = "Diamond", level = 50, type = 1, attribute_1 = "defensepower,150", attribute_2 = ""}, + {id = 31, name = "Memory Drop", level = 5, type = 1, attribute_1 = "expbonus,10", attribute_2 = ""}, + {id = 32, name = "Fortune Drop", level = 5, type = 1, attribute_1 = "goldbonus,10", attribute_2 = ""} +} + +db:insert("drops", drops_data) + +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 ''" +) + +local items_data = { + {id = 1, type = 1, name = "Stick", value = 10, attribute = 2, special = ""}, + {id = 2, type = 1, name = "Branch", value = 30, attribute = 4, special = ""}, + {id = 3, type = 1, name = "Club", value = 40, attribute = 5, special = ""}, + {id = 4, type = 1, name = "Dagger", value = 90, attribute = 8, special = ""}, + {id = 5, type = 1, name = "Hatchet", value = 150, attribute = 12, special = ""}, + {id = 6, type = 1, name = "Axe", value = 200, attribute = 16, special = ""}, + {id = 7, type = 1, name = "Brand", value = 300, attribute = 25, special = ""}, + {id = 8, type = 1, name = "Poleaxe", value = 500, attribute = 35, special = ""}, + {id = 9, type = 1, name = "Broadsword", value = 800, attribute = 45, special = ""}, + {id = 10, type = 1, name = "Battle Axe", value = 1200, attribute = 50, special = ""}, + {id = 11, type = 1, name = "Claymore", value = 2000, attribute = 60, special = ""}, + {id = 12, type = 1, name = "Dark Axe", value = 3000, attribute = 100, special = "expbonus,-5"}, + {id = 13, type = 1, name = "Dark Sword", value = 4500, attribute = 125, special = "expbonus,-10"}, + {id = 14, type = 1, name = "Bright Sword", value = 6000, attribute = 100, special = "expbonus,10"}, + {id = 15, type = 1, name = "Magic Sword", value = 10000, attribute = 150, special = "maxmp,50"}, + {id = 16, type = 1, name = "Destiny Blade", value = 50000, attribute = 250, special = "strength,50"}, + {id = 17, type = 2, name = "Skivvies", value = 25, attribute = 2, special = "goldbonus,10"}, + {id = 18, type = 2, name = "Clothes", value = 50, attribute = 5, special = ""}, + {id = 19, type = 2, name = "Leather Armor", value = 75, attribute = 10, special = ""}, + {id = 20, type = 2, name = "Hard Leather Armor", value = 150, attribute = 25, special = ""}, + {id = 21, type = 2, name = "Chain Mail", value = 300, attribute = 30, special = ""}, + {id = 22, type = 2, name = "Bronze Plate", value = 900, attribute = 50, special = ""}, + {id = 23, type = 2, name = "Iron Plate", value = 2000, attribute = 100, special = ""}, + {id = 24, type = 2, name = "Magic Armor", value = 4000, attribute = 125, special = "maxmp,50"}, + {id = 25, type = 2, name = "Dark Armor", value = 5000, attribute = 150, special = "expbonus,-10"}, + {id = 26, type = 2, name = "Bright Armor", value = 10000, attribute = 175, special = "expbonus,10"}, + {id = 27, type = 2, name = "Destiny Raiment", value = 50000, attribute = 200, special = "dexterity,50"}, + {id = 28, type = 3, name = "Reed Shield", value = 50, attribute = 2, special = ""}, + {id = 29, type = 3, name = "Buckler", value = 100, attribute = 4, special = ""}, + {id = 30, type = 3, name = "Small Shield", value = 500, attribute = 10, special = ""}, + {id = 31, type = 3, name = "Large Shield", value = 2500, attribute = 30, special = ""}, + {id = 32, type = 3, name = "Silver Shield", value = 10000, attribute = 60, special = ""}, + {id = 33, type = 3, name = "Destiny Aegis", value = 25000, attribute = 100, special = "maxhp,50"} +} + +db:insert("items", items_data) + +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: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" +) + +local spells_data = { + {id = 1, name = "Heal", mp = 5, power = 10, type = 1}, + {id = 2, name = "Revive", mp = 10, power = 25, type = 1}, + {id = 3, name = "Life", mp = 25, power = 50, type = 1}, + {id = 4, name = "Breath", mp = 50, power = 100, type = 1}, + {id = 5, name = "Gaia", mp = 75, power = 150, type = 1}, + {id = 6, name = "Hurt", mp = 5, power = 15, type = 2}, + {id = 7, name = "Pain", mp = 12, power = 35, type = 2}, + {id = 8, name = "Maim", mp = 25, power = 70, type = 2}, + {id = 9, name = "Rend", mp = 40, power = 100, type = 2}, + {id = 10, name = "Chaos", mp = 50, power = 130, type = 2}, + {id = 11, name = "Sleep", mp = 10, power = 5, type = 3}, + {id = 12, name = "Dream", mp = 30, power = 9, type = 3}, + {id = 13, name = "Nightmare", mp = 60, power = 13, type = 3}, + {id = 14, name = "Craze", mp = 10, power = 10, type = 4}, + {id = 15, name = "Rage", mp = 20, power = 25, type = 4}, + {id = 16, name = "Fury", mp = 30, power = 50, type = 4}, + {id = 17, name = "Ward", mp = 10, power = 10, type = 5}, + {id = 18, name = "Fend", mp = 20, power = 25, type = 5}, + {id = 19, name = "Barrier", mp = 30, power = 50, type = 5} +} + +db:insert("spells", spells_data) + +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" +) + +local towns_data = { + {id = 1, name = "Midworld", lat = 0, lon = 0, inn_price = 5, map_price = 0, tp_cost = 0, items = "1,2,3,17,18,19,28,29"}, + {id = 2, name = "Roma", lat = 30, lon = 30, inn_price = 10, map_price = 25, tp_cost = 5, items = "2,3,4,18,19,29"}, + {id = 3, name = "Bris", lat = 70, lon = -70, inn_price = 25, map_price = 50, tp_cost = 15, items = "2,3,4,5,18,19,20,29.30"}, + {id = 4, name = "Kalle", lat = -100, lon = 100, inn_price = 40, map_price = 100, tp_cost = 30, items = "5,6,8,10,12,21,22,23,29,30"}, + {id = 5, name = "Narcissa", lat = -130, lon = -130, inn_price = 60, map_price = 500, tp_cost = 50, items = "4,7,9,11,13,21,22,23,29,30,31"}, + {id = 6, name = "Hambry", lat = 170, lon = 170, inn_price = 90, map_price = 1000, tp_cost = 80, items = "10,11,12,13,14,23,24,30,31"}, + {id = 7, name = "Gilead", lat = 200, lon = -200, inn_price = 100, map_price = 3000, tp_cost = 110, items = "12,13,14,15,24,25,26,32"}, + {id = 8, name = "Endworld", lat = -250, lon = -250, inn_price = 125, map_price = 9000, tp_cost = 160, items = "16,27,33"} +} + +db:insert("towns", towns_data) + +db:create_table("users", + "id INTEGER PRIMARY KEY AUTOINCREMENT", + "username TEXT NOT NULL", + "password TEXT NOT NULL", + "email TEXT NOT NULL", + "verify TEXT NOT NULL default ''", + "regdate datetime NOT NULL default CURRENT_TIMESTAMP", + "onlinetime datetime NOT NULL default CURRENT_TIMESTAMP", + "authlevel INTEGER NOT NULL default 0", + "latitude INTEGER NOT NULL default 0", + "longitude INTEGER NOT NULL default 0", + "charclass INTEGER NOT NULL default 0", + "currentaction TEXT NOT NULL default 'In Town'", + "currentfight INTEGER NOT NULL default 0", + "currentmonster INTEGER NOT NULL default 0", + "currentmonsterhp INTEGER NOT NULL default 0", + "currentmonstersleep INTEGER NOT NULL default 0", + "currentmonsterimmune INTEGER NOT NULL default 0", + "currentuberdamage INTEGER NOT NULL default 0", + "currentuberdefense INTEGER NOT NULL default 0", + "currenthp INTEGER NOT NULL default 15", + "currentmp INTEGER NOT NULL default 0", + "currenttp INTEGER NOT NULL default 10", + "maxhp INTEGER NOT NULL default 15", + "maxmp INTEGER NOT NULL default 0", + "maxtp INTEGER NOT NULL default 10", + "level INTEGER NOT NULL default 1", + "gold INTEGER NOT NULL default 100", + "experience INTEGER NOT NULL default 0", + "goldbonus INTEGER NOT NULL default 0", + "expbonus INTEGER NOT NULL default 0", + "strength INTEGER NOT NULL default 5", + "dexterity INTEGER NOT NULL default 5", + "attackpower INTEGER NOT NULL default 5", + "defensepower INTEGER NOT NULL default 5", + "weaponid INTEGER NOT NULL default 0", + "armorid INTEGER NOT NULL default 0", + "shieldid INTEGER NOT NULL default 0", + "slot1id INTEGER NOT NULL default 0", + "slot2id INTEGER NOT NULL default 0", + "slot3id INTEGER NOT NULL default 0", + "weaponname TEXT NOT NULL default 'None'", + "armorname TEXT NOT NULL default 'None'", + "shieldname TEXT NOT NULL default 'None'", + "slot1name TEXT NOT NULL default 'None'", + "slot2name TEXT NOT NULL default 'None'", + "slot3name TEXT NOT NULL default 'None'", + "dropcode INTEGER NOT NULL default 0", + "spells TEXT NOT NULL default '0'", + "towns TEXT NOT NULL default '0'" +) \ No newline at end of file