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: Modified RaidSingle  (Read 6148 times)

0 Members and 1 Guest are viewing this topic.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Modified RaidSingle
« on: May 20, 2005, 11:22:49 pm »
Changes:

Added support for adding mutiple points.

RaidSingle Module

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Modified RaidSingle
« Reply #1 on: November 21, 2005, 08:37:02 pm »
Made some changes to this one, added !raid add <player> for leaders when the raid is locked,

made the leader-only commands leader/admin only,

fixed !raid check so it doesnt return the list of players if theres no raid going on and...

fixed !raid kick so you dont have to uppercase the first letter

[ see updated code below ]

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Modified RaidSingle
« Reply #2 on: November 21, 2005, 08:38:16 pm »
and here is the new help file, that goes in help/raid.txt

Code: [Select]
<font color=CCInfoHeader><pre>raid (join|leave)</font>
<font color=CCInfoText>Makes you join/leave the raid.

<font color=CCInfoHeader><pre>raid (start|stop)</font>
Starts/Stops the raid.
Once the raid is started people can join the raid and gain points.

<font color=CCInfoHeader><pre>raid kick &lt;nickname&gt;</font>
Removes &lt;nickname&gt; from the raid.

<font color=CCInfoHeader><pre>raid add &lt;nickname&gt;</font>
Adds &lt;nickname&gt; to a locked raid.

<font color=CCInfoHeader><pre>raid (lock|unlock)</font>
Locks/Unlocks the raid makeing it possible/not possible for more to join.

<font color=CCInfoHeader><pre>raid check</font>
Makes a list to check if all members in the raid are also present.

<font color=CCInfoHeader><pre>raid point [number]</font>
Awards points to active raiders. If no number is given, raiders will be given one point</font>

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Modified RaidSingle
« Reply #3 on: December 03, 2005, 11:29:20 pm »
made more changes (I forgot I had changed this before...) anyway

added aliases for !raid join, !joinraid and !raidjoin, cause everyone tries those

added a !raiders command, that is the same as !online but shows people that joined the raid

also added !startraid / !raidstart aliases just for kicks

edited: added leaveraid/raidleave........

Code: [Select]
<?
  /*
   * Raid.php - Announces a raid.
   *
   * BeBot - An Anarchy Online Chat Automaton
   * Copyright (C) 2004 Jonas Jax
   *
   * Developed by Blondengy (RK1)
   * Special thanks goes out to Khalem (RK1) for his support.
   *
   * Modified by Glarawyn (RK1). raid point can now add mutiple points instead of just one.
   *
   * Modified again by Wanuarmi (RK1). joinraid/raidjoin/startraid/raidstart aliases, !raiders cmd
   *
   * File last changed at $LastChangedDate: 2005-05-20 16:04:32 -0600 (Fir, 20 May 2005) $
   * Revision: $Id: RaidSingle_RAID.php 9 2005-05-20 10:04:32Z Glarawyn $
   */


 
  $raid = new Raid($bot);

  $commands["tell"]["raid"] = &$raid;
  $commands["pgmsg"]["raid"] = &$raid;
 
  $commands["tell"]["raidjoin"] = &$raid;
  $commands["pgmsg"]["raidjoin"] = &$raid;
  $commands["tell"]["joinraid"] = &$raid;
  $commands["pgmsg"]["joinraid"] = &$raid;

  $commands["tell"]["raidstart"] = &$raid;
  $commands["pgmsg"]["raidstart"] = &$raid;
  $commands["tell"]["startraid"] = &$raid;
  $commands["pgmsg"]["startraid"] = &$raid;

  $commands["tell"]["raidleave"] = &$raid;
  $commands["pgmsg"]["raidleave"] = &$raid;
  $commands["tell"]["leaveraid"] = &$raid;
  $commands["pgmsg"]["leaveraid"] = &$raid;

  $commands["tell"]["raiders"] = &$raid;
  $commands["pgmsg"]["raiders"] = &$raid;

  $commands["pgleave"][] = &$raid;
  $commands["connect"][] = &$raid;


  /*
    The Class itself...
  */
  class Raid
  {
    var $bot;
    var $raid;
    var $user;
    var $announce;
    var $start;
    var $locked;
   
   

    /*
      Constructor:
        Hands over a referance to the "Bot" class.
    */
    function Raid (&$bot)
    {
      $this -> bot = &$bot;
      $this -> raid = false;
      $this -> user = array();
      $this -> announce = 0;
      $this -> locked = false;
    }



    /*
      This gets called on a tell with the command
    */
    function tell($name, $msg)
    {
if (preg_match("/^" . $this -> bot -> commpre . "raid start$/i", $msg))
$this -> start_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raidstart$/i", $msg))
$this -> start_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "startraid$/i", $msg))
$this -> start_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raid add (.+)$/i", $msg, $info))
$this -> addto_raid($name, $info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "raid (stop|end)$/i", $msg))
$this -> end_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raid join$/i", $msg))
$this -> join_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raidjoin$/i", $msg))
$this -> join_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "joinraid$/i", $msg))
$this -> join_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raiders$/i", $msg))
$this -> bot -> send_tell($name, $this -> raiders());
else if (preg_match("/^" . $this -> bot -> commpre . "raid leave$/i", $msg))
$this -> leave_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raidleave$/i", $msg))
$this -> leave_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "leaveraid$/i", $msg))
$this -> leave_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raid kick (.+)$/i", $msg, $info))
$this -> kick_raid($name, $info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "raid check$/i", $msg))
$this -> check_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raid (lock|unlock)$/i", $msg, $info))
$this -> lock_raid($name, $info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "raid point$/i", $msg))
$this -> add_point($name);
                        else if (preg_match("/^" . $this -> bot -> commpre . "raid point ([0-9]+)$/i", $msg, $info))
                                $this -> add_points($name, $info[1]);

/* else if (preg_match("/^" . $this -> bot -> commpre . "raid mpoint [1-9]$/", $msg))
{
$this -> add_mpoint($name, $msg);
}*/
else
$this -> bot -> send_help($name);
    }



    /*
      This gets called on a msg in the privgroup with the command
    */
    function pgmsg($name, $msg)
    {
if (preg_match("/^" . $this -> bot -> commpre . "raid start$/i", $msg))
$this -> start_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raidstart$/i", $msg))
$this -> start_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "startraid$/i", $msg))
$this -> start_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raid add (.+)$/i", $msg, $info))
$this -> addto_raid($name, $info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "raid (stop|end)$/i", $msg))
$this -> end_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raid join$/i", $msg))
$this -> join_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raidjoin$/i", $msg))
$this -> join_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "joinraid$/i", $msg))
$this -> join_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raiders$/i", $msg))
$this -> bot -> send_pgroup($this -> raiders());
else if (preg_match("/^" . $this -> bot -> commpre . "raid leave$/i", $msg))
$this -> leave_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raid kick (.+)$/i", $msg, $info))
$this -> kick_raid($name, $info[1]);
else if (preg_match("/^" . $this -> bot -> commpre . "raid check$/i", $msg))
$this -> check_raid($name);
else if (preg_match("/^" . $this -> bot -> commpre . "raid (lock|unlock)$/i", $msg, $info))
$this -> lock_raid($name, $info[1]);
    }



    /*
      This gets called if someone leaves the privgroup
    */
    function pgleave($name)
    {
if (isset($this -> user[$name]))
{
unset($this -> user[$name]);
$this -> bot -> send_pgroup("<font color=#ffff00>$name</font> was removed from the raid.");
$this -> bot -> db -> query("UPDATE raid_points SET raiding = 0 WHERE id = " . $this -> points_to($name));
}
    }



    /*
      This gets called on cron
    */
    function connect()
    {
    $this -> bot -> db -> query("UPDATE raid_points SET raiding = 0");
    }
       


/*
Starts a Raid
*/
function start_raid($name)
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
if (!$this -> raid)
{
  $this -> raid = true;
  $this -> start = time();
  $this -> bot -> send_pgroup("<font color=#ffff00>$name</font> has started the raid :: " . $this -> clickjoin());
  }
  else
  $this -> bot -> send_tell($name, "Raid already running.");
}
else
$this -> bot -> send_tell($name, "You must be a raid leader to do this");
}



/*
Ends a Raid
*/
function end_raid($name)
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
if ($this -> raid)
{
  $this -> raid = false;
  $this -> announce = 0;
  unset($this -> bot -> cron["1min"]["raid"]);
  $this -> user = array();
  $this -> bot -> send_pgroup("<font color=#ffff00>$name</font> has stopped the raid.");
  $this -> bot -> db -> query("UPDATE raid_points SET raiding = 0");
  $this -> locked = false;
  }
  else
  $this -> bot -> send_tell($name, "No raid running.");
}
else
$this -> bot -> send_tell($name, "You must be a raid leader to do this");
}



/*
Adds a point to all raiders
*/
function add_point($name)
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
$this -> bot -> send_pgroup("<font color=#ffff00>1</font> point has been added to all raiders.");
  $this -> bot -> db -> query("Update raid_points SET points = points + 10 WHERE raiding = 1");
}
else
$this -> bot -> send_tell($name, "You must be a raid leader to do this");
}
/* Adds mutiple points to all raiders */
function add_points($name, $num)
{
                        if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
                        {
$this -> bot -> send_pgroup("<font color=#ffff00>$num</font> points have been added to all raiders.");
$this -> bot -> db -> query("Update raid_points SET points = points + ($num*10) WHERE raiding = 1");
                        }
                        else
                                $this -> bot -> send_tell($name, "You must be a raid leader to do this");
    }

/*
Joins a Raid
*/
function join_raid($name)
{
if (isset($this -> user[$name]))
$this -> bot -> send_tell($name, "You are already in the raid", 1);
else if ($this -> locked)
$this -> bot -> send_tell($name, "The raid status is currently <font color=#ffff00>locked</font>.");
else if ($this -> raid)
{
$id = $this -> points_to($name);

$result = $this -> bot -> db -> select ("SELECT id FROM raid_points WHERE id = " . $id);
if (empty($result))
          $this -> bot -> db -> query("INSERT INTO raid_points (id, points, raiding) VALUES (" . $id . ", 0, 0)");

$this -> user[$name] = $this -> bot -> aoc -> get_uid($name);
$this -> bot -> send_pgroup("<font color=#ffff00>$name</font> has <font color=#ffff00>joined</font> the raid :: " . $this -> clickjoin());
$this -> bot -> db -> query("UPDATE raid_points SET raiding = 1 WHERE id = " . $id);
}
else
$this -> bot -> send_tell($name, "No raid in progress");
}



/*
Adds a player to Raid
*/
function addto_raid($name, $player)
{
$player = ucfirst(strtolower($player));
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
if (isset($this -> user[$player]))
$this -> bot -> send_tell($name, "$player is already in the raid", 1);
else if ($this -> raid)
{
$id = $this -> points_to($player);

$result = $this -> bot -> db -> select ("SELECT id FROM raid_points WHERE id = " . $id);
if (empty($result))
         $this -> bot -> db -> query("INSERT INTO raid_points (id, points, raiding) VALUES (" . $id . ", 0, 0)");

$this -> user[$player] = $this -> bot -> aoc -> get_uid($player);
$this -> bot -> send_pgroup("<font color=#ffff00>$player</font> was <font color=#ffff00>added</font> to the raid :: " . $this -> clickjoin());
$this -> bot -> db -> query("UPDATE raid_points SET raiding = 1 WHERE id = " . $id);
}
else
$this -> bot -> send_tell($name, "No raid in progress");
}
}



/*
Leaves a Raid
*/
function leave_raid($name)
{
if (!isset($this -> user[$name]))
$this -> bot -> send_tell($name, "You are not in the raid.", 1);
else
{
unset($this -> user[$name]);
$this -> bot -> send_pgroup("<font color=#ffff00>$name</font> has <font color=#ffff00>left</font> the raid :: " . $this -> clickjoin());
$this -> bot -> send_tell($name, "You have <font color=#ffff00>left</font> the raid.", 1);
$this -> bot -> db -> query("UPDATE raid_points SET raiding = 0 WHERE id = " . $this -> points_to($name));
}
}



/*
Kicks someone from the raid
*/
function kick_raid($name, $who)
{
$who = ucfirst(strtolower($who));
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
  if (!isset($this -> user[$who]))
  $this -> bot -> send_tell($name, "<font color=#ffff00>$who</font> is not in the raid.");
  else
  {
  unset($this -> user[$who]);
  $this -> bot -> send_pgroup("<font color=#ffff00>$who</font> was kicked from the raid.");
  $this -> bot -> send_tell($who, "<font color=#ffff00>$name</font> kicked you from the raid.");
 $this -> bot -> db -> query("UPDATE raid_points SET raiding = 0 WHERE id =" . $this -> points_to($who));
  }
}
else
$this -> bot -> send_tell($name, "You must be a raid leader to do this");
}



/*
Checks memebers on a raid
*/
function check_raid($name)
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
if (!($this -> raid))
{
$this -> bot -> send_tell($name, "No raid in progress");
return;
}
$players = array_keys($this -> user);
sort($players);

        $inside = "<font color=CCInfoHeadline>:::: People at the raid ::::</font><font color=CCInfoText>\n\n";
        if (!empty($players))
foreach ($players as $player)
{
$inside .= "<font color=CCInfoHeader>[<a href='chatcmd:///assist $player'>check</a>]</font> " .
$player . "<font color=CCInfoHeader> [<a href='chatcmd:///tell <botname> " .
"<pre>raid kick $player'>kick player</a>]</font>\n";
}
$this -> bot -> send_tell($name, "Players in raid :: " .
$this -> bot -> make_blob("click to view", $inside . "</font>"));
}
else
$this -> bot -> send_tell($name, "You must be a raid leader to do this");
}



function raiders()
{
if (!($this -> raid))
{
return "No raid in progress";
}
$players = array_keys($this -> user);
sort($players);

$inside = "<font color=CCInfoHeadline>:::: Raiders ::::</font><font color=CCInfoText>\n\n";
if (!empty($players))
{
foreach ($players as $player)
{
$inside .= "<font color=CCInfoHeader>[<a href='chatcmd:///assist $player'>check</a>]</font> " . $player . "\n";
}
$raiders = count($players);
return "<font color=#ffff00>$raiders</font> Raiders :: " . $this -> bot -> make_blob("click to view", $inside . "</font>");
}
else
{
return "No players in raid.";
}
}



/*
Locks/unlocks a Raid
*/
function lock_raid($name, $lock)
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
if (strtolower($lock) == "lock")
{
$this -> locked = true;
$this -> bot -> send_pgroup("<font color=#ffff00>$name</font> has <font color=#ffff00>locked</font> the raid.");
}
else
{
$this -> locked = false;
$this -> bot -> send_pgroup("<font color=#ffff00>$name</font> has <font color=#ffff00>unlocked</font> the raid.");
}
}
else
$this -> bot -> send_tell($name, "You must be a raid leader to do this");
}



/*
Make click to join blob
*/
function clickjoin()
{
        $inside = "<font color=CCInfoHeadline>:::: Join/Leave Raid ::::</font>\n\n";
        $inside .= " - <a href='chatcmd:///tell <botname> <pre>raid join'>Join the raid</a>\n";
        $inside .= " - <a href='chatcmd:///tell <botname> <pre>raid leave'>Leave the raid</a>\n";

        return $this -> bot -> make_blob("click to join", $inside);
}



/*
Get correct char for points
*/
function points_to($name)
{
return $this -> bot -> commands["tell"]["points"] -> points_to($name);
}
  }
?>

Offline Akarah

  • Contributor
  • *******
  • Posts: 72
  • Karma: +0/-0
    • http://synergyfactor.net/
Modified RaidSingle
« Reply #4 on: December 03, 2005, 11:46:29 pm »
Quote from: "Wanuarmi"

added a !raiders command, that is the same as !online but shows people that joined the raid


awesome addition. thanks :)

Offline Wanuarmi

  • Contributor
  • *******
  • Posts: 121
  • Karma: +0/-0
Re: Modified RaidSingle
« Reply #5 on: December 22, 2005, 12:30:14 am »
theres a bug in this module that lets people join raid without being in the privategroup, which beats the script removing someone from raid when he leave the group. ill try to fix and post it again

Offline eracet1

  • BeBot User
  • **
  • Posts: 20
  • Karma: +0/-0
Re: Modified RaidSingle
« Reply #6 on: June 11, 2006, 09:45:23 am »
Trying this Module but having a problem with This error

Parse error: syntax error, unexpected T_STRING in C:\bbot\modules\raidsingle.php on line 21


Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: Modified RaidSingle
« Reply #7 on: June 20, 2006, 07:56:44 pm »
Copy-paste that line for us?

220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline laen

  • BeBot User
  • **
  • Posts: 24
  • Karma: +0/-0
Re: Modified RaidSingle
« Reply #8 on: June 23, 2006, 07:48:37 am »
What i would love to see though, is the way IGN bot handles things (http://bebot.shadow-rea...421.msg2645.html).

And even more important, a permanent history of every raid.. so for a raid thats held, start and endtime, who was in it, and who got how many points..

That way you would be able to see a !raid history or something, and i can create a php script myself (really don't need a webcast module for it) that loads the history onto the website..
« Last Edit: June 23, 2006, 07:50:20 am by lcidw »

Offline eracet1

  • BeBot User
  • **
  • Posts: 20
  • Karma: +0/-0
Re: Modified RaidSingle
« Reply #9 on: June 24, 2006, 11:49:11 am »
Copy-paste that line for us?



There is nothing on that line.
Its just after    * Revision: $Id: RaidSingle_RAID.php 9 2005-05-20 10:04:32Z Glarawyn $
   */
 and right before
  $raid = new Raid($bot);

 

* 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: 303
  • 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