act_obj.c
muddy/src/act_obj.c · 218.9 KB
From the archive astrum.tar.bz2
Download the archive « Back to the archive contents
/* $Id: act_obj.c,v 1.666 2004/09/20 10:49:46 shrike Exp $ */
/************************************************************************************
* Copyright 2004 Astrum Metaphora consortium *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
************************************************************************************/
/************************************************************************************
* ANATOLIA 2.1 is copyright 1996-1997 Serdar BULUT, Ibrahim CANPUNAR *
* ANATOLIA has been brought to you by ANATOLIA consortium *
* Serdar BULUT {Chronos} bulut@rorqual.cc.metu.edu.tr *
* Ibrahim Canpunar {Asena} canpunar@rorqual.cc.metu.edu.tr *
* Murat BICER {KIO} mbicer@rorqual.cc.metu.edu.tr *
* D.Baris ACAR {Powerman} dbacar@rorqual.cc.metu.edu.tr *
* By using this code, you have agreed to follow the terms of the *
* ANATOLIA license, in the file Anatolia/anatolia.licence *
***********************************************************************************/
/************************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
************************************************************************************/
/************************************************************************************
* ROM 2.4 is copyright 1993-1995 Russ Taylor *
* ROM has been brought to you by the ROM consortium *
* Russ Taylor (rtaylor@pacinfo.com) *
* Gabrielle Taylor (gtaylor@pacinfo.com) *
* Brian Moore (rom@rom.efn.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
*************************************************************************************/
/************************************************************************************
* Copyright (c) 1998 fjoe <fjoe@iclub.nsu.ru> *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND *
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE *
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY *
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
* SUCH DAMAGE. *
************************************************************************************/
#include <sys/types.h>
#if !defined (WIN32)
#include <sys/time.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "merc.h"
#include "quest.h"
#include "update.h"
#include "mob_prog.h"
#include "obj_prog.h"
#include "fight.h"
#include "conquer.h"
#include "war.h"
#include "gambling.h"
#include "shamans.h"
extern STAT_DATA stat_record;
void interpret_social(social_t *soc, CHAR_DATA *ch, const char *argument);
DECLARE_DO_FUN(do_split );
DECLARE_DO_FUN(do_say );
DECLARE_DO_FUN(do_scan );
DECLARE_DO_FUN(do_mount );
DECLARE_DO_FUN(do_yell );
DECLARE_DO_FUN(do_dismount );
DECLARE_DO_FUN(do_lore_area );
void agent_net_printf(CHAR_DATA *ch, CHAR_DATA *victim, int);
/*
* Local functions.
*/
CHAR_DATA * find_keeper (CHAR_DATA * ch);
uint get_cost (CHAR_DATA * keeper, OBJ_DATA * obj, bool fBuy);
void obj_to_keeper (OBJ_DATA * obj, CHAR_DATA * ch);
OBJ_DATA * get_obj_keeper (CHAR_DATA * ch, CHAR_DATA * keeper,
const char *argument);
void sac_obj (CHAR_DATA * ch, OBJ_DATA *obj);
void sac_obj_all (CHAR_DATA * ch, OBJ_DATA *obj);
AFFECT_DATA * affect_find (AFFECT_DATA * paf, int sn);
CHAR_DATA * find_forger args ((CHAR_DATA * ch));
CHAR_DATA * find_forger (CHAR_DATA *ch)
{
CHAR_DATA * forger;
for (forger = ch->in_room->people; forger != NULL; forger = forger->next_in_room)
{
if (!IS_NPC(forger))
continue;
if (IS_NPC(forger) && IS_SET(forger->pIndexData->act, ACT_FORGER))
return forger;
}
if (forger == NULL)
{
char_act("You can't do that here.", ch);
return NULL;
}
return NULL;
}
void do_forger( CHAR_DATA *ch, const char *argument )
{
OBJ_DATA * obj;
CHAR_DATA * forger;
char weapon[MAX_INPUT_LENGTH];
char * words;
int cost = 0;
if (IS_NPC(ch))
return;
forger = find_forger(ch);
if (!forger)
return;
if (argument[0] == '\0')
{
act(" {C$N{x offers following improvements : ", ch, NULL, forger, TO_CHAR);
char_act("{c--------------------------------------------------{x", ch);
char_act("{w bless {g:{w bless object {g|{w {W 5 {CQP{x", ch);
char_act("{w poison {g:{w poison weapon {g|{w {W 5 {CQP{x", ch);
char_act("{w sharp {g:{w sharp weapon {g|{w {W 20 {CQP{x", ch);
char_act("{w flame {g:{w flaming weapon {g|{w {W1800 {CQP{x", ch);
char_act("{w drain {g:{w vampiric weapon {g|{w {W1800 {CQP{x", ch);
char_act("{w shocking {g:{w electric weapon {g|{w {W1800 {CQP{x", ch);
char_act("{w frost {g:{w frost weapon {g|{w {W1800 {CQP{x", ch);
char_act("{w vorpal {g:{w vorpal weapon {g|{w {W 800 {CQP{x", ch);
char_act("{w nodrop {g:{w make nodrop object {g|{w {W 800 {CQP{x", ch);
char_act("{w noremove {g:{w make noremove weapon {g|{w {W 800 {CQP{x", ch);
// char_act("{w enchant {g:{w enchant weapon {g|{w {W 800 {CQP{x", ch);
char_act("{w fireproof {g:{w make fireproof object {g|{w {W1000 {CQP{x", ch);
char_act("{w noalign {g:{w remove object aligment {g|{w {W1500 {CQP{x", ch);
char_act("{w noloot {g:{w make noloot object {g|{w {W9999 {CQP{x", ch);
char_act("{w hidurability{g:{w make hidurability object {g|{w {W1500 {CQP{x", ch);
char_act("{w indestructab{g:{w make indestructable objec{g|{w {W5000 {CQP{x", ch);
// char_act("{w radiation {g:{w radiation weapon {g|{w {W5000 {CQP{x", ch);
char_act("{c--------------------------------------------------{x", ch);
char_act(" Type {Cforger <object> <type>{x for forger ", ch);
char_act(" and pray GrayMage for success. ", ch);
return;
}
argument = one_argument( argument, weapon, sizeof(weapon));
if ((obj = get_obj_carry(ch, weapon)) == NULL)
{
act("$N says : '{GYou're not carrying that.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"fireproof"))
cost = 2;
if (!str_prefix(argument,"hidurability"))
cost = 2;
if (!str_prefix(argument,"indestructable"))
cost = 2;
if (!str_prefix(argument,"bless"))
cost = 2;
if (!str_prefix(argument,"nodrop"))
cost = 2;
if (!str_prefix(argument,"noalign"))
cost = 2;
if (!str_prefix(argument,"noloot"))
cost = 2;
if (obj->pIndexData->item_type != ITEM_WEAPON && cost != 2)
{
act("$N says : '{GThis is not a weapon! See menu difference: {wobject{G and {wweapon{G!{x'", ch, NULL, forger, TO_CHAR);
return;
}
if ( argument[0] == '\0' )
{
act("$N says : '{GPardon? type 'forger' to see the list of modifications.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (check_material(obj, "unique"))
{
act("$N says : '{GPardon. I can't forger this.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if ((obj->timer > 0)
|| (obj->pIndexData->limit != -1))
// || IS_WEAPON_STAT(obj, WEAPON_KATANA))
{
act("$N says : '{GPardon. You can't forger this.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"bless"))
{
if (IS_OBJ_STAT(obj,ITEM_BLESS))
{
act("$N says : '{G$p {Gis already blessed.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "belessa";
cost = 5;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_bless( 0, forger->level, forger, obj, TARGET_OBJ );
if (IS_OBJ_STAT(obj,ITEM_BLESS))
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"poison"))
{
if (IS_WEAPON_STAT(obj, WEAPON_POISON))
{
act("$N says : '{G$p {Gis already poisoned.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "poisana";
cost = 5;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_poison( 0, forger->level, forger, obj, TARGET_OBJ );
if (IS_WEAPON_STAT(obj, WEAPON_POISON))
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"sharp"))
{
if (IS_WEAPON_STAT( obj, WEAPON_SHARP) )
{
act("$N says : '{G$p {Gis already sharp.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "gpabras braoculo";
cost = 20;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_sharp_blade( 0, forger->level, forger, obj, TARGET_OBJ );
if ( IS_WEAPON_STAT ( obj, WEAPON_SHARP) )
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"flame"))
{
if (IS_WEAPON_STAT( obj, WEAPON_FLAMING) )
{
act("$N says : '{G$p {Gis already flaming.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "yrawz braoculo";
cost = 1800;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_flame_blade( 0, forger->level, forger, obj, TARGET_OBJ );
if ( IS_WEAPON_STAT ( obj, WEAPON_FLAMING) )
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"drain"))
{
if (IS_WEAPON_STAT( obj, WEAPON_VAMPIRIC) )
{
act("$N says : '{G$p {Gis already vampiric.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "egruui braoculo";
cost = 1800;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_drain_blade( 0, forger->level, forger, obj, TARGET_OBJ );
if ( IS_WEAPON_STAT ( obj, WEAPON_VAMPIRIC) )
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"shocking"))
{
if (IS_WEAPON_STAT( obj, WEAPON_SHOCKING) )
{
act("$N says : '{G$p {Gis already electrical.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "gpaqtuio braoculo";
cost = 1800;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_shocking_blade( 0, forger->level, forger, obj, TARGET_OBJ );
if ( IS_WEAPON_STAT ( obj, WEAPON_SHOCKING) )
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"frost"))
{
if (IS_WEAPON_STAT( obj, WEAPON_FROST) )
{
act("$N says : '{G$p {Gis already frost.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "yfagh braoculo";
cost = 1800;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_frost_blade( 0, forger->level, forger, obj, TARGET_OBJ );
if ( IS_WEAPON_STAT ( obj, WEAPON_FROST) )
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"vorpal"))
{
if (IS_WEAPON_STAT( obj, WEAPON_VORPAL) )
{
act("$N says : '{G$p {Gis already vorpal.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "zafsar braoculo";
cost = 800;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_vorpal_blade( 0, forger->level, forger, obj, TARGET_OBJ );
if ( IS_WEAPON_STAT ( obj, WEAPON_VORPAL) )
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"nodrop"))
{
if (IS_OBJ_STAT(obj,ITEM_NODROP))
{
act("$N says : '{G$p {Gis already nodrop.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "nodropa itema";
cost = 800;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
SET_BIT(obj->extra_flags,ITEM_NODROP);
if (IS_OBJ_STAT(obj,ITEM_NODROP))
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"noremove"))
{
if (IS_OBJ_STAT(obj,ITEM_NOREMOVE))
{
act("$N says : '{G$p {Gis already noremove.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "noremova itema";
cost = 800;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
SET_BIT(obj->extra_flags,ITEM_NOREMOVE);
if (IS_OBJ_STAT(obj,ITEM_NOREMOVE))
{
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
}
else
act("$N says : '{GI'm sorry I can't help you.{x'", ch, NULL, forger, TO_CHAR);
return;
}
if (!str_prefix(argument,"enchant"))
{
words = "enchanta superia";
cost = 800;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
spell_enchant_weapon( 0, forger->level, forger, obj, TARGET_OBJ );
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
return;
}
if (!str_prefix(argument,"noalign"))
{
if (!IS_OBJ_STAT(obj, ITEM_ANTI_EVIL))
if (!IS_OBJ_STAT(obj, ITEM_ANTI_GOOD))
if (!IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL))
{
act("$N says : '{G$p {Gis already have no align.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "aligna peredelka";
cost = 1500;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
if (IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL))
REMOVE_BIT(obj->extra_flags,ITEM_ANTI_NEUTRAL);
if (IS_OBJ_STAT(obj, ITEM_ANTI_GOOD))
REMOVE_BIT(obj->extra_flags,ITEM_ANTI_GOOD);
if (IS_OBJ_STAT(obj, ITEM_ANTI_EVIL))
REMOVE_BIT(obj->extra_flags,ITEM_ANTI_EVIL);
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
return;
}
if (!str_prefix(argument,"noloot"))
{
//if (IS_OBJ_STAT(obj, ITEM_CONTAINER))
if (obj->pIndexData->item_type == ITEM_CONTAINER)
{
act("$N says : '{G$p {Gis container! Gods forbidden to do it noloot.{x'", ch, obj, forger, TO_CHAR);
return;
}
if (IS_OBJ_STAT(obj, ITEM_NOLOOT))
{
act("$N says : '{G$p {Gis already noloot.{x'", ch, obj, forger, TO_CHAR);
return;
}
words = "noluta poluta";
cost = 9999;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'", ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.", forger, NULL, words, TO_ROOM);
SET_BIT(obj->extra_flags,ITEM_NOLOOT);
act("$N gives $p to $n.", ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'", ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
return;
}
if (!str_prefix(argument,"fireproof"))
{
if (IS_OBJ_STAT(obj, ITEM_BURN_PROOF))
{
act("$N says : '{G$p {Gis already fireproof.{x'",
ch, obj, forger, TO_CHAR);
return;
}
words = "fire proofa";
cost = 1000;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'",
ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.",
forger, NULL, words, TO_ROOM);
SET_BIT(obj->extra_flags, ITEM_BURN_PROOF);
act("$N gives $p to $n.",
ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'",
ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
return;
}
if (!str_prefix(argument,"hidurability"))
{
if (IS_OBJ_STAT(obj, ITEM_HIDURABILITY))
{
act("$N says : '{G$p {Gis already high durability.{x'",
ch, obj, forger, TO_CHAR);
return;
}
words = "itema impruva";
cost = 1500;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'",
ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.",
forger, NULL, words, TO_ROOM);
SET_BIT(obj->extra_flags, ITEM_HIDURABILITY);
act("$N gives $p to $n.",
ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'",
ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
return;
}
if (!str_prefix(argument,"indestructable"))
{
if (IS_OBJ_STAT(obj, ITEM_INDESTRUCTABLE))
{
act("$N says : '{G$p {Gis already anaffected by weapon damage.{x'",
ch, obj, forger, TO_CHAR);
return;
}
words = "itema indestructable";
cost = 5000;
if ( cost > ch->pcdata->questpoints )
{
act("$N says : '{GYou do not have enough QP for my services'",
ch, NULL, forger, TO_CHAR);
return;
}
act("$n utters the words '$T'.",
forger, NULL, words, TO_ROOM);
SET_BIT(obj->extra_flags, ITEM_INDESTRUCTABLE);
act("$N gives $p to $n.",
ch, obj, forger, TO_ROOM);
act("$N says : '{GTake care with $p{G, now is a lot powerful.{x'",
ch, obj, forger, TO_CHAR);
ch->pcdata->questpoints -= cost;
return;
}
act("$N says : '{GPardon? Type 'forger' to see the list of modifications.{x'",
ch, NULL, forger, TO_CHAR);
return;
}
bool is_same_obj(OBJ_DATA *obj, OBJ_DATA *obj1)
{
if (obj1 == NULL
|| obj == NULL
|| mlstr_cmp(obj1->short_descr, obj->short_descr)
|| obj1->pIndexData->vnum != obj->pIndexData->vnum)
return FALSE;
return TRUE;
}
/* RT part of the corpse looting code */
bool can_loot(CHAR_DATA * ch, OBJ_DATA * obj)
{
if (IS_IMMORTAL(ch))
return TRUE;
if (obj->pIndexData->item_type != ITEM_CORPSE_PC)
return TRUE;
/*
* PC corpses in the ROOM_BATTLE_ARENA rooms can be looted
* only by owners
*/
if (obj->in_room != NULL
&& IS_SET(obj->in_room->room_flags, ROOM_BATTLE_ARENA)
&& obj->owner != NULL && str_cmp(ch->name, obj->owner))
return FALSE;
/*
* Peacefuls can loot only own corpses.
*/
if (IS_SET(ch->comm, PLR_PEACE) && obj->owner != NULL
&& str_cmp(ch->name,obj->owner))
return FALSE;
/*
* Nobody can loot corpse of peaceful, except himself.
*/
if (obj->value[2] && obj->owner
&& str_cmp(ch->name,obj->owner)
&& !ch->in_room->area->clan)
return FALSE;
return TRUE;
}
int can_get_obj(CHAR_DATA * ch, OBJ_DATA * obj, bool message)
{
CHAR_DATA *rch;
if (!CAN_WEAR(obj, ITEM_TAKE)
|| ((obj->pIndexData->item_type == ITEM_CORPSE_PC
|| obj->pIndexData->item_type == ITEM_CORPSE_NPC)
&& (!IS_NPC(ch) || IS_AFFECTED(ch, AFF_CHARM))
&& !IS_IMMORTAL(ch)
&& str_cmp(ch->name, obj->owner)))
{
if (message)
char_act("You can't take that.", ch);
return 1; // return FALSE; just can't take
}
/* can't even get limited eq which does not match alignment */
if (obj->pIndexData->limit != -1 && !IS_IMMORTAL(ch))
{
if ((IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch))
|| (IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch))
|| (IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch)))
{
if (message)
{
act_puts("You are zapped by $p and drop it.",
ch, obj, NULL, TO_CHAR, POS_DEAD);
act_puts("$n is zapped by $p and drops it.",
ch, obj, NULL, TO_ROOM, POS_RESTING);
}
return 2; // return FALSE; align check failed
}
}
if (ch->carry_number + get_obj_number(obj) > can_carry_n(ch))
{
if (message)
act_puts("$d: you can't carry that many items.",
ch, NULL, obj->name, TO_CHAR, POS_DEAD);
return 3; // return FALSE; U can't carry so much! that's it
}
if (get_carry_weight(ch) + get_obj_weight(obj) > can_carry_w(ch))
{
if (message)
act_puts("$d: you can't carry that much weight.",
ch, NULL, obj->name, TO_CHAR, POS_DEAD);
return 4; // return FALSE; u can't carry so much weight
}
if (obj->in_room != NULL)
{
for (rch = obj->in_room->people; rch != NULL;
rch = rch->next_in_room)
if (rch->on == obj)
{
if (message)
act_puts("$N uses $p.", ch, obj, rch, TO_CHAR, POS_DEAD);
return 5; // return FALSE; obj is in use
}
}
if (obj->pIndexData->item_type == ITEM_MONEY)
{
if (get_carry_weight(ch) + obj->value[0] / 10
+ obj->value[1] * 2 / 5 > can_carry_w(ch))
{
if (message)
act_puts("$d: you can't carry that much weight.",
ch, NULL, obj->name, TO_CHAR, POS_DEAD);
return 4; // return FALSE; u can't carry so much weight
}
return 0; // return TRUE;
}
return 0; // return TRUE;
}
void get_obj(CHAR_DATA * ch, OBJ_DATA * obj, OBJ_DATA * container, bool message)
{
/* variables for AUTOSPLIT */
CHAR_DATA *gch;
int members;
if (container != NULL)
{
if (IS_SET(container->pIndexData->extra_flags, ITEM_PIT)
&& !CAN_WEAR(container, ITEM_TAKE)
&& !IS_OBJ_STAT(obj, ITEM_HAD_TIMER))
obj->timer = 0;
if (message)
{
act_puts("You get $p from $P.", ch, obj, container, TO_CHAR, POS_DEAD);
act("$n gets $p from $P.",
ch, obj, container, TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
}
REMOVE_BIT(obj->extra_flags, ITEM_HAD_TIMER);
obj_from_obj(obj);
}
else
{
if (message)
{
act_puts("You get $p.", ch, obj, container, TO_CHAR, POS_DEAD);
act("$n gets $p.", ch, obj, container,
TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
}
obj_from_room(obj);
}
if (obj->pIndexData->item_type == ITEM_MONEY)
{
ch->silver += obj->value[0];
ch->gold += obj->value[1];
if (IS_SET(ch->plr_flags, PLR_AUTOSPLIT))
{
members = 0;
for (gch = ch->in_room->people; gch != NULL;
gch = gch->next_in_room)
{
if (!IS_AFFECTED(gch, AFF_CHARM)
&& is_same_group(gch, ch))
members++;
}
if (members > 1 && (obj->value[0] > 1
|| obj->value[1]))
doprintf(do_split, ch, "%d %d", obj->value[0], obj->value[1]);
}
}
else
{
obj_to_char(obj, ch);
if (HAS_TRIGGER_OBJ(obj, TRIG_GET))
p_give_trigger( NULL, obj, NULL, ch, obj, TRIG_GET);
if (HAS_TRIGGER_ROOM(ch->in_room, TRIG_GET))
p_give_trigger(NULL, NULL, ch->in_room, ch, obj, TRIG_GET);
oprog_call(OPROG_GET, obj, ch, NULL);
}
}
int draw(CHAR_DATA * ch, const char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
OBJ_DATA *obj = NULL;
// OBJ_DATA *obj;
OBJ_DATA *container;
bool found = FALSE;
int loc;
argument = one_argument(argument, arg1, sizeof(arg1));
if (!str_cmp(arg1, "with"))
argument = one_argument(argument, arg1, sizeof(arg1));
argument = one_argument(argument, arg2, sizeof(arg2));
if (!str_cmp(arg2, "from"))
argument = one_argument(argument, arg2, sizeof(arg2));
for (container = ch->carrying; container; container = container->next_content)
{
if (container->wear_loc == WEAR_NONE
|| container->pIndexData->item_type != ITEM_SCABBARD
|| !container->contains)
continue;
if (arg2[0] != '\0' && !is_name(arg2, container->name))
continue;
for (obj = container->contains; obj != NULL; obj = obj->next_content)
{
if (arg1[0] == '\0' || is_name(arg1, obj->name))
{
found = TRUE;
break;
}
}
if (found)
break;
}
if (!found || obj == NULL)
{
if (arg1[0] == '\0')
act("You haven't weapons in your scabbards.", ch, NULL, NULL, TO_CHAR);
else
act("You can't find this weapon in your scabbards.", ch, NULL, NULL, TO_CHAR);
return 0;
}
loc = WEAR_WIELD;
if (get_eq_char(ch, loc) != NULL)
{
loc = WEAR_SECOND_WIELD;
if (get_eq_char(ch, loc) != NULL
|| get_eq_char(ch, WEAR_SHIELD) != NULL
|| get_eq_char(ch, WEAR_HOLD) != NULL
|| get_skill(ch, gsn_second_weapon) < 2)
{
act("You can't wield more weapons.", ch, NULL, NULL, TO_CHAR);
return 0;
}
}
act_puts("You arm $p from $P.", ch, obj, container, TO_CHAR, POS_DEAD);
act("$n arms $p from $P.",
ch, obj, container, TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
obj_from_obj(obj);
obj_to_char(obj, ch);
equip_char(ch, obj, loc);
oprog_call(OPROG_GET, obj, ch, NULL);
return loc;
}
void do_draw(CHAR_DATA * ch, const char *argument)
{
draw(ch, argument);
}
void do_quickdraw(CHAR_DATA * ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *wield;
int chance, loc;
if ((chance = get_skill(ch, gsn_iaitsu)) == 0)
{
act("You don't know the art of iaitsu.",
ch, NULL, NULL, TO_CHAR);
return;
}
argument = one_argument(argument, arg, sizeof(arg));
if (!str_cmp(arg, "at"))
argument = one_argument(argument, arg, sizeof(arg));
victim = get_char_room(ch, arg);
if (victim == NULL)
victim = ch->fighting;
if (victim == NULL)
{
act("You can't find your victim here.",
ch, NULL, NULL, TO_CHAR);
return;
}
if (victim == ch
|| is_safe(ch, victim))
{
act("You can't do that.", ch, NULL, NULL, TO_CHAR);
return;
}
if ((!IS_NPC(victim) && (victim->hit < victim->max_hit * 9 / 10))
|| (IS_NPC(victim) && (victim->hit < victim->max_hit * 7 / 10)))
{
act("$N is already bleeding, your honour do not allow you attack $gN{him}.",
ch, NULL, victim, TO_CHAR);
return;
}
if (is_affected(ch, gsn_adv_fury)
|| (is_affected(ch, gsn_fury)
&& !IS_NPC(victim)))
{
act("Your FURY do not allow you attack $gN{him}.",
ch, NULL, victim, TO_CHAR);
return;
}
if ((wield = get_eq_char(ch, WEAR_WIELD)) != NULL)
{
act("You're already wielding $p.", ch, wield, NULL, TO_CHAR);
return;
}
loc = draw(ch, argument);
if (loc != WEAR_WIELD)
return;
if ((wield = get_eq_char(ch, loc)) == NULL)
return;
WAIT_STATE(ch, SKILL(gsn_iaitsu)->beats);
if (number_percent() < chance)
{
check_improve(ch, gsn_iaitsu, TRUE, 3);
one_hit(ch, victim, gsn_iaitsu, loc);
} else
{
act("You move clumsily and $p falls from your hands.",
ch, wield, NULL, TO_CHAR);
act("$p falls from $n's clumsy hands.",
ch, wield, NULL, TO_ROOM);
check_improve(ch, gsn_iaitsu, FALSE, 3);
obj_from_char(wield);
if (IS_OBJ_STAT(wield, ITEM_NODROP)
|| IS_OBJ_STAT(wield, ITEM_INVENTORY)
|| (ch->in_room
&& IS_SET(ch->in_room->room_flags, ROOM_BATTLE_ARENA)))
obj_to_char(wield, ch);
else
obj_to_room(wield, ch->in_room);
}
}
void do_get(CHAR_DATA * ch, const char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
OBJ_DATA *obj, *obj_next, *obj_curr;
OBJ_DATA *container;
bool found, cfound;
int count = 1, canGetResult;
argument = one_argument(argument, arg1, sizeof(arg1));
argument = one_argument(argument, arg2, sizeof(arg2));
if (!str_cmp(arg2, "from") || !str_cmp(arg2, "ÉÚ"))
argument = one_argument(argument, arg2, sizeof(arg2));
/* Get type. */
if (arg1[0] == '\0')
{
char_act("Get what?", ch);
return;
}
if ( is_number(arg1))
{
OBJ_DATA *get_coins=NULL;
count = atoi(arg1);
if (count <= 0
|| (str_cmp(arg2, "gold") && str_cmp(arg2, "silver")
&& str_cmp(arg2, "ÚÏÌÏÔÏ") && str_cmp(arg2, "ÓÅÒÅÂÒÏ")))
{
char_act("Syntax: <get> <amount> <silver|gold>", ch);
return;
}
for (obj = ch->in_room->contents; obj != NULL; obj = obj->next_content)
if ( obj->pIndexData->item_type == ITEM_MONEY)
{
if (!str_cmp(arg2, "gold") || !str_cmp(arg2, "ÚÏÌÏÔÏ"))
{
if ( obj->value[1] >= count)
{
obj_to_room(get_coins=create_money(count, 0), ch->in_room);
} else
{
char_act("Here no so many gold.", ch);
return;
}
}
if (!str_cmp(arg2, "silver") || !str_cmp(arg2, "ÓÅÒÅÂÒÏ"))
{
if (obj->value[0] >= count)
{
obj_to_room(get_coins=create_money(0, count), ch->in_room);
} else
{
char_act("Here no so many silver.", ch);
return;
}
}
if (!can_get_obj(ch, get_coins, TRUE))
{
get_obj(ch, get_coins, NULL, TRUE);
extract_obj(obj);
} else
{
extract_obj(get_coins);
}
return;
}
}
if (arg2[0] == '\0')
{
if ((str_cmp(arg1, "all") && str_prefix("all.", arg1))
&& (str_cmp(arg1, "×ÓÅ") && str_prefix("×ÓÅ.", arg1)))
{
/* 'get obj' */
obj = get_obj_list(ch, arg1, ch->in_room->contents);
if (obj == NULL)
{
act_puts("You see no $T here.", ch, NULL, arg1, TO_CHAR, POS_DEAD);
return;
}
if (!can_get_obj(ch, obj, TRUE))
get_obj(ch, obj, NULL, TRUE);
} 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;
obj_curr = obj;
canGetResult = can_get_obj(ch, obj, TRUE);
// magic number '3' -- can't carry so much objs
if (canGetResult == 3)
break;
if (canGetResult == 0)
{
cfound = FALSE;
get_obj(ch, obj, NULL, FALSE);
if (obj_next != NULL
&& is_same_obj(obj_curr, obj_next)
&& !can_get_obj(ch, obj_next, FALSE))
{
count++;
cfound = TRUE;
}
if (!cfound)
{
if (count > 1)
{
act_puts("$n gets $P[$j].",
ch, (const void *) count, obj, TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0), POS_RESTING);
act_puts("You get $P[$j].",
ch, (const void *) count, obj, TO_CHAR, POS_DEAD);
} else
{
act_puts("You get $p.",
ch, obj, NULL, TO_CHAR, POS_DEAD);
act("$n gets $p.",
ch, obj, NULL, TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
}
count = 1;
}
if (obj->pIndexData->item_type == ITEM_MONEY)
extract_obj(obj);
}
}
}
if (!found)
{
if (arg1[3] == '\0')
char_act("You see nothing here..", ch);
else
act_puts("You see no $T here.", ch, NULL, arg1+4, TO_CHAR, POS_DEAD);
}
}
return;
}
/* 'get ... container' */
if (!str_cmp(arg2, "all") || !str_prefix("all.", arg2)
|| !str_cmp(arg2, "×ÓÅ") || !str_prefix("×ÓÅ.", arg2))
{
char_act("You can't do that.", ch);
return;
}
if ((container = get_obj_here(ch, arg2)) == NULL)
{
act_puts("You see no $T here.", ch, NULL, arg2, TO_CHAR, POS_DEAD);
return;
}
switch (container->pIndexData->item_type)
{
default:
char_act("That is not a container.", ch);
return;
case ITEM_CONTAINER:
case ITEM_CORPSE_NPC:
break;
case ITEM_CORPSE_PC:
if (!can_loot(ch, container))
{
char_act("You can't do that.", ch);
return;
}
}
if (IS_SET(container->value[1], CONT_CLOSED))
{
act_puts("The $d is closed.", ch, NULL, container->name, TO_CHAR, POS_DEAD);
return;
}
if ((str_cmp(arg1, "all") && str_prefix("all.", arg1))
&& (str_cmp(arg1, "×ÓÅ") && str_prefix("×ÓÅ.", arg1)))
{
/* 'get obj container' */
obj = get_obj_list(ch, arg1, container->contains);
if (obj == NULL)
{
act_puts("I see nothing like that in the $T.",
ch, NULL, arg2, TO_CHAR, POS_DEAD);
return;
}
if (!can_get_obj(ch, obj, TRUE))
get_obj(ch, obj, container, TRUE);
} else
{
/* 'get all container' or 'get all.obj container' */
if (container->pIndexData->vnum == OBJ_VNUM_PIT
&& !IS_IMMORTAL(ch))
{
char_act("Don't be so greedy!", ch);
return;
}
found = FALSE;
count = 1;
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;
obj_curr = obj;
canGetResult = can_get_obj(ch, obj, TRUE);
// magic number '3' -- can't carry so much objs
if (canGetResult == 3)
break;
if (canGetResult == 0)
{
cfound = FALSE;
get_obj(ch, obj, container, FALSE);
if (obj_next != NULL
&& is_same_obj(obj_curr, obj_next)
&& !can_get_obj(ch, obj_next, FALSE))
{
count++;
cfound = TRUE;
}
if (!cfound)
{
if (count > 1)
{
act_puts3("$n gets $p[$J] from $P.",
ch, obj, container, (const void *) count, TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0), POS_RESTING);
act_puts3("You get $p[$J] from $P.",
ch, obj, container, (const void *) count, TO_CHAR, POS_RESTING);
} else
{
act("You get $p from $P.", ch, obj, container, TO_CHAR);
act("$n gets $p from $P.", ch, obj, container,
TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
}
count = 1;
}
if (obj->pIndexData->item_type == ITEM_MONEY)
extract_obj(obj);
}
}
}
if (!found)
{
if (arg1[3] == '\0')
act_puts("You see nothing in the $T.", ch, NULL, arg2, TO_CHAR, POS_DEAD);
else
act_puts("You see nothing like that in the $T.",
ch, NULL, arg2, TO_CHAR, POS_DEAD);
}
}
}
int scabbard_type(int weapon_type)
{
int type;
switch (weapon_type)
{
case WEAPON_SWORD:
type = 1;
break;
case WEAPON_DAGGER:
case WEAPON_KNIFE:
type = 2;
break;
case WEAPON_MACE:
case WEAPON_AXE:
case WEAPON_FLAIL:
type = 3;
break;
case WEAPON_SPEAR:
case WEAPON_POLEARM:
case WEAPON_LANCE:
case WEAPON_WHIP:
type = 4;
break;
default:
type = 0;
}
return type;
}
bool sheathe(CHAR_DATA *ch, OBJ_DATA *container, OBJ_DATA *obj, int* count, bool message)
{
if ((container->value[1] != scabbard_type(obj->value[0]))
|| (obj->pIndexData->item_type != ITEM_WEAPON))
{
act_puts("You can't put $P in the $p.",
ch, container, obj, TO_CHAR, POS_DEAD);
return FALSE;
}
if ((obj->pIndexData->limit != -1)
&& (container->pIndexData->limit == -1))
{
act_puts("This unworthy container won't hold $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if (!IS_WEAPON_STAT(obj, WEAPON_KATANA)
&& IS_SET(obj->pIndexData->extra_flags, ITEM_QUEST)
&& (!IS_SET(container->pIndexData->extra_flags, ITEM_QUEST)
|| container->owner == NULL
|| obj->owner == NULL
|| container->owner != obj->owner))
{
act_puts("This unworthy container won't hold $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
(*count)++;
if (*count > container->value[2])
{
act_puts("It is unsafe to put so much weapons in the $p.",
ch, container, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if (get_obj_weight(obj) + get_true_weight(container) > (container->value[0] * 10)
|| get_obj_weight(obj) > (container->value[3] * 10))
{
act_puts("The $p is not located in $P.", ch, obj, container, TO_CHAR, POS_DEAD);
return FALSE;
}
if (ch->fighting != NULL)
{
char_act("You can't do this while fighting.", ch);
return FALSE;
}
obj_from_char(obj);
obj_to_obj(obj, container);
if (message)
{
act_puts("$n puts $p in $P.", ch, obj, container, TO_ROOM, POS_RESTING);
act_puts("You put $p in $P.", ch, obj, container, TO_CHAR, POS_DEAD);
}
return TRUE;
}
void do_sheathe(CHAR_DATA * ch, const char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
OBJ_DATA *container;
OBJ_DATA *obj = NULL;
OBJ_DATA *objc;
int count, type;
argument = one_argument(argument, arg1, sizeof(arg1));
argument = one_argument(argument, arg2, sizeof(arg2));
if (!str_cmp(arg2, "in") || !str_cmp(arg2, "into") || !str_cmp(arg2, "×"))
argument = one_argument(argument, arg2, sizeof(arg2));
if (arg1[0] != '\0')
{
if ((obj = get_obj_wear(ch, arg1)) == NULL)
{
act_puts("You are not armed any $T.", ch, NULL, arg1, TO_CHAR, POS_DEAD);
return;
}
} else
{
obj = get_eq_char(ch, WEAR_SECOND_WIELD);
if (obj == NULL)
obj = get_eq_char(ch, WEAR_WIELD);
if (obj == NULL)
{
act("But you are unarmed!", ch, NULL, NULL, TO_CHAR);
return;
}
}
if ((IS_OBJ_STAT(obj, ITEM_NOREMOVE) || IS_OBJ_STAT(obj, ITEM_NODROP))
&& !IS_WEAPON_STAT(obj, WEAPON_KATANA))
{
act("You can't get of $p.", ch, obj, NULL, TO_CHAR);
return;
}
type = scabbard_type(obj->value[0]);
for (container = ch->carrying; container; container = container->next_content)
{
if (container->wear_loc == WEAR_NONE
|| container->pIndexData->item_type != ITEM_SCABBARD)
continue;
if (arg2[0] != '\0' && !is_name(arg2, container->name))
continue;
if (container->value[1] != type)
continue;
break;
}
if (container == NULL)
{
act("You haven't a proper weapon container for $p.",
ch, obj, NULL, TO_CHAR);
return;
}
if (container->pIndexData->item_type != ITEM_SCABBARD)
{
act("$p it is not intended for storage of the weapon.",
ch, container, NULL, TO_CHAR);
return;
}
if (obj->timer > 0)
{
act_puts("$p decays, you should wait a little.",
ch, obj, NULL, TO_CHAR, POS_DEAD);
return;
}
count = 0;
for (objc = container->contains; objc; objc = objc->next_content)
count++;
sheathe(ch, container, obj, &count, TRUE);
}
bool put_obj(CHAR_DATA *ch, OBJ_DATA *container, OBJ_DATA *obj, int* count, bool message)
{
OBJ_DATA * objc;
if (IS_SET(container->value[1], CONT_QUIVER)
&& (obj->pIndexData->item_type != ITEM_WEAPON
|| obj->value[0] != WEAPON_ARROW))
{
act_puts("You can only put arrows in $p.",
ch, container, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if (container->pIndexData->vnum == OBJ_VNUM_PIT
&& !CAN_WEAR(obj, ITEM_TAKE))
{
if (obj->timer)
SET_BIT(obj->extra_flags, ITEM_HAD_TIMER);
else
obj->timer = number_range(100, 200);
}
if (obj->pIndexData->limit != -1)
{
act_puts("This unworthy container won't hold $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if (IS_SET(obj->pIndexData->extra_flags, ITEM_QUEST)
&& (container->pIndexData->vnum != QUEST_VNUM_SONG
|| container->owner == NULL || obj->owner == NULL
|| container->owner != obj->owner) )
{
act_puts("This unworthy container won't hold $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if (obj->pIndexData->item_type == ITEM_POTION
&& IS_SET(container->wear_flags, ITEM_TAKE)
&& !IS_SET(container->value[1], CONT_ROOMY))
{
int pcount = 0;
for (objc = container->contains; objc; objc = objc->next_content)
if (objc->pIndexData->item_type == ITEM_POTION)
pcount++;
if (pcount > 15)
{
act_puts("It's not safe to put more potions into $p.",
ch, container, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
}
(*count)++;
if (*count > container->value[0])
{
act_puts("It's not safe to put that much items into $p.",
ch, container, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if (get_obj_weight(obj) + get_true_weight(container) >
(container->value[0] * 10)
|| get_obj_weight(obj) > (container->value[3] * 10))
{
act_puts3("$p is not located $U $P.",
ch, obj, container, IS_SET(container->value[1], CONT_PUT_ON) ? "on" : "in", TO_CHAR, POS_DEAD);
return FALSE;
}
obj_from_char(obj);
obj_to_obj(obj, container);
if (message)
{
act_puts3("$n puts $p $U $P.",
ch, obj, container, IS_SET(container->value[1], CONT_PUT_ON) ? "on" : "in", TO_ROOM, POS_RESTING);
act_puts3("You put $p $U $P.",
ch, obj, container, IS_SET(container->value[1], CONT_PUT_ON) ? "on" : "in", TO_CHAR, POS_DEAD);
}
return TRUE;
}
void do_put(CHAR_DATA * ch, const char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
OBJ_DATA *container;
OBJ_DATA *obj = NULL;
OBJ_DATA *obj_next, *obj_curr;
OBJ_DATA *objc;
clan_t *clan = NULL;
int count, pcount = 1;
bool found, cfound;
argument = one_argument(argument, arg1, sizeof(arg1));
argument = one_argument(argument, arg2, sizeof(arg2));
if (!str_cmp(arg2, "in") || !str_cmp(arg2, "on")
|| !str_cmp(arg2, "×") || !str_cmp(arg2, "ÎÁ"))
argument = one_argument(argument, arg2, sizeof(arg2));
if (arg1[0] == '\0' || arg2[0] == '\0')
{
char_act("Put what in what?", ch);
return;
}
if (!str_cmp(arg2, "all") || !str_prefix("all.", arg2))
{
char_act("You can't do that.", ch);
return;
}
if ((container = get_obj_here(ch, arg2)) == NULL)
{
act_puts("You see no $T here.", ch, NULL, arg2, TO_CHAR, POS_DEAD);
return;
}
if ((container->pIndexData->item_type != ITEM_CONTAINER)
&& (container->pIndexData->item_type != ITEM_CORPSE_NPC)
&& (container->pIndexData->item_type != ITEM_CORPSE_PC))
{
char_act("That is not a container.", ch);
return;
}
clan = is_clan_altar(container);
if ((clan == NULL) || (clan != CLAN(ch->clan)))
if (IS_SET(container->value[1], CONT_CLOSED))
{
act_puts("The $d is closed.", ch, NULL, container->name, TO_CHAR, POS_DEAD);
if (!IS_IMMORTAL(ch))
return;
}
if ((str_cmp(arg1, "all") && str_prefix("all.", arg1))
&& (str_cmp(arg1, "×ÓÅ") && str_prefix("×ÓÅ.", arg1)))
{
/* 'put obj container' */
if ((obj = get_obj_carry(ch, arg1)) == NULL)
{
char_act("You do not have that item.", ch);
return;
}
if (obj == container)
{
char_act("You can't fold it into itself.", ch);
return;
}
if (!can_drop_obj(ch, obj))
{
char_act("You can't let go of it.", ch);
return;
}
if (WEIGHT_MULT(obj) != 100)
{
char_act("You have a feeling that would be a bad idea.", ch);
return;
}
if (container->pIndexData->item_type == ITEM_CORPSE_PC)
{
char_act("You have a feeling that would be a bad idea.", ch);
act("$n tries to thrust $p in $P.", ch, obj, container, TO_ROOM);
return;
}
if (obj->pIndexData->item_type == ITEM_CORPSE_PC)
{
char_act("To bury it would be necessary...", ch);
return;
}
if (obj->pIndexData->limit != -1)
{
act_puts("This unworthy container won't hold $p.",
ch, obj, NULL, TO_CHAR, POS_DEAD);
return;
}
if (obj->timer > 0)
{
act_puts("$p decays, you should wait a little.", ch, obj, NULL, TO_CHAR, POS_DEAD);
return;
}
count = 0;
for (objc = container->contains; objc; objc = objc->next_content)
count++;
put_obj(ch, container, obj, &count, TRUE);
} else
{
if (!IS_NPC(ch) && IS_AFFECTED(ch, AFF_CHARM))
{
do_say(ch, "Nah, I won't do that.");
return;
}
count = 0;
for (objc = container->contains; objc; objc = objc->next_content)
count++;
/* 'put all container' or 'put all.obj container' */
for (obj = ch->carrying; 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)
&& WEIGHT_MULT(obj) == 100
&& obj->wear_loc == WEAR_NONE
&& obj != container
&& obj->timer == 0
&& can_drop_obj(ch, obj))
{
cfound = FALSE;
obj_curr = obj;
found = put_obj(ch, container, obj, &count, FALSE);
if (found && is_same_obj(obj_curr, obj_next))
{
pcount++;
cfound = TRUE;
}
if (!cfound)
{
if (pcount > 1)
{
act("$n puts $P[$j] ",
ch, (const void *) pcount, obj, TO_ROOM | ACT_NOLF);
act("$t $P.\n",
ch, IS_SET(container->value[1], CONT_PUT_ON) ? "on" : "into", container, TO_ROOM | ACT_NOUCASE);
act_puts("You put $P[$j] ",
ch, (const void *) pcount, obj, TO_CHAR | ACT_NOLF, POS_DEAD);
act_puts("$t $P.\n",
ch, IS_SET(container->value[1], CONT_PUT_ON) ? "on" : "into", container, TO_CHAR | ACT_NOUCASE, POS_DEAD);
} else
{
if (found)
{
act_puts3("$n puts $p $U $P.",
ch, obj, container, IS_SET(container->value[1], CONT_PUT_ON) ? "on" : "into", TO_ROOM, POS_RESTING);
act_puts3("You put $p $U $P.",
ch, obj, container, IS_SET(container->value[1], CONT_PUT_ON) ? "on" : "into", TO_CHAR, POS_DEAD);
}
}
pcount = 1;
}
}
}
}
}
void drop_obj(CHAR_DATA *ch, OBJ_DATA *obj, bool message)
{
obj_from_char(obj);
obj_to_room(obj, ch->in_room);
if (message)
{
act("$n drops $p.",
ch, obj, NULL, TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
act_puts("You drop $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
}
if (obj->pIndexData->vnum == OBJ_VNUM_POTION_VIAL
&& number_percent() < 51)
switch (ch->in_room->sector_type)
{
case SECT_FOREST:
case SECT_DESERT:
case SECT_AIR:
case SECT_WATER_NOSWIM:
case SECT_WATER_SWIM:
case SECT_FIELD:
break;
default:
act("$p cracks and shaters into tiny pieces.",
ch, obj, NULL, TO_ROOM);
act("$p cracks and shaters into tiny pieces.",
ch, obj, NULL, TO_CHAR);
extract_obj(obj);
return;
}
oprog_call(OPROG_DROP, obj, ch, NULL);
if (HAS_TRIGGER_OBJ(obj, TRIG_DROP))
p_give_trigger(NULL, obj, NULL, ch, obj, TRIG_DROP);
if (HAS_TRIGGER_ROOM(ch->in_room, TRIG_DROP))
p_give_trigger(NULL, NULL, ch->in_room, ch, obj, TRIG_DROP);
if (!may_float(obj) && cant_float(obj) && IS_WATER(ch->in_room))
{
act("$p sinks down the water.", ch, obj, NULL,
TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
act("$p sinks down the water.", ch, obj, NULL, TO_CHAR);
extract_obj(obj);
} else if (IS_OBJ_STAT(obj, ITEM_MELT_DROP))
{
act("$p dissolves into smoke.", ch, obj, NULL,
TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
act("$p dissolves into smoke.", ch, obj, NULL, TO_CHAR);
extract_obj(obj);
}
}
void do_drop(CHAR_DATA * ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *obj_next;
bool found, cfound ;
int count = 1;
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("Drop what?", ch);
return;
}
if (is_number(arg))
{
/* 'drop NNNN coins' */
int amount, gold = 0, silver = 0;
amount = atoi(arg);
argument = one_argument(argument, arg, sizeof(arg));
if (amount <= 0
|| (str_cmp(arg, "coins") && str_cmp(arg, "coin") && str_cmp(arg, "ÍÏÎÅÔ")
&& str_cmp(arg, "gold") && str_cmp(arg, "silver")
&& str_cmp(arg, "ÚÏÌÏÔÏ") && str_cmp(arg, "ÓÅÒÅÂÒÏ")))
{
char_act("You can't do that.", ch);
return;
}
if (!str_cmp(arg, "coins") || !str_cmp(arg, "coin")
|| !str_cmp(arg, "silver") || !str_cmp(arg, "ÓÅÒÅÂÒÏ")
|| !str_cmp(arg, "ÍÏÎÅÔ"))
{
if (ch->silver < amount)
{
char_act("You don't have that much silver.", ch);
return;
}
ch->silver -= amount;
silver = amount;
}
else
{
if (ch->gold < amount)
{
char_act("You don't have that much gold.", ch);
return;
}
ch->gold -= amount;
gold = amount;
}
for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
switch (obj->pIndexData->vnum)
{
case OBJ_VNUM_SILVER_ONE:
silver += 1;
extract_obj(obj);
break;
case OBJ_VNUM_GOLD_ONE:
gold += 1;
extract_obj(obj);
break;
case OBJ_VNUM_SILVER_SOME:
silver += obj->value[0];
extract_obj(obj);
break;
case OBJ_VNUM_GOLD_SOME:
gold += obj->value[1];
extract_obj(obj);
break;
case OBJ_VNUM_COINS:
silver += obj->value[0];
gold += obj->value[1];
extract_obj(obj);
break;
}
}
obj = create_money(gold, silver);
obj_to_room(obj, ch->in_room);
act("$n drops some coins.", ch, NULL, NULL,
TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
char_act("Ok.", ch);
if (IS_WATER(ch->in_room))
{
extract_obj(obj);
act("The coins sink down, and disapear in the water.",
ch, NULL, NULL,TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
char_act("The coins sink down, and disapear in the water.", ch);
}
return;
}
if ((str_cmp(arg, "all") && str_prefix("all.", arg))
&& (str_cmp(arg, "×ÓÅ") && str_prefix("×ÓÅ.", arg)))
{
/* 'drop obj' */
if ((obj = get_obj_carry(ch, arg)) == NULL)
{
char_act("You do not have that item.", ch);
return;
}
if (!can_drop_obj(ch, obj))
{
char_act("You can't let go of it.", ch);
return;
}
drop_obj(ch, obj, TRUE);
} else
{
/* 'drop all' or 'drop all.obj' */
if (!IS_NPC(ch) && IS_AFFECTED(ch, AFF_CHARM))
{
do_say(ch, "Nah, I won't do that.");
return;
}
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;
cfound = FALSE;
if (is_same_obj(obj, obj->next_content))
{
count++;
cfound = TRUE;
}
if (!cfound)
{
if (count > 1)
{
act("$n drops $P[$j].", ch, (const void *) count, obj,
TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
act("You drop $P[$j].",
ch, (const void *) count, obj, TO_CHAR);
}
else
{
act("$n drops $p.", ch, obj, NULL,
TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
act("You drop $p.", ch, obj, NULL, TO_CHAR);
}
count = 1;
}
drop_obj(ch, obj, FALSE);
}
}
if (!found)
{
if (arg[3] == '\0')
act_puts("You are not carrying anything.", ch, NULL, arg, TO_CHAR, POS_DEAD);
else
act_puts("You are not carrying any $T.", ch, NULL, &arg[4], TO_CHAR, POS_DEAD);
}
}
}
void do_label(CHAR_DATA* ch, const char *argument)
{
OBJ_DATA * obj;
char obj_name[MAX_INPUT_LENGTH];
char label[MAX_INPUT_LENGTH];
char buff[MAX_INPUT_LENGTH];
if (IS_NPC(ch)) return;
argument = first_arg(argument, obj_name, sizeof(obj_name), FALSE);
first_arg(argument, label, sizeof(label), FALSE);
if (!obj_name[0])
{
char_act("Label what?", ch);
return;
}
if (!label[0])
{
char_act("How do you want to label it?", ch);
return;
}
if ((obj=get_obj_carry(ch,obj_name)) == NULL)
{
char_act("You don't have that object.", ch);
return;
}
if (is_name(label, obj->name))
{
char_act("Such label already is on object.", ch);
return;
}
if (ch->pcdata->questpoints < 10)
{
char_act("You do not have enough questpoints for labeling.", ch);
return;
}
if ((strlen(obj->name)+strlen(label)+1) >=MAX_INPUT_LENGTH)
{
char_act("You can't label this object with this label.", ch);
return;
}
buff[0] = '\0';
strnzcat(buff, sizeof(buff), obj->name);
strnzcat(buff, sizeof(buff), " ");
strnzcat(buff, sizeof(buff), label);
free_string(obj->name);
obj->name = strdup(buff);
ch->pcdata->questpoints -= 10;
char_act("Ok.", ch);
return;
}
DO_FUN(do_nogive)
{
TOGGLE_BIT(ch->comm, COMM_NOGIVE);
if (IS_SET(ch->comm, COMM_NOGIVE))
char_act("You any more do not accept items from others. ", ch);
else
char_act("Now you accept items from others.", ch);
}
void do_give(CHAR_DATA * ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *obj;
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("äÁÔØ ÞÔÏ É ËÏÍÕ?", ch);
return;
}
if (is_number(arg))
{
/* 'give NNNN coins victim' */
int amount;
bool silver;
amount = atoi(arg);
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
do_give(ch, str_empty);
return;
}
if (amount <= 0
|| (str_cmp(arg, "coins") && str_cmp(arg, "coin")
&& str_cmp(arg, "gold") && str_cmp(arg, "silver")))
{
char_act("éÚ×ÉÎÉ, ÎÏ ÔÙ ÎÅ ÍÏÖÅÛØ ÜÔÏÇÏ ÓÄÅÌÁÔØ.", ch);
return;
}
silver = str_cmp(arg, "gold");
argument = one_argument(argument, arg, sizeof(arg));
if (!str_cmp(arg, "to"))
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
do_give(ch, str_empty);
return;
}
if ((victim = get_char_room(ch, arg)) == NULL)
{
char_act("ôÁËÉÈ ÚÄÅÓØ ÎÅÔ.", ch);
return;
}
if ((!silver && ch->gold < amount)
|| (silver && ch->silver < amount))
{
char_act("õ ÔÅÂÑ ÎÅÔ ÔÁËÏÇÏ ËÏÌÉÞÅÓÔ×Á.", ch);
return;
}
if ((silver && get_carry_weight(victim) + amount*SILVER_WEIGHT > can_carry_w(victim))
|| (!silver && get_carry_weight(victim) + amount*GOLD_WEIGHT > can_carry_w(victim)))
{
char_act("ïÎ ÎÅ ÍÏÖÅÛØ ÕÎÅÓÔÉ ÓÔÏÌØËÏ ÄÅÎÅÇ.", ch);
return;
}
if (silver)
{
ch->silver -= amount;
victim->silver += amount;
} else
{
ch->gold -= amount;
victim->gold += amount;
}
act_puts3("$n ÄÁÅÔ ÔÅÂÅ $J $t.", ch, silver ? "silver" : "gold", victim, (const void *) amount, TO_VICT | ACT_TRANS, POS_RESTING);
act("$n ÄÁÅÔ $N ÎÅÓËÏÌØËÏ ÍÏÎÅÔ.", ch, NULL, victim, TO_NOTVICT);
act_puts3("ôÙ ÄÁÅÛØ $N $J $t.", ch, silver ? "silver" : "gold", victim, (const void *) amount, TO_CHAR | ACT_TRANS, POS_RESTING);
/*
* Bribe trigger
*/
if (IS_NPC(victim) && HAS_TRIGGER_MOB(victim, TRIG_BRIBE))
p_bribe_trigger(victim, ch, silver ? amount : amount * 100);
if (IS_NPC(victim)
&& IS_SET(victim->pIndexData->act, ACT_CHANGER))
{
int change;
change = (silver ? 95 * amount / 100 / 100
: 95 * amount);
if (!silver && change > victim->silver)
victim->silver += change;
if (silver && change > victim->gold)
victim->gold += change;
if (change < 1 && can_see(victim, ch))
{
act_tell("éÚ×ÉÎÉ, ÎÏ ÜÔÏÇÏ ÂÕÄÅÔ ÎÅÄÏÓÔÁÔÏÞÎÏ ÄÌÑ ÏÂÍÅÎÁ.", victim, NULL, ch);
doprintf(do_give, victim, "%d %s %s", amount, silver ? "silver" : "gold", ch->name);
}
else if (can_see(victim, ch))
{
doprintf(do_give, victim, "%d %s %s", change, silver ? "gold" : "silver", ch->name);
if (silver)
doprintf(do_give, victim, "%d silver %s", (95 * amount / 100 - change * 100), ch->name);
act_tell("óÐÁÓÉÂÏ, ÐÒÉÈÏÄÉÔÅ ÅÝÅ!", victim, NULL, ch);
}
victim->silver = 0;
victim->gold = 0;
}
return;
}
if ((obj = get_obj_carry(ch, arg)) == NULL)
{
char_act("õ ÔÅÂÑ ÎÅÔ ÜÔÏÇÏ ÐÒÅÄÍÅÔÁ.", ch);
return;
}
argument = one_argument(argument, arg, sizeof(arg));
if (!str_cmp(arg, "to"))
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
do_give(ch, str_empty);
return;
}
if (obj->wear_loc != WEAR_NONE)
{
char_act("óÎÁÞÁÌÁ ÓÎÉÍÉ ÜÔÏ.", ch);
return;
}
if ((victim = get_char_room(ch, arg)) == NULL)
{
char_act("ôÁËÉÈ ÚÄÅÓØ ÎÅÔ.", ch);
return;
}
if (IS_NPC(victim) && victim->pIndexData->pShop != NULL
&& !HAS_TRIGGER_MOB(victim, TRIG_GIVE))
{
do_tell_raw(victim, ch, "éÚ×ÉÎÉ, ÔÙ ÓÏÂÉÒÁÅÛØÓÑ ÜÔÏ ÐÒÏÄÁÔØ?");
return;
}
if (IS_NPC(victim)
&& is_affected (victim, gsn_mirror))
{
act("îÏ ÜÔÏ ÎÅ ÎÁÓÔÏÑÝÉÊ $N!", ch, NULL, victim, TO_CHAR);
return;
}
if (!can_drop_obj(ch, obj))
{
char_act("ôÙ ÎÅ ÍÏÖÅÛØ ÉÚÂÁ×ÉÔØÓÑ ÏÔ ÜÔÏÇÏ.", ch);
return;
}
if (victim->carry_number + get_obj_number(obj) > can_carry_n(victim))
{
act("òÕËÉ $c1{$N} ÐÏÌÎÙ.", ch, NULL, victim, TO_CHAR);
return;
}
if (get_carry_weight(victim) + get_obj_weight(obj) > can_carry_w(victim))
{
act("$N ÎÅ ÍÏÖÅÔ ÎÅÓÔÉ ÔÁËÏÊ ×ÅÓ.", ch, NULL, victim, TO_CHAR);
return;
}
if (IS_SET(obj->pIndexData->extra_flags, ITEM_QUEST)
&& !IS_IMMORTAL(ch) && !IS_IMMORTAL(victim))
{
act_puts("ôÙ ÎÅ ÎÁÓÔÏÌØËÏ $gn{ÇÌÕÐ}, ÞÔÏÂÙ ÏÔÄÁÔØ $p $c2{$N}.",
ch, obj, victim, TO_CHAR, POS_DEAD);
return;
}
if (!can_see_obj(victim, obj))
{
act("$N ÎÅ ×ÉÄÉÔ ÜÔÏÇÏ.", ch, NULL, victim, TO_CHAR);
return;
}
if (obj->pIndexData->limit != -1)
{
if ((IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(victim))
|| (IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(victim))
|| (IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(victim)))
{
act("$gN{ÅÇÏ} ÈÁÒÁËÔÅÒ ÎÅ ÐÏÚ×ÏÌÑÅÔ ÐÒÉËÁÓÁÔØÓÑ Ë ÜÔÏÊ ×ÅÝÉ.",
ch, NULL, victim, TO_CHAR);
return;
}
}
if (IS_SET(victim->comm, COMM_NOGIVE)
&& !IS_IMMORTAL(ch))
{
act("$N ÎÅ ÐÒÉÎÉÍÁÅÔ ÐÒÅÄÍÅÔÏ× ÏÔ ÐÏÓÔÏÒÏÎÉÈ.",
ch, NULL, victim, TO_CHAR);
return;
}
obj_from_char(obj);
obj_to_char(obj, victim);
act("$n ÄÁÅÔ $p $c2{$N}.", ch, obj, victim, TO_NOTVICT | ACT_NOTRIG);
act("$n ÄÁÅÔ ÔÅÂÅ $p.", ch, obj, victim, TO_VICT | ACT_NOTRIG);
act("ôÙ ÄÁÅÛØ $p $c2{$N}.", ch, obj, victim, TO_CHAR | ACT_NOTRIG);
if (HAS_TRIGGER_OBJ(obj, TRIG_GIVE))
p_give_trigger(NULL, obj, NULL, ch, obj, TRIG_GIVE);
if (HAS_TRIGGER_ROOM( ch->in_room, TRIG_GIVE))
p_give_trigger(NULL, NULL, ch->in_room, ch, obj, TRIG_GIVE);
if (IS_NPC(victim)
&& IS_SET(victim->pIndexData->act, ACT_CHANGER)
&& (obj->pIndexData->item_type == ITEM_MONEY))
{
act("$N Ó ÒÁÄÏÓÔØÀ ÏÂÍÅÎÑÌ ÔÅÂÅ $p ÎÁ ÚÏÌÏÔÏ.",ch, obj, victim, TO_CHAR | ACT_NOTRIG);
ch->gold += obj->value[0];
extract_obj(obj);
}
/*
* Give trigger
*/
if (IS_NPC(victim) && HAS_TRIGGER_MOB(victim, TRIG_GIVE))
p_give_trigger(victim, NULL, NULL, ch, obj, TRIG_GIVE);
oprog_call(OPROG_GIVE, obj, ch, victim);
}
/* for poisoning weapons and food/drink */
void do_envenom(CHAR_DATA * ch, const char *argument)
{
OBJ_DATA *obj;
AFFECT_DATA af;
int percent, chance;
int sn;
/* find out what */
if (argument == '\0')
{
char_act("ëÁËÏÊ ÐÒÅÄÍÅÔ ÏÔÒÁ×ÉÔØ?", ch);
return;
}
obj = get_obj_list(ch, argument, ch->carrying);
if (obj == NULL)
{
char_act("õ ÔÅÂÑ ÎÅÔ ÜÔÏÇÏ ÐÒÅÄÍÅÔÁ.", ch);
return;
}
if ((sn = sn_lookup("envenom")) < 0
|| (chance = get_skill(ch, sn)) == 0)
{
char_act("ôÙ ÓÏÂÉÒÁÅÛØÓÑ ÏÔÒÁ×ÉÔØ ÓÅÂÑ???", ch);
return;
}
if (obj->pIndexData->item_type == ITEM_FOOD || obj->pIndexData->item_type == ITEM_DRINK_CON)
{
if (IS_OBJ_STAT(obj, ITEM_BLESS)
|| IS_OBJ_STAT(obj, ITEM_BURN_PROOF))
{
act("õ ÔÅÂÑ ÎÅ ÐÏÌÕÞÉÌÏÓØ ÏÔÒÁ×ÉÔØ $p.", ch, obj, NULL, TO_CHAR);
return;
}
WAIT_STATE(ch, SKILL(sn)->beats);
if (number_percent() < chance)
{ /* success! */
act("$n ÐÏËÒÙ×ÁÅÔ $p ÓÍÅÒÔÅÌØÎÙÍ ÑÄÏÍ.",
ch, obj, NULL, TO_ROOM);
act("ôÙ ÐÏËÒÙ×ÁÅÛØ $p ÓÍÅÒÔÅÌØÎÙÍ ÑÄÏÍ.",
ch, obj, NULL, TO_CHAR);
if (!obj->value[3])
{
obj->value[3] = 1;
check_improve(ch, sn, TRUE, 4);
}
return;
}
act("õ ÔÅÂÑ ÎÅ ÐÏÌÕÞÉÌÏÓØ ÏÔÒÁ×ÉÔØ $p.", ch, obj, NULL, TO_CHAR);
if (!obj->value[3])
check_improve(ch, sn, FALSE, 4);
return;
} else if (obj->pIndexData->item_type == ITEM_WEAPON)
{
if (IS_WEAPON_STAT(obj, WEAPON_FLAMING)
|| IS_WEAPON_STAT(obj, WEAPON_FROST)
|| IS_WEAPON_STAT(obj, WEAPON_VAMPIRIC)
|| IS_WEAPON_STAT(obj, WEAPON_SHARP)
|| IS_WEAPON_STAT(obj, WEAPON_VORPAL)
|| IS_WEAPON_STAT(obj, WEAPON_RADIATION)
|| IS_WEAPON_STAT(obj, WEAPON_SHOCKING))
chance/=2;
if (IS_WEAPON_STAT(obj, WEAPON_HOLY)
|| IS_OBJ_STAT(obj, ITEM_BLESS)
|| IS_OBJ_STAT(obj, ITEM_BURN_PROOF))
{
act("ôÙ ÎÅ ÍÏÖÅÛØ ÏÔÒÁ×ÉÔØ $p.",
ch, obj, NULL, TO_CHAR);
return;
}
if (obj->value[3] < 0
|| attack_table[obj->value[3]].damage == DAM_BASH)
{
char_act("ôÙ ÍÏÖÅÛØ ÏÔÒÁ×ÉÔØ ÔÏÌØËÏ ËÏÌÀÝÅÅ ÏÒÕÖÉÅ.", ch);
return;
}
if (IS_WEAPON_STAT(obj, WEAPON_POISON))
{
act("$p ÕÖÅ $gp{ÏÔÒÁ×ÌÅÎ}.", ch, obj, NULL, TO_CHAR);
return;
}
WAIT_STATE(ch, SKILL(sn)->beats);
percent = number_percent();
if (percent < chance)
{
af.where = TO_WEAPON;
af.type = gsn_poison;
af.level = LVL(ch) * percent / 100;
af.duration = LVL(ch) * percent / 100;
af.location = 0;
af.modifier = 0;
af.bitvector = WEAPON_POISON;
affect_to_obj(obj, &af);
act("$n ÐÏËÒÙ×ÁÅÔ $p ÓÍÅÒÔÅÌØÎÙÍ ÑÄÏÍ.", ch, obj, NULL,
TO_ROOM | (IS_AFFECTED(ch, AFF_SNEAK) ? ACT_NOMORTAL : 0));
act("ôÙ ÐÏËÒÙ×ÁÅÛØ $p ÓÍÅÒÔÅÌØÎÙÍ ÑÄÏÍ.", ch, obj, NULL, TO_CHAR);
check_improve(ch, sn, TRUE, 3);
return;
} else
{
act("õ ÔÅÂÑ ÎÅ ÐÏÌÕÞÉÌÏÓØ ÏÔÒÁ×ÉÔØ $p.", ch, obj, NULL, TO_CHAR);
check_improve(ch, sn, FALSE, 3);
return;
}
}
act("ôÙ ÎÅ ÍÏÖÅÛØ ÏÔÒÁ×ÉÔØ $p.", ch, obj, NULL, TO_CHAR);
}
void do_fill(CHAR_DATA * ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *fountain;
bool found;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("îÁÐÏÌÎÉÔØ ÞÔÏ?", ch);
return;
}
if ((obj = get_obj_carry(ch, arg)) == NULL)
{
char_act("õ ÔÅÂÑ ÎÅÔ ÜÔÏÇÏ ÐÒÅÄÍÅÔÁ.", ch);
return;
}
found = FALSE;
for (fountain = ch->in_room->contents; fountain != NULL; fountain = fountain->next_content)
{
if (fountain->pIndexData->item_type == ITEM_FOUNTAIN)
{
found = TRUE;
break;
}
}
if (!found)
{
char_act("úÄÅÓØ ÎÅÔ ÆÏÎÔÁÎÁ!", ch);
return;
}
if (obj->pIndexData->item_type != ITEM_DRINK_CON)
{
char_act("ôÙ ÎÅ ÍÏÖÅÛØ ÎÁÐÏÌÎÉÔØ ÜÔÏ.", ch);
return;
}
if (obj->value[1] != 0 && obj->value[2] != fountain->value[2])
{
char_act("úÄÅÓØ ÕÖÅ ÐÌÅÝÅÔÓÑ ËÁËÁÑ ÔÏ ÖÉËÏÓÔØ.", ch);
return;
}
if (obj->value[1] >= obj->value[0] && obj->value[0] >= 0)
{
char_act("ô×ÏÊ ËÏÎÔÅÊÎÅÒ ÐÏÌÏÎ.", ch);
return;
}
//act_puts3("ôÙ ÎÁÐÏÌÎÑÅÛØ $p $U ÉÚ $P.", ch, obj, fountain, liq_table[fountain->value[2]].liq_name, TO_CHAR, POS_RESTING);
//act_puts3("$n ÎÁÐÏÌÎÑÅÔ $p $U ÉÚ $P.", ch, obj, fountain, liq_table[fountain->value[2]].liq_name, TO_ROOM, POS_RESTING);
act_puts3("ôÙ ÎÁÐÏÌÎÑÅÛØ $p $c4{$U} ÉÚ $c1{$P}.", ch, obj, fountain, liquid_name(fountain->value[2]), TO_CHAR | ACT_TRANS, POS_RESTING);
act_puts3("$n ÎÁÐÏÌÎÑÅÔ $p $c4{$U} ÉÚ $c1{$P}.", ch, obj, fountain, liquid_name(fountain->value[2]), TO_ROOM | ACT_TRANS, POS_RESTING);
obj->value[2] = fountain->value[2];
obj->value[1] = obj->value[0];
}
void do_pour(CHAR_DATA * ch, const char *argument)
{
char arg[MAX_STRING_LENGTH];
OBJ_DATA *out, *in;
CHAR_DATA *vch = NULL;
int amount;
argument = one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0' || argument[0] == '\0')
{
char_act("ðÅÒÅÌÉÔØ ÞÔÏ É ËÕÄÁ?", ch);
return;
}
if ((out = get_obj_carry(ch, arg)) == NULL)
{
char_act("õ $gn{ÔÅÂÑ} ÎÅÔ ÜÔÏÇÏ ÐÒÅÄÍÅÔÁ.", ch);
return;
}
if (out->pIndexData->item_type != ITEM_DRINK_CON)
{
char_act("üÔÏ ÎÅ ÖÉÄËÏÓÔÎÏÊ ËÏÎÔÅÊÎÅÒ.", ch);
return;
}
if (!str_cmp(argument, "out"))
{
if (out->value[1] == 0)
{
char_act("ôÕÔ ÐÕÓÔÏ.", ch);
return;
}
//act_puts3("$gn{ôÙ} $gn{ÐÅÒÅ×ÏÒÁÞÉ×ÁÅÛØ} $c3{$p}, ×ÙÌÉ×ÁÑ $c3{$T} $U.",
// ch, out, liq_table[out->value[2]].liq_name, IS_WATER(ch->in_room) ? "× ×ÏÄÕ" : "ÎÁ ÚÅÍÌÀ", TO_CHAR | ACT_TRANS, POS_RESTING);
//act_puts3("$n $gn{ÐÅÒÅ×ÏÒÁÞÉ×ÁÅÔ} $c3{$p}, ×ÙÌÉ×ÁÑ $c3{$T} $U.",
// ch, out, liq_table[out->value[2]].liq_name, IS_WATER(ch->in_room) ? "× ×ÏÄÕ" : "ÎÁ ÚÅÍÌÀ", TO_ROOM | ACT_TRANS, POS_RESTING);
act_puts3("$gn{ôÙ} $gn{ÐÅÒÅ×ÏÒÁÞÉ×ÁÅÛØ} $c3{$p}, ×ÙÌÉ×ÁÑ $c3{$T} $U.",
ch, out, liquid_name(out->value[2]), IS_WATER(ch->in_room) ? "× ×ÏÄÕ" : "ÎÁ ÚÅÍÌÀ", TO_CHAR | ACT_TRANS, POS_RESTING);
act_puts3("$n $gn{ÐÅÒÅ×ÏÒÁÞÉ×ÁÅÔ} $c3{$p}, ×ÙÌÉ×ÁÑ $c3{$T} $U.",
ch, out, liquid_name(out->value[2]), IS_WATER(ch->in_room) ? "× ×ÏÄÕ" : "ÎÁ ÚÅÍÌÀ", TO_ROOM | ACT_TRANS, POS_RESTING);
out->value[1] = 0;
//out->value[2] = -1;
return;
}
if ((in = get_obj_here(ch, argument)) == NULL)
{
vch = get_char_room(ch, argument);
if (vch == NULL)
{
char_act("÷ÙÌÉÔØ ËÕÄÁ?", ch);
return;
}
in = get_eq_char(vch, WEAR_HOLD);
if (in == NULL)
{
act("õ $gn{ÔÅÂÑ} ÎÉÞÅÇÏ ÎÅÔ.", ch, out, NULL, TO_CHAR);
return;
}
}
if (in->pIndexData->item_type != ITEM_DRINK_CON)
{
char_act("$gn{ôÙ} $gn{ÍÏÖÅÛØ} ÐÅÒÅÌÉÔØ ÖÉÄËÏÓÔØ ÔÏÌØËÏ × ÄÒÕÇÏÊ ËÏÎÔÅÊÎÅÒ.", ch);
return;
}
if (in == out)
{
char_act("$gn{ôÙ} ÎÅ $gn{ÍÏÖÅÛØ} ÉÚÍÅÎÉÔØ ÚÁËÏÎÙ ÆÉÚÉËÉ!", ch);
return;
}
if (in->value[1] != 0 && in->value[2] != out->value[2])
{
char_act("ôÕÔ ËÁËÁÑ-ÔÏ ÄÒÕÇÁÑ ÖÉÄËÏÓÔØ.", ch);
return;
}
if (out->value[1] == 0)
{
act("ôÕÔ ÎÅÞÅÇÏ ×ÙÌÉÔØ ÉÚ $c1{$p}.", ch, out, NULL, TO_CHAR);
return;
}
if (in->value[0] < 0)
{
act("$gn{ôÙ} ÎÅ ÍÏÖÅÛØ ÎÁÐÏÌÎÉÔØ $c3{$p}.", ch, in, NULL, TO_CHAR);
return;
}
if (in->value[1] >= in->value[0])
{
act("$p ÕÖÅ $gp{ÎÁÐÏÌÎÅÎ} ÄÏ ËÒÁÅ×.", ch, in, NULL, TO_CHAR);
return;
}
amount = UMIN(out->value[1], in->value[0] - in->value[1]);
in->value[1] += amount;
if (out->value[0]>0) out->value[1] -= amount;
in->value[2] = out->value[2];
if (vch == NULL)
{
act_puts3("$gn{ôÙ} $gn{ÐÅÒÅÌÉ×ÁÅÛØ} $c3{$U} ÉÚ $c1{$p} × $c3{$P}.",
ch, out, in, /*liq_table[out->value[2]].liq_name*/liquid_name(out->value[2]), TO_CHAR | ACT_TRANS, POS_RESTING);
act_puts3("$n $gn{ÐÅÒÅÌÉ×ÁÅÔ} $c3{$U} ÉÚ $c1{$p} × $c3{$P}.",
ch, out, in, /*liq_table[out->value[2]].liq_name*/liquid_name(out->value[2]), TO_ROOM | ACT_TRANS, POS_RESTING);
} else
{
act("$gn{ôÙ} $gn{ÎÁÌÉ×ÁÅÛØ} ÎÅÍÎÏÇÏ $c1{$t} ÄÌÑ $c1{$N}.", ch, liquid_name(out->value[2])/*liq_table[out->value[2]].liq_name*/, vch, TO_CHAR);
act("$n $gn{ÎÁÌÉ×ÁÅÔ} $gN{ÔÅÂÅ} ÎÅÍÎÏÇÏ $c1{$t}.", ch, liquid_name(out->value[2])/*liq_table[out->value[2]].liq_name*/, vch, TO_VICT);
act("$n $gn{ÎÁÌÉ×ÁÅÔ} ÎÅÍÎÏÇÏ $c1{$t} ÄÌÑ $c1{$N}.", ch, liquid_name(out->value[2])/*liq_table[out->value[2]].liq_name*/, vch, TO_NOTVICT);
}
}
void do_drink(CHAR_DATA * ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
int amount;
int liquid;
liquid_t *lq;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
for (obj = ch->in_room->contents; obj; obj= obj->next_content)
{
if (obj->pIndexData->item_type == ITEM_FOUNTAIN)
break;
}
if (obj == NULL)
{
char_act("÷ÙÐÉÔØ ÞÔÏ?", ch);
return;
}
} else
{
if ((obj = get_obj_here(ch, arg)) == NULL)
{
char_act("ôÙ ÎÅ ÍÏÖÅÛØ ÜÔÏ ÎÁÊÔÉ.", ch);
return;
}
}
if (!IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10)
{
char_act("ôÙ ÐÒÏÍÁÈÉ×ÁÅÛØÓÑ ÍÉÍÏ Ó×ÏÅÇÏ ÒÔÁ. éë!", ch);
return;
}
switch (obj->pIndexData->item_type)
{
default:
char_act("ôÙ ÎÅ ÍÏÖÅÛØ ÐÉÔØ ÏÔÓÀÄÁ.", ch);
return;
case ITEM_FOUNTAIN:
if ((liquid = obj->value[2]) < 0)
{
bug("Do_drink: bad liquid number %d.", liquid);
liquid = obj->value[2] = 0;
}
lq = LIQUID(liquid);
if (lq == NULL)
{
bug("Do_drink: lq NULL from liquid number %d.", liquid);
lq = LIQUID(0);
}
amount = lq->ssize *3;
//amount = liq_table[liquid].liq_affect[4] * 3;
break;
case ITEM_DRINK_CON:
if (obj->value[1] == 0)
{
char_act("ôÕÔ ÐÕÓÔÏ.", ch);
return;
}
if ((liquid = obj->value[2]) < 0)
{
bug("Do_drink: bad liquid number %d.", liquid);
liquid = obj->value[2] = 0;
}
lq = LIQUID(liquid);
if (lq == NULL)
{
bug("Do_drink: bad liquid number %d.", liquid);
liquid = obj->value[2] = 0;
lq = LIQUID(0);
}
amount = lq->thirst;
if (obj->value[0]>=0)
amount = UMIN(amount, obj->value[1]);
break;
}
if (!IS_NPC(ch) && !IS_IMMORTAL(ch) && ch->pcdata->condition[COND_FULL] > 80)
{
char_act("ô×ÏÊ ÖÅÌÕÄÏË ÐÏÌÏÎ, ÔÙ ÂÏÌØÛÅ ÎÅ ×ÙÐØÅÛØ ÎÉ ËÁÐÌÉ.", ch);
return;
}
act("$n ÐØÅÔ $c3{$T} ÉÚ $c1{$p}.", ch, obj, liquid_name(liquid)/*liq_table[liquid].liq_name*/, TO_ROOM | ACT_TRANS);
act_puts("ôÙ ÐØÅÛØ $c3{$T} ÉÚ $c1{$p}.", ch, obj, liquid_name(liquid)/*liq_table[liquid].liq_name*/, TO_CHAR | ACT_TRANS, POS_DEAD);
if (ch->fighting)
WAIT_STATE(ch, 3 * PULSE_VIOLENCE);
if (!IS_UNDEAD(ch))
{
/*gain_condition(ch, COND_DRUNK, amount * liq_table[liquid].liq_affect[COND_DRUNK] / 36);
gain_condition(ch, COND_FULL, amount * liq_table[liquid].liq_affect[COND_FULL] / 2);
gain_condition(ch, COND_THIRST, amount * liq_table[liquid].liq_affect[COND_THIRST] / 5);
gain_condition(ch, COND_HUNGER, amount * liq_table[liquid].liq_affect[COND_HUNGER] / 1);*/
gain_condition(ch, COND_DRUNK, amount * lq->proof / 36);
gain_condition(ch, COND_FULL, amount * lq->full / 2);
gain_condition(ch, COND_THIRST, amount * lq->thirst / 5);
gain_condition(ch, COND_HUNGER, amount * lq->food / 1);
if (!IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10)
char_act("ôÙ $gn{ÐØÑÎ}.", ch);
if (!IS_NPC(ch) && ch->pcdata->condition[COND_FULL] > 60)
char_act("ô×ÏÊ ÖÅÌÕÄÏË ÐÏÌÏÎ.", ch);
if (!IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] > 60)
char_act("Your thirst is quenched.", ch);
if (obj->value[3] != 0 && !saves_spell(obj->level, ch, DAM_POISON))
{
/* The drink was poisoned ! */
AFFECT_DATA af;
act("$n ÚÅÌÅÎÅÅÔ É È×ÁÔÁÅÔÓÑ ÚÁ ÖÉ×ÏÔ.", ch, NULL, NULL, TO_ROOM);
char_act("ô×ÏÊ ÖÅÌÕÄÏË ÂÕË×ÁÌØÎÏ ×Ù×ÏÒÁÞÉ×ÁÅÔ ÎÁÉÚÎÁÎËÕ.", ch);
af.where = TO_AFFECTS;
af.type = gsn_poison;
af.level = number_fuzzy(amount);
af.duration = 3 * amount;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_POISON;
affect_join(ch, &af);
}
}
if (obj->value[0] > 0)
obj->value[1] = UMAX(obj->value[1]-amount,0);
return;
}
void do_eat(CHAR_DATA * ch, const char *argument)
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
AFFECT_DATA *af;
one_argument(argument, arg, sizeof(arg));
if (arg[0] == '\0')
{
char_act("óØÅÓÔØ ÞÔÏ?", ch);
return;
}
if ((obj = get_obj_carry(ch, arg)) == NULL)
{
char_act("õ ÔÅÂÑ ÎÅÔ ÜÔÏÇÏ ÐÒÅÄÍÅÔÁ.", ch);
return;
}
if (!IS_IMMORTAL(ch))
{
if ((obj->pIndexData->item_type != ITEM_FOOD
|| IS_SET(obj->extra_flags, ITEM_NOT_EDIBLE))
&& obj->pIndexData->item_type != ITEM_PILL)
{
char_act("üÔÏ ÎÅÓ'ÅÄÏÂÎÏ.", ch);
return;
}
if (!IS_NPC(ch) && ch->pcdata->condition[COND_FULL] > 80
&& obj->pIndexData->item_type != ITEM_PILL)
{
char_act("ô×ÏÊ ÖÅÌÕÄÏË ÐÏÌÏÎ.", ch);
return;
}
}
act("$n eats $p.", ch, obj, NULL, TO_ROOM);
act_puts("You eat $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
if (ch->fighting != NULL)
WAIT_STATE(ch, 3 * PULSE_VIOLENCE);
if (IS_UNDEAD(ch))
{
if (obj->pIndexData->vnum == OBJ_VNUM_TORN_HEART
|| obj->pIndexData->vnum == OBJ_VNUM_SEVERED_HEAD
|| obj->pIndexData->vnum == OBJ_VNUM_SLICED_ARM
|| obj->pIndexData->vnum == OBJ_VNUM_SLICED_LEG
|| obj->pIndexData->vnum == OBJ_VNUM_GUTS
|| obj->pIndexData->vnum == OBJ_VNUM_BRAINS)
{
act("$n looks much better, after using $p.", ch, obj, NULL, TO_ROOM);
act_puts("You looks much better, after using $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
if (obj->pIndexData->vnum == OBJ_VNUM_TORN_HEART)
ch->hit += obj->level * 10;
else
ch->hit += obj->level;
ch->hit = UMIN(ch->hit,ch->max_hit);
ch->mana += obj->level * 2;
ch->mana = UMIN(ch->mana,ch->max_mana);
ch->move += obj->level / 2;
ch->move = UMIN(ch->move,ch->max_move);
}
extract_obj(obj);
for (af = ch->affected; af; af = af->next)
{
if (af->type == gsn_cause_critical)
{
if (number_percent() < get_curr_stat(ch, STAT_LCK))
{
affect_remove(ch, af);
char_act("Your wounds stopped bleeding so critically.", ch);
}
}
if (af->type == gsn_cause_serious)
{
if (number_percent() < get_curr_stat(ch, STAT_LCK))
{
affect_remove(ch, af);
char_act("Your wounds stopped bleeding so seriously.", ch);
}
}
if (af->type == gsn_cause_light)
{
if (number_percent() < get_curr_stat(ch, STAT_LCK))
{
affect_remove(ch, af);
char_act("Your wounds stopped bleeding.", ch);
}
}
}
return;
}
switch (obj->pIndexData->item_type)
{
case ITEM_FOOD:
if (!IS_NPC(ch))
{
int condition;
condition = ch->pcdata->condition[COND_HUNGER];
gain_condition(ch, COND_FULL, obj->value[0] * 2);
gain_condition(ch, COND_HUNGER, obj->value[1] * 2);
if (!condition
&& ch->pcdata->condition[COND_HUNGER] > 0)
char_act("ôÙ ÂÏÌØÛÅ ÎÅ ÉÓÐÙÔÙ×ÁÅÛØ ÇÏÌÏÄÁ.", ch);
else if (ch->pcdata->condition[COND_FULL] > 60)
char_act("ô×ÏÊ ÖÅÌÕÄÏË ÐÏÌÏÎ.", ch);
if (obj->pIndexData->vnum == OBJ_VNUM_TORN_HEART)
{
if (IS_CYBORG(ch))
ch->hit = UMIN(ch->max_hit, ch->hit+ch->level*2+obj->level*10);
else
ch->hit = UMIN(ch->max_hit, ch->hit+ch->level+obj->level*5);
char_act("You feel empowered by the blood of your foe.", ch);
}
}
if (obj->value[3] != 0 && !saves_spell(obj->level, ch, DAM_POISON))
{
/* The food was poisoned! */
AFFECT_DATA af;
act("$n ÚÅÌÅÎÅÅÔ É È×ÁÔÁÅÔÓÑ ÚÁ ÖÉ×ÏÔ.", ch, NULL, NULL, TO_ROOM);
char_act("ô×ÏÊ ÖÅÌÕÄÏË ÂÕË×ÁÌØÎÏ ×Ù×ÏÒÁÞÉ×ÁÅÔ ÎÁÉÚÎÁÎËÕ!", ch);
af.where = TO_AFFECTS;
af.type = gsn_poison;
af.level = number_fuzzy(obj->value[0]);
af.duration = 2 * obj->value[0];
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_POISON;
affect_join(ch, &af);
}
break;
case ITEM_PILL:
if (ch->level < obj->level)
{
char_act("üÔÏ ÎÅ ÏËÁÚÙ×ÁÅÔ ×ÉÄÉÍÏÇÏ ×ÏÚÄÅÊÓÔ×ÉÑ ÎÁ ÔÅÂÑ.", ch);
extract_obj(obj);
return;
}
obj_cast_spell(obj->value[1], obj->value[0], ch, ch, NULL);
obj_cast_spell(obj->value[2], obj->value[0], ch, ch, NULL);
obj_cast_spell(obj->value[3], obj->value[0], ch, ch, NULL);
obj_cast_spell(obj->value[4], obj->value[0], ch, ch, NULL);
break;
}
extract_obj(obj);
return;
}
/*
* Remove an object.
*/
bool remove_obj(CHAR_DATA * ch, int iWear, bool fReplace)
{
OBJ_DATA *obj;
AFFECT_DATA af;
if ((obj = get_eq_char(ch, iWear)) == NULL)
return TRUE;
if (!fReplace)
return FALSE;
if (obj->pIndexData->item_type == ITEM_SHAMAN_TATTOO)
{
act_puts("You can't remove $p this way.", ch, obj, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if (IS_SET(obj->extra_flags, ITEM_NOREMOVE))
{
act_puts("ôÙ ÎÅ ÍÏÖÅÛØ ÓÎÑÔØ $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if ((obj->pIndexData->item_type == ITEM_TATTOO) && (!IS_IMMORTAL(ch)))
{
act_puts("ôÙ $gn{ÄÏÌÖÅÎ} ÕÄÁÌÑÔØ $p.", ch, obj, NULL, TO_CHAR, POS_DEAD);
return FALSE;
}
if (iWear == WEAR_STUCK_IN)
{
unequip_char(ch, obj);
if (get_eq_char(ch, WEAR_STUCK_IN) == NULL)
{
if (is_affected(ch, gsn_arrow))
affect_strip(ch, gsn_arrow);
if (is_affected(ch, gsn_spear))
affect_strip(ch, gsn_spear);
if (is_affected(ch, gsn_shuriken))
affect_strip(ch, gsn_shuriken);
if (is_affected(ch, gsn_knife))
affect_strip(ch, gsn_knife);
}
act_puts("ôÙ ×ÙÔÁÓËÉ×ÁÅÛØ $c3{$p}, ÍÏÒÝÁÓØ ÏÔ ÂÏÌÉ.",
ch, obj, NULL, TO_CHAR, POS_DEAD);
act("$n ×ÙÔÁÓËÉ×ÁÅÔ $c3{$p}, ÍÏÒÝÁÓØ ÏÔ ÂÏÌÉ.",
ch, obj, NULL, TO_ROOM);
if (number_percent() < 60)
{
int dam=ch->level-5;
switch (number_bits(2))
{
case 0:
act_puts("ïÊ.. ÐÏÈÏÖÅ ÔÙ $gn{ÐÏ×ÒÅÄÉÌ} ÁÒÔÅÒÉÀ, ËÒÏר ÎÁÞÉÎÁÅÔ ÂÉÔØ ÆÏÎÔÁÎÏÍ.",
ch, obj, NULL, TO_CHAR, POS_DEAD);
act("$n × ÕÖÁÓÅ ÎÁÂÌÀÄÁÅÔ, ËÁË ËÒÏר ÉÚ $c1{$gn{ÏÎ}} ÒÁÎÙ ÂßÅÔ ÆÏÎÔÁÎÏÍ.",
ch, obj, NULL, TO_ROOM);
dam*=2;
break;
case 1:
if (!IS_AFFECTED(ch, AFF_CORRUPTION))
{
act_puts("þÅÒÔ × ÒÁÎÕ ÐÏÐÁÌÁ ÇÒÑÚØ! ôÙ ÞÕ×ÓÔ×ÕÅÛØ ËÁË ÚÁÒÁÖÅÎÉÅ ÎÁÞÉÎÁÅÔ ÒÁÓÐÒÏÓÔÒÁÎÑÔØÓÑ.",
ch, obj, NULL, TO_CHAR, POS_DEAD);
act("$n ÐÏËÒÙ×ÁÅÔÓÑ ËÒÁÓÎÙÍÉ ÐÑÔÎÁÍÉ.",
ch, obj, NULL, TO_ROOM);
af.where = TO_AFFECTS;
af.type = sn_lookup("corruption");
af.level = ch->level * 3/4;
af.duration = (1 + ch->level / 10);
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_CORRUPTION;
affect_join(ch,&af);
}
break;
case 2:
act_puts("õÄÁÌÅÎÉÅ $c1{$p} ÐÒÏÛÌÏ ×ÅÌÉËÏÌÅÐÎÏ, ÒÁÎÁ ÎÁÞÁÌÁ ÚÁÔÑÇÉ×ÁÔØÓÑ.",
ch, obj, NULL, TO_CHAR, POS_DEAD);
dam/=2;
break;
case 3:
break;
}
if (dam < ch->hit)
ch->hit -= dam;
else
ch->hit = 1;
}
WAIT_STATE(ch, 4);
return TRUE;
}
unequip_char(ch, obj);
act("$n ÓÎÉÍÁÅÔ $c3{$p}.", ch, obj, NULL, TO_ROOM);
act_puts("ôÙ ÓÎÉÍÁÅÛØ $c3{$p}.", ch, obj, NULL, TO_CHAR, POS_DEAD);
if ((obj->pIndexData->item_type == ITEM_WEAPON) && IS_OBJ_STAT(obj,ITEM_DEATH))
{
act("The black mist around $p fades away.",ch,obj,NULL,TO_ALL);
REMOVE_BIT(obj->extra_flags,ITEM_DEATH);
}
if ((obj->pIndexData->item_type == ITEM_WEAPON) && IS_OBJ_STAT(obj,ITEM_SINGING))
{
act( "$p ÚÁÍÏÌËÁÅÔ.",ch,obj,NULL,TO_ALL);
REMOVE_BIT(obj->extra_flags,ITEM_SINGING);
}
if (iWear == WEAR_WIELD
&& (obj = get_eq_char(ch, WEAR_SECOND_WIELD)) != NULL)
{
unequip_char(ch, obj);
equip_char(ch, obj, WEAR_WIELD);
if (is_affected(ch,gsn_deathgrip) && !IS_OBJ_STAT(obj,ITEM_DEATH))
{
SET_BIT( obj->extra_flags, ITEM_DEATH);
act("$p flickers with dark power.",ch,obj,NULL,TO_ALL);
}
if (!is_affected(ch,gsn_deathgrip) && IS_OBJ_STAT(obj,ITEM_DEATH))
{
REMOVE_BIT(obj->extra_flags, ITEM_DEATH);
}
if (is_affected(ch, gsn_weaponsong) && !IS_OBJ_STAT(obj,ITEM_SINGING))
{
int my_chance = get_skill(ch, gsn_weaponsong);
if (IS_WEAPON_STAT(obj,WEAPON_FLAMING)) my_chance -= 10;
if (IS_WEAPON_STAT(obj,WEAPON_FROST))my_chance -= 10;
if (IS_WEAPON_STAT(obj,WEAPON_SHARP)) my_chance -= 10;
if (IS_WEAPON_STAT(obj,WEAPON_VORPAL)) my_chance -= 10;
if (IS_WEAPON_STAT(obj,WEAPON_SHOCKING)) my_chance -= 10;
if (IS_WEAPON_STAT(obj,WEAPON_RADIATION)) my_chance -= 10;
if (ch->mana > ch->level)
ch->mana -= ch->level;
else
{
char_act("ôÅÂÅ ÎÅ È×ÁÔÁÅÔ ÜÎÅÒÇÉÉ...", ch);
my_chance = 0;
}
if (number_percent() < my_chance)
{
SET_BIT( obj->extra_flags, ITEM_SINGING);
act("$p ÚÁÐÅ×ÁÅÔ ÐÅÓÎØ ×ÍÅÓÔÅ Ó ÔÏÂÏÊ.", ch, obj, NULL, TO_CHAR);
act("$p ÚÁÐÅ×ÁÅÔ ÐÅÓÎØ ×ÍÅÓÔÅ Ó $c4{$n}.", ch, obj, ch, TO_NOTVICT);
} else
{
act("$p ÍÏÌÞÉÔ..", ch, obj, NULL, TO_CHAR);
}
}
if (!is_affected(ch,gsn_weaponsong) && IS_OBJ_STAT(obj,ITEM_SINGING))
{
REMOVE_BIT(obj->extra_flags, ITEM_SINGING);
}
}
return TRUE;
}
/*
* Wear one object.
* Optional replacement of existing objects.
* Big repetitive code, ick.
*/
#define CLASS_RACE_WEAR(loc) \
if (!class_can_wear(ch, loc)) { \
act_puts("ôÙ ÎÅ ÚÎÁÅÛØ ËÁË ÉÓÐÏÌØÚÏ×ÁÔØ $c3{$p}.", ch, obj, NULL, TO_CHAR, POS_DEAD); \
return; \
} \
if (!race_can_wear(ch, loc)) { \
act_puts("ôÅÂÅ ÎÅËÕÄÁ ÎÁÄÅÔØ $c3{$p}.", ch, obj, NULL, TO_CHAR, POS_DEAD); \
return; \
}
void wear_obj(CHAR_DATA * ch, OBJ_DATA * obj, bool fReplace)
{
clan_t *clan;
int wear_level = get_wear_level(ch, obj);
if (obj->pIndexData->item_type == ITEM_PILL)
{
char_act("ïÄÅÔØ ÐÉÌÀÌÀ? íÏÖÅÔ ÔÅÂÅ ÓÔÏÉÔ ÏÂÒÁÔÉÔÓÑ Ë ×ÒÁÞÕ?", ch);
return;
}
if (obj->pIndexData->item_type == ITEM_KEYRING)
{
char_act("ïÄÅÔØ ÂÒÅÌÏË? ôÙ ÎÁ×ÅÒÎÏÅ ÈÏÞÅÛØ ÞÔÏÂÙ Õ ÔÅÂÑ ÓÐÅÒÌÉ ×ÓÅ ËÌÀÞÉ!", cShowing the first 100 KB of 218.9 KB. Download the archive for the full file.