#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_STRING_LENGTH];
int counter;
int count;
char buf2[MAX_STRING_LENGTH];
argument = one_argument(argument,command);
if (command[0] == '\0')
{
send_to_char("Something is wrong\n\r",ch);
}
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;
}
switch (ch->position)
{
case POS_DEAD:
send_to_char("Lie still; you are DEAD!\n\r",ch);
return;
case POS_INCAP:
case POS_MORTAL:
send_to_char("You are hurt far too bad for that.\n\r",ch);
return;
case POS_STUNNED:
send_to_char("You are too stunned for that.\n\r",ch);
return;
}
one_argument(argument,arg);
victim = NULL;
if (arg[0] == '\0')
{
sprintf(buf, "{W[{DSocial{W]{R:{x %s", social_table[cmd].char_no_arg);
act(buf,ch,NULL,NULL,TO_CHAR);
sprintf(buf, "{W[{DSocial{W]{R:{x %s",social_table[cmd].others_no_arg );
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *vch;
vch = d->original ? d->original : d->character;
if (d->connected == CON_PLAYING &&
d->character != ch)
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, "{W[{DSocial{W]{R:{x %s", social_table[cmd].char_auto);
act(buf,ch,NULL,NULL,TO_CHAR);
sprintf(buf, "{W[{DSocial{W]{R:{x %s",social_table[cmd].others_auto);
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *vch;
vch = d->original ? d->original : d->character;
if (d->connected == CON_PLAYING &&
d->character != ch)
act(buf,ch,NULL,vch,TO_VICT);
}
}
else
{
sprintf(buf, "{W[{DSocial{W]{R:{x %s",social_table[cmd].char_found);
act(buf,ch,NULL,victim,TO_CHAR);
sprintf(buf, "{W[{DSocial{W]{R:{x %s",social_table[cmd].vict_found);
act(buf,ch,NULL,victim,TO_VICT);
sprintf(buf, "{W[{DSocial{W]{R:{x %s",social_table[cmd].others_found);
for (counter = 0; buf[counter+1] != '\0'; counter++)
{
if (buf[counter] == '$' && 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,"it");
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,"it");
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')
{
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_DATA *vch;
vch = d->original ? d->original : d->character;
if (d->connected == CON_PLAYING &&
d->character != ch &&
d->character != victim)
act(buf,ch,NULL,vch,TO_VICT);
}
}
return;
}