BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: craized on April 28, 2005, 09:14:15 am
-
LOOT MODULE (http://www.craized.net/junk/bebot/highlight.php?Loot)
Description:
This module allows you to add multiple items into a roll system.
Instructions:
!add <num>
Adds a user to the roll in slot <num>.
!rem <num>
Removes a user from the roll in slot <num>.
!loot <item>
Adds <item> into a roll in the next open slot.
!list
Lists the current rolls in progress, and who is currently in the roll for each item.
!result
Rolls all items and announces the winner.
!clear
Clears all current rolls.
!mode <single/multiple>
In single loot mode, a user can only be included in one slot.
In multiple loot mode, a user can join as many slots as they choose.
!timer [name]
Checks the time remaining.
If the timer being checked is named, use [name].
!timer clear [name]
Clears an active timer.
If the timer being cleared is named, use [name].
-
I modified your module with:
<?
function rlist() {
$highlight = $this -> highlight;
unset($msg);
$num= 0;
foreach($this -> loot as $slot) {
$num++;
$msg .= "Rolling on item$highlight $slot[item]</font> in slot$highlight #$num</font>:";
if(count($slot) == 1) {
$msg .= $highlight . " Nobody included</font>";
} else {
$list = array_keys($slot);
foreach($list as $key=>$player) {
if($player != "item") {
$msg .= "$highlight [$player]</font>";
}
}
}
$msg .="\n<a href='chatcmd:///tell <botname> !add $num'>Add</a>|<a href='chatcmd:///tell <botname> !rem $num'>Remove</a>\n\n";
}
$this -> bot -> send_pgroup($this -> bot -> make_blob("[Click for Loot list]", $msg));
}
?>
and
<?
function roll($name){
$highlight = $this -> highlight;
$num = 1;
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name, "raidleader") || $this -> bot -> admin -> in_group($name, "admin") || $this -> lead == $name || !$this -> lead) {
foreach($this -> loot as $slot) {
unset($winner);
$users = array();
$item = $slot[item];
unset($slot[item]);
$list = $slot;
$users = array_keys($slot);
$rolling = $users;
$count = count($slot)-1;
for($i = 1; $i <= 10000; $i++) {
$list[$users[rand(0, $count)]] += 1;
}
natsort($list);
foreach($list as $name => $points) {
$winner = $name;
}
if(!$winner) {
$winner = Nobody;
}
$this -> bot -> send_pgroup($highlight . $winner . " </font>won the roll for$highlight " . $item . " </font>in slot$highlight #" . $num . "!");
$resultlootlist .= "$winner won $item !\n";
unset($this -> loot[$num]);
unset($this -> lead);
$num++;
}
$this -> bot -> send_pgroup($this -> bot -> make_blob("[Click for Winners list]", $resultlootlist));
}
}
?>
So i can have the loots blobbed. But so, i can't click on items to show their ql. Must i change something or it's the way blob works and you can only have "/tell botname !items blah" in it?
-
!items <ql> <search>
-
Redid a lot of this module. List and Results are now shown in blob as well. Each item looted is also stored in the database for future reference. So far, it only saved id, name of looter, timestamp, and the posted item. I'm sure this will change.
-
Can you add !reroll command?
I've added to previous version of -loot module.
Was
function roll($name){
$highlight = $this -> highlight;
++ $lcount=0;
[..]
if(!$winner) {
$winner = Nobody;
++ $lcount = count($this -> leftovers)+1;
++ $this -> leftovers[$lcount] = $item;
} else unset($slot[$winner]);
in roll function + few unsets on !clear|!loot and
function reroll($name) {
$lcount= count($this->leftovers);
if ($lcount==0) {$this -> bot -> send_pgroup($highlight ."No leftovers from last roll</font>");}
elseif ( $this -> lead ) {$this -> bot -> send_pgroup($highlight ."There's another roll active atm</font>");}
else {
$this -> lead = $name;
$this -> count = 0;
foreach ($this -> leftovers as $item) {
$notyet = true;
for ($i=1;$i<= $this->count; $i++)
{ if ($item == $this->loot[$i][item]) {
$this->loot[$i][num]++;
$num = $this->loot[$i][num];
$notyet = false;
$numslot = $i;
}
}
if ($notyet) {
$this -> count ++;
$num = 1;
$numslot = $this -> count;
$this -> loot[$numslot][item] = $item;
$this -> loot[$numslot][num] = 1;
}
$this -> bot -> send_pgroup($highlight . $num . "x " . $item . "</font> being rolled in slot".$highlight." #" . $numslot);
}
unset($this->leftovers);
}
}
Also little tweak like below to stack similar items into 1 roll will be nice. I once did it like this
function loot($msg, $name) {
$highlight = $this -> highlight;
if($this -> lead == $name || !$this -> lead) {
$this -> lead = $name;
$this -> type = "common";
$notyet = true;
for ($i=1;$i<= $this->count; $i++)
{ if ($msg == $this->loot[$i][item]) {
$this->loot[$i][num]++;
$num = $this->loot[$i][num];
$notyet = false;
$numslot = $i;
}
}
if ($notyet) {
$this -> count ++;
$num = 1;
$numslot = $this -> count;
$this -> loot[$numslot][item] = $msg;
$this -> loot[$numslot][num] = 1;
}
$this -> bot -> send_pgroup($highlight . $num . "x " . $msg . "</font> being rolled in slot".$highlight." #" . $numslot);
}
if ($this->count == 1) {
unset($this -> leftovers);
}
}
-
Could Kuznechik post your complete loot module, i cant get craizeds working
get this message
Parse error: parse error, unexpected T_VARIABLE in D:\Program files\Funcom\kbot\
bbot\modules\Loot.php on line 156
using v.0.2.10 - PHP 5.1.4
-
Here is my Loot.php which has the multiple loot, rerolls, list, set to single or multi add etc
-
uuh, it worked it with me, thx
-
the one posted at the top is missing a ";" at the end of line 155, add it in and it starts fine
but i have a problem, i've tested both, and if you add more than one item at a time, only one item is rolled, and the rest are never won... i took two alts on aorc, rolled 4 items and !added them each to all of them, and only one person wins one thing, the rest don't get any winners at all