Hello im trying to update this old module i had from other bot and needed some help. The module responds but no output is shown so not sure if the results are coming out right. Any help would be great thanks. Im still new to the bot so getting more use to how it works.
$impql = new Impql($bot);
$commands["tell"]["impql"] = &$impql;
$commands["pgmsg"]["impql"] = &$impql;
$commands["gc"]["impql"] = &$impql;
/*
The Class itself...
*/
class Impql
{
var $bot;
/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Impql (&$bot)
{
$this -> bot = &$bot;
$this -> bot -> accesscontrol -> create('all', 'impql', 'GUEST');
$this -> help['description'] = "Performs implant skill calculation";
$this -> help['command']['impql <expression>'] = "Shows the result of the matematical <expression>";
}
/*
This gets called on a tell with the command
*/
function tell($name, $msg)
{
if (preg_match("/^".$this -> bot -> commpre. "impql ([0-9]+)/i", $msg, $info))
$this -> bot -> send_tell($name, $this -> do_impql($info[1]));
else
$this -> bot -> send_help($name);
}
/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "impql (.+)/i", $msg, $info))
$this -> bot -> send_pgroup($this -> do_impql($info[1]));
}
/*
This gets called on a msg in the guildchat with the command
*/
function gc($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "impql (.+)/i", $msg, $info))
$this -> bot -> send_gc($this -> do_impql($info[1]));
}
/*
This calculates the implant quality level
*/
function do_impql($impql)
{
if(preg_match("/^impql ([0-9]+)$/i", $message, $arr)) {
if($arr[1] <= 220) {
$ql = $arr[1];
$ability = ($ql * 2) + 4;
$treatment = (($ql/10) * 47) + 7;
if($ql > 50)
{
$treatment = $treatment + 1;
}
if($ql > 70)
{
$treatment = $treatment + 1;
}
if($ql > 130)
{
$treatment = $treatment + 1;
}
if($ql > 170)
{
$treatment = $treatment + 1;
}
if($ql > 200)
{
$ability = $ability + 20;
$treatment = $treatment + 50;
}
if($ql > 205)
{
$ability = $ability + 40;
$treatment = $treatment + 50;
}
if($ql > 219)
{
$ability = $ability + 50;
$treatment = $treatment + 55;
}
return "A QL <font color=#ffff00>" .$ql. "</font> implant will require a skill of <font color=#ffff00>" .$ability. "</font> in an ability and a skill of <font color=#ffff00>" .$treatment. "</font> in treatment.";
}
}
}
}
?>