int add_obj_cost(struct char_data *ch, struct char_data *re, struct obj_data *obj, struct obj_cost *cost, int hoarder) { char buf[MAX_INPUT_LENGTH]; int temp; struct obj_data *hobj; if((cost->total_cost == 100) && (cost->no_carried == 0)) { hobj = obj; /* Add cost for an item and it's contents, and next->contents */ } if (obj) { if ((obj->item_number > -1) && (cost->ok) && ItemEgoClash(ch,obj,0) >-5 ) { temp = MAX(0, obj->obj_flags.cost_per_day); cost->total_cost += temp; if (re) { #if 0 sprintf(buf, "%30s : %d coins/day\n\r", obj->short_description, temp); send_to_char(buf, ch); #endif } cost->no_carried++; hoarder = add_obj_cost(ch, re, obj->contains, cost, hoarder); hoarder = add_obj_cost(ch, re, obj->next_content, cost, hoarder); } else { if(ItemEgoClash(ch,obj,0) < 0 && obj->obj_flags.cost_per_day > 0) { if (re) act("$p refuses to be rented with a wimp like you!", TRUE,ch,obj,0,TO_CHAR); cost->ok = FALSE; } else if (cost->ok) { if (re) { act("$n tells you 'I refuse storing $p'",FALSE,re,obj,ch,TO_VICT); cost->ok = FALSE; } else { #if NODUPLICATES #else act("Sorry, but $p don't keep in storage.",FALSE,ch,obj,0,TO_CHAR); #endif cost->ok = FALSE; } } } } return(hoarder); }
void equip_char(struct char_data *ch, struct obj_data *obj, int pos) { int j; assert(pos>=0 && pos<MAX_WEAR); assert(!(ch->equipment[pos])); if (obj->carried_by) { logE("EQUIP: Obj is carried_by when equip."); assert(0); } if (obj->in_room!=NOWHERE) { logE("EQUIP: Obj is in_room when equip."); assert(0); return; } /* if the item is limited, check its ego. use some funky function to determine if pc's ego is higher than objs' ego.. if it is, proceed.. otherwise, deny. */ j = ItemEgoClash(ch, obj, 0); if (j < -5) { act("$p almost seems to say 'You're much too puny to use me, twerp!'",0, ch, obj, 0, TO_CHAR); act("$p falls to the floor",0,ch, obj, 0, TO_CHAR); act("$p removes itself, and falls to the floor",0,ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } else if (j < 0) { act("$p almost seems to say 'You're pretty puny. I don't want to be seen with you!\n", 0, ch, obj, 0, TO_CHAR); act("$p falls to the floor",0,ch, obj, 0, TO_CHAR); act("$p removes itself, and falls to the floor",0,ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } if (ItemAlignClash(ch, obj)) { if (ch->in_room != NOWHERE) { act("You are zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } else { logE("ch->in_room = NOWHERE when equipping char."); assert(0); } } if (IS_AFFECTED(ch, AFF_SNEAK) && IsRestricted(GetItemClassRestrictions(obj), CLASS_THIEF)) affect_from_char(ch, SKILL_SNEAK); ch->equipment[pos] = obj; obj->equipped_by = ch; obj->eq_pos = pos; if (GET_ITEM_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, (int)obj->affected[j].modifier, obj->obj_flags.bitvector, TRUE); if (GET_ITEM_TYPE(obj) == ITEM_WEAPON) { /* some nifty manuevering for strength */ if (IS_NPC(ch) && !IS_SET(ch->specials.act, ACT_POLYSELF)) GiveMinStrToWield(obj, ch); } affect_total(ch); }