diff options
author | colin <colin@cicadas.surf> | 2023-03-06 18:33:45 -0800 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2023-03-06 18:33:45 -0800 |
commit | 36df81a7e3bb23d4cc347cc335fbd9b949a6af91 (patch) | |
tree | 0c5178e513682b710a7bdc37441c7d287272799c /src | |
parent | c06de3e0ee54c183fc8bb12c1fb5686694876eae (diff) |
Altered: s/campaign/adventure globally
Diffstat (limited to 'src')
-rw-r--r-- | src/endpoints.lisp | 13 | ||||
-rw-r--r-- | src/model.lisp | 32 | ||||
-rw-r--r-- | src/names.lisp | 4 | ||||
-rw-r--r-- | src/pages/tavern.lisp | 4 | ||||
-rw-r--r-- | src/queries.lisp | 20 | ||||
-rw-r--r-- | src/transactions.lisp | 4 | ||||
-rw-r--r-- | src/views/adventure.lisp | 8 | ||||
-rw-r--r-- | src/views/campaign.lisp | 8 |
8 files changed, 50 insertions, 43 deletions
diff --git a/src/endpoints.lisp b/src/endpoints.lisp index dbfb455..5b65ff7 100644 --- a/src/endpoints.lisp +++ b/src/endpoints.lisp @@ -130,10 +130,15 @@ functions in url parameters in endpoint definitions." (birth-from-the-goddess-loins player name) (redirect-to "/tavern")))) -(defendpoint* :post "/new-campaign" () () +(defendpoint* :get "/adventure-awaits" () () + (with-session (player) + (render (page-render-mode) + (make-instance 'new-adventure)))) + +(defendpoint* :post "/adventure-awaits" () () (with-session (creator) (with-checked-plist ((title :title 'a-short-string)) (lzb:request-body) - (let ((campaign - (create-campaign creator title))) - (redirect-to (urlpath campaign)))))) + (let ((adventure + (create-adventure creator title))) + (redirect-to (urlpath adventure)))))) diff --git a/src/model.lisp b/src/model.lisp index 49cd03a..f64e28f 100644 --- a/src/model.lisp +++ b/src/model.lisp @@ -122,17 +122,17 @@ (:metaclass db:persistent-class)) -(defmethod campaign ((hero hero)) +(defmethod adventure ((hero hero)) (a:when-let (quest (quest hero)) - (campaign quest))) + (adventure quest))) -(defclass campaign (game-object) +(defclass adventure (game-object) ((creator :reader creator :initarg :creator - :initform (error "campaigns must have a creator") + :initform (error "adventures must have a creator") :type player - :documentation "The player instance of the user who made this campaign.") + :documentation "The player instance of the user who made this adventure.") (seers :accessor seers :initarg :seers @@ -142,7 +142,7 @@ (title :accessor title :initarg :title - :initform (error "A campaign needs a title") + :initform (error "A adventure needs a title") :type string) (rumors :accessor rumors @@ -150,7 +150,7 @@ :type (or nil (cons rumor)) :documentation "Beasts, Monsters, and Hazards rumored to be lurking about.")) (:metaclass db:persistent-class) - (:documentation "A campaign is a container of quests. Campaigns are expected to be engaged with on a particular schedule, and are run by particular people.")) + (:documentation "A adventure is a container of quests. Adventures are expected to be engaged with on a particular schedule, and are run by particular people.")) (defclass rumor (db:store-object) ((reporter @@ -163,19 +163,19 @@ :initform (error "A rumor must contain some reported matter") :initarg :reported :type string - :documentation "A description of the supposed peril that awaits heroes in a particular campaign.")) + :documentation "A description of the supposed peril that awaits heroes in a particular adventure.")) (:metaclass db:persistent-class) - (:documentation "Transcript of a rumor reported by some player related to a Campaign.")) + (:documentation "Transcript of a rumor reported by some player related to a Adventure.")) (defclass quest (game-object) - ((campaign - :reader campaign - :initarg :campaign - :initform (error "No quest can fall outside the scope of a campaign.") - :type campaign + ((adventure + :reader adventure + :initarg :adventure + :initform (error "No quest can fall outside the scope of a adventure.") + :type adventure :index-type idx:hash-index - :index-reader quests-in-campaign - :documentation "The campaign to which this quest belongs") + :index-reader quests-in-adventure + :documentation "The adventure to which this quest belongs") (name :accessor name :initarg :name diff --git a/src/names.lisp b/src/names.lisp index 48601b4..b355405 100644 --- a/src/names.lisp +++ b/src/names.lisp @@ -7,8 +7,8 @@ (:documentation "Returns a unique name for an object, or NIL if it does not have one.") (:method ((ob t)) nil)) -(defmethod unique-name ((campaign campaign)) - (title campaign)) +(defmethod unique-name ((adventure adventure)) + (title adventure)) (defmethod unique-name ((hero hero)) (name hero)) diff --git a/src/pages/tavern.lisp b/src/pages/tavern.lisp index e6250e1..1f6c441 100644 --- a/src/pages/tavern.lisp +++ b/src/pages/tavern.lisp @@ -13,5 +13,7 @@ (:br) (:a :href "/goddess-shrine" "Pray a new hero rises.") (:br) - (:a :href "/spymaster" "Report a Roguish Rumour...")))) + (:a :href "/spymaster" "Report a Roguish Rumour...") + (:br) + (:a :href "/adventure-awaits" "Embark on a new Adventure!")))) diff --git a/src/queries.lisp b/src/queries.lisp index 1816c5c..9cd581c 100644 --- a/src/queries.lisp +++ b/src/queries.lisp @@ -9,22 +9,22 @@ "Return all quests in which one of player's heroes is engaged." (remove nil (mapcar #'quest (player-heroes player)))) -(defun player-campaigns (player) - "Return a list of campaigns one of the players' heroes is involved in." - (mapcar #'campaign (player-quests player) )) +(defun player-adventures (player) + "Return a list of adventures one of the players' heroes is involved in." + (mapcar #'adventure (player-quests player) )) -(defun campaign-heros (campaign &key (activep t)) - "All the heros actively involved in this CAMPAIGN. If ACTIVEP, then +(defun adventure-heros (adventure &key (activep t)) + "All the heros actively involved in this ADVENTURE. If ACTIVEP, then only the active quest(s) are considered, otherwise all quests are considered." (remove-duplicates (mapcan #'heroes-on-quest (if activep - (remove-if-not #'quest-startedp (quests-in-campaign campaign)) - (quests-in-campaign campaign))))) + (remove-if-not #'quest-startedp (quests-in-adventure adventure)) + (quests-in-adventure adventure))))) (defun fetch-comrades (player &key (activep t)) - "Returns all the heroes in any one of the player's campaigns. If + "Returns all the heroes in any one of the player's adventures. If ACTIVEP, then only heroes involved in active quests are returned." (remove-duplicates - (loop :for campaign :in (player-campaigns player) - :nconc (campaign-heros campaign :activep activep)))) + (loop :for adventure :in (player-adventures player) + :nconc (adventure-heros adventure :activep activep)))) diff --git a/src/transactions.lisp b/src/transactions.lisp index ad9c9e8..647452b 100644 --- a/src/transactions.lisp +++ b/src/transactions.lisp @@ -17,6 +17,6 @@ (db:with-transaction () (make-instance 'player :nickname nick))) -(defun create-campaign (player title) +(defun create-adventure (player title) (db:with-transaction () - (make-instance 'campaign :title title :creator player))) + (make-instance 'adventure :title title :creator player))) diff --git a/src/views/adventure.lisp b/src/views/adventure.lisp new file mode 100644 index 0000000..b4980f1 --- /dev/null +++ b/src/views/adventure.lisp @@ -0,0 +1,8 @@ +;;;; views/adventure.lisp -- views of for adventure instances + +(in-package :dnd) + + +(defrender :inline ((adventure adventure)) + (with-html + (:a :href (urlpath adventure) (title adventure)))) diff --git a/src/views/campaign.lisp b/src/views/campaign.lisp deleted file mode 100644 index 5e1498a..0000000 --- a/src/views/campaign.lisp +++ /dev/null @@ -1,8 +0,0 @@ -;;;; views/campaign.lisp -- views of for campaign instances - -(in-package :dnd) - - -(defrender :inline ((campaign campaign)) - (with-html - (:a :href (urlpath campaign) (title campaign)))) |