/*************************************************************************** * 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-1995 Russ Taylor * * ROM has been brought to you by the ROM consortium * * Russ Taylor (rtaylor@pacinfo.com) * * Gabrielle Taylor (gtaylor@pacinfo.com) * * Brian Moore (rom@rom.efn.org) * * By using this code, you have agreed to follow the terms of the * * ROM license, in the file Rom24/doc/rom.license * ***************************************************************************/ /*************************************************************************** * ROT 1.4 is copyright 1996-1997 by Russ Walsh * * By using this code, you have agreed to follow the terms of the * * ROT license, in the file doc/rot.license * ***************************************************************************/ /*************************************************************************** * Hello and thanks for trying out my arena code. :) All I really have to * * is that I would like a little credit if you dont mind like keeping * * the statements I make in the file and keeping this header in the file * * I dont REQUIRE you to give me credit although its always nice to * * credit the coders for their work(hint hint :p). Anyways all I really * * want is for you people to have fun anyways adios. Any problems, * * changes, bugs, comments or anything you might wanna see on the next * * release(if there even is one) mail me at shuvthisupyourass@hotmail.com * ******************************[Happy MUDding]******************************/ #if defined(macintosh) #include <types.h> #else #include <sys/types.h> #endif #include <stdlib.h> #include <string.h> #include <stdio.h> #include <string.h> #include <time.h> #include "merc.h" #include "interp.h" /* Alright you can delete this after you read it I only have here here for a few * ideas and such. Alright on my mud I have it so you can yourself and fight a * that is cloned after you. Also I am working on having it so you can challenge * groups and guilds and do battle that way which comes in handy for NPK guilds and * such. Anyways if anyone has any ideas or finds some bugs as I didn't test this * all that much just to see if it worked and I could challenge after I challenge * someone. Alright thats all anyways mail me if you find bugs or have ideas or * wanna make a comment about it :) anyways adios have fun */ bool is_challenge; bool challenge_tme = 0; bool arena_is_busy = FALSE; /* * do_challenge sends the challenge */ void do_challenge(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; ROOM_INDEX_DATA *room1; ROOM_INDEX_DATA *room2; char buf[MAX_STRING_LENGTH]; int i = 0; if (argument[0] == '\0') { send_to_char("You must specify who you want to challenge.\n\r", ch); return; } if (is_challenge) { send_to_char("Someone has been challenged wait a few moments the try again.",ch); return; } if (arena_is_busy) { send_to_char("The arena is being used at the moment..Please wait a few minutes.\n\r",ch); return; } if ((victim = get_char_world(ch,argument)) == NULL) { act_new( "Sorry but $t seems to be gone from the realms at this time.'", ch,argument, NULL, TO_CHAR,POS_STANDING ); return; /* simply change the acts to send_to_char if you dont want this. */ } if(IS_SET(ch->act2,ACT2_CHALLENGED)) { send_to_char("You have been challenged already. Accept or decline.\n\r",ch); return; } if(IS_SET(victim->act2,ACT2_CHALLENGER)) { act("$N has already challenged someone else.",ch,NULL,victim,TO_CHAR); return; } if (IS_SET(victim->comm,COMM_AFK)) { act("Sorry but $N is AFK at the moment.",ch,NULL,victim,TO_CHAR); return; /* simply change the acts to send_to_char if you dont want this. */ } /* this check was changed you need to change what it says though :p */ if (IS_NPC(victim) || ch->victim == ch) { send_to_char("You can only challenge players or yourself.\n\r",ch); return; /* simply change the acts to send_to_char if you dont want this. */ } if (IS_IMMORTAL(victim) && !IS_IMMORTAL(ch)) { act("Sorry but $E is a higher being.",ch,NULL,victim,TO_CHAR); send_to_char("Besides they all would laugh at you!\n\r",ch); return; /* simply change the acts to send_to_char if you dont want this. */ } if (victim->level <= 5) { act("Sorry but $E is not experianced enough.",ch,NULL,victim,TO_CHAR); return; /* simply change the acts to send_to_char if you dont want this. */ } if (victim->fighting != NULL ) { act("Sorry but $N is in combat right now.",ch,NULL,victim,TO_CHAR); return; } if (!str_cmp(argument,"self") || !str_cmp(argument,"mirror match")) { return; /* Sorry I dont wanna give away all my stuff right now :p */ } /* this is where the challenge gets sent */ SET_BIT(ch->act2,ACT2_CHALLENGER); send_to_char("Your challenge has been sent if they done accept in 3 ticks it will decline",ch); sprintf(buf,"\n\rIf they do not accept it will be automatically withdrawn from %s.\n\r",ch->name); send_to_char(buf,ch); act("{RYou have been challenged by {W$n{R.{x",ch,NULL,victim,TO_VICT); sprintf(buf,"Type accept %s to accept or decline %s to decline.\n\r",ch->name, ch->name); send_to_char(buf,victim); challenge_tme = 5; is_challenge = TRUE; return; } /* * Accepts a challenge */ void do_accept(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char buf[MAX_STRING_LENGTH]; ROOM_INDEX_DATA *room1; ROOM_INDEX_DATA *room2; if (IS_NPC(ch)) { send_to_char("Hrmm....You must be a new kinda mobile to accept challenges eh?",ch); return; } if (argument[0] == '\0') { send_to_char("You must be specify who challenged you I am only a MUD that can do so mud.\n\r", ch); return; } if ((victim = get_char_world(ch,argument)) == NULL) { act_new( "Sorry but $t seems to be gone from the realms at this time.'", ch,argument, NULL, TO_CHAR,POS_STANDING ); return; /* simply change the acts to send_to_char if you dont want this. */ } if (IS_NPC(victim)) { send_to_char("Hrmm, I dont think I can let you die like that.\n\r", ch); return; } if (victim == ch) { send_to_char("I bet you think your funny eh?\n\r",ch); return; } if (!IS_SET(victim->act2, ACT2_CHALLENGER)) { send_to_char("Now have you drank that much ale that you can't remember who challenged you?\n\r",ch); return; } /* these will need to get changed for your mud :p */ room1 = get_room_index(number_range(30000,30008)); room2 = get_room_index(number_range(30000,30008)); sprintf(buf, "{R%s has accepted your challenge!{x\n\r", ch->name); send_to_char(buf, victim); send_to_char("You plop onto the ground.\n\r",ch); char_from_room(ch); char_to_room( ch, room1 ); do_look(ch,"auto"); send_to_char("You plop onto the ground.{x\n\r",victim); char_from_room(victim); char_to_room( victim, room2 ); do_look(ch, "auto"); SET_BIT(ch->act2,ACT2_CHALLENGED); SET_BIT(ch->comm,COMM_NOCHANNELS); SET_BIT(ch->act,PLR_NORESTORE); SET_BIT(victim->comm,COMM_NOCHANNELS); SET_BIT(victim->act,PLR_NORESTORE); arena_is_busy = TRUE; is_challenge = FALSE; challenge_tme = 0; return; } void do_decline(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char buf[MAX_STRING_LENGTH]; if (argument[0] == '\0') { send_to_char("You must specify who you want to challenge.\n\r", ch); return; } if (!is_challenge) { send_to_char("Nobody hase even challenged someone wanna try again?",ch); return; } if (arena_is_busy) { send_to_char("Alright the arena is in use so no one yet again has challenged you.\n\r",ch); return; } if ((victim = get_char_world(ch,argument)) == NULL) { act_new( "Sorry but $t seems to be gone from the realms at this time.'", ch,argument, NULL, TO_CHAR,POS_STANDING ); return; /* simply change the acts to send_to_char if you dont want this. */ } if(!IS_SET(victim->act2,ACT2_CHALLENGER)) { act("$N hasn't challenged you.",ch,NULL,victim,TO_CHAR); return; } if (IS_NPC(victim) || victim == ch) { send_to_char("How did that happen?\n\r",ch); return; /* simply change the acts to send_to_char if you dont want this. */ } is_challenge = FALSE; REMOVE_BIT(ch->act2, ACT2_CHALLENGER); sprintf(buf, "{R%s decline your invitation to death!{x\n\r", ch->name); send_to_char(buf, victim); sprintf(buf, "{RYou have choosen not to die by %s!{x\n\r", victim->name); send_to_char(buf, ch); return; } void do_withdraw(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char buf[MAX_STRING_LENGTH]; if (IS_NPC(ch)) return; if (!IS_SET(ch->act2,ACT2_CHALLENGER)) { send_to_char("You haven't challenged anyone!\n\r", ch); return; } if ((victim = get_char_world(ch, argument)) == NULL) { send_to_char("Does it look like they are here?!?\n\rNO, I didn't think so!!\n\r", ch); return; } if (arena_is_busy) { send_to_char("Hrmm, how does that work again?!?\n\r", ch); return; } if (IS_NPC(victim)) { send_to_char("I think you are brain dead how many drugs have you done again?\n\r", ch); return; } is_challenge = FALSE; REMOVE_BIT(ch->act2,ACT2_CHALLENGER); sprintf(buf, "{R%s has withdrawn their challenge!{x\n\r", ch->name); send_to_char(buf, victim); sprintf(buf, "{RYou withdraw your challenge to %s!{x\n\r", victim->name); send_to_char(buf, ch); return; } * This is has been censored even though I hate censorship * ********************************************************************* * Hello I would first like to say hello and thanks for using this * * well that is if you use it. :p All I have to say is that this * * is a base foundation for a good arena system why i say good is * * because as far as I know with the testing I have done is that * * works without any bugs in the functions I am releasing to you in * * this version. Anyways this is the installation. So what I say * * in here is what you MUST follow not really I am sure there is a * * better way to do what I did heh anyways. DONT SEND ME SHIT * * TELLING ME THAT I SUCK AT CODING AND HOW MUCH BETTER THIS COULDA * * BEEN WRITTEN. The reason I say that is because for some reason * * all the arena snippets I have downloaded always had mass ass * * bugs and shit and its easier to write your own after fixing all * * of them. After all if your looking at this your prolly conside- * * using this in your mud so dont say SHIT! heh now that I have * * outta my system lets get on with it! oh yea have fun :) * ********************************************************************* * * ********************************************************************* BTW if your using ROM just take out the norestore crap because I am using RoT and we have that unless you wanna add it in Also this *SHOULD* work on ROM heh so yea heh. :p Alright first in the makefile stick arena.o in there :) ******************#####$$$$$[merc.h]$$$$$#####******************** define these somewhere where you have free bits #define ACT2_CHALLENGED (A) #define ACT2_CHALLENGER (B) Then in room flags stick this stuff in there #define ROOM_ARENA (Y) /*use whatever is next :p */ in pc_data struct stick these somewhere int akills; int adeaths; ******************#####$$$$$[update.c]$$$$$#####******************** stick this in char_update I put it right after this --> if ( ch->position == POS_STUNNED ) update_pos( ch ); <-- after that I have this if ( challenge_tme != 0) challenge_tme--; if (challenge_tme == 0 && IS_SET(ch->act2,ACT2_CHALLENGER) && !IS_SET(ch->in_room->room_flags,ROOM_ARENA)) { send_to_char("{RThey have not responded challenge canceled.{x\n\r",ch); REMOVE_BIT(ch->act2,ACT2_CHALLENGER); is_challenge = FALSE; return; } ******************#####$$$$$[tables.c]$$$$$#####******************** Stick this in the room_flags spot I have it last :p { "arena", ROOM_ARENA, TRUE }, *************[handler.c]***********(so what I got lazy :p) This is in the room_bit_name thing or wahtever it is :p if (room_flags & ROOM_ARENA ) strcat(buf, " arena"); ************************************************************************* * Now this is the hard part if you **** up here it wont work correctly * * do exactly as I say here or your players will get pissed when they * * get pked in the arena and loose their **** in there * ************************************************************************* $ $ ######################################################################### This is where I put it is right after the sleeping spells s**t this is how mine is. So stick this in damage and damage_old(If you dont use RoT dont worry about damage_old) /* * Sleep spells and extremely wounded folks. */ if ( !IS_AWAKE(victim) ) stop_fighting( victim, FALSE ); <-----------from here on down stick this piece of code if (victim->position == POS_DEAD && !IS_NPC(victim) && !IS_NPC(ch) && (IS_SET(victim->in_room->room_flags,ROOM_ARENA))) { ch->pcdata->akills += 1; victim->pcdata->adeaths += 1; /* the dead man */ stop_fighting(victim,TRUE); char_from_room(victim); char_to_room(victim,get_room_index(ROOM_VNUM_ALTAR)); send_to_char("{RYou lost haha!{x\n\r",victim); victim->hit = victim->max_hit; victim->mana = victim->max_mana; affect_strip(victim,gsn_plague); affect_strip(victim,gsn_poison); affect_strip(victim,gsn_blindness); affect_strip(victim,gsn_sleep); affect_strip(victim,gsn_curse); victim->move = victim->max_move; update_pos( victim ); do_look(victim, "auto"); /* the winner :) */ stop_fighting(ch,TRUE); char_from_room(ch); char_to_room(ch,get_room_index(ROOM_VNUM_TEMPLE)); send_to_char("{RYou won are you sure you didn't cheat?!? heh{x\n\r",ch); ch->hit = ch->max_hit; ch->mana = ch->max_mana; affect_strip(ch,gsn_plague); affect_strip(ch,gsn_poison); affect_strip(ch,gsn_blindness); affect_strip(ch,gsn_sleep); affect_strip(ch,gsn_curse); ch->move = ch->max_move; update_pos( ch ); do_look(ch, "auto"); if (IS_SET(ch->act2,ACT2_CHALLENGER)) REMOVE_BIT(ch->act2,ACT2_CHALLENGER); if (IS_SET(victim->act2,ACT2_CHALLENGER)) REMOVE_BIT(victim->act2,ACT2_CHALLENGER); if (IS_SET(victim->act2,ACT2_CHALLENGED)) REMOVE_BIT(victim->act2,ACT2_CHALLENGED); if (IS_SET(ch->act2,ACT2_CHALLENGED)) REMOVE_BIT(ch->act2,ACT2_CHALLENGED); REMOVE_BIT(ch->comm,COMM_NOCHANNELS); REMOVE_BIT(ch->act,PLR_NORESTORE); REMOVE_BIT(victim->comm,COMM_NOCHANNELS); REMOVE_BIT(victim->act,PLR_NORESTORE); arena_is_busy = FALSE; return TRUE; } <----------------Ending of code NOTICE: If your using RoT you will need to do that in damage and damage_old /* * Payoff for killing things. */ if ( victim->position == POS_DEAD ) { group_gain( ch, victim ); if ( !IS_NPC(victim) ) { sprintf( log_buf, "%s killed by %s at %d", victim->name, (IS_NPC(ch) ? ch->short_descr : ch->name), ch->in_room->vnum ); log_string( log_buf ); ********** Alright now in is_safe and is_safe_spell stick this if (IS_SET(ch->in_room->room_flags,ROOM_ARENA) && IS_SET(victim->in_room->room_flags,ROOM_ARENA)) { return FALSE; } ***********************[act_comm.c]************************* stick this in do quit if (IS_SET(ch->in_room->room_flags,ROOM_ARENA)) { send_to_char( "You may not leave while in the arena.\n\r", ch ); return; } Alright and that should be all just define the correct stuff in interp.c and interp.h and I think you should be set so thats all. Please mail me if you use this I wanna know who all would ever dare use something of mine :p heh anyways take care and have fun adios Faaen Just for the records I hate to censor Update on 28 Apr: ====================== add this to the top of fight.c bool arena_is_busy; -=[and then this to the top of update.c bool challenge_tme; bool is_challenge;