void load_acorn(int rnum, int how_many) { int r, obj_num, znum, n, DROP = 0; struct obj_data *acorn; znum = world[real_room(rnum)].zone; for (n = 0; n <= how_many; n++) { r = number(rnum, (rnum + 99)); if (real_room(r)) { obj_num = real_object(200); acorn = read_object(obj_num, REAL); obj_to_room(acorn, real_room(r)); DROP = 1; } } if (DROP) { send_to_zone_outdoor(znum, "In the distance, you hear an acorn fall to the ground with a rustle of leaves.\r\n"); } obj_num = real_object(599); acorn = read_object(obj_num, REAL); obj_to_room(acorn, real_room(220)); }
static void event_scatter_goodies_zone(int rnum, struct room_data *rp, struct event_goodies *stuff) { int i = 0; int exit_found = 0; int gold = 0; struct char_data *monster = NULL; struct obj_data *object = NULL; struct obj_data *coins = NULL; if (DEBUG > 1) log_info("called %s with %d, %08zx, %08zx", __PRETTY_FUNCTION__, rnum, (size_t) rp, (size_t) stuff); if (!rp || rp->number < stuff->bottom || rp->number > stuff->top) return; if (IS_SET(rp->room_flags, (NO_MOB | PEACEFUL | PRIVATE))) return; exit_found = 0; for (i = 0; i < MAX_NUM_EXITS; i++) /* neswud */ if (rp->dir_option[i]) { exit_found = 1; break; } if (!exit_found) return; if (number(0, 99) >= stuff->chance) return; gold = dice(stuff->gold_dice, stuff->gold_die) + stuff->gold_mod; gold_count += gold; coins = create_money(gold); obj_to_room(coins, rnum); rprintf(rnum, "In a brilliant green flash, a pile of %s appears before you!\r\n", coins->short_description); if (number(0, 99) < stuff->mob_chance) { i = number(1, stuff->mob_count) - 1; if ((monster = read_mobile(stuff->mob_vnum[i], VIRTUAL))) { GET_GOLD(monster) = 0; mob_count++; char_to_room(monster, rnum); act("A rift of red light rips open and $N rushes out!", FALSE, monster, 0, monster, TO_ROOM); } } if (number(0, 99) < stuff->obj_chance) { i = number(1, stuff->obj_count) - 1; if ((object = read_object(stuff->obj_vnum[i], VIRTUAL))) { obj_count++; obj_to_room(object, rnum); rprintf(rnum, "In a shimmering of blue light, %s %s forms!\r\n", SANA(object), object->short_description); } } }
SPEC_RET spec_fido( CHAR_DATA *ch ) { OBJ_DATA *corpse; OBJ_DATA *c_next; OBJ_DATA *obj; OBJ_DATA *obj_next; if ( !is_awake(ch) ) return FALSE; for ( corpse = ch->in_room->first_content; corpse; corpse = c_next ) { c_next = corpse->next_content; if ( corpse->type != OBJTYPE_CORPSE_MOB ) continue; act( AT_ACTION, "$n divora selvaggiamente un cadavere.", ch, NULL, NULL, TO_ROOM ); for ( obj = corpse->first_content; obj; obj = obj_next ) { obj_next = obj->next_content; obj_from_obj( obj ); obj_to_room( obj, ch->in_room ); } free_object( corpse ); return TRUE; } return FALSE; }
bool spec_fido( CHAR_DATA *ch ) { OBJ_DATA *corpse; OBJ_DATA *c_next; OBJ_DATA *obj; OBJ_DATA *obj_next; if ( !IS_AWAKE(ch) ) return FALSE; for ( corpse = ch->in_room->contents; corpse != NULL; corpse = c_next ) { c_next = corpse->next_content; if ( corpse->item_type != ITEM_CORPSE_NPC ) continue; act( "$n savagely devours a corpse.", ch, NULL, NULL, TO_ROOM ); for ( obj = corpse->contains; obj; obj = obj_next ) { obj_next = obj->next_content; obj_from_obj( obj ); obj_to_room( obj, ch->in_room ); } extract_obj( corpse ); return TRUE; } return FALSE; }
/* * Lets the mobile to transfer an object. The object must be in the same * room with the mobile. * * Syntax: mob otransfer [item name] [location] */ void do_mpotransfer(CHAR_DATA * ch, char *argument) { OBJ_DATA *obj; ROOM_INDEX_DATA *location; char arg[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH]; argument = one_argument(argument, arg); if (arg[0] == '\0') { bug("MpOTransfer - Missing argument from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0); return; } one_argument(argument, buf); if ((location = find_location(ch, buf)) == NULL) { bug("MpOTransfer - No such location from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0); return; } if ((obj = get_obj_here(ch, arg)) == NULL) return; if (obj->carried_by == NULL) obj_from_room(obj); else { if (obj->wear_loc != WEAR_NONE) unequip_char(ch, obj); obj_from_char(obj); } obj_to_room(obj, location); }
/* Load all objects for a house */ int House_load(room_vnum vnum) { FILE *fl; char fname[MAX_STRING_LENGTH]; struct obj_file_elem object; room_rnum rnum; if ((rnum = real_room(vnum)) == -1) return 0; if (!House_get_filename(vnum, fname)) return 0; if (!(fl = fopen(fname, "r+b"))) { /* no file found */ return 0; } while (!feof(fl)) { fread(&object, sizeof(struct obj_file_elem), 1, fl); if (ferror(fl)) { perror("Reading house file: House_load."); fclose(fl); return 0; } if (!feof(fl)) obj_to_room(Obj_from_store(object), rnum); } fclose(fl); return 1; }
void perform_defile(struct room_data *room, int *state, char **olddesc, char **oldtitle) { struct obj_data *fount = NULL; if (*state != STATE_HOLY) { errlog("invalid state in perform_defile from unholy_square."); return; } *state = STATE_UNHOLY; for (fount = room->contents; fount; fount = fount->next_content) if (GET_OBJ_VNUM(fount) == FOUNT_HOLY) { extract_obj(fount); break; } if (!(fount = read_object(FOUNT_UNHOLY))) errlog("unable to load unholy fount in unholy_square."); else obj_to_room(fount, room); *olddesc = room->description; *oldtitle = room->name; room->name = strdup(TITLE_UNHOLY); room->description = strdup(DESC_UNHOLY); SET_BIT(room->zone->flags, ZONE_LOCKED); REMOVE_BIT(room->room_flags, ROOM_PEACEFUL); }
void spell_portal( int sn, int level, CHAR_DATA *ch, void *vo,int target) { CHAR_DATA *victim; OBJ_DATA *portal, *stone; if ( ( victim = get_char_world( ch, target_name ) ) == NULL || victim == ch || victim->in_room == NULL || !can_see_room(ch,victim->in_room) || IS_SET(victim->in_room->room_flags, ROOM_SAFE) || IS_SET(victim->in_room->room_flags, ROOM_PRIVATE) || IS_SET(victim->in_room->room_flags, ROOM_SOLITARY) || IS_SET(victim->in_room->room_flags, ROOM_DRAGONPIT) || IS_SET(ch->in_room->room_flags, ROOM_DRAGONPIT) || IS_SET(victim->in_room->room_flags, ROOM_NO_RECALL) || IS_SET(victim->in_room->area->area_flags, AREA_PROTO ) || IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) || victim->level >= level + 3 || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) || (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) || (is_clan(victim) && !is_same_clan(ch,victim))) { send_to_char( "You failed.\n\r", ch ); return; } if (!IS_IMP(ch)) { if (IS_IMMORTAL(ch)) { send_to_char("\n\r{rIMMs can use {RGOTO{r so there is no reason to be opening {RPORTAL{r.{x\n\r",ch); return; } } stone = get_eq_char(ch,WEAR_HOLD); if (!IS_IMMORTAL(ch) && (stone == NULL || stone->item_type != ITEM_WARP_STONE)) { send_to_char("You lack the proper component for this spell.\n\r",ch); return; } if (stone != NULL && stone->item_type == ITEM_WARP_STONE) { act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR); //act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR); //extract_obj(stone); } portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); portal->timer = 2 + level / 25; portal->value[3] = victim->in_room->vnum; obj_to_room(portal,ch->in_room); act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM); act("$p rises up before you.",ch,portal,NULL,TO_CHAR); }
/* * Disarm a creature. * Caller must check for successful attack. */ void disarm( CHAR_DATA *ch, CHAR_DATA *victim ) { OBJ_DATA *obj; if ( ( obj = get_eq_char( victim, WEAR_WIELD ) ) == NULL ) return; if ( IS_OBJ_STAT(obj,ITEM_NOREMOVE)) { act("$S weapon won't budge!",ch,NULL,victim,TO_CHAR, 1); act("$n tries to disarm you, but your weapon won't budge!", ch,NULL,victim,TO_VICT, 0); act("$n tries to disarm $N, but fails.",ch,NULL,victim,TO_NOTVICT, 0); return; } act( "$n DISARMS you and sends your weapon flying!", ch, NULL, victim, TO_VICT, 1 ); act( "You disarm $N!", ch, NULL, victim, TO_CHAR, 1 ); act( "$n disarms $N!", ch, NULL, victim, TO_NOTVICT, 0 ); obj_from_char( obj ); if ( IS_OBJ_STAT(obj,ITEM_NODROP) || IS_OBJ_STAT(obj,ITEM_INVENTORY) ) obj_to_char( obj, victim ); else { obj_to_room( obj, victim->in_room ); if (IS_NPC(victim) && victim->wait == 0 && can_see_obj(victim,obj)) get_obj(victim,obj,NULL); } return; }
void make_bloodstain( CHAR_DATA * ch ) { OBJ_DATA *obj; obj = create_object( get_obj_index( OBJ_VNUM_BLOODSTAIN ), 0 ); obj->timer = number_range( 1, 2 ); obj_to_room( obj, ch->in_room ); }
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)); }
/* * Make a fire. */ void make_fire( ROOM_INDEX_DATA * in_room, short timer ) { OBJ_DATA *fire; fire = create_object( get_obj_index( OBJ_VNUM_FIRE ), 0 ); fire->timer = number_fuzzy( timer ); obj_to_room( fire, in_room ); return; }
void make_blood( CHAR_DATA * ch ) { OBJ_DATA *obj; obj = create_object( get_obj_index( OBJ_VNUM_BLOOD ), 0 ); obj->timer = number_range( 2, 4 ); obj->value[1] = number_range( 3, UMIN( 5, ch->level ) ); obj_to_room( obj, ch->in_room ); }
void MakeScrap(struct char_data *ch, struct obj_data *obj) { char buf[256]; struct obj_data *t, *x; int pos; if (!ch || !obj || (ch->in_room == NOWHERE)) return; act("$p falls to the ground in scraps.", TRUE, ch, obj, 0, TO_CHAR); act("$p falls to the ground in scraps.", TRUE, ch, obj, 0, TO_ROOM); t = read_object(9, VIRTUAL); if (!t) return; sprintf(buf, "Scraps from %s&n lie in a pile", obj->short_description); t->description = str_dup(buf); t->short_description = str_dup("a pile of scraps"); if (obj->carried_by) { obj_from_char(obj); } else if (obj->worn_by) { for (pos = 0; pos < NUM_WEARS; pos++) if (ch->equipment[pos] == obj) break; if (pos >= NUM_WEARS) { log("SYSERR: MakeScrap(), can't find worn object in equip"); exit(1); } obj = unequip_char(ch, pos); } obj_to_room(t, ch->in_room); while (obj->contains) { x = obj->contains; obj_from_obj(x); obj_to_room(x, ch->in_room); } extract_obj(obj); }
void Teleport( int pulse ) { struct char_data *ch; struct obj_data *obj_object, *temp_obj; int or; if(DEBUG) dlog("Teleport"); if (pulse < 0) return; if(MOUNTED(ch)) { FallOffMount(ch,MOUNTED(ch)); Dismount(ch,MOUNTED(ch),POSITION_SITTING); } else if(RIDDEN(ch)) { FallOffMount(RIDDEN(ch),ch); Dismount(RIDDEN(ch),ch,POSITION_SITTING); } for (ch = character_list; ch; ch = ch->next) { if (ch->in_room != NOWHERE) { if (real_roomp(ch->in_room)->tele_targ > 0) { if (real_roomp(ch->in_room)->tele_time > 0) { if ((pulse % real_roomp(ch->in_room)->tele_time)==0) { obj_object = real_roomp(ch->in_room)->contents; while (obj_object) { temp_obj = obj_object->next_content; obj_from_room(obj_object); obj_to_room(obj_object, real_roomp(ch->in_room)->tele_targ); obj_object = temp_obj; } or = ch->in_room; char_from_room(ch); char_to_room(ch, real_roomp(or)->tele_targ); if (real_roomp(or)->tele_look) { do_look(ch, "\0",15); } } } } } } }
/* * A healer spell that will allow the healer to create a bind stone that will stay in the * room with some of their healing power imbued into it. The bind stone will be an object * that can't be moved or sacrificed. Only one can exist in an area. It will have a certain * amount of charges that it can be used. When a player touches it, they will be healed. * when the bind stone's magic is used up it will disappear into the ether. The item won't * disappear with time however.. it must be used. For now, this will not survive copyover's * or reboots. */ void spell_healers_bind(int sn, int level, CHAR_DATA *ch, void *vo, int target) { OBJ_DATA *obj; OBJ_DATA *objSearch; int charges = 0; // First, let's see if there are any other bind stones in the area, if so, we // are not going to cast this. These will not be in containers. for (objSearch = object_list; objSearch != NULL; objSearch = objSearch->next) { // Can't be in a null room if (objSearch->in_room != NULL) { // Only one per area at a time. if (objSearch->pIndexData->vnum == OBJ_VNUM_HEALERS_BIND && objSearch->in_room->area->vnum == ch->in_room->area->vnum) { send_to_char("A healer's bind stone already exists somewhere in this area...\r\n", ch); return; } } } // Base is level / 5 charges = ch->level / 5; // +1 for bless if (is_affected(ch, gsn_bless)) { charges += 1; } // +1 for enhanced recovery, the healer can then pass that along. if (is_affected(ch, gsn_enhanced_recovery)) { charges += 1; } // Cut in half if these are the case.. if (is_affected(ch, gsn_curse) || is_affected(ch, gsn_weaken)) { charges = charges / 2; } obj = create_object(get_obj_index(OBJ_VNUM_HEALERS_BIND)); obj->value[0] = charges; // The number of charges obj->value[1] = 50; // The amount it heals obj_to_room(obj, ch->in_room); act("$p slowly fades into existence.", ch, obj, NULL, TO_ROOM); act("$p slowly fades into existence.", ch, obj, NULL, TO_CHAR); } // end spell_create_healers_bind
int pray_for_items(struct char_data *ch, int cmd, char *arg) { char buf[256]; int key_room, gold; bool found; struct obj_data *tmp_obj, *obj; struct extra_descr_data *ext; if (cmd != 176) /* You must pray to get the stuff */ return FALSE; key_room = 1+ch->in_room; strcpy(buf, "item_for_"); strcat(buf, GET_NAME(ch)); gold = 0; found = FALSE; for (tmp_obj = world[key_room].contents; tmp_obj; tmp_obj = tmp_obj->next_content) for(ext = tmp_obj->ex_description; ext; ext = ext->next) if (str_cmp(buf, ext->keyword) == 0) { if (gold == 0) { gold = 1; act("$n kneels and at the altar and chants a prayer to Odin.", FALSE, ch, 0, 0, TO_ROOM); act("You notice a faint light in Odin's eye.", FALSE, ch, 0, 0, TO_CHAR); } obj = read_object(tmp_obj->item_number, REAL); obj_to_room(obj, ch->in_room); act("$p slowly fades into existence.",FALSE,ch,obj,0,TO_ROOM); act("$p slowly fades into existence.",FALSE,ch,obj,0,TO_CHAR); gold += obj->obj_flags.cost; found = TRUE; } if (found) { GET_GOLD(ch) -= gold; GET_GOLD(ch) = MAX(0, GET_GOLD(ch)); return TRUE; } return FALSE; }
void handle_waterwheel_destruction(OBJ_DATA & obj) { // Verify a room ROOM_INDEX_DATA * room(get_room_for_obj(obj)); if (room == NULL) return; // Load up the remains and transfer the contents OBJ_DATA * remains(create_object(get_obj_index(OBJ_VNUM_WATERWHEEL_REMAINS), 0)); remains->level = obj.level; for (OBJ_DATA * item(obj.contains); item != NULL; item = obj.contains) { obj_from_obj(item); obj_to_obj(item, remains); } obj_to_room(remains, room); }
int fido(struct char_data *ch, int cmd, char *arg) { struct obj_data *i, *temp, *next_obj; if (cmd || !AWAKE(ch)) return(FALSE); for (i = world[ch->in_room].contents; i; i = i->next_content) { if (GET_ITEM_TYPE(i)==ITEM_CONTAINER && i->obj_flags.value[3]) { act("$n savagely devour a corpse.", FALSE, ch, 0, 0, TO_ROOM); for(temp = i->contains; temp; temp=next_obj) { next_obj = temp->next_content; obj_from_obj(temp); obj_to_room(temp,ch->in_room); } extract_obj(i); return(TRUE); } } return(FALSE); }
/* * Donate Command */ void do_donate(CHAR_DATA *ch, char *argument) { char Object_Name[MAX_INPUT_LENGTH]; ROOM_INDEX_DATA *xRoom; OBJ_DATA *xObject; int DONATION_ROOM; argument = one_argument(argument, Object_Name); if(Object_Name == '\0') { send_to_char("Donate WHAT Object?", ch); return; } if((xObject = get_obj_carry(ch, Object_Name)) == NULL) { send_to_char("You can't donate that item! You have not got it!", ch); return; } switch(xObject->item_type) { case ITEM_WEAPON : DONATION_ROOM = DONATION_ROOM_WEAPON; break; case ITEM_ARMOR : DONATION_ROOM = DONATION_ROOM_ARMOR; break; default : DONATION_ROOM = DONATION_ROOM_REST; break; } if((xRoom = get_room_index(DONATION_ROOM)) == NULL) { bug("Donate Room Does Not Exist : %d", DONATION_ROOM); return; } act("$p vanishes from your hands in a pink mist.", ch, xObject, NULL, TO_CHAR); act("$p vanishes from $n's hands in a pink mist.", ch, xObject, NULL, TO_ROOM); obj_from_char(xObject); obj_to_room(xObject, xRoom); act("$p appears in a pink mist in the room.", ch, xObject, NULL, TO_ROOM); return; }
void read_obj_file( char *dirname, char *filename ) { ROOM_INDEX_DATA *room; FILE *fp; char fname[256]; int vnum; vnum = atoi( filename ); if( ( room = get_room_index( vnum ) ) == NULL ) { bug( "read_obj_file: ARGH! Missing room index for %d!", vnum ); return; } snprintf( fname, 256, "%s%s", dirname, filename ); if( ( fp = fopen( fname, "r" ) ) != NULL ) { short iNest; bool found; OBJ_DATA *tobj, *tobj_next; rset_supermob( room ); for( iNest = 0; iNest < MAX_NEST; iNest++ ) rgObjNest[iNest] = NULL; found = TRUE; for( ;; ) { char letter; const char *word; letter = fread_letter( fp ); if( letter == '*' ) { fread_to_eol( fp ); continue; } if( letter != '#' ) { bug( "%s", "read_obj_file: # not found." ); break; } word = fread_word( fp ); if( !str_cmp( word, "OBJECT" ) ) /* Objects */ fread_obj( supermob, fp, OS_CARRY ); else if( !str_cmp( word, "END" ) ) /* Done */ break; else { bug( "read_obj_file: bad section: %s", word ); break; } } FCLOSE( fp ); unlink( fname ); for( tobj = supermob->first_carrying; tobj; tobj = tobj_next ) { tobj_next = tobj->next_content; #ifdef OVERLANDCODE if( IS_OBJ_STAT( tobj, ITEM_ONMAP ) ) { SET_ACT_FLAG( supermob, ACT_ONMAP ); supermob->map = tobj->map; supermob->x = tobj->x; supermob->y = tobj->y; } #endif obj_from_char( tobj ); #ifndef OVERLANDCODE obj_to_room( tobj, room ); #else obj_to_room( tobj, room, supermob ); REMOVE_ACT_FLAG( supermob, ACT_ONMAP ); supermob->map = -1; supermob->x = -1; supermob->y = -1; #endif } release_supermob( ); } else log_string( "Cannot open obj file" ); return; }
/* Update PCs, NPCs, and objects */ void point_update(void) { struct char_data *i, *next_char; struct obj_data *j, *next_thing, *jj, *next_thing2; /* characters */ for (i = character_list; i; i = next_char) { next_char = i->next; gain_condition(i, FULL, -1); gain_condition(i, DRUNK, -1); gain_condition(i, THIRST, -1); if (GET_POS(i) >= POS_STUNNED) { GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i)); GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i)); GET_MOVE(i) = MIN(GET_MOVE(i) + move_gain(i), GET_MAX_MOVE(i)); if (AFF_FLAGGED(i, AFF_POISON)) if (damage(i, i, 2, SPELL_POISON) == -1) continue; /* Oops, they died. -gg 6/24/98 */ if (GET_POS(i) <= POS_STUNNED) update_pos(i); } else if (GET_POS(i) == POS_INCAP) { if (damage(i, i, 1, TYPE_SUFFERING) == -1) continue; } else if (GET_POS(i) == POS_MORTALLYW) { if (damage(i, i, 2, TYPE_SUFFERING) == -1) continue; } if (!IS_NPC(i)) { update_char_objects(i); if (GET_LEVEL(i) < idle_max_level) check_idling(i); } } /* objects */ for (j = object_list; j; j = next_thing) { next_thing = j->next; /* Next in object list */ /* If this is a corpse */ if (IS_CORPSE(j)) { /* timer count down */ if (GET_OBJ_TIMER(j) > 0) GET_OBJ_TIMER(j)--; if (!GET_OBJ_TIMER(j)) { if (j->carried_by) act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR); else if ((IN_ROOM(j) != NOWHERE) && (world[IN_ROOM(j)].people)) { act("A quivering horde of maggots consumes $p.", TRUE, world[IN_ROOM(j)].people, j, 0, TO_ROOM); act("A quivering horde of maggots consumes $p.", TRUE, world[IN_ROOM(j)].people, j, 0, TO_CHAR); } for (jj = j->contains; jj; jj = next_thing2) { next_thing2 = jj->next_content; /* Next in inventory */ obj_from_obj(jj); if (j->in_obj) obj_to_obj(jj, j->in_obj); else if (j->carried_by) obj_to_room(jj, IN_ROOM(j->carried_by)); else if (IN_ROOM(j) != NOWHERE) obj_to_room(jj, IN_ROOM(j)); else core_dump(); } extract_obj(j); } } /* If the timer is set, count it down and at 0, try the trigger */ /* note to .rej hand-patchers: make this last in your point-update() */ else if (GET_OBJ_TIMER(j)>0) { GET_OBJ_TIMER(j)--; if (!GET_OBJ_TIMER(j)) timer_otrigger(j); } } }
void do_disarm(struct char_data *ch, char *argument, int cmd) { char name[30]; int percent; struct char_data *victim; struct obj_data *w; int chance; int cost; if (check_peaceful(ch,"You feel too peaceful to contemplate violence.\n\r")) return; only_argument(argument, name); if (!(victim = get_char_room_vis(ch, name))) { if (ch->specials.fighting) { victim = ch->specials.fighting; } else { send_to_char("Disarm who?\n\r", ch); return; } } if (victim == ch) { send_to_char("Aren't we funny today...\n\r", ch); return; } if(!CheckKill(ch,victim)) return; if(ch->attackers > 3) { send_to_char("There is no room to disarm!\n\r", ch); return; } if(victim->attackers > 3) { send_to_char("There is no room to disarm!\n\r",ch); return; } cost = 25 - (GET_LEVEL(ch,BestFightingClass(ch))/10); if(GET_MANA(ch)<cost) { send_to_char("You trip and fall while trying to disarm.\n\r",ch); return; } percent=number(1,101); /* 101% is a complete failure */ percent -= dex_app[GET_DEX(ch)].reaction; percent += dex_app[GET_DEX(victim)].reaction; if(!ch->equipment[WIELD] && !ch->equipment[WIELD_TWOH]) { percent -= 50; } if(percent > ch->skills[SKILL_DISARM].learned) { /* failure */ GET_MANA(ch) -= 10; act("You try to disarm $N, but fail miserably.",TRUE,ch,0,victim,TO_CHAR); if((ch->equipment[WIELD]) && (number(1,10) > 8)) { send_to_char("Your weapon flies from your hand while trying!\n\r",ch); w = unequip_char(ch,WIELD); obj_from_char(w); obj_to_room(w,ch->in_room); act("$n tries to disarm $N, but $n loses his weapon!",TRUE,ch,0,victim,TO_ROOM); } else if((ch->equipment[WIELD_TWOH]) && (number(1,10) > 9)) { send_to_char("Your weapon slips from your hands while trying!\n\r",ch); w = unequip_char(ch,WIELD_TWOH); obj_from_char(w); obj_to_room(w,ch->in_room); act("$n tries to disarm $N, but $n loses his weapon!",TRUE,ch,0,victim,TO_ROOM); } GET_POS(ch) = POSITION_SITTING; if((IS_NPC(victim)) && (GET_POS(victim) > POSITION_SLEEPING) && (!victim->specials.fighting)) { set_fighting(victim, ch); } WAIT_STATE(ch, PULSE_VIOLENCE*2); } else { if(victim->equipment[WIELD]) { GET_MANA(ch) -= 25; w = unequip_char(victim, WIELD); act("$n makes an impressive fighting move.",TRUE, ch, 0, 0, TO_ROOM); act("You send $p flying from $N's grasp.", TRUE, ch, w, victim, TO_CHAR); act("$p flies from your grasp.", TRUE, ch, w, victim, TO_VICT); obj_from_char(w); obj_to_room(w, victim->in_room); if(ch->skills[SKILL_DISARM].learned < 50) ch->skills[SKILL_DISARM].learned += 2; } else if(victim->equipment[WIELD_TWOH]) { GET_MANA(ch) -= cost; if(IS_NPC(victim)) chance = 70; else chance = victim->skills[SKILL_TWO_HANDED].learned; percent=number(1,101); /* 101% is a complete failure */ if(percent > chance) { w = unequip_char(victim, WIELD_TWOH); act("$n makes a very impressive fighting move.",TRUE, ch, 0, 0, TO_ROOM); act("You send $p flying from $N's grasp.", TRUE, ch, w, victim, TO_CHAR); act("$p flies from your grasp.", TRUE, ch, w, victim, TO_VICT); obj_from_char(w); obj_to_room(w, victim->in_room); if(ch->skills[SKILL_DISARM].learned < 50) ch->skills[SKILL_DISARM].learned += 4; } else { act("You try to disarm $N, but fail miserably.",TRUE,ch,0,victim,TO_CHAR); } } else { act("You try to disarm $N, but $E doesn't have a weapon.", TRUE, ch, 0, victim, TO_CHAR); act("$n makes an impressive fighting move, but does little more.", TRUE, ch, 0, 0, TO_ROOM); } if ((IS_NPC(victim)) && (GET_POS(victim) > POSITION_SLEEPING) && (!victim->specials.fighting)) { set_fighting(victim, ch); } WAIT_STATE(ch, PULSE_VIOLENCE*1); } }
/* ** Update PCs, NPCs, and objects */ void point_update( void ) { int slot; void update_char_objects(CharData * ch); /* handler.c */ void extract_obj(ObjData * obj); /* handler.c */ void update_char_quests(CharData * ch); /* quest.c */ CharData *i, *next_char; ObjData *j, *next_thing, *jj, *next_thing2, *debugnext; int loopvar; /* characters */ for( i = character_list; i; i = next_char ) { next_char = i->next; // state flags i->tickstate = 0; /* dismount anyone who's gotten separated from their steed */ /* Note that it's superfluous to check for both rider AND mount */ if (i->rider && i->rider->in_room != i->in_room) { i->rider->mount = NULL; i->rider = NULL; } /* Prayer timer */ if (i->player_specials->saved.prayer_time > 0) { if (i->player_specials->saved.prayer_time == 1) { i->player_specials->saved.prayer_time = 0; send_to_char("Your prayers will be heard once again.\r\n", i); } else i->player_specials->saved.prayer_time -= 1; } for(slot = 0; slot<4; slot++) { if (COOLDOWN(i, slot) ) { COOLDOWN(i, slot) -= 1; if (!COOLDOWN(i, slot) ) { switch( GET_CLASS(i) ) { case CLASS_DEATH_KNIGHT: break; case CLASS_SOLAMNIC_KNIGHT: break; case CLASS_MAGIC_USER: break; case CLASS_SHADOW_DANCER: if(slot == SLOT_SLIPPERY_MIND) break; else if(slot == SLOT_NODESHIFT) sendChar(i, "You may once again shift your spectrum.\r\n"); else sendChar(i, "ERROR!\r\n"); break; case CLASS_THIEF: if(slot== SLOT_BLACKJACK) { sendChar(i, "You are able to use blackjack again.\r\n"); break; } else sendChar(i, "ERROR!\r\n"); case CLASS_ASSASSIN: if(slot == SLOT_DETERRENCE) sendChar(i, "You are able to use deterrence again.\r\n"); else sendChar(i, "ERROR!\r\n"); break; case CLASS_CLERIC: if(slot == SLOT_SHADOW_FORM) sendChar(i, "You are ready to enter shadow form again..\r\n"); else sendChar(i, "ERROR!\r\n"); case CLASS_WARRIOR: if(slot == SLOT_REDOUBT) sendChar(i, "You can shield yourself again.\r\n"); else if(slot == SLOT_COMMANDING_SHOUT) sendChar(i, "You can shout commands again.\r\n"); else sendChar(i, "ERROR!\r\n"); break; case CLASS_SHOU_LIN: break; case CLASS_RANGER: break; case CLASS_NECROMANCER: if(slot == SLOT_QUICKEN) sendChar(i, "You may once again rise from the grave.\r\n"); else if(slot == SLOT_METAMORPHOSIS) sendChar(i, "You may once again metamorphisize.\r\n"); else sendChar(i, "ERROR!\r\n"); break; default: sendChar(i, "ERROR!\r\n"); break; } } } } if( IS_AFFECTED(i, AFF_PLAGUE )) infectious(i); if( !IS_NPC(i) ) { update_char_objects(i); if( GET_LEVEL(i) < LVL_GOD ) check_idling(i); update_char_quests(i); } gain_condition(i, HUNGER, IS_AFFECTED(i, AFF_REGENERATE)? -2:-1); gain_condition(i, DRUNK, -1); /* Amara get thirsty in different ways */ if (IS_AMARA(i)) { if (IN_ROOM(i) >= 0 && IN_ROOM(i) <= top_of_world) { switch (SECT(IN_ROOM(i))) { case SECT_WATER_SWIM: case SECT_WATER_NOSWIM: gain_condition(i, THIRST, 1); break; case SECT_UNDERWATER: case SECT_UNDERWATER_RIVER: gain_condition(i, THIRST, 24); break; default: gain_condition(i, THIRST, -2); break; } } else gain_condition(i, THIRST, -2); } else gain_condition(i, THIRST, -1); }/* for */ debugnext = NULL; /* objects */ for( j = object_list; j; j = next_thing ) { next_thing = j->next; /* Next in object list */ debugnext = j; // we didn't crash if we got here if( IS_SET_AR( j->obj_flags.extra_flags, ITEM_TIMED )) { if( GET_OBJ_TIMER(j) > 0 ) GET_OBJ_TIMER(j)--; if (GET_OBJ_TIMER(j) == 0) { if(contains_soulbound(j)) { GET_OBJ_TIMER(j) = 1; continue; } if (SCRIPT_CHECK(j, OTRIG_TIMER)) { REMOVE_BIT_AR(j->obj_flags.extra_flags, ITEM_TIMED); timer_otrigger(j); continue; // don't do anything more with this } } if( GET_OBJ_TYPE(j) == ITEM_KEY ) { static char *keyVaporMsgs[] = { "$p vanishes with a flash.", "$p begins to shake violently.", "$p begins to vibrate.", "$p begins to hum.", "$p begins to glow." }; if( GET_OBJ_TIMER(j) < (sizeof( keyVaporMsgs )/sizeof( *keyVaporMsgs ))) { int vaporMsg = GET_OBJ_TIMER(j); if( j->carried_by ) act( keyVaporMsgs[ vaporMsg ], FALSE, j->carried_by, j, 0, TO_CHAR); else if( j->worn_by ) { act( keyVaporMsgs[ vaporMsg ], FALSE, j->worn_by, j, 0, TO_CHAR); for( loopvar = 0; loopvar < NUM_WEARS; loopvar++ ) { if( j->worn_by->equipment[loopvar] == j ) j->worn_by->equipment[loopvar] = 0; } } else if( j->in_room != NOWHERE && world[j->in_room].people ) { act( keyVaporMsgs[ vaporMsg ], FALSE, world[j->in_room].people, j, 0, TO_CHAR); act( keyVaporMsgs[ vaporMsg ], FALSE, world[j->in_room].people, j, 0, TO_ROOM); } extract_obj(j); continue; }/* ITEM_KEY has timed out */ }/* if ITEM_KEY */ else if (GET_OBJ_TYPE(j) == ITEM_AFFECT) { if (!GET_OBJ_TIMER(j)) { if (j->in_room != NOWHERE && world[j->in_room].people) { act(j->action_description, FALSE, world[j->in_room].people, j, 0, TO_CHAR); act(j->action_description, FALSE, world[j->in_room].people, j, 0, TO_ROOM); } extract_obj(j); continue; // object gone, don't act further on it! } } else if( !GET_OBJ_TIMER(j) ) { /* The object timed out - delete it */ if( j->carried_by ) act( "$p crumbles to dust and is blown away.", FALSE, j->carried_by, j, 0, TO_CHAR ); else if( j->worn_by ) { act("$p crumbles to dust and is blown away.", FALSE, j->worn_by, j, 0, TO_CHAR); unequip_char( j->worn_by, j->worn_at ); } else if( j->in_room != NOWHERE && world[j->in_room].people ) { act( "$p crumbles to dust and is blown away.", FALSE, world[j->in_room].people, j, 0, TO_CHAR); act( "$p crumbles to dust and is blown away.", FALSE, world[j->in_room].people, j, 0, TO_ROOM); } extract_obj(j); continue; // object gone, don't act further on it! } } /* if OBJ_TIMED */ /* if this looks like a portal */ if ( (GET_OBJ_RNUM(j) >= 0 && GET_OBJ_RNUM(j) <= top_of_objt) && obj_index[GET_OBJ_RNUM(j)].func == portal_proc && GET_OBJ_TYPE(j) == ITEM_OTHER ) { /* Mage created portals are type other, permanent portals are type portal. */ /* Permanent portals thus don't decay. */ if (GET_OBJ_VAL(j, 2) > 0) GET_OBJ_VAL(j,2)--; } /* ** Digger */ /* If this is a corpse */ if ((GET_OBJ_TYPE(j) == ITEM_CONTAINER) && GET_OBJ_VAL(j, 3)) { /* timer count down */ if (GET_OBJ_TIMER(j) > 0) GET_OBJ_TIMER(j)--; // PC corpses which are empty will decay eventually.. if(!CAN_WEAR(j, ITEM_WEAR_TAKE) && !(j->contains)) { GET_OBJ_TIMER(j) = MAX(GET_OBJ_TIMER(j) / 3, 0); } if (!GET_OBJ_TIMER(j)) { if(contains_soulbound(j)) { GET_OBJ_TIMER(j) = 1; continue; } if (j->carried_by) act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR); else if ((j->in_room != NOWHERE) && (world[j->in_room].people)) { static char *decay_messages[] = { "A quivering hoard of maggots consumes $p.", "A flock of vultures swoop down from the sky to devour $p.", "The $p rots and decays as the shards of bone are blown to the four winds.", "The $p rots and decays leaving behind the pungent stench of death.", "A bolt of holy fire streaks from the heavens to burn the corpse of $p to ash.", "The $p rots to ash and is swept away by the winds of time." }; int decay_idx = (int)( random() % ( sizeof( decay_messages ) / sizeof( *decay_messages ))); act( decay_messages[ decay_idx ], TRUE, world[j->in_room].people, j, 0, TO_ROOM); act( decay_messages[ decay_idx ], TRUE, world[j->in_room].people, j, 0, TO_CHAR); }/* JBP */ for (jj = j->contains; jj; jj = next_thing2) { next_thing2 = jj->next_content; /* Next in inventory */ obj_from_obj(jj); if (j->in_obj) { if ( GET_OBJ_TYPE(j) != ITEM_KEY && GET_OBJ_TYPE(j) != ITEM_SCROLL && GET_OBJ_TYPE(j) != ITEM_POTION && GET_OBJ_TYPE(j) != ITEM_DUST && (GET_OBJ_VNUM(j) == 1460 || GET_OBJ_VNUM(j) == 1461 || GET_OBJ_VNUM(j) == 1462 ) ) continue; // Refrigeration to keep food from rotting. obj_to_obj(jj, j->in_obj); } else if (j->carried_by) obj_to_room(jj, j->carried_by->in_room); else if (j->in_room != NOWHERE) obj_to_room(jj, j->in_room); else { /* OLD WAY: assert(FALSE); */ mudlog(NRM, LVL_IMMORT, TRUE, "SYSERR: Something is wrong with a container." ); obj_to_room(jj, real_room(1201)); } } extract_obj(j); } } /* Imhotep: Added support for ITEM_TROPHY pieces that decay after * a given MUD date */ if(IS_OBJ_STAT(j, ITEM_TROPHY)) { if(GET_OBJ_TIMER(j) < TICKS_SO_FAR) { if (j->carried_by) act("$p shimmers and vanishes out of your hands!", FALSE, j->carried_by, j, 0, TO_CHAR); else if (j->worn_by) { act("$p shimmers and vanishes!", FALSE, j->worn_by, j, 0, TO_CHAR); unequip_char(j->worn_by, j->worn_at); } else if (j->in_room != NOWHERE && world[j->in_room].people) { act("$p shimmers and vanishes!", FALSE, world[j->in_room].people, j, 0, TO_CHAR); act("$p shimmers and vanishes!", FALSE, world[j->in_room].people, j, 0, TO_ROOM); } extract_obj(j); continue; } } } }/* point_update */
void acid_effect(void *vo, int level, int dam, int target) { if (target == TARGET_ROOM) /* nail objects on the floor */ { ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; OBJ_DATA *obj, *obj_next; for (obj = room->contents; obj != NULL; obj = obj_next) { obj_next = obj->next_content; acid_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_CHAR) /* do the effect on a victim */ { CHAR_DATA *victim = (CHAR_DATA *) vo; OBJ_DATA *obj, *obj_next; /* let's toast some gear */ for (obj = victim->carrying; obj != NULL; obj = obj_next) { obj_next = obj->next_content; acid_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_OBJ) /* toast an object */ { OBJ_DATA *obj = (OBJ_DATA *) vo; OBJ_DATA *t_obj,*n_obj; int chance = level / 4 + dam / 10; char *msg; if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) || IS_OBJ_STAT(obj,ITEM_NOPURGE) || number_range(0,4) == 0) return; if (chance > 25) chance = (chance - 25) / 2 + 25; if (chance > 50) chance = (chance - 50) / 2 + 50; if (IS_OBJ_STAT(obj,ITEM_BLESS)) chance -= 5; chance -= obj->level * 2; switch (obj->item_type) { default: return; case ITEM_CONTAINER: case ITEM_CORPSE_PC: case ITEM_CORPSE_NPC: msg = "$p fumes and dissolves."; break; case ITEM_ARMOR: msg = "$p is pitted and etched."; break; case ITEM_CLOTHING: msg = "$p is corroded into scrap."; break; case ITEM_STAFF: case ITEM_WAND: chance -= 10; msg = "$p corrodes and breaks."; break; case ITEM_SCROLL: chance += 10; msg = "$p is burned into waste."; break; } chance = URANGE(5,chance,95); if (number_percent() > chance) return; if (obj->carried_by != NULL) act(msg,obj->carried_by,obj,NULL,TO_ALL); else if (obj->in_room != NULL && obj->in_room->people != NULL) act(msg,obj->in_room->people,obj,NULL,TO_ALL); if (obj->item_type == ITEM_ARMOR) /* etch it */ { AFFECT_DATA *paf; bool af_found = FALSE; int i; affect_enchant(obj); for ( paf = obj->affected; paf != NULL; paf = paf->next) { if ( paf->location == APPLY_AC) { af_found = TRUE; paf->type = -1; paf->modifier += 1; paf->level = UMAX(paf->level,level); break; } } if (!af_found) /* needs a new affect */ { paf = new_affect(); paf->type = -1; paf->level = level; paf->duration = -1; paf->location = APPLY_AC; paf->modifier = 1; paf->bitvector = 0; paf->next = obj->affected; obj->affected = paf; } if (obj->carried_by != NULL && obj->wear_loc != WEAR_NONE) for (i = 0; i < 4; i++) obj->carried_by->armor[i] += 1; return; } /* get rid of the object */ if (obj->contains) /* dump contents */ { for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) { n_obj = t_obj->next_content; obj_from_obj(t_obj); if (obj->in_room != NULL) obj_to_room(t_obj,obj->in_room); else if (obj->carried_by != NULL) obj_to_room(t_obj,obj->carried_by->in_room); else { extract_obj(t_obj); continue; } acid_effect(t_obj,level/2,dam/2,TARGET_OBJ); } } extract_obj(obj); return; } }
void fire_effect(void *vo, int level, int dam, int target) { if (target == TARGET_ROOM) /* nail objects on the floor */ { ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo; OBJ_DATA *obj, *obj_next; for (obj = room->contents; obj != NULL; obj = obj_next) { obj_next = obj->next_content; fire_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_CHAR) /* do the effect on a victim */ { CHAR_DATA *victim = (CHAR_DATA *) vo; OBJ_DATA *obj, *obj_next; /* chance of blindness */ if (!IS_AFFECTED(victim,AFF_BLIND) && !saves_spell(level / 4 + dam / 20, victim,DAM_FIRE)) { AFFECT_DATA af; act("$n is blinded by smoke!",victim,NULL,NULL,TO_ROOM); act("Your eyes tear up from smoke...you can't see a thing!", victim,NULL,NULL,TO_CHAR); af.where = TO_AFFECTS; af.type = skill_lookup("fire breath"); af.level = level; af.duration = number_range(0,level/10); af.location = APPLY_HITROLL; af.modifier = -4; af.bitvector = AFF_BLIND; affect_to_char(victim,&af); } /* getting thirsty */ if (!IS_NPC(victim)) gain_condition(victim,COND_THIRST,dam/20); /* let's toast some gear! */ for (obj = victim->carrying; obj != NULL; obj = obj_next) { obj_next = obj->next_content; fire_effect(obj,level,dam,TARGET_OBJ); } return; } if (target == TARGET_OBJ) /* toast an object */ { OBJ_DATA *obj = (OBJ_DATA *) vo; OBJ_DATA *t_obj,*n_obj; int chance = level / 4 + dam / 10; char *msg; if (IS_OBJ_STAT(obj,ITEM_BURN_PROOF) || IS_OBJ_STAT(obj,ITEM_NOPURGE) || number_range(0,4) == 0) return; if (chance > 25) chance = (chance - 25) / 2 + 25; if (chance > 50) chance = (chance - 50) / 2 + 50; if (IS_OBJ_STAT(obj,ITEM_BLESS)) chance -= 5; chance -= obj->level * 2; switch ( obj->item_type ) { default: return; case ITEM_CONTAINER: msg = "$p ignites and burns!"; break; case ITEM_POTION: chance += 25; msg = "$p bubbles and boils!"; break; case ITEM_SCROLL: chance += 50; msg = "$p crackles and burns!"; break; case ITEM_STAFF: chance += 10; msg = "$p smokes and chars!"; break; case ITEM_WAND: msg = "$p sparks and sputters!"; break; case ITEM_FOOD: msg = "$p blackens and crisps!"; break; case ITEM_PILL: msg = "$p melts and drips!"; break; } chance = URANGE(5,chance,95); if (number_percent() > chance) return; if (obj->carried_by != NULL) act( msg, obj->carried_by, obj, NULL, TO_ALL ); else if (obj->in_room != NULL && obj->in_room->people != NULL) act(msg,obj->in_room->people,obj,NULL,TO_ALL); if (obj->contains) { /* dump the contents */ for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj) { n_obj = t_obj->next_content; obj_from_obj(t_obj); if (obj->in_room != NULL) obj_to_room(t_obj,obj->in_room); else if (obj->carried_by != NULL) obj_to_room(t_obj,obj->carried_by->in_room); else { extract_obj(t_obj); continue; } fire_effect(t_obj,level/2,dam/2,TARGET_OBJ); } } extract_obj( obj ); return; } }
void spell_nexus( int sn, int level, Character *ch, void *vo, int target) { Character *victim; OBJ_DATA *portal, *stone; ROOM_INDEX_DATA *to_room, *from_room; from_room = ch->in_room; if ( ( victim = get_char_world( ch, target_name ) ) == NULL || victim == ch || (to_room = victim->in_room) == NULL || !can_see_room(ch,to_room) || !can_see_room(ch,from_room) || IS_SET(to_room->room_flags, ROOM_SAFE) || IS_SET(from_room->room_flags,ROOM_SAFE) || IS_SET(to_room->room_flags, ROOM_PRIVATE) || IS_SET(to_room->room_flags, ROOM_SOLITARY) || IS_SET(to_room->room_flags, ROOM_NO_RECALL) || IS_SET(from_room->room_flags,ROOM_NO_RECALL) || victim->level >= level + 3 || (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */ || (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON)) || (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) ) || (IS_CLANNED(victim) && !is_same_clan(ch,victim))) { send_to_char( "You failed.\n\r", ch ); return; } stone = get_eq_char(ch,WEAR_HOLD); if (!IS_IMMORTAL(ch) && (stone == NULL || stone->item_type != ITEM_WARP_STONE)) { send_to_char("You lack the proper component for this spell.\n\r",ch); return; } if (stone != NULL && stone->item_type == ITEM_WARP_STONE) { act("You draw upon the power of $p.",ch,stone,NULL,TO_CHAR); act("It flares brightly and vanishes!",ch,stone,NULL,TO_CHAR); extract_obj(stone); } /* portal one */ portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); portal->timer = 1 + level / 10; portal->value[3] = to_room->vnum; obj_to_room(portal,from_room); act("$p rises up from the ground.",ch,portal,NULL,TO_ROOM); act("$p rises up before you.",ch,portal,NULL,TO_CHAR); /* no second portal if rooms are the same */ if (to_room == from_room) return; /* portal two */ portal = create_object(get_obj_index(OBJ_VNUM_PORTAL),0); portal->timer = 1 + level/10; portal->value[3] = from_room->vnum; obj_to_room(portal,to_room); if (to_room->people != NULL) { act("$p rises up from the ground.",to_room->people,portal,NULL,TO_ROOM); act("$p rises up from the ground.",to_room->people,portal,NULL,TO_CHAR); } }
/* RT Enter portals */ void do_enter( CHAR_DATA *ch, char *argument) { ROOM_INDEX_DATA *location; if ( ch->fighting != NULL ) return; /* nifty portal stuff */ if (argument[0] != '\0') { ROOM_INDEX_DATA *old_room; OBJ_DATA *portal; CHAR_DATA *fch, *fch_next; old_room = ch->in_room; portal = get_obj_list( ch, argument, ch->in_room->contents ); if (portal == NULL) { send_to_char("You don't see that here.\n\r",ch); return; } if (portal->item_type != ITEM_PORTAL || (IS_SET(portal->value[1],EX_CLOSED) && !IS_TRUSTED(ch,KNIGHT))) { send_to_char("You can't seem to find a way in.\n\r",ch); return; } if (!IS_TRUSTED(ch,KNIGHT) && !IS_SET(portal->value[2],GATE_NOCURSE) && IS_AFFECTED(ch,AFF_CURSE) ) { send_to_char("Something prevents you from leaving...\n\r",ch); return; } if (IS_SET(portal->value[2],GATE_RANDOM) || portal->value[3] == -1) { location = get_random_room(ch); portal->value[3] = location->vnum; /* for record keeping :) */ } else if (IS_SET(portal->value[2],GATE_BUGGY) && (number_percent() < 5)) location = get_random_room(ch); else location = get_room_index(portal->value[3]); if (location == NULL || location == old_room || !can_see_room(ch,location) || (room_is_private(ch,location) && !IS_TRUSTED(ch,IMPLEMENTOR))) { act("$p doesn't seem to go anywhere.",ch,portal,NULL,TO_CHAR); return; } if (IS_NPC(ch) && IS_SET(ch->act,ACT_AGGRESSIVE) && IS_SET(location->room_flags,ROOM_LAW)) { send_to_char("Something prevents you from leaving...\n\r",ch); return; } act("$n steps into $p.",ch,portal,NULL,TO_ROOM); if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) act("You enter $p.",ch,portal,NULL,TO_CHAR); else act("You walk through $p and find yourself somewhere else...", ch,portal,NULL,TO_CHAR); char_from_room(ch); char_to_room(ch, location); if (IS_SET(portal->value[2],GATE_GOWITH)) /* take the gate along */ { obj_from_room(portal); obj_to_room(portal,location); } if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) act("$n has arrived.",ch,portal,NULL,TO_ROOM); else act("$n has arrived through $p.",ch,portal,NULL,TO_ROOM); do_look(ch,"auto"); /* charges */ if (portal->value[0] > 0) { portal->value[0]--; if (portal->value[0] == 0) portal->value[0] = -1; } /* protect against circular follows */ if (old_room == location) return; for ( fch = old_room->people; fch != NULL; fch = fch_next ) { fch_next = fch->next_in_room; if (portal == NULL || portal->value[0] == -1) /* no following through dead portals */ continue; if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM) && fch->position < POS_STANDING) do_stand(fch,""); if ( fch->master == ch && fch->position == POS_STANDING) { if (IS_SET(ch->in_room->room_flags,ROOM_LAW) && (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE))) { act("You can't bring $N into the city.", ch,NULL,fch,TO_CHAR); act("You aren't allowed in the city.", fch,NULL,NULL,TO_CHAR); continue; } act( "You follow $N.", fch, NULL, ch, TO_CHAR ); do_enter(fch,argument); } } if (portal != NULL && portal->value[0] == -1) { act("$p fades out of existence.",ch,portal,NULL,TO_CHAR); if (ch->in_room == old_room) act("$p fades out of existence.",ch,portal,NULL,TO_ROOM); else if (old_room->people != NULL) { act("$p fades out of existence.", old_room->people,portal,NULL,TO_CHAR); act("$p fades out of existence.", old_room->people,portal,NULL,TO_ROOM); } extract_obj(portal); } /* * If someone is following the char, these triggers get activated * for the followers before the char, but it's safer this way... */ if ( IS_NPC( ch ) && HAS_TRIGGER( ch, TRIG_ENTRY ) ) mp_percent_trigger( ch, NULL, NULL, NULL, TRIG_ENTRY ); if ( !IS_NPC( ch ) ) mp_greet_trigger( ch ); return; } send_to_char("Nope, can't do it.\n\r",ch); return; }
void sit(struct char_data *ch, struct gameobject *on) { // TODO - it is currently possible to defeat object pickup restrictions by // sitting on them. Need to extract can_get_obj from get_obj and use it! // Impassible positions. switch (ch->position) { case POS_SITTING: if (on == NULL || on == ch->on) { send_to_char("You are already sitting down.\n\r", ch); return; } break; case POS_FIGHTING: send_to_char("Maybe you should finish this fight first?\n\r", ch); return; case POS_SLEEPING: if (IS_AFFECTED(ch, AFF_SLEEP)) { send_to_char("You can't wake up!\n\r", ch); return; } break; } // Validate target object, if any. if (on != NULL) { if (!is_situpon(on)) { send_to_char("You can't sit on that.\n\r", ch); return; } if (ch->position == POS_SLEEPING && on != ch->on) { send_to_char("You'll need to wake up to find it.\n\r", ch); return; } if (on->carried_by != NULL && on->carried_by != ch) { act_new("The $p is being held by someone!", ch, on, NULL, TO_CHAR, POS_DEAD, false); return; } if (on->in_obj != NULL) { if (on->in_obj->in_room != ch->in_room) { send_to_char("What? Where?\n\r", ch); return; } } if (ch->on != on && (long)count_users(on) >= on->value[0]) { act_new("There's no more room on $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false); return; } } // Sit down, possibly on and object. ch->position = POS_SITTING; if (on != NULL) { ch->on = on; if (on->carried_by == ch) { obj_from_char(on); obj_to_room(on, ch->in_room); } else if (on->in_obj != NULL) { obj_from_obj(on); obj_to_room(on, ch->in_room); } } // Notify switch (ch->position) { default: if (on == NULL) { send_to_char("You sit down.\n\r", ch); act("$n sits down on the ground.", ch, NULL, NULL, TO_ROOM); } else if (IS_SET(on->value[2], SIT_AT)) { act("You sit down at $p.", ch, on, NULL, TO_CHAR); act("$n sits down at $p.", ch, on, NULL, TO_ROOM); } else if (IS_SET(on->value[2], SIT_ON)) { act("You sit on $p.", ch, on, NULL, TO_CHAR); act("$n sits on $p.", ch, on, NULL, TO_ROOM); } else { act("You sit down in $p.", ch, on, NULL, TO_CHAR); act("$n sits down in $p.", ch, on, NULL, TO_ROOM); } break; case POS_SLEEPING: if (on == NULL) { send_to_char("You wake and sit up.\n\r", ch); act("$n wakes and sits up.", ch, NULL, NULL, TO_ROOM); } else if (IS_SET(on->value[2], SIT_AT)) { act_new("You wake and sit at $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false); act("$n wakes and sits at $p.", ch, on, NULL, TO_ROOM); } else if (IS_SET(on->value[2], SIT_ON)) { act_new("You wake and sit on $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false); act("$n wakes and sits at $p.", ch, on, NULL, TO_ROOM); } else { act_new("You wake and sit in $p.", ch, on, NULL, TO_CHAR, POS_DEAD, false); act("$n wakes and sits in $p.", ch, on, NULL, TO_ROOM); } break; case POS_RESTING: if (on == NULL) { send_to_char("You stop resting.\n\r", ch); } else if (IS_SET(on->value[2], SIT_AT)) { act("You sit at $p.", ch, on, NULL, TO_CHAR); act("$n sits at $p.", ch, on, NULL, TO_ROOM); } else if (IS_SET(on->value[2], SIT_ON)) { act("You sit on $p.", ch, on, NULL, TO_CHAR); act("$n sits on $p.", ch, on, NULL, TO_ROOM); } break; } }
void make_corpse(struct char_data *ch) { char buf2[MAX_NAME_LENGTH + 64]; struct obj_data *corpse, *o; struct obj_data *money; int i; corpse = create_obj(); corpse->item_number = NOTHING; IN_ROOM(corpse) = NOWHERE; corpse->name = strdup("corpse"); snprintf(buf2, sizeof(buf2), "The corpse of %s is lying here.", GET_NAME(ch)); corpse->description = strdup(buf2); snprintf(buf2, sizeof(buf2), "the corpse of %s", GET_NAME(ch)); corpse->short_description = strdup(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)) obj_to_obj(unequip_char(ch, i), corpse); /* transfer gold */ if (GET_GOLD(ch) > 0) { /* * following 'if' clause added to fix gold duplication loophole * The above line apparently refers to the old "partially log in, * kill the game character, then finish login sequence" duping * bug. The duplication has been fixed (knock on wood) but the * test below shall live on, for a while. -gg 3/3/2002 */ if (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)); }