/* Arena Systems by spawn */ // fightarena and challenge spar/death arena #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "merc.h" // CHALLENGE ARENA BEGINS HERE void do_ainfo( CHAR_DATA *ch, char *argument ) { DESCRIPTOR_DATA *d; char buf[MAX_STRING_LENGTH]; if ( argument[0] == '\0' ) { return; } sprintf(buf, "#c[#Cx#c]#CARENA#c[#Cx#c] #n%s #c[#Cx#c]#CARENA#c[#Cx#c]#n\n\r", argument); for ( d = descriptor_list; d != NULL; d = d->next ) { if ( d->connected == CON_PLAYING && d->character != NULL && !IS_SET(d->character->deaf, CHANNEL_INFO) ) { send_to_char(buf, d->character); } } return; } bool in_fortress(CHAR_DATA *ch) { if (!ch->in_room) return FALSE; if (ch->in_room->vnum >= 50 && ch->in_room->vnum <= 53) return TRUE; return FALSE; } void arenacheck() { char buf[MSL]; CHAR_DATA *ch; CHAR_DATA *ch_next; if (arena_time > 0) { for (ch = char_list;ch != NULL;ch = ch_next) { ch_next = ch->next; if (in_fortress(ch) && !IS_NPC(ch)) { if (ch->challenger != NULL) ch->challenger = NULL; do_restore(ch,"self"); do_transfer(ch,"self 3054"); ch->fight_timer = 0; } } sprintf(buf,"Time Limit has been Reached. Arena Match Aborted!"); do_ainfo(NULL,buf); arena2 = TRUE; arena_time = 0; } return; } void do_clearchallenge(CHAR_DATA *ch, char *argument) { char buf[MSL]; if (!arena2) { stc("A challenge arena match has already started.\n\r",ch); return; } /* MAKE IT GLOBAL CLEAR CHALLENGE LIKE CLEARREPLY */ if (ch->challenger != NULL) ch->challenger = NULL; else { stc("You haven't even challenged anyone!\n\r",ch); return; } sprintf(buf,"%s cancels his challenge.",ch->name); do_ainfo(ch,buf); return; } void fortresskill(CHAR_DATA *ch, CHAR_DATA *victim) { char buf[MAX_STRING_LENGTH]; ROOM_INDEX_DATA *location; if (IS_NPC(ch) || IS_NPC(victim)) { bug("Challenge Arena failure", 0); return; } /* * cleanup */ ch->fight_timer = 0; victim->fight_timer = 0; // free_string(victim->morph); // victim->morph = str_dup(""); do_restore(ch, ch->name); do_restore(ch, victim->name); REMOVE_BIT(victim->extra, TIED_UP); REMOVE_BIT(victim->extra, GAGGED); REMOVE_BIT(victim->extra, BLINDFOLDED); /* * Tally the score */ ch->pcdata->awins++; victim->pcdata->alosses++; /* * Information */ sprintf(buf, "%s was beaten in The Arena by %s.", victim->name, ch->name); do_ainfo(ch, buf); /* * Out they go. */ if ((location = get_room_index(ROOM_VNUM_ALTAR)) == NULL) return; char_from_room(victim); char_to_room(victim, location); char_from_room(ch); char_to_room(ch, location); do_call(ch, "all"); do_call(victim, "all"); // do_clearstats(victim, ""); // victim->level = 2; ch->pcdata->safe_counter = 5; victim->pcdata->safe_counter = 5; /* * Open the Fortress */ arena2 = TRUE; return; } /* * The challenge system, uses specific vnums of rooms, so don't remove those. */ void do_challenge(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char arg[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; bool canfight; bool theycanfight; argument = one_argument(argument, arg); one_argument(argument, arg2); if (IS_NPC(ch)) return; if (ragnarok) { send_to_char("Not while ragnarok is running.\n\r",ch); return; } if (!IS_SET(ch->special, SPC_NOTNEWBIE) && !IS_NPC(ch)) { if ((get_age(ch)-17)*2<6) { send_to_char("You cannot challenge others till you have 6 hours.\n\r",ch); return; } } if (!TIME_UP(ch, TIMER_CHALLENGE)) { send_to_char("You can only use challenge once every 2 mud hours.\n\r", ch); return; } if (!arena2) { send_to_char("The Challenge Arena is currently being used by someone else.\n\r", ch); return; } if(ch->hit < ch->max_hit) { stc("You must be fully healed to fight in the arena.\n\r",ch); return; } if (arg[0] == '\0' || arg2[0] == '\0') { send_to_char("Syntax : Challenge <person> <death/spar>\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_NPC(victim)) { send_to_char("You can't challenge monsters.\n\r", ch); return; } if (!IS_SET(victim->special, SPC_NOTNEWBIE) && !IS_NPC(victim)) { if ((get_age(victim)-17)*2<6 && !IS_NPC(victim)) { send_to_char("You cannot challenge someone with less than 6 hours.\n\r",ch); return; } } if (ch->fight_timer > 0) { send_to_char("Not with a fight timer.\n\r", ch); return; } if (IS_SET(victim->extra,EXTRA_AFK)) { send_to_char("They are AFK!\n\r", ch); return; } if (victim->position != POS_STANDING) { send_to_char("They are not standing, you'll have to wait.\n\r", ch); return; } if(victim->hit < victim->max_hit) { stc("They must be fully healed to fight in the arena.\n\r",ch); return; } if (victim == ch) { send_to_char("Ehm, no.\n\r", ch); return; } if (victim->level != 3) { send_to_char("You can only challenge avatars.\n\r", ch); return; } if (victim == ch->challenger) { send_to_char("You have already challenged them.\n\r", ch); return; } if (!str_cmp(arg2, "death")) { canfight = fair_fight(ch,victim); if (!canfight) { stc("You are not within their status range.\n\r",ch); return; } theycanfight = fair_fight(victim,ch); if (!theycanfight) { stc("They are not within your status range.\n\r",ch); return; } ch->deathmatch = TRUE; } else if (!str_cmp(arg2, "spar")) ch->deathmatch = FALSE; else { do_challenge(ch, ""); return; } ch->challenger = victim; send_to_char("You challenge them.\n\r", ch); SET_TIMER(ch, TIMER_CHALLENGE, 2); if (ch->deathmatch) sprintf(buf, "You have been challenged to a #Gdeathmatch#n by %s. Type agree %s to start the fight.\n\r", ch->name, ch->name); else sprintf(buf, "You have been challenged to a #Gspar#n by %s. Type agree %s to start the fight.\n\r", ch->name, ch->name); send_to_char(buf, victim); if (ch->deathmatch) sprintf(buf,"%s has challenged %s to a #Gdeathmatch#n",ch->name,victim->name); else sprintf(buf,"%s has challenged %s to a #Gspar#n",ch->name,victim->name); do_ainfo(ch,buf); WAIT_STATE(ch, 8); return; } void do_decline(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char arg[MAX_INPUT_LENGTH]; char buf[MSL]; one_argument(argument, arg); if (IS_NPC(ch)) return; if (arg[0] == '\0') { send_to_char("Decline whom?\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_NPC(victim)) { send_to_char("You can't decline a monster, since it can't challenge you.\n\r", ch); return; } if (victim->challenger != ch) { send_to_char("They aren't challenging you.\n\r", ch); return; } victim->challenger = NULL; send_to_char("You decline their challenge.\n\r", ch); send_to_char("Your challenge has been declined.\n\r", victim); sprintf(buf,"%s has declined to the fight with %s.",ch->name,victim->name); do_ainfo(ch,buf); return; } void do_agree(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char arg[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; ROOM_INDEX_DATA *location; one_argument(argument, arg); if (IS_NPC(ch)) return; if (!arena2) { send_to_char("The Challenge Arena is currently being used by someone else.\n\r", ch); return; } if(ch->hit < ch->max_hit) { stc("You must be fully healed to fight in the arena.\n\r",ch); return; } if (arg[0] == '\0') { send_to_char("Agree who's challenge?\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_NPC(victim)) { send_to_char("You cannot accept a challenge from a monster.\n\r", ch); return; } if (victim->desc == NULL) { stc("They seem to be linkdead at the moment.\n\r",ch); return; } if (victim->challenger != ch) { send_to_char("You haven't been challenged by them.\n\r", ch); return; } if (victim->level != 3 && !IS_IMMORTAL(victim)) { send_to_char("They have to be avatar.\n\r", ch); return; } if(victim->hit < victim->max_hit) { stc("They must be fully healed to fight in the arena.\n\r",ch); return; } if (victim->fight_timer > 0) { send_to_char("They have a fighttimer currently, you'll have to wait.\n\r", ch); return; } if (ch->fight_timer > 0) { send_to_char("Not with a fight timer.\n\r", ch); return; } if (IS_SET(victim->extra,EXTRA_AFK)) { send_to_char("They are AFK!\n\r", ch); return; } if (victim->position != POS_STANDING) { send_to_char("They are not standing, you'll have to wait.\n\r", ch); return; } if (ch->in_room != NULL) { if (IS_SET(ch->in_room->room_flags, ROOM_ARENA) || IS_SET(ch->in_room->room_flags, ROOM_ASTRAL)) { send_to_char("This room is not connected to the astral sphere.\n\r",ch); return; } } if (victim->in_room != NULL) { if (IS_SET (victim->in_room->room_flags, ROOM_ARENA) || IS_SET(victim->in_room->room_flags, ROOM_ASTRAL)) { send_to_char("Their room is not connected to the astral sphere.\n\r",ch); return; } } if ((location = get_room_index((number_range(50,51)))) == NULL) { bug("Challenge arena Missing.", 0); return; } char_from_room(ch); char_to_room(ch, location); if ((location = get_room_index((number_range(52,53)))) == NULL) { bug("Challenge arena Missing.", 0); return; } char_from_room(victim); char_to_room(victim, location); do_restore(victim, victim->name); do_restore(ch, ch->name); if (!victim->deathmatch) sprintf(buf, "%s and %s enter #CThe Arena#n to test their skills", ch->name, victim->name); else sprintf(buf, "%s and %s enter #CThe Arena#n to duel for their lives", ch->name, victim->name); do_ainfo(ch, buf); arena2 = FALSE; if (victim->deathmatch) arena2death = TRUE; else arena2death = FALSE; victim->challenger = NULL; return; } void do_arenastats(CHAR_DATA *ch, char *argument) { char buf[MAX_STRING_LENGTH]; DESCRIPTOR_DATA *d; int hp_stats = 0; int mana_stats = 0; int move_stats = 0; if (IS_NPC(ch)) return; if (in_fortress(ch)) { send_to_char("Hehe.\n\r", ch); return; } send_to_char("#G Forbidden Fortress#n\n\r\n\r",ch); send_to_char("#RName Health Stamina Mana#n\n\r",ch); send_to_char("#0----------------------------------------------#n\n\r",ch); for ( d = descriptor_list; d != NULL; d = d->next ) { if (d->character != NULL) { if (d->character->in_room != NULL) { if (!in_fortress(d->character)) continue; if (d->character->max_hit > 0) hp_stats = 100 * d->character->hit / d->character->max_hit; if (d->character->max_move > 0) move_stats = 100 * d->character->move / d->character->max_move; if (d->character->max_mana > 0) mana_stats = 100 * d->character->mana / d->character->max_mana; sprintf(buf,"%-15s %3d/100 %3d/100 %3d/100\n\r", d->character->name, hp_stats, move_stats, mana_stats); send_to_char(buf,ch); } } } return; } // CHALLENGE ARENA ENDS HERE // FIGHTARENA STARTS HERE bool in_fightarena(CHAR_DATA *ch) { if (!ch->in_room) return FALSE; if (ch->in_room->vnum >= 100000 && ch->in_room->vnum <= 100021) return TRUE; return FALSE; } void do_fainfo( CHAR_DATA *ch, char *argument ) { DESCRIPTOR_DATA *d; if ( argument[0] == '\0' ) { return; } // if (!IS_NPC(ch) && IS_IMMORTAL(ch) && IS_SET(ch->act,PLR_WIZINVIS)) // Silent entering with wizinvis on. // return; for ( d = descriptor_list; d != NULL; d = d->next ) { if ( d->connected == CON_PLAYING && !IS_SET(d->character->deaf, CHANNEL_INFO) ) { // send_to_char( "#R-#yF#oi#yg#oh#yt #oA#yr#oe#yn#oa#n-#C ",d->character ); stc("#o(#n<>#0.#o|#0.#n<>#o) ",d->character); send_to_char( argument, d->character ); // send_to_char( " #R-#yF#oi#yg#oh#yt #oA#yr#oe#yn#oa#n-\n\r", d->character ); stc(" #o(#n<>#0.#o|#0.#n<>#o)#n\n\r",d->character); } } return; } //#define ARENA_PLAYERS 2 void do_fightarena( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; CHAR_DATA *mount; int location; // int arenapeople=0; // DESCRIPTOR_DATA *d; location = number_range(100000,100021); if (IS_NPC(ch)) return; if (ch->in_room != NULL) { if (IS_SET (ch->in_room->room_flags, ROOM_FARENA)) { send_to_char("You're already in the fightarena.\n\r",ch); return; } } if (ch->in_room != NULL) { if (IS_SET (ch->in_room->room_flags, ROOM_ARENA)) { send_to_char("You're in the challenge arena.\n\r",ch); return; } } /* for ( d = descriptor_list; d != NULL; d = d->next ) { if ( d->character != NULL ) { if (!d->connected == CON_PLAYING) continue; if (d->character->in_room != NULL) { if (IS_SET (d->character->in_room->room_flags, ROOM_FARENA)) arenapeople++; } } } if (arenapeople >= ARENA_PLAYERS) { send_to_char("Not while there is a current battle in the FightArena.\n\r",ch); return; } */ if (ragnarok) { send_to_char("Not while ragnarok is running.\n\r",ch); return; } if (ch->in_room != NULL) { if (IS_SET(ch->in_room->room_flags, ROOM_ARENA) || IS_SET(ch->in_room->room_flags, ROOM_ASTRAL)) { send_to_char("This room is not connected to the astral sphere.\n\r",ch); return; } } if(ch->hit < ch->max_hit || ch->mana < ch->max_mana ||ch->move < ch->max_move) { stc("You must be in perfect condition to fight in the arena.\n\r",ch); return; } if (ch->fight_timer > 0) { stc("You have a fight timer, get rid of it first.\n\r",ch); return; } char_from_room(ch); char_to_room(ch,get_room_index(location)); // sprintf(buf,"#C%s#0 !#n", ch->name); sprintf(buf,"#s%s #Ph#pa#Ps #Gen#gter#Ged #Rt#rh#Re #CFig#chtAr#Cena#n.",ch->name); do_fainfo(ch,buf); stc("#CPrepare yourself, tie your victim to win when they are morted!#n\n\r",ch); act( "$n appears in the room.", ch, NULL, NULL, TO_ROOM ); do_look( ch, "auto" ); if ( ( mount = ch->mount ) == NULL ) return; if (ch->mount != NULL) do_dismount(ch,""); return; } void do_leavearena( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; ROOM_INDEX_DATA *location; CHAR_DATA *mount; if (IS_NPC(ch)) return; if (ch->in_room != NULL) { if (!IS_SET (ch->in_room->room_flags, ROOM_FARENA)) { send_to_char("You aren't even in the fightarena.\n\r",ch); return; } } if (ch->fight_timer > 0) { stc("You can't leave with a fight timer!\n\r",ch); return; } location = get_room_index(3054); ch->hit = ch->max_hit; ch->mana = ch->max_mana; ch->move = ch->max_move; ch->fight_timer = 0; char_from_room(ch); char_to_room(ch, location); sprintf(buf,"#s%s #Ph#pa#Ps #Gle#gft #Rt#rh#Re #CFi#Cg#chtAr#Cena#n.",ch->name); do_fainfo(ch,buf); stc("You leave the FightArena!\n\r",ch); act( "$n appears in the room.", ch, NULL, NULL, TO_ROOM ); do_look( ch, "auto" ); do_call(ch, "all"); if ( ( mount = ch->mount ) == NULL ) return; do_dismount(ch,""); WAIT_STATE( ch, 18 ); return; } // FIGHTARENA ENDS HERE