sacall-keri.txt
snippets · 2.7 KB · 2010-03-30
Sacrifice all by Keridan of Benevolent Iniquity (no license).
Download « Back to the snippets list
/********************************************************
* Sacrifice all code by Keridan of Benevolent Iniquity *
* This code is released under no license and is freely *
* distributable. I require no credit, but would *
* appreciate a quick note to keridan@exile.mudsrus.com *
* if you choose to use it in your mud. *
* http://stargazer.inetsolve.com/~keridan *
* stargazer.inetsolve.com 1414 *
********************************************************/
Act_obj.c, search for:
if ( arg[0] == '\0' || !str_cmp( arg, ch->name ) )
{
act( "$n offers $mself to $G, who graciously declines.",ch, NULL, NULL, TO_ROOM );
act("$G appreciates your offer and may accept it later.", ch, NULL, NULL, TO_CHAR );
return;
}
And just below it put:
if (!str_cmp("all",arg) || !str_prefix("all.",arg))
{ OBJECT_DATA *obj_next;
int allsilver = 0;
for (obj = ch->in_room->contents;obj;obj = obj_next)
{ obj_next = obj->next_content;
if (arg[3] != '\0' && !is_name(&arg[4],obj->name))
continue;
if ( (!CAN_WEAR(obj,ITEM_TAKE) || CAN_WEAR(obj,ITEM_NOSAC))
|| (obj->item_type == ITEM_CORPSE_PC && obj->contains))
continue;
found = TRUE;
silver = UMAX(1,obj->level * 3);
if (obj->item_type != ITEM_CORPSE_NPC && obj->item_type != ITEM_CORPSE_PC)
silver = UMIN(silver,obj->cost);
allsilver += silver;
extract_obj( obj );
}
if (found)
{ sprintf(buf,"$G gives you {2%d{0 silver for your sacrifice.",allsilver);
act(buf,ch,NULL,NULL,TO_CHAR);
act("$n sacrifices everything to $G",ch,NULL,NULL,TO_ROOM);
add_cost(ch,allsilver,VALUE_SILVER);
if (IS_SET(ch->act,PLR_AUTOSPLIT))
{ members = 0;
for (gch = ch->in_room->people;gch;gch = gch->next_in_room)
if (is_same_group(ch,gch))
members++;
if (members > 1 && allsilver > 1)
{ sprintf(buf,"%d",allsilver);
do_split(ch,buf); }
}
wiznet("$N sends up everything in that room as a burnt offering.",ch,obj,WIZ_SACCING,0,0);
}
else
send_to_char("There is nothing sacrificable in this room.\n\r",ch);
return;
}
This is by no means perfect code, nor has it been tested in every occurance, but it should work fine.
I am pretty sure you need RoT for this one, but it should work with a little tweaking on ROM 2.4+, Maybe
even MERC :)
As always, keep the message at the top of the file if send it to anyone or post it anywhere.
PS: Thanks Alecca of Devil's Silence for her help with this one :)