summaryrefslogtreecommitdiff
path: root/model.lisp
blob: 050bbfe8fc3f14f4ab8fb1452465ecc25e14e9dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
;;;; model.lisp -- bknr.datastore class definitions for dnd

(in-package :dnd.api)

(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 ()
  ((uid :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))

;; 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))