]> jfr.im git - irc/gameservirc.git/blame - gameserv/c_forest.cpp
Added the do_store command, and some store functionality. Also added an init_masters...
[irc/gameservirc.git] / gameserv / c_forest.cpp
CommitLineData
85ce9d3e 1#include "sockhelp.h"
2#include "aClient.h"
3#include "list.h"
4#include "extern.h"
5#include <cctype>
6
7void do_forest(char *u);
8
9void forest(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, "SEARCH") == 0)
19 {
20 do_forest(source);
21 } else if (stricmp(cmd, "ATTACK") == 0) {
22 do_attack(source);
ad7dfaa0 23 } else if (stricmp(cmd, "HEAL") == 0) {
24 do_heal(source);
85ce9d3e 25 }
26
27source--;
28}
29
30void do_forest(char *u)
31{
32 aClient *source;
33 char *cmd;
34
35 int num = rand() % 12;
36
37 source = find(u);
38
39 if (!is_playing(u))
40 {
41 notice(s_GameServ, u, "You must be playing the game to search the forest!");
42 }
43 else
44 {
45 if (source->stats->forest_fights <= 0)
46 {
47 notice(s_GameServ, u, "You are out of forest fights for the day. Wait "\
48 "till tomorrow!");
49 return;
50 }
51 else if (isnt_fighting(u))
52 {
53 Player *ni = source->stats;
54 ni->forest_fights--;
55 ni->fight = &monsters[ni->level - 1][num];
56 notice(s_GameServ, u, "You search the forest for something to kill...");
57 notice(s_GameServ, u, "You have found \ 2%s\ 2!", ni->fight->name);
58 ni->fight->hp = ni->fight->maxhp;
59 ni->battle = NULL;
60 display_monster(u);
61 }
62 else if (is_fighting(u))
63 {
64 notice(s_GameServ, u, "You want to fight two monsters at once?");
65 }
66 }
67
68}
69