act_info.c
dystopia2/src/act_info.c · 220.4 KB
From the archive dystopia-2.0.tar.gz
Download the archive « Back to the archive contents
/***************************************************************************
* Dystopia 2 © 2000, 2001, 2002, 2003, 2004 & 2005 by Brian Graversen *
* *
* In order to use any part of this code, you must comply with the license *
* files found in the license folder in the doc folder of this codebase. *
* *
* Dystopia MUD is based of Godwars by Richard Woolcock. *
* *
* Godwars is based of Merc by Michael Chastain, Michael Quan and Mitchell *
* Tse. *
* *
* Merc is based of DIKU by Sebastian Hammer, Michael Seifert, Hans Henrik *
* Staerfeldt. Tom Madsen and Katja Nyboe. *
* *
* Any additional licenses, copyrights, etc that affects this sourcefile *
* will be mentioned just below this copyright notice. *
***************************************************************************/
#define _XOPEN_SOURCE
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include "dystopia.h"
LIST *top10_list = NULL;
char *const where_name[] = {
"#0[#GLight #0]#n ",
"#0[#GOn Finger #0]#n ",
"#0[#GOn Finger #0]#n ",
"#0[#GAround Neck #0]#n ",
"#0[#GAround Neck #0]#n ",
"#0[#GOn Body #0]#n ",
"#0[#GOn Head #0]#n ",
"#0[#GOn Legs #0]#n ",
"#0[#GOn Feet #0]#n ",
"#0[#GOn Hands #0]#n ",
"#0[#GOn Arms #0]#n ",
"#0[#GShield Hand #0]#n ",
"#0[#GAround Body #0]#n ",
"#0[#GAround Waist #0]#n ",
"#0[#GAround Wrist #0]#n ",
"#0[#GAround Wrist #0]#n ",
"#0[#GRight Hand #0]#n ",
"#0[#GLeft Hand #0]#n ",
"#0[#GThird Hand #0]#n ",
"#0[#GFourth Hand #0]#n ",
"#0[#GOn Face #0]#n ",
"#0[#GLeft Scabbard #0]#n ",
"#0[#GRight Scabbard#0]#n ",
"#0[#GMastery #0]#n ",
"#0[#GFloating #0]#n ",
"#0[#GMedal #0]#n ",
"#0[#GBodyart #0]#n ",
};
const char *exitname[6] = {
"to the north",
"to the east",
"to the south",
"to the west",
"above you",
"below you"
};
/*
* Local functions.
*/
void show_char_to_char_0 ( CHAR_DATA * victim, CHAR_DATA * ch );
void show_char_to_char_1 ( CHAR_DATA * victim, CHAR_DATA * ch );
void show_char_to_char ( LIST *list, CHAR_DATA *ch );
void check_left_arm ( CHAR_DATA * ch, CHAR_DATA * victim );
void check_right_arm ( CHAR_DATA * ch, CHAR_DATA * victim );
void check_left_leg ( CHAR_DATA * ch, CHAR_DATA * victim );
void check_right_leg ( CHAR_DATA * ch, CHAR_DATA * victim );
void add_vote ( POLL_DATA *poll, CHAR_DATA *ch, int choice );
char *birth_date ( CHAR_DATA * ch, bool is_self );
void do_immune(CHAR_DATA * ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
argument = one_argument(argument, arg);
if (IS_NPC(ch))
return;
send_to_char("----------------------------------------------------------------------------\n\r", ch);
send_to_char(" -= Immunities =-\n\r", ch);
send_to_char("----------------------------------------------------------------------------\n\r", ch);
/* Display weapon resistances */
send_to_char("Weapons:", ch);
if (!(!IS_IMMUNE(ch, IMM_SLASH) && !IS_IMMUNE(ch, IMM_STAB) && !IS_IMMUNE(ch, IMM_SMASH) && !IS_IMMUNE(ch, IMM_ANIMAL) && !IS_IMMUNE(ch, IMM_MISC)))
{
if (IS_IMMUNE(ch, IMM_SLASH))
send_to_char(" Slash Slice", ch);
if (IS_IMMUNE(ch, IMM_STAB))
send_to_char(" Stab Pierce", ch);
if (IS_IMMUNE(ch, IMM_SMASH))
send_to_char(" Blast Crush Pound", ch);
if (IS_IMMUNE(ch, IMM_ANIMAL))
send_to_char(" Claw Bite", ch);
if (IS_IMMUNE(ch, IMM_MISC))
send_to_char(" Grep Whip Suck", ch);
}
else
send_to_char(" None", ch);
send_to_char(".\n\r", ch);
/* Display spell immunities */
send_to_char("Spells :", ch);
if (!(!IS_IMMUNE(ch, IMM_CHARM) && !IS_IMMUNE(ch, IMM_HEAT) &&
!IS_IMMUNE(ch, IMM_COLD) && !IS_IMMUNE(ch, IMM_LIGHTNING) && !IS_IMMUNE(ch, IMM_ACID) && !IS_IMMUNE(ch, IMM_SUMMON) && !IS_IMMUNE(ch, IMM_DRAIN)))
{
if (IS_IMMUNE(ch, IMM_CHARM))
send_to_char(" Charm", ch);
if (IS_IMMUNE(ch, IMM_HEAT))
send_to_char(" Heat", ch);
if (IS_IMMUNE(ch, IMM_COLD))
send_to_char(" Cold", ch);
if (IS_IMMUNE(ch, IMM_LIGHTNING))
send_to_char(" Lightning", ch);
if (IS_IMMUNE(ch, IMM_ACID))
send_to_char(" Acid", ch);
if (!IS_IMMUNE(ch, IMM_SUMMON))
send_to_char(" Summon", ch);
if (IS_IMMUNE(ch, IMM_DRAIN))
send_to_char(" Drain", ch);
if (IS_IMMUNE(ch, IMM_TRANSPORT))
send_to_char(" Transport", ch);
}
else
send_to_char(" None", ch);
send_to_char(".\n\r", ch);
/* Display skill immunities */
send_to_char("Skills :", ch);
if (!(!IS_IMMUNE(ch, IMM_HURL) && !IS_IMMUNE(ch, IMM_BACKSTAB) && !IS_IMMUNE(ch, IMM_KICK) && !IS_IMMUNE(ch, IMM_DISARM) && !IS_IMMUNE(ch, IMM_STEAL)))
{
if (IS_IMMUNE(ch, IMM_HURL))
send_to_char(" Hurl", ch);
if (IS_IMMUNE(ch, IMM_BACKSTAB))
send_to_char(" Backstab", ch);
if (IS_IMMUNE(ch, IMM_KICK))
send_to_char(" Kick", ch);
if (IS_IMMUNE(ch, IMM_DISARM))
send_to_char(" Disarm", ch);
if (IS_IMMUNE(ch, IMM_STEAL))
send_to_char(" Steal", ch);
}
else
send_to_char(" None", ch);
send_to_char(".\n\r", ch);
send_to_char("----------------------------------------------------------------------------\n\r", ch);
return;
}
void do_auction(CHAR_DATA *ch, char *argument)
{
AUCTION_DATA *auction;
EVENT_DATA *pEvent;
ITERATOR *pIter;
OBJ_DATA *obj;
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
if (IS_NPC(ch) || ch->desc == NULL)
return;
argument = one_argument(argument, arg);
if (arg[0] == '\0')
{
send_to_char("Syntax: auction [bid|sell|list|id|remove|mybids]\n\r", ch);
return;
}
if (!str_cmp("bid", arg))
{
int id, bid;
argument = one_argument(argument, arg);
if (arg[0] == '\0')
{
send_to_char("Syntax: auction bid [id of item] [your bid]\n\r", ch);
return;
}
if ((id = atoi(arg)) < 1)
{
send_to_char("There are not items with an ID below 1.\n\r", ch);
return;
}
one_argument(argument, arg);
bid = atoi(arg);
pIter = AllocIterator(auction_list);
while ((auction = (AUCTION_DATA *) NextInList(pIter)) != NULL)
{
if (auction->id != id) continue;
if ((obj = auction->obj) == NULL)
{
send_to_char("You have encountered a bug, please report this.\n\r", ch);
return;
}
if (!str_cmp(auction->seller_account, ch->pcdata->account))
{
send_to_char("You cannot bid on your own sales.\n\r", ch);
return;
}
if (auction->bidder_name[0] == '\0' && bid < auction->bid)
{
printf_to_char(ch, "You must bid at least %d gold.\n\r", auction->bid);
return;
}
else if (auction->bidder_name[0] != '\0' && bid < 21 * auction->bid / 20)
{
printf_to_char(ch, "You must bid at least %d gold.\n\r", 21 * auction->bid / 20);
return;
}
if (getGold(ch) < bid)
{
send_to_char("You do not have that much gold.\n\r", ch);
return;
}
/* new bidder, repay the old bidder */
if (auction->bidder_account[0] != '\0')
{
ACCOUNT_DATA *account;
if (!str_cmp(auction->bidder_account, ch->pcdata->account))
{
send_to_char("You already have the highest bid on this item.\n\r", ch);
return;
}
if ((account = load_account(auction->bidder_account)) != NULL)
{
account->goldcrowns += auction->bid;
save_account(account);
close_account(account);
}
}
free_string(auction->bidder_name);
free_string(auction->bidder_account);
auction->bidder_name = str_dup(ch->name);
auction->bidder_account = str_dup(ch->pcdata->account);
auction->bid = bid;
setGold(ch, -1 * bid);
/* if this is a bidout, then set the expire time to now */
if (auction->bidout > 0 && auction->bid >= auction->bidout)
auction->expire = current_time;
save_auctions();
send_to_char("New bid accepted.\n\r", ch);
return;
}
send_to_char("There is no item with that ID.\n\r", ch);
}
else if (!str_cmp("list", arg))
{
bool found = FALSE, information = FALSE;
int section, count = 0;
one_argument(argument, arg);
if ((section = atoi(arg)) <= 0)
{
section = 1;
information = TRUE;
}
pIter = AllocIterator(auction_list);
while ((auction = (AUCTION_DATA *) NextInList(pIter)) != NULL)
{
count++;
if (count <= 10 * (section - 1) || count > 10 * section)
continue;
if ((obj = auction->obj) == NULL)
{
bug("do_auction: auction without item.\n\r", 0);
continue;
}
if (!found)
{
printf_to_char(ch, "[%3s] [%-58s] [%10s]\n\r", "ID", "name of item", "cost");
send_to_char("----------------------------------------"
"---------------------------------------\n\r", ch);
found = TRUE;
}
/* add the correct colour */
if (!str_cmp(auction->seller_name, ch->name))
sprintf(arg, "#R");
else if (auction->bidder_name[0] != '\0')
{
if (!str_cmp(auction->bidder_name, ch->name))
sprintf(arg, "#R");
else
sprintf(arg, "#y");
}
else
arg[0] = '\0';
cprintf(buf, "[%3d] [%-58.58s#n] [%s%5d gold#n]\n\r",
auction->id, obj->short_descr, arg, auction->bid);
send_to_char(buf, ch);
}
if (!found)
send_to_char("There are no more items for auction.\n\r", ch);
else if (information)
send_to_char("\n\rType 'auction list [2|3|4|etc] to get more auctions.\n\r", ch);
}
else if (!str_cmp("id", arg))
{
int id;
one_argument(argument, arg);
if (arg[0] == '\0')
{
send_to_char("Syntax: auction id [id of item]\n\r", ch);
return;
}
if ((id = atoi(arg)) < 1)
{
send_to_char("There are not items with an ID below 1.\n\r", ch);
return;
}
pIter = AllocIterator(auction_list);
while ((auction = (AUCTION_DATA *) NextInList(pIter)) != NULL)
{
BUFFER *buf_id, *buf_box;
if (auction->id != id) continue;
if ((obj = auction->obj) == NULL)
{
send_to_char("You have encountered a bug, please report this.\n\r", ch);
return;
}
buf_id = identify_obj(obj);
bprintf(buf_id, "\n\r #o-:|:-~-:|:-~-:|:-~-:|:-~-:|:--:|:-~-:|:-~-:|:-~-:|:-~-:|:-~-:|:-~-:|:-#n\n\n\r");
bprintf(buf_id, "This auction will complete at %s.\n\r", smudge_time(auction->expire));
bprintf(buf_id, "You must bid at least #C%d#n gold to enter the auction.\n\r",
(auction->bidder_name[0] != '\0') ? 21 * auction->bid / 20 : auction->bid);
if (auction->bidder_name[0] != '\0')
bprintf(buf_id, "Highest bid is currently held by #C%s#n.\n\r", auction->bidder_name);
buf_box = box_text(buf_id->data, "Auction ID");
send_to_char(buf_box->data, ch);
buffer_free(buf_id);
return;
}
send_to_char("There is no item with that ID.\n\r", ch);
}
else if (!str_cmp("sell", arg))
{
AFFECT_DATA *paf;
int cost, sell_cost = 5, bidout = 0;
argument = one_argument(argument, arg);
if (arg[0] == '\0')
{
send_to_char("Syntax: auction sell [object] [price] [bidout]\n\r"
" The bidout is optional.\n\r", ch);
return;
}
if ((obj = get_obj_carry(ch, arg)) == NULL)
{
send_to_char("You are not carrying that item.\n\r", ch);
return;
}
/* must be claimed, rare, etc etc */
if (obj->ownerid != ch->pcdata->playerid)
{
send_to_char("You can only auction items that you own.\n\r", ch);
return;
}
if (!IS_OBJ_STAT(obj, ITEM_RARE) && !IS_OBJ_STAT(obj, ITEM_SENTIENT))
{
send_to_char("You can only auction rare/sentient items.\n\r", ch);
return;
}
if (obj->cost < 50)
{
send_to_char("The item must have a value of at least 50.\n\r", ch);
return;
}
argument = one_argument(argument, arg);
if ((cost = atoi(arg)) < 1 || cost > 10000)
{
send_to_char("The price should be between 1 and 10000 goldcrowns.\n\r", ch);
return;
}
argument = one_argument(argument, arg);
if (arg[0] != '\0')
{
bidout = atoi(arg);
if (bidout < cost || bidout > 20000)
{
printf_to_char(ch, "The bidout should be between %d and 20000 goldcrowns.\n\r", cost);
return;
}
}
if (getGold(ch) < sell_cost)
{
printf_to_char(ch, "You need %d more gold to auction this item.\n\r", sell_cost - getGold(ch));
return;
}
setGold(ch, -1 * sell_cost);
/* strip all events on item */
pIter = AllocIterator(obj->events);
while ((pEvent = (EVENT_DATA *) NextInList(pIter)) != NULL)
dequeue_event(pEvent, TRUE);
obj_from_char(obj);
/* strip all temporary affects on this item */
pIter = AllocIterator(obj->affected);
while ((paf = (AFFECT_DATA *) NextInList(pIter)) != NULL)
{
if (paf->duration > 0)
{
switch(paf->type)
{
default:
break;
case OAFF_FROSTBITE:
REMOVE_BIT(obj->spellflags, OAFF_FROSTBITE);
break;
case OAFF_LIQUID:
REMOVE_BIT(obj->spellflags, OAFF_LIQUID);
break;
}
DetachAtIterator(pIter);
PushStack(paf, affect_free);
}
}
/* remove the item from the game */
DetachFromList(obj, object_list);
obj->ownerid = 0;
free_string(obj->questowner);
obj->questowner = str_dup("");
auction = alloc_auction();
auction->seller_name = str_dup(ch->name);
auction->seller_account = str_dup(ch->pcdata->account);
auction->bid = cost;
auction->bidout = bidout;
auction->obj = obj;
AttachToList(auction, auction_list);
save_auctions();
sprintf(buf, "%s has put a new item up for auction (help auction)", ch->name);
do_info(ch, buf);
if (IS_SET(ch->deaf, CHANNEL_INFO))
send_to_char("Ok.\n\r", ch);
}
else if (!str_cmp(arg, "remove"))
{
int id;
one_argument(argument, arg);
if (arg[0] == '\0')
{
send_to_char("Syntax: auction remove [id of item]\n\r", ch);
return;
}
if ((id = atoi(arg)) < 1)
{
send_to_char("There are not items with an ID below 1.\n\r", ch);
return;
}
pIter = AllocIterator(auction_list);
while ((auction = (AUCTION_DATA *) NextInList(pIter)) != NULL)
{
if (auction->id != id) continue;
if ((obj = auction->obj) == NULL)
{
send_to_char("You have encountered a bug, please report this.\n\r", ch);
return;
}
if (str_cmp(auction->seller_name, ch->name))
{
send_to_char("You do not own this auction.\n\r", ch);
return;
}
if (auction->bidder_name[0] != '\0')
{
send_to_char("Someone have already bid on this item, you cannot remove it.\n\r", ch);
return;
}
/* give the item to the character */
auction->obj = NULL;
AttachToList(obj, object_list);
obj_to_char(obj, ch);
free_auction(auction);
act("$p appears in $n's hands in a blast of lightning.", ch, obj, NULL, TO_ROOM);
act("$p appears in your hands in a blast of lightning.", ch, obj, NULL, TO_CHAR);
send_to_char("You cancel the auction.\n\r", ch);
return;
}
send_to_char("There is no item with that ID.\n\r", ch);
}
else if (!str_cmp(arg, "mybids"))
{
bool found = FALSE;
pIter = AllocIterator(auction_list);
while ((auction = (AUCTION_DATA *) NextInList(pIter)) != NULL)
{
if (!str_cmp(auction->bidder_name, ch->name))
{
if ((obj = auction->obj) == NULL)
{
bug("do_auction: auction without item.\n\r", 0);
continue;
}
if (!found)
{
printf_to_char(ch, "[%3s] [%-58s] [%10s]\n\r", "ID", "name of item", "cost");
send_to_char("----------------------------------------"
"---------------------------------------\n\r", ch);
found = TRUE;
}
cprintf(buf, "[%3d] [%-58.58s#n] [%5d gold]\n\r",
auction->id, obj->short_descr, auction->bid);
send_to_char(buf, ch);
}
}
if (!found)
send_to_char("You do not have the highest bid on any items.\n\r", ch);
}
else
{
do_auction(ch, "");
return;
}
}
void do_pkready(CHAR_DATA *ch, char *argument)
{
char buf[MAX_STRING_LENGTH];
if (IS_NPC(ch) || !ch->desc)
return;
if (argument[0] == '\0')
{
do_help(ch, "pkready");
return;
}
if (IS_SET(ch->extra, EXTRA_PKREADY))
{
send_to_char("You have already joined the PK rank.\n\r", ch);
return;
}
if (strcmp(crypt(argument, ch->desc->account->owner), ch->desc->account->password))
{
send_to_char("Illegal password.\n\r", ch);
return;
}
SET_BIT(ch->extra, EXTRA_PKREADY);
sprintf(buf, "%s considers %s pkready!", ch->name, (ch->sex == SEX_FEMALE) ? "herself" : "himself");
do_info(ch, buf);
}
void do_session(CHAR_DATA *ch, char *argument)
{
BUFFER *buf, *buf2;
int minutes, hours;
if (IS_NPC(ch))
return;
/* calculate information */
minutes = (current_time - ch->xlogon) / 60;
hours = minutes / 60;
minutes = minutes % 60;
/* present data */
buf = buffer_new(MAX_STRING_LENGTH);
bprintf(buf, " You have been online for #C%d#n hour%s and #C%d#n minute%s.\n\n\r",
hours, (hours == 1) ? "" : "s", minutes, (minutes == 1) ? "" : "s");
bprintf(buf, " Hitpoints : #G+#C%-5d#n Magics : #G+#C%-5d#n Movement : #G+#C%d#n\n\r",
ch->pcdata->session->hit, ch->pcdata->session->mana, ch->pcdata->session->move);
bprintf(buf, " Quest Runs : #G+#C%-5d#n Gold : #G+#C%-5d#n Experience : #G+#C%d#n\n\r",
ch->pcdata->session->quests, ch->pcdata->session->gold, ch->pcdata->session->exp);
bprintf(buf, " MKills : #G+#C%-5d#n PKills : #G+#C%-5d#n\n\r",
ch->pcdata->session->mkills, ch->pcdata->session->pkills);
buf2 = box_text(buf->data, "Session Info");
send_to_char(buf2->data, ch);
buffer_free(buf);
}
void do_spectate(CHAR_DATA *ch, char *argument)
{
ITERATOR *pIter, *pIter2;
SNOOP_DATA *snoop;
char arg[MAX_STRING_LENGTH];
one_argument(argument, arg);
if (arg[0] == '\0')
{
if (in_fortress(ch) || in_arena(ch))
send_to_char("Spectate [on/off]\n\r", ch);
else
send_to_char("Spectate whom?\n\r", ch);
return;
}
if (in_arena(ch) || in_fortress(ch))
{
if (!str_cmp(arg, "on"))
{
SET_BIT(ch->pcdata->tempflag, TEMP_SPECTATE);
send_to_char("You now allow others to spectate on you.\n\r", ch);
}
else if (!str_cmp(arg, "off"))
{
REMOVE_BIT(ch->pcdata->tempflag, TEMP_SPECTATE);
send_to_char("You no longer allow anyone to spectate you.\n\r", ch);
stop_spectating(ch);
}
else
{
do_spectate(ch, "");
}
return;
}
else
{
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
bool found = FALSE;
if (!str_cmp(arg, "off"))
{
pIter = AllocIterator(descriptor_list);
while ((d = (DESCRIPTOR_DATA *) NextInList(pIter)) != NULL)
{
pIter2 = AllocIterator(d->snoops);
while ((snoop = (SNOOP_DATA *) NextInList(pIter2)) != NULL)
{
if (snoop->snooper == ch->desc)
{
if (d->character)
act("$n stops spectating on you.", ch, NULL, d->character, TO_VICT);
free_snoop(d, snoop);
found = TRUE;
}
}
}
if (found)
send_to_char("You stop spectating.\n\r", ch);
else
send_to_char("You are not spectating on anyone.\n\r", ch);
return;
}
if ((victim = get_char_world(ch, arg)) == NULL)
{
send_to_char("They are not here.\n\r", ch);
return;
}
if (IS_NPC(victim))
{
send_to_char("Spectating on monsters is boring.\n\r", ch);
return;
}
if (!in_fortress(victim) && !in_arena(victim))
{
send_to_char("They are not in the fortress or arena.\n\r", ch);
return;
}
if (!IS_SET(victim->pcdata->tempflag, TEMP_SPECTATE))
{
send_to_char("They do not allow spectating.\n\r", ch);
return;
}
if (victim->desc == NULL)
{
send_to_char("You cannot specate on linkdead players.\n\r", ch);
return;
}
pIter = AllocIterator(descriptor_list);
while ((d = (DESCRIPTOR_DATA *) NextInList(pIter)) != NULL)
{
pIter2 = AllocIterator(d->snoops);
while ((snoop = (SNOOP_DATA *) NextInList(pIter2)) != NULL)
{
if (snoop->snooper == ch->desc)
{
send_to_char("You are already spectating on someone else.\n\r", ch);
send_to_char("If you want to stop spectating, type 'spectate off'.\n\r", ch);
return;
}
}
}
/* create new snoop and attach */
snoop = alloc_snoop();
snoop->snooper = ch->desc;
AttachToList(snoop, victim->desc->snoops);
act("You start spectating on $N.", ch, NULL, victim, TO_CHAR);
act("$n starts spectating on you.", ch, NULL, victim, TO_VICT);
}
}
void do_evolve(CHAR_DATA *ch, char *argument)
{
EVOLVE_DATA evolve;
char buf[MAX_STRING_LENGTH];
/* reset evolve data */
evolve.valid = FALSE;
evolve.field = NULL;
evolve.error[0] = '\0';
evolve.mana = 0;
evolve.hps = 0;
evolve.move = 0;
evolve.gold = 0;
evolve.exp = 0;
evolve.bit = 0;
if (IS_NPC(ch) || !ch->desc)
return;
else if (!str_prefix("clear ", argument))
{
argument = one_argument(argument, buf);
if (strcmp(crypt(argument, ch->desc->account->owner), ch->desc->account->password))
{
send_to_char("You must confirm with your password. Please remember that you can\n\r"
"only clear your evolves once. After this attempt, your will be stuck\n\r"
"with your chosen evolves forever.\n\n\r"
"Syntax: evolve clear [password]\n\r", ch);
return;
}
ch->pcdata->powers[EVOLVE_1] = 0;
ch->pcdata->powers[EVOLVE_2] = 0;
ch->pcdata->powers[EVOLVE_3] = 0;
ch->pcdata->evolveCount = 0;
send_to_char("All your evolves has been cleared.\n\r", ch);
clearstats(ch);
return;
}
else if (IS_CLASS(ch, CLASS_WARLOCK))
warlock_evolve(ch, argument, &evolve);
else if (IS_CLASS(ch, CLASS_SHADOW))
shadow_evolve(ch, argument, &evolve);
else if (IS_CLASS(ch, CLASS_GIANT))
giant_evolve(ch, argument, &evolve);
else if (IS_CLASS(ch, CLASS_FAE))
fae_evolve(ch, argument, &evolve);
else
{
send_to_char("Your class cannot evolve yet.\n\r", ch);
return;
}
/* not possible to do this ? */
if (evolve.valid == FALSE)
{
mxp_to_char(evolve.error, ch, MXP_ALL);
return;
}
if (ch->max_hit < evolve.hps)
{
sprintf(buf, "You need %d more hps before you can gain this evolve.\n\r", evolve.hps - ch->max_hit);
send_to_char(buf, ch);
return;
}
if (ch->max_mana < evolve.mana)
{
sprintf(buf, "You need %d more mana before you can gain this evolve.\n\r", evolve.mana - ch->max_mana);
send_to_char(buf, ch);
return;
}
if (ch->max_move < evolve.move)
{
sprintf(buf, "You need %d more move before you can gain this evolve.\n\r", evolve.move - ch->max_move);
send_to_char(buf, ch);
return;
}
if (ch->exp < evolve.exp)
{
sprintf(buf, "You need %d more exp before you can gain this evolve.\n\r", evolve.exp - ch->exp);
send_to_char(buf, ch);
return;
}
if (getGold(ch) < evolve.gold)
{
sprintf(buf, "You need %d more goldcrowns before you can gain this evolve.\n\r", evolve.gold - getGold(ch));
send_to_char(buf, ch);
return;
}
/* take the quest points and experience points */
ch->exp -= evolve.exp;
setGold(ch, -1 * evolve.gold);
ch->pcdata->evolveCount++;
/* reduce statistics */
ch->max_hit = 3 * ch->max_hit / 4;
ch->max_mana = 3 * ch->max_mana / 4;
ch->max_move = 3 * ch->max_move / 4;
/* do a restore of statistics */
ch->hit = ch->max_hit;
ch->move = ch->max_move;
ch->mana = ch->max_mana;
/* set the bit on the field */
SET_BIT(*evolve.field, evolve.bit);
send_to_char("You have succesfully evolved.\n\r", ch);
}
void do_mudinfo(CHAR_DATA *ch, char *argument)
{
printf_to_char(ch, " %s\n\n\r", get_dystopia_banner("Mudinfo", 56));
printf_to_char(ch, " Decapitations this week %3d kill%s\n\r",
muddata.pk_count_now[0], (muddata.pk_count_now[0] == 1) ? "" : "s");
printf_to_char(ch, " Gensteals this week %3d steal%s\n\r",
muddata.pk_count_now[2], (muddata.pk_count_now[2] == 1) ? "" : "s");
printf_to_char(ch, " Average Players Online %3d player%s\n\r",
(muddata.mudinfo[MUDINFO_MCCP_USERS] + muddata.mudinfo[MUDINFO_OTHER_USERS]) /
muddata.mudinfo[MUDINFO_UPDATED], ((muddata.mudinfo[MUDINFO_MCCP_USERS] +
muddata.mudinfo[MUDINFO_OTHER_USERS]) / muddata.mudinfo[MUDINFO_UPDATED] == 1) ? "" : "s");
printf_to_char(ch, " Peak Players Online (this week) %3d player%s\n\r",
muddata.mudinfo[MUDINFO_PEAK_USERS], (muddata.mudinfo[MUDINFO_PEAK_USERS] == 1) ? "" : "s");
printf_to_char(ch, " Number of areas for Calim's Cradle %3d area%s\n\r",
top_area, (top_area == 1) ? "" : "s");
printf_to_char(ch, " Number of rooms for Calim's Cradle %4d room%s\n\r",
top_room, (top_room == 1) ? "" : "s");
printf_to_char(ch, "\n\r Data collected over %d day%s and %d hour%s\n\r",
(muddata.mudinfo[MUDINFO_UPDATED] / (120 * 24)),
(muddata.mudinfo[MUDINFO_UPDATED] / (120 * 24) == 1) ? "" : "s",
(muddata.mudinfo[MUDINFO_UPDATED] / 120 - 24 * (muddata.mudinfo[MUDINFO_UPDATED] / (120 * 24))),
(muddata.mudinfo[MUDINFO_UPDATED] / 120 - 24 * (muddata.mudinfo[MUDINFO_UPDATED] / (120 * 24)) == 1) ? "" : "s");
printf_to_char(ch, "\n\r %s\n\r", get_dystopia_banner("", 56));
}
void do_top10(CHAR_DATA *ch, char *argument)
{
TOP10_ENTRY *entry;
ITERATOR *pIter;
BUFFER *buf = buffer_new(MAX_STRING_LENGTH), *buf2;
bprintf(buf, " #G%-14s %-7s %-6s %-7s %-5s#n\n\n\r",
"name", "pkscore", "pkills", "pdeaths", "hours");
pIter = AllocIterator(top10_list);
while ((entry = (TOP10_ENTRY *) NextInList(pIter)) != NULL)
{
bprintf(buf, " %-14s %5d %3d %3d %3d\n\r",
entry->name, entry->pkscore, entry->pkills, entry->pdeaths, entry->hours);
}
buf2 = box_text(buf->data, "Top 10 PK'ers");
send_to_char(buf2->data, ch);
buffer_free(buf);
}
void do_oldprompt(CHAR_DATA *ch, char *argument)
{
if (IS_SET(ch->extra, EXTRA_PROMPT))
{
send_to_char("You already have a customized prompt.\n\r", ch);
return;
}
free_string(ch->prompt);
free_string(ch->cprompt);
ch->prompt = str_dup("#n<[#C%x#n] [%hH %mM %vV] [#C%t#n ft]> ");
ch->cprompt = str_dup("#n<[%f] [%hH %mM %vV] [#C%t#n ft]> ");
SET_BIT(ch->extra, EXTRA_PROMPT);
send_to_char("Ok. You now use the old prompt.\n\r", ch);
}
void do_rarelist(CHAR_DATA *ch, char *argument)
{
OBJ_DATA *obj;
LIST *list;
ITERATOR *pIter;
char arg[MAX_INPUT_LENGTH];
bool found = FALSE;
one_argument(argument, arg);
if (arg[0] == '\0')
{
list = ch->carrying;
if (SizeOfList(list) == 0)
{
send_to_char("You are not carrying anything.\n\r", ch);
return;
}
send_to_char("You are carrying:\n\r", ch);
}
else
{
OBJ_DATA *container;
if ((container = get_obj_carry(ch, arg)) == NULL)
{
if ((container = get_obj_wear(ch, arg)) == NULL)
{
if ((container = get_obj_list(ch, arg, ch->in_room->contents)) == NULL)
{
send_to_char("You where unable to find that container of rares.\n\r", ch);
return;
}
}
}
if (container->item_type != ITEM_CONTAINER)
{
act("$p is not a container.", ch, container, NULL, TO_CHAR);
return;
}
list = container->contains;
if (SizeOfList(list) == 0)
{
act("$p is empty.", ch, container, NULL, TO_CHAR);
return;
}
act("$p contains:", ch, container, NULL, TO_CHAR);
}
pIter = AllocIterator(list);
while ((obj = (OBJ_DATA *) NextInList(pIter)) != NULL)
{
char buf[MAX_STRING_LENGTH];
if (obj->wear_loc != WEAR_NONE)
continue;
if (IS_OBJ_STAT(obj, ITEM_RARE) || IS_OBJ_STAT(obj, ITEM_SENTIENT))
{
found = TRUE;
sprintf(buf, " [%3d] %s\n\r", obj->cost, format_obj_to_char(obj, ch, TRUE));
send_to_char(buf, ch);
}
}
if (!found)
send_to_char(" Nothing.\n\r", ch);
}
void do_enhcombat(CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
int i, found1 = -1, found2 = -1;
const char *c_table[8][2] =
{
{ "red", "#R" },
{ "green", "#G" },
{ "cyan", "#C" },
{ "blue", "#L" },
{ "purple", "#P" },
{ "yellow", "#y" },
{ "none", "#n" },
/* terminate */
{ "", "" }
};
if (IS_NPC(ch)) return;
argument = one_argument(argument, arg);
one_argument(argument, arg2);
if (arg[0] == '\0' || arg2[0] == '\0')
{
send_to_char("What colour should the emphasized text be in?\n\r", ch);
send_to_char(" - red, green, cyan, blue, purple, yellow or none.\n\n\r", ch);
send_to_char("Syntax: enhcombat [your messages] [opponent messages]\n\r", ch);
return;
}
for (i = 0; c_table[i][0][0] != '\0'; i++)
{
if (!str_cmp(arg, c_table[i][0]))
found1 = i;
if (!str_cmp(arg2, c_table[i][0]))
found2 = i;
}
if (found1 == -1 || found2 == -1)
{
do_enhcombat(ch, "");
return;
}
if (!str_cmp(arg, "none") && !str_cmp(arg2, "none"))
{
REMOVE_BIT(ch->newbits, NEW_ENH_COMBAT);
}
else
{
SET_BIT(ch->newbits, NEW_ENH_COMBAT);
sprintf(arg, "%s%s", c_table[found1][1], c_table[found2][1]);
free_string(ch->pcdata->enh_combat);
ch->pcdata->enh_combat = str_dup(arg);
}
send_to_char("Ok.\n\r", ch);
}
void do_reimb(CHAR_DATA *ch, char *argument)
{
char field[MAX_INPUT_LENGTH];
char value[MAX_INPUT_LENGTH];
int age;
if (IS_NPC(ch)) return;
if (!ch->desc || !ch->desc->account)
return;
argument = one_argument(argument, field);
argument = one_argument(argument, value);
age = (ch->played + (int) (current_time - ch->logon)) / 3600;
if (field[0] == '\0')
{
BUFFER *buf = buffer_new(MAX_STRING_LENGTH);
bprintf(buf, " %s\n\n\r", get_dystopia_banner("Reimb Screen", 72));
bprintf(buf, " Syntax: reimb [field] [value]\n\n\r");
bprintf(buf, " #u#9Field#n\n\r");
bprintf(buf, " spells (10 pts) : green blue red yellow purple.\n\r");
bprintf(buf, " stances ( 5 pts) : viper crane crab mongoose bull dragon swallow.\n\r");
bprintf(buf, " weapons ( 5 pts) : slice slash whip claw pound crush pierce unarmed.\n\r");
bprintf(buf, " gold ( 1 pts) : gain 25 goldcrowns per reimb point spend.\n\r");
bprintf(buf, " exp (35 pts) : gain 10.000.000 experience points.\n\r");
if (!IS_SET(ch->newbits, NEW_REIMBCLASS) && ch->class != 0)
bprintf(buf, " class (35 pts) : boosts some of your class powers.\n\r");
if (!IS_SET(ch->newbits, NEW_MASTERY) && IS_SET(ch->desc->account->flags, ACCOUNT_FLAG_MASTERY))
bprintf(buf, " mastery (10 pts) : gain mastery.\n\r");
bprintf(buf, "\n\r You have #C%d#n reimb points.\n\r", ch->desc->account->reimb_points);
bprintf(buf, "\n\r %s\n\r", get_dystopia_banner("", 72));
send_to_char(buf->data, ch);
buffer_free(buf);
return;
}
if (!str_cmp(field, "spells"))
{
int cost = 10;
if (value[0] == '\0')
{
send_to_char("What spell colour do you wish to raise to 200?\n\r", ch);
return;
}
if (ch->desc->account->reimb_points < cost)
{
send_to_char("You do not have enough reimb points to do that.\n\r", ch);
return;
}
if (!str_cmp(value, "red"))
{
if (ch->spl[RED_MAGIC] >= 200)
{
send_to_char("You have already mastered that spell colour.\n\r", ch);
return;
}
ch->spl[RED_MAGIC] = 200;
}
else if (!str_cmp(value, "green"))
{
if (ch->spl[GREEN_MAGIC] >= 200)
{
send_to_char("You have already mastered that spell colour.\n\r", ch);
return;
}
ch->spl[GREEN_MAGIC] = 200;
}
else if (!str_cmp(value, "yellow"))
{
if (ch->spl[YELLOW_MAGIC] >= 200)
{
send_to_char("You have already mastered that spell colour.\n\r", ch);
return;
}
ch->spl[YELLOW_MAGIC] = 200;
}
else if (!str_cmp(value, "blue"))
{
if (ch->spl[BLUE_MAGIC] >= 200)
{
send_to_char("You have already mastered that spell colour.\n\r", ch);
return;
}
ch->spl[BLUE_MAGIC] = 200;
}
else if (!str_cmp(value, "purple"))
{
if (ch->spl[PURPLE_MAGIC] >= 200)
{
send_to_char("You have already mastered that spell colour.\n\r", ch);
return;
}
ch->spl[PURPLE_MAGIC] = 200;
}
else
{
send_to_char("There is no spell colour by that name.\n\r", ch);
return;
}
ch->desc->account->reimb_points -= cost;
send_to_char("Reimbed.\n\r", ch);
return;
}
else if (!str_cmp(field, "stances"))
{
int cost = 5;
if (value[0] == '\0')
{
send_to_char("What stance do you wish to raise to 200?\n\r", ch);
return;
}
if (age < 1)
{
send_to_char("Your character must be atleast 1 hour old before you can reimb stances.\n\r", ch);
return;
}
if (ch->desc->account->reimb_points < cost)
{
send_to_char("You do not have enough reimb points to do that.\n\r", ch);
return;
}
if (!str_cmp(value, "viper"))
{
if (ch->stance[STANCE_VIPER] >= 200)
{
send_to_char("You have already mastered that stance.\n\r", ch);
return;
}
ch->stance[STANCE_VIPER] = 200;
}
else if (!str_cmp(value, "crane"))
{
if (ch->stance[STANCE_CRANE] >= 200)
{
send_to_char("You have already mastered that stance.\n\r", ch);
return;
}
ch->stance[STANCE_CRANE] = 200;
}
else if (!str_cmp(value, "crab"))
{
if (ch->stance[STANCE_CRAB] >= 200)
{
send_to_char("You have already mastered that stance.\n\r", ch);
return;
}
ch->stance[STANCE_CRAB] = 200;
}
else if (!str_cmp(value, "mongoose"))
{
if (ch->stance[STANCE_MONGOOSE] >= 200)
{
send_to_char("You have already mastered that stance.\n\r", ch);
return;
}
ch->stance[STANCE_MONGOOSE] = 200;
}
else if (!str_cmp(value, "bull"))
{
if (ch->stance[STANCE_BULL] >= 200)
{
send_to_char("You have already mastered that stance.\n\r", ch);
return;
}
ch->stance[STANCE_BULL] = 200;
}
else if (!str_cmp(value, "dragon"))
{
if (ch->stance[STANCE_DRAGON] >= 200)
{
send_to_char("You have already mastered that stance.\n\r", ch);
return;
}
ch->stance[STANCE_DRAGON] = 200;
}
else if (!str_cmp(value, "swallow"))
{
if (ch->stance[STANCE_SWALLOW] >= 200)
{
send_to_char("You have already mastered that stance.\n\r", ch);
return;
}
ch->stance[STANCE_SWALLOW] = 200;
}
else
{
send_to_char("There is no stance by that name.\n\r", ch);
return;
}
ch->desc->account->reimb_points -= cost;
send_to_char("Reimbed.\n\r", ch);
return;
}
else if (!str_cmp(field, "weapons"))
{
int cost = 5;
if (value[0] == '\0')
{
send_to_char("What weapon do you wish to raise to 200?\n\r", ch);
return;
}
if (age < 1)
{
send_to_char("Your character must be atleast 1 hour old before you can reimb weapons.\n\r", ch);
return;
}
if (ch->desc->account->reimb_points < cost)
{
send_to_char("You do not have enough reimb points to do that.\n\r", ch);
return;
}
if (!str_cmp(value, "unarmed"))
{
if (ch->wpn[0] >= 200)
{
send_to_char("You have already mastered that weapon.\n\r", ch);
return;
}
ch->wpn[0] = 200;
}
else if (!str_cmp(value, "slice"))
{
if (ch->wpn[1] >= 200)
{
send_to_char("You have already mastered that weapon.\n\r", ch);
return;
}
ch->wpn[1] = 200;
}
else if (!str_cmp(value, "slash"))
{
if (ch->wpn[3] >= 200)
{
send_to_char("You have already mastered that weapon.\n\r", ch);
return;
}
ch->wpn[3] = 200;
}
else if (!str_cmp(value, "whip"))
{
if (ch->wpn[4] >= 200)
{
send_to_char("You have already mastered that weapon.\n\r", ch);
return;
}
ch->wpn[4] = 200;
}
else if (!str_cmp(value, "claw"))
{
if (ch->wpn[5] >= 200)
{
send_to_char("You have already mastered that weapon.\n\r", ch);
return;
}
ch->wpn[5] = 200;
}
else if (!str_cmp(value, "pound"))
{
if (ch->wpn[7] >= 200)
{
send_to_char("You have already mastered that weapon.\n\r", ch);
return;
}
ch->wpn[7] = 200;
}
else if (!str_cmp(value, "crush"))
{
if (ch->wpn[8] >= 200)
{
send_to_char("You have already mastered that weapon.\n\r", ch);
return;
}
ch->wpn[8] = 200;
}
else if (!str_cmp(value, "pierce"))
{
if (ch->wpn[11] >= 200)
{
send_to_char("You have already mastered that weapon.\n\r", ch);
return;
}
ch->wpn[11] = 200;
}
else
{
send_to_char("There is no weapon skill by that name.\n\r", ch);
return;
}
ch->desc->account->reimb_points -= cost;
send_to_char("Reimbed.\n\r", ch);
return;
}
else if (!str_cmp(field, "gold"))
{
int amount;
if ((amount = atoi(value)) <= 0 || amount > ch->desc->account->reimb_points)
{
send_to_char("Syntax: reimb gold [amount of reimbpoints to use]\n\r", ch);
return;
}
ch->desc->account->reimb_points -= amount;
setGold(ch, amount * 25);
setGoldTotal(ch, amount * 25);
send_to_char("Reimbed.\n\r", ch);
return;
}
else if (!str_cmp(field, "exp"))
{
int cost = 35;
if (age < 1)
{
send_to_char("Your character must be atleast 1 hour old to gain this reimb.\n\r", ch);
return;
}
if (ch->desc->account->reimb_points < cost)
{
send_to_char("You don't have enough reimb points to do this.\n\r", ch);
return;
}
ch->exp += 10000000;
ch->desc->account->reimb_points -= cost;
send_to_char("Reimbed.\n\r", ch);
return;
}
else if (!str_cmp(field, "class"))
{
int cost = 35;
if (ch->class == 0)
{
send_to_char("You do not have a class.\n\r", ch);
return;
}
if (age < 2)
{
send_to_char("Your character must be at least 2 hours old before you can boost its class.\n\r", ch);
return;
}
if (IS_SET(ch->newbits, NEW_REIMBCLASS))
{
send_to_char("You have already boosted your class powers.\n\r", ch);
return;
}
if (ch->desc->account->reimb_points < cost)
{
send_to_char("You don't have enough reimb points to do this.\n\r", ch);
return;
}
if (ch->class == CLASS_GIANT)
{
ch->pcdata->powers[GIANT_POINTS] += 100000;
ch->pcdata->powers[GIANT_ATT] = UMIN(10, ch->pcdata->powers[GIANT_ATT] + 2);
ch->pcdata->powers[GIANT_DEF] = UMIN(10, ch->pcdata->powers[GIANT_DEF] + 2);
}
else if (ch->class == CLASS_SHADOW)
{
ch->pcdata->powers[SHADOW_POWER] += 100000;
ch->pcdata->powers[SHADOW_MARTIAL] = UMIN(25, ch->pcdata->powers[SHADOW_MARTIAL] + 3);
}
else if (ch->class == CLASS_FAE)
{
if (ch->pcdata->powers[FAE_PLASMA] >= 7
&& ch->pcdata->powers[FAE_MATTER] >= 7
&& ch->pcdata->powers[FAE_ENERGY] >= 7
&& ch->pcdata->powers[FAE_WILL] >= 7)
{
send_to_char("You would not gain anything from this.\n\r", ch);
return;
}
if (ch->pcdata->powers[FAE_PLASMA] < 7)
ch->pcdata->powers[FAE_PLASMA]++;
if (ch->pcdata->powers[FAE_MATTER] < 7)
ch->pcdata->powers[FAE_MATTER]++;
if (ch->pcdata->powers[FAE_ENERGY] < 7)
ch->pcdata->powers[FAE_ENERGY]++;
if (ch->pcdata->powers[FAE_WILL] < 7)
ch->pcdata->powers[FAE_WILL]++;
ch->practice += 200;
}
else if (ch->class == CLASS_WARLOCK)
{
EVENT_DATA *event;
if (ch->pcdata->powers[SPHERE_DIVINATION] >= 4
&& ch->pcdata->powers[SPHERE_ABJURATION] >= 4
&& ch->pcdata->powers[SPHERE_ENCHANTMENT] >= 4
&& ch->pcdata->powers[SPHERE_INVOCATION] >= 4
&& ch->pcdata->powers[SPHERE_NECROMANCY] >= 4
&& ch->pcdata->powers[SPHERE_SUMMONING] >= 4)
{
send_to_char("You would not gain anything from this.\n\r", ch);
return;
}
/* remove any study events */
if ((event = event_isset_mobile(ch, EVENT_PLAYER_STUDY)) != NULL)
dequeue_event(event, TRUE);
if (ch->pcdata->powers[SPHERE_DIVINATION] < 4)
ch->pcdata->powers[SPHERE_DIVINATION]++;
if (ch->pcdata->powers[SPHERE_ABJURATION] < 4)
ch->pcdata->powers[SPHERE_ABJURATION]++;
if (ch->pcdata->powers[SPHERE_ENCHANTMENT] < 4)
ch->pcdata->powers[SPHERE_ENCHANTMENT]++;
if (ch->pcdata->powers[SPHERE_INVOCATION] < 4)
ch->pcdata->powers[SPHERE_INVOCATION]++;
if (ch->pcdata->powers[SPHERE_NECROMANCY] < 4)
ch->pcdata->powers[SPHERE_NECROMANCY]++;
if (ch->pcdata->powers[SPHERE_SUMMONING] < 4)
ch->pcdata->powers[SPHERE_SUMMONING]++;
}
else
{
send_to_char("Your class cannot be reimbed. Tell an immortal.\n\r", ch);
return;
}
SET_BIT(ch->newbits, NEW_REIMBCLASS);
ch->desc->account->reimb_points -= cost;
send_to_char("Reimbed.\n\r", ch);
return;
}
else if (!str_cmp(field, "mastery"))
{
int cost = 10, i;
if (age < 4)
{
send_to_char("Your character must be atleast 4 hours old before it can regain mastery.\n\r", ch);
return;
}
if (!IS_SET(ch->desc->account->flags, ACCOUNT_FLAG_MASTERY))
{
send_to_char("You cannot reimb mastery with this account.\n\r", ch);
return;
}
if (IS_SET(ch->newbits, NEW_MASTERY))
{
send_to_char("This character already have mastery.\n\r", ch);
return;
}
if (ch->desc->account->reimb_points < cost)
{
send_to_char("You don't have enough reimb points to do this.\n\r", ch);
return;
}
for (i = 0; i < 5; i++)
ch->spl[i] = UMAX(ch->spl[i], 200);
for (i = 0; i < 13; i++)
ch->wpn[i] = UMAX(ch->wpn[i], 200);
for (i = 1; i < 11; i++)
ch->stance[i] = UMAX(ch->stance[i], 200);
REMOVE_BIT(ch->desc->account->flags, ACCOUNT_FLAG_MASTERY);
ch->desc->account->reimb_points -= cost;
send_to_char("Reimbed. Please type 'mastery'.\n\r", ch);
return;
}
else
{
do_reimb(ch, "");
return;
}
}
void do_timer(CHAR_DATA *ch, char *argument)
{
EVENT_DATA *event;
ITERATOR *pIter;
pIter = AllocIterator(global_event_list);
while ((event = (EVENT_DATA *) NextInList(pIter)) != NULL)
{
if (event->type == EVENT_GAME_ARENA)
{
char buf[MAX_INPUT_LENGTH];
sprintf(buf, "The next arena is in %s\n\r", event_time_left(event));
send_to_char(buf, ch);
return;
}
}
send_to_char("The arena is broken, please report this.\n\r", ch);
}
void do_donate(CHAR_DATA *ch, char *argument)
{
OBJ_DATA *obj, *pit;
ROOM_INDEX_DATA *pRoom;
ITERATOR *pIter;
char arg[MAX_INPUT_LENGTH];
one_argument(argument, arg);
if (arg[0] == '\0')
{
send_to_char("What item do you wish to donate?\n\r", ch);
return;
}
if ((obj = get_obj_carry(ch, arg)) == NULL)
{
send_to_char("You do not have that item.\n\r", ch);
return;
}
if (obj->ownerid != 0)
{
send_to_char("That item is owned, first you must unclaim it.\n\r", ch);
return;
}
if ((pRoom = get_room_index(ROOM_VNUM_CITYSAFE)) == NULL)
{
send_to_char("Some gremlins have stolen the MUD, please report this.\n\r", ch);
return;
}
pIter = AllocIterator(pRoom->contents);
while ((pit = (OBJ_DATA *) NextInList(pIter)) != NULL)
{
if (pit->pIndexData->vnum == OBJ_VNUM_PIT)
break;
}
if (pit == NULL)
{
send_to_char("The pit seems to be missing.\n\r", ch);
return;
}
act("$n donates $p to the donation pit.", ch, obj, NULL, TO_ROOM);
act("You donate $p to the donation pit.", ch, obj, NULL, TO_CHAR);
obj_from_char(obj);
obj_to_obj(obj, pit);
}
void do_disenchant(CHAR_DATA *ch, char *argument)
{
AREA_DATA *pArea;
AREA_AFFECT *paf;
ITERATOR *pIter;
bool found = FALSE;
if (ch->in_room == NULL || IS_NPC(ch))
{
send_to_char("You have encountered a bug, please report this.\n\r", ch);
return;
}
pArea = ch->in_room->area;
pIter = AllocIterator(pArea->affects);
while ((paf = (AREA_AFFECT *) NextInList(pIter)) != NULL)
{
if (paf->owner == ch->pcdata->playerid)
{
paf->duration = 1;
found = TRUE;
}
}
if (!found)
send_to_char("You have no area enchantments running in this area.\n\r", ch);
else
send_to_char("Ok.\n\r", ch);
}
void do_areaaff(CHAR_DATA *ch, char *argument)
{
CHAR_DATA *gch;
char buf[MAX_STRING_LENGTH];
AREA_AFFECT *aff;
ITERATOR *pIter;
bool found = FALSE;
AREA_DATA *pArea;
if (!ch->in_room || (pArea = ch->in_room->area) == NULL)
{
send_to_char("You have encounted a bug, please report this.\n\r", ch);
return;
}
send_to_char("#u#9Area Affects in this area#n\n\r", ch);
pIter = AllocIterator(pArea->affects);
while ((aff = (AREA_AFFECT *) NextInList(pIter)) != NULL)
{
found = TRUE;
switch(aff->type)
{
default:
sprintf(buf, "o Unknown enchantment laid by %s for %d seconds.\n\r",
((gch = get_online_player(aff->owner)) == NULL) ? "unknown" : gch->name,
aff->duration * 10);
break;
case AREA_AFF_EARTHMOTHER:
sprintf(buf, "o Earthmother enchantment laid by %s for %d seconds.\n\r",
((gch = get_online_player(aff->owner)) == NULL) ? "unknown" : gch->name,
aff->duration * 10);
break;
case AREA_AFF_PLAGUE:
sprintf(buf, "o Plague enchantment laid by %s for %d seconds.\n\r",
((gch = get_online_player(aff->owner)) == NULL) ? "unknown" : gch->name,
aff->duration * 10);
break;
case AREA_AFF_MILKANDHONEY:
sprintf(buf, "o Land of milk and honey enchantment laid by %s for %d seconds.\n\r",
((gch = get_online_player(aff->owner)) == NULL) ? "unknown" : gch->name,
aff->duration * 10);
break;
}
send_to_char(buf, ch);
}
if (!found)
{
send_to_char("There are no enchantments in this area.\n\r", ch);
}
}
void do_bountylist(CHAR_DATA *ch, char *argument)
{
BUFFER *buf = buffer_new(MAX_STRING_LENGTH), *buf2;
CHAR_DATA *gch;
ITERATOR *pIter;
DESCRIPTOR_DATA *d;
bprintf(buf, " #G%-12s %6s %7s %3s %6s#n\n\r",
"Name", "Bounty", "Pkscore", "Gen", "Status");
pIter = AllocIterator(descriptor_list);
while ((d = (DESCRIPTOR_DATA *) NextInList(pIter)) != NULL)
{
if (!d->connected == CON_PLAYING || (gch = d->character) == NULL)
continue;
if (gch->level > 6)
continue;
if (!can_see(ch, d->character))
continue;
bprintf(buf, " #C%-12s#n %5d %5d %d %3d\n\r",
gch->name, gch->pcdata->bounty, get_ratio(gch), gch->generation, gch->pcdata->status);
}
buf2 = box_text(buf->data, "Bountylist");
buffer_free(buf);
send_to_char(buf2->data, ch);
}
void do_dcredits(CHAR_DATA *ch, char *argument)
{
do_help(ch, "dcredits");
}
void do_version(CHAR_DATA *ch, char *argument)
{
BUFFER *buf = buffer_new(MAX_STRING_LENGTH);
BUFFER *buf2;
bprintf(buf, " This MUD is based on the Dystopia 2 codebase. The original\n\r");
bprintf(buf, " Dystopia 2 was called Calim's Cradle.\n\n\r");
bprintf(buf, " Calim's Cradle was build on a mix of GangWars and Dystopia 1.4 CE,\n\r");
bprintf(buf, " making it one of the more advanced GodWars MUDs out there.\n\n\r");
bprintf(buf, " GangWars is based on the SocketMud(tm) codebase,\n\r");
buf2 = box_text(buf->data, "Version");
send_to_char(buf2->data, ch);
buffer_free(buf);
}
void do_upkeep(CHAR_DATA *ch, char *argument)
{
BUFFER *buf;
AFFECT_DATA *paf, *prev_paf, *next_paf;
ITERATOR *pIter, *pIter2;
bool found;
int evocount = 0, sn;
if (IS_NPC(ch)) return;
buf = buffer_new(MAX_STRING_LENGTH);
bprintf(buf, " %s<BR><BR>", get_dystopia_banner("Upkeep List", 68));
bprintf(buf, " [%s] Chaos Shield [%s] Extra Speed [%s] Sanctuary<BR>",
(IS_ITEMAFF(ch, ITEMA_CHAOSSHIELD)) ? "o" : " ",
(IS_ITEMAFF(ch, ITEMA_SPEED)) ? "o" : " ",
(IS_AFFECTED(ch, AFF_SANCTUARY)) ? "o" : " ");
bprintf(buf, " [%s] Pro. vs Evil [%s] Pro. vs Good [%s] Flying<BR>",
(IS_AFFECTED(ch, AFF_PROTECT)) ? "o" : " ",
(IS_AFFECTED(ch, AFF_PROTECT_GOOD)) ? "o" : " ",
(IS_AFFECTED(ch, AFF_FLYING)) ? "o" : " ");
bprintf(buf, " [%s] Passdoor [%s] Invisibility [%s] Sneak<BR>",
(IS_AFFECTED(ch, AFF_PASS_DOOR)) ? "o" : " ",
(IS_AFFECTED(ch, AFF_INVISIBLE)) ? "o" : " ",
(IS_AFFECTED(ch, AFF_SNEAK)) ? "o" : " ");
bprintf(buf, " [%s] Regeneration<BR>",
(IS_ITEMAFF(ch, ITEMA_REGENERATE)) ? "o" : " ");
bprintf(buf, "<BR> %s<BR><BR>", get_dystopia_banner("Spell Affects", 68));
pIter = AllocIterator(ch->affected);
while ((paf = (AFFECT_DATA *) NextInList(pIter)) != NULL)
{
found = FALSE;
pIter2 = AllocIterator(ch->affected);
while ((prev_paf = (AFFECT_DATA *) NextInList(pIter2)) != NULL)
{
if (prev_paf == paf)
break;
if (prev_paf->type == paf->type)
{
found = TRUE;
break;
}
}
if (found) continue;
bprintf(buf, " Spell: '%s'<BR>", skill_table[paf->type].name);
pIter2 = AllocIterator(ch->affected);
while ((next_paf = (AFFECT_DATA *) NextInList(pIter2)) != NULL)
{
if (next_paf == paf)
break;
}
do {
if (next_paf->type != paf->type) continue;
bprintf(buf, " * modifies %s by %d for %d hour%s with bits %s.<BR>",
affect_loc_name(next_paf->location), next_paf->modifier,
paf->duration, (next_paf->duration != 1) ? "s" : "",
affect_bit_name(next_paf->bitvector));
} while ((next_paf = (AFFECT_DATA *) NextInList(pIter2)) != NULL);
}
if (SizeOfList(ch->affected) == 0)
{
bprintf(buf, " You are not affected by any spells.<BR>");
}
bprintf(buf, "<BR> %s<BR><BR>", get_dystopia_banner("Class Powers", 68));
if (IS_CLASS(ch, CLASS_FAE))
{
bprintf(buf, " [%s] <SEND href=\"spiritkiss\">Spirit Kiss</SEND> "
" [%s] <SEND href=\"truesight\">Truesight</SEND> "
" [%s] <SEND href=\"blastbeams\">Blastbeams</SEND><BR>",
(is_affected(ch, gsn_spiritkiss)) ? "o" : " ",
(IS_SET(ch->act, PLR_HOLYLIGHT)) ? "o" : " ",
(IS_SET(ch->pcdata->powers[FAE_BITS], FAE_BLASTBEAMS)) ? "o" : " ");
bprintf(buf, " [%s] <SEND href=\"vanish\">Vanish</SEND> "
" [%s] <SEND href=\"elementalform\">Elemental Form</SEND> "
" [%s] <SEND href=\"gaseous\">Gaseous</SEND><BR>",
(IS_SET(ch->act, PLR_HIDE)) ? "o" : " ",
(IS_SET(ch->newbits, NEW_CUBEFORM)) ? "o" : " ",
(IS_SET(ch->pcdata->powers[FAE_BITS], FAE_GASEOUS)) ? "o" : " ");
if (ch->pcdata->powers[DISC_FAE_ARCANE] >= 10)
{
if ((sn = skill_lookup("ghost gauntlets")) < 0)
bug("do_upkeep: ghost gauntlets doesn't exist as a spell.", 0);
bprintf(buf, " [%s] <SEND href=\"ghostgauntlets\">Ghost Gauntlets</SEND> %s",
(is_affected(ch, sn)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
if (IS_SET(ch->pcdata->powers[EVOLVE_2], FAE_EVOLVE_CHAMELEON))
{
bprintf(buf, " [%s] <SEND href=\"chameleon\">Chameleon Skin</SEND> %s",
(IS_SET(ch->newbits, NEW_CHAMELEON)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
if (IS_SET(ch->pcdata->powers[EVOLVE_2], FAE_EVOLVE_HALO))
{
bprintf(buf, " [%s] <SEND href=\"halo\">Halo</SEND> %s",
(IS_SET(ch->newbits, NEW_FAEHALO)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
if (IS_SET(ch->pcdata->powers[EVOLVE_2], FAE_EVOLVE_PSPRAY))
{
bprintf(buf, " [%s] <SEND href=\"pspray\">Prismatic Spray</SEND> %s",
(IS_SET(ch->newbits, NEW_PSPRAY)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
/* make sure we break that line */
if (evocount > 0 && (evocount % 3) != 0)
bprintf(buf, "<BR>");
}
else if (IS_CLASS(ch, CLASS_GIANT))
{
bprintf(buf, " [%s] <SEND href=\"dawnstrength\">Dawnstrength</SEND> "
" [%s] <SEND href=\"truesight\">Truesight</SEND> "
" [%s] <SEND href=\"standfirm\">Standfirm</SEND><BR>",
(IS_SET(ch->newbits, NEW_CUBEFORM)) ? "o" : " ",
(IS_SET(ch->act, PLR_HOLYLIGHT)) ? "o" : " ",
(ch->pcdata->powers[GIANT_STANDFIRM] == 1) ? "o" : " ");
if (IS_SET(ch->pcdata->powers[EVOLVE_1], GIANT_EVOLVE_EARTH))
{
bprintf(buf, " [%s] <SEND href=\"mudform\">Mudform</SEND> %s",
(IS_SET(ch->newbits, NEW_MUDFORM)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
if (IS_SET(ch->pcdata->powers[EVOLVE_2], GIANT_EVOLVE_WINDWALK))
{
bprintf(buf, " [%s] <SEND href=\"windwalk\">Windwalk</SEND> %s",
(IS_SET(ch->extra, EXTRA_WINDWALK)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
if (IS_SET(ch->pcdata->powers[EVOLVE_2], GIANT_EVOLVE_SINKHOLE))
{
bprintf(buf, " [%s] <SEND href=\"sinkhole\">Sinkhole</SEND> %s",
(IS_SET(ch->newbits, NEW_SINKHOLE)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
/* make sure we break that line */
if (evocount > 0 && (evocount % 3) != 0)
bprintf(buf, "<BR>");
}
else if (IS_CLASS(ch, CLASS_WARLOCK))
{
bprintf(buf, " [%s] <SEND href=\"shattershield\">Shattershield</SEND> "
" [%s] <SEND href=\"magicvest\">Magical Vestment</SEND>"
" [%s] <SEND href=\"wallofswords\">Wall of Swords</SEND><BR>",
(IS_SET(ch->affected_by, AFF_SHATTERSHIELD)) ? "o" : " ",
(IS_SET(ch->affected_by, AFF_MVEST)) ? "o" : " ",
(IS_SET(ch->affected_by, AFF_WALLSWORDS)) ? "o" : " ");
bprintf(buf, " [%s] <SEND href=\"displacement\">Displaced</SEND> "
" [%s] <SEND href=\"truesight\">Truesight</SEND> "
" [%s] <SEND href=\"fireshield\">Fire Shield</SEND><BR>",
(event_isset_mobile(ch, EVENT_PLAYER_DISPLACE)) ? "o" : " ",
(IS_SET(ch->act, PLR_HOLYLIGHT)) ? "o" : " ",
(IS_SET(ch->affected_by, AFF_FIRESHIELD)) ? "o" : " ");
bprintf(buf, " [%s] <SEND href=\"steelfists\">Steel Fists</SEND> ",
(is_affected(ch, skill_lookup("steel fists"))) ? "o" : " ");
/* we will use evocount to know when to add a linebreak */
evocount = 1;
if (IS_SET(ch->pcdata->powers[EVOLVE_1], WARLOCK_EVOLVE_MOUNTAIN))
{
bprintf(buf, " [%s] <SEND href=\"mking\">Mountain King</SEND> %s",
(IS_SET(ch->newbits, NEW_MOUNTAIN)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
if (IS_SET(ch->pcdata->powers[EVOLVE_1], WARLOCK_EVOLVE_CONTINGENCY))
{
bprintf(buf, " [%s] Contingency %s",
(SizeOfList(ch->pcdata->contingency) > 0) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
if (IS_SET(ch->pcdata->powers[EVOLVE_2], WARLOCK_EVOLVE_BACKLASH))
{
bprintf(buf, " [%s] <SEND href=\"backlash\">Backlash</SEND> %s",
(IS_SET(ch->newbits, NEW_BACKLASH)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
if (IS_SET(ch->pcdata->powers[EVOLVE_2], WARLOCK_EVOLVE_HUNTINGSTARS))
{
bprintf(buf, " [%s] <SEND href=\"hstars\">Hunting Stars</SEND> %s",
(IS_SET(ch->newbits, NEW_HSTARS)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
/* make sure we break that line */
if ((evocount % 3) != 0)
bprintf(buf, "<BR>");
}
else if (IS_CLASS(ch, CLASS_SHADOW))
{
bprintf(buf, " [%s] Shadowform "
" [%s] <SEND href=\"truesight\">Truesight</SEND> "
" [%s] Blurred<BR>",
(IS_SET(ch->pcdata->powers[SHADOW_BITS], NPOWER_SHADOWFORM)) ? "o" : " ",
(IS_SET(ch->act, PLR_HOLYLIGHT)) ? "o" : " ",
(IS_SET(ch->pcdata->powers[SHADOW_BITS], NPOWER_BLUR)) ? "o" : " ");
bprintf(buf, " [%s] <SEND href=\"vanish\">Vanish</SEND> "
" [%s] Knifeshield "
" [%s] Bloodrage<BR>",
(IS_SET(ch->act, PLR_HIDE)) ? "o" : " ",
(IS_SET(ch->pcdata->powers[SHADOW_BITS], NPOWER_KNIFESHIELD)) ? "o" : " ",
(IS_SET(ch->pcdata->powers[SHADOW_BITS], NPOWER_BLOODRAGE)) ? "o" : " ");
bprintf(buf, " [%s] <SEND href=\"shield\">Shielded</SEND> "
" [%s] <SEND href=\"aurasight\">Aura Sight</SEND> ",
(IS_IMMUNE(ch, IMM_SHIELDED)) ? "o" : " ",
(IS_SET(ch->pcdata->powers[SHADOW_BITS], NPOWER_AURASIGHT)) ? "o" : " ");
/* we will use evocount to know when to add a linebreak */
evocount = 2;
if (IS_SET(ch->pcdata->powers[EVOLVE_1], SHADOW_EVOLVE_SHADOWPLANE))
{
bprintf(buf, " [%s] <SEND href=\"shadowplane\">Shadowplane</SEND> %s",
(IS_SET(ch->newbits, NEW_SHADOWPLANE)) ? "o" : " ", ((++evocount) % 3 == 0) ? "<BR>" : "");
}
/* make sure we break that line */
if ((evocount % 3) != 0)
bprintf(buf, "<BR>");
}
else
{
bprintf(buf, " You have no class powers.<BR>");
}
bprintf(buf, "<BR> %s<BR>", get_dystopia_banner("", 68));
/* send and free data */
mxp_to_char(buf->data, ch, MXP_ALL);
buffer_free(buf);
}
/* Mastery command to gain mastery items */
void do_mastery(CHAR_DATA *ch, char *argument)
{
OBJ_DATA *obj;
char buf[MAX_INPUT_LENGTH];
char arg[MAX_INPUT_LENGTH];
if (IS_NPC(ch)) return;
one_argument(argument, arg);
if (IS_SET(ch->newbits, NEW_MASTERY) && ch->level < 6)
{
send_to_char("You've already gotten your mastery. If you lost it, tough luck!\n\r",ch);
return;
}
if (ch->wpn[0] < 200 || ch->wpn[1] < 200 || ch->wpn[2] < 200 || ch->wpn[3] < 200 || ch->wpn[4] < 200
|| ch->wpn[5] < 200 || ch->wpn[6] < 200 || ch->wpn[7] < 200 || ch->wpn[8] < 200
|| ch->wpn[9] < 200 || ch->wpn[10] < 200 || ch->wpn[11] < 200 || ch->wpn[12] < 200 )
{
send_to_char("Maybe you should grandmaster your weapons first.\n\r",ch);
return;
}
if (ch->spl[0] < 200 || ch->spl[1] < 200 || ch->spl[2] < 200 || ch->spl[3] < 200 || ch->spl[4] < 200 )
{
send_to_char("Maybe you should be grand sorcerer in all spell colors first.\n\r",ch);
return;
}
if (ch->stance[1] < 200 || ch->stance[2] < 200 || ch->stance[3] < 200 || ch->stance[4] < 200
|| ch->stance[5] < 200 || ch->stance[6] < 200 || ch->stance[7] < 200 || ch->stance[8] < 200
|| ch->stance[9] < 200 || ch->stance[10] < 200 )
{
send_to_char("Maybe you should grandmaster your stances first.\n\r",ch);
return;
}
obj = create_object(get_obj_index(OBJ_VNUM_PROTOPLASM), 50);
obj->questowner = str_dup(ch->name);
obj->ownerid = ch->pcdata->playerid;
obj->item_type = ITEM_ARMOR;
obj->weight = 1;
obj->value[0] = 25;
forge_affect(obj, 25);
if (IS_CLASS(ch, CLASS_WARLOCK))
{
if (arg[0] == '\0')
{
send_to_char("What magic sphere do you wish to master?\n\r", ch);
extract_obj(obj);
return;
}
else if (!str_cmp(arg, "invocation"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("the ion stone of invocation");
obj->name = str_dup("ion stone mastery");
obj->description = str_dup("a glowing ion stone floats here.");
ch->pcdata->powers[WARLOCK_PATH] = PATH_INVOCATION;
}
else if (!str_cmp(arg, "necromancy"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("the ion stone of necromancy");
obj->name = str_dup("ion stone mastery");
obj->description = str_dup("a glowing ion stone floats here.");
ch->pcdata->powers[WARLOCK_PATH] = PATH_NECROMANCY;
}
else if (!str_cmp(arg, "abjuration"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("the ion stone of abjuration");
obj->name = str_dup("ion stone mastery");
obj->description = str_dup("a glowing ion stone floats here.");
ch->pcdata->powers[WARLOCK_PATH] = PATH_ABJURATION;
}
else if (!str_cmp(arg, "divination"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("the ion stone of divination");
obj->name = str_dup("ion stone mastery");
obj->description = str_dup("a glowing ion stone floats here.");
ch->pcdata->powers[WARLOCK_PATH] = PATH_DIVINATION;
}
else if (!str_cmp(arg, "enchantment"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("the ion stone of enchantment");
obj->name = str_dup("ion stone mastery");
obj->description = str_dup("a glowing ion stone floats here.");
ch->pcdata->powers[WARLOCK_PATH] = PATH_ENCHANTMENT;
}
else if (!str_cmp(arg, "summoning"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("the ion stone of summoning");
obj->name = str_dup("ion stone mastery");
obj->description = str_dup("a glowing ion stone floats here.");
ch->pcdata->powers[WARLOCK_PATH] = PATH_SUMMONING;
}
else
{
send_to_char("There is no magic sphere by that name.\n\r", ch);
extract_obj(obj);
return;
}
ch->pcdata->powers[WARLOCK_RANK] = WLCK_RNK_WARLOCK;
update_archmage(ch);
}
else if (IS_CLASS(ch, CLASS_GIANT))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("the pendant of ages");
obj->name = str_dup("pendant mastery ages");
obj->description = str_dup("a shiny pendant lies on the floor.");
}
else if (IS_CLASS(ch, CLASS_SHADOW))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("a pair of whirling blades");
obj->name = str_dup("whirling blades mastery");
obj->description = str_dup("a pair of whirling blades hover in the air.");
}
else if (IS_CLASS(ch, CLASS_FAE))
{
if (arg[0] == '\0')
{
send_to_char("What ancient do you wish to master?\n\r", ch);
extract_obj(obj);
return;
}
else if (!str_cmp(arg, "matter"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("a glowing matter band");
obj->name = str_dup("glowing band mastery");
obj->description = str_dup("a glowing band lies on the floor.");
ch->pcdata->powers[FAE_PATH] = FAE_MATTER;
}
else if (!str_cmp(arg, "energy"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("a glowing energy band");
obj->name = str_dup("glowing band mastery");
obj->description = str_dup("a glowing band lies on the floor.");
ch->pcdata->powers[FAE_PATH] = FAE_ENERGY;
}
else if (!str_cmp(arg, "plasma"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("a glowing plasma band");
obj->name = str_dup("glowing band mastery");
obj->description = str_dup("a glowing band lies on the floor.");
ch->pcdata->powers[FAE_PATH] = FAE_PLASMA;
}
else if (!str_cmp(arg, "will"))
{
free_string(obj->short_descr);
free_string(obj->name);
free_string(obj->description);
obj->short_descr = str_dup("a glowing willpower band");
obj->name = str_dup("glowing band mastery");
obj->description = str_dup("a glowing band lies on the floor.");
ch->pcdata->powers[FAE_PATH] = FAE_WILL;
}
else
{
send_to_char("There is no ancient by that name.\n\r", ch);
extract_obj(obj);
return;
}
}
else
{
send_to_char("Your class mastery is not done yet.\n\r", ch);
extract_obj(obj);
return;
}
obj->wear_flags = ITEM_WEAR_MASTERY + ITEM_TAKE;
SET_BIT(ch->newbits, NEW_MASTERY);
SET_BIT(obj->extra_flags, ITEM_MASTERY);
obj_to_char(obj,ch);
sprintf(buf,"%s has achieved mastery.",ch->name);
do_info(ch,buf);
}
void do_ragnarok( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
int amount;
if (IS_NPC(ch)) return;
argument = one_argument(argument, arg);
if (!new_ragnarok)
{
send_to_char("The gods are tired, and will not listen to your pleas.\n\r", ch);
return;
}
/* players with fighttimers shouldn't be able to use
* this to chicken out of a fight.
*/
if (has_timer(ch)) return;
if (arg[0] == '\0' || !is_number(arg))
{
printf_to_char(ch, "The ragnarok pool is at : %d gold.\n\r", 3000 - ragnarok_cost);
send_to_char("How many goldcrowns do you want to bid ?\n\r",ch);
return;
}
amount = atoi(arg);
if (amount < 100)
{
send_to_char("You cannot tempt the gods with this puny amount.\n\r",ch);
return;
}
if (getGold(ch) < amount)
{
send_to_char("You don't have that many goldcrowns.\n\r",ch);
return;
}
setGold(ch, -1 * UMIN(amount, ragnarok_cost));
ragnarok_cost -= amount;
if (ragnarok_cost <= 0)
{
EVENT_DATA *event;
ragnarok_cost = 3000;
ragnarok = TRUE;
new_ragnarok = FALSE;
do_info(ch,"#0The world comes to an end, #yRAGNAROK#0 is over us all!!!!#n");
event = alloc_event();
event->fun = &event_game_ragnarok;
event->type = EVENT_GAME_RAGNAROK;
add_event_world(event, 15 * 60 * PULSE_PER_SECOND);
}
else
{
do_info(ch,"The ragnarok moves closer, the gods shiver with fear");
}
}
void do_favor( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
one_argument(argument,arg);
if (IS_NPC(ch)) return;
if (arg[0] == '\0')
{
send_to_char("Favor left, right or both hands ?\n\r",ch);
return;
}
if (!str_cmp(arg,"left"))
{
SET_BIT(ch->act, PLR_LEFTHAND);
send_to_char("You favor your left arm in combat.\n\r",ch);
}
else if (!str_cmp(arg,"right"))
{
SET_BIT(ch->act, PLR_RIGHTHAND);
send_to_char("You favor your right arm in combat.\n\r",ch);
}
else if (!str_cmp(arg,"both"))
{
SET_BIT(ch->act, PLR_AMBI);
send_to_char("You fight well with both arms.\n\r",ch);
}
else do_favor(ch,"");
}
void do_birth(CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
CHAR_DATA *victim;
DESCRIPTOR_DATA *dummy;
ACCOUNT_DATA *account;
if (IS_NPC(ch)) return;
argument = one_argument(argument, arg);
if (ch->sex != SEX_FEMALE)
{
send_to_char("Huh?\n\r", ch);
return;
}
if (!IS_EXTRA(ch, EXTRA_PREGNANT))
{
send_to_char("But you are not even pregnant!\n\r", ch);
return;
}
if (!IS_EXTRA(ch, EXTRA_LABOUR))
{
send_to_char("You're not ready to give birth yet.\n\r", ch);
return;
}
if (arg[0] == '\0')
{
if (ch->pcdata->genes[4] == SEX_MALE)
send_to_char("What do you wish to name your little boy?\n\r", ch);
else if (ch->pcdata->genes[4] == SEX_FEMALE)
send_to_char("What do you wish to name your little girl?\n\r", ch);
else
send_to_char("What do you wish to name your child?\n\r", ch);
return;
}
if (!check_parse_name(arg, TRUE))
{
send_to_char("Thats an illegal name.\n\r", ch);
return;
}
if (char_exists(arg))
{
send_to_char("That player already exists.\n\r", ch);
return;
}
/* make sure we have an live connection and a fitting account */
if (ch->desc == NULL || (account = load_account(ch->pcdata->account)) == NULL)
{
send_to_char("You have encountered a bug, please report this.\n\r", ch);
return;
}
if ((dummy = (DESCRIPTOR_DATA *) PopStack(descriptor_free)) == NULL)
{
dummy = calloc(1, sizeof(*dummy));
}
/* make sure it's added to the right account */
dummy->account = account;
arg[0] = UPPER(arg[0]);
load_char_obj(dummy, arg);
victim = dummy->character;
/* set the statistics for the child */
victim->pcdata->perm_str = 18;
victim->pcdata->perm_int = 18;
victim->pcdata->perm_wis = 18;
victim->pcdata->perm_dex = 18;
victim->pcdata->perm_con = 18;
victim->max_hit = 4000;
victim->hit = 4000;
victim->max_mana = 4000;
victim->mana = 4000;
victim->max_move = 4000;
victim->move = 4000;
victim->sex = ch->pcdata->genes[4];
victim->level = 2;
victim->in_room = ch->in_room;
/* save this account, and force a reload on the original */
account_new_player(dummy->account, victim);
save_account(dummy->account);
/* save and free the child */
save_char_obj(victim);
free_char(victim);
/* Put the descriptor back into the free list */
PushStack(dummy, descriptor_free);
ch->pcdata->genes[9]++;
REMOVE_BIT(ch->extra, EXTRA_PREGNANT);
REMOVE_BIT(ch->extra, EXTRA_LABOUR);
free_string(ch->pcdata->conception);
ch->pcdata->conception = str_dup("");
save_char_obj(ch);
if (ch->pcdata->genes[4] == SEX_MALE)
{
sprintf(buf, "%s gives birth to %s's son, named %s!",
ch->name, ch->pcdata->cparents, arg);
}
else
{
sprintf(buf, "%s gives birth to %s's daughter, named %s!",
ch->name, ch->pcdata->cparents, arg);
}
do_info(ch, buf);
send_to_char("Pop!\n\r", ch);
}
void do_leader(CHAR_DATA *ch, char *argument)
{
BUFFER *leaderlist;
leaderlist = get_leader();
if (leaderlist != NULL)
{
send_to_char(leaderlist->data, ch);
buffer_free(leaderlist);
}
else
{
send_to_char("Something went wrong. please report this.\n\r", ch);
}
}
BUFFER *get_leader()
{
BUFFER *buf = buffer_new(MAX_STRING_LENGTH);
BUFFER *buf2;
bprintf(buf, " #RMost Player Kills #C---> #G%-13s #Rwith #G%d #RKills#n\n\r",
leader_board.name[LEADER_PK], leader_board.number[LEADER_PK]);
bprintf(buf, " #RMost Hours Played #C---> #G%-13s #Rwith #G%d #RHours#n\n\r",
leader_board.name[LEADER_TIME], leader_board.number[LEADER_TIME]);
bprintf(buf, " #RMost Active Player #C---> #G%-13s #Rwith #G%d.%d #R%%#n\n\r",
leader_board.name[LEADER_ACTIVE], leader_board.number[LEADER_ACTIVE] / 10,
leader_board.number[LEADER_ACTIVE] % 10);
bprintf(buf, " #RMost Quest Completed #C---> #G%-13s #Rwith #G%d #RQuests#n\n\r",
leader_board.name[LEADER_QUEST], leader_board.number[LEADER_QUEST]);
bprintf(buf, " #RMost Mobs Killed #C---> #G%-13s #Rwith #G%d #RKills#n\n\r",
leader_board.name[LEADER_MOBKILLS], leader_board.number[LEADER_MOBKILLS]);
bprintf(buf, " #RHighest PK score #C---> #G%-13s #Rwith #G%d #RPoints#n\n\r",
leader_board.name[LEADER_PKSCORE], leader_board.number[LEADER_PKSCORE]);
bprintf(buf, " #RMost Status #C---> #G%-13s #Rwith #G%d #RStatus#n\n\r",
leader_board.name[LEADER_STATUS], leader_board.number[LEADER_STATUS]);
bprintf(buf, " #RMost Arena Wins #C---> #G%-13s #Rwith #G%d #RWins#n\n\r",
leader_board.name[LEADER_ARENA], leader_board.number[LEADER_ARENA]);
bprintf(buf, " #RRichest Kingdom #C---> #G%-13s #Rwith #G%d #RGold#n\n\r",
leader_board.name[LEADER_KINGDOM], leader_board.number[LEADER_KINGDOM]);
buf2 = box_text(buf->data, "Leader Board");
buffer_clear(buf);
bprintf(buf, "%s", buf2->data);
return buf;
}
void do_policy(CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
if (IS_NPC(ch) || !ch->desc) return;
argument = one_argument(argument, arg);
if (arg[0] == '\0')
{
do_help(ch, "policy");
return;
}
if (IS_SET(ch->pcdata->jflags, JFLAG_POLICY))
{
send_to_char("You have already accepted the policy.\n\r", ch);
return;
}
if (!str_cmp(arg, "accept"))
{
if (strcmp(crypt(argument, ch->desc->account->owner), ch->desc->account->password))
{
send_to_char("Illegal password.\n\r", ch);
WAIT_STATE(ch, 12);
return;
}
send_to_char("You have accepted the player policy at Calim's Cradle.\n\r", ch);
SET_BIT(ch->pcdata->jflags, JFLAG_POLICY);
log_string("%s has accepted the player policy.", ch->name);
}
else if (!str_cmp(arg, "decline"))
{
if (strcmp(crypt(argument, ch->desc->account->owner), ch->desc->account->password))
{
send_to_char("Illegal password.\n\r", ch);
WAIT_STATE(ch, 12);
return;
}
log_string("%s has declined the player policy.", ch->name);
ch->fight_timer = 0;
char_from_room(ch);
char_to_room(ch, get_room_index(ROOM_VNUM_LIMBO), TRUE);
do_quit(ch, "");
}
else
{
send_to_char("Syntax : policy [accept|decline] [password]\n\r", ch);
}
}
void do_vote(CHAR_DATA *ch, char *argument)
{
POLL_DATA *poll;
ITERATOR *pIter;
VOTE_DATA *vote;
char *strtime;
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf2[20];
int i, choice;
if (IS_NPC(ch) || !ch->desc) return;
argument = one_argument(argument, arg1);
one_argument(argument, arg2);
if (arg1[0] == '\0' || arg2[0] == '\0')
{
send_to_char(" #R[#G***#R] #CCurrent Polls at Calim's Cradle #R[#G***#R]#n\n\r", ch);
pIter = AllocIterator(poll_list);
while ((poll = (POLL_DATA *) NextInList(pIter)) != NULL)
{
strtime = ctime(&poll->expire);
for (i = 0; i < 6; i++)
buf2[i] = strtime[i + 4];
buf2[6] = '\0';
printf_to_char(ch, "\n\r A poll on #y%s#n with the following options. (expires %s)\n\n\r", poll->name, buf2);
printf_to_char(ch, " * %s\n\n\r", line_indent(poll->description, 4, 76));
for (i = 0; i < MAX_VOTE_OPTIONS; i++)
{
if (!str_cmp("<null>", poll->options[i]))
continue;
printf_to_char(ch, " #0[#R%2d#0] #y%s\n\r", i+1, poll->options[i]);
}
}
send_to_char("\n\r #CPlease read HELP VOTE for details on voting.#n\n\r", ch);
return;
}
if (ch->desc->account->max_might < RANK_CADET)
{
send_to_char("You need at least one character of cadet rank or better to vote.\n\r", ch);
return;
}
pIter = AllocIterator(poll_list);
while ((poll = (POLL_DATA *) NextInList(pIter)) != NULL)
{
if (!str_cmp(arg1, poll->name))
break;
}
if (poll == NULL)
{
send_to_char("There is no poll active by that name.\n\r", ch);
return;
}
pIter = AllocIterator(poll->votes);
while ((vote = (VOTE_DATA *) NextInList(pIter)) != NULL)
{
if (!str_cmp(ch->desc->account->owner, vote->pname))
{
send_to_char("You have already voted on this poll.\n\r", ch);
return;
}
}
/* count amount of valid fields in poll */
for (i = 0; i < MAX_VOTE_OPTIONS; i++)
{
if (!str_cmp(poll->options[i], "<null>"))
break;
}
if ((choice = atoi(arg2)) < 1 || choice > i)
{
printf_to_char(ch, "You can only vote on 1 to %d.\n\r", i + 1);
return;
}
add_vote(poll, ch, choice);
send_to_char("You vote has been accepted.\n\r", ch);
save_subvotes(poll);
save_polls();
}
void add_vote(POLL_DATA *poll, CHAR_DATA *ch, int choice)
{
VOTE_DATA *vote;
if (!ch->desc || !ch->desc->account)
return;
poll->vcount[choice-1]++;
vote = malloc(sizeof(*vote));
vote->pname = str_dup(ch->desc->account->owner);
vote->phost = str_dup(HOSTNAME(ch->desc));
vote->choice = choice;
AttachToList(vote, poll->votes);
}
void do_changes(CHAR_DATA *ch, char *argument)
{
CHANGE_DATA *change;
ITERATOR *pIter;
char buf[MAX_STRING_LENGTH];
char tempbuf[MAX_STRING_LENGTH];
bool found = FALSE;
int i = 0;
if (IS_NPC(ch)) return;
sprintf(buf, "%11s#0[#C***#0] #GThe latest changes made to Calim's Cradle #0[#C***#0]#n\n\r\n\r", "");
pIter = AllocIterator(change_list);
while ((change = (CHANGE_DATA *) NextInList(pIter)) != NULL)
{
found = TRUE;
++i;
sprintf(tempbuf, " #0[#C%3d#0] #G%-8s #C%s#n\n\r",
i, change->date, line_indent(change->text, 16, 79));
strcat(buf, tempbuf);
}
if (found)
send_to_char(buf, ch);
else
send_to_char("No changes.\n\r", ch);
}
void do_score(CHAR_DATA *ch, char *argument)
{
BUFFER *buf, *buf2;
char tempbuf[MAX_STRING_LENGTH];
char col_str[MAX_STRING_LENGTH];
char *seperator = "#o-:|:-~-:|:-~-:|:-~-:|:-~-:|:--:|:-~-:|:-~-:|:-~-:|:-~-:|:-~-:|:-#n";
int nextRank = next_rank_in(ch);
if (IS_NPC(ch))
return;
buf = buffer_new(MAX_STRING_LENGTH);
bprintf(buf, " Your name is #C%s #nand you have been playing for #C%d #nhour%s\n\r",
ch->name, (ch->played + (int) (current_time - ch->logon))/3600,
((ch->played + (int) (current_time - ch->logon))/3600 == 1) ? "" : "s");
bprintf(buf, "%s", birth_date(ch, FALSE));
sprintf(tempbuf, " STR: #G%2d#n Hitpoints : %s/#C%d#n",
get_curr_str(ch), col_scale(ch->hit, ch->max_hit), ch->max_hit);
cprintf(col_str, "%-44s #uLast two kills#n\n\r", tempbuf);
bprintf(buf, "%s", col_str);
sprintf(tempbuf, " DEX: #G%2d#n Movement : %s/#C%d#n",
get_curr_dex(ch), col_scale(ch->move, ch->max_move), ch->max_move);
cprintf(col_str, "%-44s #C%s#n\n\r", tempbuf, ch->pcdata->last_decap[0]);
bprintf(buf, "%s", col_str);
sprintf(tempbuf, " CON: #G%2d#n Magics : %s/#C%d#n",
get_curr_con(ch), col_scale(ch->mana, ch->max_mana), ch->max_mana);
cprintf(col_str, "%-44s #C%s#n\n\r", tempbuf, ch->pcdata->last_decap[1]);
bprintf(buf, "%s", col_str);
sprintf(tempbuf, " WIS: #G%2d#n PKscore : #y%d#n",
get_curr_wis(ch), get_ratio(ch));
cprintf(col_str, "%-44s #uRetaliation#n\n\r", tempbuf);
bprintf(buf, "%s", col_str);
sprintf(tempbuf, " INT: #G%2d#n Gold : #y%d#n/#C%d#n",
get_curr_int(ch), getGold(ch), getGoldTotal(ch));
cprintf(col_str, "%-44s #C%s#n\n\r", tempbuf, ch->pcdata->retaliation[0]);
bprintf(buf, "%s", col_str);
sprintf(tempbuf, " Quests : #y%d#n", ch->pcdata->questsrun);
bprintf(buf, "%-48s #C%s#n\n\r", tempbuf, ch->pcdata->retaliation[1]);
bprintf(buf, "\n\r %s\n\n\r", seperator);
bprintf(buf, " Damroll : #C%4d#n Damcap : #C%5d#n Saving Throw : #C%d#n (%s%d)\n\r",
char_damroll(ch), ch->damcap[0],
(ch->spl[0] + ch->spl[1] + ch->spl[2] + ch->spl[3] + ch->spl[4]) / 20,
(ch->saving_throw >= 0) ? "+" : "", ch->saving_throw);
bprintf(buf, " Hitroll : #C%4d#n Armor : #C%5d#n Paradox Tick : #C%d#n\n\r",
char_hitroll(ch), char_ac(ch), ch->pcdata->mean_paradox_counter);
bprintf(buf, " Primal : #C%4d#n Status : #C%5d#n Experience : #C%d#n\n\n\r",
ch->practice, ch->pcdata->status, ch->exp);
bprintf(buf, " You are carrying #C%d#n/#C%d#n items with weight #C%d#n/#C%d#n lbs\n\r",
ch->carry_number, can_carry_n(ch), ch->carry_weight, can_carry_w(ch));
/* Class stuff */
if (IS_CLASS(ch, CLASS_SHADOW))
{
bprintf(buf, "\n\r %s\n\n\r", seperator);
bprintf(buf, " Shadow Points : #C%d#n Shadow Upkeep : #C%d#n seconds\n\r",
ch->pcdata->powers[SHADOW_POWER], (IS_SET(ch->newbits, NEW_SUPKEEP2)) ? 75 : ((IS_SET(ch->newbits, NEW_SUPKEEP1) ? 50 : 25)));
}
else if (IS_CLASS(ch, CLASS_GIANT))
{
bprintf(buf, "\n\r %s\n\n\r", seperator);
bprintf(buf, " Giant Size : #C%d#n Feet Giant Points : #C%d#n\n\r",
(ch->pcdata->powers[GIANT_RANK] + 1) * 5, ch->pcdata->powers[GIANT_POINTS]);
}
else if (IS_CLASS(ch, CLASS_FAE))
{
;
}
else if (IS_CLASS(ch, CLASS_WARLOCK))
{
EVENT_DATA *event;
if ((event = event_isset_mobile(ch, EVENT_PLAYER_STUDY)) != NULL)
{
int cost;
char *earg;
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
earg = one_argument(event->argument, arg1);
one_argument(earg, arg2);
cost = atoi(arg2);
bprintf(buf, "\n\r %s\n\n\r", seperator);
bprintf(buf, " You are studying #C%s#n and need #C%d#n exp in #C%d#n min\n\r",
arg1, cost, (event_pulses_left(event) / (60 * PULSE_PER_SECOND) + 1));
}
}
bprintf(buf, "\n\r %s\n\n\r", seperator);
if (nextRank != -1)
{
int i;
bprintf(buf, " Rank : #0[#C");
for (i = 0; i < nextRank / 10; i++)
bprintf(buf, "*");
bprintf(buf, "#n");
for ( ; i < 10; i++)
bprintf(buf, "*");
bprintf(buf, "#0]#n\n\r");
}
sprintf(tempbuf, " Players : #C%6d#n %s and #C%3d#n %s",
ch->pkill, (ch->pkill == 1) ? "kill " : "kills",
ch->pdeath, (ch->pdeath == 1) ? "death " : "deaths");
cprintf(col_str, "%-42s Ratio #C%3d#n%s\n\r",
tempbuf, calc_ratio(ch->pkill, ch->pdeath), "%");
bprintf(buf, "%s", col_str);
sprintf(tempbuf, " Arena : #C%6d#n %s and #C%3d#n %s",
ch->pcdata->awins, (ch->pcdata->awins == 1) ? "kill " : "kills",
ch->pcdata->alosses, (ch->pcdata->alosses == 1) ? "death " : "deaths");
cprintf(col_str, "%-42s Ratio #C%3d#n%s\n\r",
tempbuf, calc_ratio(ch->pcdata->awins, ch->pcdata->alosses), "%");
bprintf(buf, "%s", col_str);
bprintf(buf, " Monsters : #C%6d#n %s and #C%3d#n %s\n\r",
ch->mkill, (ch->mkill == 1) ? "kill " : "kills",
ch->mdeath, (ch->mdeath == 1) ? "death " : "deaths");
buf2 = box_text(buf->data, "Calim's Cradle");
send_to_char(buf2->data, ch);
buffer_free(buf);
}
bool event_room_extra_action(EVENT_DATA *event)
{
OBJ_INDEX_DATA *pObjIndex;
OBJ_DATA *obj;
ROOM_INDEX_DATA *pRoom, *location;
ITERATOR *pIter, *pIter2;
CHAR_DATA *ch, *vch;
EXTRA_DESCR_DATA *ed;
char name[MAX_INPUT_LENGTH];
char *ptr;
int sn;
if ((pRoom = event->owner.room) == NULL)
{
bug("event_room_extra_action: no owner.", 0);
return FALSE;
}
ptr = one_argument(event->argument, name);
/* ch is either NULL or a pointer to the action initiator */
pIter = AllocIterator(pRoom->people);
while ((ch = (CHAR_DATA *) NextInList(pIter)) != NULL)
{
if (!str_cmp(name, ch->name))
break;
}
pIter = AllocIterator(pRoom->extra_descr);
while ((ed = (EXTRA_DESCR_DATA *) NextInList(pIter)) != NULL)
{
if (!str_cmp(ptr, ed->keyword))
{
switch(ed->action)
{
default:
break;
case ED_ACTION_TELEPORT:
if (ed->vnum > 0)
{
if ((location = get_room_index(ed->vnum)) == NULL)
return FALSE;
if (ch != NULL)
{
act(line_indent(ed->buffer1, 0, 79), ch, NULL, NULL, TO_CHAR);
act(line_indent(ed->buffer2, 0, 79), ch, NULL, NULL, TO_ROOM);
char_from_room(ch);
char_to_room(ch, location, TRUE);
do_look(ch, "auto");
}
}
else
{
location = get_rand_room();
pIter2 = AllocIterator(pRoom->people);
while ((ch = (CHAR_DATA *) NextInList(pIter2)) != NULL)
{
if (IS_NPC(ch))
continue;
act(line_indent(ed->buffer1, 0, 79), ch, NULL, NULL, TO_CHAR);
act(line_indent(ed->buffer2, 0, 79), ch, NULL, NULL, TO_ROOM);
char_from_room(ch);
char_to_room(ch, location, TRUE);
do_look(ch, "auto");
}
}
break;
case ED_ACTION_OBJECT:
if ((pObjIndex = get_obj_index(ed->vnum)) == NULL)
return FALSE;
obj = create_object(pObjIndex, 50);
if (CAN_WEAR(obj, ITEM_TAKE) && ch != NULL && ch->in_room == pRoom)
obj_to_char(obj, ch);
else
obj_to_room(obj, pRoom);
if (ch != NULL)
{
act(line_indent(ed->buffer1, 0, 79), ch, NULL, NULL, TO_CHAR);
act(line_indent(ed->buffer2, 0, 79), ch, NULL, NULL, TO_ROOM);
}
break;;
case ED_ACTION_SPELL:
if ((sn = skill_lookup(ed->buffer1)) < 0)
return FALSE;
if (ch != NULL)
(*skill_table[sn].spell_fun) (sn, number_range(40,50), ch, ch);
break;
case ED_ACTION_ELEVATOR:
if ((location = get_room_index(ed->vnum)) == NULL)
return FALSE;
if (FirstInList(location->people) != NULL && (vch = (CHAR_DATA *) FirstInList(pRoom->people)) != NULL)
{
act(line_indent(ed->buffer2, 0, 79), vch, NULL, NULL, TO_ALL);
return FALSE;
}
pIter2 = AllocIterator(pRoom->people);
while ((ch = (CHAR_DATA *) NextInList(pIter2)) != NULL)
{
char_from_room(ch);
char_to_room(ch, location, TRUE);
act(line_indent(ed->buffer1, 0, 79), ch, NULL, NULL, TO_CHAR);
}
break;
}
return FALSE;
}
}
return FALSE;
}
void extra_action(CHAR_DATA *ch, char *argument, int type)
{
EVENT_DATA *event;
EXTRA_DESCR_DATA *ed;
ITERATOR *pIter;
char arg[MAX_INPUT_LENGTH];
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
one_argument(argument, arg);
pIter = AllocIterator(ch->in_room->extra_descr);
while ((ed = (EXTRA_DESCR_DATA *) NextInList(pIter)) != NULL)
{
if (is_full_name(arg, ed->keyword))
{
if (ed->type == type)
{
switch(type)
{
case ED_TYPE_PULL:
sprintf(buf1, "You pull %s.\n\r", ed->keyword);
sprintf(buf2, "$n pulls %s.", ed->keyword);
break;
case ED_TYPE_PRESS:
sprintf(buf1, "You press %s.\n\r", ed->keyword);
sprintf(buf2, "$n presses %s.", ed->keyword);
break;
case ED_TYPE_PUSH:
sprintf(buf1, "You push %s.\n\r", ed->keyword);
sprintf(buf2, "$n pushes %s.", ed->keyword);
break;
case ED_TYPE_TOUCH:
sprintf(buf1, "You touch %s.\n\r", ed->keyword);
sprintf(buf2, "$n touches %s.", ed->keyword);
break;
}
send_to_char(buf1, ch);
act(buf2, ch, NULL, NULL, TO_ROOM);
}
else
{
switch(type)
{
case ED_TYPE_PULL:
send_to_char("That cannot be pulled.\n\r", ch);
break;
case ED_TYPE_PUSH:
send_to_char("That cannot be pushed.\n\r", ch);
break;
case ED_TYPE_PRESS:
send_to_char("That cannot be pressed.\n\r", ch);
break;
case ED_TYPE_TOUCH:
send_to_char("You seem unable to touch it.\n\r", ch);
break;
}
return;
}
switch(ed->action)
{
default:
send_to_char("Nothing happens.\n\r", ch);
return;
case ED_ACTION_TELEPORT:
case ED_ACTION_OBJECT:
case ED_ACTION_SPELL:
case ED_ACTION_ELEVATOR:
sprintf(buf1, "%s %s", ch->name, ed->keyword);
event = alloc_event();
event->fun = &event_room_extra_action;
event->type = EVENT_ROOM_EXTRA_ACTION;
event->argument = str_dup(buf1);
add_event_room(event, ch->in_room, PULSE_PER_SECOND + 1);
return;
}
}
}
send_to_char("You are unable to find that.\n\r", ch);
}
void do_pull(CHAR_DATA *ch, char *argument)
{
extra_action(ch, argument, ED_TYPE_PULL);
}
void do_press(CHAR_DATA *ch, char *argument)
{
extra_action(ch, argument, ED_TYPE_PRESS);
}
void do_push(CHAR_DATA *ch, char *argument)
{
extra_action(ch, argument, ED_TYPE_PUSH);
}
void do_touch(CHAR_DATA *ch, char *argument)
{
extra_action(ch, argument, ED_TYPE_TOUCH);
}
void do_ignore(CHAR_DATA *ch, char *argument)
{
IGNORE_DATA *ignore;
CHAR_DATA *victim;
ITERATOR *pIter, *pIter2;
char arg[MAX_INPUT_LENGTH];
if (IS_NPC(ch))
return;
one_argument(argument, arg);
if (arg[0] == '\0')
{
bool found = FALSE;
send_to_char("You are currently ignoring :\n\n\r", ch);
pIter = AllocIterator(ch->pcdata->ignores);
while ((ignore = (IGNORE_DATA *) NextInList(pIter)) != NULL)
{
printf_to_char(ch, " [o] All players in %s's account.\n\r", ignore->player);
found = TRUE;
}
if (!found)
send_to_char("Noone.\n\r", ch);
else
send_to_char("\n\rType 'ignore clear' to remove all ignores.\n\r", ch);
return;
}
if (!str_cmp(arg, "clear"))
{
pIter = AllocIterator(ch->pcdata->ignores);
while ((ignore = (IGNORE_DATA *) NextInList(pIter)) != NULL)
free_ignore(ignore, ch);
send_to_char("All ignores cleared.\n\r", ch);
return;
}
pIter = AllocIterator(char_list);
while ((victim = (CHAR_DATA *) NextInList(pIter)) != NULL)
{
if (IS_NPC(victim))
continue;
if (!str_prefix(victim->name, arg))
{
if (victim->desc == NULL || victim->desc->account == NULL)
{
send_to_char("You cannot ignore linkdead characters.\n\r", ch);
return;
}
/* stop ignoring? */
pIter2 = AllocIterator(ch->pcdata->ignores);
while ((ignore = (IGNORE_DATA *) NextInList(pIter2)) != NULL)
{
if (!str_cmp(ignore->account, victim->desc->account->owner))
{
free_ignore(ignore, ch);
printf_to_char(ch, "You stop ignoring %s.\n\r", victim->name);
return;
}
}
/* add this to the ignore list */
printf_to_char(ch, "You now ignore %s.\n\r", victim->name);
/* allocate and attach */
ignore = alloc_ignore();
ignore->player = str_dup(victim->name);
ignore->account = str_dup(victim->desc->account->owner);
AttachToList(ignore, ch->pcdata->ignores);
return;
}
}
send_to_char("Ignore/unignore whom?\n\r", ch);
}
void do_setdecap(CHAR_DATA *ch, char *argument)
{
int cost = 10;
if (IS_NPC(ch)) return;
if (IS_SET(ch->pcdata->jflags, JFLAG_NOSET))
{
send_to_char("Your not allowed to use custom settings.\n\r", ch);
return;
}
if (getMight(ch) < RANK_SUPREME)
{
send_to_char("You need supreme rank to use this command.\n\r", ch);
return;
}
if (getGold(ch) < cost)
{
printf_to_char(ch, "You need %d more gold to use this command.\n\r", cost - getGold(ch));
return;
}
smash_tilde(argument);
if (collen(argument) < 10 || collen(argument) > 90)
{
send_to_char("Your custom message should be no less than 10 characters and no more than 90.\n\r",ch);
return;
}
if (!is_contained2("$n", argument) || !is_contained2("$N", argument))
{
send_to_char("You really need to include both $n and $N in the message.\n\r",ch);
return;
}
if (!IS_SET(ch->pcdata->jflags, JFLAG_SETDECAP)) SET_BIT(ch->pcdata->jflags, JFLAG_SETDECAP);
free_string(ch->pcdata->decapmessage);
ch->pcdata->decapmessage = str_dup(argument);
setGold(ch, -1 * cost);
send_to_char("done.\n\r",ch);
}
void do_settie(CHAR_DATA *ch, char *argument)
{
int cost = 10;
if (IS_NPC(ch)) return;
if (IS_SET(ch->pcdata->jflags, JFLAG_NOSET))
{
send_to_char("Your not allowed to use custom settings.\n\r", ch);
return;
}
if (getMight(ch) < RANK_PRIVATE)
{
send_to_char("You need private rank to use this command.\n\r", ch);
return;
}
if (getGold(ch) < cost)
{
printf_to_char(ch, "You need %d more gold to use this command.\n\r", cost - getGold(ch));
return;
}
smash_tilde(argument);
if (collen(argument) < 10 || collen(argument) > 90)
{
send_to_char("Your custom message should be no less than 10 characters and no more than 90.\n\r",ch);
return;
}
if (!is_contained2("$n", argument) || !is_contained2("$N", argument))
{
send_to_char("You really need to include both $n and $N in the message.\n\r",ch);
return;
}
if (!IS_SET(ch->pcdata->jflags, JFLAG_SETTIE)) SET_BIT(ch->pcdata->jflags, JFLAG_SETTIE);
free_string(ch->pcdata->tiemessage);
ch->pcdata->tiemessage = str_dup(argument);
setGold(ch, -1 * cost);
send_to_char("done.\n\r",ch);
}
void do_setlogout(CHAR_DATA *ch, char *argument)
{
int cost = 10;
if (IS_NPC(ch)) return;
if (IS_SET(ch->pcdata->jflags, JFLAG_NOSET))
{
send_to_char("Your not allowed to use custom settings.\n\r", ch);
return;
}
if (getMight(ch) < RANK_MASTER)
{
send_to_char("You need master rank to use this command.\n\r", ch);
return;
}
if (getGold(ch) < cost)
{
printf_to_char(ch, "You need %d more gold to use this command.\n\r", cost - getGold(ch));
return;
}
smash_tilde(argument);
if (collen(argument) < 10 || collen(argument) > 90)
{
send_to_char("Your custom message should be no less than 10 characters and no more than 90.\n\r",ch);
return;
}
if (!is_contained2("$n", argument))
{
send_to_char("You really need to include $n in the message.\n\r",ch);
return;
}
if (!IS_SET(ch->pcdata->jflags, JFLAG_SETLOGOUT)) SET_BIT(ch->pcdata->jflags, JFLAG_SETLOGOUT);
free_string(ch->pcdata->logoutmessage);
ch->pcdata->logoutmessage = str_dup(argument);
setGold(ch, -1 * cost);
send_to_char("done.\n\r",ch);
}
void do_setlogin(CHAR_DATA *ch, char *argument)
{
int cost = 10;
if (IS_NPC(ch)) return;
if (IS_SET(ch->pcdata->jflags, JFLAG_NOSET))
{
send_to_char("Your not allowed to use custom settings.\n\r", ch);
return;
}
if (getMight(ch) < RANK_ADVENTURER)
{
send_to_char("You need adventurer rank to use this command.\n\r", ch);
return;
}
if (getGold(ch) < cost)
{
printf_to_char(ch, "You need %d more gold to use this command.\n\r", cost - getGold(ch));
return;
}
smash_tilde(argument);
if (collen(argument) < 10 || collen(argument) > 90)
{
send_to_char("Your custom message should be no less than 10 characters and no more than 90.\n\r",ch);
return;
}
if (!is_contained2("$n", argument))
{
send_to_char("You really need to include $n in the message.\n\r",ch);
return;
}
if (!IS_SET(ch->pcdata->jflags, JFLAG_SETLOGIN)) SET_BIT(ch->pcdata->jflags, JFLAG_SETLOGIN);
free_string(ch->pcdata->loginmessage);
ch->pcdata->loginmessage = str_dup(argument);
setGold(ch, -1 * cost);
send_to_char("done.\n\r",ch);
}
void do_setavatar(CHAR_DATA *ch, char *argument)
{
int cost = 10;
if (IS_NPC(ch)) return;
if (IS_SET(ch->pcdata->jflags, JFLAG_NOSET))
{
send_to_char("Your not allowed to use custom settings.\n\r", ch);
return;
}
if (getMight(ch) < RANK_DUKE)
{
send_to_char("You need duke rank to use this command.\n\r", ch);
return;
}
if (getGold(ch) < cost)
{
printf_to_char(ch, "You need %d more gold to use this command.\n\r", cost - getGold(ch));
return;
}
smash_tilde(argument);
if (collen(argument) < 10 || collen(argument) > 90)
{
send_to_char("Your custom message should be no less than 10 characters and no more than 90.\n\r",ch);
return;
}
if (!is_contained2("$n", argument))
{
send_to_char("You really need to include $n in the message.\n\r",ch);
return;
}
if (!IS_SET(ch->pcdata->jflags, JFLAG_SETAVATAR)) SET_BIT(ch->pcdata->jflags, JFLAG_SETAVATAR);
free_string(ch->pcdata->avatarmessage);
ch->pcdata->avatarmessage = str_dup(argument);
setGold(ch, -1 * cost);
send_to_char("done.\n\r",ch);
}
void do_alias(CHAR_DATA *dMob, char *arg)
{
char name[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
ITERATOR *pIter;
ALIAS_DATA *alias;
int i = 0, count = 0;
arg = one_argument(arg, name);
smash_tilde(arg);
smash_tilde(name);
if (name[0] == '\0')
{
int cln = 0;
send_to_char("#uYour aliases are#n\n\r", dMob);
/* list all aliases, then do the syntax thing */
pIter = AllocIterator(dMob->pcdata->aliases);
while ((alias = (ALIAS_DATA *) NextInList(pIter)) != NULL)
{
sprintf(buf, "%-18.17s %s", alias->name, (++cln % 4 == 0) ? "\n\r" : "");
send_to_char(buf, dMob);
}
send_to_char("\n\r", dMob);
if (cln % 4)
send_to_char("\n\r", dMob);
send_to_char("Syntax: alias <keyword> <string>\n\rRead HELP ALIAS for more details.\n\r", dMob);
return;
}
if (arg[0] == '\0')
{
pIter = AllocIterator(dMob->pcdata->aliases);
while ((alias = (ALIAS_DATA *) NextInList(pIter)) != NULL)
{
if (!str_cmp(alias->name, name))
{
sprintf(buf, "#u%s#n\n\r%s", alias->name, alias->expand_string);
send_to_char(buf, dMob);
return;
}
}
sprintf(buf, "What do you want to alias '%s' to?\n\r", name);
send_to_char(buf, dMob);
return;
}
if (SizeOfList(dMob->pcdata->aliases) >= MAX_ALIAS)
{
send_to_char("You are not allowed to create any more aliases.\n\r", dMob);
send_to_char("To create a new alias, you must delete an old alias first.\n\r", dMob);
return;
}
pIter = AllocIterator(dMob->pcdata->aliases);
while ((alias = (ALIAS_DATA *) NextInList(pIter)) != NULL)
{
if (!str_cmp(name, alias->name))
{
send_to_char("You already have an alias with that name.\n\r", dMob);
return;
}
}
if (is_full_name(name, "alias delalias"))
{
send_to_char("Please don't alias the alias commands.\n\r", dMob);
return;
}
if (strlen(arg) > 400)
{
send_to_char("That alias is way to big, please behave.\n\r", dMob);
return;
}
while (arg[i] != '\0')
{
if (arg[i] == '@')
count++;
i++;
}
if (count > 2)
{
send_to_char("Please control your use of the @ character.\n\r", dMob);
return;
}
alias = alloc_alias();
alias->name = str_dup(name);
alias->expand_string = str_dup(create_alias_string(arg));
/* link it */
AttachToList(alias, dMob->pcdata->aliases);
send_to_char("Alias created.\n\r", dMob);
}
void do_delalias(CHAR_DATA *dMob, char *arg)
{
char name[MAX_STRING_LENGTH];
ALIAS_DATA *alias;
ITERATOR *pIter;
arg = one_argument(arg, name);
pIter = AllocIterator(dMob->pcdata->aliases);
while ((alias = (ALIAS_DATA *) NextInList(pIter)) != NULL)
{
if (!str_cmp(name, alias->name))
{
alias_from_player(dMob, alias);
send_to_char("The alias has been deleted.\n\r", dMob);
return;
}
}
send_to_char("You have no alias by that name.\n\r", dMob);
}
void do_pshift(CHAR_DATA *ch, char *argument)
{
DESCRIPTOR_DATA *d;
CHAR_DATA *vch = ch;
char arg[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
char *ptr;
char silent_string[] = { 27, 27, '\0' };
if ((d = ch->desc) == NULL)
return;
if (has_timer(ch))
return;
if (in_arena(ch) || in_fortress(ch))
{
send_to_char("You cannot shift here.\n\r", ch);
return;
}
one_argument(argument, arg);
if (arg[0] == '\0')
{
show_options(d);
send_to_char("Whom do you wish to change into?\n\r", ch);
return;
}
ptr = one_argument(d->account->players, buf);
do
{
if (!str_cmp(buf, arg) && str_cmp(buf, ch->name))
{
if (check_reconnect(d, arg, FALSE))
{
send_to_char("That character is already connected.\n\r", ch);
return;
}
if (!load_char_obj(d, arg))
{
d->character = ch;
send_to_char("Something went wrong, please report this.\n\r", ch);
return;
}
ch = d->character;
login_char(ch, FALSE);
log_string("%s has shifted into %s.", vch->name, ch->name);
sprintf(buf, "You shift into %s.\n\r", ch->name);
send_to_char(buf, ch);
if (ch->level < 7 && vch->level < 7)
{
sprintf(buf, "%s changes skin, and becomes %s", vch->name, ch->name);
do_info(ch, buf);
}
else if (ch->level < 7 && vch->level >= 7)
{
sprintf(buf,"#G%s #9enters #RCalim's Cradle.#n", ch->name);
enter_info(buf);
}
else if (ch->level >= 7 && vch->level < 7)
{
sprintf(buf, "#R%s #9has fled from #RCalim's Cradle#9.#n", vch->name);
leave_info(buf);
}
if (ch->level < 7 && vch->level < 7)
WAIT_STATE(ch, 12);
vch->desc = NULL;
do_quit(vch, silent_string);
return;
}
/* scan forward to next character */
ptr = one_argument(ptr, buf);
ptr = one_argument(ptr, bufShowing the first 100 KB of 220.4 KB. Download the archive for the full file.