;;;; model.lisp -- bknr.datastore class definitions for dnd (in-package :dnd) (deftype title () `(member :noob)) (deftype character-class () `(member :hero)) (defun hero-class (h) "barGaryan") (defun hero-title (h) "Scouse Chef") (defun renown (hero) (experience hero)) (defclass has-uid () ((nuid :reader uid :initform (nuid))) (:metaclass db:persistent-class)) (defclass can-equip () ((equipment-table :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 (db:store-object 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)) (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)) ;; TODO expiration? (defclass session (db:store-object) ((hero :reader session-hero :initarg :hero) (id :reader session-id :initform (nuid) :index-type idx:string-unique-index :index-reader session-with-id)) (: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))