1 #include "room.h"
2 #include "tune.h"
3 
4 ONE_EXIT("room/wiz_hall", "south",
5 	 "Room of quests",
6 "This is the room of quests. Every wizard can make at most one quest.\n" +
7 "When he has made a quest, he should have it approved by an arch wizard.\n" +
8 "When it is approved, put a permanent object in this room, wich has as\n"+
9 "short description the name of the wizard. All objects in this room will be\n"+
10 "checked when a player wants to become a wizard. The player must have\n"+
11 "solved ALL quests. To mark that a quest is solved, call 'set_quest(\"name\")'\n"+
12 "in the player object. The objects must all accept the id 'quest' and the\n"+
13 "name of the wizard. The objects must also define a function hint(),\n"+
14 "that should return a message giving a hint of where to start the quest.\n"+
15 "Note that players never can come here. set_quest(str) will return 1 if\n"+
16 "this is the first time it was solved by this player, otherwise 0.\n", 1)
17 
count(silently)18 count(silently) {
19     object ob;
20     int i;
21 
22     ob = first_inventory(this_object());
23     while(ob) {
24 	if (call_other(ob, "id", "quest")) {
25 	    string str;
26 	    str = call_other(ob, "short");
27 	    if (!call_other(this_player(), "query_quests", str))
28 		i += 1;
29 	}
30 	ob = next_inventory(ob);
31     }
32     if (!silently) {
33 	if (i == 0)
34 	    write("You have solved all quests!\n");
35 	else {
36 	    write("You have " + i + " quests unsolved.\n");
37 	    if (i - FREE_QUESTS <= 0)
38 		write("You don't have to solve any more quests.\n");
39 	    else
40 		write("You must solve " + (i - FREE_QUESTS) + " of these.\n");
41 	}
42     }
43     if (i - FREE_QUESTS < 0)
44 	return 0;
45     return i - FREE_QUESTS;
46 }
47 
list(i)48 list(i) {
49     object ob;
50 
51     ob = first_inventory(this_object());
52     while(ob) {
53 	if (call_other(ob, "id", "quest")) {
54 	    string str;
55 	    str = call_other(ob, "short");
56 	    if (!call_other(this_player(), "query_quests", str))
57 		i -= 1;
58 	    if (i == 0) {
59 		write(call_other(ob, "hint") + "\n");
60 		return;
61 	    }
62 	}
63 	ob = next_inventory(ob);
64     }
65 }
66