collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Loot Module - Multiple rolls  (Read 4204 times)

0 Members and 1 Guest are viewing this topic.

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Loot Module - Multiple rolls
« on: April 28, 2005, 09:14:15 am »
LOOT MODULE

Description:
This module allows you to add multiple items into a roll system.

Instructions:
Quote from: "Privgroup/Tell"
!add <num>
Adds a user to the roll in slot <num>.

!rem <num>
Removes a user from the roll in slot <num>.

Quote from: "Privgroup"
!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].
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline Nogoal

  • BeBot Apprentice
  • ***
  • Posts: 77
  • Karma: +0/-0
Re: Loot Module - Multiple rolls
« Reply #1 on: December 12, 2005, 04:34:17 pm »
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?
« Last Edit: December 13, 2005, 03:21:32 pm by Nogoal »

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Re: Loot Module - Multiple rolls
« Reply #2 on: December 14, 2005, 01:37:21 am »
!items <ql> <search>
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Re: Loot Module - Multiple rolls
« Reply #3 on: March 15, 2006, 10:52:02 pm »
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.
« Last Edit: March 15, 2006, 10:53:52 pm by craized »
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline kuznechik

  • Contributor
  • *******
  • Posts: 60
  • Karma: +0/-0
Re: Loot Module - Multiple rolls
« Reply #4 on: March 16, 2006, 10:00:15 am »
Can you add !reroll command?
I've added to previous version of -loot module.

Was
Quote

        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
Quote
        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
Quote
        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);
                }
        }
« Last Edit: March 16, 2006, 10:05:46 am by kuznechik »
Kuznechik, proud bot admin of Disciples of Omni-Tek, Rimor.

Offline Karsta

  • BeBot User
  • **
  • Posts: 28
  • Karma: +0/-0
Re: Loot Module - Multiple rolls
« Reply #5 on: January 30, 2007, 12:04:42 am »
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

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
Re: Loot Module - Multiple rolls
« Reply #6 on: January 30, 2007, 04:07:30 pm »
Here is my Loot.php which has the multiple loot, rerolls, list, set to single or multi add etc
Eternalist
General of The Syndicate

Offline Karsta

  • BeBot User
  • **
  • Posts: 28
  • Karma: +0/-0
Re: Loot Module - Multiple rolls
« Reply #7 on: January 31, 2007, 12:29:42 am »
uuh, it worked it with me, thx

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Loot Module - Multiple rolls
« Reply #8 on: January 31, 2007, 11:25:50 am »
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

« Last Edit: February 04, 2007, 12:30:25 am by Parfet »

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 666
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal