consolidate database files, fix error messages for registration, town map shop list

This commit is contained in:
Sky Johnson 2025-08-28 15:21:46 -05:00
parent e9d1e12c8d
commit 73d946e011
8 changed files with 152 additions and 239 deletions

Binary file not shown.

View File

@ -56,7 +56,6 @@ type User struct {
Slot1Name string
Slot2Name string
Slot3Name string
Spells string
Towns string
}
@ -87,7 +86,6 @@ func New() *User {
Dexterity: 0,
Attack: 0,
Defense: 0,
Spells: "",
Towns: "",
}
}

View File

@ -94,7 +94,6 @@ func showRegister(ctx sushi.Ctx) {
components.RenderPage(ctx, "Register", "auth/register.html", map[string]any{
"username": username,
"email": email,
"error_message": sess.GetFlashMessage("error"),
"classes": allClasses,
})
}
@ -115,23 +114,20 @@ func processRegister(ctx sushi.Ctx) {
sess := ctx.GetCurrentSession()
if err := validateRegistration(username, email, userPassword, confirmPassword); err != nil {
fmt.Println("Error occured: " + err.Error())
setFlashAndFormData(ctx, err.Error(), formData)
ctx.Redirect("/register")
return
}
// Check if username already exists
if _, err := users.ByUsername(username); err != nil {
fmt.Println("Username already exists")
if _, err := users.ByUsername(username); err == nil {
setFlashAndFormData(ctx, "Username already exists", formData)
ctx.Redirect("/register")
return
}
// Check if email already exists
if _, err := users.ByEmail(email); err != nil {
fmt.Println("Email already exists")
if _, err := users.ByEmail(email); err == nil {
setFlashAndFormData(ctx, "Email already registered", formData)
ctx.Redirect("/register")
return
@ -140,7 +136,6 @@ func processRegister(ctx sushi.Ctx) {
// Ensure class ID exists (should always, unless someone modified the form)
class, err := classes.Find(classID)
if err != nil {
fmt.Println("Invalid class ID")
setFlashAndFormData(ctx, "Invalid class selected", formData)
ctx.Redirect("/register")
return

View File

@ -248,7 +248,7 @@ func showThread(ctx sushi.Ctx) {
}
components.RenderPage(ctx, threadData.Title, "forum/thread.html", map[string]any{
"thread": threadData,
"thread": &threadData,
"replies": replies,
"currentPage": pagination.Page,
"totalPages": pagination.TotalPages(),

View File

@ -200,22 +200,25 @@ func buyItem(ctx sushi.Ctx) {
}
func showMaps(ctx sushi.Ctx) {
sess := ctx.GetCurrentSession()
var errorHTML string
errorMsg := sess.GetFlashMessage("error")
if errorMsg != "" {
errorHTML = `<div style="color: red; margin-bottom: 1rem;">` + errorMsg + "</div>"
}
user := ctx.UserValue("user").(*users.User)
town := ctx.UserValue("town").(*towns.Town)
towns, _ := towns.All()
var mapList []*Map
for _, town := range towns {
mapList = append(mapList, &Map{
ID: town.ID,
Name: town.Name,
Cost: town.MapCost,
Owned: user.HasTownMap(town.ID),
X: town.X, Y: town.Y,
TP: town.TPCost,
})
}
components.RenderPage(ctx, town.Name+" Maps", "town/maps.html", map[string]any{
"town": town,
"towns": towns,
"error_message": errorHTML,
"maplist": mapList,
})
}

View File

@ -9,48 +9,6 @@ CREATE TABLE babble (
`babble` TEXT NOT NULL
);
DROP TABLE IF EXISTS drops;
CREATE TABLE drops (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`name` TEXT NOT NULL,
`level` INTEGER NOT NULL DEFAULT 0,
`type` INTEGER NOT NULL DEFAULT 0,
`att` TEXT NOT NULL DEFAULT ''
);
INSERT INTO drops VALUES
(1, 'Life Pebble', 1, 1, 'maxhp,10'),
(2, 'Life Stone', 10, 1, 'maxhp,25'),
(3, 'Life Rock', 25, 1, 'maxhp,50'),
(4, 'Magic Pebble', 1, 1, 'maxmp,10'),
(5, 'Magic Stone', 10, 1, 'maxmp,25'),
(6, 'Magic Rock', 25, 1, 'maxmp,50'),
(7, 'Dragon''s Scale', 10, 1, 'defensepower,25'),
(8, 'Dragon''s Plate', 30, 1, 'defensepower,50'),
(9, 'Dragon''s Claw', 10, 1, 'attackpower,25'),
(10, 'Dragon''s Tooth', 30, 1, 'attackpower,50'),
(11, 'Dragon''s Tear', 35, 1, 'strength,50'),
(12, 'Dragon''s Wing', 35, 1, 'dexterity,50'),
(13, 'Demon''s Sin', 35, 1, 'maxhp,-50,strength,50'),
(14, 'Demon''s Fall', 35, 1, 'maxmp,-50,strength,50'),
(15, 'Demon''s Lie', 45, 1, 'maxhp,-100,strength,100'),
(16, 'Demon''s Hate', 45, 1, 'maxmp,-100,strength,100'),
(17, 'Angel''s Joy', 25, 1, 'maxhp,25,strength,25'),
(18, 'Angel''s Rise', 30, 1, 'maxhp,50,strength,50'),
(19, 'Angel''s Truth', 35, 1, 'maxhp,75,strength,75'),
(20, 'Angel''s Love', 40, 1, 'maxhp,100,strength,100'),
(21, 'Seraph''s Joy', 25, 1, 'maxmp,25,dexterity,25'),
(22, 'Seraph''s Rise', 30, 1, 'maxmp,50,dexterity,50'),
(23, 'Seraph''s Truth', 35, 1, 'maxmp,75,dexterity,75'),
(24, 'Seraph''s Love', 40, 1, 'maxmp,100,dexterity,100'),
(25, 'Ruby', 50, 1, 'maxhp,150'),
(26, 'Pearl', 50, 1, 'maxmp,150'),
(27, 'Emerald', 50, 1, 'strength,150'),
(28, 'Topaz', 50, 1, 'dexterity,150'),
(29, 'Obsidian', 50, 1, 'attackpower,150'),
(30, 'Diamond', 50, 1, 'defensepower,150'),
(31, 'Memory Drop', 5, 1, 'expbonus,10'),
(32, 'Fortune Drop', 5, 1, 'goldbonus,10');
DROP TABLE IF EXISTS forum;
CREATE TABLE forum (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
@ -260,31 +218,53 @@ INSERT INTO news (content) VALUES ('This is the first news post. Please use the
DROP TABLE IF EXISTS spells;
CREATE TABLE spells (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`type` INTEGER NOT NULL DEFAULT 0,
`name` TEXT NOT NULL,
`lore` TEXT DEFAULT '',
`icon` TEXT DEFAULT '',
`mp` INTEGER NOT NULL DEFAULT 0,
`attribute` INTEGER NOT NULL DEFAULT 0,
`type` INTEGER NOT NULL DEFAULT 0
`power` INTEGER NOT NULL DEFAULT 0
);
-- Types: 0 (Heal), 1 (Damage), 2 (Sleep), 3 (Uber Attack), 4 (Uber Defense)
INSERT INTO spells VALUES
(1, 'Heal', 5, 10, 1),
(2, 'Revive', 10, 25, 1),
(3, 'Life', 25, 50, 1),
(4, 'Breath', 50, 100, 1),
(5, 'Gaia', 75, 150, 1),
(6, 'Hurt', 5, 15, 2),
(7, 'Pain', 12, 35, 2),
(8, 'Maim', 25, 70, 2),
(9, 'Rend', 40, 100, 2),
(10, 'Chaos', 50, 130, 2),
(11, 'Sleep', 10, 5, 3),
(12, 'Dream', 30, 9, 3),
(13, 'Nightmare', 60, 13, 3),
(14, 'Craze', 10, 10, 4),
(15, 'Rage', 20, 25, 4),
(16, 'Fury', 30, 50, 4),
(17, 'Ward', 10, 10, 5),
(18, 'Fend', 20, 25, 5),
(19, 'Barrier', 30, 50, 5);
(1, 0, 'Heal', '', '', 5, 10),
(2, 0, 'Revive', '', '', 10, 25),
(3, 0, 'Life', '', '', 25, 50),
(4, 0, 'Breath', '', '', 50, 100),
(5, 0, 'Gaia', '', '', 75, 150),
(6, 1, 'Hurt', '', '', 5, 15),
(7, 1, 'Pain', '', '', 12, 35),
(8, 1, 'Maim', '', '', 25, 70),
(9, 1, 'Rend', '', '', 40, 100),
(10, 1, 'Chaos', '', '', 50, 130),
(11, 2, 'Sleep', '', '', 10, 5),
(12, 2, 'Dream', '', '', 30, 9),
(13, 2, 'Nightmare', '', '', 60, 13),
(14, 3, 'Craze', '', '', 10, 10),
(15, 3, 'Rage', '', '', 20, 25),
(16, 3, 'Fury', '', '', 30, 50),
(17, 4, 'Ward', '', '', 10, 10),
(18, 4, 'Fend', '', '', 20, 25),
(19, 4, 'Barrier', '', '', 30, 50),
(20, 2, 'Spark', 'Small jolt of electric energy.', '', 5, 10),
(21, 2, 'Firebolt', 'Blast of concentrated fire.', '', 10, 30),
(22, 2, 'Geyser', 'Explosion of high-pressure water.', '', 15, 60),
(23, 2, 'Magic Missile', 'Fast, tracking bolt of arcane force.', '', 20, 85);
CREATE TABLE spell_unlocks (
`spell_id` INTEGER NOT NULL,
`class_id` INTEGER NOT NULL,
`level` INTEGER NOT NULL
);
INSERT INTO spell_unlocks VALUES
(1, 1, 3), (6, 1, 3), (11, 1, 7), (14, 1, 7), (17, 1, 7),
(20, 2, 1), (21, 2, 5), (22, 2, 12), (23, 2, 22), (11, 2, 7), (17, 2, 10), (19, 2, 24),
(1, 4, 1), (2, 4, 5), (3, 4, 10), (4, 4, 20);
CREATE TABLE user_spells (
`user_id` INTEGER NOT NULL,
`spell_id` INTEGER NOT NULL
);
DROP TABLE IF EXISTS towns;
CREATE TABLE towns (
@ -310,9 +290,9 @@ INSERT INTO towns VALUES
DROP TABLE IF EXISTS users;
CREATE TABLE users (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`username` TEXT NOT NULL,
`username` TEXT NOT NULL UNIQUE,
`password` TEXT NOT NULL,
`email` TEXT NOT NULL,
`email` TEXT NOT NULL UNIQUE,
`verified` INTEGER NOT NULL DEFAULT 0,
`token` TEXT NOT NULL DEFAULT '',
`registered` INTEGER NOT NULL DEFAULT (unixepoch()),
@ -350,7 +330,6 @@ CREATE TABLE users (
`slot_1_name` TEXT NOT NULL DEFAULT '',
`slot_2_name` TEXT NOT NULL DEFAULT '',
`slot_3_name` TEXT NOT NULL DEFAULT '',
`spells` TEXT NOT NULL DEFAULT '',
`towns` TEXT NOT NULL DEFAULT ''
);
@ -386,4 +365,87 @@ CREATE TABLE fight_logs (
`created` INTEGER NOT NULL DEFAULT (unixepoch())
);
DROP TABLE IF EXISTS items;
CREATE TABLE items (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`type` INTEGER NOT NULL DEFAULT 1,
`name` TEXT NOT NULL,
`lore` TEXT DEFAULT '',
`value` INTEGER NOT NULL DEFAULT 0,
`attack` INTEGER NOT NULL DEFAULT 0,
`defense` INTEGER NOT NULL DEFAULT 0,
`strength` INTEGER NOT NULL DEFAULT 0,
`dexterity` INTEGER NOT NULL DEFAULT 0,
`max_hp` INTEGER NOT NULL DEFAULT 0,
`max_mp` INTEGER NOT NULL DEFAULT 0,
`exp_bonus` INTEGER NOT NULL DEFAULT 0,
`gold_bonus` INTEGER NOT NULL DEFAULT 0,
`special` TEXT NOT NULL DEFAULT ''
);
INSERT INTO items VALUES
(1, 1, 'Stick', 'Just a stick.', 10, 2, 0, 0, 0, 0, 0, 0, 0, ''),
(2, 1, 'Branch', 'Slightly larger stick.', 30, 4, 0, 0, 0, 0, 0, 0, 0, ''),
(3, 1, 'Club', 'Much larger stick.', 40, 5, 0, 0, 0, 0, 0, 0, 0, ''),
(4, 1, 'Dagger', 'Well-crafted knife.', 90, 8, 0, 0, 0, 0, 0, 0, 0, ''),
(5, 1, 'Hatchet', 'A smaller, sharpened axe.', 150, 12, 0, 0, 0, 0, 0, 0, 0, ''),
(6, 1, 'Axe', 'Full-sized, razor-sharp axe.', 200, 16, 0, 0, 0, 0, 0, 0, 0, ''),
(7, 1, 'Brand', 'An oddly-shaped, large knife.', 300, 25, 0, 0, 0, 0, 0, 0, 0, ''),
(8, 1, 'Poleaxe', 'A weighty axe on a long stick.', 500, 35, 0, 0, 0, 0, 0, 0, 0, ''),
(9, 1, 'Broadsword', 'Thick and heavy sword.', 800, 45, 0, 0, 0, 0, 0, 0, 0, ''),
(10, 1, 'Battle Axe', 'A large axe with spikes on the rear for catching armor.', 1200, 50, 0, 0, 0, 0, 0, 0, 0, ''),
(11, 1, 'Claymore', 'A very long sword made for cleaving through armor.', 2000, 60, 0, 0, 0, 0, 0, 0, 0, ''),
(12, 1, 'Dark Axe', 'Cursed axe with a dark aura - seems to be sharper than most, but strangely draining.', 3000, 100, 0, 0, 0, 0, 0, -5, 0, ''),
(13, 1, 'Dark Sword', 'Exceptionally sharp sword. The blade seems to shine with malice - you can feel it absorbing some of your will.', 4500, 125, 0, 0, 0, 0, 0, -10, 0, ''),
(14, 1, 'Bright Sword', 'The golden hilt and silver blade make this sword shine in the sun. Defeating enemies with it makes you feel fulfilled.', 6000, 100, 0, 0, 0, 0, 0, 10, 0, ''),
(15, 1, 'Magic Sword', 'One of Gilead''s mass-produced mage blades. Crafted with skill, enchanted by apprentices.', 10000, 150, 0, 0, 0, 0, 50, 0, 0, ''),
(16, 1, 'Destiny Blade', 'The sword that cleaves through demons like butter; a lost relic from humanity''s champion. Its immense strength is palpable.', 50000, 250, 0, 50, 0, 0, 0, 5, 5, ''),
(17, 2, 'Skivvies', 'Underwear! Plain and simple.', 25, 0, 2, 0, 0, 0, 0, 0, 10, ''),
(18, 2, 'Clothes', 'Standard working attire.', 50, 0, 5, 0, 0, 0, 0, 0, 0, ''),
(19, 2, 'Leather Armor', 'Basic protection provided by supple hide.', 75, 0, 10, 0, 0, 0, 0, 0, 0, ''),
(20, 2, 'Studded Armor', 'Leather armor enhanced with small metal buckles.', 150, 0, 25, 0, 0, 0, 0, 0, 0, ''),
(21, 2, 'Chain Mail', 'Iron links, pieced together to form a dense shirt.', 300, 0, 30, 0, 0, 0, 0, 0, 0, ''),
(22, 2, 'Bronze Plate', 'Pieces of bronze formed to your vital areas, secured with leather straps.', 900, 0, 50, 0, 0, 0, 0, 0, 0, ''),
(23, 2, 'Iron Plate', 'Stronger and slightly lighter than bronze plates.', 2000, 0, 100, 0, 0, 0, 0, 0, 0, ''),
(24, 2, 'Magic Armor', 'Steel armor crafted by the skilled artisans of Gilead, enchanted by apprentices.', 4000, 0, 125, 0, 0, 0, 50, 0, 0, ''),
(25, 2, 'Dark Armor', 'Armor that feels unnaturally heavy, although it also feels unnaturaly safe.', 5000, 0, 150, 0, 0, 0, 0, -10, 0, ''),
(26, 2, 'Bright Armor', 'These plates reflect the suns rays. You seem to understand your enemies attacks easier in it.', 10000, 0, 120, 0, 0, 0, 0, 10, 0, ''),
(27, 2, 'Destiny Raiment', 'A dazzling array of fabric and engineering layered over steel alloy. Despite the wars it has seen, it bears no scars.', 50000, 0, 200, 0, 50, 0, 0, 5, 5, ''),
(28, 3, 'Reed Shield', 'Stiff river reeds. Dried, cured, strapped together with twine.', 50, 0, 2, 0, 0, 0, 0, 0, 0, ''),
(29, 3, 'Buckler', 'Planks of wood cleaned up and formed into a small, round shield.', 100, 0, 4, 0, 0, 0, 0, 0, 0, ''),
(30, 3, 'Small Shield', 'Cedar is treated to withstand impacts, then bonded together with rivets.', 500, 0, 10, 0, 0, 0, 0, 0, 0, ''),
(31, 3, 'Tower Shield', 'A very heavy, tall shield built to withstand might blows.', 2500, 0, 30, 0, 0, 0, 0, 0, 0, ''),
(32, 3, 'Silver Shield', 'Surprisingly sturdy, this gleaming shield lets attacks bounce right off.', 10000, 0, 60, 0, 0, 0, 0, 0, 0, ''),
(33, 3, 'Destiny Aegis', 'An exquisite piece of forging, it is surprisingly light. Impacts seem to be absorbed into nothing.', 25000, 0, 100, 0, 0, 50, 0, 5, 5, ''),
(34, 4, 'Life Pebble', 'Shiny green rock. Seems to put a spring in your step.', 0, 0, 0, 0, 0, 10, 0, 0, 0, ''),
(35, 4, 'Life Stone', 'Glistening green rock. You feel energized with it.', 0, 0, 0, 0, 0, 25, 0, 0, 0, ''),
(36, 4, 'Life Rock', 'Polished green rock. You feel as if you''ll live longer with it.', 0, 0, 0, 0, 0, 50, 0, 0, 0, ''),
(37, 4, 'Magic Pebble', 'Shiny blue rock. You feel at ease with it.', 0, 0, 0, 0, 0, 0, 10, 0, 0, ''),
(38, 4, 'Magic Stone', 'Glistening blue rock. It feels like it gives you clarity.', 0, 0, 0, 0, 0, 0, 25, 0, 0, ''),
(39, 4, 'Magic Rock', 'Polished blue rock. It seems to hum in your mind.', 0, 0, 0, 0, 0, 0, 50, 0, 0, ''),
(40, 4, 'Dragon''s Scale', 'A scale from a young dragon.', 0, 0, 25, 0, 0, 0, 0, 0, 0, ''),
(41, 4, 'Dragon''s Plate', 'A piece of the ridge of an adult dragon.', 0, 0, 50, 0, 0, 0, 0, 0, 0, ''),
(42, 4, 'Dragon''s Claw', 'A claw taken from a dragon.', 0, 25, 0, 0, 0, 0, 0, 0, 0, ''),
(43, 4, 'Dragon''s Tooth', 'A fang ripped from a dragon.', 0, 50, 0, 0, 0, 0, 0, 0, 0, ''),
(44, 4, 'Dragon''s Tear', 'A sad reminder of a dragon''s death.', 0, 0, 0, 50, 0, 0, 0, 0, 0, ''),
(45, 4, 'Dragon''s Wing', 'A flap of leather from a dragon''s wing.', 0, 0, 0, 0, 50, 0, 0, 0, 0, ''),
(46, 4, 'Demon''s Sin', 'The demons sin; sacrificing life for power.', 0, 0, 0, 50, 0, -50, 0, 0, 0, ''),
(47, 4, 'Demon''s Fall', 'The demons failure; sacrificing wisdom for strength.', 0, 0, 0, 50, 0, 0, -50, 0, 0, ''),
(48, 4, 'Demon''s Lie', 'The demons lie; power is more valuable than life.', 0, 0, 0, 100, 0, -100, 0, 0, 0, ''),
(49, 4, 'Demon''s Hate', 'The demons hate; the will of others.', 0, 0, 0, 100, 0, 0, -100, 0, 0, ''),
(50, 4, 'Angel''s Joy', 'The angels joy; the celebration of life.', 0, 0, 0, 25, 0, 25, 0, 0, 0, ''),
(51, 4, 'Angel''s Rise', 'The angels rise; growth begets strength.', 0, 0, 0, 50, 0, 50, 0, 0, 0, ''),
(52, 4, 'Angel''s Truth', 'The angels truth; all breath is valuable.', 0, 0, 0, 75, 0, 75, 0, 0, 0, ''),
(53, 4, 'Angel''s Love', 'The angels love; the protection of existence.', 0, 0, 0, 100, 0, 100, 0, 0, 0, ''),
(54, 4, 'Seraph''s Wisdom', 'The seraphs wisdom; meekness is strength.', 0, 0, 0, 0, 25, 0, 25, 0, 0, ''),
(55, 4, 'Seraph''s Strength', 'The seraphs strength; sharpness of mind and soul.', 0, 0, 0, 0, 50, 0, 50, 0, 0, ''),
(56, 4, 'Seraph''s Creed', 'The seraphs creed; the lust for power makes weak.', 0, 0, 0, 0, 75, 0, 75, 0, 0, ''),
(57, 4, 'Seraph''s Loyalty', 'The seraphs loyalty; to all creation.', 0, 0, 0, 0, 100, 0, 100, 0, 0, ''),
(58, 4, 'Ruby', 'A gorgeous red crystal.', 0, 0, 0, 0, 0, 150, 0, 0, 0, ''),
(59, 4, 'Pearl', 'A beautiful white crystal.', 0, 0, 0, 0, 0, 0, 150, 0, 0, ''),
(60, 4, 'Emerald', 'A mesmerizing green crystal.', 0, 0, 0, 150, 0, 0, 0, 0, 0, ''),
(61, 4, 'Topaz', 'A translucent orange crystal.', 0, 0, 0, 0, 150, 0, 0, 0, 0, ''),
(62, 4, 'Obsidian', 'A razor-sharp black crystal.', 0, 150, 0, 0, 0, 0, 0, 0, 0, ''),
(63, 4, 'Diamond', 'A shockingly tough blue crystal.', 0, 0, 150, 0, 0, 0, 0, 0, 0, ''),
(64, 4, 'Memory Drop', 'This swirling blue liquid comes from the Fount.', 0, 0, 0, 0, 0, 0, 0, 10, 0, ''),
(65, 4, 'Fortune Drop', 'This mysterious green, sparkly concoction comes from lands unknown.', 0, 0, 0, 0, 0, 0, 0, 0, 10, '');

View File

@ -1,88 +0,0 @@
-- Migration 2: rework items system
-- Created: 2025-08-25 10:50:50
DROP TABLE IF EXISTS drops;
DROP TABLE IF EXISTS items;
CREATE TABLE items (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`type` INTEGER NOT NULL DEFAULT 1,
`name` TEXT NOT NULL,
`lore` TEXT DEFAULT '',
`value` INTEGER NOT NULL DEFAULT 0,
`attack` INTEGER NOT NULL DEFAULT 0,
`defense` INTEGER NOT NULL DEFAULT 0,
`strength` INTEGER NOT NULL DEFAULT 0,
`dexterity` INTEGER NOT NULL DEFAULT 0,
`max_hp` INTEGER NOT NULL DEFAULT 0,
`max_mp` INTEGER NOT NULL DEFAULT 0,
`exp_bonus` INTEGER NOT NULL DEFAULT 0,
`gold_bonus` INTEGER NOT NULL DEFAULT 0,
`special` TEXT NOT NULL DEFAULT ''
);
INSERT INTO items VALUES
(1, 1, 'Stick', 'Just a stick.', 10, 2, 0, 0, 0, 0, 0, 0, 0, ''),
(2, 1, 'Branch', 'Slightly larger stick.', 30, 4, 0, 0, 0, 0, 0, 0, 0, ''),
(3, 1, 'Club', 'Much larger stick.', 40, 5, 0, 0, 0, 0, 0, 0, 0, ''),
(4, 1, 'Dagger', 'Well-crafted knife.', 90, 8, 0, 0, 0, 0, 0, 0, 0, ''),
(5, 1, 'Hatchet', 'A smaller, sharpened axe.', 150, 12, 0, 0, 0, 0, 0, 0, 0, ''),
(6, 1, 'Axe', 'Full-sized, razor-sharp axe.', 200, 16, 0, 0, 0, 0, 0, 0, 0, ''),
(7, 1, 'Brand', 'An oddly-shaped, large knife.', 300, 25, 0, 0, 0, 0, 0, 0, 0, ''),
(8, 1, 'Poleaxe', 'A weighty axe on a long stick.', 500, 35, 0, 0, 0, 0, 0, 0, 0, ''),
(9, 1, 'Broadsword', 'Thick and heavy sword.', 800, 45, 0, 0, 0, 0, 0, 0, 0, ''),
(10, 1, 'Battle Axe', 'A large axe with spikes on the rear for catching armor.', 1200, 50, 0, 0, 0, 0, 0, 0, 0, ''),
(11, 1, 'Claymore', 'A very long sword made for cleaving through armor.', 2000, 60, 0, 0, 0, 0, 0, 0, 0, ''),
(12, 1, 'Dark Axe', 'Cursed axe with a dark aura - seems to be sharper than most, but strangely draining.', 3000, 100, 0, 0, 0, 0, 0, -5, 0, ''),
(13, 1, 'Dark Sword', 'Exceptionally sharp sword. The blade seems to shine with malice - you can feel it absorbing some of your will.', 4500, 125, 0, 0, 0, 0, 0, -10, 0, ''),
(14, 1, 'Bright Sword', 'The golden hilt and silver blade make this sword shine in the sun. Defeating enemies with it makes you feel fulfilled.', 6000, 100, 0, 0, 0, 0, 0, 10, 0, ''),
(15, 1, 'Magic Sword', 'One of Gilead''s mass-produced mage blades. Crafted with skill, enchanted by apprentices.', 10000, 150, 0, 0, 0, 0, 50, 0, 0, ''),
(16, 1, 'Destiny Blade', 'The sword that cleaves through demons like butter; a lost relic from humanity''s champion. Its immense strength is palpable.', 50000, 250, 0, 50, 0, 0, 0, 5, 5, ''),
(17, 2, 'Skivvies', 'Underwear! Plain and simple.', 25, 0, 2, 0, 0, 0, 0, 0, 10, ''),
(18, 2, 'Clothes', 'Standard working attire.', 50, 0, 5, 0, 0, 0, 0, 0, 0, ''),
(19, 2, 'Leather Armor', 'Basic protection provided by supple hide.', 75, 0, 10, 0, 0, 0, 0, 0, 0, ''),
(20, 2, 'Studded Armor', 'Leather armor enhanced with small metal buckles.', 150, 0, 25, 0, 0, 0, 0, 0, 0, ''),
(21, 2, 'Chain Mail', 'Iron links, pieced together to form a dense shirt.', 300, 0, 30, 0, 0, 0, 0, 0, 0, ''),
(22, 2, 'Bronze Plate', 'Pieces of bronze formed to your vital areas, secured with leather straps.', 900, 0, 50, 0, 0, 0, 0, 0, 0, ''),
(23, 2, 'Iron Plate', 'Stronger and slightly lighter than bronze plates.', 2000, 0, 100, 0, 0, 0, 0, 0, 0, ''),
(24, 2, 'Magic Armor', 'Steel armor crafted by the skilled artisans of Gilead, enchanted by apprentices.', 4000, 0, 125, 0, 0, 0, 50, 0, 0, ''),
(25, 2, 'Dark Armor', 'Armor that feels unnaturally heavy, although it also feels unnaturaly safe.', 5000, 0, 150, 0, 0, 0, 0, -10, 0, ''),
(26, 2, 'Bright Armor', 'These plates reflect the suns rays. You seem to understand your enemies attacks easier in it.', 10000, 0, 120, 0, 0, 0, 0, 10, 0, ''),
(27, 2, 'Destiny Raiment', 'A dazzling array of fabric and engineering layered over steel alloy. Despite the wars it has seen, it bears no scars.', 50000, 0, 200, 0, 50, 0, 0, 5, 5, ''),
(28, 3, 'Reed Shield', 'Stiff river reeds. Dried, cured, strapped together with twine.', 50, 0, 2, 0, 0, 0, 0, 0, 0, ''),
(29, 3, 'Buckler', 'Planks of wood cleaned up and formed into a small, round shield.', 100, 0, 4, 0, 0, 0, 0, 0, 0, ''),
(30, 3, 'Small Shield', 'Cedar is treated to withstand impacts, then bonded together with rivets.', 500, 0, 10, 0, 0, 0, 0, 0, 0, ''),
(31, 3, 'Tower Shield', 'A very heavy, tall shield built to withstand might blows.', 2500, 0, 30, 0, 0, 0, 0, 0, 0, ''),
(32, 3, 'Silver Shield', 'Surprisingly sturdy, this gleaming shield lets attacks bounce right off.', 10000, 0, 60, 0, 0, 0, 0, 0, 0, ''),
(33, 3, 'Destiny Aegis', 'An exquisite piece of forging, it is surprisingly light. Impacts seem to be absorbed into nothing.', 25000, 0, 100, 0, 0, 50, 0, 5, 5, ''),
(34, 4, 'Life Pebble', 'Shiny green rock. Seems to put a spring in your step.', 0, 0, 0, 0, 0, 10, 0, 0, 0, ''),
(35, 4, 'Life Stone', 'Glistening green rock. You feel energized with it.', 0, 0, 0, 0, 0, 25, 0, 0, 0, ''),
(36, 4, 'Life Rock', 'Polished green rock. You feel as if you''ll live longer with it.', 0, 0, 0, 0, 0, 50, 0, 0, 0, ''),
(37, 4, 'Magic Pebble', 'Shiny blue rock. You feel at ease with it.', 0, 0, 0, 0, 0, 0, 10, 0, 0, ''),
(38, 4, 'Magic Stone', 'Glistening blue rock. It feels like it gives you clarity.', 0, 0, 0, 0, 0, 0, 25, 0, 0, ''),
(39, 4, 'Magic Rock', 'Polished blue rock. It seems to hum in your mind.', 0, 0, 0, 0, 0, 0, 50, 0, 0, ''),
(40, 4, 'Dragon''s Scale', 'A scale from a young dragon.', 0, 0, 25, 0, 0, 0, 0, 0, 0, ''),
(41, 4, 'Dragon''s Plate', 'A piece of the ridge of an adult dragon.', 0, 0, 50, 0, 0, 0, 0, 0, 0, ''),
(42, 4, 'Dragon''s Claw', 'A claw taken from a dragon.', 0, 25, 0, 0, 0, 0, 0, 0, 0, ''),
(43, 4, 'Dragon''s Tooth', 'A fang ripped from a dragon.', 0, 50, 0, 0, 0, 0, 0, 0, 0, ''),
(44, 4, 'Dragon''s Tear', 'A sad reminder of a dragon''s death.', 0, 0, 0, 50, 0, 0, 0, 0, 0, ''),
(45, 4, 'Dragon''s Wing', 'A flap of leather from a dragon''s wing.', 0, 0, 0, 0, 50, 0, 0, 0, 0, ''),
(46, 4, 'Demon''s Sin', 'The demons sin; sacrificing life for power.', 0, 0, 0, 50, 0, -50, 0, 0, 0, ''),
(47, 4, 'Demon''s Fall', 'The demons failure; sacrificing wisdom for strength.', 0, 0, 0, 50, 0, 0, -50, 0, 0, ''),
(48, 4, 'Demon''s Lie', 'The demons lie; power is more valuable than life.', 0, 0, 0, 100, 0, -100, 0, 0, 0, ''),
(49, 4, 'Demon''s Hate', 'The demons hate; the will of others.', 0, 0, 0, 100, 0, 0, -100, 0, 0, ''),
(50, 4, 'Angel''s Joy', 'The angels joy; the celebration of life.', 0, 0, 0, 25, 0, 25, 0, 0, 0, ''),
(51, 4, 'Angel''s Rise', 'The angels rise; growth begets strength.', 0, 0, 0, 50, 0, 50, 0, 0, 0, ''),
(52, 4, 'Angel''s Truth', 'The angels truth; all breath is valuable.', 0, 0, 0, 75, 0, 75, 0, 0, 0, ''),
(53, 4, 'Angel''s Love', 'The angels love; the protection of existence.', 0, 0, 0, 100, 0, 100, 0, 0, 0, ''),
(54, 4, 'Seraph''s Wisdom', 'The seraphs wisdom; meekness is strength.', 0, 0, 0, 0, 25, 0, 25, 0, 0, ''),
(55, 4, 'Seraph''s Strength', 'The seraphs strength; sharpness of mind and soul.', 0, 0, 0, 0, 50, 0, 50, 0, 0, ''),
(56, 4, 'Seraph''s Creed', 'The seraphs creed; the lust for power makes weak.', 0, 0, 0, 0, 75, 0, 75, 0, 0, ''),
(57, 4, 'Seraph''s Loyalty', 'The seraphs loyalty; to all creation.', 0, 0, 0, 0, 100, 0, 100, 0, 0, ''),
(58, 4, 'Ruby', 'A gorgeous red crystal.', 0, 0, 0, 0, 0, 150, 0, 0, 0, ''),
(59, 4, 'Pearl', 'A beautiful white crystal.', 0, 0, 0, 0, 0, 0, 150, 0, 0, ''),
(60, 4, 'Emerald', 'A mesmerizing green crystal.', 0, 0, 0, 150, 0, 0, 0, 0, 0, ''),
(61, 4, 'Topaz', 'A translucent orange crystal.', 0, 0, 0, 0, 150, 0, 0, 0, 0, ''),
(62, 4, 'Obsidian', 'A razor-sharp black crystal.', 0, 150, 0, 0, 0, 0, 0, 0, 0, ''),
(63, 4, 'Diamond', 'A shockingly tough blue crystal.', 0, 0, 150, 0, 0, 0, 0, 0, 0, ''),
(64, 4, 'Memory Drop', 'This swirling blue liquid comes from the Fount.', 0, 0, 0, 0, 0, 0, 0, 10, 0, ''),
(65, 4, 'Fortune Drop', 'This mysterious green, sparkly concoction comes from lands unknown.', 0, 0, 0, 0, 0, 0, 0, 0, 10, '');

View File

@ -1,57 +0,0 @@
-- Migration 3: new spell system
-- Created: 2025-08-25 22:13:03
DROP TABLE IF EXISTS spells;
CREATE TABLE spells (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`type` INTEGER NOT NULL DEFAULT 0,
`name` TEXT NOT NULL,
`lore` TEXT DEFAULT '',
`icon` TEXT DEFAULT '',
`mp` INTEGER NOT NULL DEFAULT 0,
`power` INTEGER NOT NULL DEFAULT 0
);
-- Types: 0 (Heal), 1 (Damage), 2 (Sleep), 3 (Uber Attack), 4 (Uber Defense)
INSERT INTO spells VALUES
(1, 0, 'Heal', '', '', 5, 10),
(2, 0, 'Revive', '', '', 10, 25),
(3, 0, 'Life', '', '', 25, 50),
(4, 0, 'Breath', '', '', 50, 100),
(5, 0, 'Gaia', '', '', 75, 150),
(6, 1, 'Hurt', '', '', 5, 15),
(7, 1, 'Pain', '', '', 12, 35),
(8, 1, 'Maim', '', '', 25, 70),
(9, 1, 'Rend', '', '', 40, 100),
(10, 1, 'Chaos', '', '', 50, 130),
(11, 2, 'Sleep', '', '', 10, 5),
(12, 2, 'Dream', '', '', 30, 9),
(13, 2, 'Nightmare', '', '', 60, 13),
(14, 3, 'Craze', '', '', 10, 10),
(15, 3, 'Rage', '', '', 20, 25),
(16, 3, 'Fury', '', '', 30, 50),
(17, 4, 'Ward', '', '', 10, 10),
(18, 4, 'Fend', '', '', 20, 25),
(19, 4, 'Barrier', '', '', 30, 50),
(20, 2, 'Spark', 'Small jolt of electric energy.', '', 5, 10),
(21, 2, 'Firebolt', 'Blast of concentrated fire.', '', 10, 30),
(22, 2, 'Geyser', 'Explosion of high-pressure water.', '', 15, 60),
(23, 2, 'Magic Missile', 'Fast, tracking bolt of arcane force.', '', 20, 85);
CREATE TABLE spell_unlocks (
`spell_id` INTEGER NOT NULL,
`class_id` INTEGER NOT NULL,
`level` INTEGER NOT NULL
);
-- Classes: 1 (Adventurer), 2 (Mage), 3 (Warrior), 4 (Paladin)
INSERT INTO spell_unlocks VALUES
(1, 1, 3), (6, 1, 3), (11, 1, 7), (14, 1, 7), (17, 1, 7),
(20, 2, 1), (21, 2, 5), (22, 2, 12), (23, 2, 22), (11, 2, 7), (17, 2, 10), (19, 2, 24),
(1, 4, 1), (2, 4, 5), (3, 4, 10), (4, 4, 20);
CREATE TABLE user_spells (
`user_id` INTEGER NOT NULL,
`spell_id` INTEGER NOT NULL
);