blob: 3f0e4a11878af88fa85de7ada168d02970bb6d5c (
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
|
;;;; model.lisp
(in-package :arclade)
(defclass player ()
((name :initarg :name :reader name)
(games :accessor games)))
(defclass game (db:store-object)
((name :initarg :name :reader name
:index-type idx:string-unique-index
:index-reader game-with-name
:index-values all-games)
(rating :accessor rating)
(playtime :accessor playtime)
(icon-url :accessor icon-url)
(last-played :accessor last-played))
(:metaclass db:persistent-class))
(defclass steam-game (game)
((appid :initarg :appid :reader appid
:index-type idx:unique-index
:index-initargs (:test #'equal)
:index-reader steam-game-with-appid))
(:metaclass db:persistent-class))
(defmethod print-object ((object steam-game) stream)
(format stream "#<STEAM GAME ~a>" (name object)))
(defclass feat (db:store-object)
((game
:reader game
:initarg :game
:initform (error "Feats must belong to a GAME.")
:type game
:index-type idx:hash-index
:index-reader feats-for-game
:documentation "Game object to which this feat belongs.")
(name
:initarg :name
:reader name
:type string
:initform ""
:documentation "Optional name of the feat.")
(fulfillment
:initarg :fulfillment
:initform nil
:accessor fulfillment
:documentation "Ideally a date and time when the feat was fulfilled.
If nil, implies the feat is yet to be fulfilled.")
(description
:initarg :description
:accessor description
:initform ""
:type string
:documentation "Free text feat flattery."))
(:metaclass db:persistent-class)
(:documentation "Base class for a notable event performed in GAME.
Example:
Castlevania - 2003-10-31 (guess)
Defeated Dracula and finished the game!"))
(defclass score (feat)
((points :initarg :points :accessor points))
(:metaclass db:persistent-class)
(:documentation "Feat subclass specific to score based games."))
(defclass steam-achievement (feat)
((icongray :accessor icongray)
(icon :accessor icon)
(apiname :accessor apiname))
(:metaclass db:persistent-class)
(:documentation "Feat with Steam specific slots."))
;;; "queries"
(defun feats-fulfilled ()
(remove-if-not #'fulfillment (db:store-objects-with-class 'feat)))
|