BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: pksiazek on January 24, 2007, 11:02:27 pm

Title: Research plugin
Post by: pksiazek on January 24, 2007, 11:02:27 pm
Couldn't find anything similar, so wrote my own  :).

This plugin show extendend information about research. Example output is:

"Research level 9 needs 740,000 SK. Max SK located into research from single kill is 37,000 SK. You must be at least level 190 to get this research level."

Any comments are welcome.
Title: Re: Research plugin
Post by: pusikas on January 25, 2007, 12:12:05 am
http://bebot.link/index.php/topic,580.0.html (http://bebot.link/index.php/topic,580.0.html)

:)

Your module is a tad more verbose, tho.
Title: Re: Research plugin
Post by: Wolfbiter on January 25, 2007, 02:23:36 pm
I'll look into this script after work and if it looks good, I'll remove research from my module because, well.. I never really finished that part or made sure the numbers were correct.
Title: Re: Research plugin
Post by: Malosar on January 25, 2007, 02:58:30 pm
Level already includes req levels after I modified it and I also added in caps awhile ago as well. Files attached.

Any bugs or incorrect information let me know!
Title: Re: Research plugin
Post by: Wolfbiter on January 25, 2007, 04:00:12 pm
You should have a seperate table for your ai/rp stuff, Malosar.. instead of adding a bunch of extra cells that has very little to do with the other cells. It's just a very bad structure as it is now.
Title: Re: Research plugin
Post by: Malosar on January 25, 2007, 04:25:43 pm
um I just expanded on your own structure where you added in rp values for level 1-10 and had the axp in there for 1-30, so it just needed the real level equivalents for those as well. Probably could have been done in an array instead but your existing structure was there for assigning xp to the level value based on each different type so I went with that.

I didn't really see a need to separate the tables when the data was all there already in 1 table with at least some reference to each other. If you want to separate all the reference data into multiple tables go for it but I didn't think level needs like 4 different lookup tables.
Title: Re: Research plugin
Post by: nebhyper on January 25, 2007, 04:27:54 pm
I did the same and just expanded on Wolfbiter code and structure.  However, since at lower levels you don't get SK I added XP.

Code: [Select]
function rp($from,$to) {
if ($from > $to && !empty($to)) {
$temp = $from;
$from = $to;
$to = $temp;
}
if ($from < 1 || (($to>10 && !empty($to)) || $from>10))
$ret = "Enter a number between 1 and 10.";
elseif (empty($to)) {
$qry = "select rp from level where level=$from";
$res = $this->bot->db->select($qry);
$qry2 = "select rp2 from level where level=$from";
$res2 = $this->bot->db->select($qry2);
$qry3 = "select capxp from level where level=$from";
$res3 = $this->bot->db->select($qry3);
$qry4 = "select capsk from level where level=$from";
$res4 = $this->bot->db->select($qry4);
$ret = $this->bot->colors->colorize("text","At research level ".$this->bot->colors->colorize("num",$from)." you need ".$this->bot->colors->colorize("num",number_format($res[0][0])." XP")." with a cap of ".$this->bot->colors->colorize("num",number_format($res3[0][0])." XP") ." or ".$this->bot->colors->colorize("num",number_format($res2[0][0])." SK")." with a cap of ".$this->bot->colors->colorize("num",number_format($res4[0][0])." SK").", to get the next research level.");
}
else {
$qry = "select sum(rp) as rp from level where level>$from AND level<=$to";
$res = $this->bot->db->select($qry);
$qry2 = "select sum(rp2) as rp2 from level where level>$from AND level<=$to";
$res2 = $this->bot->db->select($qry2);
$ret = $this->bot->colors->colorize("text","From the beginning of research level ".$this->bot->colors->colorize("num",$from)." to the end of research level ".$this->bot->colors->colorize("num",$to)." you need ".$this->bot->colors->colorize("num", number_format($res[0][0])." XP")." or ".$this->bot->colors->colorize("num", number_format($res2[0][0])." SK"));
}
return $ret;
}
Title: Re: Research plugin
Post by: Malosar on January 25, 2007, 04:44:52 pm
I guess the cool way to do it would be to get the level of the person requesting the info and refine the values returned to either xp or sk  :) Might actually do that....
Title: Re: Research plugin
Post by: pksiazek on January 25, 2007, 05:54:08 pm
I was thinking about that, but not sure if it'll be good idea.
Probably I'll just do two versions like 'researchxp' and 'researchsk'.
Values can be easily converted between them.
Title: Re: Research plugin
Post by: Wolfbiter on January 25, 2007, 10:56:04 pm
um I just expanded on your own structure where you added in rp values for level 1-10 and had the axp in there for 1-30, so it just needed the real level equivalents for those as well. Probably could have been done in an array instead but your existing structure was there for assigning xp to the level value based on each different type so I went with that.

I didn't really see a need to separate the tables when the data was all there already in 1 table with at least some reference to each other. If you want to separate all the reference data into multiple tables go for it but I didn't think level needs like 4 different lookup tables.

I used the "level" cell as a common thing, while you added alvl and rlvl as its own cells. Since it no longer uses a common cell with other level stuff.

Since ao-universe has info on caps etc now, I'll tidy up my script with research (been meaning to a while, just been lazy), but it's a good starting script, pksiazek.

Nebhyper: "select rp, rp2, capxp, capsk from level where level=$from"
Title: Re: Research plugin
Post by: nebhyper on January 25, 2007, 10:58:53 pm
I was just being lazy.  Would be nicer and cleaner to have seperate tables and use whois cache to get the person lvl that just did the !rp command and make it display cap in XP or SK based on thier level.


Title: Re: Research plugin
Post by: Malosar on January 26, 2007, 01:04:21 am
I used the "level" cell as a common thing, while you added alvl and rlvl as its own cells. Since it no longer uses a common cell with other level stuff.

I don't get it sorry. alvl and rlvl are common with "level" just as axp and rp are common with "level". Your original script got the axp as associated with level and I just added another lookup directly aligned with axp to get the required level as well.

I guess I just don't understand and probably never will if I don't already. You seem to say that the alvl and rlvl are completely unrelated to any other column whereas thats simply untrue.
Title: Re: Research plugin
Post by: Wolfbiter on January 26, 2007, 01:41:56 am
Ah, you use alvl and rlvl for the cap, well nevermind me then, I just didn't doublecheck your script.. guess I can always blame on all that extra spacing ;)
Title: Re: Research plugin
Post by: Malosar on January 26, 2007, 03:06:07 am
Ah, you use alvl and rlvl for the cap, well nevermind me then, I just didn't doublecheck your script.. guess I can always blame on all that extra spacing ;)

damn thing, I even tried to take out double lines today and checked it in vi. oh well.
Title: Re: Research plugin
Post by: jjones666 on January 26, 2007, 01:46:51 pm
I just didn't doublecheck your script.. guess I can always blame on all that extra spacing ;)

ROFL.  This is no excuse ;-P

-jj-
Title: Re: Research plugin
Post by: nebhyper on February 12, 2007, 09:22:13 pm
I guess the cool way to do it would be to get the level of the person requesting the info and refine the values returned to either xp or sk  :) Might actually do that....


in my tokens.php I have done just this and also ported it over to !level !lvl and a made a new one called !me that has basically the same thing as !lvl but displays in a blob instead of spamming chat.


Anyways, here is the code from !tokens I used to get the persons level.

Code: [Select]
//Find player lvl
$result = $this -> bot -> db -> select("SELECT level FROM members WHERE id = " . $this -> bot -> aoc -> get_uid($name));
if (empty($result))
{
$result = $this -> bot -> db -> select("SELECT level FROM whois WHERE id = " . $this -> bot -> aoc -> get_uid($name));
$lvl = $result[0][0];
}
else
{
$lvl = $result[0][0];
}

if (empty($lvl))
{
return "Unable to find your level.  Please manually enter it. <pre>help tokens";
}
else
{
  return $this -> ShowTokens($lvl, $info[1], $info[2]);
}
SimplePortal 2.3.7 © 2008-2024, SimplePortal