Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

olc_roflags.c

Go to the documentation of this file.
00001 #if defined(macintosh)
00002 #include <types.h>
00003 #else
00004 #include <sys/types.h>
00005 #endif
00006 #include <ctype.h>
00007 #include <stdio.h>
00008 #include <stdlib.h>
00009 #include <string.h>
00010 #include <time.h>
00011 #include "merc.h"
00012 #include "tables.h"
00013 #include "olc.h"
00014 #include "recycle.h"
00015 #include "lookup.h"
00016 
00017 
00018 void do_rflagall(CHAR_DATA *ch, char *argument)
00019 {
00020         char arg[MSL];
00021         char buf[MSL];
00022         ROOM_INDEX_DATA *pRoom;
00023         AREA_DATA *pArea;
00024         int count,vnum,value=0;
00025         bool found;
00026 
00027 
00028         argument = one_argument(argument, arg);
00029 
00030         if (ch->level < 59)
00031         {
00032                 send_to_char("Huh?\n\r",ch);
00033                 return;
00034         }
00035 
00036         if (arg[0] == '\0' || argument[0] == '\0')
00037         {
00038                 send_to_char("Syntax: rflagall [name|sector|room|extended] <flags>\n\r",ch);
00039                 return;
00040         }
00041 
00042         if (!str_prefix(arg, "name") || !str_prefix(arg, "sector") || !str_prefix(arg, "room")
00043                         || !str_prefix(arg, "extended"))
00044         {
00045                 pArea = ch->in_room->area;
00046                 for (vnum=pArea->min_vnum;vnum <=pArea->max_vnum;vnum++)
00047                 {
00048 
00049                         if ((pRoom = get_room_index(vnum)))
00050                         {
00051                                 found = TRUE;
00052                                 if (!str_prefix(arg, "name"))
00053                                 {
00054                                         free_string (pRoom->name);
00055                                         pRoom->name = str_dup (argument);
00056                                         count++;
00057                                         continue;
00058                                 }
00059                                 else if (!str_prefix(arg, "sector"))
00060                                 {
00061                                         if ((value = flag_value (sector_flags, argument)) == NO_FLAG)
00062                                         {
00063                                                 send_to_char ("Invalid flag. Not setting rooms.\n\r", ch);
00064                                                 return;
00065                                         }
00066                                         pRoom->room_flags = value;
00067                                         count++;
00068                                         continue;
00069                                 }
00070                                 else if (!str_prefix(arg, "room"))
00071                                 {
00072                                         if ((value = flag_value(room_flags, argument)) == NO_FLAG)
00073                                         {
00074                                                 send_to_char("Invalid flag. Not setting rooms.\n\r",ch);
00075                                                 return;
00076                                         }
00077                                         pRoom->room_flags = value;
00078                                         count++;
00079                                         continue;
00080                                 }
00081                                  
00082                 else if (!str_prefix(arg, "extended"))
00083                                 {
00084                                         send_to_char("No extendeds allowed right now.\n\r",ch);
00085                                         return;
00086                                 }
00087                                 else
00088                                 {
00089                                         send_to_char("Invalid type.\n\r",ch);
00090                                         return;
00091                                 }
00092                         }
00093                 }
00094 
00095                 if (found)
00096                 {
00097                         sprintf(buf, "{c%d{x room",count);
00098             if (!str_prefix(arg, "name"))
00099                 strcat(buf, " names");
00100             if (!str_prefix(arg, "sector"))
00101                 strcat(buf, " sector flags");
00102             if (!str_prefix(arg, "room"))
00103                 strcat(buf, " flags");
00104             send_to_char(buf,ch);
00105             sprintf(buf, " set to {c%s{x\n\r", argument);
00106             send_to_char(buf,ch);
00107             SET_BIT (ch->in_room->area->area_flags, AREA_CHANGED);
00108                         count=0;
00109             return;
00110                 }
00111                 else
00112                 {
00113                         send_to_char("No rooms in area.\n\r",ch);
00114                         return;
00115                 }
00116     }
00117 }
00118 
00119 void do_make_bare (CHAR_DATA *ch, char *argument)
00120 {
00121     send_to_char("Not at this time, buddy!\n\r",ch);
00122     
00123     char arg[MSL];
00124     char buf[MSL];
00125     AREA_DATA *parea;
00126     ROOM_INDEX_DATA *pRoom;
00127     int count,runner=0;
00128     int iHash;
00129         
00130     if (ch->level < 60)
00131     {
00132         send_to_char("Huh?\n\r",ch);
00133         return;
00134     }
00135     parea = ch->in_room->area;
00136     for (count = parea->min_vnum; count <= parea->max_vnum; count++)
00137     {
00138         if ((pRoom = get_room_index(count)))
00139             continue;
00140         
00141         pRoom = new_room_index ();
00142         pRoom->area = parea;
00143         pRoom->vnum = count;
00144         pRoom->name = str_dup("New Room");
00145         pRoom->description = str_dup("Give me a description!");
00146         
00147         if (count > top_vnum_room)
00148             top_vnum_room = count;
00149         iHash = count % MAX_KEY_HASH;
00150         pRoom->next = room_index_hash[iHash];
00151         room_index_hash[iHash] = pRoom;
00152         runner++;
00153     }
00154     sprintf(buf, "%d rooms made in this area.\n\r", runner);
00155     send_to_char(buf,ch);
00156     return;
00157 }
00158         
00159                             
00160 
00161     
00162 void do_oflagall (CHAR_DATA *ch, char *argument)
00163 {
00164     OBJ_INDEX_DATA *obj;
00165     char arg[MSL];
00166     char buf[MSL];      
00167     AREA_DATA *pArea;
00168     int count,vnum,value=0;
00169     bool found;
00170     
00171     argument = one_argument(argument, arg);
00172 
00173     if (arg[0] == '\0' || argument[0] == '\0')
00174     {
00175         send_to_char("Syntax: oflagall [name|type|level|wear|extra"
00176                 "|material|condition|weight|cost|short|long|v1|v2|v3|v4] <value>\n\r",ch);
00177         return;
00178     }
00179 
00180     /* FIXME: Warning, incoming ugly if statement! */
00181 
00182     if (!str_prefix(arg, "name") || !str_prefix(arg, "type") || !str_prefix(arg, "level")
00183             || !str_prefix(arg, "wear") || !str_prefix(arg, "extra")
00184             || !str_prefix(arg, "material") || !str_prefix(arg, "condition")
00185             || !str_prefix(arg, "weight") || !str_prefix(arg, "cost")
00186             || !str_prefix(arg, "short") || !str_prefix(arg, "long"))
00187             /*(|| !str_prefix(arg, "v1") || !str_prefix("v2") || !str_prefix(arg, "v3")
00188             || !str_prefix(arg, "v4")) *//* YAY! it's over! Time to type: 1 minute, 15 seconds */
00189             /* Took v0-4 out due to the fact that not every item can be the same thing..
00190              * and while doing so, i've decided that this whole function is pointless -sigh-*/
00191     {
00192         pArea = ch->in_room->area;
00193         
00194         for (vnum=pArea->min_vnum;vnum<=pArea->max_vnum;vnum++)
00195         {
00196             if ((obj = get_obj_index(vnum)))
00197             {
00198                 found = TRUE;
00199 
00200                 if (!str_prefix(arg, "name"))
00201                 {
00202                     free_string(obj->name);
00203                     obj->name = str_dup(argument);
00204                     count++;
00205                     continue;
00206                 }
00207                 else if (!str_prefix(arg, "type"))
00208                 {
00209                     if ((value = flag_value(type_flags, argument)) != NO_FLAG)
00210                     {
00211                         obj->item_type = value;
00212                         obj->value[0]=0;
00213                         obj->value[1]=0;
00214                         obj->value[2]=0;
00215                         obj->value[3]=0;
00216                         obj->value[4]=0;
00217                         count++;
00218                         continue;
00219                     }
00220                     else
00221                     {
00222                         send_to_char("Invalid flag.\n\r",ch);
00223                         return;
00224                     }
00225                 }
00226                 else if (!str_prefix(arg, "level"))
00227                 {
00228                     value = atoi(argument);
00229                     if (!is_number(argument) || value < 0 || value > 51)
00230                     {
00231                         send_to_char("Level must not exceed max level, and must not be lower than 0.\n\r",ch);
00232                         return;
00233                     }
00234 
00235                     obj->level = atoi(argument);
00236                     count++;
00237                     continue;
00238                 }
00239                 else if(!str_prefix(arg, "wear"))
00240                 {
00241                     if ((value = flag_value(wear_flags, argument)) != NO_FLAG)
00242                     {
00243                         TOGGLE_BIT(obj->wear_flags, value);
00244                         count++;
00245                         continue;
00246                     }
00247                     else
00248                     {
00249                         send_to_char("Invalid flag.\n\r",ch);
00250                         return;
00251                     }
00252                 }
00253                 else if (!str_prefix(arg,"extra"))
00254                 {
00255                     if ((value = flag_value(extra_flags, argument)) != NO_FLAG)
00256                     {
00257                         TOGGLE_BIT(obj->extra_flags, value);
00258                         count++;
00259                         continue;
00260                     }
00261                     else
00262                     {
00263                         send_to_char("Invalid flag.\n\r",ch);
00264                         return;
00265                     }
00266                 }
00267                 else if (!str_prefix(arg, "material"))
00268                 {
00269                     free_string(obj->material);
00270                     obj->material = str_dup(argument);
00271                     count++;
00272                     continue;
00273                 }
00274                 else if (!str_prefix(arg, "condition"))
00275                 {
00276                     if (!is_number(argument) || atoi(argument) < 0 || atoi(argument) > 100)
00277                     {
00278                         send_to_char("Condition must not exceed 100 or be less than 0.\n\r",ch);
00279                         return;
00280                     }
00281                     
00282                     obj->condition = atoi(argument);
00283                     count++;
00284                     continue;
00285                 }
00286                 else if (!str_prefix(arg, "weight"))
00287                 {
00288                     if (!is_number(argument) || atoi(argument) < 0)
00289                     {
00290                         send_to_char("Value must be numberic.\n\r",ch);
00291                         return;
00292                     }
00293                     
00294                     obj->weight = atoi(argument);
00295                     count++;
00296                     continue;
00297                 }
00298                 else if (!str_prefix(arg, "cost"))
00299                 {
00300                     if (!is_number(argument) || atoi(argument) < 0)
00301                     {
00302                         send_to_char("Value must be numeric.\n\r",ch);
00303                         return;
00304                     }
00305 
00306                     obj->cost = atoi (argument);
00307                     count++;
00308                     continue;
00309                 }
00310                 else if (!str_prefix(arg, "short"))
00311                 {
00312                     free_string(obj->short_descr);
00313                     obj->short_descr = str_dup(argument);
00314                     obj->short_descr[0] = LOWER(obj->short_descr[0]);
00315                     count++;
00316                     continue;
00317                 }
00318                 else if (!str_prefix(arg, "long"))
00319                 {
00320                     free_string(obj->description);
00321                     obj->description = str_dup(argument);
00322                     obj->description[0] = UPPER(obj->description[0]);
00323                     count++;
00324                     continue;
00325                 }
00326                 else 
00327                 {
00328                     send_to_char("Invalid syntax.\n\r",ch);
00329                     return;
00330                 }
00331             }
00332         }
00333         if (found)
00334         {
00335             sprintf(buf, "%d items set in area.\n\r",count);
00336             send_to_char(buf,ch);
00337             count=0;
00338             return;
00339         }
00340         else
00341         {
00342             send_to_char("No items found.\n\r",ch);
00343             return;
00344         }
00345     }
00346                     
00347                         
00348         
00349     
00350 }
00351     
00352     
00353     

Generated on Thu Jan 13 21:48:13 2005 for Beyond the Shadows by  doxygen 1.4.0