about summary refs log tree commit diff stats
path: root/ccap-muck.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'ccap-muck.lisp')
-rw-r--r--ccap-muck.lisp71
1 files changed, 71 insertions, 0 deletions
diff --git a/ccap-muck.lisp b/ccap-muck.lisp
new file mode 100644
index 0000000..3374606
--- /dev/null
+++ b/ccap-muck.lisp
@@ -0,0 +1,71 @@
+(defvar *terminate-program* nil)
+
+(defconstant +bold+ "[1m")
+(defconstant +unbold+ "[0m")
+(defconstant +q+ #\")
+
+(defclass <avatar> () ((name :accessor name)
+                       (playing :reader playing :initform nil)
+                       (password :accessor password)))
+(defvar *avatars* '())
+
+(defvar *write-avatars* nil)
+
+(defclass <connection> () ((g :reader g)
+                           (socket :reader socket)
+                           (parser :reader parser)
+                           (avatar :reader avatar)
+                           (r :reader r)))
+(defvar *connections* '())
+
+(defconstant +port-number+ 6565)
+
+(defconstant +vd-type+ (vector 'n 's 'e 'w
+			       'u 'd))
+
+(defclass <room> () ((name :reader name)
+		     (desc :reader desc)
+		     (exits :reader exits)))
+(defvar *rooms* '())
+
+(defvar *write-rooms* nil)
+
+(defconstant +command-type+ (vector 'say 'help 'quit 'look
+				    'rooms 'make-room 'make-door 'teleport
+				    'n 's 'e 'w
+				    'u 'd 'password 'shutdown))
+
+(defconstant +name-prompt+ "Please enter your character name:")
+
+(defconstant +rdb+ "room.tam")
+(defconstant +adb+ "avatar.tam")
+
+(defun read-room-database ()
+  (with-open-file (file +rdb+ :direction :input)
+    ))
+
+(defun write-room-database ()
+  (with-open-file (file +rdb+ :direction output)
+    (mapcar (lambda (r)
+	      (format file "~A~%"
+
+(defun read-avatar-database ()
+  (setq *avatars* '())
+  (with-open-file (file +adb+ :direction :input)
+    (do ((name (read-line file nil nil))
+	 (password (read-line file nil nil)))
+	((or (null name) (null password)))
+      (let ((a (make-instance (find-class '<avatar>))))
+	(setf (name a) name)
+	(setf (password a) password)
+	(setq *avatars* (cons a *avatars*)))))
+  (setq *write-avatars* nil))
+
+(defun write-avatar-database ()
+  (with-open-file (file +adb+ :direction output)
+    (mapcar (lambda (a) (format file "~A~%~A~%" (name a) (password a))) *avatars*)))
+
+(read-avatar-database)
+(read-room-database)
+(while (not *terminate-program*)
+       (check-for-inputs))