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

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

Author Topic: modified alts  (Read 38150 times)

0 Members and 2 Guests are viewing this topic.

Offline Akarah

  • Contributor
  • *******
  • Posts: 72
  • Karma: +0/-0
    • http://synergyfactor.net/
modified alts
« on: November 27, 2005, 02:57:02 pm »
this is actually a custom core change, not a module, but i added in a "altadmin" feature, so admins can add alts to mains, when they recruit the alt.

add to the commands array init:
Code: [Select]

  $commands["tell"]["altadmin"] = &$alts;


find this in function tell:
Code: [Select]

      else if (preg_match("/^" . $this -> bot -> commpre . "alts$/i", $msg))
        $this -> bot -> send_tell($name, $this -> show_alt($name, $name));


add this after it, before the final else:
Code: [Select]

      else if (preg_match("/^" . $this -> bot -> commpre . "altadmin add ([a-zA-Z0-9]+) ([a-zA-Z0-9]+)$/i", $msg, $info))
        $this -> bot -> send_tell($name, $this -> add_altadmin($info[1], $info[2]));
      else if (preg_match("/^" . $this -> bot -> commpre . "altadmin (rem|del) ([a-zA-Z0-9]+) ([a-zA-Z0-9]+)$/i", $msg, $info))
        $this -> bot -> send_tell($name, $this -> remove_altadmin($info[2], $info[3]));


then, after add_alt and remove_alt functions, add these two:
Code: [Select]

function add_altadmin($main, $alt)
{
  if ((!$this -> bot -> aoc -> get_uid($alt)) || (!$this -> bot -> aoc -> get_uid($main)))
    return "Character <font color=#ffff00>" . $main . "</font> or <font color=#ffff00>" . $alt . "</font> does not exist.";
  else
  {
    $result = $this -> bot -> db -> select("SELECT main FROM alts WHERE alt = '" . ucfirst(strtolower($main)) . "'");
    $result2 = $this -> bot -> db -> select("SELECT main FROM alts WHERE alt = '" . ucfirst(strtolower($alt)) . "' OR main = '" . ucfirst(strtolower($alt)) . "'");
    if (!empty($result))
      return "<font color=#ffff00>" . $main . "</font> is registered as an alt of <font color=#ffff00>" . $result[0][0] . "</font> and cannot have alts registered to it.";
    else if (!empty($result2))
      return "<font color=#ffff00>" . $alt . "</font> already exists in the database.";
    else
    {
      $this -> bot -> db -> query("INSERT INTO alts (alt, main) VALUES
                                  ('" . ucfirst(strtolower($alt)) . "', '" . ucfirst(strtolower($main)) . "')");
      return "<font color=#ffff00>" . $alt . "</font> has been registered to <font color=#ffff00>" . $main . "</font>.";
    }
  }
}

function remove_altadmin($main, $alt)
{
  if ((!$this -> bot -> aoc -> get_uid($alt)) || (!$this -> bot -> aoc -> get_uid($main)))
    return "Character <font color=#ffff00>" . $main . "</font> or <font color=#ffff00>" . $alt . "</font> does not exist.";
  else
  {
    $result = $this -> bot -> db -> select("SELECT main FROM alts WHERE alt = '" . ucfirst(strtolower($alt)) . "' AND main = '" . ucfirst(strtolower($main)) . "'");
    if (empty($result))
      return "<font color=#ffff00>" . $alt . "</font> is not registered to <font color=#ffff00>" . $main . "</font>.";
    else
    {
      $this -> bot -> db -> query("DELETE FROM alts WHERE alt = '" . ucfirst(strtolower($alt)) . "'");
      return "<font color=#ffff00>" . $alt . "</font> has been removed from the database.";
    }
  }
}


standard disclaimer applies, of course :)

Offline Akarah

  • Contributor
  • *******
  • Posts: 72
  • Karma: +0/-0
    • http://synergyfactor.net/
modified alts
« Reply #1 on: November 27, 2005, 03:07:56 pm »
this actually depends on custom rights management, as i do not check if $name is actually an admin before sending it to add/remove_altadmin functions. so to use it you'll have to /tell yourbot !commands enable tell altadmin Admin first.

can add these 2 lines to the end of $botdir/help/alts.txt :
Code: [Select]


<font color=CCInfoHeader><pre>altadmin (add|rem) &lt;mainname&gt; &lt;altname&gt;</font>
<font color=CCInfoText>Adds/Removes &lt;altname&gt; to &lt;mainname&gt; (Admin only)


could be redone more foolproof, but ehh :)

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: modified alts
« Reply #2 on: January 19, 2006, 04:47:47 am »
Thanks for this mod. I took it a step further.


http://zibby.isa-geek.net/bebot/PointsToMainAlts.zip

This modification is inteded for raidbots with PointsToMain set to on. The default Alts module pretty much allows stealing of raid points using the Alts command. This mod only allows users to view alts. Raidleaders, Admins, and Superadmins are allowed to add/remove alts.

I just borrowed Akarah's code, took out what wasn't needed, added security checks, and called it dun. :)

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified alts
« Reply #3 on: January 20, 2006, 05:16:06 pm »
Problem with this one.
If an admin tries to remove an Alt that is a Deleted character you'll get the "Character <main> or <alt> does not exist." reply.

BTW... check it. My custom version of Alts looks like this:
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: modified alts
« Reply #4 on: January 20, 2006, 06:17:21 pm »
Problem with this one.
If an admin tries to remove an Alt that is a Deleted character you'll get the "Character <main> or <alt> does not exist." reply.

To [Campalot]: !alts del Lilredhot Glarawyn
Campalot: Glarawyn is not registered to Lilredhot.
To [Campalot]: !alts del Glarawyn Lilredhot
Campalot: Lilredhot has been removed from the database.

Seems alright... :)

But I see what you mean with the deleted character thing. But that shouldn't be an issue for a raid bot only allowing 190+ characters. :p

I blame Akarah. I just stole Akarah's code and changed the inputs and security around.  :P
« Last Edit: January 20, 2006, 06:22:48 pm by Glarawyn »

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified alts
« Reply #5 on: January 20, 2006, 11:03:14 pm »
Oh, sorry Glara, it was Akarah's code I was refering to.  :o

I fixed it already for my bot by removing the (!$this -> bot -> aoc -> get_uid($alt)) and left the check for Mains name in the remove functions for both altadmin and player. Figured the Database check on alts name was enough. :)
« Last Edit: January 20, 2006, 11:09:02 pm by Xenixa »
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Akarah

  • Contributor
  • *******
  • Posts: 72
  • Karma: +0/-0
    • http://synergyfactor.net/
Re: modified alts
« Reply #6 on: January 21, 2006, 02:41:33 pm »
yeah i just needed to add altadmin for adding alts, not deleting really..

usually all problems can be solved by a DELETE in mysql anyway ;)

Offline buff

  • BeBot User
  • **
  • Posts: 36
  • Karma: +0/-0
Re: modified alts
« Reply #7 on: March 23, 2006, 09:30:00 pm »
Xenixa:

Do you mind to share out how you did the last seen+alts?
That looks very nice and really hope to have a taste of it also ;)

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified alts
« Reply #8 on: March 23, 2006, 10:03:22 pm »
Sure, you'll need a few things to make it work.

1) My Rooster_GUILD module (Xens_Rooster_GUILD.php)
2) My modified Alts module (Alts.php)

Both can be found on my FTP server here: ftp://xen.afraid.org/bebot_files/
Rename Xens_Rooster_GUILD.php to just Rooster_GUILD.php and place in /modules folder
Place Alts.php in /core folder

That Rooster_GUILD uses a different Members Table layout by the way from the default one. There's a Alter Table statement in the file you can use to adjust it using a MySQL query tool. Should look like this:
Code: [Select]
ALTER TABLE members, DROP COLUMN pic, DROP COLUMN lvlrange, ADD COLUMN lastseen INT(11) DEFAULT '0' NOT NULL after aititle, ADD COLUMN updated INT(11) after lastseen
Should all just snap right in.
You may want to review this thread also incase I missed something here:
http://bebot.link/index.php/topic,288.0.html
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline buff

  • BeBot User
  • **
  • Posts: 36
  • Karma: +0/-0
Re: modified alts
« Reply #9 on: March 24, 2006, 04:34:47 am »
downloaded and it works nicely
got an error when i do !member <name> command

Incorrected integer value: '' for column 'rank' at row 1

and it won't add member to my memberl in mySQL db :(


also for the last seen if the member never been online after added
i get this error

Out of range value adjusted for column 'lastseen' at row 1
« Last Edit: March 24, 2006, 05:25:16 am by buff »

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified alts
« Reply #10 on: March 24, 2006, 12:33:19 pm »
Hmm never seen those occur on mine. What version of MySQL server you running btw? When you set up the Members table did you verify that the it set Default for lastseen column to '0'? That would fix the "Out of range value" error when a member is added but hasn't been seen by the bot yet.

As for the Rank column I forgot I had set it to default to '0' in the Database table directly but didn't update the code that sets up the table. So make sure 'rank' is set as a tinyint(4) and the default is '0'.

P.S. I just tested my Rooster_GUILD code on my test setup with MySQL v5.0.18, PHP v5.1.2.2 and the latest v0.3.2 Bebot Code base(using AOChat v1.19 and the new AOKex.dll extension) with no errors in the console. :)
« Last Edit: March 28, 2006, 03:31:26 pm by Xenixa »
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline buff

  • BeBot User
  • **
  • Posts: 36
  • Karma: +0/-0
Re: modified alts
« Reply #11 on: March 28, 2006, 01:31:05 am »
I use new bebot 0.3.2 also but i'm using php4 not php5
I will upgrade to php5 later but right now still on 4 :)

I tweaked your code abit and I am now using lastseen.php code that is posted on forum somewhere with your alts.php file which i modified abit so it's working fine now

I also changed it so it shows the time/date the person last log on

Thanks alot for the original codes and all the help. :)

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified alts
« Reply #12 on: March 28, 2006, 03:30:04 pm »
Resolved these issues in Rooster_GUILD.php see:
 http://bebot.link/index.php/topic,288.msg2041.html#msg2041

<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: modified alts
« Reply #13 on: August 17, 2006, 10:40:05 pm »
I'm using Bebot 3.2.4, MYSQL 5.0.19, and php 4.4.2

I'm getting errors when I put your Alts file in (Your modified rooster file wouldn't update my mysql but I manually made the changes you outlined and that seems to work fine now).  When I use your alts if I do the !alts command I get:
Fatal error: Call to a member function lookup() on a non-object in C:\BeBot\core\Alts.php on line 216

I'm guessing you use the caching thing that was made but I currently don't (couldn't get it to work right).  Is that the case and is what is causing my error or am I off here?  If so how can I mod this to make it work without it?

Nevermind, got the whoiscache working and this works great!!
« Last Edit: August 18, 2006, 02:34:57 am by Dabaron »

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: modified alts
« Reply #14 on: August 18, 2006, 03:24:56 am »
I am now having a strange issue.  It works great on the first call of it, if I try and check someone else it crashes with this error:

Fatal error: Cannot use string offset as an array in C:\BeBot\Beerraid\core\Alts.php on line 233

Any ideas?

Edit: I'm using Xenixa's
« Last Edit: August 18, 2006, 03:28:44 am by Dabaron »

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


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 ]

* Who's Online
  • Dot Guests: 296
  • 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