/* do_simple_move assumes * 1. That there is no master and no followers. * 2. That the direction exists. * * Returns : * 1 : If succes. * 0 : If fail */ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) { room_rnum was_in; struct char_data *i; /* * Check for special routines (North is 1 in command list, but 0 here) Note * -- only check if following; this avoids 'double spec-proc' bug */ if (need_specials_check && special(ch, dir + 1, "")) { return (0); } /* charmed? */ if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && ch->in_room == ch->master->in_room) { send_to_char("The thought of leaving your master makes you weep.\r\n", ch); act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM); return (0); } /* if this room or the one we're going to needs a boat, check for one */ if ((SECT(ch->in_room) == SECT_WATER_NOSWIM) || (SECT(EXIT(ch, dir)->to_room) == SECT_WATER_NOSWIM)) { if (!has_boat(ch)) { send_to_char("You need a boat to go there.\r\n", ch); return (0); } } if((IS_CARRYING_W(ch) > (CAN_CARRY_W(ch) * 2) && GET_LEVEL(ch) < LVL_GOD && !IS_NPC(ch))) { send_to_char("You are to heavy to move! Drop something!\r\n", ch); return (0); } if(IS_NPC_FISH(ch)) { if(SECT(EXIT(ch, dir)->to_room) != SECT_BRIDGE && SECT(EXIT(ch, dir)->to_room) != SECT_WATER_SWIM && SECT(EXIT(ch, dir)->to_room) != SECT_WATER_NOSWIM) { // sprintf(buf, "%s %d", dirs[dir], SECT(EXIT(ch, dir)->to_room)); // mobsay(ch, buf); return FALSE; } if(GET_MOB_VNUM(ch) < 1500 && ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_SALT_FISH)) { return FALSE; } } if (SECT(EXIT(ch, dir)->to_room) != SECT_FOREST) { if (IS_NPC_WOLF(ch) || IS_NPC_CRAB(ch) || IS_NPC_SKELETON(ch)) { return (0); } } /* move points needed is avg. move loss for src and destination sect type */ if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_TUNNEL) && num_pc_in_room(&(world[EXIT(ch, dir)->to_room])) > 1) { send_to_char("There isn't enough room there for more than one person!\r\n", ch); return (0); } /* Mortals and low level gods cannot enter greater god rooms. */ if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GRGOD) { send_to_char("You aren't godly enough to use that room!\r\n", ch); return (0); } /* Now we know we're allow to go into the room. */ if(AFF_FLAGGED(ch, AFF_FISHING) || GET_FISHON(ch)) { REMOVE_BIT(AFF_FLAGS(ch), AFF_FISHING); GET_FISHON(ch) = 0; GET_REELIN(ch) = 0; send_to_char("You stop fishing.\r\n", ch); act("$n stops fishing.", FALSE, ch, 0, 0, TO_ROOM); } if (!AFF_FLAGGED(ch, AFF_SNEAK) && !AFF_FLAGGED(ch, AFF_INVISIBLE)) { if(IS_NPC(ch)) { switch(GET_RACE(ch)) { case RACE_NPC_MAMMAL: case RACE_NPC_HIGHHUMAN: case RACE_NPC_GOBLIN: case RACE_NPC_PIG: case RACE_NPC_WOLF: case RACE_NPC_CHICKEN: sprintf(buf2, "$n walks %s.", dirs[dir]); break; case RACE_NPC_AVIAN: sprintf(buf2, "$n flits %s.", dirs[dir]); break; case RACE_NPC_SHEEP: case RACE_NPC_GOAT: sprintf(buf2, "$n walks %s.", dirs[dir]); break; case RACE_NPC_SKELETON: sprintf(buf2, "$n shambles %s.", dirs[dir]); break; case RACE_NPC_COW: sprintf(buf2, "$n walks %s.", dirs[dir]); break; case RACE_NPC_CRAB: sprintf(buf2, "$n scurries %s.", dirs[dir]); break; case RACE_NPC_FISH: sprintf(buf2, "$n swims %s.", dirs[dir]); break; case RACE_NPC_INSECT: sprintf(buf2, "$n buzzes %s.", dirs[dir]); break; default: sprintf(buf2, "$n leaves %s.", dirs[dir]); break; } } else { sprintf(buf2, "$n leaves %s.", dirs[dir]); } if(SECT(ch->in_room) == SECT_WATER_SWIM && !IS_NPC_FISH(ch)) { sprintf(buf2, "$n splashes through the water, heading %s.", dirs[dir]); } act(buf2, FALSE, ch, 0, 0, TO_ROOM); } was_in = ch->in_room; char_from_room(ch); char_to_room(ch, world[was_in].dir_option[dir]->to_room); if (!AFF_FLAGGED(ch, AFF_SNEAK)) { if(!AFF_FLAGGED(ch, AFF_INVISIBLE)) { act("$n has arrived.", FALSE, ch, 0, 0, TO_ROOM); } } if (ch->desc != NULL) look_at_room(ch, 0); if(IS_NPC_CRAB(ch) || IS_NPC_LIVESTOCK(ch)) { for (i = world[ch->in_room].people; i; i = i->next_in_room) { if(IS_NPC_WOLF(i) && IS_NPC_CRAB(ch)) { sprintf(buf, "%s sees %s and tries to run!\r\n", GET_NAME(ch), GET_NAME(i)); send_to_room(buf, ch->in_room); if(!number(0, 2)) { do_flee(ch, NULL, 0, 0); } if(i->in_room == ch->in_room && !number(0, 2)) { hit(i, ch, TYPE_UNDEFINED); } } if((IS_NPC_SKELETON(i) || IS_NPC_WOLF(i)) && IS_NPC_LIVESTOCK(ch)) { if(ch->master) { sprintf(buf, "%s sees %s and %s in absolute terror!\r\n", GET_NAME(ch), GET_NAME(i), livestock_afraid_vocals[(int)GET_RACE(ch)]); send_to_room(buf, ch->in_room); if(!number(0, 2)) { do_flee(ch, NULL, 0, 0); } if(i->in_room == ch->in_room && !number(0, 2)) { hit(i, ch, TYPE_UNDEFINED); } } } } return (1); } if (ROOM_FLAGGED(ch->in_room, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) { log_death_trap(ch); death_cry(ch); extract_char(ch); return (0); } return (1); }
/* do_simple_move assumes * 1. That there is no master and no followers. * 2. That the direction exists. * * Returns : * 1 : If succes. * 0 : If fail */ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) { char throwaway[MAX_INPUT_LENGTH] = ""; /* Functions assume writable. */ room_rnum was_in; int need_movement, moveadd = 0; struct obj_data *k; /* * Check for special routines (North is 1 in command list, but 0 here) Note * -- only check if following; this avoids 'double spec-proc' bug */ if (need_specials_check && special(ch, dir + 1, throwaway)) return (0); /* blocked by a leave trigger ? */ if (!leave_mtrigger(ch, dir)) return 0; if (!leave_wtrigger(&world[IN_ROOM(ch)], ch, dir)) return 0; /* charmed? */ if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && IN_ROOM(ch) == IN_ROOM(ch->master)) { send_to_char(ch, "The thought of leaving your master makes you weep.\r\n"); act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM); return (0); } /* if this room or the one we're going to needs a boat, check for one */ if ((SECT(IN_ROOM(ch)) == SECT_WATER_NOSWIM) || (SECT(EXIT(ch, dir)->to_room) == SECT_WATER_NOSWIM)) { if (!has_boat(ch)) { send_to_char(ch, "You need a boat to go there.\r\n"); return (0); } } /* move points needed is avg. move loss for src and destination sect type * You know .. I don't like this system, let's base this not ONLY on terrain type * but also on dex of char. * Needs to adjust on max abils * Original: * need_movement = (movement_loss[SECT(IN_ROOM(ch))] + movement_loss[SECT(EXIT(ch, dir)->to_room)]) / 2; */ if (GET_DEX(ch) <= 5) /* 0(1?)-5 Dex */ moveadd = 8; if ((GET_DEX(ch) >= 6) && (GET_DEX(ch) <= 10)) /* 6-10 Dex */ moveadd = 6; if ((GET_DEX(ch) >= 11) && (GET_DEX(ch) <= 15)) /* 11-15 Dex */ moveadd = 4; if (GET_DEX(ch) >= 16) /* 16+ Up to ..? Dex */ moveadd = 2; need_movement = (movement_loss[SECT(IN_ROOM(ch))] + movement_loss[SECT(EXIT(ch, dir)->to_room)] + moveadd) / 2; if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) { if (need_specials_check && ch->master) send_to_char(ch, "You are too exhausted to follow.\r\n"); else send_to_char(ch, "You are too exhausted.\r\n"); return (0); } if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_ATRIUM)) { if (!House_can_enter(ch, GET_ROOM_VNUM(EXIT(ch, dir)->to_room))) { send_to_char(ch, "That's private property -- no trespassing!\r\n"); return (0); } } if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_TUNNEL) && num_pc_in_room(&(world[EXIT(ch, dir)->to_room])) >= tunnel_size) { if (tunnel_size > 1) send_to_char(ch, "There isn't enough room for you to go there!\r\n"); else send_to_char(ch, "There isn't enough room there for more than one person!\r\n"); return (0); } /* Room big enough for you? */ if ((SIZE(EXIT(ch, dir)->to_room) < GET_SIZE(ch)) && (SIZE(EXIT(ch, dir)->to_room) != SIZE_SPECIAL) && (GET_LEVEL(ch) < LVL_GOD)) { //GOD+ can enter any room send_to_char(ch, "You are too big to fit in there!\r\n"); return (0); } /* Mortals and low level gods cannot enter greater god rooms. */ /* irrelevant because of min/max level -mak 8.21.05 -reinstated 2.9.06 if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD) { send_to_char(ch, "You aren't godly enough to use that room!\r\n"); return (0); } uncomment to fix GODROOM */ /* No access for non-IMPs */ if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_IMPROOM) && GET_LEVEL(ch) < LVL_IMPL) { send_to_char(ch, "You dare not disturb the Implementors!\r\n"); return (0); } if (GET_LEVEL(ch) < ROOM_MIN_LEVEL(EXIT(ch, dir)->to_room)) { if (world[EXIT(ch, dir)->to_room].max_level_message ) { send_to_char(ch, world[EXIT(ch, dir)->to_room].min_level_message); send_to_char(ch, "\r\n"); } else send_to_char(ch, "You are not experienced enough to enter that room.\r\n"); return 0; } if (ROOM_MAX_LEVEL(EXIT(ch, dir)->to_room) > 0) { if (GET_LEVEL(ch) > ROOM_MAX_LEVEL(EXIT(ch, dir)->to_room) && GET_LEVEL(ch) < LVL_SAINT ) { if (world[EXIT(ch, dir)->to_room].max_level_message ){ send_to_char(ch, world[EXIT(ch, dir)->to_room].max_level_message); send_to_char(ch, "\r\n"); } else send_to_char(ch, "You are too experienced to enter that room.\r\n"); return 0; } } if (AFF_FLAGGED(ch, AFF_FLEET_FEET)) { need_movement = need_movement / 2; if (need_movement < 2) need_movement = 1;} if (AFF_FLAGGED(ch, AFF_AIRWALK)) need_movement = 1; /* Now we know we're allowed to go into the room. */ if (GET_LEVEL(ch) < LVL_SAINT && !IS_NPC(ch)) GET_MOVE(ch) -= need_movement; if (!AFF_FLAGGED(ch, AFF_SNEAK)) { char buf2[MAX_STRING_LENGTH]; snprintf(buf2, sizeof(buf2), "$n leaves %s.", dirs[dir]); act(buf2, TRUE, ch, 0, 0, TO_ROOM); } was_in = IN_ROOM(ch); char_from_room(ch); char_to_room(ch, world[was_in].dir_option[dir]->to_room); /* move them first, then move them back if they aren't allowed to go. */ /* see if an entry trigger disallows the move */ if (!entry_mtrigger(ch) || !enter_wtrigger(&world[IN_ROOM(ch)], ch, dir)) { char_from_room(ch); char_to_room(ch, was_in); return 0; } if (!AFF_FLAGGED(ch, AFF_SNEAK)) act("$n has arrived.", TRUE, ch, 0, 0, TO_ROOM); if (ch->desc != NULL) look_at_room(IN_ROOM(ch), ch, 0); if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH) && GET_LEVEL(ch) < LVL_SAINT) { clanlog(ch, "%s entered a Death Room", GET_NAME(ch)); was_in = IN_ROOM(ch); log_death_trap(ch); death_cry(ch); /* Fix the PCs size first if it needs fixing */ fix_size(ch); extract_char(ch); for (k = world[was_in].contents; k; k = world[was_in].contents) extract_obj(k); return (0); } entry_memory_mtrigger(ch); if (!greet_mtrigger(ch, dir)) { char_from_room(ch); char_to_room(ch, was_in); look_at_room(IN_ROOM(ch), ch, 0); } else greet_memory_mtrigger(ch); /* send warning message if moves are getting low */ if ( GET_MOVE(ch) < (GET_MAX_MOVE(ch) / 10) ) { send_to_char(ch, "You cannot go much further.\r\n"); } return (1); }