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: New: Bebot Local Items database w/Icons!  (Read 88867 times)

0 Members and 2 Guests are viewing this topic.

Offline lonillen

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #105 on: June 11, 2007, 11:52:44 pm »
I am, but one of the modules requires local items database (Malosar's bossloot), besides a local database is, at least for me, faster than using Vhab's centralized DB

Offline boogyman

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #106 on: July 25, 2007, 10:26:32 pm »
For those of us using this plug-in (and it works pretty well in 0.3.x) I've compiled a new database, 17.4.1

http://jcariveau.selfip.com/bebot/17.4.1_items.sql.zip

Includes clusters but allot of tradeskill items were removed.


I dropped my table and loaded this script, and now the items search does not allow for a Quality level to be specified.  Is there a code change that needs to be made?

Search for QL 75 "combined" brought up 0 results. :::

Search for any QL "combined" brought up 85 results. ::: Click to View results 1 to 50

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #107 on: July 26, 2007, 05:46:35 am »
to be honest i rewrote a bit of the plugin, and i'm having no troubles with it... i'll include a copy here, i've changed it to read 'items2' so it can run in combination with the central database

items2.php for bebot 0.4.0
Code: [Select]
<?
  /*
   * Items.php - Searches the itemsdatabase.
   *
   * 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.
   *
   * File last changed at $LastChangedDate: 2007-6-15 01:41:32 -0600 $
   * Revision: $Id: Items.php 8 2007-6-15 00:41:32Z parfet(rk2) $
   *
   * Revised for Icon display - By: Xenixa
   */


  /*
    Prepare MySQL database
  */
  $db -> query("CREATE TABLE IF NOT EXISTS items
               (lowid INT NOT NULL,
        highid INT NOT NULL,
        lowql INT,
        highql INT,
        name VARCHAR(150),
        icon INT)");


  $items2 = new Items2($bot);


  $commands["tell"]["items2"] = &$items2;
  $commands["pgmsg"]["items2"] = &$items2;
  $commands["gc"]["items2"] = &$items2;



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



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



    /*
      This gets called on a tell with the command
    */
    function tell($name, $msg)
    {
      //~ if (preg_match("/^" . $this -> bot -> commpre . "items2 make ([0-9]+) ([0-9]+) ([0-9]+) (.+)/i", $msg, $info))
        //~ $this -> bot -> send_tell($name, $this -> make_item($info[1], $info[2], $info[3], $info[4]));
      if (preg_match("/^" . $this -> bot -> commpre . "items2 ([0-9]+) (.+)/i", $msg, $info))
        $this -> bot -> send_tell($name, $this -> search_items($info[2], $info[1]));
      else if (preg_match("/^" . $this -> bot -> commpre . "items2 (.+)/i", $msg, $info))
        $this -> bot -> send_tell($name, $this -> search_items($info[1]));
    }



    /*
      This gets called on a msg in the privgroup with the command
    */
    function pgmsg($name, $msg)
    {
      if (preg_match("/^" . $this -> bot -> commpre . "items2 ([0-9]+) (.+)/i", $msg, $info))
        $this -> bot -> send_pgroup($this -> search_items($info[2], $info[1]));
      else if (preg_match("/^" . $this -> bot -> commpre . "items2 (.+)/i", $msg, $info))
        $this -> bot -> send_pgroup($this -> search_items($info[1]));
    }



    /*
      This gets called on a msg in the guildchat with the command
    */
    function gc($name, $msg)
    {
      if (preg_match("/^" . $this -> bot -> commpre . "items2 ([0-9]+) (.+)/i", $msg, $info))
        $this -> bot -> send_gc($this -> search_items($info[2], $info[1]));
      else if (preg_match("/^" . $this -> bot -> commpre . "items2 (.+)/i", $msg, $info))
        $this -> bot -> send_gc($this -> search_items($info[1]));
    }



    //~ /*
      //~ Returns an itemref...
    //~ */
    //~ function make_item($ql, $low, $high, $name)
    //~ {
      //~ return "QL ##Highlight##" . $ql . "##End## " . $this -> bot -> make_item($low, $high, $ql, $name);
    //~ }


    /*
      Searches for items
    */
    function search_items($name, $ql=0)
    {
     
if (preg_match("/<a href=\"itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\">(.*)<\/a>/iU",$name, $link)) {
if (preg_match("/Instruction Disc (.*)/i", $link[4], $id)) {
$name = $id[1];
} else {
$name = $link[4];
}
}

 
  //$name = str_replace("'", "", $name);
      if ($ql != 0)
      {
        $addage = " AND lowql <= $ql AND highql >= $ql";
        $order = "name ASC, highql DESC";
        $addql = "QL ##Highlight##$ql##End##";
      }
      else
      {
        $addage = "";
        $order = "highql DESC, name ASC";
        $addql = "any QL";
      }

      $name2 = str_replace(" ", "%", $name);
  $name2 = addslashes($name2);

      $num = $this -> bot -> db -> select("SELECT count(*) FROM items WHERE name LIKE '%".$name2."%'" . $addage);
      $result = $this -> bot -> db -> select("SELECT lowid, highid, lowql, highql, name, icon FROM items WHERE name LIKE '%".
                            $name2 . "%'" . $addage . " ORDER BY " . $order . " LIMIT 0, 50");

      $outside = "Search for $addql \"##Highlight##$name##End##\" brought up " .
                  "##Highlight##" . $num[0][0] . "##End## results.";
      $inside = "<center>##Highlight##:::##End## ##Blob_Title##Search Results for \"##Highlight##$name##End##\"##End## ##Highlight##:::##End##</center>\n\n";

      if (!empty($result))
      {
      if ($num[0][0] == 1)
      {
          $outside .= "\nQL ##Highlight##" . (($ql == 0) ? $result[0][3] : $ql) . "##End## " .
          $this -> bot -> make_item($result[0][0], $result[0][1], (($ql == 0) ? $result[0][3] : $ql), $result[0][4]) .
                      " ##Blob_Text##[QL ##Highlight##" . $list[2] . "##End##-##Highlight##" . $list[3] . "##End##]##End##";
        }
        else
{
        foreach ($result as $list)
        {
        //~ $inside .= "<img src=rdb://" . $list[5] . ">\n";
            //$inside .= $this -> bot -> make_item($list[0][0], $list[0][1], (($ql == 0) ? $list[0][3] : $ql), $list[0][4]) .
        $inside .= "<a href=itemref://" . $list[0] . "/" . $list[1] . "/" . (($ql == 0) ? $list[3] : $ql) . ">"
. "<img src=rdb://" . $list[5] . ">\n" . $list[4] . "</a> ##Blob_Text##[QL ##Highlight##" . $list[2]
. "##End##-##Highlight##" . $list[3] . "##End##]##End##\n\n";
            }
        }
      }

      if ($num[0][0] > 1)
        $outside .= $this -> bot -> make_blob("\nClick to View", $inside) .
        " results ##Highlight##1##End## to ##Highlight##" .
                    (($num[0][0] > 50) ? "50" : $num[0][0]) . "##End##.";

      return $outside;
    }
  }
?>

Offline boogyman

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #108 on: July 28, 2007, 08:12:40 am »
after using the code....I still get the same error

Search for QL 70 "combined" brought up 0 results.

I did modify the page back to items and I made changes my central DB items into !vitems

!vitems 70 combined
45 Results :: Click to View

is there a problem with the .sql file???  I did notice that
Code: [Select]
CREATE TABLE `items` (
  `lowid` mediumint(6) unsigned NOT NULL,
  `highid` mediumint(6) unsigned NOT NULL,
  `lowql` smallint(3) unsigned NOT NULL,
  `highql` smallint(3) unsigned NOT NULL,
  `name` tinytext NOT NULL,
  `icon` mediumint(6) unsigned NOT NULL,
  PRIMARY KEY  (`lowid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

differs from what has been in other .sql files

Code: [Select]
CREATE TABLE IF NOT EXISTS items (lowid INT, highid INT, lowql INT, highql INT, name VARCHAR(250), icon INT);
I modified your .sql to try that and still nothing

anyway....let me know what you think

~bOogYmAn

by the way what utility do you use to pull the info from the database??
« Last Edit: July 28, 2007, 08:17:03 am by boogyman »

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #109 on: July 28, 2007, 05:18:31 pm »
actually the header is correct (optimized) but the info is kinda borked... i used that new experimental extractor located in the 'ctreestd.dll' thread on aodevs.com, and what's wrong is instead of listing those kinda items as (sql) lowid,highid,lowql,highql,etc it's listing lowid,lowid,lowql,lowql,etc and then highid,highid,highql,highql,etc... i didn't see that before, but that's what's screwing up the listings by ql... need the good aodbresourcetool fixed... current version crashes on each extract... i'll have to keep arguing with it

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #110 on: July 28, 2007, 07:58:52 pm »
ok, this one works right:

http://jcariveau.selfip.com/bebot/items.sql.zip

i used aodb resource tool 9.5 to extract, 9.6 to parse, aodbxmlparser to parse that (mysql template), and then a slightly modified copy of the converter found on this forum for the final copy, ended with an export

works pretty good on my end so far

Offline boogyman

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #111 on: July 29, 2007, 07:43:51 am »
thanks so much!!!  Both of the bots I run are working beautifully!!!

~bOogY

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #112 on: August 11, 2007, 01:07:25 am »
Use Vhab's centralized database.

Much better and easier.  :D

Not really, I tried it on my bot for grins. All I got was complaints from my org that it's too slow as I knew it would be.

As I alluded to in my very first post the centralized database is nice but always slower than a database local to the bot.

BTW, I'm in the process of re-writing this module to be more 0.4+ version friendly.
<<< Hack's in Zend Studio

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

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #113 on: August 11, 2007, 07:15:35 am »
bump, above link is now 17.5, updated & tested this time

woot for 4.x release of an updated plugin

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #114 on: August 11, 2007, 10:28:24 am »
:) I still parse my own so thanks for sharing one Parfet. I too discovered the hard way that I had to use Jayde's v0.9.5 AODBResourceTool to rip the raw file then use his 0.9.6 version to dump to XML. As far as I can tell it seems he compiled the latest with some proprietary version of a dll file in his .NET v2.0 setup.
<<< Hack's in Zend Studio

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

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #115 on: August 14, 2007, 10:33:37 am »
one thing i'd like to see added to both these items listers, i've done so locally and my users that have used it like it

Code: [Select]
  function search_items($name, $ql=0)
    {
//~ Pulls strings from item references, to get Instruction Disc names,
//~ or sometimes different QL of the same item name
if (preg_match("/<a href=\"itemref:\/\/[0-9]*\/[0-9]*\/[0-9]*\">(.*)<\/a>/iU", $name, $link)) {
if (preg_match("/Instruction Disc (.*)/i", $link[1], $id)) {
$name = $id[1];
} else {
$name = $link[1];
}
}

at the top of the function, adds the primary ability to drop instruction disks to pull up the nano crystal it goes to, quite a time saver.

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
Re: New: Bebot Local Items database w/Icons!
« Reply #116 on: August 15, 2007, 09:41:58 pm »
Thanks muchly for a local 17.5 db :)
Eternalist
General of The Syndicate

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: New: Bebot Local Items database w/Icons!
« Reply #117 on: October 11, 2007, 03:43:28 am »
here we go again, 17.6.1 database, for those who use it
« Last Edit: October 11, 2007, 04:12:07 am by Parfet »

 

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