diff options
author | colin <colin@cicadas.surf> | 2023-04-01 10:13:17 -0700 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2023-04-01 10:13:17 -0700 |
commit | cc10599f1531e18998fd8a6d80f8b17846699d63 (patch) | |
tree | 13b9e25456957f4db988e82b577338ebb861f03a /src | |
parent | 08a8e51de33a77b458b87dbd25bdfdceefb6584e (diff) |
Add navbar and various unaccountable changes
Diffstat (limited to 'src')
-rw-r--r-- | src/game/adventure.lisp | 17 | ||||
-rw-r--r-- | src/game/hazard.lisp | 16 | ||||
-rw-r--r-- | src/game/quest.lisp | 21 | ||||
-rw-r--r-- | src/game/tavern.lisp | 18 | ||||
-rw-r--r-- | src/game/views.lisp | 9 | ||||
-rw-r--r-- | src/pages/spymaster.lisp | 4 | ||||
-rw-r--r-- | src/render.lisp | 1 |
7 files changed, 62 insertions, 24 deletions
diff --git a/src/game/adventure.lisp b/src/game/adventure.lisp index 801bc5e..6bbd2d3 100644 --- a/src/game/adventure.lisp +++ b/src/game/adventure.lisp @@ -2,7 +2,7 @@ (in-package :dnd) -;;; MODEL CLASSES +;;; MODEL CLASSES (defclass adventure (game-object) ((creator @@ -43,7 +43,7 @@ :type player :documentation "The player who hast reported the vile rumor.") (reported - :accessor reported + :accessor reported :initform (error "A rumor must contain some reported matter") :initarg :reported :type string @@ -110,8 +110,6 @@ only the active quest(s) are considered, otherwise all quests are considered." (render :inline adventure)) - - ;;; PAGES & PAGE CLASSES (defclass adventure-awaits () @@ -189,6 +187,14 @@ only the active quest(s) are considered, otherwise all quests are considered." (:br) (:button :type "submit" "Report!")))) +(defclass/std tavern-adventures () + ((your-adventures))) + +(defrender t ((page tavern-adventures)) + (with-page (:title "Your Adventures") + (:h1 "You are seer on the following adventures") + (render :list (your-adventures page)))) + ;;; ENDPOINT HELPERS (define-id-plucker adventure) @@ -203,9 +209,6 @@ only the active quest(s) are considered, otherwise all quests are considered." :your-adventures (adventures-visible-by me))))) - - - (defendpoint* :get "/adventure-awaits" () () (with-session (player) (render (page-render-mode) diff --git a/src/game/hazard.lisp b/src/game/hazard.lisp index c6ad58d..ceb1ad0 100644 --- a/src/game/hazard.lisp +++ b/src/game/hazard.lisp @@ -1,5 +1,7 @@ (in-package :dnd) +;;; MODEL CLASSES + (defclass hazard (game-object) ((quest :accessor quest-of @@ -26,3 +28,17 @@ :documentation "How dangerous the hazard is." )) (:metaclass db:persistent-class) (:documentation "Hazard is a superclass for all hazards encountered in a quest. It's chronicle includes data about which heroes fought and which overcame.")) + +;;; HELPERS + +;;; QUERIES + +;;; TRANSACTIONS + +;;; MODEL VIEWS + +;;; PAGES & PAGE CLASSES + +;;; ENDPOINT HELPERS + +;;; ENDPOINT DEFINITIONS diff --git a/src/game/quest.lisp b/src/game/quest.lisp index ed9a5b4..d36b9f9 100644 --- a/src/game/quest.lisp +++ b/src/game/quest.lisp @@ -49,3 +49,24 @@ (defrender t ((page quest)) (with-page (:title (unique-name (quest page ))) (:h1 (unique-name (quest page))))) + +;;; HELPERS + +;;; QUERIES + +;;; TRANSACTIONS + +;;; MODEL VIEWS + +;;; PAGES & PAGE CLASSES + +;;; ENDPOINT HELPERS + +;;; ENDPOINT DEFINITIONS + +(defendpoint* :get "/quest/:quest a-quest-with-id:/:name:" () () + (with-session (player) + (render (page-render-mode) + (make-instance 'quest-page + :player player + :hero quest)))) diff --git a/src/game/tavern.lisp b/src/game/tavern.lisp index 25d6ef0..5997218 100644 --- a/src/game/tavern.lisp +++ b/src/game/tavern.lisp @@ -2,6 +2,9 @@ (in-package :dnd) + +;;; PAGES & PAGE CLASSES + (defclass/std tavern () ((player))) @@ -21,13 +24,9 @@ (:a :href "/adventure-awaits" "Embark on a new Adventure!")))) -(defclass/std tavern-adventures () - ((your-adventures))) +;;; ENDPONT HELPERS -(defrender t ((page tavern-adventures)) - (with-page (:title "Your Adventures") - (:h1 "You are seer on the following adventures") - (render :list (your-adventures page)))) +;;; ENDPOINT DEFINTIONS (defendpoint* :get "/tavern" () () (with-session (me) @@ -37,12 +36,5 @@ -(defendpoint* :get "/quest/:quest a-quest-with-id:/:name:" () () - (with-session (player) - (render (page-render-mode) - (make-instance 'quest-page - :player player - :hero quest)))) - diff --git a/src/game/views.lisp b/src/game/views.lisp new file mode 100644 index 0000000..1b2f05d --- /dev/null +++ b/src/game/views.lisp @@ -0,0 +1,9 @@ +;;;; views.lisp + +(in-package :dnd) + +(defun page-nav () + (with-html + (:nav :class "navbar" + (:ul + (:li (:a :href "/tavern" "🍺 Tavern")))))) diff --git a/src/pages/spymaster.lisp b/src/pages/spymaster.lisp deleted file mode 100644 index 0068862..0000000 --- a/src/pages/spymaster.lisp +++ /dev/null @@ -1,4 +0,0 @@ -;;;; spymaster.lisp - -(in-package :dnd) - diff --git a/src/render.lisp b/src/render.lisp index 71f07b4..a073f31 100644 --- a/src/render.lisp +++ b/src/render.lisp @@ -22,4 +22,5 @@ be a keyword for usin in EQL method specializers.")) (:head (:title ,title-var)) (:body + (page-nav) ,@body)))))) |