#include "room.h"
object beggar;
#undef EXTRA_RESET
#define EXTRA_RESET extra_reset();
/*
* Make these arrays global, so they only have to be initialized once.
*/
string chat_str, a_chat_str, function, type, match;
extra_reset() {
no_castle_flag = 1;
if (!present("knife")) {
string weapon;
weapon = clone_object("obj/weapon");
call_other(weapon, "set_name", "knife");
call_other(weapon, "set_class", 5);
call_other(weapon, "set_value", 8);
call_other(weapon, "set_weight", 2);
move_object(weapon, this_object());
}
if (!beggar) {
beggar = clone_object("obj/monster");
call_other(beggar, "set_name", "beggar");
call_other(beggar, "set_level", 3);
call_other(beggar, "set_al", 200);
call_other(beggar, "set_race", "human");
call_other(beggar, "set_long",
"A really filthy looking poor beggar.\n");
call_other(beggar, "set_hp", 30);
move_object(beggar, this_object());
if (!function) {
function = allocate(1);
type = allocate(1);
match = allocate(1);
function[0] = "give_beggar";
type[0] = "gives";
}
call_other(beggar, "set_match", this_object(), function, type, match);
if (!chat_str) {
chat_str = allocate(3);
chat_str[0] =
"Beggar says: Please, give money to a poor beggar!\n";
chat_str[1] =
"Beggar says: Why can't I find any money ?\n";
chat_str[2] =
"Beggar says: two coins please !\n";
}
if (!a_chat_str) {
a_chat_str = allocate(1);
a_chat_str[0] = "Beggar says: Why do you do this to me ?\n";
}
call_other(beggar, "load_chat", 1, chat_str);
call_other(beggar, "load_a_chat", 20, a_chat_str);
}
}
TWO_EXIT("room/vill_road1", "south",
"room/pub2", "east",
"Small yard",
"A small yard surrounded by houses.\n", 1)
give_beggar(str) {
int money;
string who;
say("Beggar says: Thank you.\n");
if (sscanf(str, "%s gives you %d gold coins.", who, money) != 2)
return;
if (call_other(beggar, "query_money") >= 12 &&
environment(beggar) == this_object()) {
call_other(beggar, "init_command", "east");
call_other(beggar, "init_command", "buy beer");
call_other(beggar, "init_command", "drink beer");
call_other(beggar, "init_command", "west");
}
}