From 8e7fc055823fde522fb83f9a7d86dcba39dcf551 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 26 Dec 2022 14:13:22 -0800 Subject: initial commit; Add hero model definition --- model.lisp | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 model.lisp (limited to 'model.lisp') diff --git a/model.lisp b/model.lisp new file mode 100644 index 0000000..318aa26 --- /dev/null +++ b/model.lisp @@ -0,0 +1,81 @@ +;;;; model.lisp -- bknr.datastore class definitions for dnd + +ty + +(in-package :dungeons-and-deadlines) + +(deftype title () + `(member :noob)) + +(deftype character-class () + `(member :hero)) + +(defclass has-uid (db:store-object) + ((nuid :reader uid :initform (nuid))) + (:metaclass db:persistent-class)) + +(defclass can-equip (db:store-object) + ((equipment-slots + :initform (make-hash-table)) + (equipment-slot-names + :initform (list :holding) + :initarg :slot-names + :type (list keyword))) + (:metaclass db:persistent-class)) + +;; TODO: define an equip protocol + +;; a user +(defclass hero (can-equip has-uid) + ((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) + (experience + :accessor experience + :initform 0 + :type integer) + (chronicle + :accessor hero-chronicle + :initform (list) + :type (cons string)) + (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)) + +;; aka an issue +;; (defclass monster (can-equip has-uid) +;; ((name) +;; (description) +;; (difficulty) +;; (tags) +;; (status) +;; (priority) +;; ) +;; (:metaclass db:persistent-class)) + +;; (defun experience-value (monster) +;; ;; Int +;; ;; (tag + campaign) - lookup table , priortiy, +;; ) + +;; ;; aka .... uhh.... dumbass github flair +;; (defclass loot (db:store-object) +;; () +;; (:metaclass db:persistent-class)) + +;; ;; aka a project +;; (defclass campagin (db:store-object) +;; () +;; (:metaclass db:persistent-class)) -- cgit v1.2.3