/*Quad Damage By Dazzle(Darien) of Sandstorm. -- Derived from the Double Exp system.
 *Double Exp   -- Unknown Creator  -- Trying to find creator
 *Double Qp    -- Derived from the double-exp system.
 *I think this is just about everything.  You'll have to add the interp.c/interp.h calls yourself
 *but this should be everything required, if not, log into sandstorm.kicks-ass.org port 6969
 *and tell me your problem, and i will be more then happy to help you out :)
 *For those people that i don't know who released this code, i'm sorry, i'm scrounging through
 *all the code i can find on double-xp to see what match's.  But thanks :)
 *
 *Please, enjoy the code everyone, and remember, keep the muds alive, and donate code :)
 *
 *Coders like myself appreciate all other coders whom have released their code.
 *thanks always go out to Samson of Alsherok, and Zarius of Mindcloud.  And many, many more
 *Implementors out there, theres just too many to mention.  But thanks to you all :)
 */

in merc.h add this somewhere that you keep variable like this.
extern          bool    		double_xp;
extern          int                     global_exp;     
extern          int                     global_qp;     
extern		int     		global_quad;
extern          bool                    double_qp;
extern          bool                    quad_damage;
extern          sh_int                  display;
extern          sh_int                  qpdisplay;

/*If you don't have this, or a variation of this, add this.*/
#define ACMD(name) 		void name(CHAR_DATA *ch, char *argument)


in fight.c add this to beggining part of fight.c
bool quad_damage;
bool    double_exp = FALSE;
bool double_qp = FALSE;

in fight.c add this to damage

    if(IS_NPC(victim) && !IS_NPC(ch) && quad_damage)
	dam = dam *4;

in group_gain add this.
		      xp = xp*2;

in act_wiz.c add this at the bottom.

void do_doublexp( CHAR_DATA *ch, char *argument )
{
    char arg[MIL];
    char arg1[MIL];
    char buf[MSL];
    int amount;

    argument = one_argument( argument, arg );
    one_argument( argument, arg1 ); 

    if ( arg[0] == '\0' )
    {
        send_to_char("Syntax: double <on|off> ticks.\n\r",ch);
        return;
    }
    
    if (!str_cmp(arg, "on"))
    {
        if ( arg1[0] == '\0' || !is_number( arg1 ) )
        {
            send_to_char("You need to apply the number of ticks.\n\r", ch );
            return;
        }

        if (double_exp)
        {
            send_to_char("Double exp is already in affect!\n\r",ch);
            return;
        }
    
        amount = atoi( arg1 );

        if ( amount < 0 || amount > 500 )
        {
            send_to_char( "Please choose an amount between 0 and 500.\n\r", ch );
            return;
        }
 
        global_exp = amount;
        double_exp = TRUE;
        xprintf(buf,"{R%s has declared %d ticks of double exp for everyone!{x\n\r", ch->name, amount );
	announce(NULL,buf);
        send_to_char("Double exp is now in affect!\n\r",ch);
        return;
    }                
 
    if (!str_cmp(arg, "off"))
    {
        if (!double_exp)
        {
            send_to_char("Double exp is not on please turn it on first!\n\r",ch);
            return;
        }
        double_exp = FALSE;
        global_exp = 0;
        xprintf(buf,"{R%s has removed double experience!{x\n\r", ch->name );
	announce(NULL,buf);
        send_to_char( "You have turned off double exp!\n\r", ch );
        return;             
    }
}

ACMD ( do_doubleqp )
{
    char arg[MIL];
    char arg1[MIL];
    char buf[MSL];
    int amount;

    argument = one_argument( argument, arg );
    one_argument( argument, arg1 ); 

    if ( ( arg[0] == '\0' ) )
    {
        if ( !double_qp )
        {
            send_to_char ( "Syntax: double <on|off> ticks.\n\r", ch );
            return;
        }
    }

    if ( !str_cmp ( arg, "on" ) )
    {
        if ( double_qp )
        {
            send_to_char ( "Double QP is already in affect!\n\r", ch );
            return;
        }

        amount = atoi( arg1 );

        if ( amount < 0 || amount > 500 )
        {
            send_to_char( "Please choose an amount between 0 and 500.\n\r", ch );
            return;
        }
 
        global_qp = amount;
        double_qp = TRUE;
        xprintf(buf,"{R%s has declared %d ticks of double qp for everyone!{x\n\r", ch->name, amount );
	announce(NULL,buf);
        send_to_char ( "Double QP is now in affect!\n\r", ch );
        return;
    }
    if ( !str_cmp ( arg, "off" ) )
    {
        if ( !double_qp )
        {
            send_to_char ( "The global QP flag isn't on!.\n\r", ch );
            return;
        }
        double_qp = FALSE;
        global_qp = 0;
        xprintf(buf,"{R%s has removed double qp!{x\n\r", ch->name );
	announce(NULL,buf);
        return;
    }
}

ACMD ( do_quad_damage )
{
    char arg[MIL];
    char arg1[MIL];
    char buf[MSL];
    int amount;

    argument = one_argument( argument, arg );
    one_argument( argument, arg1 ); 

    if ( ( arg[0] == '\0' ) )
    {
        if ( !quad_damage )
        {
            send_to_char ( "Syntax: quaddamage <on|off> ticks.\n\r", ch );
            return;
        }
    }

    if ( !str_cmp ( arg, "on" ) )
    {
        if ( quad_damage )
        {
            send_to_char ( "Quad Damage is already in affect!\n\r", ch );
            return;
        }

        amount = atoi( arg1 );

        if ( amount < 0 || amount > 30 )
        {
            send_to_char( "Please choose an amount between 0 and 30.\n\r", ch );
            return;
        }
 
        global_quad = amount;
        quad_damage = TRUE;
        xprintf(buf,"{R%s has declared %d ticks of Quad Damage for everyone!{x\n\r", ch->name, amount );
	announce(NULL,buf);
        send_to_char ( "Quad Damage is now in affect!\n\r", ch );
        return;
    }
    if ( !str_cmp ( arg, "off" ) )
    {
        if ( !quad_damage )
        {
            send_to_char ( "The Quad Damage flag isn't on!.\n\r", ch );
            return;
        }
        quad_damage = FALSE;
        global_quad = 0;
        xprintf(buf,"{R%s has removed Quad Damage!{x\n\r", ch->name );
	announce(NULL,buf);
        return;
    }
}


in Update.c add the following
int     global_exp;      
sh_int  display;
int     global_qp;      
sh_int  qpdisplay;
sh_int  quaddisplay;
int     global_quad;

then add this

void update_bonuses()
{
        if ( global_exp-- > 0)
        {

	        display++;

 	       if ( display >= 5 )
	        {
		    char theBuf[MSL];
		    xprintf(theBuf, "{BThere are {Y%d{B ticks of {`d{`o{`u{`bl{`e {`e{`x{`p{B left.{x\n\r", global_exp );
		    announce(NULL,theBuf);
	            display = 0;
	        }

	        if (global_exp == 0)
	        {
	            announce(NULL, "{BDouble exp has run out! {R:({x\n\r" );
	            double_exp = FALSE;
	        }
	     }

        if ( global_qp-- > 0)
        {

	        qpdisplay++;

 	       if ( qpdisplay >= 5 )
	        {
		    char theBuf[MSL];
		    xprintf(theBuf, "{BThere are {Y%d{B ticks of {`d{`o{`u{`b{`l{`e {`q{`p {Bleft.{x\n\r", global_qp );
		    announce(NULL,theBuf);
	            qpdisplay = 0;
	        }

	        if (global_qp == 0)
	        {
	            announce(NULL, "{BDouble qp has run out! {R:({x\n\r" );
	            double_qp = FALSE;
	        }
	     }

        if ( global_quad-- > 0)
        {

	        quaddisplay++;

 	       if ( quaddisplay >= 5 )
	        {
		    char theBuf[MSL];
		    xprintf(theBuf, "{BThere are {Y%d{B ticks of {RQ{rU{RA{rD {rD{DA{rM{DA{rG{DE{B left.{x\n\r", global_quad );
		    announce(NULL,theBuf);
	            qpdisplay = 0;
	        }

	        if (global_quad == 0)
	        {
	            announce(NULL, "{B{RQ{rU{RA{rD {rD{DA{rM{DA{rG{DE{B has run out! {R:({x\n\r" );
	            quad_damage = FALSE;
	        }
         }

}

in update_handler add this in the pulse_point section.

       /* Note this makes use of the announce so if you don't have it 
        * change this to your global channel. 
        */ 
	update_bonuses();