BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Coding and development discussion => Topic started by: onekman on April 06, 2008, 07:13:40 pm

Title: How to get Item ID from the items database
Post by: onekman on April 06, 2008, 07:13:40 pm
Hi,

Just wonder if anyone got an idea how to get the ItemsID from the database, if you know the item name ?

thx in advance

1k
Title: Re: How to get Item ID from the items database
Post by: Temar on April 06, 2008, 11:15:15 pm
you could use auno, search for item and look at address bar, it will contain lowID highID and ql
Title: Re: How to get Item ID from the items database
Post by: onekman on April 07, 2008, 08:05:37 am
hehe k yeah sry, it seems I dident exlain my self correctly then, my mistake  :-\

I want to get the Items id from inside a own delveloped PHP module in bebot, just by using the items name ? is that possible and if so how ?

Title: Re: How to get Item ID from the items database
Post by: Blueeagle on April 08, 2008, 02:04:20 am
What you can do is to create a dummy module

create the command !raw and have the command handler var_dump($msg)

That will show you exactly what you get when you do !raw <drop item here>
Title: Re: How to get Item ID from the items database
Post by: Ebag333 on April 15, 2008, 08:58:29 pm
Code: [Select]
<?php
$item_info 
= new item_info($bot);

$commands["tell"]["item"] = &$item_info;
$commands["pgmsg"]["item"] = &$item_info;
$commands["gc"]["item"] = &$item_info;

class 
item_info
{

var $bot;
function item_info (&$bot)
{
$this->bot = &$bot;

$this -> bot -> accesscontrol -> create('tell''item''GUEST');
$this -> bot -> accesscontrol -> create('gc''item''GUEST');
$this -> bot -> accesscontrol -> create('pgmsg''item''GUEST');

$this -> help['description'] = 'Searches the central database for information about an item.';
$this -> help['command']['items [ql] <item>']="Searches and displays information about an <item> of the optional [ql]";
$this -> help['notes']="This module uses the Central Items Database v1.1, By Vhab.";
}
function tell($name$msg)
{
$this->bot->send_tell($name$this->process_command($name$msg));
}
function pgmsg($name$msg)
{
$this->bot->send_pgroup($this->process_command($name$msg));
}

function gc($name$msg)
{
$this->bot->send_gc($this->process_command($name$msg));
}

function process_command($name$msg)
{

if(preg_match("/^" $this -> bot -> commpre "item <a href=\"itemref:\/\/(.*)\/(.*)\/(.*)\">(.*)/i"$msg$info))
return $this -> item($name$info[1], $info[2], $info[3], $info[4]);
else
$this -> bot -> send_help($name);
}

function item($name$lowid,$highid,$ql$itemname)
{
$msg "\n##normal## Item Name:##end## ##highlight##" $itemname "##end##";
$msg .= "\n##normal## Item ID (Low):##end## ##highlight##" $lowid "##end##";
$msg .= "\n##normal## Item ID (High):##end## ##highlight##" $highid "##end##";
$msg .= "\n##normal## Item QL:##end## ##highlight##" $ql "##end##";
$msg .= "\n##normal## Item Referance:##end## ##highlight##\n";
$msg .= "&lt;a href=\"itemref://" $lowid "/" $highid "/" $ql "\"&gt;" $itemname "&lt;/a&gt;##end##\n";
$msg .= "\n";
$msg .= "##normal## References:##end## ##highlight##\n";

$aunoURL "http://auno.org/ao/db.php?id=" $lowid "&ql=" $ql;
$msg .= "##normal## Auno:##end## " $this -> bot -> make_chatcommand('start ' $aunoURL,$itemname) . "\n";

$aomainframeURL "http://aomainframe.com/showitem.aspx?AOID=" $lowid "&QL=" $ql;
$msg .= "##normal## AOMainframe:##end## " $this -> bot -> make_chatcommand('start ' $aomainframeURL,$itemname) . "\n";

return $blob "Item Information :: " $this -> bot -> make_blob("click to view"$msg);
}
}
?>

SimplePortal 2.3.7 © 2008-2024, SimplePortal