/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
/***************************************************************************
* ROM 2.4 is copyright 1993-1996 Russ Taylor *
* ROM has been brought to you by the ROM consortium *
* Russ Taylor (rtaylor@efn.org) *
* Gabrielle Taylor *
* Brian Moore (zump@rom.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************/
#include <glib.h>
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <merc.h>
#include <interp.h>
/* Local functions... */
void do_notag(CHAR_DATA *ch, char *argument);
void game_in_play(CHAR_DATA *ch, char *name);
void do_tag( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *victim;
char name[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
name[0]='\0';
game_in_play(ch, name);
if (IS_NPC(ch))
return;
if ( argument[0] == '\0' )
{
send_to_char("Who do you want to tag?\n\r", ch);
return;
}
if ( strcmp(argument,"show")==0 )
{
if ( name[0] == '\0' )
{
send_to_char("There is no game of tag in progress.\n\r", ch);
return;
}
else
{
sprintf(buf, "%s is currently IT!\n\r", name);
send_to_char(buf, ch);
return;
}
}
victim = get_char_world(ch,argument);
if ( victim == NULL )
{
send_to_char( "They aren't playing!\n\r", ch);
return;
}
if ( victim->level < 2 )
{
send_to_char("You can't tag submortals.\n\r",ch);
return;
}
if ( IS_NPC(victim) )
{
send_to_char("Sorry! NPC's can't play tag!\n\r", ch);
return;
}
if (IS_SET(victim->act, PLR_NOTAG) )
{
send_to_char("They don't want to play tag... Spoil sports!\n\r", ch);
return;
}
if ( (name[0] == '\0' ) ) /* No Game in progress... */
{
if ( ch->name == victim->name && IS_IMMORTAL(ch)) /* Player tags self... */
{
SET_BIT(victim->act, PLR_TAG);
send_to_char("You tag yourself, Now go get someone!\n\r", ch);
do_info(ch,"The game of tag has started!\n\r");
return;
}
else /* Player tags someone else... */
{
if (IS_IMMORTAL(ch))
{
if ((ch->in_room->vnum == victim->in_room->vnum) && can_see(ch, victim)) /* Players can see eachother... */
{
SET_BIT(victim->act, PLR_TAG );
sprintf(buf, "%s Pounces on you shouting 'TAG! You're IT!'\n\r", ch->name->str);
send_to_char(buf, victim);
sprintf(buf, "You pounce on %s and shout 'TAG! You're IT!'\n\r", victim->name->str);
send_to_char(buf, ch);
sprintf(buf, "%s has started a game of TAG, and %s is IT!\n\r", ch->name->str, victim->name->str);
do_info(ch,buf); /* Voltecs info channel */
return;
}
else /* Players can't see eachother! */
{
send_to_char("You can't see anyone by that name...\n\r", ch);
return;
}
}
else
{
send_to_char("There is no game of tag in progress, why not start one!\n\r", ch);
return;
}
}
}
else /* There is a game in play... */
{
if (!IS_SET(ch->act, PLR_TAG) ) /* The player calling tag isn't IT */
{
sprintf(buf, "There is already a game in play, and %s is IT!\n\r", name);
send_to_char(buf, ch);
return;
}
else /* The player calling tag is IT */
{
if (ch->name == victim->name ) /* Player tags self... */
{
send_to_char("Tagging yourself won't get you anywhere!\n\r", ch);
return;
}
else /* Player Tags someone else... */
{
if ((ch->in_room->vnum == victim->in_room->vnum) && can_see(ch, victim)) /* Players can see eachother... */
{
if (IS_IMMORTAL(victim))
{
REMOVE_BIT(ch->act, PLR_TAG );
sprintf(buf, "%s Pounces on you shouting 'TAG! You're IT!'\n\r", ch->name->str);
send_to_char(buf, victim);
sprintf(buf, "You pounce on %s and shout 'TAG! You're IT!'\n\r", victim->name->str);
send_to_char(buf, ch);
sprintf(buf, "TAG Game update: %s has just Ended it\n\r", ch->name->str);
do_info(ch,buf); /* Voltecs info channel */
return;
}
else
{
SET_BIT(victim->act, PLR_TAG );
REMOVE_BIT(ch->act, PLR_TAG );
sprintf(buf, "%s Pounces on you shouting 'TAG! You're IT!'\n\r", ch->name->str);
send_to_char(buf, victim);
sprintf(buf, "You pounce on %s and shout 'TAG! You're IT!'\n\r", victim->name->str);
send_to_char(buf, ch);
sprintf(buf, "TAG Game update:- %s has just tagged %s, so %s is IT!\n\r", ch->name->str, victim->name->str, victim->name->str);
do_info(ch,buf); /* Voltecs info channel */
return;
}
}
else /* Players can't see eachother... */
{
send_to_char("You can't see anyone by that name...\n\r", ch);
return;
}
} /* End of Player Tags someone else... */
} /* End of Player calling tag is IT */
} /* End of there is a game in play */
} /* End of do_tag */
/********************************************************************/
void do_notag(CHAR_DATA *ch, char *argument) /*Removes a players TAG flag if set... */
{
if (IS_SET (ch->act, PLR_NOTAG ) )
{
send_to_char("You now allow people to tag you. (YAY!)\n\r", ch);
REMOVE_BIT( ch->act, PLR_NOTAG );
return;
}
else
{
send_to_char("You no longer let people tag you... (Spoil Sport!)\n\r", ch);
SET_BIT( ch->act, PLR_NOTAG );
return;
}
}
/********************************************************************/
void game_in_play(CHAR_DATA *ch, char *name)
{
CHAR_DATA *on_it;
DESCRIPTOR_DATA *d;
GSList *desc_list = descriptor_list;
while ( desc_list != NULL )
{
d = (DESCRIPTOR_DATA*)desc_list->data;
if ( d->connected == CON_PLAYING && IS_SET(d->character->act, PLR_TAG) )
{
on_it = d->character;
str_cpy(name, d->character->name->str);
}
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
return;
}
bool is_ignoring(CHAR_DATA *ch, CHAR_DATA *victim)
{
int pos;
CHAR_DATA *rch;
if (IS_NPC(ch) || IS_NPC(victim))
return FALSE;
if (ch->desc == NULL)
rch = ch;
else
rch = ch->desc->original ? ch->desc->original : ch;
for (pos = 0; pos < MAX_IGNORE; pos++)
{
if (rch->pcdata->ignore[pos] == NULL)
break;
if (!str_cmp(rch->pcdata->ignore[pos]->str, victim->name->str))
return TRUE;
}
return FALSE;
}
void do_ignore(CHAR_DATA *ch, char *argument)
{
CHAR_DATA *victim, *rch;
char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH];
int pos;
argument = one_argument(argument, arg);
if (ch->desc == NULL)
rch = ch;
else
rch = ch->desc->original ? ch->desc->original : ch;
if (IS_NPC(rch))
return;
if (arg[0] == '\0')
{
send_to_char("Who do you want to ignore?\n\r", ch);
return;
}
if ((victim = get_char_world(rch, argument)) == NULL)
{
send_to_char("They aren't here.\n\r", ch);
return;
}
if (IS_NPC(victim))
{
send_to_char("Ignore a mob? I don't think so.\n\r", ch);
return;
}
if (ch == victim)
{
send_to_char("I don't think you really want to ignore yourself.\n\r", ch);
return;
}
if (IS_IMMORTAL(victim))
{
send_to_char("Don't even think you can ignore immortals!\n\r", ch);
return;
}
for (pos = 0; pos < MAX_IGNORE; pos++)
{
if (rch->pcdata->ignore[pos] == NULL)
break;
if (!str_cmp(arg, rch->pcdata->ignore[pos]->str))
{
rch->pcdata->ignore[pos] = g_string_assign(rch->pcdata->ignore[pos],"");
sprintf(buf, "You stop ignoring %s.\n\r", victim->name->str);
send_to_char(buf, ch);
sprintf(buf, "%s stops ignoring you.\n\r", ch->name->str);
send_to_char(buf, victim);
return;
}
}
if (pos >= MAX_IGNORE)
{
send_to_char("You can't ignore anymore people.\n\r", ch);
return;
}
rch->pcdata->ignore[pos] = g_string_assign(rch->pcdata->ignore[pos],arg);
sprintf(buf, "You now ignore %s.\n\r", victim->name->str);
send_to_char(buf, ch);
sprintf(buf, "%s ignores you.\n\r", ch->name->str);
send_to_char(buf, victim);
return;
}