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

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

Author Topic: Custom modules  (Read 40360 times)

0 Members and 2 Guests are viewing this topic.

Offline Zacix

  • Contributor
  • *******
  • Posts: 73
  • Karma: +0/-0
Teams module
« Reply #45 on: April 13, 2005, 02:18:53 pm »
Took the liberty of changing the teammodule. I have no clue how PHP really works so forgice the coding, but I think I made a nice feature rewrite. I removed the !showmeteams command, and added /tell <botname> !teams admin. Should make it abit easier to make teams and makes a good replacement for !showmeteams. Also, fixed a bug (seemed to be at least) that when someone leaves the bot, the teams weren't cleaned properly. Feel free to use it :)
Code: [Select]
<?php
/*
* Teams Module for BE Bot <http://bebot.fieses.net>
* Module coded by Craized <http://www.craized.net>

/*
Add a "_" at the beginning of the file (Teams.php) if you do not want it to be loaded.
*/

$teams = new Teams($bot);
$commands["tell"]["teams"] = &$teams;
$commands["pgmsg"]["teams"] = &$teams;
$commands["pgjoin"][] = &$teams;
$commands["pgleave"][] = &$teams;

/*
The Class itself...
*/
class Teams {
var $bot;
var $pgroup;


/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Teams (&$bot) {
$this -> bot = &$bot;
$this -> autonum true;
}

function tell($name$msg) {
$msg explode(" "$msg);
$red "<font color=#FF0000>";
$blue "<font color=#9999CC>";
$yellow "<font color=#ffff00>";

if($this -> autonum == true) {
$numteams $this -> teams;

else {
$numteams $this -> numteam;
}
if($msg[1] == "admin"){
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
$result .= $yellow ":::: Teams Administration ::::</font><font color=#0000dd44>\n\n";
$result .= "Commands:\n";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams admin'>Refresh Teams Administration</a>\n";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams'>Show Teams</a>\n";
$result .= "Set Number of Teams <a href='chatcmd:///tell <botname> <pre>teams num auto'>Auto</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 1'>1</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 2'>2</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 3'>3</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 4'>4</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 5'>5</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 6'>6</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 7'>7</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 8'>8</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 9'>9</a>\n\n";
for($num=1$num<=$numteams$num++) {
$result .= $red $num ": LDR ";
$count count($this -> team[$num]);
$membnum 1;
for($spot=1$spot<=$count$spot++) {
if($this -> team[$num][$spot] && $this -> team[$num][$spot] != "gone") {
if($membnum == 1) {
$result .= "<a href='chatcmd:///tell <botname> <pre>teams 0 " $this -> team[$num][$spot] . "'>" $this -> team[$num][$spot] . "</a></font>";
}
else {
$result .= " - " $membnum "." "<a href='chatcmd:///tell <botname> <pre>teams 0 " $this -> team[$num][$spot] . "'>" $this -> team[$num][$spot] . "</a>";
}
$membnum++;
}
}
$result .= "\n";
}
$result .= $red "Unteamed: </font>\n";
unset($unteamed);
foreach($this -> pgroup as $player=>$team) {
if($team == "lft") {
$result .= "~" $player "~ ";
$result .= "Add to team: ";
for($num=1$num<=$numteams$num++) {
$result .=  "<a href='chatcmd:///tell <botname> <pre>teams " $num " " $player "'>" $num "</a> ";
}
$result .= "\n";
$unteamed true;
}
}
$result $this -> bot -> make_blob("Teams Administration"$result);
$this -> bot -> send_tell($name$result);
unset($result);
}
}
if ($msg[1] == "") {
for($num=1$num<=$numteams$num++) {
$result .= $red $num ": LDR ";
$count count($this -> team[$num]);
$membnum 1;
for($spot=1$spot<=$count$spot++) {
if($this -> team[$num][$spot] && $this -> team[$num][$spot] != "gone") {
if($membnum == 1) {
$result .= $this -> team[$num][$spot] . "</font>";
}
else {
$result .= " - " $membnum "." $this -> team[$num][$spot];
}
$membnum++;
}
}
$this -> bot -> send_pgroup($result);
unset($result);
}
$result .= $red "Unteamed: ";
unset($unteamed);
foreach($this -> pgroup as $player=>$team) {
if($team == "lft") {
$result .= "~" $player "~ ";
$unteamed true;
}
}
if($unteamed) {
$this -> bot -> send_pgroup($result);
}
}
if($msg[1] == "clear") {
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
foreach($this -> pgroup as $player=>$value) {
if($this -> left[$player]) {
unset($this -> pgroup[$player]);

else {
$this -> pgroup[$player] = "lft";
}
unset($this -> team);
}
$this -> bot -> send_pgroup($blue "Teams cleared");
}
}
if(preg_match("#^[1-9]#"$msg[1])) {
if($numteams >= $msg[1]) {
$team $msg[1];
$spot count($this -> team[$team])+1;
$count 1;
for($teamnum=1$teamnum <= $numteams$teamnum++) {
foreach($this -> team[$teamnum] as $key => $value) {
if($value == $teamnum) {
$count++;
}
}
}
if ($count <= 6){
if($msg[2] == "") {
if($this -> pgroup[$name] != $team) {
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $name){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
$this -> team[$team][$spot] = $name;
$this -> pgroup[$name] = $team;
$this -> bot -> send_pgroup($blue $name " assigned to team " $msg[1]);
}
else {
$this -> bot -> send_pgroup($blue " " $name " already in team " $team);
}
}
else {
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
$user ucfirst($msg[2]);
if($numteams >= $msg[1]) {
if($this -> pgroup[$user]) {
if($this -> pgroup[$user] != $team) {
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $user){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
$this -> team[$team][$spot] = $user;
$this -> pgroup[$user] = $team;
$this -> bot -> send_pgroup($blue $user " assigned to team " $msg[1]);

else {
$this -> bot -> send_pgroup($blue $user " already in team " $team);
}
}
else {
$this -> bot -> send_pgroup($blue $msg[2] . " not in " $this -> bot -> botname);
}
}
}
}

else {
$this -> bot -> send_pgroup($blue "Sorry, team " $team " is full.");
}
}
}
 elseif(preg_match("#^0#"$msg[1])) {
if(!$msg[2]) {
$user $name;
}
else {
$user ucfirst($msg[2]);
}
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $user){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
if($this -> left[$user]) {
unset($this -> pgroup[$user]);

else {
$this -> pgroup[$user] = "lft";
}
$this -> bot -> send_pgroup($blue $user " cleared from teams.");
}
if($msg[1] == num) {
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
if($msg[2] == auto) {
$this -> autonum true;
foreach($this -> pgroup as $player=>$value) {
$this -> pgroup[$player] = "lft";
unset($this -> team);
}
$this -> bot -> send_pgroup($blue "Teams cleared");
$this -> bot -> send_pgroup($blue "Automatic teams now enabled");

elseif(preg_match("#^[1-90]#"$msg[2])) {
$this -> numteam $msg[2];
$this -> bot -> send_pgroup($blue "Maximum number of teams now set to " $msg[2]);
$this -> autonum false;
}
}
}
}

/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name$msg) {
$msg explode(" "$msg);
$red "<font color=#FF0000>";
$blue "<font color=#9999CC>";
if($this -> autonum == true) {
$numteams $this -> teams;

else {
$numteams $this -> numteam;
}
if ($msg[1] == "") {
for($num=1$num<=$numteams$num++) {
$result .= $red $num ": LDR ";
$count count($this -> team[$num]);
$membnum 1;
for($spot=1$spot<=$count$spot++) {
if($this -> team[$num][$spot] && $this -> team[$num][$spot] != "gone") {
if($membnum == 1) {
$result .= $this -> team[$num][$spot];
} else {
$result .= " - " $membnum "." $this -> team[$num][$spot];
}
$membnum++;
}
}
$this -> bot -> send_pgroup($result);
unset($result);
}
$result .= $red "Unteamed: ";
unset($unteamed);
foreach($this -> pgroup as $player=>$team) {
if($team == "lft") {
$result .= "~" $player "~ ";
$unteamed true;
}
}
if($unteamed) {
$this -> bot -> send_pgroup($result);
}
}
if($msg[1] == "clear") {
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
foreach($this -> pgroup as $player=>$value) {
if($this -> left[$player]) {
unset($this -> pgroup[$player]);
} else {
$this -> pgroup[$player] = "lft";
}
unset($this -> team);
}
$this -> bot -> send_pgroup($blue "Teams cleared");
}
}
if(preg_match("#^[1-9]#"$msg[1])) {
if($numteams >= $msg[1]) {
$team $msg[1];
$spot count($this -> team[$team])+1;
$count 1;
for($teamnum=1$teamnum <= $numteams$teamnum++) {
foreach($this -> team[$teamnum] as $key => $value) {
if($value == $teamnum) {
$count++;
}
}
}
if ($count <= 6){
if($msg[2] == "") {
if($this -> pgroup[$name] != $team) {
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $name){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
$this -> team[$team][$spot] = $name;
$this -> pgroup[$name] = $team;
$this -> bot -> send_pgroup($blue $name " assigned to team " $msg[1]);
} else {
$this -> bot -> send_pgroup($blue " " $name " already in team " $team);
}
} else {
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
$user ucfirst($msg[2]);
if($numteams >= $msg[1]) {
if($this -> pgroup[$user]) {
if($this -> pgroup[$user] != $team) {
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $user){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
$this -> team[$team][$spot] = $user;
$this -> pgroup[$user] = $team;
$this -> bot -> send_pgroup($blue $user " assigned to team " $msg[1]);
} else {
$this -> bot -> send_pgroup($blue $user " already in team " $team);
}
} else {
$this -> bot -> send_pgroup($blue $msg[2] . " not in " $this -> bot -> botname);
}
}
}
}
} else {
$this -> bot -> send_pgroup($blue "Sorry, team " $team " is full.");
}
}
} elseif(preg_match("#^0#"$msg[1])) {
if(!$msg[2]) {
$user $name;
} else {
$user ucfirst($msg[2]);
}
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $user){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
if($this -> left[$user]) {
unset($this -> pgroup[$user]);
} else {
$this -> pgroup[$user] = "lft";
}
$this -> bot -> send_pgroup($blue $user " cleared from teams.");
}
if($msg[1] == num) {
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
if($msg[2] == auto) {
$this -> autonum true;
foreach($this -> pgroup as $player=>$value) {
$this -> pgroup[$player] = "lft";
unset($this -> team);
}
$this -> bot -> send_pgroup($blue "Teams cleared");
$this -> bot -> send_pgroup($blue "Automatic teams now enabled");
} elseif(preg_match("#^[1-90]#"$msg[2])) {
$this -> numteam $msg[2];
$this -> bot -> send_pgroup($blue "Maximum number of teams now set to " $msg[2]);
$this -> autonum false;
}
}
}
}


/*
This gets called if someone joins the privgroup
*/
function pgjoin($name) {
if($this -> left[$name]) {
unset($this -> left[$name]);
}
if(!$this -> pgroup[$name]) {
$this -> pgroup[$name] = "lft";
$this -> teams ceil(count($this -> pgroup)/6);
}
}



/*
This gets called if someone leaves the privgroup
*/
function pgleave($name) {
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $name){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
/*if($this -> left[$user]) {
unset($this -> pgroup[$user]);

else {
$this -> pgroup[$user] = "lft";
}*/
$this -> pgroup[$name] = "lft";
if ($this -> pgroup[$name] == "lft") {
unset($this -> pgroup[$name]);

else {
$this -> left[$name] = true;
}
}
}
?>
Zacix
Current projects:
RINGBot, BeBot branch
Neutnet, RK2 Neutral massmessage network

Offline Zacix

  • Contributor
  • *******
  • Posts: 73
  • Karma: +0/-0
!admin del $playername
« Reply #46 on: April 13, 2005, 02:28:23 pm »
This command has an error. It allows an admin to remove a superadmin. The problem is in the member_del function (depending on how the command is done, sometimes group = all, hence the error occurs). The first part of the function should be something like this:

Code: [Select]

function member_del($name, $group, $member)
{
      $group = strtolower($group);

        if($this -> in_group($member, "superadmin"))
return "Hey stupid!, Don't mess with the superadmins!";
        if($this -> in_group($member, "admin"))
$need_group = "superadmin";
        else
$need_group = "admin";

Zacix
Current projects:
RINGBot, BeBot branch
Neutnet, RK2 Neutral massmessage network

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Custom modules
« Reply #47 on: April 14, 2005, 08:13:45 am »
Per request, I have made it possible to set a highlight color so to speak through your Bot.conf file. All my modules will now use this color if its set, otherwise I've set another color to highlight with. In order for this to work, download these moded files and replace your current versions. I included Bot.conf as well with the extra value, but I suggest just adding in the line $highlight_color = "#FF0000";(or any color) to your pre-existing files.

On top of this, I'm releasing a new version of my Loot module with better formatting, and a new Teams module Lal and I have been working on together. It actually does include some of the changes Zacix has made himself, purely by coincidence, !showmeteams has been changed to !teams, there are now two modes. !teams mode stay, and !teams mode kick. Stay mode will keep users in the teams setup after they leave the bot (My prefered setup to help prevent confusion with LD etc.), and kick mode, where users will be kicked from the teams setup upon exit of the bot.
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: !admin del $playername
« Reply #48 on: April 14, 2005, 08:16:41 am »
Quote from: "Zacix"
This command has an error. It allows an admin to remove a superadmin. The problem is in the member_del function (depending on how the command is done, sometimes group = all, hence the error occurs). The first part of the function should be something like this:

Code: [Select]

function member_del($name, $group, $member)
{
      $group = strtolower($group);

        if($this -> in_group($member, "superadmin"))
return "Hey stupid!, Don't mess with the superadmins!";
        if($this -> in_group($member, "admin"))
$need_group = "superadmin";
        else
$need_group = "admin";




Code: [Select]

    function member_del($name, $group, $member)
    {
      $group = strtolower($group);
      if (($group == "admin") || ($group == "superadmin"))
        $need_group = "superadmin";
      else
        $need_group = "admin";


This means that if the user is trying to delete an admin or a superadmin, then they need to be a superadmin, otherwise, they need to be an admin. This does not allow users in the admin group to delete superadmins.

Also, this is the wrong thread for this.  :)
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline Zacix

  • Contributor
  • *******
  • Posts: 73
  • Karma: +0/-0
Re: !admin del $playername
« Reply #49 on: April 14, 2005, 09:47:00 am »
Quote from: "craized"

Code: [Select]

    function member_del($name, $group, $member)
    {
      $group = strtolower($group);
      if (($group == "admin") || ($group == "superadmin"))
        $need_group = "superadmin";
      else
        $need_group = "admin";


This means that if the user is trying to delete an admin or a superadmin, then they need to be a superadmin, otherwise, they need to be an admin. This does not allow users in the admin group to delete superadmins.

Also, this is the wrong thread for this.  :)


This is true, but u could do !tell <botname> !admin del <username>. In this case group = all (the option where u want to delete the user from all groups). If the <username> is a superadmin and the user that tries to delete the superadmin is just an admin, it will work perfectly well since the code checks the $group against "admin" and "superadmin". Therefore, in my opinion, it's more bulletproof and versatile to check if the user you are trying to delete is in a specific group rather than using the groupname entered.

I do understand the old code btw, and it does not work :) Only difference with my code is that you can't delete superadmins online. Superadmins will have to be removed from the setupfiles anyway. To make the code the same as yours was intended to be, just remove the first if block.

If u want to check that the old logic doesn't work, make an admin do a /tell <botname> !admin del <superadmin>

Sowwy for using the wrong thread btw and big thx to you guys that's making this a really good bot :)
Zacix
Current projects:
RINGBot, BeBot branch
Neutnet, RK2 Neutral massmessage network

Offline Zarkingu

  • Contributor
  • *******
  • Posts: 34
  • Karma: +0/-0
Custom modules
« Reply #50 on: April 14, 2005, 09:05:15 pm »
Love those modules craized.

As I'm a complete beginner in the PHP bussines I was wondering how to change this code from the timer module.

function cron()
   {
      $timeleft = $this -> timer -> time-mktime();
      if($timeleft <= 0 && $this -> timer -> active == "on") {
         $this -> bot -> send_pgroup($highlight . $this -> timer -> user . " your timer has gone off.");
         unset($this -> timer);
      }
   }


As it is now it will display this in chat when timer is up.
Somecharacter your timer has gone off

What I would like is something like this
TIMER UP!! ITS ON!!

Tried editing it, but got a parse error. Think I might have cut off too much of the code.
Zarkingu 210 MP RK2

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Custom modules
« Reply #51 on: April 14, 2005, 11:38:27 pm »
Code: [Select]

function cron()
{
$timeleft = $this -> timer -> time-mktime();
if($timeleft <= 0 && $this -> timer -> active == "on") {
$this -> bot -> send_pgroup("TIMER UP!! ITS ON !!");
unset($this -> timer);
}
}


That should work :)
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline Lal

  • BeBot User
  • **
  • Posts: 53
  • Karma: +0/-0
Custom modules
« Reply #52 on: April 15, 2005, 08:26:25 am »
Code: [Select]
$this -> timer -> time = mktime()+$msg[1]*60;
$this -> bot -> send_pgroup("Timer set for " . $highlight . $msg[1] . " minutes");
} elseif($msg[1] == clear) {


change this to

Code: [Select]
$this -> timer -> time = mktime()+$msg[1]*60;
$this -> bot -> send_pgroup("ITS ON!!!");
} elseif($msg[1] == clear) {
[205/12][Lalsoldier][RK2]

[190/5][Laldoc][RK2]

[195/10][Lalnt][RK2]

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Custom modules
« Reply #53 on: April 15, 2005, 08:48:47 am »
Oop ><

Bad bug in my loot module, whoever joins the role first wins. Updated code here, I'll upload asap.

Thanks to Zacix for fixing a bug in the single loot mode.

Code: [Select]

<?
/*
* Loot Module for BE Bot <http://bebot.fieses.net>
* Module coded by Craized <http://www.craized.net>

/*
Add a "_" at the beginning of the file (_Loot.php) if you do not want it to be loaded.
*/

$loot = new Rolls($bot);


$commands["tell"]["rem"] = &$loot;
$commands["tell"]["add"] = &$loot;
$commands["pgmsg"]["loot"] = &$loot;
$commands["pgmsg"]["add"] = &$loot;
$commands["pgmsg"]["rem"] = &$loot;
$commands["pgmsg"]["result"] = &$loot;
$commands["pgmsg"]["mode"] = &$loot;
$commands["pgmsg"]["list"] = &$loot;
$commands["pgmsg"]["clear"] = &$loot;

/*
The Class itself...
*/
class Rolls {
var $bot;

/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Rolls (&$bot) {
$this -> bot = &$bot;
$this -> mode = "multi";
if(!$this -> bot -> highlight_color) {
$this -> highlight = "<font color=#CB11C9>";
} else {

$this -> highlight = "<font color=" . $this -> bot -> highlight_color . ">";
}
}

/*
This gets called on a tell with the command
*/
function tell($name, $msg) {
$highlight = $this -> highlight;
if(preg_match("/^" . $this -> bot -> commpre . "rem ([0-9]+)/i", $msg, $info)) {
unset($this -> loot[$info[1]][$name]);
$this -> bot -> send_pgroup($highlight . $name . "</font> removed from rolls in slot$highlight #" . $info[1]);
$this -> bot -> send_tell($name, $highlight . $name . " </font>removed from rolls in slot$highlight #" . $info[1]);
}
if(preg_match("/^" . $this -> bot -> commpre . "add ([0-9]+)/i", $msg, $info)) {
$this -> add($name, $info[1]);
$this -> bot -> send_tell($name, $this -> addmsg);
}
}

/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name, $msg) {
$highlight = $this -> highlight;
if(preg_match("/^" . $this -> bot -> commpre . "loot (.*)/i", $msg, $info)) {
$this -> loot($info[1], $name);
}
if(preg_match("/^" . $this -> bot -> commpre . "add ([0-9]+)/i", $msg, $info)) {
$this -> add($name, $info[1]);
}
if(preg_match("/^" . $this -> bot -> commpre . "list/i", $msg)) {
$this -> rlist();
}
if(preg_match("/^" . $this -> bot -> commpre . "mode ?(.*)/i", $msg, $info)) {
if(!$info[1]) {
$this -> bot -> send_pgroup("Loot mode currently set to$highlight " . $this -> mode . "</font>.");
}
if(!$this -> lead || $this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name, "raidleader") || $this -> bot -> admin -> in_group($name, "admin")) {
if(!$this -> lead) {
if($info[1] == single) {
$this -> mode = "single";
$this -> bot -> send_pgroup("Roll mode changed to$highlight single loot</font>.");
} else if($info[1] == multi) {
$this -> mode = "multi";
$this -> bot -> send_pgroup("Roll mode changed to$highlight multiple loot</font>.");
}
} else {
$this -> bot -> send_pgroup("You cannot change the loot mode while rolling is in progress.");
}
}
}

if(preg_match("/^" . $this -> bot -> commpre . "rem ([0-9]+)/i", $msg, $info)) {
unset($this -> loot[$info[1]][$name]);
$this -> bot -> send_pgroup($highlight . $name . "</font> removed from rolls in slot$highlight #" . $info[1]);
}
if(preg_match("/^" . $this -> bot -> commpre . "result/i", $msg)) {
if($this -> lead == $name || !$this -> lead || $this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name, "raidleader") || $this -> bot -> admin -> in_group($name, "admin")) {
$this -> roll($name);
}
}
if(preg_match("/^" . $this -> bot -> commpre . "clear/i", $msg)) {
if($this -> lead == $name || !$this -> lead || $this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name, "raidleader") || $this -> bot -> admin -> in_group($name, "admin")) {
unset($this -> loot);
unset($this -> lead);
$this -> bot -> send_pgroup("<font color=#FF0000>" . $name . " cancelled the loot rolls in progress");
}
}
}

function add($name, $slot) {
$highlight = $this -> highlight;
unset($present);
if($this -> loot[$slot]) {
if($this -> mode == 'single') {
$slots = array_keys($this -> loot);
foreach($slots as $key=>$sslot) {
$list = array_keys($this -> loot[$sslot]);
foreach($list as $playerslot=>$player) {
if($player == $name) {
unset($this -> loot[$sslot][$player]);
$present = true;
}
}
}
if($present == true) {
$this -> addmsg = $highlight . "$name</font> changed to slot$highlight #$slot</font>";
} else {
$this -> addmsg = $highlight . "$name</font> assigned to slot$highlight #$slot</font>";
}
$this -> loot[$slot][$name] = true;
} else {
$this -> loot[$slot][$name] = true;
$this -> addmsg = $highlight . "$name</font> assiged to slot$highlight #$slot</font>";
}
} else {
$this -> addmsg = "There is currently no roll in slot $slot";
}
$this -> bot -> send_pgroup($this -> addmsg);
}

function loot($msg, $name) {
$highlight = $this -> highlight;
if($this -> lead == $name || !$this -> lead) {
$this -> lead = $name;
$count = count($this -> loot)+1;
$this -> loot[$count][item] = $msg;
$this -> bot -> send_pgroup($highlight . $msg . "</font> being rolled in slot$highlight #" . $count);
}
}

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 . "!");
unset($this -> loot[$num]);
unset($this -> lead);
$num++;
}
}
}

function rlist() {
$highlight = $this -> highlight;
$num = 0;
foreach($this -> loot as $slot) {
unset($msg);
$num++;
$msg .= "Rolling on item$highlight $slot[item]</font> in slot$highlight #$num</font>:";
if(count($slot) == 1) {
$msg .= $highlight . " Nobody included";
} else {
$list = array_keys($slot);
foreach($list as $key=>$player) {
if($player != "item") {
$msg .= "$highlight [$player]</font>";
}
}
}
$this -> bot -> send_pgroup($msg);
}
}
}
?>
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
Custom modules
« Reply #54 on: April 15, 2005, 10:55:24 am »
More spam, but I'm proud to announce that my Alien Playfield Module is ready for re-release. Its held stead through 4 alien playfields opening up at an interval of 7 hours 12 minutes and 2.5 seconds. I'll upload when I get a chance, same as usual.

Code: [Select]

<?php
/*
* Playfield Module for BE Bot <http://bebot.fieses.net>
* Module coded by Craized <http://www.craized.net>

/*
Add a "_" at the beginning of the file (_Playfield.php) if you do not want it to be loaded.
*/

$playfield = new Playfield($bot);

$commands["tell"]["pf"] = &$playfield;
$commands["pgmsg"]["pf"] = &$playfield;
$commands["gc"]["pf"] = &$playfield;
$cron["2sec"][] = &$playfield;

/*
The Class itself...
*/
class Playfield {
var $bot;

/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Playfield (&$bot) {
$this -> bot = &$bot;
if($this -> bot -> highlight_color) {
$this -> highlight "<font color=" $this -> bot -> highlight_color ">";
} else {
$this -> highlight "<font color=#FFFFFF>";
}
}

/*
This gets called on a tell with the command
*/
function tell($name$msg) {
$this -> time();
$this -> bot -> send_tell($name$this -> msg);
}

/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name$msg) {
$this -> time();
$this -> bot -> send_pgroup($this -> msg);
}

/*
This gets called on a msg in the guildchat with the command
*/
function gc($name$msg) {
$this -> time();
$this -> bot -> send_gc($this -> msg);
$this -> bot -> log(GROUPSEND$this -> msg);
}

/*
This gets called on cron
*/
function cron() {
$highlight $this -> highlight;
$this -> time();
if($this -> timeleft <= 3600 && $this -> timeleft >= 3599) {
$this -> bot -> send_pgroup("<font color=#FF2222>Alien playfield is beginning in$highlight 1</font> hour!");
$this -> bot -> send_gc("<font color=#FF2222>Alien playfield is beginning in$highlight 1</font> hour!");
}
if($this -> timeleft <= 1800 && $this -> timeleft >= 1799) {
$this -> bot -> send_pgroup("<font color=#FF2222>Alien playfield is beginning in$highlight 30</font> minutes!");
$this -> bot -> send_gc("<font color=#FF2222>Alien playfield is beginning in$highlight 30</font> minutes!");
}
if($this -> timeleft <= 900 && $this -> timeleft >= 899) {
$this -> bot -> send_pgroup("<font color=#FF2222>Alien playfield is beginning in$highlight 15</font> minutes!");
$this -> bot -> send_gc("<font color=#FF2222>Alien playfield is beginning in$highlight 15</font> minutes!");
}
if($this -> timeleft <= 300 && $this -> timeleft >= 299) {
$this -> bot -> send_pgroup("<font color=#FF2222>Alien playfield is beginning in$highlight 5</font> minutes!");
$this -> bot -> send_gc("<font color=#FF2222>Alien playfield is beginning in$highlight 5</font> minutes!");
}
if($this -> timeleft <= 1) {
$this -> bot -> send_pgroup("<font color=#FF2222>Alien playfield starting$highlight now</font>!");
$this -> bot -> send_gc("<font color=#FF2222>Alien playfield starting$highlight now</font>!");
}
}

function time() {
$time gmmktime(1011454142005);
$int 7*60*60+12*60+2.5;
$raids floor((mktime()-$time)/$int);
#if(round($raids/2) == $raids/2) {
# $time = $time-1;
#}
$this -> timeleft = ($time+$int+$int*$raids)-mktime();
$timer ceil($this -> timeleft);
$h 0;
while($timer >= 3600) {
$h++;
$timer-=3600;
}
$m 0;
while($timer >= 60) {
$m++;
$timer-=60;
}
$s $timer;
if($h == 0) {
$h '00';
}
if($m 10) {
$m '0' $m;
}
if($s 10) {
$s '0' $s;
}
$this -> msg "$h:$m:$s remaining until Alien Playfield.";
}
}
?>

Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline Lal

  • BeBot User
  • **
  • Posts: 53
  • Karma: +0/-0
Custom modules
« Reply #55 on: April 15, 2005, 06:05:28 pm »
Quote from: "craized"
More spam, but I'm proud to announce that my Alien Playfield Module is ready for re-release. Its held stead through 4 alien playfields opening up at an interval of 7 hours 12 minutes and 2.5 seconds. I'll upload when I get a chance, same as usual.


Nice, what about also finding out how long the gates are open?

Bots do log the vinicity if I remember right, so I might also be able to get everything comfirmed. (At least... IGNBot logged it somehow)
[205/12][Lalsoldier][RK2]

[190/5][Laldoc][RK2]

[195/10][Lalnt][RK2]

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Custom modules
« Reply #56 on: April 15, 2005, 06:38:06 pm »
When you log out at the alien playfield for too long, it warps you out closer to the beacon, where vicinity will unfortunately not catch gates opening/closing. I don't know how long this timer is, but for now I spose I can just assume they're 12:025 minutes, leaving 7 hours in between the gates closing and teh gates opening. I'll update code when I get a chance.
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
Custom modules
« Reply #57 on: April 20, 2005, 10:45:14 am »
Updates, but I've gotten lazy and I'm tired of rezipping all of my files. You can get gauranteed up to date code(pulls straight from my bot dir) here.

http://www.craized.net/junk/bebot/highlight.php?Teams
http://www.craized.net/junk/bebot/highlight.php?Loot
http://www.craized.net/junk/bebot/highlight.php?Playfield
http://www.craized.net/junk/bebot/highlight.php?Timer

The Teams Loot and Playfield I highly recommend updating as I've found some major bugs, one of which is the Playfield timer gradually pulling away from the correct time. This may still be the case, but the best I can do is keep adjusting it until I get it right.

Thank you all for your support in this process.
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline Zacix

  • Contributor
  • *******
  • Posts: 73
  • Karma: +0/-0
Teams module - Unofficial realease
« Reply #58 on: April 22, 2005, 10:37:55 am »
Updated the teams module with /tell <Botname> !teams admin command and rewamped some of the code. !teams num # is now limited to 50...guess that could be changed.
Code: [Select]
<?php
/*
* Teams Module for BE Bot <http://bebot.fieses.net>
* Module coded by Craized <http://www.craized.net>
* Special thanks to Lal for bug fixes, styles, and development
* Rewritten by Zacix

/*
Add a "_" at the beginning of the file (Teams.php) if you do not want it to be loaded.
*/


$teams = new Teams($bot);
$commands["tell"]["teams"] = &$teams;
$commands["pgmsg"]["teams"] = &$teams;
$commands["pgjoin"][] = &$teams;
$commands["pgleave"][] = &$teams;

/*
The Class itself...
*/
class Teams {
var $bot;
var $pgroup;
/*
Constructor:
Hands over a referance to the "Bot" class.
*/
function Teams (&$bot) {
$this -> bot = &$bot;
$this -> autonum true;
$this -> teammode stay;
if(!$this -> bot -> highlight_color) {
$this -> highlight "<font color=#CB11C9>";
}
else {
$this -> highlight "<font color=" $this -> bot -> highlight_color ">";
}
}

function tell($name$msg) {
$highlight $this -> highlight;
$msg explode(" "$msg);
if($this -> autonum == true) {
$numteams $this -> teams;
}
else {
$numteams $this -> numteam;
}

if ($msg[1] == "") {
$this->print_teams();
}
elseif(preg_match("#^[1-9]#"$msg[1])) {
$this->assign_team($name,$msg[1],$msg[2]);
}
elseif(preg_match("#^0#"$msg[1])) {
$this->remove_team($name,$msg[2]);
}
elseif($msg[1] == num) {
$this->set_num($name,$msg[2]);
}
elseif($msg[1] == "clear") {
$this->clear_team($name);
}
elseif($msg[1] == "mode") {
$this->set_mode($name,$msg[2]);
}
elseif($msg[1] == "admin") {
$this->admin_team($name,$msg[2]);
}
}

/*
This gets called on a msg in the privgroup with the command
*/
function pgmsg($name$msg)   {
$highlight $this -> highlight;
$msg explode(" "$msg);
if($this -> autonum == true) {
$numteams $this -> teams;
}
else {
$numteams $this -> numteam;
}

if ($msg[1] == "") {
$this->print_teams();
}
elseif(preg_match("#^[1-9]#"$msg[1])) {
$this->assign_team($name,$msg[1],$msg[2]);
}
elseif(preg_match("#^0#"$msg[1])) {
$this->remove_team($name,$msg[2]);
}
elseif($msg[1] == num) {
$this->set_num($name,$msg[2]);
}
elseif($msg[1] == "clear") {
$this->clear_team($name);
}
elseif($msg[1] == "mode") {
$this->set_mode($name,$msg[2]);
}
}

function admin_team($name) {
$highlight $this -> highlight;
$yellow "<font color=#ffff00>";
if($this->is_allowed($name)) {
if($this -> autonum == true) {
$numteams $this -> teams;
}
else {
$numteams $this -> numteam;
}

$result .= $yellow ":::: Teams Administration ::::</font>\n\n";
$result .= $highlight "Commands:</font>\n";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams admin'>Refresh Teams Administration</a>\n";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams'>Show Teams</a>\n";
$result .= "Set Number of Teams <a href='chatcmd:///tell <botname> <pre>teams num auto'>Auto</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 1'>1</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 2'>2</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 3'>3</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 4'>4</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 5'>5</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 6'>6</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 7'>7</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 8'>8</a> ";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams num 9'>9</a>\n";
$result .= "<a href='chatcmd:///tell <botname> <pre>teams clear'>Clear Teams</a>\n\n ";

for($num=1$num<=$numteams$num++) {
$count 0;
foreach($this -> team[$num] as $player=>$value) {
if($value != "gone") {
$count++;
}
}
$result .= "Team " $num $highlight " (" $count ")</font>: ";
$count count($this -> team[$num]);
$membnum 1;
for($spot=1$spot<=$count$spot++) {
if($this -> team[$num][$spot] && $this -> team[$num][$spot] != "gone") {
$result .= "[" $this -> team[$num][$spot] . "] ";
$membnum++;
}
}
if ($membnum == 1) { $result .= $highlight "None</font>"; }
$result .= "\n";
}
$result .= $highlight "Unteamed:</font>\n";
unset($unteamed);
foreach($this -> pgroup as $player=>$team) {
if($team == "lft") {
$result .= $highlight "[" $player "] </font> ";
$result .= "Add to team: ";
for($num=1$num<=$numteams$num++) {
$result .=  "<a href='chatcmd:///tell <botname> <pre>teams " $num " " $player "'>" $num "</a> ";
}
$unteamed true;
$result .= "\n";
}
}
$result $this -> bot -> make_blob("Show teams"$result);
$this -> bot -> send_tell($name$result);
unset($result);
}
}


function is_allowed($name) {
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
return true;
}
return false;
}


function set_mode($name,$mode) {
$highlight $this -> highlight;
if($this->is_allowed($name)) {
if(!$mode) {
$this -> bot -> send_pgroup("Teams mode currently set to $highlight.  $this -> teammode ".");
}
if($mode == "stay") {
$this -> teammode stay;
$this -> bot -> send_pgroup("Teams mode set to$highlight stay</font>.");
}
elseif($mode == "kick") {
$this -> teammode kick;
$this -> bot -> send_pgroup("Teams mode set to$highlight kick</font>.");
}
}
}


function clear_team($name) {
$highlight $this -> highlight;
if($this->is_allowed($name)) {
foreach($this -> pgroup as $player=>$value) {
if($this -> left[$player]) {
unset($this -> pgroup[$player]);
}
else {
$this -> pgroup[$player] = "lft";
}
unset($this -> team);
}
$this -> bot -> send_pgroup("Current teams configuration cleared by " $highlight $name "</font>.");
}
}


function set_num($name,$num) {
$highlight $this -> highlight;
if($this->is_allowed($name)) {
if($num == auto) {
$this -> autonum true;
foreach($this -> pgroup as $player=>$value) {
$this -> pgroup[$player] = "lft";
unset($this -> team);
}
$this -> bot -> send_pgroup("Maximum number of teams set to$highlight automatic</font>.");
}
elseif(preg_match("#^[1-9]$|^[1-4][0-9]$|^[1-5]0$#"$num)) {
$this -> numteam $num;
$this -> bot -> send_pgroup("Maximum number of teams set to$highlight " $num "</font>.");
$this -> autonum false;
}
}
}


function remove_team($name,$assignee) {
$highlight $this -> highlight;
if(!$assignee) {
$user $name;
}
else {
if($this -> bot -> commands[pgmsg][leader] -> raidleader == $name || $this -> bot -> admin -> in_group($name"raidleader") || $this -> bot -> admin -> in_group($name"admin")) {
$user ucfirst($assignee);
}
}
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $user){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
if($this -> left[$user]) {
unset($this -> pgroup[$user]);
}
else {
$this -> pgroup[$user] = "lft";
}
$this -> bot -> send_pgroup($highlight $user "</font> is looking for team</font>.");
}


function assign_team($name,$team,$assignee) {
$highlight $this -> highlight;
if($this -> autonum == true) {
$numteams $this -> teams;
}
else {
$numteams $this -> numteam;
}
if($numteams >= $team) {
$spot count($this -> team[$team])+1;
$count 1;
for($teamnum=1$teamnum <= $numteams$teamnum++) {
foreach($this -> team[$teamnum] as $key => $value) {
if($value == $teamnum) {
$count++;
}
}
}
if ($count <= 6){
if($assignee == "") {
if($this -> pgroup[$name] != $team) {
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $name){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
$this -> team[$team][$spot] = $name;
$this -> pgroup[$name] = $team;
$this -> bot -> send_pgroup($highlight $name "</font> assigned to team " $highlight "#" $team "</font>.");
}
else {
$this -> bot -> send_pgroup($highlight $name "</font> is already in team " $highlight "#" $team "</font>.");
}
}
else {
if($this->is_allowed($name)) {
$user ucfirst($assignee);
if($numteams >= $team) {
if($this -> pgroup[$user]) {
if($this -> pgroup[$user] != $team) {
foreach($this -> team as $team1=>$spot1) {
foreach($this -> team[$team1] as $spot1=>$spot2) {
if($this -> team[$team1][$spot1] == $user){
$oldspot $spot1;
$oldteam $team1;
}
}
}
$this -> team[$oldteam][$oldspot] = "gone";
$this -> team[$team][$spot] = $user;
$this -> pgroup[$user] = $team;
$this -> bot -> send_pgroup($highlight $user "</font> assigned to team$highlight #" $team "</font>.");
}
else {
$this -> bot -> send_pgroup($highlight $user "</font> is already in team$highlight #" $team "</font>.");
}
}
else {
$this -> bot -> send_pgroup($highlight $user "</font> is not in$highlight " ucfirst($this -> bot -> botname) . "</font>.");
}
}
}
}
}
else {
$this -> bot -> send_pgroup("Team$highlight #" $team "</font> is full.");
}
}
}


function print_teams() {
$highlight $this -> highlight;
if($this -> autonum == true) {
$numteams $this -> teams;
}
else {
$numteams $this -> numteam;
}
for($num=1$num<=$numteams$num++) {
$count 0;
foreach($this -> team[$num] as $player=>$value) {
if($value != "gone") {
$count++;
}
}
$result .= "Team" $num $highlight " ($count)</font>: ";
$count count($this -> team[$num]);
$membnum 1;
for($spot=1$spot<=$count$spot++) {
if($this -> team[$num][$spot] && $this -> team[$num][$spot] != "gone") {
$result .= $highlight "[" $this -> team[$num][$spot] . "] </font>";
$membnum++;
}
}
if ($membnum == 1) { $result .= $highlight "None</font>"; }
$this -> bot -> send_pgroup($result);
unset($result);
}
$result .= "Unteamed: ";
unset($unteamed);
$players 1;
foreach($this -> pgroup as $player=>$team) {
if($team == "lft") {
$result .= $highlight "[" $player "] </font>";
$players++;
$unteamed true;
}
}
if ($players == 1) {
$result .= $highlight "None</font>";
}
$this -> bot -> send_pgroup($result);
}

/*
This gets called if someone joins the privgroup
*/
function pgjoin($name) {
if($this -> left[$name]) {
unset($this -> left[$name]);
}
if(!$this -> pgroup[$name]) {
$this -> pgroup[$name] = "lft";
$this -> teams ceil(count($this -> pgroup)/6);
}
}



/*
This gets called if someone leaves the privgroup
*/
function pgleave($name) {
if ($this -> pgroup[$name] == "lft") {
unset($this -> pgroup[$name]);

else {
if($this -> teammode == stay) {
$this -> left[$name] = true;

else {
foreach($this -> team[$this -> pgroup[$name]] as $spot=>$spot2) {
if($this -> team[$this -> pgroup[$name]][$spot] == $name) {
$this -> team[$this -> pgroup[$name]][$spot] = gone;
unset($this -> pgroup[$name]);
}
}
}
}
}
}
?>

Zacix
Current projects:
RINGBot, BeBot branch
Neutnet, RK2 Neutral massmessage network

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Custom modules
« Reply #59 on: April 23, 2005, 05:33:17 am »
Great work! I've made a tweak, I removed the 50 team limit, a preference I spose, removed an extraneous space, and added a player count to the unteamed section.
http://www.craized.net/junk/bebot/highlight.php?Teams
I'm tired of rezipping everything, so get my code here if you want.
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 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: 97
  • 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