]> jfr.im git - irc/gameservirc.git/blob - gameserv/c_store.cpp
added items to the tavern.dat, added the filename option to the config file
[irc/gameservirc.git] / gameserv / c_store.cpp
1 #include "sockhelp.h"
2 #include "aClient.h"
3 #include "list.h"
4 #include "extern.h"
5 #include <cctype>
6
7 void do_store(char *u);
8
9 void store(char *source, char *buf)
10 {
11 char *cmd = strtok(buf, " ");
12
13 if (cmd[0] == ':')
14 cmd++;
15 if (source[0] == ':')
16 source++;
17
18 if (stricmp(cmd, "LIST") == 0)
19 {
20 do_store(source);
21 }
22
23 source--;
24 }
25
26 void do_store(char *u)
27 {
28 aClient *source;
29 char *cmd;
30
31 int num = rand() % 12;
32
33 source = find(u);
34
35 if (!is_playing(u))
36 {
37 notice(s_GameServ, u, "You must be playing the game to search the forest!");
38 }
39 else
40 {
41 if (source->stats->forest_fights <= 0)
42 {
43 notice(s_GameServ, u, "You are out of forest fights for the day. Wait "\
44 "till tomorrow!");
45 return;
46 }
47 else if (isnt_fighting(u))
48 {
49 Player *ni = source->stats;
50 ni->forest_fights--;
51 ni->fight = &monsters[ni->level - 1][num];
52 notice(s_GameServ, u, "You search the forest for something to kill...");
53 notice(s_GameServ, u, "You have found \ 2%s\ 2!", ni->fight->name);
54 ni->fight->hp = ni->fight->maxhp;
55 ni->battle = NULL;
56 display_monster(u);
57 }
58 else if (is_fighting(u))
59 {
60 notice(s_GameServ, u, "You want to fight two monsters at once?");
61 }
62 }
63
64 }
65