diff --git a/assets/dk.css b/assets/dk.css index d8f2143..4fce2c3 100644 --- a/assets/dk.css +++ b/assets/dk.css @@ -4,12 +4,22 @@ for legibility and design, but keep the soul of the original project. */ +@font-face { + font-family: 'Seagram'; + src: url('/assets/fonts/seagram.ttf') format('truetype'); + font-display: swap; +} + :root { color: #222; font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; } +.seagram { + font-family: 'Seagram', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; +} + * { margin: 0; padding: 0; @@ -26,10 +36,13 @@ body { i { font-style: italic; } b { font-weight: bold; } -h1 { font-size: 2rem; font-weight: bold; } -h2 { font-size: 1.7rem; font-weight: bold; } -h3 { font-size: 1.4rem; font-weight: bold; } -h4 { font-size: 1.1rem; font-weight: bold; } +h1, h2, h3, h4, h5 { + font-family: 'Seagram', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; +} +h1 { font-size: 2rem; } +h2 { font-size: 1.7rem; } +h3 { font-size: 1.4rem; } +h4 { font-size: 1.1rem; } div#container { max-width: 1024px; @@ -56,17 +69,20 @@ section#game { margin: 1rem 0; border-top: 2px solid #000; - & > aside { - padding: 0.5rem; - } - - & > aside > section:not(:last-child) { - margin-bottom: 1rem; + & > aside > section:not(:last-of-type) { + margin-bottom: 0.5rem; + padding-bottom: 1rem; + border-bottom: 2px solid black; } & > aside > section { display: flex; flex-direction: column; + padding: 0.5rem; + + h5 { + margin-bottom: 0.25rem; + } } & > aside#left { @@ -267,6 +283,10 @@ form.standard { margin-bottom: 0.5rem; } +.mb-025 { + margin-bottom: 0.25rem; +} + div.town { & > section:not(:last-child) { margin-bottom: 2rem; @@ -294,7 +314,7 @@ button.img-button { div#statbars { display: flex; justify-content: space-around; - margin: 1rem 0; + margin-top: 1rem; & > div.stat { display: flex; diff --git a/assets/fonts/seagram.ttf b/assets/fonts/seagram.ttf new file mode 100644 index 0000000..765faa8 Binary files /dev/null and b/assets/fonts/seagram.ttf differ diff --git a/data/dk.db b/data/dk.db index 1616cbd..46857de 100644 Binary files a/data/dk.db and b/data/dk.db differ diff --git a/go.mod b/go.mod index 18cfee9..2da4b7b 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module dk go 1.25.0 require ( - git.sharkk.net/Sharkk/Sashimi v1.0.1 + git.sharkk.net/Sharkk/Sashimi v1.1.1 git.sharkk.net/Sharkk/Sushi v1.2.0 github.com/valyala/fasthttp v1.65.0 ) diff --git a/go.sum b/go.sum index cd607f6..7407c92 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -git.sharkk.net/Sharkk/Sashimi v1.0.1 h1:5YMmxnCgcsyasg5J91AS5FVzzJoDZ17I3J4hlJyyMR4= -git.sharkk.net/Sharkk/Sashimi v1.0.1/go.mod h1:wTMnO6jo34LIjpDJ0qToq14RbwP6Uf4HtdWDmqxrdAM= +git.sharkk.net/Sharkk/Sashimi v1.1.1 h1:ST7YQjnQq3ydAKy/Kerx89cx+b/mXDOq7W/ll1aX1jA= +git.sharkk.net/Sharkk/Sashimi v1.1.1/go.mod h1:wTMnO6jo34LIjpDJ0qToq14RbwP6Uf4HtdWDmqxrdAM= git.sharkk.net/Sharkk/Sushi v1.2.0 h1:RwOCZmgaOqtkmuK2Z7/esdLbhSXJZphsOsWEHni4Sss= git.sharkk.net/Sharkk/Sushi v1.2.0/go.mod h1:S84ACGkuZ+BKzBO4lb5WQnm5aw9+l7VSO2T1bjzxL3o= github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ= diff --git a/internal/components/asides.go b/internal/components/asides.go index e5cfd89..92e5a6c 100644 --- a/internal/components/asides.go +++ b/internal/components/asides.go @@ -21,6 +21,10 @@ func LeftAside(ctx sushi.Ctx) map[string]any { user := ctx.UserValue("user").(*users.User) + if user.Currently == "In Town" { + data["town"], _ = towns.ByCoords(user.X, user.Y) + } + // Build owned town maps list if user.Towns != "" { townMap := helpers.NewOrderedMap[int, *towns.Town]() diff --git a/internal/components/town.go b/internal/components/town.go index cc74ba0..5e023a5 100644 --- a/internal/components/town.go +++ b/internal/components/town.go @@ -9,7 +9,7 @@ import ( ) func GenerateTownNews() string { - title := `
Latest News
` + title := `

Latest News

` news, err := news.Recent(1) if err == nil && len(news) > 0 { @@ -22,7 +22,7 @@ func GenerateTownNews() string { } func GenerateTownWhosOnline() string { - title := `
Who's Online
` + title := `

Who's Online

` onlineUsers, err := users.Online(10 * time.Minute) if err == nil && len(onlineUsers) > 0 { diff --git a/internal/database/wrapper.go b/internal/database/wrapper.go index 79b0a41..20a612d 100644 --- a/internal/database/wrapper.go +++ b/internal/database/wrapper.go @@ -35,7 +35,7 @@ func Close() error { } // Wrapper functions for convenience -func Query(query string, args ...any) (*sashimi.Stmt, error) { +func Query(query string, args ...any) (*sashimi.PooledStmt, error) { return db.Query(query, args...) } diff --git a/internal/routes/forum.go b/internal/routes/forum.go new file mode 100644 index 0000000..3b35016 --- /dev/null +++ b/internal/routes/forum.go @@ -0,0 +1,18 @@ +package routes + +import ( + "dk/internal/components" + + sushi "git.sharkk.net/Sharkk/Sushi" + "git.sharkk.net/Sharkk/Sushi/auth" +) + +func RegisterForumRoutes(app *sushi.App) { + authed := app.Group("/forum") + authed.Use(auth.RequireAuth()) + authed.Get("/", index) +} + +func index(ctx sushi.Ctx) { + components.RenderPage(ctx, "Forum", "forum/index.html", map[string]any{}) +} diff --git a/main.go b/main.go index a03b600..df24a8b 100644 --- a/main.go +++ b/main.go @@ -177,6 +177,7 @@ func start(port string) error { routes.RegisterAuthRoutes(app) routes.RegisterTownRoutes(app) routes.RegisterFightRoutes(app) + routes.RegisterForumRoutes(app) app.Get("/assets/*path", sushi.Static(cwd)) diff --git a/templates/forum/index.html b/templates/forum/index.html new file mode 100644 index 0000000..21c8ea0 --- /dev/null +++ b/templates/forum/index.html @@ -0,0 +1,5 @@ +{include "layout.html"} + +{block "content"} +FORUM PAGE +{/block} diff --git a/templates/intro.html b/templates/intro.html index 2be2b98..48a4eb4 100644 --- a/templates/intro.html +++ b/templates/intro.html @@ -1,5 +1,9 @@ {include "layout.html"} {block "content"} -Hey there! +

Welcome to Dragon Knight

+ +

+ Hey there! +

{/block} diff --git a/templates/leftside.html b/templates/leftside.html index 4533b6c..1e85102 100644 --- a/templates/leftside.html +++ b/templates/leftside.html @@ -1,13 +1,13 @@
-
Location
+
Compass
-
+
{if user.Currently == "In Town" and town != nil} In {town.Name} {else} {user.Currently} {/if} -
+
{user.X}{if user.X < 0}W{else}E{/if}, {user.Y}{if user.Y < 0}S{else}N{/if}
{if user.Currently != "Fighting"} @@ -26,7 +26,7 @@
-
Towns
+
Town Maps
{if #_towns > 0} Teleport to: {for t in _towns} @@ -46,7 +46,6 @@
-
Functions
Home Forum Change Password diff --git a/templates/rightside.html b/templates/rightside.html index 4c6f242..c6a7271 100644 --- a/templates/rightside.html +++ b/templates/rightside.html @@ -1,5 +1,4 @@
-
Character
-
Inventory
+
Equipment
Weapon @@ -69,7 +68,7 @@
-
Fast Spells
+
Spells
{if #_spells > 0} {for id,name in _spells} {name} diff --git a/templates/town/inn.html b/templates/town/inn.html index eefeeaf..d8211b0 100644 --- a/templates/town/inn.html +++ b/templates/town/inn.html @@ -2,7 +2,7 @@ {block "content"}
-

{town.Name} Inn

+

{town.Name} Inn

{if rested}

You wake up feeling refreshed and ready for action!

@@ -22,4 +22,4 @@ {/if} {/if}
-{/block} \ No newline at end of file +{/block} diff --git a/templates/town/maps.html b/templates/town/maps.html index 7099944..22f739d 100644 --- a/templates/town/maps.html +++ b/templates/town/maps.html @@ -2,7 +2,7 @@ {block "content"}
-

{town.Name} Maps

+

{town.Name} Maps

Buying maps will put the town in your Travel To box, and it won't cost you as many TP to get there.

Click a town name to purchase its map.

diff --git a/templates/town/shop.html b/templates/town/shop.html index 8bce181..0209281 100644 --- a/templates/town/shop.html +++ b/templates/town/shop.html @@ -2,7 +2,7 @@ {block "content"}
-

{town.Name} Shop

+

{town.Name} Shop

Buying weapons will increase your Attack. Buying armor and shields will increase your Defense.

Click an item name to purchase it.

diff --git a/templates/town/town.html b/templates/town/town.html index d134e32..e1b4818 100644 --- a/templates/town/town.html +++ b/templates/town/town.html @@ -3,7 +3,7 @@ {block "content"}
-
Welcome to {town.Name}
+

Welcome to {town.Name}

Town Options
-
Babblebox
+

Babblebox

@TODO