act_obj.c
cthulu3/drv8/act_obj.c · 234.7 KB
From the archive cthulu3-1.tar.gz
Download the archive « Back to the archive contents
/*********************************************************
* CTHULHUMUD *
* CthulhuMud driver version 8.x copyright (C) 2000 *
* by Mik Clarke (mykael@vianet.net.au) *
* and Joachim Häusler (mystery@chello.at). *
* *
* While the code is original, many concepts and the *
* typical look & feel are derived from MERC and its *
* derivatives - especially the SunderMud 1.0 prototype. *
* *
* Therefore we'd like to thank: *
* Lotherius *
* Russ Taylor, Gabrielle Taylor, Brian Moore *
* Michael Chastain, Michael Quan, and Mitchell Tse *
* *
* Please keep this code open-source and share your *
* ideas. It's still a long way to go. *
*********************************************************/
#include "everything.h"
#include "skill.h"
#include "spell.h"
#include "doors.h"
#include "econd.h"
#include "mob.h"
#include "wev.h"
#include "affect.h"
#include "exp.h"
#include "magic.h"
#include "profile.h"
#include "olc.h"
#include "race.h"
#include "bank.h"
#include "cult.h"
#include "gsn.h"
/* command procedures needed */
DECLARE_DO_FUN(do_split);
DECLARE_DO_FUN(do_yell);
DECLARE_DO_FUN(do_kill);
DECLARE_DO_FUN(do_look);
/*
* Local functions.
*/
#define CD CHAR_DATA
#define OD OBJ_DATA
bool remove_obj (CHAR_DATA *ch, int iWear, bool fReplace);
void wear_obj (CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace, int slot);
void obj_to_keeper (OBJ_DATA *obj, CHAR_DATA *ch );
OD *get_obj_keeper (CHAR_DATA *ch,CHAR_DATA *keeper,char *argument);
void reload_gun (CHAR_DATA *ch, OBJ_DATA *obj, int gnum, bool loud);
void slotmachine (CHAR_DATA *ch, OBJ_DATA *obj);
char *photo_char (CHAR_DATA *victim, CHAR_DATA *ch);
void do_real_sac (CHAR_DATA *ch, OBJ_DATA *obj);
int soc_tax (CHAR_DATA *ch, int gold, int currency);
int get_cost (CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy );
void order_passport (CHAR_DATA *ch, int type);
#undef OD
#undef CD
/* RT part of the corpse looting code */
bool can_loot(CHAR_DATA *ch, OBJ_DATA *obj) {
CHAR_DATA *owner, *wch;
if (IS_IMMORTAL(ch)) return TRUE;
if (!obj->owner || obj->owner == NULL) return TRUE;
owner = NULL;
for ( wch = char_list; wch != NULL ; wch = wch->next )
if (!str_cmp(wch->name,obj->owner))
owner = wch;
if (owner == NULL) return TRUE;
if (!str_cmp(ch->name,owner->name)) return TRUE;
if (!IS_NPC(owner) && IS_SET(owner->plr, PLR_CANLOOT)) return TRUE;
if (is_same_group(ch,owner)) return TRUE;
return FALSE;
}
void get_obj( CHAR_DATA *ch, OBJ_DATA *obj, OBJ_DATA *container ) {
CHAR_DATA *gch;
CHAR_DATA *sleeper;
EXTRA_DESCR_DATA *ed;
int members;
int gold;
int zmask;
int currency = 0;
char buffer[100];
MOB_CMD_CONTEXT *mcc;
WEV *wev;
if ( !CAN_WEAR(obj, ITEM_TAKE)) {
send_to_char( "You can't take that.\r\n", ch );
return;
}
if ( IS_SET(obj->extra_flags, ITEM_SCENIC) ) {
send_to_char( "You can't take that.\r\n", ch );
return;
}
if (obj->item_type == ITEM_FURNITURE) {
for ( sleeper = ch->in_room->people; sleeper != NULL; sleeper = sleeper->next_in_room ) {
if (IS_NPC(sleeper)) continue;
if (sleeper->on_furniture == obj
&& sleeper->position <= POS_RESTING) {
send_to_char( "Someone is using it right now.\r\n", ch );
return;
}
}
}
if (obj->owner != NULL
&& str_cmp(obj->owner, ch->short_descr)
&& str_cmp(obj->owner, ch->short_descr_orig)) {
act( "You are zapped by $p and drop it.", ch, obj, NULL, TO_CHAR );
act( "$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM );
return;
}
if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch )) {
act( "$d: you can't carry that many items.", ch, NULL, obj->name, TO_CHAR );
return;
}
if ( ch->carry_weight + get_obj_weight( obj ) > can_carry_w( ch ) ) {
act( "$d: you can't carry that much weight.", ch, NULL, obj->name, TO_CHAR );
return;
}
if (!can_loot(ch,obj)) {
act("Corpse looting is not permitted.",ch,NULL,NULL,TO_CHAR );
return;
}
/* Check on getting items out of the pit... */
if ( container != NULL
&& container->pIndexData->vnum == OBJ_VNUM_PIT) {
if ( (ch->level + 10) < obj->level) {
send_to_char("You are not powerful enough to use it.\r\n",ch);
return;
}
if ( !CAN_WEAR(container, ITEM_TAKE)
&& obj->timer != 0) {
obj->timer = 0;
}
}
/* Ok, get context and build the wev... */
if (obj->item_type == ITEM_MONEY) {
currency = obj->value[1];
mcc = get_mcc(ch, ch, NULL, NULL, NULL, container, obj->value[0], flag_string(currency_type,currency));
if ( container != NULL ) {
wev = get_wev(WEV_GET, WEV_GET_GOLD, mcc,
"You get @n0 @t0 from @s1.\r\n",
"@a2 gets @n0 @t0 from @s1.\r\n",
"@a2 gets @n0 @t0 from @s1.\r\n");
} else {
wev = get_wev(WEV_GET, WEV_GET_GOLD, mcc,
"You get @n0 @t0.\r\n",
"@a2 gets @n0 @t0.\r\n",
"@a2 gets @n0 @t0.\r\n");
}
} else {
mcc = get_mcc(ch, ch, NULL, NULL, obj, container, 0, NULL);
if ( container != NULL ) {
wev = get_wev(WEV_GET, WEV_GET_ITEM, mcc,
"You get @p2 from @s2.\r\n",
"@a2 gets @p2 from @s2.\r\n",
"@a2 gets @p2 from @s2.\r\n");
} else {
wev = get_wev(WEV_GET, WEV_GET_ITEM, mcc,
"You get @p2.\r\n",
"@a2 gets @p2.\r\n",
"@a2 gets @p2.\r\n");
ed = obj->pIndexData->extra_descr;
while (ed != NULL) {
if (is_name("secondary_long", ed->keyword)) {
if (str_cmp(obj->description, ed->description)) {
free_string(obj->description);
obj->description = strtok(ed->description, "\n");
break;
}
}
ed = ed->next;
}
}
}
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
/* Pull the object out of it's current location... */
if ( container != NULL ) obj_from_obj( obj );
else obj_from_room( obj );
/* Give it to the character... */
gold = 0;
if ( obj->item_type == ITEM_MONEY) {
gold = obj->value[0];
gold = soc_tax(ch, gold, currency);
ch->gold[currency] += gold;
extract_obj( obj );
} else {
obj_to_char( obj, ch );
REMOVE_BIT(obj->extra_flags, ITEM_CONCEALED);
if (obj->item_type == ITEM_HERB) obj->timer=-1;
zmask = zones[ch->in_room->area->zone].mask;
if ( zmask != 0 ) {
if ( obj->zmask != 0
&& (zmask & obj->zmask) == 0) {
obj_from_char(obj);
obj_to_char_ooz(obj, ch);
sprintf(buffer, "{m%s evaporates!{x\r\n", obj->short_descr);
buffer[2] = UPPER(buffer[2]);
send_to_char(buffer, ch);
}
}
}
/* Send to command issuers room... */
room_issue_wev( ch->in_room, wev);
/* Free the wev (will autofree the context)... */
free_wev(wev);
/* Now split the gold up... */
if ( gold > 0
&& IS_SET(ch->plr, PLR_AUTOSPLIT) ) {
/* See how many party members there are... */
members = 0;
gch = ch->in_room->people;
while ( gch != NULL ) {
if ( is_same_group( gch, ch ) ) {
members++;
}
gch = gch->next_in_room;
}
/* Go split... */
if ( members > 1 ) {
sprintf(buffer, "%d %s", gold, flag_string(currency_accept, currency));
do_split(ch,buffer);
}
}
/* All done... */
return;
}
void do_get( CHAR_DATA *ch, char *argument ) {
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *obj_next;
OBJ_DATA *container;
bool found;
if (IS_SET(ch->form, FORM_MIST)) {
send_to_char( "You can't get a grip on it?\r\n", ch );
return;
}
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if (!str_cmp(arg2,"from"))
argument = one_argument(argument,arg2);
if (IS_AFFECTED(ch, AFF_MIST)) {
send_to_char( "You can't do that in mist form?\r\n", ch );
return;
}
/* Get type. */
if ( arg1[0] == '\0' ) {
send_to_char( "Get what?\r\n", ch );
return;
}
if ( arg2[0] == '\0' ) {
if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) {
/* 'get obj' */
obj = get_obj_list( ch, arg1, ch->in_room->contents );
if ( obj == NULL ) {
act( "I see no $T here.", ch, NULL, arg1, TO_CHAR );
return;
}
get_obj( ch, obj, NULL );
} else {
/* 'get all' or 'get all.obj' */
found = FALSE;
for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next ) {
obj_next = obj->next_content;
if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) )
&& can_see_obj( ch, obj ) ) {
found = TRUE;
get_obj( ch, obj, NULL );
}
}
if ( !found ) {
if ( arg1[3] == '\0' )
send_to_char( "I see nothing here.\r\n", ch );
else
act( "I see no $T here.", ch, NULL, &arg1[4], TO_CHAR );
}
}
} else {
/* 'get ... container' */
if ( !str_cmp( arg2, "all" ) || !str_prefix( "all.", arg2 ) ) {
send_to_char( "You can't do that.\r\n", ch );
return;
}
if ( ( container = get_obj_here( ch, arg2 ) ) == NULL ) {
act( "I see no $T here.", ch, NULL, arg2, TO_CHAR );
return;
}
switch ( container->item_type ) {
default:
send_to_char( "That's not a container.\r\n", ch );
return;
case ITEM_CONTAINER:
case ITEM_LOCKER:
case ITEM_CLAN_LOCKER:
case ITEM_KEY_RING:
case ITEM_CAMERA:
if ( IS_SET(container->value[1], CONT_CLOSED)
&& IS_SET(container->value[1], CONT_CLOSEABLE) ) {
act( "The $d is closed.", ch, NULL, container->name, TO_CHAR );
return;
}
break;
case ITEM_CORPSE_NPC:
case ITEM_TREE:
break;
case ITEM_CORPSE_PC:
if (!can_loot(ch,container)) {
send_to_char( "You can't loot that corpse.\r\n", ch );
return;
}
break;
}
if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) ) {
/* 'get obj container' */
obj = get_obj_list( ch, arg1, container->contains );
if ( obj == NULL )
{
act( "I see nothing like that in the $T.",
ch, NULL, arg2, TO_CHAR );
return;
}
get_obj( ch, obj, container );
}
else
{
/* 'get all container' or 'get all.obj container' */
found = FALSE;
for ( obj = container->contains; obj != NULL; obj = obj_next ) {
obj_next = obj->next_content;
if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) )
&& can_see_obj( ch, obj ) ) {
found = TRUE;
if (container->pIndexData->vnum == OBJ_VNUM_PIT
&& !IS_IMMORTAL(ch)) {
send_to_char("Don't be so greedy!\r\n",ch);
return;
}
get_obj( ch, obj, container );
}
}
if ( !found ) {
if ( arg1[3] == '\0' )
act( "I see nothing in the $T.", ch, NULL, arg2, TO_CHAR );
else
act( "I see nothing like that in the $T.", ch, NULL, arg2, TO_CHAR );
}
}
}
return;
}
void do_weigh(CHAR_DATA *ch, char *args ) {
OBJ_DATA *obj;
char *pdesc;
char buf[MAX_STRING_LENGTH];
/* Syntax */
if ( args[0] == '\0'
|| args[0] == '?' ) {
send_to_char("Syntax: weight object\r\n", ch);
return;
}
/* Find the object... */
obj = get_obj_carry(ch, args);
if ( obj != NULL ) {
pdesc = "Your";
} else {
obj = get_obj_here(ch, args);
if ( obj != NULL ) {
pdesc = "The";
} else {
obj = get_obj_wear(ch, args);
if ( obj != NULL ) {
pdesc = "Your";
} else {
send_to_char("You can not find one of those!\r\n", ch);
return;
}
}
}
/* Send the data... */
sprintf(buf, "%s %s has a weight of %d units.\r\n", pdesc, obj->short_descr, get_obj_weight(obj));
send_to_char(buf, ch);
/* Capacity for containers... */
if ( obj->item_type == ITEM_CONTAINER ) {
sprintf(buf, "It has capacity for %ld units" " and currently contains %d units.\r\n", obj->value[0] - obj->weight, get_obj_weight(obj) - obj->weight );
send_to_char(buf, ch);
}
return;
}
void do_put( CHAR_DATA *ch, char *argument ) {
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
OBJ_DATA *container;
OBJ_DATA *obj;
OBJ_DATA *obj_next;
MOB_CMD_CONTEXT *mcc;
WEV *wev;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if (!str_cmp(arg2,"in"))
argument = one_argument(argument,arg2);
if ( arg1[0] == '\0' || arg2[0] == '\0' ) {
send_to_char( "Put what in what?\r\n", ch );
return;
}
if ( !str_cmp( arg2, "all" ) || !str_prefix( "all.", arg2 )) {
send_to_char( "You can't do that.\r\n", ch );
return;
}
if ( ( container = get_obj_here( ch, arg2 ) ) == NULL ) {
act( "I see no $T here.", ch, NULL, arg2, TO_CHAR );
return;
}
if ( (container->item_type != ITEM_CONTAINER )
&& (container->item_type != ITEM_CAMERA)
&& (container->item_type != ITEM_KEY_RING)
&& (container->item_type != ITEM_LOCKER)
&& (container->item_type != ITEM_CORPSE_PC)
&& (container->item_type != ITEM_CORPSE_NPC)
&& (container->item_type != ITEM_CLAN_LOCKER)) {
send_to_char( "That's not a container.\r\n", ch );
return;
}
if ( container->item_type == ITEM_CONTAINER
|| container->item_type == ITEM_CAMERA
|| container->item_type == ITEM_LOCKER
|| container->item_type == ITEM_KEY_RING
|| container->item_type == ITEM_CLAN_LOCKER) {
if ( IS_SET(container->value[1], CONT_CLOSED)
&& IS_SET(container->value[1], CONT_CLOSEABLE) ) {
act( "The $d is closed.", ch, NULL, container->name, TO_CHAR );
return;
}
}
if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 )) {
/* 'put obj container' */
if ( ( obj = get_obj_carry( ch, arg1 ) ) == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if ( obj == container ) {
send_to_char( "You can't fold it into itself!\r\n", ch );
return;
}
if ( !can_drop_obj( ch, obj ) ) {
send_to_char( "You can't let go of it!\r\n", ch );
return;
}
if ( (get_obj_weight( obj ) + get_obj_weight( container ) > container->value[0] )
&& (container->value[0] != -1)) {
send_to_char( "It won't fit!\r\n", ch );
return;
}
if (obj->trans_char != NULL) {
send_to_char( "It resists!\r\n", ch );
return;
}
if ( container->item_type == ITEM_KEY_RING
&& obj->item_type != ITEM_KEY
&& obj->item_type != ITEM_LOCKER_KEY) {
send_to_char("You can't put that in there!\r\n", ch);
return;
}
if ( container->item_type == ITEM_CAMERA) {
if (obj->item_type != ITEM_PHOTOGRAPH
|| container->contains != NULL) {
send_to_char("You can't put that in there!\r\n", ch);
return;
}
}
if ( container->item_type == ITEM_LOCKER
|| container->item_type == ITEM_CLAN_LOCKER) {
if (IS_SET(obj->extra_flags, ITEM_ARTIFACT)
|| obj->item_type == ITEM_PASSPORT) {
send_to_char("You can't put that in there!\r\n", ch);
return;
}
}
if (container->pIndexData->vnum == OBJ_VNUM_PIT
&& !CAN_WEAR(container,ITEM_TAKE)) {
if (obj->timer) {
send_to_char( "Only permanent items may go in the pit.\r\n",ch);
return;
} else {
obj->timer = number_range(100,200);
}
}
/* Set up context and get WEV... */
mcc = get_mcc(ch, ch, NULL, NULL, obj, container, 0, NULL);
wev = get_wev(WEV_PUT, WEV_PUT_ITEM, mcc,
"You put @p2 into @s2.\r\n",
"@a2 puts @p2 into @s2.\r\n",
"@a2 puts @p2 into @s2.\r\n");
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
/* Do the transfer... */
obj_from_char( obj );
obj_to_obj( obj, container );
/* Send to command issuers room... */
room_issue_wev( ch->in_room, wev);
/* Free the wev... */
free_wev(wev);
} else {
/* 'put all container' or 'put all.obj container' */
for ( obj = ch->carrying; obj != NULL; obj = obj_next ) {
obj_next = obj->next_content;
if (obj->trans_char != NULL) continue;
if ( (arg1[3] == '\0' || is_name(&arg1[4], obj->name))
&& (can_see_obj(ch, obj))
&& (obj->wear_loc == WEAR_NONE)
&& (obj != container)
&& (can_drop_obj(ch, obj))
&& ( (get_obj_weight(obj) + get_obj_weight(container) <= container->value[0]) || (container->value[0] == -1) )) {
if ( container->pIndexData->vnum == OBJ_VNUM_PIT
&& !CAN_WEAR(obj, ITEM_TAKE) ) {
if (obj->timer) continue;
else obj->timer = number_range(100,200);
}
if ( container->item_type == ITEM_KEY_RING
&& obj->item_type != ITEM_KEY
&& obj->item_type != ITEM_LOCKER_KEY ) continue;
if ( container->item_type == ITEM_CAMERA) {
if (obj->item_type != ITEM_PHOTOGRAPH
|| container->contains != NULL) continue;
}
if ( container->item_type == ITEM_LOCKER
|| container->item_type == ITEM_CLAN_LOCKER) {
if (IS_SET(obj->extra_flags, ITEM_ARTIFACT)) continue;
if(obj->item_type == ITEM_PASSPORT) continue;
}
/* Set up context and get WEV... */
mcc = get_mcc(ch, ch, NULL, NULL, obj, container, 0, NULL);
wev = get_wev(WEV_PUT, WEV_PUT_ITEM, mcc,
"You put @p2 into @s2.\r\n",
"@a2 puts @p2 into @s2.\r\n",
"@a2 puts @p2 into @s2.\r\n");
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
/* Do the transfer... */
obj_from_char( obj );
obj_to_obj( obj, container );
/* Send to command issuers room... */
room_issue_wev( ch->in_room, wev);
/* Free the wev... */
free_wev(wev);
}
}
}
return;
}
void drop_obj(CHAR_DATA *ch, OBJ_DATA *obj) {
MOB_CMD_CONTEXT *mcc;
WEV *wev;
/* Set up context and get WEV... */
mcc = get_mcc(ch, ch, NULL, NULL, obj, NULL, 0, NULL);
if (IS_SET(obj->extra_flags,ITEM_MELT_DROP)) {
wev = get_wev(WEV_DROP, WEV_DROP_ITEM_MELT, mcc,
"The @p2 dissolves into smoke when you drop it!\r\n",
"@a2 drops @p2 and it dissolves into smoke!\r\n",
"@a2 drops @p2 and it dissolves into smoke!\r\n");
} else {
wev = get_wev(WEV_DROP, WEV_DROP_ITEM, mcc,
"You drop @p2.\r\n",
"@a2 drops @p2.\r\n",
"@a2 drops @p2.\r\n");
}
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
/* Do the transfer... */
obj_from_char( obj );
/* ...but only complete it if the item dosen't melt... */
if (!IS_SET(obj->extra_flags, ITEM_MELT_DROP)) obj_to_room( obj, ch->in_room );
if (IS_SET(ch->in_room->room_flags, ROOM_DUMP)) obj->timer = number_range(10, UMAX(obj->level, 11));
/* Send to command issuers room... */
room_issue_wev( ch->in_room, wev);
/* Free the wev... */
free_wev(wev);
if (obj->in_room) obj_fall(obj, 0);
/* Lose the object if it melted... */
if (IS_SET(obj->extra_flags,ITEM_MELT_DROP)) extract_obj(obj);
return;
}
void do_drop( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *obj_next;
CHAR_DATA *victim;
bool found;
int currency;
MOB_CMD_CONTEXT *mcc;
WEV *wev;
argument = one_argument( argument, arg );
if (IS_AFFECTED(ch, AFF_MIST)) {
send_to_char( "You can't do that in mist form?\r\n", ch );
return;
}
if ( arg[0] == '\0' ) {
send_to_char( "Drop what?\r\n", ch );
return;
}
if (!str_cmp(arg, "money")) {
char buf[MAX_STRING_LENGTH];
int i;
for (i = 0; i < MAX_CURRENCY; i++) {
if (ch->gold[i] > 0) {
sprintf(buf, "%ld %s", ch->gold[i], flag_string(currency_accept, i));
do_drop(ch, buf);
}
}
return;
}
if (is_number( arg )) {
/* 'drop NNNN coins' */
int amount;
amount = atoi(arg);
argument = one_argument( argument, arg );
currency = flag_value(currency_accept, arg);
if ( amount <= 0 || currency < 0) {
send_to_char( "Sorry, you can't do that.\r\n", ch );
return;
}
if ( ch->gold[currency] < amount ) {
sprintf_to_char(ch, "You haven't got that many %s.\r\n", flag_string(currency_type, currency));
return;
}
/* Set up context and get WEV... */
mcc = get_mcc(ch, ch, NULL, NULL, NULL, NULL, amount, flag_string(currency_type, currency));
wev = get_wev(WEV_DROP, WEV_DROP_GOLD, mcc,
"You drop @n0 @t0.\r\n",
"@a2 drops @n0 @t0.\r\n",
"@a2 drops @n0 @t0.\r\n");
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
/* Do the transfer... */
ch->gold[currency] -= amount;
for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next ) {
obj_next = obj->next_content;
if (obj->value[1] == currency) {
switch ( obj->pIndexData->vnum ) {
case OBJ_VNUM_MONEY_ONE:
amount += 1;
extract_obj( obj );
break;
case OBJ_VNUM_MONEY_SOME:
amount += obj->value[0];
extract_obj( obj );
break;
}
}
}
obj_to_room(create_money(amount, currency), ch->in_room );
/* Send to command issuers room... */
room_issue_wev( ch->in_room, wev);
/* Free the wev... */
free_wev(wev);
return;
}
/* Release a carried Character */
victim = get_char_room( ch, arg );
if ( victim != NULL
&& victim->position == POS_STUNNED
&& victim->master !=NULL
&& victim->master ==ch) {
send_to_char("Your you drop your victim to the floor.\r\n", ch);
send_to_char( "You hit the floor very hard.\r\n", victim );
act("$n drops $n to the ground.",ch,victim,NULL,TO_ROOM);
stop_follower(victim);
ch->carry_weight -= 150;
return;
}
if ( str_cmp( arg, "all" ) && str_prefix( "all.", arg ) ) {
/* 'drop obj' */
obj = get_obj_carry( ch, arg );
if ( obj == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if ( !can_drop_obj( ch, obj ) ) {
send_to_char( "You can't let go of it.\r\n", ch );
return;
}
drop_obj(ch, obj);
} else {
/* 'drop all' or 'drop all.obj' */
found = FALSE;
for ( obj = ch->carrying; obj != NULL; obj = obj_next ){
obj_next = obj->next_content;
if ( ( arg[3] == '\0' || is_name( &arg[4], obj->name ) )
&& can_see_obj( ch, obj )
&& obj->wear_loc == WEAR_NONE
&& can_drop_obj( ch, obj ) ) {
found = TRUE;
drop_obj(ch, obj);
}
}
if ( !found ) {
if ( arg[3] == '\0' )
act( "You are not carrying anything you can drop.", ch, NULL, arg, TO_CHAR );
else
act( "You are not carrying any $T that you can drop.", ch, NULL, &arg[4], TO_CHAR );
}
}
return;
}
void do_give( CHAR_DATA *ch, char *argument ){
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *obj;
int currency;
MOB_CMD_CONTEXT *mcc;
WEV *wev;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if (IS_AFFECTED(ch, AFF_MIST)) {
send_to_char( "You can't do that in mist form?\r\n", ch );
return;
}
if ( arg1[0] == '\0' || arg2[0] == '\0' ) {
send_to_char( "Give what to whom?\r\n", ch );
return;
}
if ( is_number( arg1 )) {
/* 'give NNNN coins victim' */
int amount;
amount = atoi(arg1);
currency = flag_value(currency_accept, arg2);
if ( amount <= 0 || currency < 0) {
send_to_char( "Sorry, you can't do that.\r\n", ch );
return;
}
argument = one_argument( argument, arg2 );
if ( arg2[0] == '\0' ) {
send_to_char( "Give what to whom?\r\n", ch );
return;
}
if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) {
send_to_char( "They aren't here.\r\n", ch );
return;
}
if ( ch->gold[currency] < amount ) {
sprintf_to_char(ch, "You haven't got that much %s.\r\n", flag_string(currency_type, currency));
return;
}
/* Ok, get context and build the wev... */
mcc = get_mcc(ch, ch, victim, NULL, NULL, NULL, amount, flag_string(currency_type, currency));
wev = get_wev(WEV_GIVE, WEV_GIVE_GOLD, mcc,
"You give @n0 @t0 to @v2.\r\n",
"@a2 gives you @n0 @t0!\r\n",
"@a2 gives @v2 @n0 @t0.\r\n");
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
/* Make the transfer... */
ch->gold[currency] -= amount;
victim->gold[currency] += amount;
/* Send to command issuers room... */
room_issue_wev( ch->in_room, wev);
/* Free the wev (will autofree the context)... */
free_wev(wev);
mprog_bribe_trigger( victim, ch, amount );
return;
}
if ( ( obj = get_obj_carry( ch, arg1 ) ) == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if ( obj->wear_loc != WEAR_NONE ) {
send_to_char( "You must remove it first.\r\n", ch );
return;
}
if ( ( victim = get_char_room( ch, arg2 ) ) == NULL ) {
send_to_char( "They aren't here.\r\n", ch );
return;
}
if ( !can_drop_obj( ch, obj ) ) {
send_to_char( "You can't let go of it.\r\n", ch );
return;
}
if ( victim->carry_number + get_obj_number( obj ) > can_carry_n( victim ) ) {
act( "$N has $S hands full.", ch, NULL, victim, TO_CHAR );
return;
}
if ( victim->carry_weight + get_obj_weight( obj ) > can_carry_w( victim ) ) {
act( "$N can't carry that much weight.", ch, NULL, victim, TO_CHAR );
return;
}
if ( !can_see_obj( victim, obj ) ) {
act( "$N can't see it.", ch, NULL, victim, TO_CHAR );
return;
}
/* Ok, get context and build the wev... */
mcc = get_mcc(ch, ch, victim, NULL, obj, NULL, 0, NULL);
wev = get_wev(WEV_GIVE, WEV_GIVE_ITEM, mcc,
"You give @p2 to @v2.\r\n",
"@a2 gives you @p2!\r\n",
"@a2 gives @v2 @p2.\r\n");
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
/* Make the transfer... */
obj_from_char( obj );
obj_to_char( obj, victim );
if (obj->pIndexData && victim->pIndexData && !IS_NPC(ch)) {
if (obj->pIndexData->vnum == OBJ_VNUM_QUEST_DOCUMENT) {
if (ch->pcdata->questmob == victim->pIndexData->vnum
&& !IS_SET(victim->act, ACT_CRIMINAL)) {
int reward, pracreward, pointreward;
do_say(victim, "So you really got trough to me.");
reward = number_range(1000,10000);
pointreward = number_range(2,5);
sprintf(buf, "As a reward, I am giving you some fame, and %d {rCopper{x.",reward);
do_say(victim,buf);
if (chance(15)) {
pracreward = number_range(1,3);
sprintf(buf, "You gain %d practices!\r\n",pracreward);
send_to_char(buf, ch);
ch->practice += pracreward;
}
extract_obj(obj);
REMOVE_BIT(ch->plr, PLR_QUESTOR);
ch->pcdata->questgiver = NULL;
free_string(ch->pcdata->questplr);
ch->pcdata->questplr = strdup("");
ch->pcdata->countdown = 0;
ch->pcdata->questmob = 0;
ch->pcdata->questobj = 0;
ch->pcdata->nextquest = 30;
ch->gold[0] += reward;
ch->pcdata->questpoints += pointreward;
}
}
}
/* Send to command issuers room... */
room_issue_wev( ch->in_room, wev);
/* Free the wev (will autofree the context)... */
free_wev(wev);
mprog_give_trigger( victim, ch, obj );
return;
}
void do_fill( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
OBJ_DATA *obj;
MOB_CMD_CONTEXT *mcc;
WEV *wev;
/* What do they want to fill? */
one_argument( argument, arg );
if ( arg[0] == '\0' ) {
send_to_char( "Fill what?\r\n", ch );
return;
}
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if (obj->item_type != ITEM_DRINK_CON
&& (obj->item_type != ITEM_LIGHT || obj->value[1] == 0)) {
send_to_char( "You can't fill that.\r\n", ch );
return;
}
if (obj->item_type == ITEM_LIGHT) {
OBJ_DATA *refill;
int capacity = UMAX(obj->pIndexData->value[2], obj->pIndexData->value[4]);
for (refill = ch->carrying; refill; refill = refill->next_content) {
if (refill->item_type == ITEM_LIGHT_REFILL && refill->value[1] == obj->value[1]) break;
}
if (!refill) {
send_to_char( "You have nothing to refill it.\r\n", ch );
return;
}
if (obj->value[2] > refill->value[2] || obj->value[2] < 0) {
send_to_char( "No need to refill it yet.\r\n", ch );
return;
}
mcc = get_mcc(ch, ch, NULL, NULL, obj, refill, obj->value[1], flag_string(refill_type, obj->value[1]));
wev = get_wev(WEV_FILL, WEV_FILL_LIGHT, mcc,
"You refill @p2 with @s2.\r\n",
"@a2 refills @p2 with @s2.\r\n",
"@a2 refills @p2 with @s2.\r\n");
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
obj->value[2] = refill->value[2];
if (obj->pIndexData) {
if (obj->value[2] > capacity) obj->value[2] = capacity;
}
obj_from_char(refill);
extract_obj(refill);
room_issue_wev( ch->in_room, wev);
free_wev(wev);
return;
} else {
OBJ_DATA *fountain;
if ( obj->value[1] >= obj->value[0] ) {
if ( obj->value[2] >= 0
&& obj->value[2] < LIQ_MAX) {
sprintf(buf, "Your container already holds %s fluid.\r\n", liq_table[obj->value[2]].liq_color);
} else {
sprintf(buf, "Your container already holds a strange fluid!\r\n");
}
send_to_char( buf, ch );
return;
}
fountain = ch->in_room->contents;
while ( fountain != NULL
&& fountain->item_type != ITEM_FOUNTAIN ) {
fountain = fountain->next_content;
}
if (fountain == NULL) {
send_to_char( "There is no fountain here!\r\n", ch );
return;
}
if ( fountain->value[0] < 0
|| fountain->value[0] >= LIQ_MAX) {
send_to_char("You don't want a bottle of that!\r\n", ch);
return;
}
if ( obj->value[1] != 0
&& obj->value[2] != 0 ) {
if ( obj->value[2] > 0
&& obj->value[2] < LIQ_MAX) {
sprintf(buf, "Your container already holds %s fluid.\r\n", liq_table[obj->value[2]].liq_color);
} else {
sprintf(buf, "Your container already holds a strange fluid!\r\n");
}
send_to_char( buf, ch );
return;
}
mcc = get_mcc(ch, ch, NULL, NULL, obj, fountain, 0, liq_table[fountain->value[0]].liq_name);
wev = get_wev(WEV_FILL, WEV_FILL_FOUNTAIN, mcc,
"You fill @p2 with @t0 from @s2.\r\n",
"@a2 fills @p2 from @s2.\r\n",
"@a2 fills @p2 from @s2.\r\n");
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
obj->value[1] = obj->value[0];
obj->value[2] = fountain->value[0];
obj->value[4] = fountain->value[3];
if (obj->value[3] == 0) {
if ( fountain->value[1] == 1 ) {
if (number_open() > 100) {
fountain->value[1] = 1;
} else {
obj->value[3] = fountain->value[1];
}
}
} else {
if ( fountain->value[1] == 0 ) {
if (number_open() > 100) {
fountain->value[1] = 1;
}
}
}
room_issue_wev( ch->in_room, wev);
free_wev(wev);
return;
}
}
void do_pour( CHAR_DATA *ch, char * argument ) {
char buf[MAX_INPUT_LENGTH];
char arg[MAX_INPUT_LENGTH];
char arg1[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *to_obj;
int translevel;
/* What do they want to fill? */
argument = one_argument( argument, arg );
argument = one_argument( argument, arg1 );
if ( arg[0] == '\0' ) {
send_to_char( "Pour what?\r\n", ch );
return;
}
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if (obj->item_type != ITEM_DRINK_CON
&& obj->item_type != ITEM_POTION ) {
send_to_char( "You can't pour that anywhere.\r\n", ch );
return;
}
if (!str_cmp(arg1, "out")
|| arg1[0] =='\0') {
if (obj->item_type == ITEM_DRINK_CON) {
if (obj->value[1] == 0) {
send_to_char( "It's already empty.\r\n", ch );
return;
}
obj->value[1]=0;
act( "$n pours $p out.",ch, obj, NULL, TO_ROOM );
send_to_char( "You pour it out.\r\n", ch );
} else if (obj->item_type == ITEM_POTION) {
if (obj->value[1] == 0
&& obj->value[2] == 0
&& obj->value[3] == 0) {
send_to_char( "It's already empty.\r\n", ch );
return;
}
obj->value[0] = 0;
obj->value[1] = 0;
obj->value[2] = 0;
obj->value[3] = 0;
act( "$n pours $p out.",ch, obj, NULL, TO_ROOM );
send_to_char( "You pour it out.\r\n", ch );
free_string(obj->name);
obj->name = str_dup("vial empty");
free_string(obj->short_descr);
obj->short_descr = str_dup("an empty vial");
free_string(obj->description);
obj->description = str_dup("An empty vial lies here.\n");
}
} else {
if (obj->item_type != ITEM_POTION) {
send_to_char( "The concentration in your drink container is much too low.\r\n", ch );
return;
}
if ((to_obj = get_obj_here(ch, arg1) ) == NULL ) {
send_to_char( "Where do you want to pour it in?\r\n", ch );
return;
}
if (to_obj->item_type != ITEM_DRINK_CON
&& to_obj->item_type != ITEM_FOUNTAIN ) {
send_to_char( "You can't pour your potion into that.\r\n", ch );
return;
}
if (obj->value[1] == 0
&& obj->value[2] == 0
&& obj->value[3] == 0) {
send_to_char( "This vial is empty.\r\n", ch );
return;
}
sprintf(buf, "$n pours $p into %s.", to_obj->short_descr);
act(buf, ch, obj, NULL, TO_ROOM );
sprintf(buf, "You pour $p into %s.", to_obj->short_descr);
act(buf, ch, obj, NULL, TO_CHAR);
if (to_obj->item_type == ITEM_FOUNTAIN) {
translevel = obj->value[0]/25;
if (translevel < to_obj->value[2]) {
send_to_char("The concentration seems to be too low.\r\n", ch);
} else {
send_to_char("The color of the liquit changes a tiny bit.\r\n", ch);
to_obj->value[3] = obj->value[1];
to_obj->value[2] = translevel;
}
} else if (to_obj->item_type == ITEM_DRINK_CON) {
if (to_obj->value[4] > 0) {
send_to_char("The concentration seems to be too low.\r\n", ch);
} else {
send_to_char("The color of the liquit changes a tiny bit.\r\n", ch);
to_obj->value[4] = obj->value[1];
}
}
obj->value[0] = 0;
obj->value[1] = 0;
obj->value[2] = 0;
obj->value[3] = 0;
free_string(obj->name);
obj->name = str_dup("vial empty");
free_string(obj->short_descr);
obj->short_descr = str_dup("an empty vial");
free_string(obj->description);
obj->description = str_dup("An empty vial lies here.\n");
}
if (obj->condition < 10) {
obj_from_char(obj);
extract_obj(obj);
}
return;
}
void do_drink( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
int amount;
int liquid;
int aff_liq;
bool poisoned;
MOB_CMD_CONTEXT *mcc;
WEV *wev;
wev = NULL;
/* Hunt the object time... */
one_argument( argument, arg );
if ( arg[0] == '\0' ) {
for ( obj = ch->in_room->contents; obj != NULL; obj = obj->next_content ) {
if ( obj->item_type == ITEM_FOUNTAIN || obj->item_type == ITEM_POOL) break;
}
if ( obj == NULL ) {
send_to_char( "Drink what?\r\n", ch );
return;
}
/* Work out what we're drinking... */
liquid = obj->value[0];
poisoned = (obj->value[1] != 0);
amount = 0;
} else {
obj = get_obj_here( ch, arg );
if ( obj == NULL ) {
send_to_char( "You can't find it.\r\n", ch );
return;
}
/* Check that it is a bottle... */
if ( obj->item_type != ITEM_DRINK_CON
&& obj->item_type != ITEM_FOUNTAIN
&& obj->item_type != ITEM_POOL
&& obj->pIndexData->vnum != 54) {
send_to_char( "You can't drink from that.\r\n", ch );
return;
}
if (obj->condition < 5) {
send_to_char( "It's much too damaged.\r\n", ch );
return;
}
/* Check that there's something in it... */
if (obj->item_type == ITEM_DRINK_CON) {
amount = obj->value[1];
if ( amount <= 0 ) {
send_to_char( "It is already empty.\r\n", ch );
return;
}
/* Work out what we're drinking from a bottle... */
liquid = obj->value[2];
poisoned = (obj->value[3] != 0);
} else if (obj->item_type == ITEM_FOUNTAIN || obj->item_type == ITEM_POOL) {
/* Work out what we're drinking from a fountain... */
liquid = obj->value[0];
poisoned = (obj->value[1] != 0);
amount = 0;
} else {
/* Licking blood */
if (is_affected(ch, gafn_poison)) {
send_to_char("You don't want to drink that horrible stuff again!\r\n", ch);
return;
}
liquid = LIQ_BLOOD;
poisoned = TRUE;
amount = 0;
}
}
/* Check the liquid is valid... */
if ( liquid < 0
|| liquid >= LIQ_MAX ) {
send_to_char("Looks like it's gone off!\r\n", ch);
return;
}
/* To drunk to drink? */
if ( !IS_NPC(ch)
&& ch->condition[COND_DRUNK] > 10 + number_range(0,15)) {
send_to_char( "You fail to reach your mouth. *Hic*\r\n", ch );
return;
}
/* Got any room? */
if ( !IS_NPC(ch)
&& ch->condition[COND_DRINK] > 600) {
send_to_char("You're not thirsty!\r\n", ch);
return;
}
/* Ok, get context and build the wev... */
mcc = get_mcc(ch, ch, NULL, NULL, obj, NULL, amount - 1, liq_table[liquid].liq_name);
/* What's it like going down... */
aff_liq = liquid;
if ( liq_table[aff_liq].immune != 0
&& IS_SET(ch->imm_flags, liq_table[aff_liq].immune) ) {
aff_liq = LIQ_WATER;
}
if ( liq_table[aff_liq].food != 0
&& IS_SET(ch->imm_flags, liq_table[aff_liq].food) ) {
aff_liq = LIQ_JUICE;
}
/*Water creatures like salt water too*/
if (IS_AFFECTED(ch, AFF_SWIM)
&& IS_AFFECTED(ch, AFF_WATER_BREATHING)
&& aff_liq == LIQ_SALT_WATER) {
aff_liq = LIQ_WATER;
send_to_char("{cYou're used to salt-water.{x\r\n", ch);
}
/*Drinking Blood*/
if (!IS_NPC(ch)
&& IS_SET(ch->act, ACT_VAMPIRE)
&& aff_liq == LIQ_BLOOD) {
send_to_char("{rYou're used to fresh blood.{x\r\n", ch);
ch->pcdata->blood = UMIN(ch->pcdata->blood+10, ch->level);
if (is_affected(ch, gafn_frenzy)) {
if (check_dispel(255,ch, gafn_frenzy)) {
send_to_char ("You really needed that drink...\r\n",ch);
REMOVE_BIT(ch->parts, PART_FANGS);
}
}
}
/* Work out the wev's... */
if (obj->item_type == ITEM_FOUNTAIN || obj->item_type == ITEM_POOL) {
if (liq_table[aff_liq].liq_affect[COND_DRINK] > 0) {
wev = get_wev(WEV_DRINK, WEV_DRINK_FOUNTAIN_OK, mcc,
"You drink lots of @t0 from @p2.\r\n",
"@a2 drinks a lot from @p2.\r\n",
"@a2 drinks a lot from @p2.\r\n");
} else {
wev = get_wev(WEV_DRINK, WEV_DRINK_FOUNTAIN_BAD, mcc,
"You drink some @t0 from @p2! Yuck!\r\n",
"@a2 drinks from @p2 and wishes @a5 hadn't!\r\n",
"@a2 drinks from @p2 and wishes @a5 hadn't!\r\n");
}
}
if (obj->item_type == ITEM_DRINK_CON) {
if (liq_table[aff_liq].liq_affect[COND_DRINK] > 0) {
wev = get_wev(WEV_DRINK, WEV_DRINK_ITEM_OK, mcc,
"You drink @t0 from @p2.\r\n",
"@a2 drinks from @p2.\r\n",
"@a2 drinks from @p2.\r\n");
} else {
wev = get_wev(WEV_DRINK, WEV_DRINK_ITEM_BAD, mcc,
"You drink some @t0 from @p2! Yuck!\r\n",
"@a2 drinks from @p2 and wishes @a5 hadn't!\r\n",
"@a2 drinks from @p2 and wishes @a5 hadn't!\r\n");
}
}
if (obj->item_type == ITEM_TRASH) {
wev = get_wev(WEV_DRINK, WEV_DRINK_ITEM_BAD, mcc,
"You lick stained blood from @p2!\r\n",
"@a2 licks stained blood from @p2 and wishes @a5 hadn't!\r\n",
"@a2 licks stained blood from @p2 and wishes @a5 hadn't!\r\n");
}
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
room_issue_wev( ch->in_room, wev);
free_wev(wev);
/* Ok, do the drinking... */
if (obj->item_type == ITEM_FOUNTAIN) {
if (obj->value[3] != EFFECT_UNDEFINED) obj_cast_spell( obj->value[3], obj->value[2]+1, ch, ch, obj, NULL );
if ( !IS_NPC(ch) ) {
if ( ch->condition[COND_FOOD] >= COND_STUFFED
&& liq_table[aff_liq].liq_affect[COND_FOOD] > 0 ) {
gain_condition( ch, COND_FAT, 1 );
}
if (liq_table[aff_liq].liq_affect[COND_DRINK] > 0) {
amount = number_range(1, 3);
if (!IS_SET(ch->act, ACT_VAMPIRE)) {
gain_condition(ch, COND_FOOD, 27 * amount * liq_table[aff_liq].liq_affect[COND_FOOD]);
gain_condition(ch, COND_DRINK, 27 * amount * liq_table[aff_liq].liq_affect[COND_DRINK]);
}
gain_condition(ch, COND_DRUNK, amount * liq_table[aff_liq].liq_affect[COND_DRUNK]);
} else {
if (!IS_SET(ch->act, ACT_VAMPIRE)) {
gain_condition(ch, COND_FOOD, 27 * liq_table[aff_liq].liq_affect[COND_FOOD]);
gain_condition(ch, COND_DRINK, 27 * liq_table[aff_liq].liq_affect[COND_DRINK]);
}
gain_condition(ch, COND_DRUNK, liq_table[aff_liq].liq_affect[COND_DRUNK]);
}
}
}
if (obj->item_type == ITEM_POOL) {
int avail, need;
switch(obj->value[2]) {
default:
break;
case POOL_HEALTH:
need = ch->max_hit - ch->hit;
avail = obj->value[3] /4;
if (need > avail) {
ch->hit +=avail;
obj->value[3] -=avail;
} else {
ch->hit += need;
obj->value[3] -= need;
}
break;
case POOL_MOVES:
need = ch->max_move - ch->move;
avail = obj->value[3] /4;
if (need > avail) {
ch->move +=avail;
obj->value[3] -=avail;
} else {
ch->move += need;
obj->value[3] -= need;
}
break;
case POOL_MAGIC:
need = ch->max_mana - ch->mana;
avail = obj->value[3] /4;
if (need > avail) {
ch->mana +=avail;
obj->value[3] -=avail;
} else {
ch->mana += need;
obj->value[3] -= need;
}
break;
}
if ( !IS_NPC(ch) ) {
if ( ch->condition[COND_FOOD] >= COND_STUFFED
&& liq_table[aff_liq].liq_affect[COND_FOOD] > 0 ) {
gain_condition( ch, COND_FAT, 1 );
}
if (liq_table[aff_liq].liq_affect[COND_DRINK] > 0) {
amount = number_range(1, 3);
if (!IS_SET(ch->act, ACT_VAMPIRE)) {
gain_condition(ch, COND_FOOD, 27 * amount * liq_table[aff_liq].liq_affect[COND_FOOD]);
gain_condition(ch, COND_DRINK, 27 * amount * liq_table[aff_liq].liq_affect[COND_DRINK]);
}
gain_condition(ch, COND_DRUNK, amount * liq_table[aff_liq].liq_affect[COND_DRUNK]);
} else {
if (!IS_SET(ch->act, ACT_VAMPIRE)) {
gain_condition(ch, COND_FOOD, 27 * liq_table[aff_liq].liq_affect[COND_FOOD]);
gain_condition(ch, COND_DRINK, 27 * liq_table[aff_liq].liq_affect[COND_DRINK]);
}
gain_condition(ch, COND_DRUNK, liq_table[aff_liq].liq_affect[COND_DRUNK]);
}
}
}
/* But only a little from a bottle... */
if (obj->item_type == ITEM_DRINK_CON) {
if (obj->value[4] != EFFECT_UNDEFINED) obj_cast_spell( obj->value[4], obj->level/2 +1, ch, ch, obj, NULL );
if ( !IS_NPC(ch) ) {
if ( ch->condition[COND_FOOD] >= COND_STUFFED
&& liq_table[aff_liq].liq_affect[COND_FOOD] > 0 ) {
gain_condition( ch, COND_FAT, 1 + (obj->value[0]/10) );
}
if (!IS_SET(ch->act, ACT_VAMPIRE)) {
gain_condition(ch, COND_FOOD, 27 * liq_table[aff_liq].liq_affect[COND_FOOD]);
gain_condition(ch, COND_DRINK, 27 * liq_table[aff_liq].liq_affect[COND_DRINK]);
}
gain_condition(ch, COND_DRUNK, liq_table[aff_liq].liq_affect[COND_DRUNK]);
}
obj->value[1] -= 1;
if (obj->value[1] == 0) obj->value[4] = 0;
}
/* Let the poison take affect... */
if (obj->item_type == ITEM_TRASH) {
if ( !IS_NPC(ch) ) {
if ( ch->condition[COND_FOOD] >= COND_STUFFED
&& liq_table[aff_liq].liq_affect[COND_FOOD] > 0 ) {
gain_condition( ch, COND_FAT, 1 + (obj->value[0]/10) );
}
if (!IS_SET(ch->act, ACT_VAMPIRE)) {
gain_condition(ch, COND_FOOD, 27 * liq_table[aff_liq].liq_affect[COND_FOOD]);
gain_condition(ch, COND_DRINK, 27 * liq_table[aff_liq].liq_affect[COND_DRINK]);
}
gain_condition(ch, COND_DRUNK, liq_table[aff_liq].liq_affect[COND_DRUNK]);
}
obj_from_room(obj);
extract_obj(obj);
}
if (poisoned) {
AFFECT_DATA af;
af.afn = gafn_poison;
af.type = gsn_poison;
af.level = number_range(4, obj->level+5);
af.duration = 3 * number_range(5, 20);
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_POISON;
affect_join( ch, &af );
act( "$n chokes and gags.", ch, NULL, NULL, TO_ROOM );
send_to_char( "You choke and gag.\r\n", ch );
}
return;
}
void do_eat( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj = NULL;
AFFECT_DATA *pAf;
AFFECT_DATA af;
MOB_CMD_CONTEXT *mcc;
WEV *wev;
bool poisoned = FALSE;
int i;
int spell[4] = { 0, 0, 0, 0};
wev = NULL;
/* What are we trying to eat? */
one_argument( argument, arg );
if ( arg[0] == '\0' ) {
for (obj = ch->carrying; obj; obj = obj->next_content) {
if (obj->item_type == ITEM_FOOD) break;
}
if (!obj) {
send_to_char( "Eat what?\r\n", ch );
return;
}
}
/* Find food item in inventory... or on the floor */
if (!obj) {
if ((obj = get_obj_here(ch, arg)) == NULL) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
}
/* Check it's edible... */
if ( obj->item_type != ITEM_FOOD
&& obj->item_type != ITEM_PILL
&& obj->item_type != ITEM_HERB
&& obj->item_type != ITEM_CORPSE_NPC) {
send_to_char( "That's not edible.\r\n", ch );
return;
}
/* See if the player has room... */
if ( !IS_IMMORTAL(ch)
&& !IS_NPC(ch)
&& ch->condition[COND_FOOD] >= COND_OVER_STUFFED ) {
send_to_char( "You are too full to eat any more.\r\n", ch );
return;
}
/* Ok, get context and build the wev... */
mcc = get_mcc(ch, ch, NULL, NULL, obj, NULL, 0, NULL);
/* Work out the wevs... */
switch (obj->item_type) {
case ITEM_FOOD:
poisoned = (obj->value[3] != 0);
if (!poisoned) {
wev = get_wev(WEV_EAT, WEV_EAT_FOOD_OK, mcc,
"You eat @p2.\r\n",
"@a2 eats @p2.\r\n",
"@a2 eats @p2.\r\n");
} else {
wev = get_wev(WEV_EAT, WEV_EAT_FOOD_BAD, mcc,
"You eat @p2.\r\n",
"@a2 eats @p2.\r\n",
"@a2 eats @p2.\r\n");
}
break;
case ITEM_PILL:
wev = get_wev(WEV_EAT, WEV_EAT_PILL, mcc,
"You pop @p2.\r\n",
"@a2 pops @p2.\r\n",
"@a2 pops @p2.\r\n");
break;
case ITEM_HERB:
poisoned = (obj->value[2] != 0);
wev = get_wev(WEV_EAT, WEV_EAT_HERB, mcc,
"You chew @p2.\r\n",
"@a2 chews @p2.\r\n",
"@a2 chews @p2.\r\n");
break;
case ITEM_CORPSE_NPC:
if (str_cmp(race_array[ch->race].name,"deep one")) {
send_to_char( "You don't feel like cannibalizing that corpse.\r\n", ch );
return;
}
if (obj->contains != NULL) {
send_to_char( "You don't want to eat all the stuff on that corpse.\r\n", ch );
return;
}
poisoned = FALSE;
wev = get_wev(WEV_EAT, WEV_EAT_CORPSE, mcc,
"You cannibalize a @p2.\r\n",
"@a2 cannibalizes a @p2.\r\n",
"@a2 cannibalizes a @p2.\r\n");
break;
default:
bug("Wierd food found!", 0);
free_mcc(mcc);
return;
}
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
room_issue_wev( ch->in_room, wev);
free_wev(wev);
/* Ok, allowed to eat it... */
switch ( obj->item_type ) {
case ITEM_FOOD:
if (obj->value[2] != EFFECT_UNDEFINED) {
if (obj->value[2] == get_effect_efn("oracle")) {
sprintf_to_char(ch, "%s contains a scrap of paper. It reads:\r\n", capitalize(obj->short_descr));
}
obj_cast_spell( obj->value[2], obj->value[1], ch, ch, obj, NULL );
}
if ( !IS_NPC(ch) ) {
if ( ch->condition[COND_FOOD] >= COND_STUFFED ) {
gain_condition( ch, COND_FAT, 1 + (obj->value[0]/10) );
}
gain_condition( ch, COND_FOOD, 27 * obj->value[0] );
}
break;
case ITEM_CORPSE_NPC:
if ( !IS_NPC(ch) ) {
if ( ch->condition[COND_FOOD] >= COND_STUFFED ) {
gain_condition( ch, COND_FAT, 2 );
}
gain_condition( ch, COND_FOOD, 270 );
}
for (pAf = obj->affected; pAf != NULL; pAf = pAf->next) {
if (IS_AFFECTED(ch, pAf->bitvector)) continue;
af.type = pAf->type;
af.afn = pAf->afn;
af.level = obj->level/2;
af.duration = obj->level / number_range(5, 15) +1;
af.location = pAf->location;
af.modifier = pAf->modifier;
af.bitvector = pAf->bitvector;
affect_to_char(ch, &af);
}
break;
case ITEM_PILL:
spell[0] = obj->value[0];
spell[1] = obj->value[1];
spell[2] = obj->value[2];
spell[3] = obj->value[3];
break;
case ITEM_HERB:
spell[0] = obj->value[0];
spell[1] = obj->value[1];
spell[2] = obj->value[2];
break;
}
/* Apply poison... */
if (poisoned) {
/* The shit was poisoned! */
AFFECT_DATA af;
act( "$n chokes and gags.", ch, 0, 0, TO_ROOM );
send_to_char( "That didn't taste so good...\r\n", ch );
if (obj->item_type == ITEM_HERB ) {
af.type = gsn_poison;
af.afn = gafn_poison;
af.level = obj->level;
af.duration = obj->level/2;
af.location = APPLY_STR;
af.modifier = -obj->level/10;
af.bitvector = AFF_POISON;
affect_join( ch, &af );
} else {
af.type = gsn_poison;
af.afn = gafn_poison;
af.level = number_range(3,8);
af.duration = 2 * number_range(2, 24);
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_POISON;
affect_join( ch, &af );
}
}
/* Cast imbedded spells... */
if (spell[0] > 0) {
for(i=1; i < 4; i++) {
if (spell[i] > 0) {
obj_cast_spell( spell[i], spell[0], ch, ch, obj, NULL );
}
}
}
/* Lose the object... */
extract_obj( obj );
return;
}
/*
* Remove an object.
*/
bool remove_obj( CHAR_DATA *ch, int iWear, bool fReplace ) {
OBJ_DATA *obj;
MOB_CMD_CONTEXT *mcc;
WEV *wev;
if ((obj = get_eq_char( ch, iWear )) == NULL ) return TRUE;
if ( !fReplace ) return FALSE;
if ( IS_SET(obj->extra_flags, ITEM_NOREMOVE)) {
act( "You can't remove $p.", ch, obj, NULL, TO_CHAR );
return FALSE;
}
if (obj->item_type == ITEM_CAMERA) {
obj->value[4] = 0;
if (ch->activity == ACV_PHOTO) set_activity(ch, POS_STANDING, NULL, ACV_NONE, NULL);
}
mcc = get_mcc(ch, ch, NULL, NULL, obj, NULL, 0, NULL);
wev = get_wev(WEV_OPROG, WEV_OPROG_REMOVE, mcc,
NULL,
NULL,
NULL);
if (!room_issue_wev_challange(get_room_index(mud.monitor), wev)) {
room_issue_wev( ch->in_room, wev);
free_wev(wev);
return FALSE;
}
room_issue_wev( ch->in_room, wev);
free_wev(wev);
act( "$n stops using $p.", ch, obj, NULL, TO_ROOM );
act( "You stop using $p.", ch, obj, NULL, TO_CHAR );
if (obj->item_type == ITEM_LIGHT
&& obj->value[0] == FALSE && obj->value[3] == TRUE
&& (obj->value[2] != -1 && obj->value[2] < 999)) {
light_obj(ch, obj, FALSE);
}
unequip_char( ch, obj );
return TRUE;
}
/*
* Wear one object.
*/
void wear_obj( CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace, int slot) {
MOB_CMD_CONTEXT *mcc;
WEV *wev;
char buf[MAX_STRING_LENGTH];
int tech;
if ( (ch->level) < obj->level - 10 ) {
sprintf( buf, "You must be level %d to use this object.\r\n", obj->level - 10 );
send_to_char( buf, ch );
act( "$n tries to use $p, but is too inexperienced.", ch, obj, NULL, TO_ROOM );
return;
}
if (IS_SET(obj->extra_flags, ITEM_HYPER_TECH)) {
tech = (get_skill(ch, gsn_yuggoth) + ch->perm_stat[STAT_INT] + ch->level)/4;
if (tech < obj->level) {
send_to_char("You don't quite understand this object.\r\n", ch );
act( "$n tries to use $p, but doesn't know how.", ch, obj, NULL, TO_ROOM );
return;
}
}
mcc = get_mcc(ch, ch, NULL, NULL, obj, NULL, 0, NULL);
if (obj->pIndexData
&& obj->pIndexData->wear_cond) {
if (!ec_satisfied_mcc(mcc, obj->pIndexData->wear_cond, TRUE)) {
free_mcc(mcc);
sprintf_to_char(ch, "You are unable to use %s.\r\n", obj->short_descr );
act( "$n tries to use $p, but fails.", ch, obj, NULL, TO_ROOM );
return;
}
}
wev = get_wev(WEV_OPROG, WEV_OPROG_WEAR, mcc, NULL, NULL, NULL);
if (!room_issue_wev_challange(get_room_index(mud.monitor), wev)) {
free_wev(wev);
return;
}
room_issue_wev( ch->in_room, wev);
free_wev(wev);
if (slot == WEAR_WIELD) {
if (!wear_obj_size(ch, obj)) return;
if ( CAN_WEAR( obj, ITEM_WIELD )
&& ch->limb[3]<9) {
int sn,skill;
if ( !remove_obj( ch, WEAR_WIELD, fReplace )) return;
if (IS_SET(ch->act,ACT_WERE)
&& IS_AFFECTED(ch, AFF_POLY)) {
send_to_char("You don't need that!.\r\n",ch);
return;
}
if (IS_SET(ch->form, FORM_NOWEAPON)) {
send_to_char("You don't need that!\r\n",ch);
return;
}
if ( !IS_NPC(ch) && ch->pc_class == class_lookup("monk")) {
send_to_char( "Your code does not allow you to take up a weapon\r\n", ch );
return;
}
if ( !IS_NPC(ch)
&& get_obj_weight(obj ) > str_app[get_curr_stat(ch,STAT_STR)].wield ){
send_to_char( "It is too heavy for you to wield.\r\n", ch );
return;
}
if (!IS_NPC(ch) && get_char_size(ch) < SIZE_LARGE
&& IS_SET(obj->wear_flags, ITEM_TWO_HANDS)
&& get_eq_char(ch,WEAR_SHIELD) != NULL
&& get_eq_char(ch,WEAR_WIELD2) != NULL) {
send_to_char("You need two hands free for that weapon.\r\n",ch);
return;
}
act( "$n wields $p.", ch, obj, NULL, TO_ROOM );
act( "You wield $p.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_WIELD );
sn = get_weapon_sn(ch, FALSE);
if (sn == gsn_hand_to_hand) return;
skill = get_weapon_skill(ch,sn);
if (skill >= 100) act("$p feels like a part of you!",ch,obj,NULL,TO_CHAR);
else if (skill > 85) act("You feel quite confident with $p.",ch,obj,NULL,TO_CHAR);
else if (skill > 70) act("You are skilled with $p.",ch,obj,NULL,TO_CHAR);
else if (skill > 50) act("Your skill with $p is adequate.",ch,obj,NULL,TO_CHAR);
else if (skill > 25) act("$p feels a little clumsy in your hands.",ch,obj,NULL,TO_CHAR);
else if (skill > 1) act("You fumble and almost drop $p.",ch,obj,NULL,TO_CHAR);
else act("You don't even know which is end is up on $p.", ch,obj,NULL,TO_CHAR);
/* Autoload and clear the gun when you wield it... */
if ( (skill > 0)
&& ( (obj->value[0] == WEAPON_GUN)
|| (obj->value[0] == WEAPON_HANDGUN)
|| (obj->value[0] == WEAPON_BOW)
|| (obj->value[0] == WEAPON_SMG))) reload_gun (ch,obj, 0, TRUE);
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_SHIELD )
&& ch->limb[2]<9) {
OBJ_DATA *weapon;
if (!remove_obj( ch, WEAR_SHIELD, fReplace )) return;
if (IS_SET(ch->act,ACT_WERE)
&& IS_AFFECTED(ch, AFF_POLY)) {
send_to_char("You don't need that!\r\n",ch);
return;
}
if (IS_SET(ch->form, FORM_NOWEAPON)) {
send_to_char("You don't need that!\r\n",ch);
return;
}
weapon = get_eq_char(ch,WEAR_WIELD);
if (weapon != NULL && get_char_size(ch) < SIZE_LARGE
&& IS_SET(weapon->wear_flags, ITEM_TWO_HANDS)) {
send_to_char("Your hands are tied up with your weapon!\r\n",ch);
return;
}
weapon = get_eq_char(ch,WEAR_WIELD2);
if (weapon != NULL) {
send_to_char("You cannot use a shield while dual wielding!\r\n",ch);
return;
}
if ( ch->pc_class == class_lookup("monk") ) {
send_to_char("A shield would impair your fighting style too much.\r\n",ch);
return;
}
act( "$n wears $p as a shield.", ch, obj, NULL, TO_ROOM );
act( "You wear $p as a shield.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_SHIELD );
return;
}
}
if (slot == WEAR_HOLD) {
if ( CAN_WEAR( obj, ITEM_HOLD )
&& ch->limb[2]<9) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_HOLD, fReplace )) return;
act( "$n holds $p in $s hands.", ch, obj, NULL, TO_ROOM );
act( "You hold $p in your hands.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_HOLD );
return;
}
if ( obj->item_type == ITEM_PRIDE ) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_PRIDE, fReplace ) ) return;
act( "$n wears $p with pride.", ch, obj, NULL, TO_ROOM );
act( "You wear $p with pride.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_PRIDE );
return;
}
if ( obj->item_type == ITEM_LIGHT ) {
if ( !remove_obj( ch, WEAR_LIGHT, fReplace)) return;
act( "$n holds $p.", ch, obj, NULL, TO_ROOM );
act( "You hold $p.", ch, obj, NULL, TO_CHAR );
if (obj->value[0] == FALSE && obj->value[3] == FALSE
&& (obj->value[2] != -1 && obj->value[2] < 999)) {
light_obj(ch, obj, TRUE);
}
equip_char( ch, obj, WEAR_LIGHT );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_FLOAT ) ) {
if ( !remove_obj( ch, WEAR_FLOAT, fReplace )) return;
act( "$p starts floating near $n.", ch, obj, NULL, TO_ROOM );
act( "$p starts floating beside you.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_FLOAT );
return;
}
}
if ( obj->item_type == ITEM_TATTOO ) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_TATTOO, fReplace ) ) return;
act( "$p is being tattooed in $ns skin.", ch, obj, NULL, TO_ROOM );
act( "$p is being tattooed in your skin.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_TATTOO );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_FINGER ) ) {
if (!wear_obj_size(ch, obj)) return;
if ( get_eq_char( ch, WEAR_FINGER_L ) != NULL
&& get_eq_char( ch, WEAR_FINGER_R ) != NULL
&& !remove_obj( ch, WEAR_FINGER_L, fReplace )
&& !remove_obj( ch, WEAR_FINGER_R, fReplace ) )
return;
if ( get_eq_char( ch, WEAR_FINGER_L ) == NULL
&& ch->limb[2]<9) {
act( "$n wears $p on $s left finger.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your left finger.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_FINGER_L );
return;
}
if ( get_eq_char( ch, WEAR_FINGER_R ) == NULL
&& ch->limb[3]<9) {
act( "$n wears $p on $s right finger.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your right finger.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_FINGER_R );
return;
}
bug( "Wear_obj: no free finger.", 0 );
send_to_char( "You already wear two rings.\r\n", ch );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_NECK ) ) {
if (!wear_obj_size(ch, obj)) return;
if ( get_eq_char( ch, WEAR_NECK_1 ) != NULL
&& get_eq_char( ch, WEAR_NECK_2 ) != NULL
&& !remove_obj( ch, WEAR_NECK_1, fReplace )
&& !remove_obj( ch, WEAR_NECK_2, fReplace ) )
return;
if ( get_eq_char( ch, WEAR_NECK_1 ) == NULL ) {
act( "$n wears $p around $s neck.", ch, obj, NULL, TO_ROOM );
act( "You wear $p around your neck.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_NECK_1 );
return;
}
if ( get_eq_char( ch, WEAR_NECK_2 ) == NULL ) {
act( "$n wears $p around $s neck.", ch, obj, NULL, TO_ROOM );
act( "You wear $p around your neck.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_NECK_2 );
return;
}
bug( "Wear_obj: no free neck.", 0 );
send_to_char( "You already wear two neck items.\r\n", ch );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_BODY ) ) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_BODY, fReplace )) return;
act( "$n wears $p on $s body.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your body.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_BODY );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_HEAD ) ) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_HEAD, fReplace )) return;
act( "$n wears $p on $s head.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your head.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_HEAD );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_FACE ) ) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_FACE, fReplace ) ) return;
act( "$n wears $p on $s face.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your face.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_FACE );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_EARS ) ) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_EARS, fReplace ) ) return;
act( "$n wears $p on $s ears.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your ears.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_EARS );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_LEGS )) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_LEGS, fReplace )) return;
act( "$n wears $p on $s legs.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your legs.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_LEGS );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_FEET )) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_FEET, fReplace )) return;
act( "$n wears $p on $s feet.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your feet.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_FEET );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_HANDS )) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_HANDS, fReplace )) return;
act( "$n wears $p on $s hands.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your hands.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_HANDS );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_ARMS )) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_ARMS, fReplace ) ) return;
act( "$n wears $p on $s arms.", ch, obj, NULL, TO_ROOM );
act( "You wear $p on your arms.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_ARMS );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_ABOUT )) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_ABOUT, fReplace ) ) return;
act( "$n wears $p about $s body.", ch, obj, NULL, TO_ROOM );
act( "You wear $p about your body.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_ABOUT );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_WAIST )) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_WAIST, fReplace ) ) return;
act( "$n wears $p about $s waist.", ch, obj, NULL, TO_ROOM );
act( "You wear $p about your waist.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_WAIST );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_WRIST ) ) {
if (!wear_obj_size(ch, obj)) return;
if ( get_eq_char( ch, WEAR_WRIST_L ) != NULL
&& get_eq_char( ch, WEAR_WRIST_R ) != NULL
&& !remove_obj( ch, WEAR_WRIST_L, fReplace )
&& !remove_obj( ch, WEAR_WRIST_R, fReplace ) )
return;
if ( get_eq_char( ch, WEAR_WRIST_L ) == NULL ) {
act( "$n wears $p around $s left wrist.", ch, obj, NULL, TO_ROOM );
act( "You wear $p around your left wrist.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_WRIST_L );
return;
}
if ( get_eq_char( ch, WEAR_WRIST_R ) == NULL ) {
act( "$n wears $p around $s right wrist.", ch, obj, NULL, TO_ROOM );
act( "You wear $p around your right wrist.",ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_WRIST_R );
return;
}
bug( "Wear_obj: no free wrist.", 0 );
send_to_char( "You already wear two wrist items.\r\n", ch );
return;
}
if (CAN_WEAR(obj, ITEM_WEAR_EYES)) {
if (!wear_obj_size(ch, obj)) return;
if (!remove_obj(ch, WEAR_EYES, fReplace)) return;
act("$n puts $p over $s eyes.", ch, obj, NULL, TO_ROOM);
act("You cover your eyes with $p.", ch, obj, NULL, TO_CHAR);
equip_char(ch, obj, WEAR_EYES);
return;
}
if (CAN_WEAR(obj, ITEM_WEAR_BACK)) {
if (!wear_obj_size(ch, obj)) return;
if (!remove_obj(ch, WEAR_BACK, fReplace)) return;
act("$n puts $p on $s back.", ch, obj, NULL, TO_ROOM);
act("You put $p on your back.", ch, obj, NULL, TO_CHAR);
equip_char(ch, obj, WEAR_BACK);
return;
}
if ( obj->item_type == ITEM_PRIDE ) {
if (!wear_obj_size(ch, obj)) return;
if ( !remove_obj( ch, WEAR_PRIDE, fReplace ) ) return;
act( "$n wears $p with pride.", ch, obj, NULL, TO_ROOM );
act( "You wear $p with pride.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_PRIDE );
return;
}
if ( obj->item_type == ITEM_LIGHT ) {
if ( !remove_obj( ch, WEAR_LIGHT, fReplace)) return;
act( "$n holds $p.", ch, obj, NULL, TO_ROOM );
act( "You hold $p.", ch, obj, NULL, TO_CHAR );
if (obj->value[0] == FALSE && obj->value[3] == FALSE
&& (obj->value[2] != -1 && obj->value[2] < 999)) {
light_obj(ch, obj, TRUE);
}
equip_char( ch, obj, WEAR_LIGHT );
return;
}
if ( CAN_WEAR( obj, ITEM_WEAR_FLOAT ) ) {
if ( !remove_obj( ch, WEAR_FLOAT, fReplace )) return;
act( "$p starts floating near $n.", ch, obj, NULL, TO_ROOM );
act( "$p starts floating beside you.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_FLOAT );
return;
}
if (!wear_obj_size(ch, obj)) return;
if ( CAN_WEAR( obj, ITEM_WEAR_SHIELD )
&& ch->limb[2]<9) {
OBJ_DATA *weapon;
if ( !remove_obj( ch, WEAR_SHIELD, fReplace )) return;
if (IS_SET(ch->act,ACT_WERE)
&& IS_AFFECTED(ch, AFF_POLY)) {
send_to_char("You don't need that!.\r\n",ch);
return;
}
if (IS_SET(ch->form, FORM_NOWEAPON)) {
send_to_char("You don't need that!\r\n",ch);
return;
}
weapon = get_eq_char(ch,WEAR_WIELD);
if (weapon != NULL && get_char_size(ch) < SIZE_LARGE
&& IS_SET(weapon->wear_flags, ITEM_TWO_HANDS)) {
send_to_char("Your hands are tied up with your weapon!\r\n",ch);
return;
}
weapon = get_eq_char(ch,WEAR_WIELD2);
if (weapon != NULL) {
send_to_char("You cannot use a shield while dual wielding!\r\n",ch);
return;
}
if ( ch->pc_class == class_lookup("monk") ) {
send_to_char("A shield would impair your fighting style too much.\r\n",ch);
return;
}
act( "$n wears $p as a shield.", ch, obj, NULL, TO_ROOM );
act( "You wear $p as a shield.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_SHIELD );
return;
}
if ( CAN_WEAR( obj, ITEM_WIELD )
&& ch->limb[3]<9) {
int sn,skill;
if ( !remove_obj( ch, WEAR_WIELD, fReplace )) return;
if (IS_SET(ch->act,ACT_WERE)
&& IS_AFFECTED(ch, AFF_POLY)) {
send_to_char("You don't need that!.\r\n",ch);
return;
}
if (IS_SET(ch->form, FORM_NOWEAPON)) {
send_to_char("You don't need that!\r\n",ch);
return;
}
if ( !IS_NPC(ch) && ch->pc_class == class_lookup("monk")) {
send_to_char( "Your code does not allow you to take up a weapon\r\n", ch );
return;
}
if ( !IS_NPC(ch)
&& get_obj_weight(obj ) > str_app[get_curr_stat(ch,STAT_STR)].wield ){
send_to_char( "It is too heavy for you to wield.\r\n", ch );
return;
}
if (!IS_NPC(ch) && get_char_size(ch) < SIZE_LARGE
&& IS_SET(obj->wear_flags, ITEM_TWO_HANDS)
&& get_eq_char(ch,WEAR_SHIELD) != NULL
&& get_eq_char(ch,WEAR_WIELD2) != NULL)
{
send_to_char("You need two hands free for that weapon.\r\n",ch);
return;
}
act( "$n wields $p.", ch, obj, NULL, TO_ROOM );
act( "You wield $p.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_WIELD );
sn = get_weapon_sn(ch, FALSE);
if (sn == gsn_hand_to_hand)
return;
skill = get_weapon_skill(ch,sn);
if (skill >= 100) act("$p feels like a part of you!",ch,obj,NULL,TO_CHAR);
else if (skill > 85) act("You feel quite confident with $p.",ch,obj,NULL,TO_CHAR);
else if (skill > 70) act("You are skilled with $p.",ch,obj,NULL,TO_CHAR);
else if (skill > 50) act("Your skill with $p is adequate.",ch,obj,NULL,TO_CHAR);
else if (skill > 25) act("$p feels a little clumsy in your hands.",ch,obj,NULL,TO_CHAR);
else if (skill > 1) act("You fumble and almost drop $p.",ch,obj,NULL,TO_CHAR);
else act("You don't even know which is end is up on $p.", ch,obj,NULL,TO_CHAR);
/* Autoload and clear the gun when you wield it... */
if ( (skill > 0)
&& ( (obj->value[0] == WEAPON_GUN)
|| (obj->value[0] == WEAPON_HANDGUN)
|| (obj->value[0] == WEAPON_BOW)
|| (obj->value[0] == WEAPON_SMG))) reload_gun (ch,obj, 0, TRUE);
return;
}
if ( CAN_WEAR( obj, ITEM_HOLD )
&& ch->limb[2]<9) {
if ( !remove_obj( ch, WEAR_HOLD, fReplace ) )
return;
act( "$n holds $p in $s hands.", ch, obj, NULL, TO_ROOM );
act( "You hold $p in your hands.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_HOLD );
return;
}
if ( fReplace ) send_to_char( "You can't wear, wield, or hold that.\r\n", ch );
return;
}
void do_dual (CHAR_DATA *ch, char *argument) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
char buf[MAX_STRING_LENGTH];
one_argument( argument, arg );
if ( arg[0] == '\0' ) {
send_to_char( "Dual wield what?\r\n", ch );
return;
}
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if ( (ch->level) < obj->level - 10) {
sprintf( buf, "You must be level %d to use this object.\r\n", obj->level-10 );
send_to_char( buf, ch );
act( "$n tries to use $p, but is too inexperienced.", ch, obj, NULL, TO_ROOM );
return;
}
if ( CAN_WEAR( obj, ITEM_WIELD )
&& ch->limb[2]<9) {
int sn,skill;
if ( !remove_obj( ch, WEAR_WIELD2, TRUE )) return;
if (IS_SET(ch->act,ACT_WERE)
&& IS_AFFECTED(ch, AFF_POLY)) {
send_to_char("You don't need that!.\r\n",ch);
return;
}
if (IS_SET(ch->form, FORM_NOWEAPON)) {
send_to_char("You don't need that!\r\n",ch);
return;
}
if ( !IS_NPC(ch)
&& get_obj_weight( obj ) > ((str_app[get_curr_stat(ch,STAT_STR)].wield) / 2)) {
send_to_char( "It is too heavy for you to wield in your off-hand.\r\n", ch );
return;
}
if ( !IS_NPC(ch) && get_char_size(ch) < SIZE_LARGE
&& IS_SET(obj->wear_flags, ITEM_TWO_HANDS)
&& get_eq_char(ch,WEAR_WIELD) !=NULL) {
send_to_char("You need two hands free for that weapon.\r\n",ch);
return;
}
if (get_eq_char(ch, WEAR_SHIELD) != NULL) {
send_to_char ("You cannot dual wield while using a shield!\r\n",ch);
return;
}
act( "$n wields $p.", ch, obj, NULL, TO_ROOM );
act( "You wield $p.", ch, obj, NULL, TO_CHAR );
equip_char( ch, obj, WEAR_WIELD2 );
sn = get_weapon_sn(ch, TRUE);
if (sn == gsn_hand_to_hand) return;
skill = get_weapon_skill(ch,sn);
if (skill >= 100) act("$p feels like a part of you!",ch,obj,NULL,TO_CHAR);
else if (skill > 85) act("You feel quite confident with $p.",ch,obj,NULL,TO_CHAR);
else if (skill > 70) act("You are skilled with $p.",ch,obj,NULL,TO_CHAR);
else if (skill > 50) act("Your skill with $p is adequate.",ch,obj,NULL,TO_CHAR);
else if (skill > 25) act("$p feels a little clumsy in your hands.",ch,obj,NULL,TO_CHAR);
else if (skill > 1) act("You fumble and almost drop $p.",ch,obj,NULL,TO_CHAR);
else act("You don't even know which is end is up on $p.", ch,obj,NULL,TO_CHAR);
/* Autoload and clear the gun when you wield it... */
if ( (skill > 0)
&& ( obj->value[0] == WEAPON_GUN
|| obj->value[0] == WEAPON_HANDGUN
|| obj->value[0] == WEAPON_BOW
|| obj->value[0] == WEAPON_SMG)) reload_gun (ch,obj, 1, TRUE);
return;
}
}
void do_wear( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
one_argument( argument, arg );
if (IS_AFFECTED(ch, AFF_MIST)) {
send_to_char( "You can't do that in mist form?\r\n", ch );
return;
}
if ( arg[0] == '\0' ) {
send_to_char( "Wear, wield, or hold what?\r\n", ch );
return;
}
if ( !str_cmp( arg, "all" ) ) {
OBJ_DATA *obj_next;
for ( obj = ch->carrying; obj != NULL; obj = obj_next ) {
obj_next = obj->next_content;
if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) ) {
if (obj->condition != 0) {
wear_obj( ch, obj, FALSE, 0);
} else {
act ("$p is too damaged to wear!", ch, obj, NULL, TO_CHAR);
}
}
}
return;
} else {
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if (obj->condition == 0) act ("$p is too damaged to wear!", ch, obj, NULL, TO_CHAR);
else wear_obj(ch, obj, TRUE, 0);
}
return;
}
void do_wield( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
one_argument( argument, arg );
if (IS_AFFECTED(ch, AFF_MIST)) {
send_to_char( "You can't do that in mist form?\r\n", ch );
return;
}
if ( arg[0] == '\0' ) {
send_to_char( "Wield what?\r\n", ch );
return;
}
if ( !str_cmp( arg, "all" ) ) {
OBJ_DATA *obj_next;
for ( obj = ch->carrying; obj != NULL; obj = obj_next ) {
obj_next = obj->next_content;
if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) ) {
if (obj->condition != 0) {
wear_obj(ch, obj, FALSE, 0);
} else {
act ("$p is too damaged to wield!", ch, obj, NULL, TO_CHAR);
}
}
}
return;
} else {
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if (obj->condition == 0) {
act ("$p is too damaged to wield!", ch, obj, NULL, TO_CHAR);
} else {
if (IS_SET(obj->wear_flags, ITEM_WIELD) || IS_SET(obj->wear_flags, ITEM_WEAR_SHIELD)) wear_obj( ch, obj, TRUE, WEAR_WIELD);
else if (IS_SET(obj->wear_flags, ITEM_HOLD) || IS_SET(obj->wear_flags, ITEM_WEAR_PRIDE) || IS_SET(obj->wear_flags, ITEM_WEAR_FLOAT)) wear_obj( ch, obj, TRUE, WEAR_HOLD);
else wear_obj( ch, obj, TRUE, 0 );
}
}
return;
}
void do_hold( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
one_argument( argument, arg );
if (IS_AFFECTED(ch, AFF_MIST)) {
send_to_char( "You can't do that in mist form?\r\n", ch );
return;
}
if ( arg[0] == '\0' ) {
send_to_char( "Hold what?\r\n", ch );
return;
}
if ( !str_cmp( arg, "all" ) ) {
OBJ_DATA *obj_next;
for ( obj = ch->carrying; obj != NULL; obj = obj_next ) {
obj_next = obj->next_content;
if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) ) {
if (obj->condition != 0) {
wear_obj(ch, obj, FALSE, 0);
} else {
act ("$p is too damaged to hold!", ch, obj, NULL, TO_CHAR);
}
}
}
return;
} else {
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL ) {
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if (obj->condition == 0) {
act ("$p is too damaged to hold!", ch, obj, NULL, TO_CHAR);
} else {
if (IS_SET(obj->wear_flags, ITEM_HOLD) || IS_SET(obj->wear_flags, ITEM_WEAR_PRIDE) || IS_SET(obj->wear_flags, ITEM_WEAR_FLOAT)) wear_obj( ch, obj, TRUE, WEAR_HOLD);
else if (IS_SET(obj->wear_flags, ITEM_WIELD) || IS_SET(obj->wear_flags, ITEM_WEAR_SHIELD)) wear_obj( ch, obj, TRUE, WEAR_WIELD);
else wear_obj( ch, obj, TRUE, 0 );
}
}
return;
}
void do_remove( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *tmp;
int number;
bool all_type = FALSE;
bool done = FALSE;
one_argument( argument, arg );
/* Zeran - check for all.foo */
number = number_argument (arg, arg2);
if (number == -1) all_type = TRUE;
if (IS_AFFECTED(ch, AFF_MIST)) {
send_to_char( "You can't do that in mist form?\r\n", ch );
return;
}
if ( arg[0] == '\0' ) {
send_to_char( "Remove what?\r\n", ch );
return;
}
/* check remove all.foo */
if (all_type) {
number = 0;
while (!done) {
if ( (obj = get_obj_wear( ch, arg2) ) == NULL ) {
if (!number)
send_to_char( "You do not have any of those items.\r\n", ch );
done = TRUE;
continue;
}
if ( obj->item_type == ITEM_TATTOO) {
send_to_char( "You can't remove a tattoo!\r\n", ch );
} else {
remove_obj (ch, obj->wear_loc, TRUE);
}
number++;
}
return;
}
/* check "remove all" */
if (!str_cmp(arg, "all"))
{
for (tmp = ch->carrying ; tmp != NULL ; tmp = tmp->next_content)
{
if (tmp->wear_loc != WEAR_NONE) {
if ( tmp->item_type == ITEM_TATTOO) {
send_to_char( "You can't remove a tattoo!\r\n", ch );
} else {
remove_obj(ch, tmp->wear_loc, TRUE);
}
}
}
return;
}
if ( ( obj = get_obj_wear( ch, arg ) ) == NULL )
{
send_to_char( "You do not have that item.\r\n", ch );
return;
}
if ( obj->item_type == ITEM_TATTOO) {
send_to_char( "You can't remove a tattoo!\r\n", ch );
} else {
remove_obj (ch, obj->wear_loc, TRUE);
}
return;
}
void do_sacrifice( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *obj_next;
one_argument( argument, arg );
if (IS_NPC(ch)) {
act( "$n wouldn't know whom to offer it to.", ch, NULL, NULL, TO_ROOM );
return;
}
if ( arg[0] == '\0' || !str_cmp( arg, ch->name ) ) {
act( "$n offers $mself to the Gods, who graciously decline.", ch, NULL, NULL, TO_ROOM );
sprintf_to_char(ch, "{R%s{x appreciates your offer and may accept it later.\r\n",ch->pcdata->cult);
return;
}
if (!str_cmp(arg, "all")) {
if ((ch->in_room->vnum == ch->in_room->area->morgue
|| ch->in_room->vnum == zones[ch->in_room->area->zone].morgue
|| ch->in_room->vnum == mud.morgue)
&& !IS_IMMORTAL(ch)) {
send_to_char( "Be a bit more selective.\r\n", ch );
return;
}
if (!ch->in_room->contents) {
send_to_char( "There is nothing.\r\n", ch );
return;
}
for (obj = ch->in_room->contents; obj; obj = obj_next) {
obj_next = obj->next_content;
do_real_sac(ch, obj);
}
return;
}
obj = get_obj_list(ch, arg, ch->in_room->contents );
if ( obj == NULL ) {
send_to_char( "You can't find it.\r\n", ch );
return;
}
do_real_sac(ch, obj);
return;
}
void do_real_sac(CHAR_DATA *ch, OBJ_DATA *obj) {
MOB_CMD_CONTEXT *mcc;
WEV *wev;
CHAR_DATA *gch;
int gold, goswp, rn, members;
char buffer[100];
char buf[MAX_STRING_LENGTH];
int currency = 0;
/* Check it can be sacrificed... */
if (IS_SET(obj->extra_flags, ITEM_NO_SAC)
|| IS_SET(obj->extra_flags, ITEM_SCENIC)
|| IS_SET(obj->extra_flags, ITEM_ARTIFACT)) {
send_to_char ("That object cannot be sacrificed.\r\n",ch);
return;
}
if ((ch->in_room->vnum == ch->in_room->area->morgue
|| ch->in_room->vnum == zones[ch->in_room->area->zone].morgue
|| ch->in_room->vnum == mud.morgue)
&& !IS_IMMORTAL(ch)
&& obj->item_type != ITEM_CORPSE_PC
&& obj->item_type != ITEM_CORPSE_NPC) {
send_to_char( "You can't that sacrifice here.\r\n", ch );
return;
}
if ( obj->item_type == ITEM_CORPSE_PC
&& obj->contains != NULL) {
send_to_char("You should loot it first.\r\n",ch);
return;
}
/* Set up context and get WEV... */
mcc = get_mcc(ch, ch, NULL, NULL, obj, NULL, 0, NULL);
/* What's it worth... */
switch (obj->item_type) {
case ITEM_CORPSE_PC:
gold = UMAX(5*obj->level, 1);
mcc->number = gold;
wev = get_wev(WEV_SAC, WEV_SAC_PC_CORPSE, mcc,
"You sacrifice the @p2.\r\n"
"{WThe corpse is consumed by a bright white light!{x\r\n",
"@a2 sacrifices the @p2.\r\n"
"{WThe corpse is consumed by a bright white light!{x\r\n",
"@a2 sacrifices the @p2.\r\n"
"{WThe corpse is consumed by a bright white light!{x\r\n");
break;
case ITEM_CORPSE_NPC:
gold = UMAX(obj->level/5, 1);
mcc->number = gold;
wev = get_wev(WEV_SAC, WEV_SAC_CORPSE, mcc,
"You sacrifice the @p2.\r\n"
"{RThe corpse is consumed by burning flames!{x\r\n",
"@a2 sacrifices the @p2.\r\n"
"{RThe corpse is consumed by burning flames!{x\r\n",
"@a2 sacrifices the @p2.\r\n"
"{RThe corpse is consumed by burning flames!{x\r\n");
break;
case ITEM_TRASH:
gold = 1;
mcc->number = gold;
wev = get_wev(WEV_SAC, WEV_SAC_TRASH, mcc,
"You sacrifice @p2.\r\n"
"{GIt rots and decays before your eyes!{x\r\n",
"@a2 sacrifices @p2.\r\n"
"{GIt rots and decays before your eyes!{x\r\n",
"@a2 sacrifices @p2.\r\n"
"{GIt rots and decays before your eyes!{x\r\n");
break;
case ITEM_TREASURE:
gold = UMAX(10, obj->cost/5);
mcc->number = gold;
wev = get_wev(WEV_SAC, WEV_SAC_TREASURE, mcc,
"You sacrifice @p2.\r\n"
"{YIt shimmers with a golden radiance and vanishes!{x\r\n",
"@a2 sacrifices @p2.\r\n"
"{YIt shimmers with a golden radiance and vanishes!{x\r\n",
"@a2 sacrifices @p2.\r\n"
"{YIt shimmers with a golden radiance and vanishes!{x\r\n");
break;
default:
gold = UMAX(obj->level/10, 1);
mcc->number = gold;
wev = get_wev(WEV_SAC, WEV_SAC_ITEM, mcc,
"You sacrifice @p2.\r\n"
"{CIt vanishes in a flash of blue light!{x\r\n",
"@a2 sacrifices @p2.\r\n"
"{CIt vanishes in a flash of blue light!{x\r\n",
"@a2 sacrifices @p2.\r\n"
"{CIt vanishes in a flash of blue light!{x\r\n");
break;
}
/* Challange... */
if (!room_issue_wev_challange(ch->in_room, wev)) {
free_wev(wev);
return;
}
/* Send to command issuers room... */
room_issue_wev( ch->in_room, wev);
/* Free the wev... */
free_wev(wev);
/* Lose the object... */
extract_obj( obj );
/* Now work out the consequences... */
if (gold == 0) return;
if (!IS_NPC(ch)
&& gold > 15) {
sac_align(ch, gold/15);
}
if (gold == 1) {
sprintf(buf,"{R%s{x gives you {yone %s{x for your sacrifice.\r\n",ch->pcdata->cult, flag_string(currency_type, currency));
send_to_char(buf, ch);
ch->gold[currency] += 1;
return;
}
sprintf(buf,"{R%s{x gives you {y%d %s{x for your sacrifice.\r\n",ch->pcdata->cult, gold, flag_string(currency_type, currency));
send_to_char(buf, ch);
/* Saving Godmana */
rn = get_cult_rn(ch->pcdata->cult);
if (rn > 0) {
goswp=gold;
if (goswp>10) goswp=(goswp-10)/2+10;
if (goswp>30) goswp=(goswp-30)/3+30;
if (goswp>60) goswp=(goswp-60)/10+60;
cult_array[rn].power += goswp;
cult_array[rn].power = UMIN(cult_array[rn].power,50000);
}
/* Reward the character... */
gold = soc_tax(ch, gold, currency);
ch->gold[currency] += gold;
/* Do we get to share the gold? */
if (IS_SET(ch->plr, PLR_AUTOSPLIT)) {
members = 0;
gch = ch->in_room->people;
while (gch != NULL) {
if (is_same_group(gch, ch)) members++;
gch = gch->next_in_room;
}
if ( members > 1 ) {
sprintf(buffer,"%d %s",gold, flag_string(currency_accept, currency));
do_split(ch,buffer);
}
}
return;
}
void do_quaff( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
MOB_CMD_CONTEXT *mcc;
one_argument( argument, arg );
if ( arg[0] == '\0' ) {
send_to_char( "Quaff what?\r\n", ch );
return;
}
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL ) {
send_to_char( "You do not have that potion.\r\n", ch );
return;
}
if ( obj->item_type != ITEM_POTION ) {
send_to_char( "You can quaff only potions.\r\n", ch );
return;
}
if (ch->level < obj->level - 15) {
send_to_char("This liquid is too powerful for you to drink.\r\n",ch);
return;
}
mcc = get_mcc(ch, ch, NULL, NULL, obj, NULL, 0, NULL);
if (obj->pIndexData
&& obj->pIndexData->wear_cond) {
if (!ec_satisfied_mcc(mcc, obj->pIndexData->wear_cond, TRUE)) {
free_mcc(mcc);
sprintf_to_char(ch, "You are unable to use %s.\r\n", obj->short_descr );
act( "$n tries to use $p, but fails.", ch, obj, NULL, TO_ROOM );
return;
}
}
free_mcc(mcc);
if (ch->quaffLast == current_time) {
act( "$n spills $p!", ch, obj, NULL, TO_ROOM);
act( "Oops! In your haste, you spill $p!", ch, obj, NULL, TO_CHAR);
} else {
act( "$n quaffs $p.", ch, obj, NULL, TO_ROOM );
act( "You quaff $p.", ch, obj, NULL ,TO_CHAR );
if (obj->value[1] != EFFECT_UNDEFINED) {
obj_cast_spell( obj->value[1], obj->value[0], ch, ch, obj, NULL );
}
if (obj->value[2] != EFFECT_UNDEFINED) {
obj_cast_spell( obj->value[2], obj->value[0], ch, ch, obj, NULL );
}
if (obj->value[3] != EFFECT_UNDEFINED) {
obj_cast_spell( obj->value[3], obj->value[0], ch, ch, obj, NULL );
}
}
/* Remember when we did this... */
ch->quaffLast = current_time;
/* Zeran - add waitstate to stop speed quaffing. */
/* WAIT_STATE (ch, PULSE_VIOLENCE/2); *//* 2 potions per fight round */
extract_obj( obj );
return;
}
void do_recite( CHAR_DATA *ch, char *argument ){
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *scroll;
OBJ_DATA *obj;
MOB_CMD_CONTEXT *mcc;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( ( scroll = get_obj_carry( ch, arg1 ) ) == NULL ) {
send_to_char( "You do not have that scroll.\r\n", ch );
return;
}
if ( scroll->item_type != ITEM_SCROLL ) {
send_to_char( "You can recite only scrolls.\r\n", ch );
return;
}
if ( ch->level < scroll->level) {
send_to_char("This scroll is too complex for you to comprehend.\r\n",ch);
return;
}
mcc = get_mcc(ch, ch, NULL, NULL, scroll, NULL, 0, NULL);
if (scroll->pIndexData
&& scroll->pIndexData->wear_cond) {
if (!ec_satisfied_mcc(mcc, scroll->pIndexData->wear_cond, TRUE)) {
free_mcc(mcc);
sprintf_to_char(ch, "You are unable to use %s.\r\n", scroll->short_descr );
act( "$n tries to use $p, but fails.", ch, scroll, NULL, TO_ROOM );
return;
}
}
free_mcc(mcc);
obj = NULL;
if ( arg2[0] == '\0' ) {
victim = ch;
} else {
if ( ( victim = get_char_room ( ch, arg2 ) ) == NULL
&& ( obj = get_obj_here ( ch, arg2 ) ) == NULL ) {
send_to_char( "You can't find it.\r\n", ch );
return;
}
}
act( "$n recites $p.", ch, scroll, NULL, TO_ROOM );
act( "You recite $p.", ch, scroll, NULL, TO_CHAR );
WAIT_STATE(ch, PULSE_VIOLENCE/2);
if (!check_skill(ch, gsn_scrolls, -20)
|| ch->condition[COND_DRUNK] > 8) {
send_to_char("You mispronounce a syllable.\r\n",ch);
check_improve(ch,gsn_scrolls,FALSE,2);
} else {
obj_cast_spell( scroll->value[1], scroll->value[0], ch, victim, obj, NULL );
obj_cast_spell( scroll->value[2], scroll->value[0], ch, victim, obj, NULL );
obj_cast_spell( scroll->value[3], scroll->value[0], ch, victim, obj, NULL );
check_improve(ch,gsn_scrolls,TRUE,2);
}
extract_obj( scroll );
return;
}
void do_brandish( CHAR_DATA *ch, char *argument ) {
CHAR_DATA *vch;
CHAR_DATA *vch_next;
OBJ_DATA *staff;
MOB_CMD_CONTEXT *mcc;
int spn;
if ( ( staff = get_eq_char( ch, WEAR_HOLD ) ) == NULL ) {
send_to_char( "You hold nothing in your hand.\r\n", ch );
return;
}
if ( staff->item_type != ITEM_STAFF ) {
send_to_char( "You can brandish only with a staff.\r\n", ch );
return;
}
mcc = get_mcc(ch, ch, NULL, NULL, staff, NULL, 0, NULL);
if (staff->pIndexData
&& staff->pIndexData->wear_cond) {
if (!ec_satisfied_mcc(mcc, staff->pIndexData->wear_cond, TRUE)) {
free_mcc(mcc);
sprintf_to_char(ch, "You are unable to use %s.\r\n", staff->short_descr );
act( "$n tries to use $p, but fails.", ch, staff, NULL, TO_ROOM );
return;
}
}
free_mcc(mcc);
spn = staff->value[3];
if (!valid_spell(spn)) {
bug( "Do_brandish: bad spn %d.", spn );
return;
}
WAIT_STATE( ch, 2 * PULSE_VIOLENCE );
if ( staff->value[2] > 0 )
{
act( "$n brandishes $p.", ch, staff, NULL, TO_ROOM );
act( "You brandish $p.", ch, staff, NULL, TO_CHAR );
if ( ch->level < staff->level
|| !check_skill(ch, gsn_staves, -20))
{
act ("You fail to invoke $p.",ch,staff,NULL,TO_CHAR);
act ("...and nothing happens.",ch,NULL,NULL,TO_ROOM);
check_improve(ch,gsn_staves,FALSE,2);
}
else for ( vch = ch->in_room->people; vch; vch = vch_next )
{
vch_next = vch->next_in_room;
switch ( spell_array[spn].target )
{
default:
bug( "Do_brandish: bad target for spn %d.", spn );
return;
case TAR_IGNORE:
if ( vch != ch )
continue;
break;
case TAR_CHAR_OFFENSIVE:
if ( IS_NPC(ch) ? IS_NPC(vch) : !IS_NPC(vch) )
continue;
break;
case TAR_CHAR_DEFENSIVE:
if ( IS_NPC(ch) ? !IS_NPC(vch) : IS_NPC(vch) )
continue;
break;
case TAR_CHAR_SELF:
if ( vch != ch )
continue;
break;
}
if (vch==NULL) vch=ch;
obj_cast_spell( spn, staff->value[0], ch, vch, NULL, NULL );
check_improve(ch,gsn_staves,TRUE,2);
}
}
if ( --staff->value[2] <= 0 )
{
act( "$n's $p blazes bright and is gone.", ch, staff, NULL, TO_ROOM );
act( "Your $p blazes bright and is gone.", ch, staff, NULL, TO_CHAR );
extract_obj( staff );
}
return;
}
void do_zap( CHAR_DATA *ch, char *argument ) {
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *wand;
OBJ_DATA *obj;
MOB_CMD_CONTEXT *mcc;
one_argument( argument, arg );
if ( arg[0] == '\0' && ch->fighting == NULL ) {
send_to_char( "Zap whom or what?\r\n", ch );
return;
}
if ( ( wand = get_eq_char( ch, WEAR_HOLD ) ) == NULL ) {
send_to_char( "You hold nothing in your hand.\r\n", ch );
return;
}
if ( wand->item_type != ITEM_WAND ) {
send_to_char( "You can zap only with a wand.\r\n", ch );
return;
}
mcc = get_mcc(ch, ch, NULL, NULL, wand, NULL, 0, NULL);
if (wand->pIndexData
&& wand->pIndexData->wear_cond) {
if (!ec_satisfied_mcc(mcc, wand->pIndexData->wear_cond, TRUE)) {
free_mcc(mcc);
sprintf_to_char(ch, "You are unable to use %s.\r\n", wand->short_descr );
act( "$n tries to use $p, but fails.", ch, wand, NULL, TO_ROOM );
return;
}
}
free_mcc(mcc);
obj = NULL;
if ( arg[0] == '\0' ) {
if ( ch->fighting != NULL ) {
victim = ch->fighting;
} else {
send_to_char( "Zap whom or what?\r\n", ch );
return;
}
} else {
if ( ( victim = get_char_room ( ch, arg ) ) == NULL
&& ( obj = get_obj_here ( ch, arg ) ) == NULL ) {
send_to_char( "You can't find it.\r\n", ch );
return;
}
}
WAIT_STATE( ch, 2 * PULSE_VIOLENCE );
if ( wand->value[2] > 0 ) {
if ( victim != NULL ) {
act( "$n zaps $N with $p.", ch, wand, victim, TO_ROOM );
act( "You zap $N with $p.", ch, wand, victim, TO_CHAR );
} else {
act( "$n zaps $P with $p.", ch, wand, obj, TO_ROOM );
act( "You zap $P with $p.", ch, wand, obj, TO_CHAR );
}
if (ch->level < wand->level
|| !check_skill(ch, gsn_wands, -20) ) {
act( "Your efforts with $p produce only smoke and sparks.",
ch,wand,NULL,TO_CHAR);
act( "$n's efforts with $p produce only smoke and sparks.",
ch,wand,NULShowing the first 100 KB of 234.7 KB. Download the archive for the full file.