Back Reply to topic
bravoleader 
(started thread)
Blue-Ribbon Chicken 
Topics: 1
Posts: 6
Playing:  Age of Conan
Ingame:  Ethaniel
Years registered: * * * * * * * * * * * * * * * *
Yellow Gremlin Integration Posted: Post 03:10 Thu - Nov 26, 2009

I made this interesting (in my opinion) plugin.
wiriting !yg itemName in guildchat/tell
you get a tell from the bot with the item link as in the yellowgremling database big grin
It is important you write the name of the item case sentive-wise otherwise you get the not found message.
The only setting you have to write is the password from yellow gremlin. you have to register to YG to get it.
Hope you like it lachen
http://www.jofc.net/wip/PHP/ygdb.zip

F
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 09:14 Fri - Nov 27, 2009

i don't know how funny this would be for yg, but here should be a way to get items case-insensitive (example here is "axe")
(and avoid registering...)
- request on http://aoc.yg.com/search?s=axe
- extract as many hits as you want from the javascript array MyGridOptions
- - http://aoc.yg.com/item/axe-of-red-ruin?h=-y9QAdfr
- - http://aoc.yg.com/item/adamant-enforced-axe?h=bL4QRxZ7
- now follow those links and extract the javascript variable ObjectGameId
- - for the first hit above this is: "var ObjectGameId = 3843408;"

anyway: i like your code lachen it's straight dom xml and more reliable
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
bravoleader 
(started thread)
Blue-Ribbon Chicken 
Topics: 1
Posts: 6
Playing:  Age of Conan
Ingame:  Ethaniel
Years registered: * * * * * * * * * * * * * * * *
Posted: Post 09:38 Fri - Nov 27, 2009

After a day or so of testing it looks like some people are crashing when querying for an item. Still need to find the cause of it. After that if you want you can put it among the modules for the ragebot (that we in my guild love big grin)

F
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 10:27 Fri - Nov 27, 2009

sure lachen
to avoid crashing i would create a public "request array", where each array-element contains
- a timestamp
- a tempfilename like: "tmp/yg".time()
- the sender / channel where the request was made
then start an extenal proccess (for windows there is a wget.exe out there. the call must begin with "start .."), call something like
Code:
exec('bash -c "wget http://aoc.yg.com/item... --output-document=$tempfilename > /dev/null 2>&1 &"');


now you can make a 500ms plugin that goes through each element of the request array and
- checks, if the tempfile exists and if its size is big enough (let's say 1kb).
- if the file is big enough, try to load it into a domdocument, do an ingame output and delete the tempfile
- if file loading fails do nothing (the plugin will run again in 500ms, so who cares)
- if the timestamp is older than 30seconds, the request probably won't ever finish, do an ingame error-output
after an output was made, delete the array-element and the request is done

this would lead to zombie processes for abandoned wget calls, but this should be a problem of the wget-coders big grin
(i never experienced a hanging wget process in the past)
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
bravoleader 
(started thread)
Blue-Ribbon Chicken 
Topics: 1
Posts: 6
Playing:  Age of Conan
Ingame:  Ethaniel
Years registered: * * * * * * * * * * * * * * * *
Posted: Post 10:47 Fri - Nov 27, 2009

i think the crashing is due to the incorrect format of the itemrefs hash code.
I made several researches and it still looks i did not find any clue to calculate it.
the format of the itemref link is itemID/itemID/itemLvl/hash/hash.
hash has this format: hex:hex:hex:hex
I still don't know how to calculate that.
;o
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 11:04 Fri - Nov 27, 2009

er.. "ppl crashing" not the bot... -.- can you attach a xml-site from yg?

i added you to the coders group, so you can attach files here
Reply with quote


bravoleader 
(started thread)
Blue-Ribbon Chicken 
Topics: 1
Posts: 6
Playing:  Age of Conan
Ingame:  Ethaniel
Years registered: * * * * * * * * * * * * * * * *
Posted: Post 11:14 Fri - Nov 27, 2009

Chaly wrote:
can you attach a xml-site from yg?


What do you mean with this ? ^^''''

let me give you an example. atm the plugin adds at the end of the first part of the itemref the string 0:0:0:0/0:0:0:0.
It looks like if you have the item in your inv, everything is ok. otherwise the client of AoC will crash.
To solve this we have to find how they create the hash code. It looks like a 32byte CRC. I tried to CRC the name of the item (no luck), the id (no luck) and i'm still doing some test. It also looks that the code does not depend from the player nor from where he is (area code).
the data i'm working on atm is this
//3769913/3769913/80/466d69d5:fb7e0ef2:61095aca:d9c81392/ Tasset of the Martial Paragon
//3769384/3769384/80/91f8a2d8:1a64790b:6379006b:a9588ea9/
//3769469/3769469/80/cec9d766:c77ffe41:a1315eb5:5f2b11ed/ Vambraces of the Triumphant]</font></a
//3769906/3769906/80/683c9005:15969eff:8e81ec02:377d31dc/ Girdle of the Martial Paragon]</font></a>
//3769949/3769949/80/e82e1d68:e43deaae:abd3d3b1:ad07db27/ Boots of the Martial Paragon]</font></a>
//3769455/3769455/80/841434f1:885e0a3:a9ae4068:bbe1f59b/

May be 2 brains will work better than one big grin
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 11:28 Fri - Nov 27, 2009

i ment the output of yg for registered users lachen

seems like all other ppl use a database to get a hashcode they grabbed ingame.. maybe the yg db also knows it
Reply with quote


bravoleader 
(started thread)
Blue-Ribbon Chicken 
Topics: 1
Posts: 6
Playing:  Age of Conan
Ingame:  Ethaniel
Years registered: * * * * * * * * * * * * * * * *
Posted: Post 11:35 Fri - Nov 27, 2009

<?xml version="1.0" encoding="UTF-8" ?>
- <aocygxml>
- <aocygitem id="yxQnfXMR">
<name>Tasset of the Martial Paragon</name>
<level>80</level>
<gameid>3769913</gameid>
<rarity>4</rarity>
<color>#8D11BE</color>
- <link>
- <![CDATA[ http://aoc.yg.com/item/tasset-of-the-martial-paragon?h=yxQnfXMR
]]>
</link>
- <script>
- <![CDATA[ <script type="text/javascript" src="http://aoc.yg.com/extern/tooltip.js?98"></script>
]]>
</script>
- <htmllink>
- <![CDATA[ <a href="http://aoc.yg.com/item/tasset-of-the-martial-paragon?h=yxQnfXMR">Tasset of the Martial Paragon</a>
]]>
</htmllink>
- <tooltip>
- <![CDATA[ http://aoc.yg.com/etooltip?h=yxQnfXMR
]]>
</tooltip>
- <images>
- <smallicon>
- <![CDATA[ http://aoc.yg.com/eicon?h=3T7FUiFd&sz=24x24
]]>
</smallicon>
- <icon>
- <![CDATA[ http://aoc.yg.com/eicon?h=3T7FUiFd&sz=42x42
]]>
</icon>
- <thumbnail>
- <![CDATA[ http://aoc.yg.com/eicon?h=3T7FUiFd&sz=thumb
]]>
</thumbnail>
- <highres>
- <![CDATA[ http://aoc.yg.com/eicon?h=3T7FUiFd&sz=hires
]]>
</highres>
</images>
</aocygitem>
</aocygxml>
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 07:10 Fri - Nov 27, 2009

about that itemID.. well, what about extracting the rdb? http://aoc.curse.com/downloads/aoc-addons/details/rdb-extractor.aspx
Quote:
00 - scripts (10); map indices (371); mesh index; named indices; item names (37488); other binary/xml data nodes

the "binary/xml data nodes" may be interesting", but i wonder that even the several bebot coders still use their own online-db.

back to the hash.. the hash code seems to be generated by the server and the client crashs if the id is wrong. however, if the client once got the item with the correct hash, a second link with a wrong hash (0:0:0:0) seems to work.

now, i have to guess:
this may tell us that the client looks in its item-cache. if the item isn't found the hashcode is needed. one option is that the client sends a request to the server to verify the itemID (maybe to avoid the usage of patched items, whatever..). if i'm right, we probably won't be able to generate the hash, because we don't have all information that is needed (maybe they're crypted or based on an id that is hidden in aoc server-db).
Reply with quote


Kerv 
Blue-Ribbon Chicken 
Topics: 0
Posts: 8
Playing:  Fury
Ingame:  Kervo
Years registered: * * * * * * * * * * * * * * * *
Posted: Post 10:15 Fri - Jan 22, 2010

Did anyone get the YG - player profile plugin to work with Ragebot. I have it here for BeBot, but I am not able to prepare it for Ragebot... Anyone?

-----------
<?php
/*
* Yg.php - Display player profiles from the Yellow Gremlin Database (http://aoc.yg.com/)
*
* BeBot - An Anarchy Online & Age of Conan Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005-2007 Thomas Juberg Stensås, ShadowRealm Creations and the BeBot development team.
*
* Developed by:
* - Alreadythere (RK2)
* - Blondengy (RK1)
* - Blueeagl3 (RK1)
* - Glarawyn (RK1)
* - Khalem (RK1)
* - Naturalistic (RK1)
* - Temar (RK1)
*
* See Credits file for all aknowledgements.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/

/*
* Module made by Elyissa from Fury (PvP) EU
* Layout idea by Kentarii from Fury (PvP) EU
* Fetching of xml data without cURL by Getrix from Fury (PvP) EU
*/



$Yg = new Yg($bot);

class Yg extends BaseActiveModule
{

function __construct(&$bot)
{
parent::__construct(&$bot, get_class($this));

$this -> register_command('all', 'yg', "GUEST");

$this -> help['description'] = "Display player profile from Yellow Gremlin Database";
$this -> help['command']['yg <name>']="Display player profile from default server";
$this -> help['command']['yg <name> <server>']="Display player profile from <server>";
$this -> help['notes'] = "Yellow Gremlin Database url : http://aoc.yg.com";
}

function command_handler($name, $msg, $origin)
{
if (preg_match('/^yg (.+) (.+)$/i', $msg, $info)) {
return $this -> showprofile($msg, $info[1], $info[2]);
}
else if (preg_match('/^yg (.+)$/i', $msg, $info)) {
return $this -> showprofile($msg, $info[1], "");
}
else {
return ("##lightyellow##Usage:##end## ##white##<pre>Yg Name Server##end## ##gray##(Default Server: ".$this->bot->dimension.")##end##");
}
}

function showprofile($msg, $profilename, $servername)
{
/* Password to access YG xml data */
$password = 'Y7$RNe5j';
if ($servername == "")
$servername = $this->bot->dimension;
/* Check for cURL, and load xml profile data */
if ($this -> curl_check()) {
$ch = curl_init ("http://aoc.yg.com/de/profilexml?n=$profilename&srv=$servername&pwd=$password");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$xmlprf = curl_exec($ch);
curl_close($ch);
}
else {
$yg_link = "http://aoc.yg.com/de/profilexml?n=$profilename&srv=$servername&pwd=$password";
$ch = $this -> bot -> core("tools") -> get_site($yg_link, 1);
if (!empty($ch["content"])) { $xmlprf = $ch["content"]; }
else { $xmlprf = ""; }
}

$xmlobj = simplexml_load_string($xmlprf);

/* Done loading xml profile data */

if($xmlobj->aocygplayerprofile->name)
{
/* Some text formating */
$pvpkills = str_replace(".00", "", $xmlobj->aocygplayerprofile->pvpkills);
$pvpdeaths = str_replace(".00", "", $xmlobj->aocygplayerprofile->pvpdeaths);
$classarray = array("(Priest)", "(Rogue)", "(Soldier)", "(Mage)");
$class = str_replace($classarray, "", $xmlobj->aocygplayerprofile->class);
$murderer = ucfirst($xmlobj->aocygplayerprofile->murderer);

/* Player info blob */
$blobname = "<center><font face='hyborianlarge' color='yellow'>Yellow Gremlin</font></center>\n";
$blobname .= "<font face='hyboriansmall' color='orange'>Character Profile</font>\n";
$blobname .= "##seagreen##Name##end## :: ##seablue##".$xmlobj->aocygplayerprofile->name."##end## :: ##yellow##".$xmlobj->aocygplayerprofile->link."##end##\n";
if($xmlobj->aocygplayerprofile->guild)
$blobname .= "##seagreen##Guild##end## :: ##seablue##".$xmlobj->aocygplayerprofile->guild."##end## :: ##yellow##".$xmlobj->aocygplayerprofile->guildlink."##end##\n";
$blobname .= "##seagreen##Level##end## :: ##seablue##".$xmlobj->aocygplayerprofile->level."##end##\n";
$blobname .= "##seagreen##Server##end## :: ##seablue##".$xmlobj->aocygplayerprofile->server."##end##\n";
$blobname .= "##seagreen##Race##end## :: ##seablue##".$xmlobj->aocygplayerprofile->race."##end##\n";
$blobname .= "##seagreen##Class##end## :: ##seablue##".$xmlobj->aocygplayerprofile->class."##end##\n";
$blobname .= "##seagreen##Gender##end## :: ##seablue##".$xmlobj->aocygplayerprofile->gender."##end##\n";
$blobname .= "##seagreen##PvP Level##end## :: ##seablue##".$xmlobj->aocygplayerprofile->pvplevel."##end##\n";
$blobname .= "##seagreen##K/D Ratio##end## :: ##seablue##".$pvpkills."/".$pvpdeaths." = ".$xmlobj->aocygplayerprofile->kdratio."##end##\n";
$blobname .= "##seagreen##Professions##end## :: ##seablue##".$xmlobj->aocygplayerprofile->professions."##end##\n";
$blobname .= "##seagreen##Murderer##end## :: ##seablue##".$murderer."##end##\n";
$blobname .= "##seagreen##Last Updated##end## :: ##seablue##".$xmlobj->aocygplayerprofile->last_updated."##end##\n<center> </center>";
$blobname .= "<font face='hyboriansmall' color='orange'>Equipped Items</font>\n";
for($i=0; $i<=16; $i=$i+1) {
if ($xmlobj->aocygplayerprofile->equipment->slot[$i]->slotname)
$blobname .= "##seagreen##".$xmlobj->aocygplayerprofile->equipment->slot[$i]->slotname."##end## :: ##seablue##".$xmlobj->aocygplayerprofile->equipment->slot[$i]->itemname."##end##\n";
}

/* If member of a guild, fetch Guild xml data */
if($xmlobj->aocygplayerprofile->guild)
{
/* Text formating */
$guildid = str_replace("guild", "guildxml", $xmlobj->aocygplayerprofile->guildlink);

/* Check for cURL, and load xml guild data */
if ($this -> curl_check()) {
$ch = curl_init ("$guildid&pwd=$password");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$xmlgld = curl_exec($ch);
curl_close($ch);
}
else {
$yg_link = "$guildid&pwd=$password";
$ch = $this -> bot -> core("tools") -> get_site($yg_link, 1);
if (!empty($ch["content"])) { $xmlgld = $ch["content"]; }
else { $xmlgld = ""; }
}

$xmlguild = simplexml_load_string($xmlgld);

/* Done loading xml guild data */

/* Guild info blob */
$blobguild = "<center><font face='hyborianlarge' color='yellow'>Yellow Gremlin</font></center>\n";
$blobguild .= "<font face='hyboriansmall' color='orange'>Guild Profile</font>\n";
$blobguild .= "##seagreen##Guild##end## :: ##seablue##".$xmlguild->aocygguild->name."##end## :: ##yellow##".$xmlguild->aocygguild->guildlink."##end##\n";
$blobguild .= "##seagreen##Server##end## :: ##seablue##".$xmlguild->aocygguild->server."##end##\n";
$blobguild .= "##seagreen##Members##end## :: ##seablue##".$xmlguild->aocygguild->member_count."##end##\n";
$blobguild .= "##seagreen##Murderers##end## :: ##seablue##".$xmlguild->aocygguild->murderers."##end##\n";
$blobguild .= "##seagreen##Average Level##end## :: ##seablue##".$xmlguild->aocygguild->averagelvl."##end##\n";
$blobguild .= "##seagreen##Average PVP Level##end## :: ##seablue##".$xmlguild->aocygguild->averagepvplvl."##end##\n";
$blobguild .= "##seagreen##Total Kills##end## :: ##seablue##".$xmlguild->aocygguild->totalkills."##end##\n";
$blobguild .= "##seagreen##Total Deaths##end## :: ##seablue##".$xmlguild->aocygguild->totaldeaths."##end##\n";
$blobguild .= "##seagreen##Average PVP Kills##end## :: ##seablue##".$xmlguild->aocygguild->averagepvpkills."##end##\n";
$blobguild .= "##seagreen##Average PVP Deaths##end## :: ##seablue##".$xmlguild->aocygguild->averagepvpdeaths."##end##\n";
$blobguild .= "##seagreen##K/D Ratio##end## :: ##seablue##".$xmlguild->aocygguild->kdratio."##end##\n";
}

/* Output info */
$result = "##yellow##[-YG-]##end## ##white##:: ".$this->bot->core("tools")->make_blob($xmlobj->aocygplayerprofile->name, $blobname);
if($xmlobj->aocygplayerprofile->guild)
$result .= " / ".$this->bot->core("tools")->make_blob($xmlobj->aocygplayerprofile->guild, $blobguild);
$result .= " :: [ ##seagreen##L".$xmlobj->aocygplayerprofile->level."##end## | ##seagreen##";
$result .= $class."##end##| ##seablue##L".$xmlobj->aocygplayerprofile->pvplevel."##end## | ##seablue##";
$result .= $pvpkills."/".$pvpdeaths."##end## | ##seablue##".$xmlobj->aocygplayerprofile->kdratio."##end## ]##end##";

return utf8_decode($result);
}
else
{
/* No profile found */
$profilename = ucfirst(strtolower($profilename));
$servername = ucfirst(strtolower($servername));
$blob = "##yellow##[-YG-]##end## ##white##::##end## ##red##No profile found for ##lightyellow##$profilename##end## on server ##lightyellow##$servername##end##.##end##";
return $blob;
}

}

function curl_check() {
if (in_array ('curl', get_loaded_extensions()))
return true;
else
return false;
}
}
?>
Reply with quote


Back Reply to topic