L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 04, 2008, 01:36:45 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Module Requests > Topic: trickle module
Pages: [1]   Go Down
« previous next »
Print
Author Topic: trickle module  (Read 798 times)
0 Members and 1 Guest are viewing this topic.
MagZu
Freshman
*
Offline Offline

Posts: 2


trickle module
« on: February 26, 2008, 11:42:16 AM »

can anyone here help me get this module http://bebot.shadow-realm.org/index.php/topic,615.0.html  to work with the verson 0.4.2? this is a such a nice module that i have been wanting to get to work for a long time now

Edit: wops i have verson 0.4.2 not 0.4.3 sorry
« Last Edit: February 26, 2008, 02:39:34 PM by MagZu » Logged
Tichy
Rookie
**
Offline Offline

Posts: 42



Re: trickle module
« Reply #1 on: February 27, 2008, 05:27:17 PM »

Nice module... I've just ported it to 0.4.3.
Logged
MagZu
Freshman
*
Offline Offline

Posts: 2


Re: trickle module
« Reply #2 on: February 27, 2008, 11:59:52 PM »

yay thanks alot!
Logged
Blueeagle
Omnipotent
BeBot Developer
Expert
********
Offline Offline

Gender: Male
Posts: 313



Re: trickle module
« Reply #3 on: February 28, 2008, 04:39:14 AM »

That module was an ugly mess so I cleaned it up for you all.

Cut it down from 463 lines to 210 lines.

Code:
<?php

/*
Trickle.php
Version 1.2
Author: Shrike, AKA Briwn (RK1 Engineer)
Cleaned up by Terje AKA Blueeagl3(RK1)
For: Bebot (tested on version 0.4.3-svn)
*/

$trickle = new Trickle($bot);

$commands["gc"]["trickle"] = &$trickle;
$commands["tell"]["trickle"] = &$trickle;
$commands["pgmsg"]["trickle"] = &$trickle;

class 
Trickle
{
var $bot;
var $skill;
var $help;

function Trickle(&$bot)
{
$this -> bot = &$bot;

$this -> bot -> accesscontrol -> create('tell', 'trickle', 'GUEST');
$this -> bot -> accesscontrol -> create('gc', 'trickle', 'GUEST');
$this -> bot -> accesscontrol -> create('pgmsg', 'trickle', 'GUEST');

$this -> help['command']['trickle [sta <num>] [agi <num>] [int <num>] [sen <num>] [str <num>] [psy <num>]'] = 'Will show the amount of skill you gain by increasing the base abilities.';

//Set up the data
$this->skill['Nano skills']['TS']=array('agi'=>0.2, 'int'=>0.8);
$this->skill['Nano skills']['MC']=array('sta'=>0.2, 'int'=>0.8);
$this->skill['Nano skills']['BioMet']=array('psy'=>0.2, 'int'=>0.80);
$this->skill['Nano skills']['MatMet']=array('psy'=>0.2, 'int'=>0.80);
$this->skill['Nano skills']['PsyMod']=array('sen'=>0.2, 'int'=>0.80);
$this->skill['Nano skills']['SI']=array('str'=>0.20, 'int'=>0.80);
$this->skill['Aiding']['First aid']=array('agi'=>0.30, 'int'=>0.30, 'sen'=>0.40);
$this->skill['Aiding']['Treatment']=array('agi'=>0.30, 'int'=>0.50, 'sen'=>0.20);
$this->skill['Body']['Body dev']=array('sta'=>1.00);
$this->skill['Body']['Nano pool']=array('psy'=>0.70, 'sen'=>0.10, 'int'=>0.10, 'sta'=>0.10);
$this->skill['Body']['Martial arts']=array('agi'=>0.50, 'psy'=>0.30, 'str'=>0.20);
$this->skill['Body']['Brawling']=array('str'=>0.60, 'sta'=>0.40);
$this->skill['Body']['Riposte']=array('sen'=>0.50, 'agi'=>0.50);
$this->skill['Body']['Dimach']=array('sen'=>0.8, 'psy'=>0.20);
$this->skill['Body']['Adventuring']=array('str'=>0.20, 'agi'=>0.50, 'sta'=>0.30);
$this->skill['Body']['Swimming']=array('str'=>0.20, 'agi'=>0.20, 'sta'=>0.60);
$this->skill['Melee']['1h Blunt']=array('str'=>0.50, 'agi'=>0.10, 'sta'=>0.40);
$this->skill['Melee']['2h Blunt']=array('str'=>0.50, 'sta'=>0.50);
$this->skill['Melee']['1h Edged']=array('str'=>0.30, 'agi'=>0.40, 'sta'=>0.30);
$this->skill['Melee']['2h Edged']=array('str'=>0.60, 'sta'=>0.40);
$this->skill['Melee']['Piercing']=array('str'=>0.20, 'agi'=>0.50, 'sta'=>0.30);
$this->skill['Melee']['Melee Energy']=array('int'=>0.50, 'sta'=>0.50);
$this->skill['Melee']['Parry']=array('str'=>0.50, 'agi'=>0.20, 'sen'=>0.30);
$this->skill['Melee']['Sneak attack']=array('sen'=>0.80, 'psy'=>0.20);
$this->skill['Melee']['Fast attack']=array('agi'=>0.60, 'sen'=>0.40);
$this->skill['Melee']['Multi melee']=array('str'=>0.30, 'agi'=>0.60, 'sta'=>0.10);
$this->skill['Misc weapons']['Sharp objects']=array('str'=> 0.20, 'agi'=>0.60, 'sen'=>0.20);
$this->skill['Misc weapons']['Grenade']=array('sen'=>0.40, 'agi'=>0.40, 'int'=>0.20);
$this->skill['Misc weapons']['Heavy weapons']=array('str'=>0.40, 'agi'=>0.60);
$this->skill['Ranged']['Bow']=array('sen'=>.4, 'agi'=>.4, 'str'=>.2);
$this->skill['Ranged']['Pistol']=array('sen'=>.4, 'agi'=>.6);
$this->skill['Ranged']['Assault rifle']=array('sen'=>.2, 'agi'=>.3, 'sta'=>.4, 'str'=>.1);
$this->skill['Ranged']['MG/SMG']=array('sen'=>.1, 'sta'=>.3, 'str'=>.3, 'agi'=>.3);
$this->skill['Ranged']['Shotgun']=array('str'=>.4, 'agi'=>.6);
$this->skill['Ranged']['Rifle']=array('sen'=>.4, 'agi'=>.6);
$this->skill['Ranged']['Ranged energy']=array('sen'=>.4, 'psy'=>.4, 'int'=>.2);
$this->skill['Ranged']['Fling shot']=array('agi'=>1);
$this->skill['Ranged']['Aimed shot']=array('sen'=>1);
$this->skill['Ranged']['Burst']=array('agi'=>.5, 'str'=>.3, 'sta'=>.2);
$this->skill['Ranged']['Full auto']=array('sta'=>.4, 'str'=>.6);
$this->skill['Ranged']['Bow special']=array('sen'=>.4, 'agi'=>.5, 'str'=>.1);
$this->skill['Ranged']['Multi ranged']=array('agi'=>.6, 'int'=>.4);
$this->skill['Spying']['Concealment']=array('agi'=>.3, 'sen'=>.7);
$this->skill['Spying']['Break & enter']=array('agi'=>.4, 'sen'=>.3, 'psy'=>.3);
$this->skill['Spying']['Trap disarm']=array('sen'=>.6, 'int'=>.2, 'agi'=>.2);
$this->skill['Spying']['Perception']=array('int'=>.3, 'sen'=>.7);
$this->skill['Navigation']['Vehicle air']=array('sen'=>.6, 'int'=>.2, 'agi'=>.2);
$this->skill['Navigation']['Vehicle ground']=array('sen'=>.6, 'int'=>.2, 'agi'=>.2);
$this->skill['Navigation']['Vehicle water']=array('sen'=>.6, 'int'=>.2, 'agi'=>.2);
$this->skill['Navigation']['Map navigation']=array('sen'=>.5, 'int'=>.4, 'psy'=>.10);
$this->skill['Trade & Repair']['Mech engi']=array('int'=>.5, 'agi'=>.5);
$this->skill['Trade & Repair']['Electric engi']=array('int'=>.5, 'agi'=>.3, 'sta'=>.2);
$this->skill['Trade & Repair']['Quantum FT']=array('int'=>.5, 'psy'=>.5);
$this->skill['Trade & Repair']['Weapon smith']=array('int'=>.5, 'str'=>.5);
$this->skill['Trade & Repair']['Pharma tech']=array('int'=>.8, 'agi'=>.2);
$this->skill['Trade & Repair']['Nano prog']=array('int'=>1);
$this->skill['Trade & Repair']['Comp lit']=array('int'=>1);
$this->skill['Trade & Repair']['Psychology']=array('int'=>.5, 'sen'=>.5);
$this->skill['Trade & Repair']['Chemistry']=array('int'=>.5, 'sta'=>.5);
$this->skill['Trade & Repair']['Tutoring']=array('int'=>.7, 'sen'=>.2, 'psy'=>.1);
}

function tell($name, $msg)
{
$reply = $this -> command_handler($name, $msg, "tell");
if ($reply !== FALSE)
$this -> bot -> send_tell($name, "##normal## $reply ##end##");
}

function gc($name, $msg)
{
$reply = $this -> command_handler($name, $msg, "gc");
if ($reply !== FALSE)
$this -> bot -> send_gc("##normal## $reply ##end##");
}

function pgmsg($name, $msg)
{
$reply = $this -> command_handler($name, $msg, "pgmsg");
if ($reply !== FALSE)
$this -> bot -> send_pgroup("##normal## $reply ##end##");
}

function parse_com($command, $pattern = array('com', 'sub', 'args'))
{
$num_pieces=count($pattern);
$num_com=count(explode(' ', $command));
$pieces = explode(' ', $command, $num_pieces);
$com = array_combine(array_slice($pattern, 0, $num_com), $pieces);
return ($com);
}

function command_handler($source, $msg, $type)
{
$msg = strtolower($msg);
$com = $this->parse_com($msg, array('com', 'stat1', 'val1', 'stat2', 'val2', 'stat3', 'val3', 'stat4', 'val4', 'stat5', 'val5', 'stat6', 'val6', ));
if(empty($com['stat1']))
{
return('##error##You need to specify which stats to trickle from.##end##');
}
$stats=array('str', 'sta', 'sen', 'agi', 'int', 'psy');
if((!in_array($com['stat1'], $stats))&&(!empty($com['stat1'])))
return("##error##{$com['stat1']} is not a recognized base stat.##end##");
if((!in_array($com['stat2'], $stats))&&(!empty($com['stat2'])))
return("##error##{$com['stat2']} is not a recognized base stat.##end##");
if((!in_array($com['stat3'], $stats))&&(!empty($com['stat3'])))
return("##error##{$com['stat3']} is not a recognized base stat.##end##");
if((!in_array($com['stat4'], $stats))&&(!empty($com['stat4'])))
return("##error##{$com['stat4']} is not a recognized base stat.##end##");
if((!in_array($com['stat5'], $stats))&&(!empty($com['stat5'])))
return("##error##{$com['stat5']} is not a recognized base stat.##end##");
if((!in_array($com['stat6'], $stats))&&(!empty($com['stat6'])))
return("##error##{$com['stat6']} is not a recognized base stat.##end##");

if((!empty($com['stat1']))&&(!empty($com['val1'])))
$stats[$com['stat1']]=$com['val1'];
if((!empty($com['stat2']))&&(!empty($com['val2'])))
$stats[$com['stat2']]=$com['val2'];
if((!empty($com['stat3']))&&(!empty($com['val3'])))
$stats[$com['stat3']]=$com['val3'];
if((!empty($com['stat4']))&&(!empty($com['val4'])))
$stats[$com['stat4']]=$com['val4'];
if((!empty($com['stat5']))&&(!empty($com['val5'])))
$stats[$com['stat5']]=$com['val5'];
if((!empty($com['stat6']))&&(!empty($com['val6'])))
$stats[$com['stat6']]=$com['val6'];

$trickle = $this -> Calc_trickle($stats);
return($this->CreateBlob($stats, $trickle));
}

function Calc_trickle($upgrade)
{
foreach($this->skill as $group_name=>$group)
{
foreach($group as $item_name=>$item)
{
foreach($item as $stat=>$factor)
{
$increase[$group_name][$item_name]+=($upgrade[$stat]/4)*$factor;
}
}
}
return($increase);
}

function CreateBlob($stats, $trickle)
{
$msg = "##ao_infoheadline##::: Ability Trickle-down :::##end##\n\n";
$msg2 = "";
if ($stats['int'] > 0)
$msg2 .= "##ao_infotext## - Intelligence: ##end##{$stats['int']}\n";
if ($stats['sta'] > 0)
$msg2 .= "##ao_infotext## - Stamina: ##end##{$stats['sta']}\n";
if ($stats['agi'] > 0)
$msg2 .= "##ao_infotext## - Agility: ##end##{$stats['agi']}\n";
if ($stats['sen'] > 0)
$msg2