Example #1
0
void ChangeRoomName(struct room_data *rp, struct char_data *ch, char *arg, int type)
{
 char buf[255];
 
 if(type != ENTER_CHECK)
    if(!*arg || (*arg == '\n')) {
        ch->specials.edit = MAIN_MENU;
        UpdateRoomMenu(ch);
        return;
    }
 
 if(type != ENTER_CHECK) {
    if(rp->name)
       free(rp->name);
    rp->name = (char *)strdup(arg);
    ch->specials.edit = MAIN_MENU;
    UpdateRoomMenu(ch);
    return;
 }
 
 sprintf(buf, VT_HOMECLR);
 send_to_char(buf, ch);
 
 sprintf(buf, "Current Room Name: %s", rp->name);
 send_to_char(buf, ch);
 send_to_char("\n\r\n\rNew Room Name: ", ch);
 
 return;
} 
Example #2
0
void do_redit(struct char_data *ch, char *arg, int cmd)
{
#ifndef TEST_SERVER
 struct room_data *rp;

  rp = real_roomp(ch->in_room);
#endif

 if(IS_NPC(ch))
    return;
 
  if ((IS_NPC(ch)) || (GetMaxLevel(ch)<LOW_IMMORTAL))
    return;
 
  if (!ch->desc) /* someone is forced to do something. can be bad! */
    return;      /* the ch->desc->str field will cause problems... */
 
#ifndef TEST_SERVER
  if((GetMaxLevel(ch) < 56) && (rp->zone != GET_ZONE(ch))) {
     send_to_char("Sorry, you are not authorized to edit this zone.\n\r", ch);
     return;
  }
#endif
 
 ch->specials.edit = MAIN_MENU;
 ch->desc->connected = CON_EDITING;
 
 act("$n has begun editing.", FALSE, ch, 0, 0, TO_ROOM);
 
 UpdateRoomMenu(ch);
}
Example #3
0
void ChangeRoomDesc(struct room_data *rp, struct char_data *ch, char *arg, int type)
{
 char buf[255];
 
 if(type != ENTER_CHECK) {
    ch->specials.edit = MAIN_MENU;
    UpdateRoomMenu(ch);
    return;
 }
 
 sprintf(buf, VT_HOMECLR);
 send_to_char(buf, ch);
 
 sprintf(buf, "Current Room Description:\n\r");
 send_to_char(buf, ch);
 send_to_char(rp->description, ch);
 send_to_char("\n\r\n\rNew Room Description:\n\r", ch);
 send_to_char("(Terminate with a @. Press <C/R> again to continue)\n\r", ch);
if (rp->description)
 free(rp->description);
 rp->description = NULL;
 ch->desc->str = &rp->description;
 ch->desc->max_str = MAX_STRING_LENGTH;
 return;
} 
Example #4
0
void ChangeRoomFlags(struct room_data *rp, struct char_data *ch, char *arg, int type)
{
 int i, row, update;
 char buf[255];
 
 if(type != ENTER_CHECK)
    if(!*arg || (*arg == '\n')) {
        ch->specials.edit = MAIN_MENU;
        UpdateRoomMenu(ch);
        return;
    }
 
 update = atoi(arg);
 update--;
 if(type != ENTER_CHECK) {
    if(update < 0 || update > 13)
       return;
    i = 1<<update;
 
    if(IS_SET(rp->room_flags, i))
       REMOVE_BIT(rp->room_flags, i);
    else
       SET_BIT(rp->room_flags, i);
  }
 
 sprintf(buf, VT_HOMECLR);
 send_to_char(buf, ch);
 sprintf(buf, "Room Flags:");
 send_to_char(buf, ch);
 
 row = 0;
 for(i = 0; i < 14; i++) {
    sprintf(buf, VT_CURSPOS, row + 4, ((i & 1) ? 45 : 5));
    if(i & 1)
       row++;
    send_to_char(buf, ch);
    sprintf(buf, "%-2d [%s] %s", i + 1, ((rp->room_flags & (1<<i)) ? "X" : " "), room_bits[i]);
    send_to_char(buf, ch);
  }
 
 sprintf(buf, VT_CURSPOS, 20, 1);
 send_to_char(buf, ch);
 send_to_char("Select the number to toggle, <C/R> to return to main menu.\n\r--> ", ch);
}
Example #5
0
void ChangeExitDir(struct room_data *rp, struct char_data *ch, char *arg, int type)
{
 int update;
 char buf[1024];
 
 if(type != ENTER_CHECK) {
    if(!*arg || (*arg == '\n')) {
        ch->specials.edit = MAIN_MENU;
        UpdateRoomMenu(ch);
        return;
    }
 
    update = atoi(arg) - 1;
    if(update == -1) {
       ChangeExitDir(rp, ch, "", ENTER_CHECK);
       return;
    }
 
    switch(update) {
           case 0: ch->specials.edit = CHANGE_EXIT_NORTH;
                   AddExitToRoom(rp, ch, "", ENTER_CHECK);
                   return;
                   break;
           case 1: ch->specials.edit = CHANGE_EXIT_EAST;
                   AddExitToRoom(rp, ch, "", ENTER_CHECK);
                   return;
                   break;
           case 2: ch->specials.edit = CHANGE_EXIT_SOUTH;
                   AddExitToRoom(rp, ch, "", ENTER_CHECK);
                   return;
                   break;
           case 3: ch->specials.edit = CHANGE_EXIT_WEST;
                   AddExitToRoom(rp, ch, "", ENTER_CHECK);
                   return;
                   break;
           case 4: ch->specials.edit = CHANGE_EXIT_UP;
                   AddExitToRoom(rp, ch, "", ENTER_CHECK);
                   return;
                   break;
           case 5: ch->specials.edit = CHANGE_EXIT_DOWN;
                   AddExitToRoom(rp, ch, "", ENTER_CHECK);
                   return;
                   break;
           case 6: ch->specials.edit = CHANGE_EXIT_DELETE;
                   DeleteExit(rp, ch, "", ENTER_CHECK);
                   return;
                   break;
           default: ChangeExitDir(rp, ch, "", ENTER_CHECK);
                    return;
    }
 
 }
 
 
 send_to_char(VT_HOMECLR, ch);
 sprintf(buf, "Room Name: %s", rp->name);
 send_to_char(buf, ch);
 sprintf(buf, VT_CURSPOS, 1, 40);
 send_to_char(buf, ch);
 sprintf(buf, "Room Number: %d", rp->number);
 send_to_char(buf, ch);
 sprintf(buf, VT_CURSPOS, 4, 1);
 send_to_char(buf, ch);
 send_to_char(exit_menu, ch);
 send_to_char("--> ", ch);
 return;
}
Example #6
0
void ChangeRoomType(struct room_data *rp, struct char_data *ch, char *arg, int type)
{
 int i, row, update;
 char buf[255];
 
 if(type != ENTER_CHECK)
    if(!*arg || (*arg == '\n')) {
        ch->specials.edit = MAIN_MENU;
        UpdateRoomMenu(ch);
        return;
    }
 
 update = atoi(arg);
 update--;
 
 if(type != ENTER_CHECK) {
    switch(ch->specials.edit) {
    case CHANGE_TYPE: if(update < 0 || update > 11)
                         return;
                      else {
                         rp->sector_type = update;
                         if(rp->sector_type == SECT_WATER_NOSWIM) {
                            send_to_char("\n\rRiver Speed: ", ch);
                            ch->specials.edit = CHANGE_TYPE2;
			  }
                         else {
                            ch->specials.edit = MAIN_MENU;
                            UpdateRoomMenu(ch);
			  }
                         return;
                      }
    case CHANGE_TYPE2: rp->river_speed = update;
                       send_to_char("\n\rRiver Direction (0 - 5): ", ch);
                       ch->specials.edit = CHANGE_TYPE3;
                       return;
    case CHANGE_TYPE3: update++; 
                       if(update < 0 || update > 5) {
                          send_to_char("Direction must be between 0 and 5.\n\r", ch);
                          return;
			}
                       rp->river_dir = update;
                       ch->specials.edit = MAIN_MENU;
                       UpdateRoomMenu(ch);
                       return;
    }
   }
 
 sprintf(buf, VT_HOMECLR);
 send_to_char(buf, ch);
 sprintf(buf, "Sector Type: %s", sector_types[rp->sector_type]);
 send_to_char(buf, ch);
 
 row = 0;
 for(i = 0; i < 12; i++) {
    sprintf(buf, VT_CURSPOS, row + 4, ((i & 1) ? 45 : 5));
    if(i & 1)
       row++;
    send_to_char(buf, ch);
    sprintf(buf, "%-2d %s", i + 1, sector_types[i]);
    send_to_char(buf, ch);
  }
 
 sprintf(buf, VT_CURSPOS, 20, 1);
 send_to_char(buf, ch);
 send_to_char("Select the number to set to, <C/R> to return to main menu.\n\r--> ", ch);
}
Example #7
0
void RoomEdit(struct char_data *ch, char *arg)
{
 if(ch->specials.edit == MAIN_MENU) {
    if(!*arg || *arg == '\n') {
       ch->desc->connected = CON_PLYNG;
       act("$n has returned from editing.", FALSE, ch, 0, 0, TO_ROOM);
       return;
     }
    switch(atoi(arg)) {
           case 0: UpdateRoomMenu(ch);
                   return;
           case CHANGE_NAME: ch->specials.edit = CHANGE_NAME;
                   ChangeRoomName(real_roomp(ch->in_room), ch, "", ENTER_CHECK);
                   return;
           case CHANGE_DESC: ch->specials.edit = CHANGE_DESC;
                   ChangeRoomDesc(real_roomp(ch->in_room), ch, "", ENTER_CHECK);
                   return;
           case CHANGE_FLAGS: ch->specials.edit = CHANGE_FLAGS;
                   ChangeRoomFlags(real_roomp(ch->in_room), ch, "", ENTER_CHECK);
                   return;
           case CHANGE_TYPE: ch->specials.edit = CHANGE_TYPE;
                   ChangeRoomType(real_roomp(ch->in_room), ch, "", ENTER_CHECK);
                   return;
	   case 5: ch->specials.edit = CHANGE_EXIT;
                   ChangeExitDir(real_roomp(ch->in_room), ch, "", ENTER_CHECK);
                    return;
           default: UpdateRoomMenu(ch);
                   return;
    }
  }
 
 switch(ch->specials.edit) {
 case CHANGE_NAME: ChangeRoomName(real_roomp(ch->in_room), ch, arg, 0);
         return;
 case CHANGE_DESC: ChangeRoomDesc(real_roomp(ch->in_room), ch, arg, 0);
         return;
 case CHANGE_FLAGS: ChangeRoomFlags(real_roomp(ch->in_room), ch, arg, 0);
         return;
 case CHANGE_TYPE:
 case CHANGE_TYPE2:
 case CHANGE_TYPE3: ChangeRoomType(real_roomp(ch->in_room), ch, arg, 0);
         return;
 case CHANGE_EXIT: ChangeExitDir(real_roomp(ch->in_room), ch, arg, 0);
         return;
 case CHANGE_EXIT_NORTH:
 case CHANGE_EXIT_EAST:
 case CHANGE_EXIT_SOUTH:
 case CHANGE_EXIT_WEST:
 case CHANGE_EXIT_UP:
 case CHANGE_EXIT_DOWN: AddExitToRoom(real_roomp(ch->in_room), ch, arg, 0);
        return;
 case CHANGE_KEY_NORTH:
 case CHANGE_KEY_EAST:
 case CHANGE_KEY_SOUTH:
 case CHANGE_KEY_WEST:
 case CHANGE_KEY_UP:
 case CHANGE_KEY_DOWN: ChangeKeyNumber(real_roomp(ch->in_room), ch, arg, 0);
        return;
 case CHANGE_NUMBER_NORTH:
 case CHANGE_NUMBER_EAST:
 case CHANGE_NUMBER_SOUTH:
 case CHANGE_NUMBER_WEST:
 case CHANGE_NUMBER_UP:
 case CHANGE_NUMBER_DOWN: ChangeExitNumber(real_roomp(ch->in_room), ch, arg, 0);
                          return;
 default: logE("Got to bad spot in RoomEdit");
          return;
 }
}