#if defined(macintosh) #include <type.h> #else #include <sys/types.h> #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "merc.h" #include "interp.h" void do_gsocial(CHAR_DATA *ch, char *argument) { char command [MAX_INPUT_LENGTH]; CHAR_DATA *victim; int cmd; bool found; char arg [MAX_INPUT_LENGTH]; DESCRIPTOR_DATA *d; char buf [MAX_INPUT_LENGTH]; int counter; int count; char buf2 [MAX_INPUT_LENGTH]; argument = one_argument(argument, command); if (command[0] == '\0') { send_to_char("Which social?\n\r",ch); return; } found = FALSE; for (cmd = 0; social_table[cmd].name[0] != '\0'; cmd++) { if(command[0] == social_table[cmd].name[0] && str_prefix( command,social_table[cmd].name)) { found = TRUE; break; } } if (!found) { send_to_char("What kind of social is THAT?!\n\r", ch); return; } if (!IS_NPC(ch) && IS_SET(ch->deaf,CHANNEL_GSOCIAL)) { send_to_char("GSocials are turned off.\n\r", ch); return; } if (!IS_NPC(ch) && IS_SET(ch->act,PLR_SILENCE)) { send_to_char("The gods have revoked your channel priviliges.\n\r",ch); return; } switch (ch->position) { case POS_DEAD: send_to_char("Hard to socialize when you are DEAD!\n\r",ch); return; case POS_INCAP: case POS_MORTAL: send_to_char("The pain is to great to do much of anything.\n\r",ch); case POS_STUNNED: send_to_char("The pain is to great to do much of anything.\n\r",ch); } one_argument(argument, arg); victim = NULL; if(arg[0] == '\0') { sprintf(buf,"#R[#ySocial#R] #7 %s#n", social_table[cmd].char_no_arg); act(buf,ch,NULL,NULL,TO_CHAR); sprintf(buf,"#R[#ySocial#R] #7 %s#n", social_table[cmd].others_no_arg); for(d=descriptor_list; d!= NULL; d->next) { CHAR_DATA *vch; vch = d->original ? d->original : d->character; if(d->connected == CON_PLAYING && d->character!=ch && !IS_SET(vch->deaf, CHANNEL_GSOCIAL)) { act(buf,ch,NULL,vch,TO_VICT); } } } else if ((victim = get_char_world(ch,arg)) == NULL) { send_to_char("They aren't here.\n\r",ch); return; } else if (victim == ch) { sprintf(buf,"#R[#ySocial#R] #7 %s#n", social_table[cmd].char_auto); act(buf,ch,NULL,NULL,TO_CHAR); sprintf(buf,"#R[#ySocial#R] #7 %s#n", social_table[cmd].others_auto); for(d=descriptor_list; d!= NULL; d->next) { CHAR_DATA *vch; vch = d->original ? d->original : d->character; if(d->connected == CON_PLAYING && D->character!=ch && !IS_SET(vch->deaf, CHANNEL_GSOCIAL)) { act(buf,ch,NULL,vch,TO_VICT); } } } else { sprintf(buf,"#R[#ySocial#R] #7 %s#n", social_table[cmd].char_found); act(buf,ch,NULL,NULL,TO_CHAR); sprintf(buf,"#R[#ySocial#R] #7 %s#n", social_table[cmd].vict_found); act(buf,ch,NULL,NULL,TO_VICT); sprintf(buf,"#R[#ySocial#R] #7 %s#n", social_table[cmd].others_found); counter=0; if(buf[counter+1]!='\0' && buf[counter+1] == 'N') { strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2,victim->name); for(count=0;buf[count] != '\0';count++) { buf[count] = buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); } } else if (buf[counter] == '$' && buf[counter +1] == 'E') { switch (victim->sex) { default: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "it"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; case 1: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "him"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; case 2: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "her"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; } } else if (buf[counter] == '$' && buf[counter+1] == 'M') { buf[counter] = '%'; buf[counter+1] = 's'; switch (victim->sex) { default: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "it"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; case 1: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "him"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; case 2: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "her"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; } } else if (buf[counter] == '$' && buf[counter+1] == 'S') { buf[counter] = '%'; buf[counter+1] = 's'; switch (victim->sex) { default: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "its"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; case 1: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "his"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; case 2: strcpy(buf2,buf); buf2[counter] = '\0'; strcat(buf2, "hers"); for(count=0;buf[count]!='\0';count++) { buf[count]=buf[count+counter+2]; } strcat(buf2,buf); strcpy(buf,buf2); break; } } for (d=descriptor_list;d!=NULL;d=d->next) { CHAR_DTA *vch; vch=d->original ? d->original : d->character; if (d->connected == CON_PLAYING && d->character != ch && d->character !=victim && !IS_SET(vch->deaf, CHANNEL_GSOCIAL)) { act(buf,ch,NULL,vch,IO_VICT); } } } return; }