/* simple function to determine if char can walk on water */ int has_boat(struct char_data *ch) { struct obj_data *obj; int i; /* if (ROOM_IDENTITY(IN_ROOM(ch)) == DEAD_SEA) return (1); */ if (GET_LEVEL(ch) >= LVL_IMMORT) return (1); if (AFF_FLAGGED(ch, AFF_WATERWALK) || AFF_FLAGGED(ch, AFF_AIRWALK)) return (1); /* non-wearable boats in inventory will do it */ for (obj = ch->carrying; obj; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_BOAT && (find_eq_pos(ch, obj, NULL) < 0)) return (1); /* and any boat you're wearing will do it too */ for (i = 0; i < NUM_WEARS; i++) if (GET_EQ(ch, i) && GET_OBJ_TYPE(GET_EQ(ch, i)) == ITEM_BOAT) return (1); return (0); }
struct obj_data *unequip_char(struct char_data *ch, int pos) { int j; struct obj_data *obj; if ((pos < 0 || pos >= NUM_WEARS) || GET_EQ(ch, pos) == NULL) { core_dump(); return (NULL); } obj = GET_EQ(ch, pos); obj->worn_by = NULL; obj->worn_on = -1; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) += apply_ac(ch, pos); if (IN_ROOM(ch) != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[IN_ROOM(ch)].light--; } else log("SYSERR: IN_ROOM(ch) = NOWHERE when unequipping char %s.", GET_NAME(ch)); GET_EQ(ch, pos) = NULL; for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify_ar(ch, obj->affected[j].location, obj->affected[j].modifier, GET_OBJ_AFFECT(obj), FALSE); affect_total(ch); return (obj); }
char * list_object(struct char_data *ch, struct obj_data *obj, int cnt, int index, int shop_nr) { static char buf[256]; char buf2[300], buf3[200]; extern char *drinks[]; if (shop_producing(obj, shop_nr)) strcpy(buf2, "Unlimited "); else sprintf(buf2, "%5d ", cnt); sprintf(buf, " %2d) %s", index, buf2); /* Compile object name and information */ strcpy(buf3, obj->short_description); if ((GET_OBJ_TYPE(obj) == ITEM_DRINKCON) && (GET_OBJ_VAL(obj, 1))) sprintf(END_OF(buf3), " of %s", drinks[GET_OBJ_VAL(obj, 2)]); /* FUTURE: */ /* Add glow/hum/etc */ if ((GET_OBJ_TYPE(obj) == ITEM_WAND) || (GET_OBJ_TYPE(obj) == ITEM_STAFF)) if (GET_OBJ_VAL(obj, 2) < GET_OBJ_VAL(obj, 1)) strcat(buf3, " (partially used)"); sprintf(buf2, "%-48s %6d\n\r", buf3, buy_price(ch, obj, shop_nr)); strcat(buf, CAP(buf2)); return (buf); }
void equip_char(struct char_data *ch, struct obj_data *obj, int pos) { int j; if (pos < 0 || pos >= NUM_WEARS) { core_dump(); return; } if (GET_EQ(ch, pos)) { log("SYSERR: Char is already equipped: %s, %s", GET_NAME(ch), obj->short_description); return; } if (obj->carried_by) { log("SYSERR: EQUIP: Obj is carried_by when equip."); return; } if (IN_ROOM(obj) != NOWHERE) { log("SYSERR: EQUIP: Obj is in_room when equip."); return; } if (invalid_align(ch, obj) || invalid_class(ch, obj)) { act("You are zapped by $p and instantly let go of it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly lets go of it.", FALSE, ch, obj, 0, TO_ROOM); /* Changed to drop in inventory instead of the ground. */ obj_to_char(obj, ch); return; } GET_EQ(ch, pos) = obj; obj->worn_by = ch; obj->worn_on = pos; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); if (IN_ROOM(ch) != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[IN_ROOM(ch)].light++; } else log("SYSERR: IN_ROOM(ch) = NOWHERE when equipping char %s.", GET_NAME(ch)); for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify_ar(ch, obj->affected[j].location, obj->affected[j].modifier, GET_OBJ_AFFECT(obj), TRUE); affect_total(ch); }
void Enchants::update_set_bonus(OBJ_DATA *obj, const obj_sets::ench_type *set_ench) { for (auto i = list_.begin(); i != list_.end(); ++i) { if (i->type_ == ENCHANT_FROM_SET) { if (i->weight_ != set_ench->weight || i->ndice_ != set_ench->ndice || i->sdice_ != set_ench->sdice) { // вес GET_OBJ_WEIGHT(obj) += set_ench->weight - i->weight_; // дайсы пушек if (GET_OBJ_TYPE(obj) == ITEM_WEAPON) { GET_OBJ_VAL(obj, 1) += set_ench->ndice - i->ndice_; GET_OBJ_VAL(obj, 2) += set_ench->sdice - i->sdice_; } correct_values(obj); i->weight_ = set_ench->weight; i->ndice_ = set_ench->ndice; i->sdice_ = set_ench->sdice; } return; } } obj::enchant tmp; tmp.type_ = obj::ENCHANT_FROM_SET; tmp.name_ = "набором предметов"; tmp.weight_ = set_ench->weight; tmp.ndice_ = set_ench->ndice; tmp.sdice_ = set_ench->sdice; tmp.apply_to_obj(obj); }
void enchant::apply_to_obj(OBJ_DATA *obj) const { for (auto i = affected_.cbegin(), iend = affected_.cend(); i != iend; ++i) { for (int k = 0; k < MAX_OBJ_AFFECT; k++) { if (obj->affected[k].location == i->location) { obj->affected[k].modifier += i->modifier; break; } else if (obj->affected[k].location == APPLY_NONE) { obj->affected[k].location = i->location; obj->affected[k].modifier = i->modifier; break; } } } GET_OBJ_AFFECTS(obj) += affects_flags_; obj->obj_flags.extra_flags += extra_flags_; obj->obj_flags.no_flag += no_flags_; GET_OBJ_WEIGHT(obj) += weight_; if (GET_OBJ_TYPE(obj) == ITEM_WEAPON) { GET_OBJ_VAL(obj, 1) += ndice_; GET_OBJ_VAL(obj, 2) += sdice_; } correct_values(obj); obj->enchants.add(*this); }
/* Return the effect of a piece of armor in position eq_pos */ static int apply_ac(struct char_data *ch, int eq_pos) { int factor; if (GET_EQ(ch, eq_pos) == NULL) { core_dump(); return (0); } if (!(GET_OBJ_TYPE(GET_EQ(ch, eq_pos)) == ITEM_ARMOR)) return (0); switch (eq_pos) { case WEAR_BODY: factor = 3; break; /* 30% */ case WEAR_HEAD: factor = 2; break; /* 20% */ case WEAR_LEGS: factor = 2; break; /* 20% */ default: factor = 1; break; /* all others 10% */ } return (factor * GET_OBJ_VAL(GET_EQ(ch, eq_pos), 0)); }
/* * Object value #3 */ void oedit_disp_val3_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_3; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { case ITEM_LIGHT: write_to_output(d, "Number of hours (0 = burnt, -1 is infinite) : "); break; case ITEM_SCROLL: case ITEM_POTION: oedit_disp_spells_menu(d); break; case ITEM_WAND: case ITEM_STAFF: write_to_output(d, "Number of charges remaining : "); break; case ITEM_WEAPON: write_to_output(d, "Size of damage dice : "); break; case ITEM_CONTAINER: write_to_output(d, "Vnum of key to open container (-1 for no key) : "); break; case ITEM_DRINKCON: case ITEM_FOUNTAIN: oedit_liquid_type(d); break; default: oedit_disp_menu(d); } }
/* * Object value #2 */ void oedit_disp_val2_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_2; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { case ITEM_SCROLL: case ITEM_POTION: oedit_disp_spells_menu(d); break; case ITEM_WAND: case ITEM_STAFF: write_to_output(d, "Max number of charges : "); break; case ITEM_WEAPON: write_to_output(d, "Number of damage dice : "); break; case ITEM_FOOD: /* * Values 2 and 3 are unused, jump to 4...Odd. */ oedit_disp_val4_menu(d); break; case ITEM_CONTAINER: /* * These are flags, needs a bit of special handling. */ oedit_disp_container_flags_menu(d); break; case ITEM_DRINKCON: case ITEM_FOUNTAIN: write_to_output(d, "Initial drink units : "); break; default: oedit_disp_menu(d); } }
struct obj_data * roll_joint(struct obj_data *tobac, struct obj_data *paper) { struct obj_data *obj; struct extra_descr_data *new_descr; char buf[200]; if (!tobac || !paper) { errlog(" Attempt to roll_joint with NULL tobac or paper."); return NULL; } obj = make_object(); obj->shared = null_obj_shared; CREATE(new_descr, struct extra_descr_data, 1); snprintf(buf, sizeof(buf), "cig cigarette joint %s", fname(tobac->aliases)); obj->aliases = strdup(buf); snprintf(buf, sizeof(buf), "a %s cigarette", fname(tobac->aliases)); obj->name = strdup(buf); snprintf_cat(buf, sizeof(buf), " has been dropped here.", sizeof(buf), "It looks like a %s cigarette, waiting to be smoked.", fname(tobac->aliases)); new_descr->description = strdup(buf); new_descr->next = NULL; obj->ex_description = new_descr; GET_OBJ_TYPE(obj) = ITEM_CIGARETTE; GET_OBJ_VAL(obj, 0) = 3 + (GET_OBJ_WEIGHT(tobac) * 3); GET_OBJ_VAL(obj, 1) = GET_OBJ_VAL(tobac, 2); GET_OBJ_VAL(obj, 2) = SMOKE_TYPE(tobac); GET_OBJ_WEAR(obj) = ITEM_WEAR_TAKE + ITEM_WEAR_HOLD; GET_OBJ_COST(obj) = GET_OBJ_COST(tobac); return obj; }
void update_char_objects(struct char_data * ch) { int i; if (GET_EQ(ch, WEAR_LIGHT) != NULL) if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2) > 0) { i = --GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2); if (i == 1) { act("Your light begins to flicker and fade.", FALSE, ch, 0, 0, TO_CHAR); act("$n's light begins to flicker and fade.", FALSE, ch, 0, 0, TO_ROOM); } else if (i == 0) { act("Your light sputters out and dies.", FALSE, ch, 0, 0, TO_CHAR); act("$n's light sputters out and dies.", FALSE, ch, 0, 0, TO_ROOM); world[ch->in_room].light--; } } for (i = 0; i < NUM_WEARS; i++) if (GET_EQ(ch, i)) update_object(GET_EQ(ch, i), 2); if (ch->carrying) update_object(ch->carrying, 1); }
/* place a character in a room */ void char_to_room(struct char_data *ch, room_rnum room) { if (ch == NULL || room == NOWHERE || room > top_of_world) log("SYSERR: Illegal value(s) passed to char_to_room. (Room: %d/%d Ch: %p", room, top_of_world, ch); else { ch->next_in_room = world[room].people; world[room].people = ch; IN_ROOM(ch) = room; autoquest_trigger_check(ch, 0, 0, AQ_ROOM_FIND); autoquest_trigger_check(ch, 0, 0, AQ_MOB_FIND); if (GET_EQ(ch, WEAR_LIGHT)) if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2)) /* Light ON */ world[room].light++; /* Stop fighting now, if we left. */ if (FIGHTING(ch) && IN_ROOM(ch) != IN_ROOM(FIGHTING(ch))) { stop_fighting(FIGHTING(ch)); stop_fighting(ch); } } }
/* Used by James the Butler and the Cleaning Lady */ int is_trash(struct obj_data * i) { if (IS_SET(i->obj_flags.wear_flags, ITEM_WEAR_TAKE) && ((GET_OBJ_TYPE(i) == ITEM_DRINKCON) || (GET_OBJ_COST(i) <= 10))) return TRUE; else return FALSE; }
void make_corpse(struct char_data * ch) { struct obj_data *corpse, *o; struct obj_data *money; int i; corpse = create_obj(); corpse->item_number = NOTHING; IN_ROOM(corpse) = NOWHERE; corpse->name = str_dup("corpse"); sprintf(buf2, "The corpse of %s is lying here.", GET_NAME(ch)); corpse->description = str_dup(buf2); sprintf(buf2, "the corpse of %s", GET_NAME(ch)); corpse->short_description = str_dup(buf2); GET_OBJ_TYPE(corpse) = ITEM_CONTAINER; GET_OBJ_WEAR(corpse) = ITEM_WEAR_TAKE; GET_OBJ_EXTRA(corpse) = ITEM_NODONATE; GET_OBJ_VAL(corpse, 0) = 0; /* You can't store stuff in a corpse */ GET_OBJ_VAL(corpse, 3) = 1; /* corpse identifier */ GET_OBJ_WEIGHT(corpse) = GET_WEIGHT(ch) + IS_CARRYING_W(ch); GET_OBJ_RENT(corpse) = 100000; if (IS_NPC(ch)) GET_OBJ_TIMER(corpse) = max_npc_corpse_time; else GET_OBJ_TIMER(corpse) = max_pc_corpse_time; /* transfer character's inventory to the corpse */ corpse->contains = ch->carrying; for (o = corpse->contains; o != NULL; o = o->next_content) o->in_obj = corpse; object_list_new_owner(corpse, NULL); /* transfer character's equipment to the corpse */ for (i = 0; i < NUM_WEARS; i++) if (GET_EQ(ch, i)) { remove_otrigger(GET_EQ(ch, i), ch); obj_to_obj(unequip_char(ch, i), corpse); } /* transfer gold */ if (GET_GOLD(ch) > 0) { /* following 'if' clause added to fix gold duplication loophole */ if (IS_NPC(ch) || (!IS_NPC(ch) && ch->desc)) { money = create_money(GET_GOLD(ch)); obj_to_obj(money, corpse); } GET_GOLD(ch) = 0; } ch->carrying = NULL; IS_CARRYING_N(ch) = 0; IS_CARRYING_W(ch) = 0; obj_to_room(corpse, IN_ROOM(ch)); }
/* Routine to check if an object is trash. Used by James the Butler and the * Cleaning Lady. */ int is_trash(struct obj_data *i) { if (!OBJWEAR_FLAGGED(i, ITEM_WEAR_TAKE)) return (FALSE); if (GET_OBJ_TYPE(i) == ITEM_DRINKCON || GET_OBJ_COST(i) <= 10) return (TRUE); return (FALSE); }
struct obj_data *unequip_char(struct char_data * ch, int pos) { int j; struct obj_data *obj; assert(pos >= 0 && pos < NUM_WEARS); assert(GET_EQ(ch, pos)); obj = GET_EQ(ch, pos); obj->worn_by = NULL; obj->worn_on = -1; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) += apply_ac(ch, pos); if (ch->in_room != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[ch->in_room].light--; } else { log("SYSERR: ch->in_room = NOWHERE when un-equipping char."); } GET_EQ(ch, pos) = NULL; for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, obj->affected[j].modifier, obj->obj_flags.bitvector, FALSE); if (affected_by_spell(ch, SKILL_ENVENOM) && (pos == WEAR_WIELD)) { send_to_char("As your weapon leaves your hand, the venom on it dissipates.\r\n", ch); affect_from_char(ch, SKILL_ENVENOM); } if (affected_by_spell(ch, SPELL_ADAMANT_MACE) && (pos == WEAR_WIELD)) affect_from_char(ch, SPELL_ADAMANT_MACE); affect_total(ch); return (obj); }
/* Object value #1 */ static void oedit_disp_val1_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_1; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { case ITEM_LIGHT: /* values 0 and 1 are unused.. jump to 2 */ oedit_disp_val3_menu(d); break; case ITEM_SCROLL: case ITEM_WAND: case ITEM_STAFF: case ITEM_POTION: write_to_output(d, "Spell level : "); break; case ITEM_WEAPON: /* This doesn't seem to be used if I remember right. */ write_to_output(d, "Modifier to Hitroll : "); break; case ITEM_ARMOR: write_to_output(d, "Apply to AC : "); break; case ITEM_CONTAINER: write_to_output(d, "Max weight to contain (-1 for unlimited) : "); break; case ITEM_DRINKCON: case ITEM_FOUNTAIN: write_to_output(d, "Max drink units (-1 for unlimited) : "); break; case ITEM_FOOD: write_to_output(d, "Hours to fill stomach : "); break; case ITEM_MONEY: write_to_output(d, "Number of gold coins : "); break; case ITEM_FURNITURE: write_to_output(d, "Number of people it can hold : "); break; case ITEM_NOTE: // These object types have no 'values' so go back to menu case ITEM_OTHER: case ITEM_WORN: case ITEM_TREASURE: case ITEM_TRASH: case ITEM_KEY: case ITEM_PEN: case ITEM_BOAT: case ITEM_FREE: /* Not implemented, but should be handled here */ case ITEM_FREE2: /* Not implemented, but should be handled here */ oedit_disp_menu(d); break; default: mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: Reached default case in oedit_disp_val1_menu()!"); break; } }
struct obj_data *create_money(int amount) { struct obj_data *obj; struct extra_descr_data *new_descr; char buf[200]; int y; if (amount <= 0) { log("SYSERR: Try to create negative or 0 money. (%d)", amount); return (NULL); } obj = create_obj(); CREATE(new_descr, struct extra_descr_data, 1); if (amount == 1) { obj->name = strdup("coin gold"); obj->short_description = strdup("a gold coin"); obj->description = strdup("One miserable gold coin is lying here."); new_descr->keyword = strdup("coin gold"); new_descr->description = strdup("It's just one miserable little gold coin."); } else { obj->name = strdup("coins gold"); obj->short_description = strdup(money_desc(amount)); snprintf(buf, sizeof(buf), "%s is lying here.", money_desc(amount)); obj->description = strdup(CAP(buf)); new_descr->keyword = strdup("coins gold"); if (amount < 10) snprintf(buf, sizeof(buf), "There are %d coins.", amount); else if (amount < 100) snprintf(buf, sizeof(buf), "There are about %d coins.", 10 * (amount / 10)); else if (amount < 1000) snprintf(buf, sizeof(buf), "It looks to be about %d coins.", 100 * (amount / 100)); else if (amount < 100000) snprintf(buf, sizeof(buf), "You guess there are, maybe, %d coins.", 1000 * ((amount / 1000) + rand_number(0, (amount / 1000)))); else strcpy(buf, "There are a LOT of coins."); /* strcpy: OK (is < 200) */ new_descr->description = strdup(buf); } new_descr->next = NULL; obj->ex_description = new_descr; GET_OBJ_TYPE(obj) = ITEM_MONEY; for(y = 0; y < TW_ARRAY_MAX; y++) obj->obj_flags.wear_flags[y] = 0; SET_BIT_AR(GET_OBJ_WEAR(obj), ITEM_WEAR_TAKE); GET_OBJ_VAL(obj, 0) = amount; GET_OBJ_COST(obj) = amount; obj->item_number = NOTHING; return (obj); }
int Crash_is_unrentable(struct obj_data * obj) { if (!obj) return 0; if (IS_OBJ_STAT(obj, ITEM_NORENT) || GET_OBJ_RENT(obj) < 0 || GET_OBJ_RNUM(obj) <= NOTHING || GET_OBJ_TYPE(obj) == ITEM_KEY) return 1; return 0; }
int trade_with(struct obj_data * item, int shop_nr) { int counter; if (GET_OBJ_COST(item) < 1) return (OBJECT_NOTOK); if (IS_OBJ_STAT(item, ITEM_NOSELL)) return (OBJECT_NOTOK); for (counter = 0; SHOP_BUYTYPE(shop_nr, counter) != NOTHING; counter++) if (SHOP_BUYTYPE(shop_nr, counter) == GET_OBJ_TYPE(item)) { if ((GET_OBJ_VAL(item, 2) == 0) && ((GET_OBJ_TYPE(item) == ITEM_WAND) || (GET_OBJ_TYPE(item) == ITEM_STAFF))) return (OBJECT_DEAD); else if (evaluate_expression(item, SHOP_BUYWORD(shop_nr, counter))) return (OBJECT_OK); } return (OBJECT_NOTOK); }
int Crash_is_unrentable(struct obj_data *obj) { if (!obj) return (0); if (OBJ_FLAGGED(obj, ITEM_NORENT) || GET_OBJ_RENT(obj) < 0 || GET_OBJ_RNUM(obj) == NOTHING || GET_OBJ_TYPE(obj) == ITEM_KEY) { log("Crash_is_unrentable: removing object %s", obj->short_description); return (1); } return (0); }
/* simple function to determine if char can walk on water */ int has_boat(struct char_data *ch) { struct obj_data *obj; int i; if (GET_LEVEL(ch) > LVL_IMMORT) return (1); if (AFF_FLAGGED(ch, AFF_WATERWALK)) return (1); if(IS_NPC_FISH(ch)) { return 1; } if(IS_NPC_LIVESTOCK(ch)) { if(ch->master) { if(has_boat(ch->master)) { return 1; } } } /* non-wearable boats in inventory will do it */ for (obj = ch->carrying; obj; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_BOAT && (find_eq_pos(ch, obj, NULL) < 0)) return (1); /* and any boat you're wearing will do it too */ for (i = 0; i < NUM_WEARS; i++) if (GET_EQ(ch, i) && GET_OBJ_TYPE(GET_EQ(ch, i)) == ITEM_BOAT) return (1); return (0); }
void Crash_extract_norents_from_equipped(struct char_data * ch) { int j; for (j = 0;j < NUM_WEARS;j++) { if (GET_EQ(ch,j)) { if (IS_OBJ_STAT(GET_EQ(ch,j), ITEM_NORENT) || GET_OBJ_RENT(GET_EQ(ch,j)) < 0 || GET_OBJ_RNUM(GET_EQ(ch,j)) <= NOTHING || GET_OBJ_TYPE(GET_EQ(ch,j)) == ITEM_KEY) obj_to_char(unequip_char(ch,j),ch); else Crash_extract_norents(GET_EQ(ch,j)); } } }
/* * Object value #1 */ void oedit_disp_val1_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_1; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { case ITEM_LIGHT: /* * values 0 and 1 are unused.. jump to 2 */ oedit_disp_val3_menu(d); break; case ITEM_SCROLL: case ITEM_WAND: case ITEM_STAFF: case ITEM_POTION: write_to_output(d, "Spell level : "); break; case ITEM_WEAPON: /* * This doesn't seem to be used if I remembe right. */ write_to_output(d, "Modifier to Hitroll : "); break; case ITEM_ARMOR: write_to_output(d, "Apply to AC : "); break; case ITEM_CONTAINER: write_to_output(d, "Max weight to contain : "); break; case ITEM_DRINKCON: case ITEM_FOUNTAIN: write_to_output(d, "Max drink units : "); break; case ITEM_FOOD: write_to_output(d, "Hours to fill stomach : "); break; case ITEM_MONEY: write_to_output(d, "Number of gold coins : "); break; case ITEM_NOTE: /* * This is supposed to be language, but it's unused. */ break; default: oedit_disp_menu(d); } }
/* Return the effect of a piece of armor in position eq_pos */ int apply_ac(struct char_data * ch, int eq_pos) { int armor; assert(GET_EQ(ch, eq_pos)); if (!(GET_OBJ_TYPE(GET_EQ(ch, eq_pos)) == ITEM_ARMOR)) return 0; armor = GET_OBJ_VAL(GET_EQ(ch, eq_pos), 0); switch (eq_pos) { case WEAR_BODY: armor *= 3; break; case WEAR_SHIELD: armor *= 2; break; case WEAR_ARMS: case WEAR_LEGS: armor *= 1.5; break; case WEAR_ANKLE_L: case WEAR_ANKLE_R: case WEAR_WRIST_L: case WEAR_WRIST_R: armor *= .5; break; case WEAR_FINGER_L: case WEAR_FINGER_R: case WEAR_NOSE: armor *= 0; break; default: break; } return armor; }
/* * Object value #3 */ void oedit_disp_val3_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_3; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { case ITEM_LIGHT: write_to_output(d, "Number of hours (0 = burnt, -1 is infinite) : "); break; case ITEM_SCROLL: case ITEM_POTION: oedit_disp_spells_menu(d); break; case ITEM_WAND: case ITEM_STAFF: write_to_output(d, "Number of charges remaining : "); break; case ITEM_WEAPON: write_to_output(d, "Size of damage dice : "); break; case ITEM_CONTAINER: write_to_output(d, "Vnum of key to open container (-1 for no key) : "); break; case ITEM_DRINKCON: case ITEM_FOUNTAIN: oedit_liquid_type(d); break; case ITEM_VEHICLE: write_to_output(d, "Vnum of key to unlock vehicle (-1 for no key) : "); break; case ITEM_HATCH: write_to_output(d, "Vnum of key to unlock hatch (-1 for no key) : "); break; case ITEM_WINDOW: write_to_output(d, "Vnum of key to unlock window (-1 for no key) : "); break; case ITEM_PORTAL: write_to_output(d, "Vnum of the key to unlock portal (-1 for no key) : "); break; case ITEM_BOARD: write_to_output(d, "Minimum level to write: "); break; default: oedit_disp_menu(d); } }
void postmaster_receive_mail (struct char_data *ch, struct char_data *mailman, int cmd, char *arg) { char buf[256]; struct obj_data *obj; if (!has_mail (GET_IDNUM (ch))) { sprintf (buf, "$n tells you, 'Sorry, you don't have any mail waiting.'"); act (buf, FALSE, mailman, 0, ch, TO_VICT); return; } while (has_mail (GET_IDNUM (ch))) { obj = create_obj (); obj->item_number = NOTHING; obj->name = str_dup ("mail paper letter"); obj->short_description = str_dup ("a piece of mail"); obj->description = str_dup ("Someone has left a piece of mail here."); GET_OBJ_TYPE (obj) = ITEM_NOTE; GET_OBJ_WEAR (obj) = ITEM_WEAR_TAKE | ITEM_WEAR_HOLD; GET_OBJ_WEIGHT (obj) = 1; GET_OBJ_COST (obj) = 30; GET_OBJ_RENT (obj) = 10; obj->action_description = read_delete (GET_IDNUM (ch)); if (obj->action_description == NULL) obj->action_description = str_dup ("Mail system error - please report. Error #11.\r\n"); obj_to_char (obj, ch); act ("$n gives you a piece of mail.", FALSE, mailman, 0, ch, TO_VICT); act ("$N gives $n a piece of mail.", FALSE, ch, 0, mailman, TO_ROOM); } }
/* * Object value #4 */ void oedit_disp_val4_menu(struct descriptor_data *d) { OLC_MODE(d) = OEDIT_VALUE_4; switch (GET_OBJ_TYPE(OLC_OBJ(d))) { case ITEM_SCROLL: case ITEM_POTION: case ITEM_WAND: case ITEM_STAFF: oedit_disp_spells_menu(d); break; case ITEM_WEAPON: oedit_disp_weapon_menu(d); break; case ITEM_DRINKCON: case ITEM_FOUNTAIN: case ITEM_FOOD: write_to_output(d, "Poisoned (0 = not poison) : "); break; default: oedit_disp_menu(d); } }
/* place a character in a room */ void char_to_room(struct char_data * ch, room_rnum room) { if (ch == NULL || room < 0 || room > top_of_world) log("SYSERR: Illegal value(s) passed to char_to_room"); else { ch->next_in_room = world[room].people; world[room].people = ch; ch->in_room = room; if ( affected_by_spell(ch, SPELL_LIGHT) ) { world[ch->in_room].light += 10; } if ( affected_by_spell(ch, SPELL_DARKNESS) ) { world[ch->in_room].light -= 10; } if (GET_EQ(ch, WEAR_LIGHT)) if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2)) /* Light ON */ world[room].light++; } }
/* move a player out of a room */ void char_from_room(struct char_data * ch) { struct char_data *temp; if (ch == NULL || ch->in_room == NOWHERE) { log("SYSERR: NULL or NOWHERE in handler.c, char_from_room"); exit(1); } if (FIGHTING(ch) != NULL) { stop_fighting(ch); } if ( affected_by_spell(ch, SPELL_LIGHT) ) { world[ch->in_room].light -= 10; } if ( affected_by_spell(ch, SPELL_DARKNESS) ) { world[ch->in_room].light += 10; } if (GET_EQ(ch, WEAR_LIGHT) != NULL) { if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) { if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2)) { /* Light is ON */ world[ch->in_room].light--; } } } /* if (affected_by_spell(ch, SPELL_ENTANGLE)) affect_from_char(ch, SPELL_ENTANGLE); if (affected_by_spell(ch, SPELL_MIRE)) affect_from_char(ch, SPELL_MIRE); */ REMOVE_FROM_LIST(ch, world[ch->in_room].people, next_in_room); ch->in_room = NOWHERE; ch->next_in_room = NULL; }