arena.c
rot/src/arena.c · 6.7 KB
From the archive UW1.tar.gz
Download the archive « Back to the archive contents
/***************************************************************************
* 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 *
***************************************************************************/
/***************************************************************************
* Arena code written by Shinji for Destiny Mud *
* Written in the summer of '01 released for the public in '02 *
* All rights reserved for this code to Tim Hoye (tim_hoye@hotmail.com) *
* Destiny Mud is located at destiny.boue.ca port 7000 *
***************************************************************************/
#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 "recycle.h"
int atoi args( ( const char *string ) );
DECLARE_DO_FUN( do_transfer );
DECLARE_DO_FUN( do_echo );
void do_challenge(CHAR_DATA *ch, char *argument)
{
CHAR_DATA *victim;
char buf[MAX_INPUT_LENGTH];
char arg [MAX_INPUT_LENGTH];
one_argument(argument,arg);
if IS_NPC(ch)
{
return;
}
if (arg[0] == '\0')
{
send_to_char("Syntax: challenge <person>\n\r",ch);
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL)
|| IS_AFFECTED(ch, AFF_CURSE))
{
send_to_char( "The Gods have forsaken you.\n\r", ch );
return;
}
if (victim == ch)
{
return;
}
if (IS_SET(victim->act,PLR_ARENA))
{
send_to_char("They are already in the arena.\n\r",ch);
return;
}
SET_BIT( ch->act, PLR_ARENA );
sprintf(buf, "%s 8802",ch->name);
do_transfer(ch,buf);
sprintf( buf, "{R[ARENA]: {W%s {bhas just challenged {W%s {bto a friendly duel{x\n\r",ch->name,victim->name );
do_echo( ch, buf );
send_to_char("You have been challenged in the arena to deny challenge, just sit there and do nothing.\n\r",victim);
}
void do_accept(CHAR_DATA *ch, char *argument)
{
CHAR_DATA *victim;
char buf[MAX_INPUT_LENGTH];
char arg [MAX_INPUT_LENGTH];
one_argument(argument,arg);
if IS_NPC(ch)
{
return;
}
if (arg[0] == '\0')
{
send_to_char("Syntax: accept <person>\n\r",ch);
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL)
|| IS_AFFECTED(ch, AFF_CURSE))
{
send_to_char( "The Gods have forsaken you.\n\r", ch );
return;
}
if (victim == ch)
{
return;
}
if ( !IS_SET(victim->act,PLR_ARENA))
{
send_to_char("They are not in the arena.\n\r",ch);
return;
}
SET_BIT( ch->act, PLR_ARENA );
sprintf(buf, "%s 8802",ch->name);
do_transfer(ch,buf);
sprintf(buf,"{R[ARENA] {W%s {bhas just accepted the challenge.\n\r",ch->name);
do_echo( ch, buf );
}
void do_leave(CHAR_DATA *ch)
{
char buf[MAX_INPUT_LENGTH];
if IS_NPC(ch)
{
return;
}
if ( !IS_SET(ch->act,PLR_ARENA))
{
send_to_char("You are not in the arena.\n\r",ch);
return;
}
if (ch->position == POS_FIGHTING)
{
send_to_char("Maybe you should finish fighting first?\n\r",ch);
return;
}
REMOVE_BIT(ch->act,PLR_ARENA);
sprintf(buf,"{R[ARENA] {W%s {bhas just left the arena.\n\r",ch->name);
do_echo( ch, buf );
sprintf(buf,"%s 100",ch->name);
do_transfer(ch,buf);
}
void do_arena( CHAR_DATA *ch )
{
char buf[MSL];
DESCRIPTOR_DATA *d;
bool found;
found = FALSE;
sprintf(buf,"{Y<><><><><> {bUW Arena Status {Y<><><><><>{x\n\r");
send_to_char(buf,ch);
sprintf(buf,"{Y<><><><><> {bPlayers In The Arena {Y<><><><><>{x\n\r");
send_to_char(buf,ch);
sprintf(buf,"{Y<> <>{x\n\r");
send_to_char(buf,ch);
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *wch;
if (d->connected != CON_PLAYING || !can_see(ch,d->character))
continue;
wch = ( d->original != NULL ) ? d->original : d->character;
if (!can_see(ch,wch))
continue;
if (!IS_SET(wch->act,PLR_ARENA))
continue;
found = TRUE;
sprintf(buf,"{Y<> {wName: {r%12s {wLevel: {r%3d {Y<>{x\n\r",wch->name,wch->level);
send_to_char(buf,ch);
}
if (!found)
{
sprintf(buf,"There isn't anyone inside the arena right now.\n\r");
send_to_char(buf,ch);
}
sprintf(buf,"{Y<> <>{x\n\r");
send_to_char(buf,ch);
sprintf(buf,"{Y<><><><><><><><><><><><><><><><><><><><><>{x\n\r");
send_to_char(buf,ch);
}