<?
////////////////  BEBOT plugin ::Inits:: by NoGoal V1.06 ////////////// 
//
//V 1.06 by Nogoal
// Cosmetic changes
//
//V 1.05.1 by Nogoal
// Can now change color in game with '!color module init'
//
//V 1.05 by Nogoal
// Updated to 0.5
// Changed <font> tags for BeBot's color module
// Changed nano to ninit to avoid problems
//
//V 1.04 by Temar
// Updated to 0.4+
// Added !nanoinit as an Alterative if u use !nano already
// Droped 3 variable req down to 2 (ur skill isnt required)
//
//V 1.03 by Parfet
// Corrected copy/paste error in !init
//
//V 1.02 by Parfet
// Reworked !nano
//
// V 1.01 by Parfet
// Recoded to make it work with BEBOT
//
// V 1.0 by Nogoal
// First release with code redone for RINGBOT
//
///////////////

/*
Add a "_" at the beginning of the file (_Init.php) if you do not want it to be loaded.
*/

$init = new Init($bot);

/*
The Class itself...
*/
class Init extends BaseActiveModule
{
    var 
$bot;

    
/*
    Constructor:
    Hands over a referance to the "Bot" class.
    */
    
function __construct (&$bot)
    {
        
parent::__construct(&$botget_class($this));
        
        
//Register commands
        
$this -> bot = &$bot;
        
        
$this -> register_command('tell''init''GUEST');
        
$this -> register_command('gc''init''GUEST');
        
$this -> register_command('pgmsg''init''GUEST');
        
        
$this -> register_command('tell''ninit''GUEST');
        
$this -> register_command('gc''ninit''GUEST');
        
$this -> register_command('pgmsg''ninit''GUEST');
        
        
$this -> register_command('tell''as''GUEST');
        
$this -> register_command('gc''as''GUEST');
        
$this -> register_command('pgmsg''as''GUEST');
        
        
$this -> bot -> core("colors") -> define_scheme("init""sub""bluegray");
        
         
$this -> help['description'] = 'Inits/AS Calculator - BEBOT Plugin - Version 1.06';
        
$this -> help['command']['init <attack> <recharge> <Init>']="Shows Weapon Info Based on the Stats you give.";
        
$this -> help['command']['ninit <attack> <recharge> <Init>']="Shows Nanocasting Info Based on the Stats you give.";
        
$this -> help['command']['as <attack> <recharge> <AS Skill>']="Shows Aim Shot Info Based on the Stats you give.";
         
$this -> help['notes'] = 'the Skill Requirement is Optional';
    }

    
/*
    This gets called on private channel with the command
    */
    
function command_handler($name$msg$origin)
    {
        
$vars explode(' '$msg);

        
$ver explode("."$this -> bot -> botversion);
        if(
$ver[1] < 5)
        {
            if (!empty(
$this -> bot -> commpre))
            {
                
$vars[0] = substr($vars[0], 1);
            }
        }

        if(
count($vars) > 4)
            
$msg "##error##Error: Too Many Variables Given##end##";
        elseif(
count($vars) < 3)
            
$msg "##error##Error: Not enough Variables Given##end##";
        else
            Switch(
strtolower($vars[0]))
            {
                case
'init':
                    
$msg $this -> init_blob($vars[1], $vars[2], $vars[3]);
                    break;
                case
'ninit':
                    
$msg $this -> nano_blob($vars[1], $vars[2], $vars[3]);
                    break;
                case
'as':
                    
$msg $this -> as_blob($vars[1], $vars[2], $vars[3]);
                    break;
                Default:
                    
$msg "##error##Error : Broken plugin, recieved unhandled command: ".$vars[0]."##end##";
            }
        
        
$this -> bot -> send_output($name$msg$origin);
    }

    
/*
    Makes the init-blob
    */
    
function init_blob($AttTim,$RechT,$InitS) {
    
    if( 
$InitS 1200 
    {
    
$AttCalc    round(((($AttTim - ($InitS 600)) - 1)/0.02) + 87.50);
    
$RechCalc    round(((($RechT - ($InitS 300)) - 1)/0.02) + 87.50);
    }
    else 
    {
    
$InitSk $InitS 1200;
    
$AttCalc round(((($AttTim - (1200/600) - ($InitSk 600 3)) - 1)/0.02) + 87.50);
    
$RechCalc round(((($RechT - (1200/300) - ($InitSk 300 3)) - 1)/0.02) + 87.50);
    }

    if( 
$AttCalc $RechCalc $InitResult $RechCalc;
    else { 
$InitResult $AttCalc; }
    if( 
$InitResult $InitResult 0;
    if( 
$InitResult 100 $InitResult 100;
    
    
$Initatta1 round((((100 87.5) * 0.02) + $AttTim) * (-600),0);
    
$Initrech1 round((((100-87.5)*0.02)+1-$RechT)*(-300),0);
    if(
$Initatta1 1200) { $Initatta1 round((((((100-87.5)*0.02)+1-$AttTim+2)*(-1800)))+1200,0); }
    if(
$Initrech1 1200) { $Initrech1 round((((((100-87.5)*0.02)+1-$RechT+4)*(-900)))+1200,0); }
    if( 
$Initatta1 $Initrech1 $Init1 $Initrech1;
    else { 
$Init1 $Initatta1; }
    
    
$Initatta2 round((((0-87.5)*0.02)+1-$AttTim)*(-600),0);
    
$Initrech2 round((((0-87.5)*0.02)+1-$RechT)*(-300),0);
    if(
$Initatta2 1200) { $Initatta2 round((((((0-87.5)*0.02)+1-$AttTim+2)*(-1800)))+1200,0); }
    if(
$Initrech2 1200) { $Initrech2 round((((((0-87.5)*0.02)+1-$RechT+4)*(-900)))+1200,0); }
    if( 
$Initatta2 $Initrech2 $Init2 $Initrech2;
    else { 
$Init2 $Initatta2; }
        
    
$inside  "##blob_title##::: Weapons Inits Calculator - Version 1.06 :::##end##\n\n";
    
$inside    .= "##init_sub##Attack:##end## ##highlight##"$AttTim ."##end## ##blob_text##second(s).##end##\n";
    
$inside    .= "##init_sub##Recharge:##end## ##highlight##"$RechT ."##end## ##blob_text##second(s).##end##\n";
    
$inside    .= "##init_sub##Init Skill:##end## ##highlight##"$InitS ."##end##\n";
    
$inside    .= "##init_sub##Best bar position:##end## ##highlight##"$InitResult ."% ("round($InitResult*8/100,2) .")##end##\n";
    
$inside    .= "##init_sub##Inits needed for 1/1 speed:##end##\n\n";
    
$inside .= "##init_sub##- Full Agg:##end## ##highlight##"$Init1 ."##end## ##blob_text##inits.##end##\n";
    
$inside    .= "##init_sub##- Full Def:##end## ##highlight##"$Init2 ."##end## ##blob_text##inits.##end##\n";     

    return 
$this -> bot -> core("tools") -> make_blob("AGG/DEF :: Click for results"$inside);
    }

    
/*
    Makes the nano-blob
    */
    
function nano_blob($AttTim,$RechT,$InitS) {

        if( 
$InitS 1200 )
        {
        
$AttCalc        round(((($AttTim - ($InitS 200)) )/0.02) + 500);
        
$RechCalc       $RechT;
        }
        else
        {
        
$InitSk $InitS 1200;
        
$AttCalc round(((($AttTim - (1200/200) - ($InitSk 200 3)))/0.02) + 500);
        
$RechCalc $RechT;
        }

        
$InitResult $AttCalc;
        if( 
$InitResult $InitResult 0;
        if( 
$InitResult 100 $InitResult 100;

        
$Initatta1 round((((100 50) * 0.02) - $AttTim) * (-200),0);
        
$Initrech1 $RechT;
        if(
$Initatta1 1200) { $Initatta1 round((((((100-50)*0.02)-$AttTim+6)*(-600)))+1200,0); }
        
$Init1 $Initatta1;

        
$Initatta2 round((((0-50)*0.02)-$AttTim)*(-200),0);
        
$Initrech2 $RechT;
        if(
$Initatta2 1200) { $Initatta2 round((((((0-50)*0.02)-$AttTim+6)*(-600)))+1200,0); }
        
$Init2 $Initatta2;
    
        
$inside  "##blob_title##::: Nano Init Calculator - Version 1.06 :::##end##\n\n";
        
$inside    .= "##init_sub##Attack:##end## ##highlight##"$AttTim ."##end## ##blob_text##second(s).##end##\n";
        
$inside    .= "##init_sub##Recharge:##end## ##highlight##"$RechT ."##end## ##blob_text##second(s).##end##\n";
        
$inside    .= "##init_sub##Init Skill:##end## ##highlight##"$InitS ."##end##\n";
        
$inside    .= "##init_sub##Def/Agg:##end## ##highlight##"$InitResult ."%##end##\n";
        
$inside    .= "##blob_text##Best bar position:##end## ##highlight##"$InitResult ."% ("round($InitResult*8/100,2) .")##end##\n";
        
$inside    .= "##init_sub##Inits needed for 1/1 speed:##end##\n\n";
        
$inside    .= "##init_sub##- Full Agg:##end## ##highlight##"$Init1 ."##end## ##blob_text##inits.##end##\n";
        
$inside    .= "##init_sub##- Full Def:##end## ##highlight##"$Init2 ."##end## ##blob_text##inits.##end##\n";     

        return 
$this -> bot -> core("tools") -> make_blob("Nano AGG/DEF :: Click for results"$inside);
    }
        
    
/*
    Makes the AS-blob
    */
    
function as_blob($AttTim,$RechT,$ASS) {
    
$capped round($RechT+10,1);
    
$ASRech    round(($RechT*40)-($ASS*3)/1001);
    if(
$ASRech $capped) { $ASRech round($RechT+10,1); }
    
$MultiP    round($ASS/95,0);
    
$ASCap = (-10+(39*$RechT))*100/3;

    
$inside  "##blob_title##::: AS Calculator - Version 1.06 :::##end##\n\n";
    
$inside    .= "##init_sub##Attack:##end## ##highlight##"$AttTim ."##end## ##blob_text##second(s).##end##\n";
    
$inside    .= "##init_sub##Recharge:##end## ##highlight##"$RechT ."##end## ##blob_text##second(s).##end##\n";
    
$inside    .= "##init_sub##AS Skill:##end## ##highlight##"$ASS ."##end##\n";
    
$inside    .= "##init_sub##AS Multiplier:##end## ##highlight##1-"$MultiP ."x##end##\n";
    
$inside    .= "##init_sub##AS Recharge:##end## ##highlight##"$ASRech ."##end##\n";
    
$inside    .= "##init_sub##AS Skill needed to cap:##end## ##highlight##"round($ASCap,0) ."##end## ##blob_text##for##end## ##highlight##"round($RechT+10,1) ."##end####blob_text##s.##end##\n\n";
    
$inside .= "##init_sub##Specials Refresh Formulae:##end## ##blob_text##(<a href='chatcmd:///start http://forums.anarchy-online.com/showthread.php?t=99162'>Main Source</a> by SirAronar)\n
Brawl = 15s
Burst = (Recharge x 20) + Burst Delay/100* - Burst skill/25)
Dimach = 1800s
Fast Attack = (Attack x 16) - Fast skill/100
Fling Shot = (Attack x 16) - Fling skill/100
Full Auto = (Recharge x 40) + Full Auto Delay/100* - FA skill/25
Sneak Attack = 40s
Backstab = 40 - Sneak Attack skill/75

                * Those values can be found on auno.org##end##"
;

    return 
$this -> bot -> core("tools") -> make_blob("AS Calculator :: Click for results"$inside);
    }

}
?>