summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/adventure.lisp17
-rw-r--r--src/game/hazard.lisp16
-rw-r--r--src/game/quest.lisp21
-rw-r--r--src/game/tavern.lisp18
-rw-r--r--src/game/views.lisp9
5 files changed, 61 insertions, 20 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"))))))