#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "merc.h"
#include "interp.h"
Include dependency graph for act_obj.c:

Go to the source code of this file.
Defines | |
| #define | CD CHAR_DATA |
| #define | OD OBJ_DATA |
Functions | |
| OD *get_obj_keeper | args ((CHAR_DATA *ch, CHAR_DATA *keeper, char *argument)) |
| void obj_to_keeper | args ((OBJ_DATA *obj, CHAR_DATA *ch)) |
| int get_cost | args ((CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy)) |
| CD *find_keeper | args ((CHAR_DATA *ch)) |
| void wear_obj | args ((CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace)) |
| bool remove_obj | args ((CHAR_DATA *ch, int iWear, bool fReplace)) |
| bool | can_loot (CHAR_DATA *ch, OBJ_DATA *obj) |
| void | do_brandish (CHAR_DATA *ch, char *argument) |
| void | do_buy (CHAR_DATA *ch, char *argument) |
| void | do_drink (CHAR_DATA *ch, char *argument) |
| void | do_drop (CHAR_DATA *ch, char *argument) |
| void | do_eat (CHAR_DATA *ch, char *argument) |
| void | do_envenom (CHAR_DATA *ch, char *argument) |
| void | do_fill (CHAR_DATA *ch, char *argument) |
| void | do_get (CHAR_DATA *ch, char *argument) |
| void | do_give (CHAR_DATA *ch, char *argument) |
| void | do_list (CHAR_DATA *ch, char *argument) |
| void | do_pour (CHAR_DATA *ch, char *argument) |
| void | do_put (CHAR_DATA *ch, char *argument) |
| void | do_quaff (CHAR_DATA *ch, char *argument) |
| void | do_recite (CHAR_DATA *ch, char *argument) |
| void | do_remove (CHAR_DATA *ch, char *argument) |
| void | do_sacrifice (CHAR_DATA *ch, char *argument) |
| void | do_second (CHAR_DATA *ch, char *argument) |
| void | do_sell (CHAR_DATA *ch, char *argument) |
| void | do_steal (CHAR_DATA *ch, char *argument) |
| void | do_value (CHAR_DATA *ch, char *argument) |
| void | do_wear (CHAR_DATA *ch, char *argument) |
| void | do_zap (CHAR_DATA *ch, char *argument) |
| CHAR_DATA * | find_keeper (CHAR_DATA *ch) |
| int | get_cost (CHAR_DATA *keeper, OBJ_DATA *obj, bool fBuy) |
| void | get_obj (CHAR_DATA *ch, OBJ_DATA *obj, OBJ_DATA *container) |
| OBJ_DATA * | get_obj_keeper (CHAR_DATA *ch, CHAR_DATA *keeper, char *argument) |
| void | obj_to_keeper (OBJ_DATA *obj, CHAR_DATA *ch) |
| bool | remove_obj (CHAR_DATA *ch, int iWear, bool fReplace) |
| void | wear_obj (CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 61 of file act_obj.c. References char_list, FALSE, IS_IMMORTAL, IS_NPC, is_same_group(), IS_SET, char_data::name, char_data::next, PLR_CANLOOT, str_cmp(), and TRUE. Referenced by do_get(), get_obj(), mobile_update(), and spec_janitor(). 00062 {
00063 CHAR_DATA *owner, *wch;
00064
00065 if (IS_IMMORTAL (ch))
00066 return TRUE;
00067
00068 if (!obj->owner || obj->owner == NULL)
00069 return TRUE;
00070
00071 owner = NULL;
00072 for (wch = char_list; wch != NULL; wch = wch->next)
00073 if (!str_cmp (wch->name, obj->owner))
00074 owner = wch;
00075
00076 if (owner == NULL)
00077 return TRUE;
00078
00079 if (!str_cmp (ch->name, owner->name))
00080 return TRUE;
00081
00082 if (!IS_NPC (owner) && IS_SET (owner->act, PLR_CANLOOT))
00083 return TRUE;
00084
00085 if (is_same_group (ch, owner))
00086 return TRUE;
00087
00088 return FALSE;
00089 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 2102 of file act_obj.c. References act, bug(), check_improve(), extract_obj(), FALSE, get_eq_char(), get_skill(), gsn_staves, char_data::in_room, IS_NPC, ITEM_STAFF, obj_data::item_type, obj_data::level, MAX_SKILL, char_data::next_in_room, number_percent(), obj_cast_spell(), room_index_data::people, PULSE_VIOLENCE, send_to_char(), skill_table, skill_type::spell_fun, TAR_CHAR_DEFENSIVE, TAR_CHAR_OFFENSIVE, TAR_CHAR_SELF, TAR_IGNORE, TO_CHAR, TO_ROOM, TRUE, obj_data::value, WAIT_STATE, and WEAR_HOLD. 02103 {
02104 CHAR_DATA *vch;
02105 CHAR_DATA *vch_next;
02106 OBJ_DATA *staff;
02107 int sn;
02108
02109 if ((staff = get_eq_char (ch, WEAR_HOLD)) == NULL)
02110 {
02111 send_to_char ("You hold nothing in your hand.\n\r", ch);
02112 return;
02113 }
02114
02115 if (staff->item_type != ITEM_STAFF)
02116 {
02117 send_to_char ("You can brandish only with a staff.\n\r", ch);
02118 return;
02119 }
02120
02121 if ((sn = staff->value[3]) < 0
02122 || sn >= MAX_SKILL || skill_table[sn].spell_fun == 0)
02123 {
02124 bug ("Do_brandish: bad sn %d.", sn);
02125 return;
02126 }
02127
02128 WAIT_STATE (ch, 2 * PULSE_VIOLENCE);
02129
02130 if (staff->value[2] > 0)
02131 {
02132 act ("$n brandishes $p.", ch, staff, NULL, TO_ROOM);
02133 act ("You brandish $p.", ch, staff, NULL, TO_CHAR);
02134 if (ch->level < staff->level
02135 || number_percent () >= 20 + get_skill (ch, gsn_staves) * 4 / 5)
02136 {
02137 act ("You fail to invoke $p.", ch, staff, NULL, TO_CHAR);
02138 act ("...and nothing happens.", ch, NULL, NULL, TO_ROOM);
02139 check_improve (ch, gsn_staves, FALSE, 2);
02140 }
02141
02142 else
02143 for (vch = ch->in_room->people; vch; vch = vch_next)
02144 {
02145 vch_next = vch->next_in_room;
02146
02147 switch (skill_table[sn].target)
02148 {
02149 default:
02150 bug ("Do_brandish: bad target for sn %d.", sn);
02151 return;
02152
02153 case TAR_IGNORE:
02154 if (vch != ch)
02155 continue;
02156 break;
02157
02158 case TAR_CHAR_OFFENSIVE:
02159 if (IS_NPC (ch) ? IS_NPC (vch) : !IS_NPC (vch))
02160 continue;
02161 break;
02162
02163 case TAR_CHAR_DEFENSIVE:
02164 if (IS_NPC (ch) ? !IS_NPC (vch) : IS_NPC (vch))
02165 continue;
02166 break;
02167
02168 case TAR_CHAR_SELF:
02169 if (vch != ch)
02170 continue;
02171 break;
02172 }
02173
02174 obj_cast_spell (staff->value[3], staff->value[0], ch, vch,
02175 NULL);
02176 check_improve (ch, gsn_staves, TRUE, 2);
02177 }
02178 }
02179
02180 if (--staff->value[2] <= 0)
02181 {
02182 act ("$n's $p blazes bright and is gone.", ch, staff, NULL, TO_ROOM);
02183 act ("Your $p blazes bright and is gone.", ch, staff, NULL, TO_CHAR);
02184 extract_obj (staff);
02185 }
02186
02187 return;
02188 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 2655 of file act_obj.c. References act, char_data::act, ACT_PET, add_follower(), AFF_CHARM, char_data::affected_by, bug(), can_carry_n(), can_carry_w(), can_see_obj(), char_to_room(), check_improve(), char_data::comm, COMM_NOCHANNELS, COMM_NOSHOUT, COMM_NOTELL, obj_data::cost, create_mobile(), create_object(), deduct_cost(), char_data::description, obj_data::extra_flags, find_keeper(), free_string(), get_char_room(), get_cost(), get_obj_keeper(), get_obj_number(), get_obj_weight(), get_room_index(), get_skill(), char_data::gold, gsn_haggle, char_data::in_room, IS_NPC, IS_OBJ_STAT, IS_SET, ITEM_HAD_TIMER, ITEM_INVENTORY, ITEM_SELL_EXTRACT, char_data::leader, char_data::level, MAX_INPUT_LENGTH, MAX_STRING_LENGTH, mult_argument(), char_data::name, obj_data::next_content, number_percent(), obj_from_char(), obj_to_char(), one_argument(), char_data::pet, obj_data::pIndexData, char_data::pIndexData, REMOVE_BIT, char_data::reply, ROOM_PET_SHOP, send_to_char(), SET_BIT, obj_data::short_descr, char_data::silver, smash_tilde(), str_cmp(), str_dup(), obj_data::timer, TO_CHAR, TO_ROOM, TO_VICT, and TRUE. 02656 {
02657 char buf[MAX_STRING_LENGTH];
02658 int cost, roll;
02659
02660 if (argument[0] == '\0')
02661 {
02662 send_to_char ("Buy what?\n\r", ch);
02663 return;
02664 }
02665
02666 if (IS_SET (ch->in_room->room_flags, ROOM_PET_SHOP))
02667 {
02668 char arg[MAX_INPUT_LENGTH];
02669 char buf[MAX_STRING_LENGTH];
02670 CHAR_DATA *pet;
02671 ROOM_INDEX_DATA *pRoomIndexNext;
02672 ROOM_INDEX_DATA *in_room;
02673
02674 smash_tilde (argument);
02675
02676 if (IS_NPC (ch))
02677 return;
02678
02679 argument = one_argument (argument, arg);
02680
02681 /* hack to make new thalos pets work */
02682 if (ch->in_room->vnum == 9621)
02683 pRoomIndexNext = get_room_index (9706);
02684 else
02685 pRoomIndexNext = get_room_index (ch->in_room->vnum + 1);
02686 if (pRoomIndexNext == NULL)
02687 {
02688 bug ("Do_buy: bad pet shop at vnum %d.", ch->in_room->vnum);
02689 send_to_char ("Sorry, you can't buy that here.\n\r", ch);
02690 return;
02691 }
02692
02693 in_room = ch->in_room;
02694 ch->in_room = pRoomIndexNext;
02695 pet = get_char_room (ch, arg);
02696 ch->in_room = in_room;
02697
02698 if (pet == NULL || !IS_SET (pet->act, ACT_PET))
02699 {
02700 send_to_char ("Sorry, you can't buy that here.\n\r", ch);
02701 return;
02702 }
02703
02704 if (ch->pet != NULL)
02705 {
02706 send_to_char ("You already own a pet.\n\r", ch);
02707 return;
02708 }
02709
02710 cost = 10 * pet->level * pet->level;
02711
02712 if ((ch->silver + 100 * ch->gold) < cost)
02713 {
02714 send_to_char ("You can't afford it.\n\r", ch);
02715 return;
02716 }
02717
02718 if (ch->level < pet->level)
02719 {
02720 send_to_char
02721 ("You're not powerful enough to master this pet.\n\r", ch);
02722 return;
02723 }
02724
02725 /* haggle */
02726 roll = number_percent ();
02727 if (roll < get_skill (ch, gsn_haggle))
02728 {
02729 cost -= cost / 2 * roll / 100;
02730 sprintf (buf, "You haggle the price down to %d coins.\n\r", cost);
02731 send_to_char (buf, ch);
02732 check_improve (ch, gsn_haggle, TRUE, 4);
02733
02734 }
02735
02736 deduct_cost (ch, cost);
02737 pet = create_mobile (pet->pIndexData);
02738 SET_BIT (pet->act, ACT_PET);
02739 SET_BIT (pet->affected_by, AFF_CHARM);
02740 pet->comm = COMM_NOTELL | COMM_NOSHOUT | COMM_NOCHANNELS;
02741
02742 argument = one_argument (argument, arg);
02743 if (arg[0] != '\0')
02744 {
02745 sprintf (buf, "%s %s", pet->name, arg);
02746 free_string (pet->name);
02747 pet->name = str_dup (buf);
02748 }
02749
02750 sprintf (buf, "%sA neck tag says 'I belong to %s'.\n\r",
02751 pet->description, ch->name);
02752 free_string (pet->description);
02753 pet->description = str_dup (buf);
02754
02755 char_to_room (pet, ch->in_room);
02756 add_follower (pet, ch);
02757 pet->leader = ch;
02758 ch->pet = pet;
02759 send_to_char ("Enjoy your pet.\n\r", ch);
02760 act ("$n bought $N as a pet.", ch, NULL, pet, TO_ROOM);
02761 return;
02762 }
02763 else
02764 {
02765 CHAR_DATA *keeper;
02766 OBJ_DATA *obj, *t_obj;
02767 char arg[MAX_INPUT_LENGTH];
02768 int number, count = 1;
02769
02770 if ((keeper = find_keeper (ch)) == NULL)
02771 return;
02772
02773 number = mult_argument (argument, arg);
02774 obj = get_obj_keeper (ch, keeper, arg);
02775 cost = get_cost (keeper, obj, TRUE);
02776
02777 if (number < 1 || number > 99)
02778 {
02779 act ("$n tells you 'Get real!", keeper, NULL, ch, TO_VICT);
02780 return;
02781 }
02782
02783 if (cost <= 0 || !can_see_obj (ch, obj))
02784 {
02785 act ("$n tells you 'I don't sell that -- try 'list''.",
02786 keeper, NULL, ch, TO_VICT);
02787 ch->reply = keeper;
02788 return;
02789 }
02790
02791 if (!IS_OBJ_STAT (obj, ITEM_INVENTORY))
02792 {
02793 for (t_obj = obj->next_content;
02794 count < number && t_obj != NULL; t_obj = t_obj->next_content)
02795 {
02796 if (t_obj->pIndexData == obj->pIndexData
02797 && !str_cmp (t_obj->short_descr, obj->short_descr))
02798 count++;
02799 else
02800 break;
02801 }
02802
02803 if (count < number)
02804 {
02805 act ("$n tells you 'I don't have that many in stock.",
02806 keeper, NULL, ch, TO_VICT);
02807 ch->reply = keeper;
02808 return;
02809 }
02810 }
02811
02812 if ((ch->silver + ch->gold * 100) < cost * number)
02813 {
02814 if (number > 1)
02815 act ("$n tells you 'You can't afford to buy that many.",
02816 keeper, obj, ch, TO_VICT);
02817 else
02818 act ("$n tells you 'You can't afford to buy $p'.",
02819 keeper, obj, ch, TO_VICT);
02820 ch->reply = keeper;
02821 return;
02822 }
02823
02824 if (obj->level > ch->level)
02825 {
02826 act ("$n tells you 'You can't use $p yet'.",
02827 keeper, obj, ch, TO_VICT);
02828 ch->reply = keeper;
02829 return;
02830 }
02831
02832 if (ch->carry_number + number * get_obj_number (obj) >
02833 can_carry_n (ch))
02834 {
02835 send_to_char ("You can't carry that many items.\n\r", ch);
02836 return;
02837 }
02838
02839 if (ch->carry_weight + number * get_obj_weight (obj) >
02840 can_carry_w (ch))
02841 {
02842 send_to_char ("You can't carry that much weight.\n\r", ch);
02843 return;
02844 }
02845
02846 /* haggle */
02847 roll = number_percent ();
02848 if (!IS_OBJ_STAT (obj, ITEM_SELL_EXTRACT)
02849 && roll < get_skill (ch, gsn_haggle))
02850 {
02851 cost -= obj->cost / 2 * roll / 100;
02852 act ("You haggle with $N.", ch, NULL, keeper, TO_CHAR);
02853 check_improve (ch, gsn_haggle, TRUE, 4);
02854 }
02855
02856 if (number > 1)
02857 {
02858 sprintf (buf, "$n buys $p[%d].", number);
02859 act (buf, ch, obj, NULL, TO_ROOM);
02860 sprintf (buf, "You buy $p[%d] for %d silver.", number,
02861 cost * number);
02862 act (buf, ch, obj, NULL, TO_CHAR);
02863 }
02864 else
02865 {
02866 act ("$n buys $p.", ch, obj, NULL, TO_ROOM);
02867 sprintf (buf, "You buy $p for %d silver.", cost);
02868 act (buf, ch, obj, NULL, TO_CHAR);
02869 }
02870 deduct_cost (ch, cost * number);
02871 keeper->gold += cost * number / 100;
02872 keeper->silver += cost * number - (cost * number / 100) * 100;
02873
02874 for (count = 0; count < number; count++)
02875 {
02876 if (IS_SET (obj->extra_flags, ITEM_INVENTORY))
02877 t_obj = create_object (obj->pIndexData, obj->level);
02878 else
02879 {
02880 t_obj = obj;
02881 obj = obj->next_content;
02882 obj_from_char (t_obj);
02883 }
02884
02885 if (t_obj->timer > 0 && !IS_OBJ_STAT (t_obj, ITEM_HAD_TIMER))
02886 t_obj->timer = 0;
02887 REMOVE_BIT (t_obj->extra_flags, ITEM_HAD_TIMER);
02888 obj_to_char (t_obj, ch);
02889 if (cost < t_obj->cost)
02890 t_obj->cost = cost;
02891 }
02892 }
02893 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1263 of file act_obj.c. References act, AFF_POISON, affect_join(), APPLY_NONE, affect_data::bitvector, bug(), COND_DRUNK, COND_FULL, COND_HUNGER, COND_THIRST, room_index_data::contents, affect_data::duration, gain_condition(), get_obj_here(), gsn_poison, obj_data::in_room, IS_IMMORTAL, IS_NPC, ITEM_DRINK_CON, ITEM_FOUNTAIN, obj_data::item_type, affect_data::level, liq_type::liq_affect, liq_table, affect_data::location, MAX_INPUT_LENGTH, affect_data::modifier, obj_data::next_content, number_fuzzy(), one_argument(), send_to_char(), TO_AFFECTS, TO_CHAR, TO_ROOM, affect_data::type, UMIN, obj_data::value, and affect_data::where. 01264 {
01265 char arg[MAX_INPUT_LENGTH];
01266 OBJ_DATA *obj;
01267 int amount;
01268 int liquid;
01269
01270 one_argument (argument, arg);
01271
01272 if (arg[0] == '\0')
01273 {
01274 for (obj = ch->in_room->contents; obj; obj = obj->next_content)
01275 {
01276 if (obj->item_type == ITEM_FOUNTAIN)
01277 break;
01278 }
01279
01280 if (obj == NULL)
01281 {
01282 send_to_char ("Drink what?\n\r", ch);
01283 return;
01284 }
01285 }
01286 else
01287 {
01288 if ((obj = get_obj_here (ch, arg)) == NULL)
01289 {
01290 send_to_char ("You can't find it.\n\r", ch);
01291 return;
01292 }
01293 }
01294
01295 if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10)
01296 {
01297 send_to_char ("You fail to reach your mouth. *Hic*\n\r", ch);
01298 return;
01299 }
01300
01301 switch (obj->item_type)
01302 {
01303 default:
01304 send_to_char ("You can't drink from that.\n\r", ch);
01305 return;
01306
01307 case ITEM_FOUNTAIN:
01308 if ((liquid = obj->value[2]) < 0)
01309 {
01310 bug ("Do_drink: bad liquid number %d.", liquid);
01311 liquid = obj->value[2] = 0;
01312 }
01313 amount = liq_table[liquid].liq_affect[4] * 3;
01314 break;
01315
01316 case ITEM_DRINK_CON:
01317 if (obj->value[1] <= 0)
01318 {
01319 send_to_char ("It is already empty.\n\r", ch);
01320 return;
01321 }
01322
01323 if ((liquid = obj->value[2]) < 0)
01324 {
01325 bug ("Do_drink: bad liquid number %d.", liquid);
01326 liquid = obj->value[2] = 0;
01327 }
01328
01329 amount = liq_table[liquid].liq_affect[4];
01330 amount = UMIN (amount, obj->value[1]);
01331 break;
01332 }
01333 if (!IS_NPC (ch) && !IS_IMMORTAL (ch)
01334 && ch->pcdata->condition[COND_FULL] > 45)
01335 {
01336 send_to_char ("You're too full to drink more.\n\r", ch);
01337 return;
01338 }
01339
01340 act ("$n drinks $T from $p.",
01341 ch, obj, liq_table[liquid].liq_name, TO_ROOM);
01342 act ("You drink $T from $p.",
01343 ch, obj, liq_table[liquid].liq_name, TO_CHAR);
01344
01345 gain_condition (ch, COND_DRUNK,
01346 amount * liq_table[liquid].liq_affect[COND_DRUNK] / 36);
01347 gain_condition (ch, COND_FULL,
01348 amount * liq_table[liquid].liq_affect[COND_FULL] / 4);
01349 gain_condition (ch, COND_THIRST,
01350 amount * liq_table[liquid].liq_affect[COND_THIRST] / 10);
01351 gain_condition (ch, COND_HUNGER,
01352 amount * liq_table[liquid].liq_affect[COND_HUNGER] / 2);
01353
01354 if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10)
01355 send_to_char ("You feel drunk.\n\r", ch);
01356 if (!IS_NPC (ch) && ch->pcdata->condition[COND_FULL] > 40)
01357 send_to_char ("You are full.\n\r", ch);
01358 if (!IS_NPC (ch) && ch->pcdata->condition[COND_THIRST] > 40)
01359 send_to_char ("Your thirst is quenched.\n\r", ch);
01360
01361 if (obj->value[3] != 0)
01362 {
01363 /* The drink was poisoned ! */
01364 AFFECT_DATA af;
01365
01366 act ("$n chokes and gags.", ch, NULL, NULL, TO_ROOM);
01367 send_to_char ("You choke and gag.\n\r", ch);
01368 af.where = TO_AFFECTS;
01369 af.type = gsn_poison;
01370 af.level = number_fuzzy (amount);
01371 af.duration = 3 * amount;
01372 af.location = APPLY_NONE;
01373 af.modifier = 0;
01374 af.bitvector = AFF_POISON;
01375 affect_join (ch, &af);
01376 }
01377
01378 if (obj->value[0] > 0)
01379 obj->value[1] -= amount;
01380
01381 return;
01382 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 598 of file act_obj.c. References act, can_drop_obj(), can_see_obj(), room_index_data::contents, create_money(), extract_obj(), FALSE, get_obj_carry(), obj_data::in_room, is_name(), is_number(), IS_OBJ_STAT, ITEM_MELT_DROP, MAX_INPUT_LENGTH, obj_data::name, obj_data::next_content, obj_from_char(), obj_to_room(), OBJ_VNUM_COINS, OBJ_VNUM_GOLD_ONE, OBJ_VNUM_GOLD_SOME, OBJ_VNUM_SILVER_ONE, OBJ_VNUM_SILVER_SOME, one_argument(), obj_data::pIndexData, send_to_char(), str_cmp(), str_prefix(), TO_CHAR, TO_ROOM, TRUE, obj_data::value, obj_index_data::vnum, obj_data::wear_loc, and WEAR_NONE. 00599 {
00600 char arg[MAX_INPUT_LENGTH];
00601 OBJ_DATA *obj;
00602 OBJ_DATA *obj_next;
00603 bool found;
00604
00605 argument = one_argument (argument, arg);
00606
00607 if (arg[0] == '\0')
00608 {
00609 send_to_char ("Drop what?\n\r", ch);
00610 return;
00611 }
00612
00613 if (is_number (arg))
00614 {
00615 /* 'drop NNNN coins' */
00616 int amount, gold = 0, silver = 0;
00617
00618 amount = atoi (arg);
00619 argument = one_argument (argument, arg);
00620 if (amount <= 0
00621 || (str_cmp (arg, "coins") && str_cmp (arg, "coin") &&
00622 str_cmp (arg, "gold") && str_cmp (arg, "silver")))
00623 {
00624 send_to_char ("Sorry, you can't do that.\n\r", ch);
00625 return;
00626 }
00627
00628 if (!str_cmp (arg, "coins") || !str_cmp (arg, "coin")
00629 || !str_cmp (arg, "silver"))
00630 {
00631 if (ch->silver < amount)
00632 {
00633 send_to_char ("You don't have that much silver.\n\r", ch);
00634 return;
00635 }
00636
00637 ch->silver -= amount;
00638 silver = amount;
00639 }
00640
00641 else
00642 {
00643 if (ch->gold < amount)
00644 {
00645 send_to_char ("You don't have that much gold.\n\r", ch);
00646 return;
00647 }
00648
00649 ch->gold -= amount;
00650 gold = amount;
00651 }
00652
00653 for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
00654 {
00655 obj_next = obj->next_content;
00656
00657 switch (obj->pIndexData->vnum)
00658 {
00659 case OBJ_VNUM_SILVER_ONE:
00660 silver += 1;
00661 extract_obj (obj);
00662 break;
00663
00664 case OBJ_VNUM_GOLD_ONE:
00665 gold += 1;
00666 extract_obj (obj);
00667 break;
00668
00669 case OBJ_VNUM_SILVER_SOME:
00670 silver += obj->value[0];
00671 extract_obj (obj);
00672 break;
00673
00674 case OBJ_VNUM_GOLD_SOME:
00675 gold += obj->value[1];
00676 extract_obj (obj);
00677 break;
00678
00679 case OBJ_VNUM_COINS:
00680 silver += obj->value[0];
00681 gold += obj->value[1];
00682 extract_obj (obj);
00683 break;
00684 }
00685 }
00686
00687 obj_to_room (create_money (gold, silver), ch->in_room);
00688 act ("$n drops some coins.", ch, NULL, NULL, TO_ROOM);
00689 send_to_char ("OK.\n\r", ch);
00690 return;
00691 }
00692
00693 if (str_cmp (arg, "all") && str_prefix ("all.", arg))
00694 {
00695 /* 'drop obj' */
00696 if ((obj = get_obj_carry (ch, arg, ch)) == NULL)
00697 {
00698 send_to_char ("You do not have that item.\n\r", ch);
00699 return;
00700 }
00701
00702 if (!can_drop_obj (ch, obj))
00703 {
00704 send_to_char ("You can't let go of it.\n\r", ch);
00705 return;
00706 }
00707
00708 obj_from_char (obj);
00709 obj_to_room (obj, ch->in_room);
00710 act ("$n drops $p.", ch, obj, NULL, TO_ROOM);
00711 act ("You drop $p.", ch, obj, NULL, TO_CHAR);
00712 if (IS_OBJ_STAT (obj, ITEM_MELT_DROP))
00713 {
00714 act ("$p dissolves into smoke.", ch, obj, NULL, TO_ROOM);
00715 act ("$p dissolves into smoke.", ch, obj, NULL, TO_CHAR);
00716 extract_obj (obj);
00717 }
00718 }
00719 else
00720 {
00721 /* 'drop all' or 'drop all.obj' */
00722 found = FALSE;
00723 for (obj = ch->carrying; obj != NULL; obj = obj_next)
00724 {
00725 obj_next = obj->next_content;
00726
00727 if ((arg[3] == '\0' || is_name (&arg[4], obj->name))
00728 && can_see_obj (ch, obj)
00729 && obj->wear_loc == WEAR_NONE && can_drop_obj (ch, obj))
00730 {
00731 found = TRUE;
00732 obj_from_char (obj);
00733 obj_to_room (obj, ch->in_room);
00734 act ("$n drops $p.", ch, obj, NULL, TO_ROOM);
00735 act ("You drop $p.", ch, obj, NULL, TO_CHAR);
00736 if (IS_OBJ_STAT (obj, ITEM_MELT_DROP))
00737 {
00738 act ("$p dissolves into smoke.", ch, obj, NULL, TO_ROOM);
00739 act ("$p dissolves into smoke.", ch, obj, NULL, TO_CHAR);
00740 extract_obj (obj);
00741 }
00742 }
00743 }
00744
00745 if (!found)
00746 {
00747 if (arg[3] == '\0')
00748 act ("You are not carrying anything.",
00749 ch, NULL, arg, TO_CHAR);
00750 else
00751 act ("You are not carrying any $T.",
00752 ch, NULL, &arg[4], TO_CHAR);
00753 }
00754 }
00755
00756 return;
00757 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1386 of file act_obj.c. References act, AFF_POISON, affect_join(), APPLY_NONE, affect_data::bitvector, COND_FULL, COND_HUNGER, obj_data::condition, affect_data::duration, extract_obj(), gain_condition(), get_obj_carry(), gsn_poison, IS_IMMORTAL, IS_NPC, ITEM_FOOD, ITEM_PILL, obj_data::item_type, affect_data::level, affect_data::location, MAX_INPUT_LENGTH, affect_data::modifier, number_fuzzy(), obj_cast_spell(), one_argument(), send_to_char(), TO_AFFECTS, TO_CHAR, TO_ROOM, affect_data::type, obj_data::value, and affect_data::where. 01387 {
01388 char arg[MAX_INPUT_LENGTH];
01389 OBJ_DATA *obj;
01390
01391 one_argument (argument, arg);
01392 if (arg[0] == '\0')
01393 {
01394 send_to_char ("Eat what?\n\r", ch);
01395 return;
01396 }
01397
01398 if ((obj = get_obj_carry (ch, arg, ch)) == NULL)
01399 {
01400 send_to_char ("You do not have that item.\n\r", ch);
01401 return;
01402 }
01403
01404 if (!IS_IMMORTAL (ch))
01405 {
01406 if (obj->item_type != ITEM_FOOD && obj->item_type != ITEM_PILL)
01407 {
01408 send_to_char ("That's not edible.\n\r", ch);
01409 return;
01410 }
01411
01412 if (!IS_NPC (ch) && ch->pcdata->condition[COND_FULL] > 40)
01413 {
01414 send_to_char ("You are too full to eat more.\n\r", ch);
01415 return;
01416 }
01417 }
01418
01419 act ("$n eats $p.", ch, obj, NULL, TO_ROOM);
01420 act ("You eat $p.", ch, obj, NULL, TO_CHAR);
01421
01422 switch (obj->item_type)
01423 {
01424
01425 case ITEM_FOOD:
01426 if (!IS_NPC (ch))
01427 {
01428 int condition;
01429
01430 condition = ch->pcdata->condition[COND_HUNGER];
01431 gain_condition (ch, COND_FULL, obj->value[0]);
01432 gain_condition (ch, COND_HUNGER, obj->value[1]);
01433 if (condition == 0 && ch->pcdata->condition[COND_HUNGER] > 0)
01434 send_to_char ("You are no longer hungry.\n\r", ch);
01435 else if (ch->pcdata->condition[COND_FULL] > 40)
01436 send_to_char ("You are full.\n\r", ch);
01437 }
01438
01439 if (obj->value[3] != 0)
01440 {
01441 /* The food was poisoned! */
01442 AFFECT_DATA af;
01443
01444 act ("$n chokes and gags.", ch, 0, 0, TO_ROOM);
01445 send_to_char ("You choke and gag.\n\r", ch);
01446
01447 af.where = TO_AFFECTS;
01448 af.type = gsn_poison;
01449 af.level = number_fuzzy (obj->value[0]);
01450 af.duration = 2 * obj->value[0];
01451 af.location = APPLY_NONE;
01452 af.modifier = 0;
01453 af.bitvector = AFF_POISON;
01454 affect_join (ch, &af);
01455 }
01456 break;
01457
01458 case ITEM_PILL:
01459 obj_cast_spell (obj->value[1], obj->value[0], ch, ch, NULL);
01460 obj_cast_spell (obj->value[2], obj->value[0], ch, ch, NULL);
01461 obj_cast_spell (obj->value[3], obj->value[0], ch, ch, NULL);
01462 break;
01463 }
01464
01465 extract_obj (obj);
01466 return;
01467 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 951 of file act_obj.c. References act, affect_to_obj(), attack_table, affect_data::bitvector, check_improve(), DAM_BASH, attack_type::damage, affect_data::duration, FALSE, get_obj_list(), get_skill(), gsn_envenom, gsn_poison, IS_OBJ_STAT, IS_WEAPON_STAT, ITEM_BLESS, ITEM_BURN_PROOF, ITEM_DRINK_CON, ITEM_FOOD, obj_data::item_type, ITEM_WEAPON, affect_data::level, affect_data::location, affect_data::modifier, number_percent(), send_to_char(), skill_table, TO_CHAR, TO_ROOM, TO_WEAPON, TRUE, affect_data::type, obj_data::value, WAIT_STATE, WEAPON_FLAMING, WEAPON_FROST, WEAPON_POISON, WEAPON_SHARP, WEAPON_SHOCKING, WEAPON_VAMPIRIC, WEAPON_VORPAL, and affect_data::where. 00952 {
00953 OBJ_DATA *obj;
00954 AFFECT_DATA af;
00955 int percent, skill;
00956
00957 /* find out what */
00958 if (argument[0] == '\0')
00959 {
00960 send_to_char ("Envenom what item?\n\r", ch);
00961 return;
00962 }
00963
00964 obj = get_obj_list (ch, argument, ch->carrying);
00965
00966 if (obj == NULL)
00967 {
00968 send_to_char ("You don't have that item.\n\r", ch);
00969 return;
00970 }
00971
00972 if ((skill = get_skill (ch, gsn_envenom)) < 1)
00973 {
00974 send_to_char ("Are you crazy? You'd poison yourself!\n\r", ch);
00975 return;
00976 }
00977
00978 if (obj->item_type == ITEM_FOOD || obj->item_type == ITEM_DRINK_CON)
00979 {
00980 if (IS_OBJ_STAT (obj, ITEM_BLESS)
00981 || IS_OBJ_STAT (obj, ITEM_BURN_PROOF))
00982 {
00983 act ("You fail to poison $p.", ch, obj, NULL, TO_CHAR);
00984 return;
00985 }
00986
00987 if (number_percent () < skill)
00988 { /* success! */
00989 act ("$n treats $p with deadly poison.", ch, obj, NULL, TO_ROOM);
00990 act ("You treat $p with deadly poison.", ch, obj, NULL, TO_CHAR);
00991 if (!obj->value[3])
00992 {
00993 obj->value[3] = 1;
00994 check_improve (ch, gsn_envenom, TRUE, 4);
00995 }
00996 WAIT_STATE (ch, skill_table[gsn_envenom].beats);
00997 return;
00998 }
00999
01000 act ("You fail to poison $p.", ch, obj, NULL, TO_CHAR);
01001 if (!obj->value[3])
01002 check_improve (ch, gsn_envenom, FALSE, 4);
01003 WAIT_STATE (ch, skill_table[gsn_envenom].beats);
01004 return;
01005 }
01006
01007 if (obj->item_type == ITEM_WEAPON)
01008 {
01009 if (IS_WEAPON_STAT (obj, WEAPON_FLAMING)
01010 || IS_WEAPON_STAT (obj, WEAPON_FROST)
01011 || IS_WEAPON_STAT (obj, WEAPON_VAMPIRIC)
01012 || IS_WEAPON_STAT (obj, WEAPON_SHARP)
01013 || IS_WEAPON_STAT (obj, WEAPON_VORPAL)
01014 || IS_WEAPON_STAT (obj, WEAPON_SHOCKING)
01015 || IS_OBJ_STAT (obj, ITEM_BLESS)
01016 || IS_OBJ_STAT (obj, ITEM_BURN_PROOF))
01017 {
01018 act ("You can't seem to envenom $p.", ch, obj, NULL, TO_CHAR);
01019 return;
01020 }
01021
01022 if (obj->value[3] < 0
01023 || attack_table[obj->value[3]].damage == DAM_BASH)
01024 {
01025 send_to_char ("You can only envenom edged weapons.\n\r", ch);
01026 return;
01027 }
01028
01029 if (IS_WEAPON_STAT (obj, WEAPON_POISON))
01030 {
01031 act ("$p is already envenomed.", ch, obj, NULL, TO_CHAR);
01032 return;
01033 }
01034
01035 percent = number_percent ();
01036 if (percent < skill)
01037 {
01038
01039 af.where = TO_WEAPON;
01040 af.type = gsn_poison;
01041 af.level = ch->level * percent / 100;
01042 af.duration = ch->level / 2 * percent / 100;
01043 af.location = 0;
01044 af.modifier = 0;
01045 af.bitvector = WEAPON_POISON;
01046 affect_to_obj (obj, &af);
01047
01048 act ("$n coats $p with deadly venom.", ch, obj, NULL, TO_ROOM);
01049 act ("You coat $p with venom.", ch, obj, NULL, TO_CHAR);
01050 check_improve (ch, gsn_envenom, TRUE, 3);
01051 WAIT_STATE (ch, skill_table[gsn_envenom].beats);
01052 return;
01053 }
01054 else
01055 {
01056 act ("You fail to envenom $p.", ch, obj, NULL, TO_CHAR);
01057 check_improve (ch, gsn_envenom, FALSE, 3);
01058 WAIT_STATE (ch, skill_table[gsn_envenom].beats);
01059 return;
01060 }
01061 }
01062
01063 act ("You can't poison $p.", ch, obj, NULL, TO_CHAR);
01064 return;
01065 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1067 of file act_obj.c. References act, room_index_data::contents, FALSE, get_obj_carry(), obj_data::in_room, ITEM_DRINK_CON, ITEM_FOUNTAIN, obj_data::item_type, liq_table, MAX_INPUT_LENGTH, MAX_STRING_LENGTH, obj_data::next_content, one_argument(), send_to_char(), TO_CHAR, TO_ROOM, TRUE, and obj_data::value. 01068 {
01069 char arg[MAX_INPUT_LENGTH];
01070 char buf[MAX_STRING_LENGTH];
01071 OBJ_DATA *obj;
01072 OBJ_DATA *fountain;
01073 bool found;
01074
01075 one_argument (argument, arg);
01076
01077 if (arg[0] == '\0')
01078 {
01079 send_to_char ("Fill what?\n\r", ch);
01080 return;
01081 }
01082
01083 if ((obj = get_obj_carry (ch, arg, ch)) == NULL)
01084 {
01085 send_to_char ("You do not have that item.\n\r", ch);
01086 return;
01087 }
01088
01089 found = FALSE;
01090 for (fountain = ch->in_room->contents; fountain != NULL;
01091 fountain = fountain->next_content)
01092 {
01093 if (fountain->item_type == ITEM_FOUNTAIN)
01094 {
01095 found = TRUE;
01096 break;
01097 }
01098 }
01099
01100 if (!found)
01101 {
01102 send_to_char ("There is no fountain here!\n\r", ch);
01103 return;
01104 }
01105
01106 if (obj->item_type != ITEM_DRINK_CON)
01107 {
01108 send_to_char ("You can't fill that.\n\r", ch);
01109 return;
01110 }
01111
01112 if (obj->value[1] != 0 && obj->value[2] != fountain->value[2])
01113 {
01114 send_to_char ("There is already another liquid in it.\n\r", ch);
01115 return;
01116 }
01117
01118 if (obj->value[1] >= obj->value[0])
01119 {
01120 send_to_char ("Your container is full.\n\r", ch);
01121 return;
01122 }
01123
01124 sprintf (buf, "You fill $p with %s from $P.",
01125 liq_table[fountain->value[2]].liq_name);
01126 act (buf, ch, obj, fountain, TO_CHAR);
01127 sprintf (buf, "$n fills $p with %s from $P.",
01128 liq_table[fountain->value[2]].liq_name);
01129 act (buf, ch, obj, fountain, TO_ROOM);
01130 obj->value[2] = fountain->value[2];
01131 obj->value[1] = obj->value[0];
01132 return;
01133 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 297 of file act_obj.c. References act, can_loot(), can_see_obj(), CONT_CLOSED, obj_data::contains, room_index_data::contents, FALSE, get_obj(), get_obj_here(), get_obj_list(), obj_data::in_room, IS_IMMORTAL, is_name(), IS_SET, ITEM_CONTAINER, ITEM_CORPSE_NPC, ITEM_CORPSE_PC, obj_data::item_type, MAX_INPUT_LENGTH, obj_data::name, obj_data::next_content, OBJ_VNUM_PIT, one_argument(), obj_data::pIndexData, send_to_char(), str_cmp(), str_prefix(), TO_CHAR, TRUE, obj_data::value, and obj_index_data::vnum. Referenced by damage(). 00298 {
00299 char arg1[MAX_INPUT_LENGTH];
00300 char arg2[MAX_INPUT_LENGTH];
00301 OBJ_DATA *obj;
00302 OBJ_DATA *obj_next;
00303 OBJ_DATA *container;
00304 bool found;
00305
00306 argument = one_argument (argument, arg1);
00307 argument = one_argument (argument, arg2);
00308
00309 if (!str_cmp (arg2, "from"))
00310 argument = one_argument (argument, arg2);
00311
00312 /* Get type. */
00313 if (arg1[0] == '\0')
00314 {
00315 send_to_char ("Get what?\n\r", ch);
00316 return;
00317 }
00318
00319 if (arg2[0] == '\0')
00320 {
00321 if (str_cmp (arg1, "all") && str_prefix ("all.", arg1))
00322 {
00323 /* 'get obj' */
00324 obj = get_obj_list (ch, arg1, ch->in_room->contents);
00325 if (obj == NULL)
00326 {
00327 act ("I see no $T here.", ch, NULL, arg1, TO_CHAR);
00328 return;
00329 }
00330
00331 get_obj (ch, obj, NULL);
00332 }
00333 else
00334 {
00335 /* 'get all' or 'get all.obj' */
00336 found = FALSE;
00337 for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
00338 {
00339 obj_next = obj->next_content;
00340 if ((arg1[3] == '\0' || is_name (&arg1[4], obj->name))
00341 && can_see_obj (ch, obj))
00342 {
00343 found = |