BeBot - An Anarchy Online and Age Of Conan chat automaton

General => Feedback and Suggestions => Topic started by: Getrix on February 15, 2009, 06:05:25 pm

Title: AoC: Add PvP level to whois/logon notifie
Post by: Getrix on February 15, 2009, 06:05:25 pm
In AoC we have PvP lvl.
This isnt querie able, but what if its added a command like "!setcraft" that add it to member table?
And then also showed when doing whois.
Title: Re: AoC: Add PvP level to whois/logon notifie
Post by: Getrix on March 04, 2009, 11:09:09 pm
*Bump*

Any chance to get this?
Title: Re: AoC: Add PvP level to whois/logon notifie
Post by: Wizhk on March 05, 2009, 08:21:47 am
Yg.com has this information.

Would be nice to see on the bot.

Wizhk
Title: Re: AoC: Add PvP level to whois/logon notifie
Post by: Getrix on March 05, 2009, 11:32:10 am
YG.com is not relable imo...
They scan a specific area with a player char, taking the information out of memory the client has around him and saving it to DB.
I have alot of alts, non of they are added to YG.com. And i can see a problem on up2date profiles as you need to be in this area all the time to get it updated...

What i have made as a solution is disable "!logon" and added "!setpvp [0-5]" that will insert "PvP lvl [0-5]" where you have the "logon" messages. But i would like to have it as a PvP lvl variable so you can see it on "!whois" like you do with "!setcraft"
Title: Re: AoC: Add PvP level to whois/logon notifie
Post by: Alreadythere on March 05, 2009, 06:32:28 pm
Check out core/aoc/Whois.php for that.
Title: Re: AoC: Add PvP level to whois/logon notifie
Post by: Getrix on March 05, 2009, 07:28:00 pm
CREATE TABLE `pvplevel` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(32) NOT NULL,
  `pvplevel` int(3) default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`name`)
);

Modification needed:

core\aoc\Whois.php
Quote
291 a $who["pvplevel"] = $lookup[0]['pvplevel'];

147 a $lookup2 = $this -> bot -> db -> select("SELECT pvplevel FROM pvplevel WHERE name = '" . $name . "'", MYSQL_ASSOC);
148 a if (!empty($lookup2)) {
149 a $who["pvplevel"] = $lookup2[0]['pvplevel'];
150 a    }

291 a $who["pvplevel"] = $lookup[0]['pvplevel'];

393 m $this -> bot -> db -> query("INSERT INTO #___whois (id, nickname, level, pvplevel,"
395 m . " VALUES ('" . $who["id"] . "', '" . $who["nickname"] . "', '" . $who["level"] . "', '" . $who["pvplevel"] . "', '" . $who["class"] . "', '" . $who["craft1"] . "', '" . $who["craft2"] . "', " . $who["location"] . ", " . $who["online"] . ", "
397 m . "level = VALUES(level), pvplevel = VALUES(pvplevel), class = VALUES(class), craft1 = VALUES(craft1), craft2 = VALUES(craft2), online = VALUES(online), location = VALUES(location), "


417 a if(!empty($whois['pvplevel']))
418 a {
419 a    $window .= " ##normal##PvP Level:##end## ##highlight##{$whois['pvplevel']}##end##\n";
420 a }
a = add
m = modify

modules\aoc\setpvplvl.php

Quote
<?php
/*
 Author : Getrix

*/
$pvplevel = new pvplevel($bot);

class pvplevel extends BaseActiveModule
{
   /*
   Constructor: Hands over a referance to the "Bot" class.
   */
   function __construct (&$bot)
   {
      //Initialize the base module
      parent::__construct(&$bot, get_class($this));

                $this -> register_command('tell', 'setpvp', 'MEMBER');
                $this -> register_command('gc', 'setpvp', 'MEMBER');
       
                $this -> help['description'] = "This command adds your PvP Level to messages when you logon";
      $this -> help['command']['setpvp 0-5'] = "Set your current PvP Level.";
      $this -> help['notes'] = "Only set your real level. If abused you will get 24hr ban from bot without warning.";
   }


   /*
   Unified message handler
   $source: The originating player
   $msg: The actual message, including command prefix and all
   $type: The channel the message arrived from. This can be either "tell", "pgmsg" or "gc"
   */
   function command_handler($name, $msg, $type)
   {
      //ALWAYS reset the error handler before parsing the commands to prevent stale errors from giving false reports
      $this->error->reset();
      
      if (preg_match("/^setpvp (.+)$/i", $msg, $info)) {
                  return($this -> setpvp($info[1], $name));
      }
      else  {
               $this -> error -> set("Broken plugin, recieved unhandled command: $command");
         return($this->error->message());
      }
   }
   
   function setpvp($pvplevel, $name) {
      $sql = "SELECT char_id FROM #___users WHERE nickname = '$name'";
           $result = $this -> bot -> db -> select($sql);
           if ($this -> bot -> guildbot && !empty($result))
           {
      $char_id = $result[0][0];
      if(is_numeric($pvplevel)) {
         $this -> bot -> db -> query('INSERT INTO pvplevel (name,id,pvplevel) VALUES("'.$name.'","'.$char_id.'", "'.$pvplevel.'") ON DUPLICATE KEY UPDATE name=values(name), id=values(id), pvplevel=(pvplevel)');
         $this -> bot -> db -> query("UPDATE #___whois SET pvplevel = '" . $pvplevel . "' WHERE nickname = '" . $name . "'");
         $strmsg = "Thanks for setting your PvP Level.";
      }
      else { $strmsg = "Your pvp level '$pvplevel' is not a number!"; }
      }
      else { $strmsg = "Failed"; }

           return $strmsg;
   }
}
?>
Title: Re: AoC: Add PvP level to whois/logon notifie
Post by: Poonjab on May 29, 2009, 06:42:56 pm
Sorry to necro this thread, but I think YG profiles will soon become more reliable as they have recently released a profile updater that regular players can run on their machines while they are playing.  Any people they cross paths with during their playtime will get updated on the YG database.  I started running it last night and it seems to be working pretty well.

Beyond that, I know nothing about writing Bebot modules, but it would be great to see something that can leverage that YG profile information.
Title: Re: AoC: Add PvP level to whois/logon notifie
Post by: Keltezaa on August 20, 2009, 03:17:47 pm
i have downloaded that yg updater and tbh it will take a looong time for it to successfully update.. whit i have done is runn the app and went to conarch, running from one end of the map to the other, stopping at rez points for 15+ min, so that all players that are there or respawn there gets loged... i went to most instances.. and to top it off wrote down a few "regularly" seen characters names down..
6 zones and 3hrs later... i went online to yg and searched the characters from my list and comparing it to the site.. it failed..my test.. some members were not even listed...
so i thought mybe the site needs to refresh every 24 hours... checked again the next day.. only 2 were added. so after a week i check and ahh what do you know.. the stats are there. but it is old...:(.. i used the ingame search to look for members and compare the supposely new added info and once again it faild cause the characters were 6 lvl's ahead of the website...so if accuracy you want.. yg is to slow at this time...
ok after saying that.. cant we get a code that reads the pvp lvl from the game like it does your normal lvl..? also how can the code from the new "autogratz" mod be used for this..
thanx..
SimplePortal 2.3.7 © 2008-2024, SimplePortal