void cmd_goto(D_MOBILE * ch, char *argument) { D_MOBILE *victim; char arg[MSL]; char *string; string = one_argument(argument, arg); if (argument == NULL) { stcf(ch,"Goto where?\n\r"); return; } victim = get_char(ch,string); if(victim == NULL) { stcf(ch,"Victim not found!\n\r"); return; } ch->coordx = victim->coordx; ch->coordy = victim->coordy; ch->coordz = victim->coordz; stcf(ch,"You leave in a swirling mist.\n\r"); stcf(victim,"%s appears in a swirling mist.\n\r",ch->name); cmd_look(ch,""); return; }
void move_mob( D_MOBILE *dMob, const char *dir ) { D_EXIT *exit; if( !dMob || !dir ) return; if( !dMob->room ) { bug( "Error: Player (%s) without room. Sending to the void...", dMob->name ); dMob->room = frbv( 1 );//default to the void if they don't have a room assigned to them if( !dMob->room ) //if the void doesn't even exist... { bug( "Error: Can Not Find The Void Room!" ); return; } } exit = febn( dir, dMob->room->exits ); if( !exit || !exit->dest ) { if( exit && !exit->dest ) bug( "Error: Exit with non-existent room in room %i.", dMob->room->vnum ); text_to_mobile( dMob, "Alas, you can not go that way.\r\n" ); return; } switch( exit->state ) { case STATE_OPEN: case STATE_DOOR_OPEN: case STATE_DOOR_OPEN_BROKEN: { break; } case STATE_DOOR_CLOSED: case STATE_DOOR_CLOSED_BROKEN: case STATE_DOOR_CLOSED_LOCKED: { text_to_mobile( dMob, "The %s is closed.\r\n", exit->desc ); return; } default: { bug( "Exit \'%s\' in invalid state in room %i.", exit->name, dMob->room->vnum ); return; } } DetachFromList( dMob, dMob->room->mobiles ); dMob->room = exit->dest; AttachToList( dMob, dMob->room->mobiles ); cmd_look( dMob, "" ); return; }
void do_movement(D_MOBILE *dMob, int dir) { D_MOBILE *xMob; ITERATOR *pIter; bool leftr = FALSE; pIter = AllocIterator(dmobile_list); while ((xMob = (D_MOBILE *) NextInList(pIter)) != NULL) { if (xMob == dMob) continue; if ((dMob->coordx != xMob->coordx) && (dMob->coordz != xMob->coordz) && (dMob->coordy != xMob->coordy)) leftr = TRUE; } switch (dir) { case NORTH: /* North */ stcf(dMob, "You leave for the north.\n\r"); dMob->coordy++; break; case SOUTH: /* South */ stcf(dMob, "You leave for the south.\n\r"); dMob->coordy--; break; case EAST: /* East */ stcf(dMob, "You head eastward.\n\r"); dMob->coordx++; break; case WEST: /* West */ stcf(dMob, "You head westward.\n\r"); dMob->coordx--; break; case UP: /* Up */ stcf(dMob, "You fly upwards.\n\r"); dMob->coordz++; break; case DOWN: /* Down */ stcf(dMob, "You you head downwards.\n\r"); dMob->coordz--; break; case NORTHEAST: /* NorthEast */ dMob->coordy++; dMob->coordx++; break; case SOUTHEAST: /* SouthEast */ dMob->coordy--; dMob->coordx++; break; case SOUTHWEST: /* SouthWest */ dMob->coordy--; dMob->coordx--; break; case NORTHWEST: /* NorthWest */ dMob->coordy++; dMob->coordx--; break; } if (dMob->coordx > HI_XLIMIT) { dMob->coordx--; text_to_mobile(dMob, "You can't move there!\n\r"); return; } if (dMob->coordy > HI_YLIMIT) { dMob->coordy--; text_to_mobile(dMob, "You can't move there!\n\r"); return; } if (dMob->coordz > HI_ZLIMIT) { dMob->coordz--; text_to_mobile(dMob, "You can't move there!\n\r"); return; } if (dMob->coordx < LO_XLIMIT) { dMob->coordx++; text_to_mobile(dMob, "You can't move there!\n\r"); return; } if (dMob->coordy < LO_YLIMIT) { dMob->coordy++; text_to_mobile(dMob, "You can't move there!\n\r"); return; } if (dMob->coordz < LO_ZLIMIT) { dMob->coordz++; text_to_mobile(dMob, "You can't move there!\n\r"); return; } if (leftr) stcf(xMob, "%s has left the room.\n\r",dMob->name); cmd_look(dMob, NULL); return; }
/* cmd_look (string) this function 'look's in a room and handles the case of whether it's just the room or a separate object */ int cmd_look (string str) { int oldStatus; string tmp, tmp2; mapping exits, doors; mixed *hidden_exits, *hidden_doors; it = 0; viewingOb = this_player(); env = environment (viewingOb); /* standard TMI-2 look blocks for 2 seconds, but I don't like that, so we've got another option available on compile-time */ #ifndef BLOCK_ATTACK Attacking = ((viewingOb->query_attackers()) ? 1 : 0); #endif /* Check to see if we have an argument list. If we do, see if we're trying to look at a particular object. If so, get the object's description. Otherwise, ask the room for its description. */ // are we looking at our immediate environment? if (!str || !stringp (str)) { // do we have an environment? If not, write the default message if (!env) { write ("There is nothing to see here.\n"); #ifdef BLOCK_ATTACK viewingOb->block_attack (2); #endif return 1; } /* write (LANGUAGE_D->garble_string(look_in_room (env, (int)viewingOb->query_temp ("force_to_look")),"orcish")+"\n") ; */ write (look_in_room (env, (int)viewingOb->query_temp ("force_to_look"))); #ifdef BLOCK_ATTACK viewingOb->block_attack (2); #endif return 1; } // are we looking at something in a container? if (sscanf(str, "at %s in %s", tmp, tmp2) == 2) { // we're looking inside a container // blocking a look in a locked/opaque container doesn't work yet. -- Fantome // hopefully will work soon #ifndef BLOCK_ATTACK if (Attacking) { write ("You are too busy to get a detailed look at that!\n"); return 1; } #endif write (sprintf ("%-=75s", look_at_item (tmp, viewingOb, tmp2))); return 1; } // are we looking at an object? if (sscanf(str, "at %s", tmp)) { write (sprintf ("%-=75s", look_at_item (tmp, viewingOb))); return 1; } // are we looking in an object? if (sscanf(str, "in %s", tmp)) { #ifndef BLOCK_ATTACK if (Attacking) { write ("You are too busy to get a detailed look at that!\n"); return 1; } #endif write (sprintf ("%-=75s", look_in_item (tmp, viewingOb))); return 1; } // are we looking in the room? if (env) { exits = env->query ("exits"); doors = env->query ("doors"); hidden_exits = env->query ("exit_suppress"); hidden_doors = env->query ("door_suppress"); if (mapp (exits) && member_array (str, keys (exits)) != -1) { if (doors && doors[str]) { if (((!intp (hidden_doors) || (int)hidden_doors[0] != 1) || (!pointerp (hidden_doors) || member_array (str, hidden_doors) == -1)) && doors[str]["status"] != "open") { write ("The door is closed.\n"); #ifdef BLOCK_ATTACK viewingOb->block_attack(2); #endif return 1; } } if ((!pointerp (hidden_exits) || member_array (str, hidden_exits) == -1) || (!intp (hidden_exits) || (int)hidden_exits[0] != 1)) { env = find_object_or_load (exits[str]); write (look_in_room (env, 0)); #ifdef BLOCK_ATTACK viewingOb->block_attack(2); #endif return 1; } } } cmd_look (sprintf ("at %s", str)); return 1; }