summaryrefslogtreecommitdiff
path: root/model.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-03-05 16:36:44 -0800
committercolin <colin@cicadas.surf>2023-03-05 16:36:44 -0800
commitf7abccc38ceda7024ca375d34ed88f4fb561ef02 (patch)
tree432d6673e9e8d53b5fbc43e25a684b654f6dea1d /model.lisp
parent89d0d687992b41f7f0f9b0d3da19d9d587f06010 (diff)
Reorganized codebase
Diffstat (limited to 'model.lisp')
-rw-r--r--model.lisp226
1 files changed, 0 insertions, 226 deletions
diff --git a/model.lisp b/model.lisp
deleted file mode 100644
index fef01da..0000000
--- a/model.lisp
+++ /dev/null
@@ -1,226 +0,0 @@
-;;;; model.lisp -- bknr.datastore class definitions for dnd
-
-(in-package :dnd)
-
-(deftype title ()
- `(member :noob))
-
-(deftype character-class ()
- `(member :hero))
-
-(deftype priority ()
- `(member :low :medium :high))
-
-(defun hero-class (h)
- "barGaryan") ; TODO: real implementation
-
-(defun hero-title (h)
- "Scouse Chef") ; TODO: real implementation
-
-(defun renown (hero)
- (experience hero)) ; TODO: real implementaiton
-
-;;; persistent mixins
-(defclass has-uid ()
- ((nuid :reader uid
- :initform (nuid)
- :index-type idx:string-unique-index
- :index-reader object-with-uid))
- (:metaclass db:persistent-class))
-
-(defclass can-equip ()
- ((equipment-table
- :initform nil
- :type list
- :documentation "A PLIST mapping 'equipment slots' to instances of LOOT. Equipment slots are things like :head, :torso, :left-ring, etc")
- (equipment-slot-names
- :initform +standard-humanoid-equipment+
- :initarg :slot-names
- :type (list keyword)
- :documentation "The list of slots available to this entity."))
- (:metaclass db:persistent-class))
-
-(defclass has-bag ()
- ((bag
- :reader bag
- :initform nil
- :type list
- :documentation "A list of items that this entity is carrying."))
- (:metaclass db:persistent-class))
-
-(defclass has-chronicle ()
- ((chronicle :accessor chronicle :initform nil))
- (:metaclass db:persistent-class)
- (:documentation "A chronicle is a general purpose log of events. It stores a single slot that"))
-
-(defparameter +standard-humanoid-equipment+
- '(:head :neck :torso :waist :legs :feet :arms :left-fingers :right-fingers
- :left-holding :right-holding :cloak)
- "The equipment slots for standard humanoids")
-
-;; abstract class
-(defclass game-object (db:store-object has-uid has-chronicle)
- ()
- (:metaclass db:persistent-class))
-
-(defclass player (db:store-object has-uid)
- ((nick
- :reader player-nick
- :initarg :nick
- :initform (error "Players must have a nick")
- :type string
- :index-type idx:string-unique-index
- :index-reader player-with-nick)
- (pwhash
- :accessor pwhash
- :type string
- :initarg :pwhash
- :documentation "A hash of the password, hashed with the value of the pwsalt slot.")
- (pwsalt
- :reader pwsalt
- :initform (nuid)
- :type string
- :documentation "Salt for this hero's password hash."))
- (:metaclass db:persistent-class))
-
-;; a user
-(defclass hero (game-object has-bag can-equip)
- ((name
- :accessor hero-name
- :initarg :name
- :initform (error "Heroes must be named")
- :type string
- :index-type idx:string-unique-index
- :index-reader hero-known-as)
- (player
- :reader hero-player
- :initarg :player
- :type player
- :index-type idx:hash-index
- :index-reader player-heroes)
- (campaign
- :accessor hero-campaign
- :initarg :campaign
- :initform nil
- :type campaign
- :documentation "A hero may be in at most one campaign at a time."))
- (:metaclass db:persistent-class))
-
-
-
-;; TODO expiration?
-(defclass session (db:store-object)
- ((player :reader session-player
- :initarg :player)
- (id :reader session-id
- :initform (nuid)
- :index-type idx:string-unique-index
- :index-reader session-with-id))
- (:metaclass db:persistent-class))
-
-(defclass campaign (game-object)
- ((creator
- :reader campaign-creator
- :initarg :creator
- :initform (error "campaigns must have a creator")
- :type player
- :documentation "The player instance of the user who made this campaign.")
- (seers
- :accessor campaign-seers
- :initarg :seers
- :initform nil
- :type (or nil (cons player))
- :documentation "Seers are the people who peer out into their instruments of divination that heroes may go on quests.")
- (title
- :accessor title
- :initarg :title
- :initform (error "A campaign needs a title")
- :type string)
- (rumors
- :accessor campaign-rumors
- :initform nil
- :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."))
-
-(defclass rumor (db:store-object)
- ((reporter
- :reader rumor-reporter
- :initarg :reporter
- :type player
- :documentation "The player who hast reported the vile rumor.")
- (content
- :accessor rumor-content
- :initform (error "A rumor must have content")
- :initarg :content
- :type string
- :documentation "A description of the supposed peril that awaits heroes in a particular campaign."))
- (:metaclass db:persistent-class)
- (:documentation "Transcript of a rumor reported by some player related to a Campaign."))
-
-(defclass quest (game-object)
- ((campaign
- :reader quest-campaign
- :initarg :campaign
- :initform (error "No quest can fall outside the scope of a campaign.")
- :type campaign
- :index-type idx:hash-index
- :index-reader quests-in-campaign
- :documentation "The campaign to which this quest belongs")
- (name
- :accessor quest-name
- :initarg :name
- :type string
- :initform (format nil "~a" (gensym "QUEST")))
- (horizon-of-hope
- :accessor horizon-of-hope
- :initarg :deadline
- :type integer
- :initform nil
- :documentation "When all hope becomes lost.")
- (heroes
- :accessor heroes-on-quest
- :initarg :heroes
- :initform nil
- :type (or nil (cons hero))
- :documentation "A list of heroes in this quest. Join and flight dates are logged in the chronicle.")
- (inception
- :accessor quest-inception
- :initform nil
- :type (or nil integer)
- :documentation "Time at which the quest began."))
- (:metaclass db:persistent-class)
- (:documentation "A collection of hazards with a deadline and start date which heroes will attack."))
-
-(defclass hazard (game-object)
- ((quest
- :accessor quest-of
- :index-type idx:hash-index
- :index-reader hazards-in-quest
- :documentation "The quest to which this hazard belongs. Initially it is unbound. It becomes boudn when the hazard is added to a quest.")
- (description
- :accessor description
- :initarg :description
- :initform ""
- :type string
- :documentation "")
- (overcomep
- :accessor is-overcome
- :initform nil
- :documentation "indicates whether or not this hazard has been overcome.")
- (imminence
- :accessor imminence-of
- :type priority
- :documentation "")
- (menace ;; difficulty
- :accessor menace-of
- :type integer
- :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."))
-
-;; (defclass monster ())
-
-
-