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

clan.c

Go to the documentation of this file.
00001 #if defined(macintosh)
00002 #include <types.h>
00003 #include <time.h>
00004 #else
00005 #include <sys/types.h>
00006 #include <sys/time.h>
00007 #endif
00008 #include <stdio.h>
00009 #include <string.h>
00010 #include <stdlib.h>
00011 #include <unistd.h>                /* For execl in copyover() */
00012 #include "merc.h"
00013 #include "interp.h"
00014 #include "recycle.h"
00015 #include "tables.h"
00016 #include "lookup.h"
00017 
00018 
00019 void do_who_clan (CHAR_DATA *ch, char *argument)
00020 {
00021     DESCRIPTOR_DATA *d;
00022     char buf[MAX_STRING_LENGTH];
00023     char buf2[MAX_STRING_LENGTH];
00024     CHAR_DATA *victim;
00025     BUFFER *buffer;
00026     int numchar;
00027     bool rgfClan[MAX_CLAN];  
00028     register int iClan;
00029     bool fClanRestrict = FALSE;
00030         int nNumber;
00031         int iLevelLower;
00032         int iLevelUpper;
00033     bool fLeader;
00034     bool fRecruiter;
00035     int clan;
00036     int space;
00037         iLevelLower    = 0;
00038         iLevelUpper    = MAX_LEVEL;
00039         fLeader = FALSE;
00040         fRecruiter = FALSE;
00041     for (iClan = 0; iClan < MAX_CLAN; iClan++)
00042             rgfClan[iClan] = FALSE;
00043 
00044     nNumber = 0;
00045     for ( ;; )
00046     {
00047         char arg[MAX_STRING_LENGTH];
00048 
00049         argument = one_argument( argument, arg );
00050         if ( arg[0] == '\0' )
00051             break;
00052 
00053         if ( is_number( arg ) )
00054         {
00055             switch ( ++nNumber )
00056             {
00057             case 1: iLevelLower = atoi( arg ); break;
00058             case 2: iLevelUpper = atoi( arg ); break;
00059             default:
00060                 send_to_char( "Only two level numbers allowed.\n\r", ch );
00061                 return;
00062             }
00063         }
00064         else
00065         {
00066             if (!str_prefix(arg,"leader"))
00067                 fLeader = TRUE;
00068             else if (!str_prefix(arg, "recruiter"))
00069                 fRecruiter = TRUE;
00070         else
00071         {
00072                 iClan = clan_lookup(arg);       
00073 
00074             if (iClan)
00075                 {
00076                 fClanRestrict = TRUE;
00077                     rgfClan[iClan] = TRUE;
00078                 }
00079                 else
00080                 {
00081                     send_to_char("That's not a valid race, class, clan, or kingdom.\n\r",ch);
00082                     return;
00083             }
00084         }
00085         }
00086     }
00087 
00088     buffer = new_buf();
00089     numchar=0;
00090     for (d=descriptor_list;d;d=d->next)
00091     {
00092 
00093             if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) )
00094                 continue;
00095 
00096             victim   = ( d->original != NULL ) ? d->original : d->character;
00097             
00098 
00099         if (victim->clan == 0)
00100         {
00101           continue;
00102         }
00103        
00104              clan = victim->clan;
00105                 buf[0] = '\0';
00106                     buf2[0] = '\0';
00107             sprintf(buf, "[%2d %6s] ",
00108             victim->level,
00109             victim->race < MAX_PC_RACE ? pc_race_table[victim->race].who_name: "");
00110             
00111             
00112             sprintf(buf2,"%-16s", clan_table[victim->clan].who_name);
00113                         space = (20 - strlen(buf2));
00114                         for( ; space > 0;space--)
00115                         {
00116                             strcat(buf2, " ");
00117                         }
00118                         strcat(buf,buf2);
00119             sprintf(buf2,"%-11s %-9s%-9s\n\r",
00120             victim->name, IS_SET (victim->cclan, CLAN_LEADER) ? "({WLEADER{x) " : " ",
00121             IS_SET (victim->cclan, CLAN_REC) ? "({WRECRUITER{x) " : "");
00122             strcat(buf,buf2);
00123         
00124         add_buf(buffer,buf);
00125         numchar++; 
00126     
00127     }
00128         
00129     sprintf(buf, "Total: %d.\n\r",numchar);
00130     add_buf(buffer,buf);
00131         page_to_char(buf_string(buffer),ch);
00132         free_buf(buffer);
00133     return;
00134 }
00135 
00136 
00137 
00138 
00139 
00140 
00141 void do_clan_guild (CHAR_DATA *ch, char *argument)
00142 {
00143 
00144 if (IS_SET(ch->cclan, CLAN_REC ))
00145 
00146         {
00147     
00148 
00149     
00150     
00151     
00152 //  char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
00153         char buf[MAX_STRING_LENGTH];
00154     CHAR_DATA *victim;
00155     //argument = one_argument (argument, arg1);
00156         //argument = one_argument (argument, arg2); 
00157 
00158 
00159 
00160     if (argument == '\0')
00161             {
00162              send_to_char ("Syntax: cguild <char> \n\r", ch);
00163              return;
00164                 }
00165     if (ch->clan == 0)
00166     {
00167         send_to_char("You are not in a clan!\n\r",ch);
00168         return;
00169     }
00170 
00171     if ((victim = get_char_world (ch, argument)) == NULL)
00172             {
00173               send_to_char ("They aren't playing.\n\r", ch);
00174               return;
00175                 }
00176 
00177     if (IS_NPC(victim))
00178     {
00179         send_to_char ("They aren't playing.\n\r",ch);
00180         return;
00181     }
00182 
00183     if (victim->clan != 0)
00184     {
00185         send_to_char("They are already in a clan!\n\r",ch);
00186         return;
00187     }
00188 
00189     
00190     
00191     /*   if (!str_prefix (arg2, "none"))
00192              {
00193                           send_to_char ("They are now clanless.\n\r", ch);
00194                   send_to_char ("You are now a member of no clan!\n\r", victim);
00195                   victim->clan = 0;
00196                   return;
00197              }
00198     
00199 */
00200 /*if (clan_table[clan].independent)
00201     {
00202         sprintf (buf, "They are now a %s.\n\r",ch->clan);
00203         send_to_char (buf, ch);
00204         sprintf (buf, "You are now a %s.\n\r", ch->clan);
00205         send_to_char (buf, victim);
00206     }   
00207 else
00208 {
00209                 sprintf (buf, "They are now a member of clan %s.\n\r",
00210                      capitalize (ch->clan));
00211                      send_to_char (buf, ch);
00212                 sprintf (buf, "You are now a member of clan %s.\n\r",
00213                 capitalize (ch->clan));
00214                             }
00215 */
00216         /*sprintf (buf, "They are now a member of clan %s.\n\r",clan_table[ch->clan].who_name);
00217         send_to_char(buf,ch);
00218         sprintf (buf, "You have been guilded into %s by %s.\n\r", clan_table[ch->clan].who_name,ch->name);
00219         send_to_char(buf, victim);*/
00220         sprintf(buf, "%s %s\n\r", victim->name, clan_table[ch->clan].join_string);
00221         send_to_all("",buf);
00222 
00223         victim->clan = ch->clan;
00224         return; 
00225     }
00226     else
00227     {
00228         send_to_char("You are not recruiter.\n\r",ch);
00229         return;
00230     }
00231 }
00232 void do_set_guild (CHAR_DATA *ch, char *argument)
00233 {
00234 CHAR_DATA *victim;
00235 char buf[MAX_STRING_LENGTH];
00236     if (IS_SET(ch->cclan, CLAN_LEADER) || ch->level > 52)
00237     {
00238         if(argument == '\0')
00239         {
00240             send_to_char("Who would you like to set recruiter status to?\n\r",ch);
00241                 return;
00242         }
00243         if(argument == ch->name)
00244         {
00245             send_to_char("But you can already guild!\n\r",ch);
00246                 return;
00247         }
00248         if ((victim = get_char_world (ch, argument)) == NULL)
00249         {
00250                 send_to_char ("They aren't playing.\n\r", ch);
00251                     return;
00252             }
00253         if (victim->clan != ch->clan)
00254         {
00255             send_to_char("They are not a member of your clan.\n\r",ch);
00256                 return;
00257         }
00258         SET_BIT (victim->cclan, CLAN_REC);
00259                 sprintf(buf, "You are now set to guild in %s.\n\r",clan_table[ch->clan].who_name);
00260         send_to_char(buf,victim);
00261         sprintf(buf, "%s is now set to guild in %s.\n\r",victim->name, clan_table[ch->clan].who_name);
00262         send_to_char(buf,ch);
00263     }
00264     else
00265     {
00266         send_to_char("You must be a clan leader to set guild status.\n\r",ch);
00267         return;
00268     }
00269 
00270 
00271                  
00272         
00273 
00274         
00275     return;
00276 }
00277 void do_set_leader (CHAR_DATA *ch, char *argument)
00278 {
00279 char buf[MAX_STRING_LENGTH];
00280 CHAR_DATA *victim;
00281       char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
00282       int clan;
00283 argument = one_argument (argument, arg1);
00284 argument = one_argument (argument, arg2);
00285 
00286 if (arg1[0] == '\0' || arg2[0] == '\0')
00287 {
00288     send_to_char("Syntax -- 'setleader <char> <clan>\n\r",ch);
00289         return;
00290 }
00291 
00292     
00293 if (ch->level < 58)
00294 
00295 {
00296     send_to_char("You must be a level 58 or above immortal to accomplish this task. Sorry.\n\r",ch);
00297     return;
00298 }
00299 if ((victim = get_char_world (ch, arg1)) == NULL)
00300 {
00301     send_to_char ("They are not playing at the moment.\n\r",ch);
00302     return;
00303 }
00304 if ((clan = clan_lookup(arg2)) == 0)
00305 {
00306     send_to_char("There is no such clan.\n\r",ch);
00307     return;
00308 }
00309 
00310 sprintf(buf, "You are now the leader of %s.\n\r",clan_table[clan].who_name);
00311 send_to_char(buf,victim);
00312 sprintf(buf, "%s is now the leader of %s.\n\r",victim->name, clan_table[clan].who_name);
00313 send_to_char(buf, ch);
00314 SET_BIT(victim->cclan, CLAN_LEADER);
00315 SET_BIT(victim->cclan, CLAN_REC);
00316     
00317 
00318 }
00319 
00320 void do_remove_leader (CHAR_DATA *ch, char *argument)
00321 {
00322     CHAR_DATA *victim;
00323     char buf[MAX_STRING_LENGTH];
00324     if (ch->level < 58)
00325     {
00326         send_to_char("You must be atleast level 59 to accomplish this.\n\r",ch);
00327         return;
00328     }
00329     
00330     if (argument[0]== '\0')
00331     {
00332         send_to_char("Argument - 'removeleader <who>'\n\r",ch);
00333         return;
00334     }
00335     if ((victim = get_char_world (ch, argument)) == NULL)
00336     {
00337         send_to_char("They are not playing at the moment.\n\r",ch);
00338         return;
00339     }
00340     if (victim->clan == 0)
00341     {
00342         send_to_char("They are not in a clan.\n\r",ch);
00343         return;
00344     }
00345     if (!IS_SET(victim->cclan, CLAN_LEADER))
00346     {
00347         send_to_char("They are not a clan leader.\n\r",ch);
00348         return;
00349     }
00350     if (IS_SET(victim->cclan, CLAN_LEADER))
00351     {
00352         sprintf(buf,"You are no longer a leader of %s.\n\r", clan_table[victim->clan].who_name);
00353         send_to_char(buf,victim);
00354         sprintf(buf, "%s is no longer the leader of %s.\n\r", victim->name, clan_table[victim->clan].who_name);
00355         send_to_char(buf,ch);
00356         REMOVE_BIT(victim->cclan, CLAN_LEADER);
00357         REMOVE_BIT(victim->cclan, CLAN_REC);
00358     }
00359     return;
00360 }
00361 void do_remove_recruiter (CHAR_DATA *ch, char *argument)
00362 {
00363     CHAR_DATA *victim;
00364     char buf[MAX_STRING_LENGTH];
00365 
00366     if (ch->level < 58)
00367     {
00368         send_to_char("You must be atleast level 59 to do this.\n\r",ch);
00369         return;
00370     }   
00371     if (argument[0]== '\0')
00372     {
00373         send_to_char("Argument - 'removerecruiter <who>'\n\r",ch);
00374         return;
00375     }
00376     if ((victim = get_char_world (ch, argument)) == NULL)
00377     {
00378         send_to_char("They are not playing at the moment.\n\r", ch);
00379         return;
00380     }
00381     if (!IS_SET(victim->cclan, CLAN_REC))
00382     {   
00383         send_to_char("They are not a recruiter.\n\r",ch);
00384         return;
00385     }
00386     if (IS_SET(victim->cclan, CLAN_REC))
00387     {
00388         sprintf(buf, "You are no longer a recruiter for %s.\n\r", clan_table[victim->clan].who_name);
00389         send_to_char(buf,victim);
00390         sprintf(buf, "%s is not longer a recruiter for %s.\n\r", victim->name, clan_table[victim->clan].who_name);
00391         send_to_char(buf,ch);
00392         REMOVE_BIT(victim->cclan, CLAN_REC);
00393     }
00394     return;
00395 
00396     
00397 }
00398 

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