Jump to content


Photo

How to get XML with PHP from armory


  • Please log in to reply
122 replies to this topic

#41 Zimeron

Zimeron

    Cookies!

  • Members
  • 423 posts

Posted 06 March 2009 - 06:34 PM

This is something I made a while back, that tracks the top achievers on my server (Kargath - US).

It's pretty crude, but it gets the job done. I have an automated check to scan every guild listed in the db as well as nonguilded people.

Achievement Tracking

#42 StarletRox

StarletRox

    Glass Joe

  • Members
  • 16 posts

Posted 07 March 2009 - 11:32 PM

This is something I made a while back, that tracks the top achievers on my server (Kargath - US).

It's pretty crude, but it gets the job done. I have an automated check to scan every guild listed in the db as well as nonguilded people.

Achievement Tracking


World of Warcraft Achievement Ranking | SK Gaming

#43 inktomi

inktomi

    Von Kaiser

  • Members
  • 25 posts

Posted 08 March 2009 - 07:53 AM

I've been working on my own little side project that ranks guilds based on achievements, realmRanker - World of Warcraft Guild Ranking (would love feedback if you'd like to check it out, pm me).

I'm still working out the bugs, but the base functionality is there and seems to work well enough. I love how you've displayed the player achievements in the nice table - I may need to work something like that onto my realm / guild pages somehow. My next big thing to do is work on achievement reporting.

It's all in Java, but I think I might put it up on Google Code once it's all done and working well.
<irL> - looking for members today! Inktomi#1227

#44 Bukama

Bukama

    Glass Joe

  • Members
  • 9 posts

Posted 08 March 2009 - 02:38 PM

Your post inspired me to write one for my guild. It's just done for my personal enjoyment and not going to be made into a general tool. It's written in perl and uses a common package I've developed for all my armory digging.

The result can be seen here: Insomnia achievements


This is one I am also looking for my own guild, but I cant code pearl. This script in PHP would be awesome

#45 StarletRox

StarletRox

    Glass Joe

  • Members
  • 16 posts

Posted 09 March 2009 - 12:19 AM

This is one I am also looking for my own guild, but I cant code pearl. This script in PHP would be awesome


I did a script in python with inspiration (by design, not the code) from his idea. Looks like: [ Dies Irae on Shattered Hand ] created by Morirai @ Shattered Hand EU (yep, my guild's name is funnily enough the same as yours.)

You just need to setup a few variables and run the script and it creates a nice html file.

The problem is that the code is so messy and unorganized I'm actually ashamed of realeasing it to the public, if you want to try it out just tell me and I'll try to clean up the mess.

#46 Tanoh

Tanoh

    Piston Honda

  • Members
  • 200 posts

Posted 09 March 2009 - 08:49 AM

This is one I am also looking for my own guild, but I cant code pearl. This script in PHP would be awesome


Good thing it's "perl" then ;)

Without getting into a flamewar over which language is better, php is just not suitable for this. It's a shell script which creates a HTML page.

#47 StarletRox

StarletRox

    Glass Joe

  • Members
  • 16 posts

Posted 09 March 2009 - 11:03 AM

Good thing it's "perl" then ;)

Without getting into a flamewar over which language is better, php is just not suitable for this. It's a shell script which creates a HTML page.


I'm a PHPer myself and completely agree this Isn't anything for PHP.

#48 Bukama

Bukama

    Glass Joe

  • Members
  • 9 posts

Posted 09 March 2009 - 12:59 PM

I did a script in python with inspiration (by design, not the code) from his idea. Looks like: [ Dies Irae on Shattered Hand ] created by Morirai @ Shattered Hand EU (yep, my guild's name is funnily enough the same as yours.)

You just need to setup a few variables and run the script and it creates a nice html file.

The problem is that the code is so messy and unorganized I'm actually ashamed of realeasing it to the public, if you want to try it out just tell me and I'll try to clean up the mess.


Would be nice if you would do that and tell me how to use it, because (as I wrote) I don't know anything about python or pearl. For PHP I got a local setup (xampp) to test and then our webroot. Is there anything for phyton or pearl too? I mean it would be enough if I start the script local, generate the HTML-page and up the final page to get the overview online.A live-generation would be awesome, but I dont know if the webroot of our guilds page supports phyton / pearl

#49 Jezz

Jezz

    Von Kaiser

  • Members
  • 84 posts

Posted 13 March 2009 - 10:39 AM

Is there currently a script or site that allows you to search armory for all of 'x' class on 'x' realm, without being limited by searching within a guild/arena team?

#50 Renew

Renew

    Team Healbot

  • Members
  • 528 posts

Posted 13 March 2009 - 05:11 PM

I don't see how/why PHP cannot do this, I worked on this for a day and came close to figuring out how to get most of what I want from it (took me a while to learn how to read the xml as I have never done that yet). I am a bit sidetracked now with some other projects, but will probably finish it in a few weeks.

Home - Insomnia Guild :: Tichondrius US-BG9

I want it to have a database backend in the end and a ton of random features.
Confidence is not Arrogance.

#51 Ullas

Ullas

    I hate springtime

  • Members
  • 41 posts

Posted 16 March 2009 - 06:46 AM

Is there currently a script or site that allows you to search armory for all of 'x' class on 'x' realm, without being limited by searching within a guild/arena team?

Not yet. I may have something like this by the end of the week, but it would involve specifying several "seed characters". The basic idea is to crawl from guild to arena teams, to more guilds, to more teams, and so forth. The first theorem of six degrees of Kevin Bacon says that you should be able to get most level 80 players that belong to a guild with only a few "seeds", especially if you allow a high number (or infinite number) of jumps from guild to arena team to guild.

Keep in mind that this process makes a lot of armory requests, and in order to avoid a 12 hour IP ban, waiting between each one is required. There's no good way to get around this for a process that involves almost all new data. The only strategy I have had success with is cacheing as much data as possible, and being smart about the allowable "shelf life" of various data (i.e., items change in the short term, talents in medium term, class and race in the long term via some unlikely character name change antics).

#52 Jagannath

Jagannath

    Glass Joe

  • Members
  • 8 posts

Posted 27 March 2009 - 01:31 PM

I just want to thank you all of us (espacially Tanoh for helping me :) ), for doing such great job.
It helps many guilds.

#53 sleevenote

sleevenote

    Glass Joe

  • Members
  • 5 posts

Posted 31 March 2009 - 08:02 AM

Hey guys,

I have a very special question concerning reading out data from the armory, and I hope it's alright if i hijack this thread for it:

Is there any way of easily reading out a character's item data, especially itemlevel, without having to look up every item manually? Ideally, the end result would be along these lines:

CHARNAME
GUILD
SERVER

10x Ilevel 226
5x Ilevel 213
1x Ilevel 200


Is there any possible way at all of achieving this, or is it pretty much unthinkable?

thanks in advance

#54 Furizaa

Furizaa

    Somewhat usefull

  • Members
  • 44 posts

Posted 31 March 2009 - 09:53 AM

Take a look at the Source of the Characters-Page. It says something like this for an Item:

<item durability="60" gem0Id="41401" gem1Id="40048" gem2Id="0" icon="inv_crown_01" id="[B]40447[/B]" maxDurability="60" permanentenchant="3819" randomPropertiesId="0" seed="0" slot="0"/>

Now you have to extract the id value and start new requests on the Items-Page with that value to get the level. A simple relation. [characterpage/items[n]/@id]--[itempage/item/@id]

<item icon="..." id="[B]40447[/B]" level="[B]226[/B]" name="..." quality="4" type="...">


#55 Bukama

Bukama

    Glass Joe

  • Members
  • 9 posts

Posted 16 June 2009 - 02:09 PM

Hi,
I successfully build a small guildroster so far no real problem. My next step would be to read out the achievementprogress for our members and that's where I need a little help, perhaps just a show in the right direction would help.
I want to track which achievements for example are missing for Glory of the Ulduar Raider, but the sourcecode of the achievementpage only shows the overview and categories like

 <rootCategories>
      <category id="92" name="Allgemein"/>
      <category id="96" name="Quests">
        <category name="Classic"/>
        <category name="The Burning Crusade"/>

        <category name="Wrath of the Lich King"/>
      </category>


How can I "ask" the armory if a single achievement was achieved or not?

#56 Zimeron

Zimeron

    Cookies!

  • Members
  • 423 posts

Posted 16 June 2009 - 03:24 PM

Add c=X where X is the id of the category you want to look at. For example Dungeon and Raids achievements are 168. So to see your xml: http://eu.wowarmory....Dies Irae&c=168

I'm unaware of how to break it down to only show a category within a category.

#57 pankey

pankey

    Glass Joe

  • Members
  • 1 posts

Posted 16 June 2009 - 06:26 PM

i've set up something like this for my guild, the only thing you can do really is look for the 'glory of the ulduar raider' meta achievement id (10man 2957, 25man 2958) from the page zimeron linked for each person. to determine if somebody has an achievement or not simply look for a 'dateCompleted' entry for the meta. if its not set then check each criteria from the meta achievement for the same dateCompleted.

an example is here Pie Chart Glory of the Raider Status (10 & 25). this is just a static page from the actual php script, since it takes a bit to load (40ish seconds)

#58 Kemortia

Kemortia

    Von Kaiser

  • Members
  • 44 posts

Posted 18 June 2009 - 06:40 AM

I worked on setting up an automated tracker for my guild tonight. I started with the script D1g1talS0ul posted. It's worth noting if you're starting with his post, the achievement structures have changed from what he's got so that why for example the battleground print out in it won't print anything.

I made a database table consisting of fourteen rows, one for the toon's name and the other 13 for each achievement for the meta. The first file updates the table from the armory. I have it set as a cron job to run every 6 hours.

#!/usr/bin/php
<?php

/*

Heroic Achievements
-------------------
0 => Heroic: Orbit-uary
1 => Heroic: Stokin' the Furnace
2 => Heroic: Iron Dwarf, Medium Rare
3 => Heroic: Heartbreaker
4 => Heroic: I Choose You, Steelbreaker
5 => Heroic: Disarmed
6 => Heroic: Crazy Cat Lady
7 => Heroic: I Could Say That This Cache Was Rare
8 => Heroic: Lose Your Illusion
9 => Heroic: Knock, Knock, Knock on Wood
10 => Heroic: Firefighter
11 => Heroic: I Love the Smell of Saronite in the Morning
12 => Heroic: One Light in the Darkness

*/

// Include phpbb's config for db info
include("config.php");

echo 'Working...' . '</br>';

/*
roster_gen class posted by D1g1talS0ul on elitistjerks.com
*/

class roster_gen {

const BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";

public $query;
public $server;
public $guild;
public $guildie;
public $page;

public function __construct ( $query, $server, $guild, $guildie, $page ) {
$this->query = $query;
$this->server = $server;
$this->guild = $guild;
$this->guildie = $guildie;
$this->page = $page;
} // end of __construct()

public function pull_xml() {

if( $this->query === 'roster' ) {
$url = 'http://www.wowarmory.com/guild-info.xml?r=' . $this->server . '&n=' . $this->guild. '&p=' . $this->page;

} elseif( $this->query === 'character' ) {
$url = 'http://www.wowarmory.com/character-sheet.xml?r=' . $this->server . '&n=' . $this->guildie;

} elseif( $this->query === 'achievements' ) {
$url = 'http://www.wowarmory.com/character-achievements.xml?r=' . $this->server . '&cn=' . $this->guildie . '&gn=' .
$this->guild . '&c=168';
}

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_USERAGENT, roster_gen::BROWSER);

$url_string = curl_exec($ch);

return simplexml_load_string($url_string);

curl_close($ch);
} // end of pull_xml()

} // end class

$roster = new roster_gen (roster, Gilneas, Anonymous, NULL, 1);
$xml_roster = $roster->pull_xml();


// Change to querying achievements
$roster->query=achievements;

// Set up the member array
$member_data = array();
$id = 0;


foreach ($xml_roster->guildInfo->guild->members->character as $char)
{
if ($char['rank'] >= 1 && $char['rank'] <= 3 && $char['name'] != 'Semic' ) {

$roster->guildie = $char['name'];

$xml_char = $roster->pull_xml();

$ach = find_category($xml_char->category);

$a = array();

$a[0] = check_achievement($ach, 0);
$a[1] = check_achievement($ach, 1);
$a[2] = check_achievement($ach, 2);
$a[3] = check_achievement($ach, 3);
$a[4] = check_achievement($ach, 4);
$a[5] = check_achievement($ach, 5);
$a[6] = check_achievement($ach, 6);
$a[7] = check_achievement($ach, 7);
$a[8] = check_achievement($ach, 8);
$a[9] = check_achievement($ach, 9);
$a[10] = check_achievement($ach, 10);
$a[11] = check_achievement($ach, 11);
$a[12] = check_achievement($ach, 12);

$member_data[$id] = array(
'name' => $char['name'],
'0' => $a[0],
'1' => $a[1],
'2' => $a[2],
'3' => $a[3],
'4' => $a[4],
'5' => $a[5],
'6' => $a[6],
'7' => $a[7],
'8' => $a[8],
'9' => $a[9],
'10' => $a[10],
'11' => $a[11],
'12' => $a[12]
);

// Provide some output that it's doing stuff
echo 'Updated: <b>' . $char['name'] . '</b> ' . $a[0] . '-' . $a[1] . '-' . $a[2] . '-' . $a[3] . '-' . $a[4] . '-' . $a[5] . '-' . $a[6]
. '-' . $a[7] . '-' . $a[8] . '-' . $a[9] . '-' . $a[10] . '-' . $a[11] . '-' . $a[12] . '</br>';

$id++;
}

}

echo '</br>Inserting values into DB...</br>';

// Connect to the DB
$db = mysql_connect('localhost', $dbuser, $dbpasswd);
$db_selected = mysql_select_db($dbname, $db);

foreach ($member_data as $member)
{
$name = $member['name'];

$sql = "insert into ach_data(name, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
VALUES ('$name', $member[0], $member[1], $member[2], $member[3], $member[4], $member[5], $member[6],
$member[7], $member[8], $member[9], $member[10], $member[11], $member[12])";

$result = mysql_query($sql);

if(!$result);
echo mysql_error() . "\n";
}

echo 'Database update completed.';


function find_category($xml)
{
foreach($xml->achievement as $ach) {
if($ach['id'] == 2958)
return $ach;
}
}


function check_achievement($achievement, $num) {

if($achievement->criteria[$num]['date'] != NULL)
return 1;
else
return 0;

}
?>



Second file is the actual display of the achievements:
<?php

// Includes

define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);


// Page Settings
$title = 'Achievement Progress';

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');


$sql = 'SELECT name, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 FROM ach_data ORDER BY name';
$result = $db->sql_query($sql);

$row_switch = 1;

while ($row = $db->sql_fetchrow($result))
{
$name = $row['name'];

if($row_switch % 2 == 0)
$color = 'bgcolor=#EAEADA';
else
$color= 'bgcolor=#FFFFFF';

$template->assign_block_vars('member_row', array(
'NAME' => $name,
'COLOR' => $color,
'A0' => ach_icon($row['a0']),
'A1' => ach_icon($row['a1']),
'A2' => ach_icon($row['a2']),
'A3' => ach_icon($row['a3']),
'A4' => ach_icon($row['a4']),
'A5' => ach_icon($row['a5']),
'A6' => ach_icon($row['a6']),
'A7' => ach_icon($row['a7']),
'A8' => ach_icon($row['a8']),
'A9' => ach_icon($row['a9']),
'A10' => ach_icon($row['a10']),
'A11' => ach_icon($row['a11']),
'A12' => ach_icon($row['a12'])
));

$row_switch = $row_switch + 1;
}


// Output page
page_header($title);

$template->set_filenames(array(
'body' => 'achievements.html')
);

page_footer();


function ach_icon($v)
{
if($v == 1)
return "http://www.kemortia.com/pm.jpg";
else
return "http://www.kemortia.com/pf.jpg";
}

?>



Finally, a template file:
<!-- INCLUDE overall_header.html -->

<div style="float: left; width: 100%;" >
<table style="margin-left: auto; margin-right: auto;" cellspacing="0px" frame="border">
<caption align="bottom">
Heroic: Glory of the Ulduar Raider
</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/inv_misc_shadowegg.jpg" title="Orbit-uary" height="25" width="25" align="center"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_ignis_01.jpg" title="Stokin' the Furnace" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_dungeon_ulduarraid_irondwarf_01.jpg" title="Iron Dwarf, Medium Rare" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/inv_valentinescardtornleft.jpg" title="Heartbreaker" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_theironcouncil_01.jpg" title="I Choose You, Steelbreaker" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/ability_warrior_disarm.jpg" title="Disarmed" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_auriaya_01.jpg" title="Crazy Cat Lady" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_hodir_01.jpg" title="I Could Say That This Cache Was Rare" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_thorim.jpg" title="Lose Your Illusion" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_warpsplinter.jpg" title="Knock, Knock, Knock on Wood" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/inv_misc_bomb_04.jpg" title="Firefighter" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_generalvezax_01.jpg" title="I Love the Smell of Saronite in the Morning" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/spell_shadow_shadesofdarkness.jpg" title="One Light in the Darkness" height="25" width="25"></th>
</tr>
</thead>
<!-- BEGIN member_row -->
<tr {member_row.COLOR}>
<td style="text-align: center">{member_row.NAME}</td>
<td align="center"><img src="{member_row.A0}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A1}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A2}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A3}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A4}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A5}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A6}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A7}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A8}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A9}" height="15" width="15" ></td>
<td align="center"><img src="{member_row.A10}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A11}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A12}" height="15" width="15"></td>
</tr>
<!-- END member_row -->
</table>
</div>

<!-- INCLUDE overall_footer.html -->



It seems to work pretty well. Feel free to use this code as a starter, just give me some credit if you do. Hopefully this will help some of you guys that are trying to get something similar up. Couple of weird quirks I had to work out that are worth nothing. First, for everyone except one person, the achievement category was 20, but for one it was 19. So I wrote a function in to find which category it was in the xml. Was annoying to figure that one out. The armory seems to be majorly bugged with my guild also, it has our guild leader as someone who hasn't been in the guild for years, and it has a member as a raider who also hasn't been in the guild for a long time. Hence the custom checks in the update file. Feel free to just edit those out, you'll have to change the ranks in the same line anyways most likely. I don't claim my code is the best way to accomplish what I did, so use it at your own risk :P

Finished product: Anonymous - Achievement Progress
Eek, Shaman

#59 Targaryen

Targaryen

    Glass Joe

  • Members
  • 4 posts

Posted 24 June 2009 - 02:03 PM

Also been working on tracking dungeon meta achievement. What i have done so far is similar to the above only that it works for any guild and lets you select guild ranks to be shown. Working in asp.net so if anyone want some help to set it up with that instead of php feel free to contact me.

Can see the current status of it here: www.wow-stat.com

#60 talonos

talonos

    Glass Joe

  • Members
  • 5 posts

Posted 05 July 2009 - 04:33 PM

Kemortia, your script is absolute brilliant. I edited it to pull the champion of the frozen wastes info which works an absolute treat BUT I've tried editing it to display the naxxramas normal meta and to no prevail i cant get it working at all

the error I am receiving is:
Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147

Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147

Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147

Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147

Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147

Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147
Updated: Rabbitpt 0-0-0-0-0-0

and my script is:
#!/usr/bin/php 
<?php

/*



// Include phpbb's config for db info
//include("config.php");

echo 'Working...' . '</br>';

/*
roster_gen class posted by D1g1talS0ul on elitistjerks.com
*/

class roster_gen {

const BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";

public $query;
public $server;
public $guild;
public $guildie;
public $page;

public function __construct ( $query, $server, $guild, $guildie, $page ) {
$this->query = $query;
$this->server = $server;
$this->guild = $guild;
$this->guildie = $guildie;
$this->page = $page;
} // end of __construct()

public function pull_xml() {

if( $this->query === 'roster' ) {
$url = 'http://eu.wowarmory.com/guild-info.xml?r=' . $this->server . '&n=' . $this->guild. '&p=' . $this->page;

} elseif( $this->query === 'character' ) {
$url = 'http://eu.wowarmory.com/character-sheet.xml?r=' . $this->server . '&n=' . $this->guildie;

} elseif( $this->query === 'achievements' ) {
$url = 'http://eu.wowarmory.com/character-achievements.xml?r=' . $this->server . '&cn=' . $this->guildie . '&gn=' .
$this->guild . '&c=168';
}

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt ($ch, CURLOPT_USERAGENT, roster_gen::BROWSER);

$url_string = curl_exec($ch);

return simplexml_load_string($url_string);

curl_close($ch);
} // end of pull_xml()

} // end class

$roster = new roster_gen ('roster', 'stormrage', 'heroes+of+warcraft', NULL, 1);
$xml_roster = $roster->pull_xml();


// Change to querying achievements
$roster->query='achievements';

// Set up the member array
$member_data = array();
$id = 0;


foreach ($xml_roster->guildInfo->guild->members->character as $char)
{
if ($char['level'] == 80 && $char['rank'] <= '3' ) {

$roster->guildie = $char['name'];

$xml_char = $roster->pull_xml();

$ach = find_category($xml_char->category);

$a = array();

$a[0] = check_achievement($ach, 0);
$a[1] = check_achievement($ach, 1);
$a[2] = check_achievement($ach, 2);
$a[3] = check_achievement($ach, 3);
$a[4] = check_achievement($ach, 4);
$a[5] = check_achievement($ach, 5);


$member_data[$id] = array(
'name' => $char['name'],
'0' => $a[0],
'1' => $a[1],
'2' => $a[2],
'3' => $a[3],
'4' => $a[4],
'5' => $a[5]
);

// Provide some output that it's doing stuff
echo 'Updated: <b>' . $char['name'] . '</b> ' . $a[0] . '-' . $a[1] . '-' . $a[2] . '-' . $a[3] . '-' . $a[4] . '-' . $a[5] . '</br>';

$id++;
}

}
/*
echo '</br>Inserting values into DB...</br>';

// Connect to the DB
$db = mysql_connect($dbhost, $dbuser, $dbpasswd);
$db_selected = mysql_select_db($dbname, $db);

foreach ($member_data as $member)
{
$name = $member['name'];

$sql = "insert into ach_data(name, a0, a1, a2, a3, a4, a5)
VALUES ('$name', '$member[0]', '$member[1]', '$member[2]', '$member[3]', '$member[4]', '$member[5]')";
$result = mysql_query($sql);

if(!$result);
echo mysql_error() . "\n";
}

echo 'Database update completed.';
*/

function find_category($xml)
{
foreach($xml->achievement as $ach) {
if($ach['id'] == 576)
return $ach;
}
}


function check_achievement($achievement, $num) {
if($achievement ['dateCompleted'] != NULL)
return 1;
else
if($achievement->criteria[$num]['date'] != NULL)
return 1;
else
return 0;

}
?>


if you could help me fix this it would be great as then i could get working on something for my forum to pull ALL achievements for my guildies and then I will start on my custom armory too

btw heres a link showing what the outcome is of my working script Heroes Of Warcraft • Achievement Progress




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users