Skip to content

Commit eda7c12

Browse files
author
Blecki
committed
I am actually still working on this.
1 parent eec4e04 commit eda7c12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+723
-308
lines changed

DefaultDatabase/DefaultDatabase.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
<Compile Include="Properties\AssemblyInfo.cs" />
6464
</ItemGroup>
6565
<ItemGroup>
66+
<None Include="database\static\templates\basic-human-male.mud">
67+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
68+
</None>
6669
<None Include="database\static\chat.mud">
6770
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
6871
</None>
@@ -78,6 +81,9 @@
7881
<None Include="database\static\character-generation.mud">
7982
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
8083
</None>
84+
<None Include="database\static\quantum-sink.mud">
85+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
86+
</None>
8187
<None Include="database\static\wear-remove.mud">
8288
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
8389
</None>

DefaultDatabase/MudEngine2012.dll

512 Bytes
Binary file not shown.

DefaultDatabase/MudServer.exe

0 Bytes
Binary file not shown.

DefaultDatabase/database/static/account.mud

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
(defun "load-account" [name] (load "players/(name)/account"))
33
(defun "load-player-character" [account-name character-name] (load "players/(account-name)/(character-name)"))
44

5+
(defun "create-account" [name password]
6+
(let (^("account-object" (create "players/(name)/account")))
7+
(lastarg
8+
(set account-object "password" (hash password name))
9+
account-object
10+
)
11+
)
12+
)
513

614
(defun "create-player-character" [account name]
715
(let ^(^("result" (create "players/(account)/(name)")))

DefaultDatabase/database/static/basic-formatter.mud

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11

22
(defun "basic-formatter-list-objects" ^("list list" "prepend-isare" "list-on")
33
(if (equal (length list) 1)
4-
(if (prepend-isare)
5-
"is ((first list):a)(basic-formatter-list-objects-on (first list) list-on)"
6-
"((first list):a)(basic-formatter-list-objects-on (first list) list-on)"
4+
(if prepend-isare
5+
"is ((first list):list-short)(basic-formatter-list-objects-on (first list) list-on)"
6+
"((first list):list-short)(basic-formatter-list-objects-on (first list) list-on)"
77
)
8-
(if (prepend-isare) "are (strcat
8+
"(if prepend-isare "are " "")(strcat
99
$(mapi "i" list
1010
(if (equal i (subtract (length list) 1))
11-
"and ((index list i):a)(basic-formatter-list-objects-on (index list i) list-on)"
12-
"((index list i):a)(basic-formatter-list-objects-on (index list i) list-on), "
11+
"and ((index list i):list-short)(basic-formatter-list-objects-on (index list i) list-on)"
12+
"((index list i):list-short)(basic-formatter-list-objects-on (index list i) list-on), "
1313
)
1414
)
15-
)")
15+
)"
1616
)
1717
)
1818

@@ -26,7 +26,7 @@
2626
(defun "basic-formatter-list-links" ^("list links")
2727
(strcat
2828
$(map "link" links
29-
"(link.name) (if link.door "[through (link.door:a)] " "")"
29+
"(link.name) (if link.door "[through (link.door:list-short)] " "")"
3030
)
3131
)
3232
)

DefaultDatabase/database/static/character-generation.mud

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(if actor.creation-finished (nop)
1616
(nop
1717
(echo actor "The voice says \"Proceed east from the locker room to the termination center for recycling.\"\n")
18-
(invoke 10 voice-sequence actor)
18+
/*(invoke 10 voice-sequence actor)*/
1919
)
2020
)
2121
)
@@ -53,14 +53,14 @@
5353
(lfun "start-scan-sequence" [actor]
5454
(nop
5555
((load "stats").generate-character-stats actor)
56-
(invoke 5 scan-sequence-one actor)
56+
(invoke 5 scan-sequence-four actor)
5757
)
5858
)
5959

6060
(multi-set start-room [
6161
[@base (load "room")]
6262
[short "Dank tiled stall"]
63-
[long "A thousand streams of dirty water run down the walls, which might once have been white tile, to a drain nearly clogged with muck and slime. A single florescent light flickers overhead."]
63+
[long "A thousand streams of dirty water run down the walls, which might once have been white tile, to a drain nearly clogged with muck and slime. A single florescent light flickers overhead.\n[This area is designed to teach the basics of interacting with the game world. You might start with 'read sign', and then you can 'go left' or 'go right'.]"]
6464
])
6565
(open-direct-link start-room scanning-room ^("left" "l" "girl")
6666
(lambda "lchoose-girl" [actor]
@@ -99,7 +99,7 @@
9999
(multi-set locker-room [
100100
[@base (load "room")]
101101
[short "Musty Locker Room"]
102-
[long ""]
102+
[long "Lockers squat against the walls of this room. The floor is dirty and stained by old puddles.\n[You'll find items of clothing in the world that can be worn.]\n[If a command is ambiguous, or doesn't seem to be affecting the object you intend, try being more specific. For example, to exit this room, you'll need to 'open north door'.]"]
103103
])
104104

105105
(set scanning-room "door" (create-direct-door scanning-room locker-room ^("north" "n")))
@@ -123,16 +123,28 @@
123123
(multi-set locker-room.in-door [
124124
["locked" true]
125125
["short" "steel door"]
126-
["adjectives" ^("steel")]
126+
["adjectives" ^("steel" "south" "s")]
127127
])
128128

129129
(multi-set (create-direct-door locker-room null ^("east" "e")) [
130130
["locked" true]
131131
["short" "striped door"]
132132
["description" "This door is painted in diagonal yellow stripes."]
133-
["adjectives" ^("striped")]
133+
["adjectives" ^("striped" "east" "e")]
134134
])
135135

136+
(add-object locker-room "contents" (record
137+
[@base (load "object")]
138+
[short "worn denim pants"]
139+
[nouns ^("pants")]
140+
[adjectives ^("worn" "denim")]
141+
[can-wear true]
142+
))
143+
144+
(add-object locker-room "contents" ((load "quantum-sink").create))
145+
(create-door locker-room "new-haven/start-room" ^("north" "n")
146+
(lambda "" [actor] (set actor "creation-finished" true)))
147+
136148
start-room)
137149
)
138150
)

DefaultDatabase/database/static/door.mud

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
(echo actor "^(door:the) is closed.\n")
77
(nop
88
(echo to.contents "^(actor:short) arrived.\n")
9-
(move-object actor door.to "contents")
9+
(move-object actor to "contents")
1010
(echo previous.contents "^(actor:short) went (name). [Through (door:the)]\n")
1111
(echo actor "You went (name). [Through (door:the)]\n")
1212
(if on-follow (on-follow actor))
@@ -20,19 +20,20 @@
2020
(lambda "lgo" ["matches" "actor"] (implement-door-link door (load door.to) name actor on-follow))
2121
)
2222

23-
(lfun "make-door-record" [to]
23+
(lfun "make-door-record" [to names]
2424
(record
2525
^("short" "door")
2626
^("nouns" ^("door"))
2727
^("to" to)
2828
^("@base" (load "object"))
2929
^("can-open" true)
3030
^("open" null)
31+
^("adjectives" names)
3132
)
3233
)
3334

3435
(defun "create-door" ^("from" "to" "names" "function ?on-follow")
35-
(let ^(^("door" (make-door-record to)))
36+
(let ^(^("door" (make-door-record to names)))
3637
(lastarg
3738
(prop-add from "links" (record ^("name" (first names)) ^("door" door)))
3839
(for "name" names
@@ -66,7 +67,7 @@
6667
)
6768

6869
(defun "create-direct-door" [from to names "function ?on-follow"]
69-
(let ^(^("door" (make-door-record to)))
70+
(let ^(^("door" (make-door-record to names)))
7071
(lastarg
7172
(prop-add from "links" (record ^("name" (first names)) ^("door" door)))
7273
(for "name" names
Lines changed: 75 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
(depend "character-generation")
22

3-
(let (
4-
^("display-characters"
5-
(lambda "" [client characters]
6-
(mapi "i" characters (echo client "[(i)]: (index characters i) [type 'connect (i)' to choose this character.]\n"))
3+
(lfun "menu-choices" [client choices callback]
4+
(nop
5+
(for "item" choices (echo client "[(item.key)]: (item.name)\n"))
6+
(set client "command-handler"
7+
(lambda "handle-choice" [client full-command token switch]
8+
(callback client (first (where "item" choices (equal item.key token.word))))
9+
)
710
)
811
)
12+
)
13+
14+
(lfun "menu-option" [key name value] (record ^("key" key) ^("name" name) ^("value" value)))
15+
16+
(lfun "build-menu" ^("function name" "list items")
17+
(mapi "i" items
18+
(menu-option (itoa (add (atoi "A") i)) (name (index items i)) (index items i))
919
)
10-
(nop
20+
)
1121

1222
(defun "handle-frontend-command" [client full-command token switch]
1323
(let (^("words" (mapex "token" token token.word token.next)))
@@ -21,100 +31,88 @@
2131
)
2232
)
2333

24-
(defun "handle-login-command" [client account-name password]
25-
(let (^("account-object" (load-account account-name)))
26-
(if account-object
27-
(if (greaterthan (count "connected-client" clients (equal connected-client.account account-object)) 0)
28-
(echo client "You are already logged in.\n")
29-
(if (equal (hash password account-name) account-object.password)
30-
(let ^(^("characters" (list-player-characters account-name)))
34+
(lfun "connect" [client player-object]
35+
(nop
36+
(set client "player" player-object)
37+
(set client "logged_on" true)
38+
(set player-object "account" client.account-object)
39+
(move-object player-object (load "new-haven/start-room") "contents")
40+
(set client "command-handler" handle-verb-command)
41+
(command player-object "look")
42+
)
43+
)
44+
45+
(lfun "display-create-menu" [client]
46+
(menu-choices
47+
client
48+
(build-menu (lambda "" [item] (path-leaf item)) (enumerate-database "templates"))
49+
(lambda "callback" [client choice]
50+
(if (not choice)
51+
(echo client "Huh?")
52+
(nop
53+
(let (^("player" (create-player-character client.account-name choice.value)))
3154
(nop
32-
(if (equal (length characters) 0)
33-
(echo client "You have no characters.\n")
34-
(display-characters client characters)
35-
)
36-
(echo client "Valid commands are connect, create, and delete.\n")
37-
(set client "command-handler" handle-front-end-character-menu-command)
38-
(set client "account-name" account-name)
39-
(set client "account-object" account-object)
55+
(echo client choice)
56+
(set player "@base" (load "(choice.value)"))
57+
(connect client player)
4058
)
4159
)
42-
60+
)
61+
)
62+
)
63+
)
64+
)
4365

44-
45-
(echo client "Wrong password.\n")
66+
(lfun "display-characters" [client]
67+
(menu-choices
68+
client
69+
(cat
70+
(build-menu (lambda "" [item] (path-leaf item)) (list-player-characters client.account-name))
71+
^((menu-option "0" "Create new character" null))
72+
)
73+
(lambda "callback" [client choice]
74+
(if (not choice)
75+
(echo client "Huh?")
76+
(if (choice.value)
77+
(connect client (load-player-character client.account-name choice.value))
78+
(display-create-menu client)
4679
)
4780
)
48-
(echo client "I couldn't find that account.\n")
4981
)
5082
)
5183
)
5284

53-
(defun "handle-register-command" [client account-name password]
85+
86+
87+
88+
(defun "handle-login-command" [client account-name password]
5489
(let (^("account-object" (load-account account-name)))
5590
(if account-object
56-
(echo client "That account already exists.\n")
57-
(nop
58-
(var "account-object" (create "players/(account-name)/account"))
59-
(if account-object
91+
(if (greaterthan (count "connected-client" clients (equal connected-client.account account-object)) 0)
92+
(echo client "You are already logged in.\n")
93+
(if (equal (hash password account-name) account-object.password)
6094
(nop
61-
(multi-set account-object ^(^("player" "player") ^("password" (hash password account-name))))
62-
(handle-login-command client account-name password)
95+
(set client "account-name" account-name)
96+
(set client "account-object" account-object)
97+
(display-characters client)
6398
)
99+
(echo client "Wrong password.\n")
64100
)
65101
)
102+
(echo client "I couldn't find that account.\n")
66103
)
67104
)
68105
)
69106

70-
(defun "handle-front-end-character-menu-command" [client full-command token switch]
71-
(let (^("words" (mapex "token" token token.word token.next)))
72-
(if (equal (index words 0) "connect")
73-
(let (^("choice" (index (list-player-characters client.account-name) (index words 1))))
74-
(if choice
75-
(let ^(^("player-object" (load-player-character client.account-name choice)))
76-
(nop
77-
(set client "player" player-object)
78-
(set client "logged_on" true)
79-
(set player-object "account" client.account-object)
80-
(move-object player-object (load "new-haven/start-room") "contents")
81-
(set client "command-handler" handle-verb-command)
82-
(command player-object "look")
83-
)
84-
)
85-
)
86-
)
87-
(if (equal (index words 0) "create")
88-
(let (^("name" (index words 1)))
89-
(let (^("player-object" (create-player-character client.account-name name)))
90-
(if player-object
91-
(nop
92-
(set client "player" player-object)
93-
(set client "logged_on" true)
94-
(set player-object "account" client.account-object)
95-
(move-object player-object (create-character-generation-area player-object) "contents")
96-
(set client "command-handler" handle-verb-command)
97-
(command player-object "look")
98-
)
99-
(echo client "I couldn't create that character.\n")
100-
)
101-
)
102-
)
103-
(if (equal (index words 0) "delete")
104-
(echo client "Not implemented.\n")
105-
(let (^("characters" (list-player-characters client.account-name)))
106-
(nop
107-
(if (equal (length characters) 0)
108-
(echo client "You have no characters.\n")
109-
(display-characters client characters)
110-
)
111-
(echo client "Valid commands are connect, create, and delete.\n")
112-
)
113-
)
114-
)
107+
(defun "handle-register-command" [client account-name password]
108+
(let (^("account-object" (load-account account-name)))
109+
(if account-object
110+
(echo client "That account already exists.\n")
111+
(let (^("account-object" (create-account account-name password)))
112+
(handle-login-command client account-name password)
115113
)
116114
)
117115
)
118116
)
119117

120-
))
118+

DefaultDatabase/database/static/go.mud

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/* Opens an indirect link */
2121
(defun "open-link" ^("from" "to" "names" "function ?on-follow")
2222
*(nop
23-
(prop-add from "links" (first names))
23+
(prop-add from "links" (record ^("name" (first names))))
2424
(for "name" names
2525
*(nop
2626
(add-verb from name (m-nothing)

0 commit comments

Comments
 (0)