|
The Wanderer
Join Date: Jun 2009
Posts: 5
Thanks: 0
|
Another Update
Hey all,
UPDATE:
I have been really busy with a lot of IRL things lately, but I thought I would post this updated script. There are a lot of things I still haven't had time to implement.
STILL NEED TO DO:
- Complete character statistics retrieval.
- Updated the retrieval of the 50 last achievements.
- If there has been any structure changes to the official wow armory xml, I have not updated them. But in my tests everything is still working ok.
- Many more...
OK, ONTO THE REAL CODING...
I firstly want to say thank you for all this preliminary work...
It has been a tremendous help during the development of my own xml grabber...
Ok, so I wanted to share my own development with everyone..
What this script will do:- Connect to the Official WoW Armory
- Download an XML List of all the Characters in your guild
- With each Character in the Guild, it will download Info & Achievements
- Store the accumulated data as a PHP array, ready for export into a number of databases
- Displays the Array as raw XML, a SQL import Statement and a Sortable HTML Table
Here are a few notes on what I have accomplished...
- I had issues using the '->children()' object, so this solution does not use that feature...
- Due to loading limits imposed by the wow armory, I have written a XML caching system to attempt to download and save a new XML stream to a cache file. If you get a trashed response (like you have reached the quota or the site is offline for maintenance), it will load the last valid XML document you have cached...
- Every XML request is cached by default in the 'cache' directory...
- There are 3 outputs via the html. the raw XML, a SQL import statement and a sortable processed html grid with data from the XML... [SEE THE LIVE DEMO LINK]
- Inside the code I have parsed the xml into a multi-dimensional array for ease of sorting...
- The Last 5 Achievements are processed...
- All Gear / Items are parsed and stored correctly...
- I have managed to handle the special characters like 'å'... Read the comments below...
- If you want to store the data in a SQL server I would recommend using the language setting of 'utf8_general_ci'...
- When SELECT'ing the data from the SQL server, make sure you use "SET NAMES 'utf8'; SET CHARACTER SET 'utf8'; " before the SELECT statement. This way you get the same text encoding outputted by the SQL server.
LIVE DEMO [Only 3 Characters]: http://www.wingsofthefallen.com/wotf/roster.test.php
LIVE DEMO [All Characters, Takes time to load]: http://www.wingsofthefallen.com/wotf...t.php?all=true
///////////////////////////////////////////////////////////////////////////////////////
// Script: roster.test.php
// Author: Collective [ World of Warcraft Armory xml Grabber with cURL]
// Modified: DJRavine aka Adan Rehtla [DJRavine@WoWps.org]
// Date: 28/06/2009 11:29:54 PM
// Live Demo: http://www.wingsofthefallen.com/wotf/roster.test.php
// Guild Site: http://WingsOfTheFallen.com
// Guild Dev Site: http://WingsOfTheFallen.com/index2.php
///////////////////////////////////////////////////////////////////////////////////////
-------------------------------------------------------------------------
STEPS TO SUCCESSFULLY USE THIS SCRIPT
-------------------------------------------------------------------------- Make sure you have a webserver with PHP v5.x.x.
- Save both 'roster.test.php' and 'roster_functions.php' each to their own file and upload to your webserver.
- In the same directory as 'roster.php' and 'roster_functions.test.php' create a directory called 'cache'. This will be used to cache the XML files you stream from the wow armory.
- Set the permissions for the 'cache' directory to 775, or anything to allow the script to write files to that folder.
- Edit the $configs['blah'] in the top of the 'roster_functions.test.php' file to your discretion and save the file.
- Browse to the file with you favorite browser and it should look like my live demo.
NOTE: For Debug and Testing purposes, I have limited the script to only retrieve 3 characters. To correct this, just append this to the URL '?all=true'.
EG. http://www.wingsofthefallen.com/wotf...t.php?all=true
NOTE: This script has been minimally tested and may need tweaking for complete functionality, it is supplied in an 'as is' basis to aide your own development.
DON'T FORGET TO CLICK THE
'SAY THANKS' BUTTON BELOW
IF YOU FIND THIS POST USEFUL
roster.test.php
PHP Code:
<?php
///////////////////////////////////////////////////////////////////////////////////////
// Script: roster.test.php
// Author: Collective [http://www.talkphp.com/show-off/3281-world-warcraft-armory-xml-grabber-curl.html]
// Modified: DJRavine aka Adan Rehtla [DJRavine@WoWps.org]
// Date: 28/06/2009 11:29:54 PM
// Live Demo: http://www.wingsofthefallen.com/wotf/roster.test.php
// Guild Site: http://WingsOfTheFallen.com
// Guild Dev Site: http://WingsOfTheFallen.com/index2.php
///////////////////////////////////////////////////////////////////////////////////////
// INTERNAL PHP CHARSET TO UTF-8
mb_internal_encoding( 'UTF-8' );
header( 'Content-Type: text/html; charset=UTF-8' );
// INCLUDE EXTRA FUNCTIONS
include 'roster_functions.test.php';
// --- START: GET $_GET[""] VARIABLES ----------------------------
// GET: SORT FIELD
$sort_field = $_GET["sort"];
if($sort_field == ''){ $sort_field = 'level'; }
// GET: SORT DIRECTION
$sort_direction = $_GET["direction"];
if($sort_direction == ''){ $sort_direction = 'desc'; }
// GET: SORT DIRECTION
$override_process_all = $_GET["all"];
if($override_process_all == 'true') { $config['chars_to_process'] = -1; }
// --- END: GET $_GET[""] VARIABLES ----------------------------
// --- START: MAIN PHP PROCESSING ----------------------------
// PRINT THE HTML HEADER
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Guild XML Parser - '.htmlentities($config['guild_name']).' from '.htmlentities($config['server_name']).'</title>
</head><body><P><b> PLEASE WAIT FOR THE PAGE TO LOAD... DEPENDING ON THE OPTIONS SELECTED IT COULD TAKE A WHILE...</b><P>';
//alert( $config['server_name']." - ".$config['guild_name']);
// INITIALIZE THE ARMORY CLASS
$armory = new armory('roster', $config['server_name'], $config['guild_name'], NULL, NULL);
$xml_guild = $armory->pull_xml(); // PULL THE GUILD XML FROM THE WOW ARMORY
echo '<span style="font-size:75%;"><b>LOADED IN '.printLoadTime().'s</b></span><P>';
// XML SOURCE TEXT AREA
if ( $config['show_xml_source'] ) {
$latestGuildXMLfile = getXMLfile('guild-info'); // GET THE LATEST CACHE GUILD XML FILE
$cachedFile = $config['DIR_cache'].$latestGuildXMLfile['filename'];
$fh = fopen($cachedFile, 'r');
$theData = fread($fh, filesize($cachedFile));
fclose($fh);
echo '<br /><P><b>GUILD XML:</b><BR/><textarea rows="30" cols="180" wrap="off">';
echo $theData;
echo'</textarea><P>';
echo '<span style="font-size:75%;"><b>LOADED IN '.sec2hms(printLoadTime()).'s</b></span><P>';
}
// BUILD GUILD ARRAY FROM XML SOURCE
$array_Members_Basic = buildCharacterArray($xml_guild);
// PULL THE XML FOR EVERY CHARACTER IN THE GUILD AND ADD TO THE ARRAY
$array_Members = pullCharacterXML($armory, $array_Members_Basic);
// SORT GUILD ARRAY
$array_Members_sorted = sortCharacterArray($array_Members, $sort_field, $sort_direction);
// PRINT SQL IMPORT STATEMENT INSIDE A TEXTAREA
printSQLCharacterArray($array_Members_sorted,$xml_guild->guildInfo->guildHeader['count'],$xml_guild->guildInfo->guildHeader['battleGroup']);
echo '<span style="font-size:75%;"><b>LOADED IN '.sec2hms(printLoadTime()).'s</b></span><P>';
// PRINT GUILD ARRAY AS A TABLE
if ( $config['show_html_data_table'] ) {
if ( $config['show_html_data_sort'] ) {
printCharacterArray($array_Members_sorted, $sort_field, $sort_direction);
} else {
printCompleteCharacterArray($array_Members_sorted);
}
echo '<b>Showing '.count($array_Members_sorted).' / '.(string)$xml_guild->guildInfo->guildHeader['count'].' Guild Members...<br/></b> [NOTE: Only showing characters above level 10]<P>';
}
// PRINT TOTAL LOAD TIME
echo '<span style="font-size:75%;"><b>TOTAL LOAD TIME: '.sec2hms(printLoadTime()).'s</b></span><P>';
echo '</body></html>';
// --- END: MAIN PHP PROCESSING ----------------------------
// FOR DEBUG PURPOSES
//print_r($array_Members);
//print_r($array_Members_sorted);
?>
roster_functions.test.php
PHP Code:
<?php
///////////////////////////////////////////////////////////////////////////////////////
// Script: roster_functions.test.php
// Author: Collective [http://www.talkphp.com/show-off/3281-world-warcraft-armory-xml-grabber-curl.html]
// Modified: DJRavine aka Adan Rehtla [DJRavine@WoWps.org]
// Date: 28/06/2009 11:29:54 PM
// Live Demo: http://www.wingsofthefallen.com/wotf/roster.php
// Guild Site: http://WingsOfTheFallen.com
// Guild Dev Site: http://WingsOfTheFallen.com/index2.php
///////////////////////////////////////////////////////////////////////////////////////
// LOAD TIME VARS - !! DONT TOUCH !!
$m_time = explode(" ",microtime());
$m_time = $m_time[0] + $m_time[1];
$config['starttime'] = $m_time;
$config['round'] = 3; // The number of decimal places to round the micro time to.
// ---------------- EDIT THE BELOW SETTINGS ----------------
// SERVER AND GUILD SETTINGS
$config['server_name'] = 'Elune'; // Name of the WoW Realm
$config['guild_name'] = 'Wings of the Fallen'; // Name of your Guild
// $config['server_name'] = 'Marécage de Zangar'; // Name of the WoW Realm
// $config['guild_name'] = 'Lenwë Linwëlin'; // Name of your Guild
// THESE WILL BE STORED AS HTML ENTITIES FOR EASE OF DISPLAYING
// SETTINGS FOR THE GENERAL WEBSITE
$config['live_system'] = true; // 'TRUE' = Download XML & Cache; 'FALSE' = Cache Only
$config['base_filename'] = 'roster.test.php'; // Base script file name
$config['base_url'] = 'http://wingsofthefallen.com/wotf/'; // Base URL
$config['url_prefix_armory'] = 'http://www.wowarmory.com/'; // URL for the AMERICAN armory
// $config['url_prefix_armory'] = 'http://eu.wowarmory.com/'; // URL for the EUROPEAN armory
$config['url_prefix_char']=$config['url_prefix_armory'].'character-sheet.xml?'; // Use for Char links
// NOTE: THE BELOW DIRECTORY NEEDS TO HAVE WRITE ACCESS IN ORDER TO CACHE THE XML
$config['DIR_cache'] = 'cache/'; // Directory where the XML cache files are stored
// NOTE: THE ABOVE DIRECTORY NEEDS TO HAVE WRITE ACCESS IN ORDER TO CACHE THE XML
$config['days_to_cache'] = 3; // How many days to keep cached files for
$config['DIR_sql'] = 'sql/'; // Directory where the SQL files are stored
// LOADING BAR
$config['loading_bar'] = 100; // How many characters in the loading bar
$config['loading_bar_mask'] = "="; // The loading bar symbol
// OUTPUT DISPLAY SETTING
// WARNING: TURNING ALL OF THESE SETTINGS ON WILL TAKE A LOOONG TIME TO PROCESS AND WILL CONSUME A FAIR AMOUNT OF SERVER RESOURCES
// WARNING: I ONLY HAVE OVER 150 MEMBERS IN MY GUILD, WITH ALL THESE SETTINGS ON IT CAN TAKE UPTO AN HOUR TO PROCESS AND LOAD.
$config['show_xml_source'] = true; // 'TRUE' = Show XML Source; 'FALSE' = Hide XML Source
$config['show_sql_import_structure'] = true; // 'TRUE' = Show SQL Import Structure; 'FALSE' = Hide SQL Import Structure
$config['show_sql_import_data'] = true; // 'TRUE' = Show SQL Import Data; 'FALSE' = Hide SQL Import Data
$config['show_html_data_table'] = true; // 'TRUE' = Show HTML Data Table; 'FALSE' = Hide HTML Data Table
$config['show_html_data_sort'] = false; // 'TRUE' = Show HTML Data Table with sort functionality and only limited fields; 'FALSE' = Show HTML Data Table with every field
// SETTINGS FOR SQL STATEMENT GENERATION
$config['sql_database'] = 'wotf_character'; // SQL Database Name
$config['sql_table'] = 'guild_characters_test'; // SQL Table Name
// XML PARSING SETTINGS
// $config['min_char_level'] = 75; // Limits display parsing of Characters beyond a certain level. NOTE: Use '0' to process all characters. NOTE: Requires "$config['chars_to_process'] = -1;"
// $config['min_char_rank'] = 1; // Limits display to Guild Rank NOTE: Requires "$config['chars_to_process'] = -1;"
$config['equipable_items_number'] = 18; // How many equipable items on a character. !! DO NOT EDIT THIS !!
// DEBUG SETTINGS
$config['chars_to_process'] = 3; // How many characters to pull xml data for. NOTE: Use '-1' to process all characters.
$config['use_char_selction_list'] = false; // Select this option to only process characters names found in the "$config['char_selction_list']" array.
$config['char_selction_list'] = array( "Demoral", "Kyrå", "Orayn" ); // A list of characters to process, excluding all others. NOTE: Requires "$config['chars_to_process'] = -1;"
// ---------------- EDIT THE ABOVE SETTINGS ----------------
// -----------------------------------------------
// DO NOT EDIT BELOW THIS LINE
// -----------------------------------------------
//---------------------------------------------------
// CLASSES AND FUNCTIONS
//---------------------------------------------------
// DEFINE THE ARMORY CLASS
class armory {
// DEFINE THE ARMORY VARIABLES
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;
// CONSTRUCTOR FOR THE ARMORY OBJECT
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()
// THIS WILL NOW DOWNLOAD AND CACHE THE XML FEED
// THEN IT WILL SEARCH THE XML CACHE FOR THE LATEST VALID XML FEED
public function pull_xml() {
global $config;
// change the first part of the $url to the armory link that you need
if( $this->query === 'roster' ){
$filename_type = 'guild-info';
$url = $config['url_prefix_armory'].$filename_type.'.xml?r=' . urlencode( utf8_encode( $this->server ) ) . '&n=' . urlencode( utf8_encode( $this->guild ) ) . '&p=' . $this->page;
} elseif( $this->query === 'character' ){
$filename_type = 'character-sheet';
$url = $config['url_prefix_armory'].$filename_type.'.xml?r=' . urlencode( utf8_encode( $this->server ) ) . '&n=' . $this->guildie;
} elseif( $this->query === 'achievement' ){
$filename_type = 'character-achievements';
$url = $config['url_prefix_armory'].$filename_type.'.xml?r=' . urlencode( utf8_encode( $this->server ) ) . '&n=' . $this->guildie;
}
//alert($url);
if ( $config['live_system'] ) {
$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, self::BROWSER);
$url_string = curl_exec($ch);
curl_close($ch);
echo ' -> <b>'.strtoupper($filename_type).'.XML LIVE FEED:</b> <a href="'.$url.'" target="_BLANK">'.$url.'</a><P>';
} else {
if( $this->query === 'roster' ){
echo '<b>NOTE: USING XML CACHE ONLY!!!</b><P>';
}
}
//alert($url_string);
// change the first part of the $url to the armory link that you need
if( $this->query === 'roster' ){
if ( $config['live_system'] ) {
cacheXMLfile($filename_type, $url_string); // CACHE THE GUILD XML STREAM
}
$latestGuildXMLfile = getXMLfile('guild-info'); // GET THE LATEST CACHE GUILD XML FILE
$url = $config['base_url'].$config['DIR_cache'].$latestGuildXMLfile['filename'];
$url_filesize = $latestGuildXMLfile['filesize'];
//echo "<P>RESULT -> ".$latestGuildXMLfile['filename']." - ".$latestGuildXMLfile['filesize']." - ".$latestGuildXMLfile['filetime']." <br /><br /><br /><br />";
} elseif( $this->query === 'character' ) {
$char_cache_filename = $filename_type.'-'.$this->guildie; // BUILD THE CHRACTER XML CACHE FILENAME
if ( $config['live_system'] ) {
cacheXMLfile($char_cache_filename, $url_string); // CACHE THE CHARACTER XML STREAM
}
$latestCharacterXMLfile = getXMLfile($char_cache_filename); // GET THE LATEST CACHE GUILD XML FILE
$url = $config['base_url'].$config['DIR_cache'].$latestCharacterXMLfile['filename'];
$url_filesize = $latestCharacterXMLfile['filesize'];
//echo "<P>RESULT -> ".$latestCharacterXMLfile['filename']." - ".$latestCharacterXMLfile['filesize']." - ".$latestCharacterXMLfile['filetime']." <br /><br /><br /><br />";
} elseif( $this->query === 'achievement' ) {
$char_cache_filename = $filename_type.'-'.$this->guildie; // BUILD THE CHRACTER XML CACHE FILENAME
if ( $config['live_system'] ) {
cacheXMLfile($char_cache_filename, $url_string); // CACHE THE CHARACTER XML STREAM
}
$latestCharacterXMLfile = getXMLfile($char_cache_filename); // GET THE LATEST CACHE GUILD XML FILE
$url = $config['base_url'].$config['DIR_cache'].$latestCharacterXMLfile['filename'];
$url_filesize = $latestCharacterXMLfile['filesize'];
//echo "<P>RESULT -> ".$latestCharacterXMLfile['filename']." - ".$latestCharacterXMLfile['filesize']." - ".$latestCharacterXMLfile['filetime']." <br /><br /><br /><br />";
}
//
if ( $url_filesize > 0 ) {
$url_string = simplexml_load_file($url) or die ("ERROR: Unable to load XML file! URL: ".$url);
echo ' -> <b>'.strtoupper($filename_type).'.XML CACHE:</b> <a href="'.$url.'" target="_BLANK">'.$url.'</a> - '.fileSizeInfo($url_filesize).' read...<P>';
} else {
$url_string = "";
}
return $url_string;
} // end of pull_xml()
} // end class
//------------------------------------------------------------------
// Display a Javascript Alert Box [FOR DEBUG PURPOSES]
function alert($textMessage) {
global $config;
print('<script language="javascript">alert("'.$textMessage.'")</script>');
}
//------------------------------------------------------------------
// Return the current load time
function printLoadTime() {
global $config;
$m_time = explode(" ",microtime());
$m_time = $m_time[0] + $m_time[1];
$endtime = $m_time;
$totaltime = ($endtime - $config['starttime']);
return (string)round($totaltime,$config['round']);
}
//------------------------------------------------------------------
// Convert seconds to '0h 0m 0s'
function sec2hms ($sec, $padHours = false) {
$hms = "";
$hours = intval(intval($sec) / 3600);
$hms .= ($padHours)
? str_pad($hours, 2, "0", STR_PAD_LEFT). ':'
: $hours. ':';
$minutes = intval(($sec / 60) % 60);
$hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':';
$seconds = intval($sec % 60);
$hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
return $hms;
}
//------------------------------------------------------------------
// Convert bytes to '0TB 0GB 0MB 0MB 0kb'
function fileSizeInfo($size){
$i=0;
$iec = array("b", "kb", "mb", "gb", "tb", "pb", "eb", "zb", "yb");
while (($size/1024)>1) {
$size=$size/1024;
$i++;
}
return substr($size,0,strpos($size,'.')+4).$iec[$i];
}
//------------------------------------------------------------------
// Get the latest cached XML file from the cache directory
function getXMLfile( $XMLtype ) {
global $config;
// GET LATEST XML FILE
$new_file_size = 0;
$new_file_time = 0;
$new_file_name = "";
$old_file_date = time() - ($config['days_to_cache'] * 24 * 60 * 60);
$dir = opendir ("./".$config['DIR_cache']);
echo " <b>-> CHECKING XML CACHE [";
$filecount = count(glob("./".$config['DIR_cache']."*.xml"));
$filecount_current=0;
$loading_bar_list = array();
for( $i=1; $i<$config['loading_bar']; $i++ ) { $loading_bar_list[] = round($filecount/$i); }
while (false !== ($file = readdir($dir))) {
if (strpos($file, $XMLtype ) === false ) {
} else {
$file_size = filesize($config['DIR_cache'].$file);
$file_time = filemtime($config['DIR_cache'].$file);
if ( $file_size > 614 ) { // 614 BYTES 503 ERROR DOCUMENT // 651 BYTES CHAR ERROR PAGE
//echo "COMPARE -> '".$new_file_name."' '".$file."' <br /> ".$new_file_size."<=".$file_size." | ".$new_file_time."<".$file_time." |";
if ( $file_time >= $new_file_time ) { // CHECK IF ITS A NEWER FILE
//echo " [newer file]";
$new_file_size = $file_size;
$new_file_time = $file_time;
$new_file_name = $file;
}
//echo "<br />";
}
// REMOVE FILES OLDER THAN THE SPECIFIED TIME
if( $file_time < $old_file_date ) {
unlink($config['DIR_cache'].$file); //alert($config['DIR_cache'].$file);
}
}
if (in_array($filecount_current,$loading_bar_list)) echo $config['loading_bar_mask'];
$filecount_current++;
}
echo "] - DONE</b><P>";
return array( "filename" => $new_file_name, "filesize" => $new_file_size, "filetime" => $new_file_time );
}
//------------------------------------------------------------------
// Save XML Stream to the cache directory
function cacheXMLfile($filename, $XMLstream) {
global $config;
$XML_filename = $config['DIR_cache'].$filename.'-'.date('Y.m.d-H.i.s').'.xml';
$handle = fopen($XML_filename, "wb");
$numbytes = fwrite($handle, $XMLstream);
fclose($handle);
$url_filesize_obj = fileSizeInfo($numbytes);
echo ' -> <b>LIVE XML FEED CACHED TO XML FILE:</b> ./'.$XML_filename.' - '.fileSizeInfo($numbytes).' written...<P>';
}
//------------------------------------------------------------------
// For each of the characters in the supplied array, pull the XML for each and populate the character array.
function pullCharacterXML($armory, $charArray) {
global $config;
$countCharaters = 0;
$extendCharArray = array();
foreach ($charArray as $char) {
echo '<b>[ '.($countCharaters+1).' / '.count($charArray).' - '.sec2hms(printLoadTime()).'s ] PROCESSING CHARACTER -> \''.$char['name'].'\'...</b><P>';
// CHARACTER INFO
$char_armory = new armory('character', $config['server_name'], $config['guild_name'], $char['name'], NULL);
$xml_armory = $char_armory->pull_xml(); // PULL THE CHARACTER XML FROM THE WOW ARMORY
// ACHIEVEMENT INFO
$char_achievement = new armory('achievement', $config['server_name'], $config['guild_name'], $char['name'], NULL);
$xml_achievement = $char_achievement->pull_xml(); // PULL THE CHARACTER XML FROM THE WOW ARMORY
// BUILD CHARACTER ARRAY FROM XML SOURCE
$charArray[$countCharaters] = extendCharacterArray($xml_armory, $xml_achievement, $charArray[$countCharaters]);
$countCharaters++;
}
return $charArray;
}
//------------------------------------------------------------------
// Extend the Character Array from the supplied character XML stream
function extendCharacterArray($XMLstream, $XMLstreamAchievement, $char) {
global $config;
// PARSE DATA FROM THE CHAR XML SOURCE
// TITLES STRINGS
$char_obj = $XMLstream->characterInfo->character;
$current_title = $char_obj['prefix'].$char['name'].$char_obj['suffix'];
// DEPRECIATED - 1st JULY 2009
// $count_knowntitles = 0;
// $knowntitles_string = "";
// if ( count($XMLstream->characterInfo->characterTab->knownTitles->title) != 0 ) {
// foreach ($XMLstream->characterInfo->characterTab->knownTitles->title as $knowntitles) {
// if ( $count_knowntitles == 0 ) { $knowntitles_string .= $knowntitles['value'];
// } else { $knowntitles_string .= ", ".$knowntitles['value']; }
// $count_knowntitles++;
// }
// }
// REPLACE '%s' WITH CHARACTER NAME IN THE TITLES
// $current_title = str_replace("%s", $char['name'], $current_title);
// $knowntitles_string = str_replace("%s", $char['name'], $knowntitles_string);
// TALENT SPECS ARRAYS
$talentspec1 = $XMLstream->characterInfo->characterTab->talentSpecs->talentSpec[0];
$talentspec2 = $XMLstream->characterInfo->characterTab->talentSpecs->talentSpec[1];
// PROFESSIONS ARRAYS
$profession1 = $XMLstream->characterInfo->characterTab->professions->skill[0];
$profession2 = $XMLstream->characterInfo->characterTab->professions->skill[1];
// CHARACTER BARS ARRAYS
$characterbars = $XMLstream->characterInfo->characterTab->characterBars->secondBar;
// BASE STATS ARRAYS
$basestats_strength = $XMLstream->characterInfo->characterTab->baseStats->strength;
$basestats_agility = $XMLstream->characterInfo->characterTab->baseStats->agility;
$basestats_stamina = $XMLstream->characterInfo->characterTab->baseStats->stamina;
$basestats_intellect = $XMLstream->characterInfo->characterTab->baseStats->intellect;
$basestats_spirit = $XMLstream->characterInfo->characterTab->baseStats->spirit;
$basestats_armor = $XMLstream->characterInfo->characterTab->baseStats->armor;
// MELEE ARRAYS
$melee_mainHandDamage = $XMLstream->characterInfo->characterTab->melee->mainHandDamage;
$melee_offHandDamage = $XMLstream->characterInfo->characterTab->melee->offHandDamage;
$melee_mainHandSpeed = $XMLstream->characterInfo->characterTab->melee->mainHandSpeed;
$melee_offHandSpeed = $XMLstream->characterInfo->characterTab->melee->offHandSpeed;
$melee_power = $XMLstream->characterInfo->characterTab->melee->power;
$melee_hitRating = $XMLstream->characterInfo->characterTab->melee->hitRating;
$melee_critChance = $XMLstream->characterInfo->characterTab->melee->critChance;
$melee_expertise = $XMLstream->characterInfo->characterTab->melee->expertise;
// RANGED ARRAYS
$ranged_weaponSkill = $XMLstream->characterInfo->characterTab->ranged->weaponSkill;
$ranged_damage = $XMLstream->characterInfo->characterTab->ranged->damage;
$ranged_speed = $XMLstream->characterInfo->characterTab->ranged->speed;
$ranged_power = $XMLstream->characterInfo->characterTab->ranged->power;
$ranged_hitRating = $XMLstream->characterInfo->characterTab->ranged->hitRating;
$ranged_critChance = $XMLstream->characterInfo->characterTab->ranged->critChance;
// SPELL ARRAYS
$spell_bonusDamage = $XMLstream->characterInfo->characterTab->spell->bonusDamage;
$spell_critChance = $XMLstream->characterInfo->characterTab->spell->critChance;
$spell_hitRating = $XMLstream->characterInfo->characterTab->spell->hitRating;
$spell_manaRegen = $XMLstream->characterInfo->characterTab->spell->manaRegen;
$spell_hasteRating = $XMLstream->characterInfo->characterTab->spell->hasteRating;
// DEFENSES ARRAYS
$defenses_armor = $XMLstream->characterInfo->characterTab->defenses->armor;
$defenses_defense = $XMLstream->characterInfo->characterTab->defenses->defense;
$defenses_dodge = $XMLstream->characterInfo->characterTab->defenses->dodge;
$defenses_parry = $XMLstream->characterInfo->characterTab->defenses->parry;
$defenses_block = $XMLstream->characterInfo->characterTab->defenses->block;
$defenses_resilience = $XMLstream->characterInfo->characterTab->defenses->resilience;
// ITEMS ARRAYS
$items = array();
for( $i=0; $i<=$config['equipable_items_number']; $i++ ) { // SEED THE ITEMS ARRAY WITH '0' VALUES
$items[] = array(
"durability" => 0,
"gem0Id" => 0,
"gem1Id" => 0,
"gem2Id" => 0,
"icon" => 0,
"id" => 0,
"maxDurability" => 0,
"permanentenchant" => 0,
"randomPropertiesId" => 0,
"seed" => 0,
"slot" => $i
);
}
if( count($XMLstream->characterInfo->characterTab->items->item) != 0 ) {
foreach ( $XMLstream->characterInfo->characterTab->items->item as $item ) { // POPULATE THE KNOWN ITEMS
$items[((int)$item['slot'])] = array( // POPULATE THE ITEM VALUES TO THE ITEMS ARRAY
"durability" => $item['durability'],
"gem0Id" => $item['gem0Id'],
"gem1Id" => $item['gem1Id'],
"gem2Id" => $item['gem2Id'],
"icon" => $item['icon'],
"id" => $item['id'],
"maxDurability" => $item['maxDurability'],
"permanentenchant" => $item['permanentenchant'],
"randomPropertiesId" => $item['randomPropertiesId'],
"seed" => $item['seed'],
"slot" => $item['slot']
);
}
}
// GLYPHS
$glyphs0 = $XMLstream->characterInfo->characterTab->glyphs->glyph[0];
$glyphs1 = $XMLstream->characterInfo->characterTab->glyphs->glyph[1];
$glyphs2 = $XMLstream->characterInfo->characterTab->glyphs->glyph[2];
$glyphs3 = $XMLstream->characterInfo->characterTab->glyphs->glyph[3];
$glyphs4 = $XMLstream->characterInfo->characterTab->glyphs->glyph[4];
$glyphs5 = $XMLstream->characterInfo->characterTab->glyphs->glyph[5];
// ACHIEVEMENT SUMMARY
$achSummary = $XMLstream->characterInfo->summary;
// ACHIEVEMENT - LAST 5
$achievements = array();
$count_achievements = 0;
if( count($XMLstreamAchievement->achievements->summary->achievement) != 0 ) {
foreach ( $XMLstreamAchievement->achievements->summary->achievement as $achievement ) { // POPULATE THE KNOWN ACHIEVEMENTS
$achievements[$count_achievements] = array( // POPULATE THE ACHIEVEMENT VALUES TO THE ACHIEVEMENTS ARRAY
"categoryId" => $achievement['categoryId'],
"dateCompleted" => $achievement['dateCompleted'],
"desc" => $achievement['desc'],
"icon" => $achievement['icon'],
"id" => $achievement['id'],
"points" => $achievement['points'],
"title" => $achievement['title']
);
$count_achievements++;
}
}
// REBUILD THE CHARACTER ARRAY
$char_Array = array(
// BASIC INNFORMATION
"name" => $char['name'],
"level" => $char['level'],
"class" => $char['class'],
"gender" => $char['gender'],
"race" => $char['race'],
"rank" => $char['rank'],
"achPoints" => $char['achPoints'],
"url" => $char['url'],
// GET BATTLEGROUP & LAST MODIFIED TIME
"battleGroup" => $XMLstream->characterInfo->character['battleGroup'],
"lastModified" => $XMLstream->characterInfo->character['lastModified'],
// TITLES
"current_title" => addslashes($current_title),
// "known_titles" => $knowntitles_string,
// TALENT SPECS
"talent1_active" => $talentspec1['active'],
"talent1_group" => $talentspec1['group'],
"talent1_icon" => $talentspec1['icon'],
"talent1_prim" => $talentspec1['prim'],
"talent1_treeOne" => $talentspec1['treeOne'],
"talent1_treeTwo" => $talentspec1['treeTwo'],
"talent1_treeThree" => $talentspec1['treeThree'],
"talent2_active" => $talentspec2['active'],
"talent2_group" => $talentspec2['group'],
"talent2_icon" => $talentspec2['icon'],
"talent2_prim" => $talentspec2['prim'],
"talent2_treeOne" => $talentspec2['treeOne'],
"talent2_treeTwo" => $talentspec2['treeTwo'],
"talent2_treeThree" => $talentspec2['treeThree'],
// PROFESSIONS
"profession1_key" => $profession1['key'],
"profession1_name" => $profession1['name'],
"profession1_max" => $profession1['max'],
"profession1_value" => $profession1['value'],
"profession2_key" => $profession2['key'],
"profession2_name" => $profession2['name'],
"profession2_max" => $profession2['max'],
"profession2_value" => $profession2['value'],
// PVP
"pvp_honorable_kills" => $XMLstream->characterInfo->characterTab->pvp->lifetimehonorablekills['value'],
"pvp_arena_currency" => $XMLstream->characterInfo->characterTab->pvp->arenacurrency['value'],
// CHARACTER BARS
"characterbars1_value" => $XMLstream->characterInfo->characterTab->characterBars->health['effective'],
"characterbars2_value" => $characterbars['effective'],
"characterbars2_casting" => $characterbars['casting'],
"characterbars2_notCasting" => $characterbars['notCasting'],
"characterbars2_type" => $characterbars['type'],
// BASE STATS
"basestats_strength_attack" => $basestats_strength['attack'],
"basestats_strength_base" => $basestats_strength['base'],
"basestats_strength_block" => $basestats_strength['block'],
"basestats_strength_effective" => $basestats_strength['effective'],
"basestats_agility_armor" => $basestats_agility['armor'],
"basestats_agility_attack" => $basestats_agility['attack'],
"basestats_agility_base" => $basestats_agility['base'],
"basestats_agility_critHitPercent" => $basestats_agility['critHitPercent'],
"basestats_agility_effective" => $basestats_agility['effective'],
"basestats_stamina_base" => $basestats_stamina['base'],
"basestats_stamina_effective" => $basestats_stamina['effective'],
"basestats_stamina_health" => $basestats_stamina['health'],
"basestats_stamina_petBonus" => $basestats_stamina['petBonus'],
"basestats_intellect_base" => $basestats_intellect['base'],
"basestats_intellect_critHitPercent" => $basestats_intellect['critHitPercent'],
"basestats_intellect_effective" => $basestats_intellect['effective'],
"basestats_intellect_mana" => $basestats_intellect['mana'],
"basestats_intellect_petBonus" => $basestats_intellect['petBonus'],
"basestats_spirit_base" => $basestats_spirit['base'],
"basestats_spirit_effective" => $basestats_spirit['effective'],
"basestats_spirit_healthRegen" => $basestats_spirit['healthRegen'],
"basestats_spirit_manaRegen" => $basestats_spirit['manaRegen'],
"basestats_armor_base" => $basestats_armor['base'],
"basestats_armor_effective" => $basestats_armor['effective'],
"basestats_armor_percent" => $basestats_armor['percent'],
"basestats_armor_petBonus" => $basestats_armor['petBonus'],
// RESISTANCES
"resistances_arcane_value" => $XMLstream->characterInfo->characterTab->resistances->arcane['value'],
"resistances_arcane_petBonus" => $XMLstream->characterInfo->characterTab->resistances->arcane['petBonus'],
"resistances_fire_value" => $XMLstream->characterInfo->characterTab->resistances->fire['value'],
"resistances_fire_petBonus" => $XMLstream->characterInfo->characterTab->resistances->fire['petBonus'],
"resistances_frost_value" => $XMLstream->characterInfo->characterTab->resistances->frost['value'],
"resistances_frost_petBonus" => $XMLstream->characterInfo->characterTab->resistances->frost['petBonus'],
"resistances_holy_value" => $XMLstream->characterInfo->characterTab->resistances->holy['value'],
"resistances_holy_petBonus" => $XMLstream->characterInfo->characterTab->resistances->holy['petBonus'],
"resistances_nature_value" => $XMLstream->characterInfo->characterTab->resistances->nature['value'],
"resistances_nature_petBonus" => $XMLstream->characterInfo->characterTab->resistances->nature['petBonus'],
"resistances_shadow_value" => $XMLstream->characterInfo->characterTab->resistances->shadow['value'],
"resistances_shadow_petBonus" => $XMLstream->characterInfo->characterTab->resistances->shadow['petBonus'],
// MELEE
"melee_mainHandDamage_dps" => $melee_mainHandDamage['dps'],
"melee_mainHandDamage_max" => $melee_mainHandDamage['max'],
"melee_mainHandDamage_min" => $melee_mainHandDamage['min'],
"melee_mainHandDamage_percent" => $melee_mainHandDamage['percent'],
"melee_mainHandDamage_speed" => $melee_mainHandDamage['speed'],
"melee_offHandDamage_dps" => $melee_offHandDamage['dps'],
"melee_offHandDamage_max" => $melee_offHandDamage['max'],
"melee_offHandDamage_min" => $melee_offHandDamage['min'],
"melee_offHandDamage_percent" => $melee_offHandDamage['percent'],
"melee_offHandDamage_speed" => $melee_offHandDamage['speed'],
"melee_mainHandSpeed_hastePercent" => $melee_mainHandSpeed['hastePercent'],
"melee_mainHandSpeed_hasteRating" => $melee_mainHandSpeed['hasteRating'],
"melee_mainHandSpeed_value" => $melee_mainHandSpeed['value'],
"melee_offHandSpeed_hastePercent" => $melee_offHandSpeed['hastePercent'],
"melee_offHandSpeed_hasteRating" => $melee_offHandSpeed['hasteRating'],
"melee_offHandSpeed_value" => $melee_offHandSpeed['value'],
"melee_power_base" => $melee_power['base'],
"melee_power_effective" => $melee_power['effective'],
"melee_power_increasedDps" => $melee_power['increasedDps'],
"melee_hitRating_increasedHitPercent" => $melee_hitRating['increasedHitPercent'],
"melee_hitRating_penetration" => $melee_hitRating['penetration'],
"melee_hitRating_reducedArmorPercent" => $melee_hitRating['reducedArmorPercent'],
"melee_hitRating_value" => $melee_hitRating['value'],
"melee_critChance_percent" => $melee_critChance['percent'],
"melee_critChance_plusPercent" => $melee_critChance['plusPercent'],
"melee_critChance_rating" => $melee_critChance['rating'],
"melee_expertise_additional" => $melee_expertise['additional'],
"melee_expertise_percent" => $melee_expertise['percent'],
"melee_expertise_rating" => $melee_expertise['rating'],
"melee_expertise_value" => $melee_expertise['value'],
// RANGED
"ranged_weaponSkill_rating" => $ranged_weaponSkill['rating'],
"ranged_weaponSkill_value" => $ranged_weaponSkill['value'],
"ranged_damage_dps" => $ranged_damage['dps'],
"ranged_damage_max" => $ranged_damage['max'],
"ranged_damage_min" => $ranged_damage['min'],
"ranged_damage_percent" => $ranged_damage['percent'],
"ranged_damage_speed" => $ranged_damage['speed'],
"ranged_speed_hastePercent" => $ranged_speed['hastePercent'],
"ranged_speed_hasteRating" => $ranged_speed['hasteRating'],
"ranged_speed_value" => $ranged_speed['value'],
"ranged_power_base" => $ranged_power['base'],
"ranged_power_effective" => $ranged_power['effective'],
"ranged_power_increasedDps" => $ranged_power['increasedDps'],
"ranged_power_petAttack" => $ranged_power['petAttack'],
"ranged_power_petSpell" => $ranged_power['petSpell'],
"ranged_hitRating_increasedHitPercent" => $ranged_hitRating['increasedHitPercent'],
"ranged_hitRating_penetration" => $ranged_hitRating['penetration'],
"ranged_hitRating_reducedArmorPercent" => $ranged_hitRating['reducedArmorPercent'],
"ranged_hitRating_value" => $ranged_hitRating['value'],
"ranged_critChance_percent" => $ranged_critChance['percent'],
"ranged_critChance_plusPercent" => $ranged_critChance['plusPercent'],
"ranged_critChance_rating" => $ranged_critChance['rating'],
// SPELL
"spell_bonusDamage_arcane" => $spell_bonusDamage->arcane['value'],
"spell_bonusDamage_fire" => $spell_bonusDamage->fire['value'],
"spell_bonusDamage_frost" => $spell_bonusDamage->frost['value'],
"spell_bonusDamage_holy" => $spell_bonusDamage->holy['value'],
"spell_bonusDamage_nature" => $spell_bonusDamage->nature['value'],
"spell_bonusDamage_shadow" => $spell_bonusDamage->shadow['value'],
"spell_bonusDamage_petBonus_attack" => $spell_bonusDamage->petBonus['attack'],
"spell_bonusDamage_petBonus_damage" => $spell_bonusDamage->petBonus['damage'],
"spell_bonusDamage_petBonus_fromType" => $spell_bonusDamage->petBonus['fromType'],
"spell_bonusHealing" => $XMLstream->characterInfo->characterTab->spell->bonusHealing['value'],
"spell_hitRating_increasedHitPercent" => $spell_hitRating['increasedHitPercent'],
"spell_hitRating_penetration" => $spell_hitRating['penetration'],
"spell_hitRating_reducedResist" => $spell_hitRating['reducedResist'],
"spell_hitRating_value" => $spell_hitRating['value'],
"spell_critChance_rating" => $spell_critChance['rating'],
"spell_critChance_arcane_percent" => $spell_critChance->arcane['percent'],
"spell_critChance_fire_percent" => $spell_critChance->fire['percent'],
"spell_critChance_frost_percent" => $spell_critChance->frost['percent'],
"spell_critChance_holy_percent" => $spell_critChance->holy['percent'],
"spell_critChance_nature_percent" => $spell_critChance->nature['percent'],
"spell_critChance_shadow_percent" => $spell_critChance->shadow['percent'],
"spell_penetration" => $XMLstream->characterInfo->characterTab->spell->penetration['value'],
"spell_manaRegen_casting" => $spell_manaRegen['casting'],
"spell_manaRegen_notCasting" => $spell_manaRegen['notCasting'],
"spell_hastePercent" => $spell_hasteRating['hastePercent'],
"spell_hasteRating" => $spell_hasteRating['hasteRating'],
// DEFENSES
"defenses_armor_base" => $defenses_armor['base'],
"defenses_armor_effective" => $defenses_armor['effective'],
"defenses_armor_percent" => $defenses_armor['percent'],
"defenses_armor_petBonus" => $defenses_armor['petBonus'],
"defenses_defense_decreasePercent" => $defenses_defense['decreasePercent'],
"defenses_defense_increasePercent" => $defenses_defense['increasePercent'],
"defenses_defense_plusDefense" => $defenses_defense['plusDefense'],
"defenses_defense_rating" => $defenses_defense['rating'],
"defenses_defense_value" => $defenses_defense['value'],
"defenses_dodge_increasePercent" => $defenses_dodge['increasePercent'],
"defenses_dodge_percent" => $defenses_dodge['percent'],
"defenses_dodge_rating" => $defenses_dodge['rating'],
"defenses_parry_increasePercent" => $defenses_parry['increasePercent'],
"defenses_parry_percent" => $defenses_parry['percent'],
"defenses_parry_rating" => $defenses_parry['rating'],
"defenses_block_increasePercent" => $defenses_block['increasePercent'],
"defenses_block_percent" => $defenses_block['percent'],
"defenses_block_rating" => $defenses_block['rating'],
"defenses_resilience_damagePercent" => $defenses_resilience['damagePercent'],
"defenses_resilience_hitPercent" => $defenses_resilience['hitPercent'],
"defenses_resilience_value" => $defenses_resilience['value'],
// ITEMS
"item0_durability" => $items[0]['durability'], // ITEMS - SLOT 0
"item0_gem0Id" => $items[0]['gem0Id'],
"item0_gem1Id" => $items[0]['gem1Id'],
"item0_gem2Id" => $items[0]['gem2Id'],
"item0_icon" => $items[0]['icon'],
"item0_id" => $items[0]['id'],
"item0_maxDurability" => $items[0]['maxDurability'],
"item0_permanentenchant" => $items[0]['permanentenchant'],
"item0_randomPropertiesId" => $items[0]['randomPropertiesId'],
"item0_seed" => $items[0]['seed'],
"item0_slot" => $items[0]['slot'],
"item1_durability" => $items[1]['durability'], // ITEMS - SLOT 1
"item1_gem0Id" => $items[1]['gem0Id'],
"item1_gem1Id" => $items[1]['gem1Id'],
"item1_gem2Id" => $items[1]['gem2Id'],
"item1_icon" => $items[1]['icon'],
"item1_id" => $items[1]['id'],
"item1_maxDurability" => $items[1]['maxDurability'],
"item1_permanentenchant" => $items[1]['permanentenchant'],
"item1_randomPropertiesId" => $items[1]['randomPropertiesId'],
"item1_seed" => $items[1]['seed'],
"item1_slot" => $items[1]['slot'],
"item2_durability" => $items[2]['durability'], // ITEMS - SLOT 2
"item2_gem0Id" => $items[2]['gem0Id'],
"item2_gem1Id" => $items[2]['gem1Id'],
"item2_gem2Id" => $items[2]['gem2Id'],
"item2_icon" => $items[2]['icon'],
"item2_id" => $items[2]['id'],
"item2_maxDurability" => $items[2]['maxDurability'],
"item2_permanentenchant" => $items[2]['permanentenchant'],
"item2_randomPropertiesId" => $items[2]['randomPropertiesId'],
"item2_seed" => $items[2]['seed'],
"item2_slot" => $items[2]['slot'],
"item3_durability" => $items[3]['durability'], // ITEMS - SLOT 3
"item3_gem0Id" => $items[3]['gem0Id'],
"item3_gem1Id" => $items[3]['gem1Id'],
"item3_gem2Id" => $items[3]['gem2Id'],
"item3_icon" => $items[3]['icon'],
"item3_id" => $items[3]['id'],
"item3_maxDurability" => $items[3]['maxDurability'],
"item3_permanentenchant" => $items[3]['permanentenchant'],
"item3_randomPropertiesId" => $items[3]['randomPropertiesId'],
"item3_seed" => $items[3]['seed'],
"item3_slot" => $items[3]['slot'],
"item4_durability" => $items[4]['durability'], // ITEMS - SLOT 4
"item4_gem0Id" => $items[4]['gem0Id'],
"item4_gem1Id" => $items[4]['gem1Id'],
"item4_gem2Id" => $items[4]['gem2Id'],
"item4_icon" => $items[4]['icon'],
"item4_id" => $items[4]['id'],
"item4_maxDurability" => $items[4]['maxDurability'],
"item4_permanentenchant" => $items[4]['permanentenchant'],
"item4_randomPropertiesId" => $items[4]['randomPropertiesId'],
"item4_seed" => $items[4]['seed'],
"item4_slot" => $items[4]['slot'],
"item5_durability" => $items[5]['durability'], // ITEMS - SLOT 5
"item5_gem0Id" => $items[5]['gem0Id'],
"item5_gem1Id" => $items[5]['gem1Id'],
"item5_gem2Id" => $items[5]['gem2Id'],
"item5_icon" => $items[5]['icon'],
"item5_id" => $items[5]['id'],
"item5_maxDurability" => $items[5]['maxDurability'],
"item5_permanentenchant" => $items[5]['permanentenchant'],
"item5_randomPropertiesId" => $items[5]['randomPropertiesId'],
"item5_seed" => $items[5]['seed'],
"item5_slot" => $items[5]['slot'],
"item6_durability" => $items[6]['durability'], // ITEMS - SLOT 6
"item6_gem0Id" => $items[6]['gem0Id'],
"item6_gem1Id" => $items[6]['gem1Id'],
"item6_gem2Id" => $items[6]['gem2Id'],
"item6_icon" => $items[6]['icon'],
"item6_id" => $items[6]['id'],
"item6_maxDurability" => $items[6]['maxDurability'],
"item6_permanentenchant" => $items[6]['permanentenchant'],
"item6_randomPropertiesId" => $items[6]['randomPropertiesId'],
"item6_seed" => $items[6]['seed'],
"item6_slot" => $items[6]['slot'],
"item7_durability" => $items[7]['durability'], // ITEMS - SLOT 7
"item7_gem0Id" => $items[7]['gem0Id'],
"item7_gem1Id" => $items[7]['gem1Id'],
"item7_gem2Id" => $items[7]['gem2Id'],
"item7_icon" => $items[7]['icon'],
"item7_id" => $items[7]['id'],
"item7_maxDurability" => $items[7]['maxDurability'],
"item7_permanentenchant" => $items[7]['permanentenchant'],
"item7_randomPropertiesId" => $items[7]['randomPropertiesId'],
"item7_seed" => $items[7]['seed'],
"item7_slot" => $items[7]['slot'],
"item8_durability" => $items[8]['durability'], // ITEMS - SLOT 8
"item8_gem0Id" => $items[8]['gem0Id'],
"item8_gem1Id" => $items[8]['gem1Id'],
"item8_gem2Id" => $items[8]['gem2Id'],
"item8_icon" => $items[8]['icon'],
"item8_id" => $items[8]['id'],
"item8_maxDurability" => $items[8]['maxDurability'],
"item8_permanentenchant" => $items[8]['permanentenchant'],
"item8_randomPropertiesId" => $items[8]['randomPropertiesId'],
"item8_seed" => $items[8]['seed'],
"item8_slot" => $items[8]['slot'],
"item9_durability" => $items[9]['durability'], // ITEMS - SLOT 9
"item9_gem0Id" => $items[9]['gem0Id'],
"item9_gem1Id" => $items[9]['gem1Id'],
"item9_gem2Id" => $items[9]['gem2Id'],
"item9_icon" => $items[9]['icon'],
"item9_id" => $items[9]['id'],
"item9_maxDurability" => $items[9]['maxDurability'],
"item9_permanentenchant" => $items[9]['permanentenchant'],
"item9_randomPropertiesId" => $items[9]['randomPropertiesId'],
"item9_seed" => $items[9]['seed'],
"item9_slot" => $items[9]['slot'],
"item10_durability" => $items[10]['durability'], // ITEMS - SLOT 10
"item10_gem0Id" => $items[10]['gem0Id'],
"item10_gem1Id" => $items[10]['gem1Id'],
"item10_gem2Id" => $items[10]['gem2Id'],
"item10_icon" => $items[10]['icon'],
"item10_id" => $items[10]['id'],
"item10_maxDurability" => $items[10]['maxDurability'],
"item10_permanentenchant" => $items[10]['permanentenchant'],
"item10_randomPropertiesId" => $items[10]['randomPropertiesId'],
"item10_seed" => $items[10]['seed'],
"item10_slot" => $items[10]['slot'],
"item11_durability" => $items[11]['durability'], // ITEMS - SLOT 11
"item11_gem0Id" => $items[11]['gem0Id'],
"item11_gem1Id" => $items[11]['gem1Id'],
"item11_gem2Id" => $items[11]['gem2Id'],
"item11_icon" => $items[11]['icon'],
"item11_id" => $items[11]['id'],
"item11_maxDurability" => $items[11]['maxDurability'],
"item11_permanentenchant" => $items[11]['permanentenchant'],
"item11_randomPropertiesId" => $items[11]['randomPropertiesId'],
"item11_seed" => $items[11]['seed'],
"item11_slot" => $items[11]['slot'],
"item12_durability" => $items[12]['durability'], // ITEMS - SLOT 12
"item12_gem0Id" => $items[12]['gem0Id'],
"item12_gem1Id" => $items[12]['gem1Id'],
"item12_gem2Id" => $items[12]['gem2Id'],
"item12_icon" => $items[12]['icon'],
"item12_id" => $items[12]['id'],
"item12_maxDurability" => $items[12]['maxDurability'],
"item12_permanentenchant" => $items[12]['permanentenchant'],
"item12_randomPropertiesId" => $items[12]['randomPropertiesId'],
"item12_seed" => $items[12]['seed'],
"item12_slot" => $items[12]['slot'],
"item13_durability" => $items[13]['durability'], // ITEMS - SLOT 13
"item13_gem0Id" => $items[13]['gem0Id'],
"item13_gem1Id" => $items[13]['gem1Id'],
"item13_gem2Id" => $items[13]['gem2Id'],
"item13_icon" => $items[13]['icon'],
"item13_id" => $items[13]['id'],
"item13_maxDurability" => $items[13]['maxDurability'],
"item13_permanentenchant" => $items[13]['permanentenchant'],
"item13_randomPropertiesId" => $items[13]['randomPropertiesId'],
"item13_seed" => $items[13]['seed'],
"item13_slot" => $items[13]['slot'],
"item14_durability" => $items[14]['durability'], // ITEMS - SLOT 14
"item14_gem0Id" => $items[14]['gem0Id'],
"item14_gem1Id" => $items[14]['gem1Id'],
"item14_gem2Id" => $items[14]['gem2Id'],
"item14_icon" => $items[14]['icon'],
"item14_id" => $items[14]['id'],
"item14_maxDurability" => $items[14]['maxDurability'],
"item14_permanentenchant" => $items[14]['permanentenchant'],
"item14_randomPropertiesId" => $items[14]['randomPropertiesId'],
"item14_seed" => $items[14]['seed'],
"item14_slot" => $items[14]['slot'],
"item15_durability" => $items[15]['durability'], // ITEMS - SLOT 15
"item15_gem0Id" => $items[15]['gem0Id'],
"item15_gem1Id" => $items[15]['gem1Id'],
"item15_gem2Id" => $items[15]['gem2Id'],
"item15_icon" => $items[15]['icon'],
"item15_id" => $items[15]['id'],
"item15_maxDurability" => $items[15]['maxDurability'],
"item15_permanentenchant" => $items[15]['permanentenchant'],
"item15_randomPropertiesId" => $items[15]['randomPropertiesId'],
"item15_seed" => $items[15]['seed'],
"item15_slot" => $items[15]['slot'],
"item16_durability" => $items[16]['durability'], // ITEMS - SLOT 16
"item16_gem0Id" => $items[16]['gem0Id'],
"item16_gem1Id" => $items[16]['gem1Id'],
"item16_gem2Id" => $items[16]['gem2Id'],
"item16_icon" => $items[16]['icon'],
"item16_id" => $items[16]['id'],
"item16_maxDurability" => $items[16]['maxDurability'],
"item16_permanentenchant" => $items[16]['permanentenchant'],
"item16_randomPropertiesId" => $items[16]['randomPropertiesId'],
"item16_seed" => $items[16]['seed'],
"item16_slot" => $items[16]['slot'],
"item17_durability" => $items[17]['durability'], // ITEMS - SLOT 17
"item17_gem0Id" => $items[17]['gem0Id'],
"item17_gem1Id" => $items[17]['gem1Id'],
"item17_gem2Id" => $items[17]['gem2Id'],
"item17_icon" => $items[17]['icon'],
"item17_id" => $items[17]['id'],
"item17_maxDurability" => $items[17]['maxDurability'],
"item17_permanentenchant" => $items[17]['permanentenchant'],
"item17_randomPropertiesId" => $items[17]['randomPropertiesId'],
"item17_seed" => $items[17]['seed'],
"item17_slot" => $items[17]['slot'],
"item18_durability" => $items[18]['durability'], // ITEMS - SLOT 18
"item18_gem0Id" => $items[18]['gem0Id'],
"item18_gem1Id" => $items[18]['gem1Id'],
"item18_gem2Id" => $items[18]['gem2Id'],
"item18_icon" => $items[18]['icon'],
"item18_id" => $items[18]['id'],
"item18_maxDurability" => $items[18]['maxDurability'],
"item18_permanentenchant" => $items[18]['permanentenchant'],
"item18_randomPropertiesId" => $items[18]['randomPropertiesId'],
"item18_seed" => $items[18]['seed'],
"item18_slot" => $items[18]['slot'],
// GLYPHS
"glyph0_effect" => addslashes($glyphs0['effect']),
"glyph0_icon" => $glyphs0['icon'],
"glyph0_name" => addslashes($glyphs0['name']),
"glyph0_type" => $glyphs0['type'],
"glyph1_effect" => addslashes($glyphs1['effect']),
"glyph1_icon" => $glyphs1['icon'],
"glyph1_name" => addslashes($glyphs1['name']),
"glyph1_type" => $glyphs1['type'],
"glyph2_effect" => addslashes($glyphs2['effect']),
"glyph2_icon" => $glyphs2['icon'],
"glyph2_name" => addslashes($glyphs2['name']),
"glyph2_type" => $glyphs2['type'],
"glyph3_effect" => addslashes($glyphs3['effect']),
"glyph3_icon" => $glyphs3['icon'],
"glyph3_name" => addslashes($glyphs3['name']),
"glyph3_type" => $glyphs3['type'],
"glyph4_effect" => addslashes($glyphs4['effect']),
"glyph4_icon" => $glyphs4['icon'],
"glyph4_name" => addslashes($glyphs4['name']),
"glyph4_type" => $glyphs4['type'],
"glyph5_effect" => addslashes($glyphs5['effect']),
"glyph5_icon" => $glyphs5['icon'],
"glyph5_name" => addslashes($glyphs5['name']),
"glyph5_type" => $glyphs5['type'],
// ACHIEVEMENT SUMMARY
"summary_total_earned" => $achSummary->c['earned'],
"summary_total_points" => $achSummary->c['points'],
"summary_total_total" => $achSummary->c['total'],
"summary_total_totalPoints" => $achSummary->c['totalPoints'],
"summary_General_earned" => $achSummary->category[0]->c['earned'],
"summary_General_points" => $achSummary->category[0]->c['earnedPoints'],
"summary_General_total" => $achSummary->category[0]->c['total'],
"summary_General_totalPoints" => $achSummary->category[0]->c['totalPoints'],
"summary_Quests_earned" => $achSummary->category[1]->c['earned'],
"summary_Quests_points" => $achSummary->category[1]->c['earnedPoints'],
"summary_Quests_total" => $achSummary->category[1]->c['total'],
"summary_Quests_totalPoints" => $achSummary->category[1]->c['totalPoints'],
"summary_Exploration_earned" => $achSummary->category[2]->c['earned'],
"summary_Exploration_points" => $achSummary->category[2]->c['earnedPoints'],
"summary_Exploration_total" => $achSummary->category[2]->c['total'],
"summary_Exploration_totalPoints" => $achSummary->category[2]->c['totalPoints'],
"summary_PvP_earned" => $achSummary->category[3]->c['earned'],
"summary_PvP_points" => $achSummary->category[3]->c['earnedPoints'],
"summary_PvP_total" => $achSummary->category[3]->c['total'],
"summary_PvP_totalPoints" => $achSummary->category[3]->c['totalPoints'],
"summary_Dungeons_earned" => $achSummary->category[4]->c['earned'],
"summary_Dungeons_points" => $achSummary->category[4]->c['earnedPoints'],
"summary_Dungeons_total" => $achSummary->category[4]->c['total'],
"summary_Dungeons_totalPoints" => $achSummary->category[4]->c['totalPoints'],
"summary_Professions_earned" => $achSummary->category[5]->c['earned'],
"summary_Professions_points" => $achSummary->category[5]->c['earnedPoints'],
"summary_Professions_total" => $achSummary->category[5]->c['total'],
"summary_Professions_totalPoints" => $achSummary->category[5]->c['totalPoints'],
"summary_Reputation_earned" => $achSummary->category[6]->c['earned'],
"summary_Reputation_points" => $achSummary->category[6]->c['earnedPoints'],
"summary_Reputation_total" => $achSummary->category[6]->c['total'],
"summary_Reputation_totalPoints" => $achSummary->category[6]->c['totalPoints'],
"summary_WorldEvents_earned" => $achSummary->category[7]->c['earned'],
"summary_WorldEvents_points" => $achSummary->category[7]->c['earnedPoints'],
"summary_WorldEvents_total" => $achSummary->category[7]->c['total'],
"summary_WorldEvents_totalPoints" => $achSummary->category[7]->c['totalPoints'],
"summary_Feats_earned" => $achSummary->category[8]->c['earned'],
// ACHIEVEMENT SUMMARY - LAST 5
"summary_last0_categoryId" => $achievements[0]['categoryId'],
"summary_last0_dateCompleted" => $achievements[0]['dateCompleted'],
"summary_last0_desc" => addslashes($achievements[0]['desc']),
"summary_last0_icon" => addslashes($achievements[0]['icon']),
"summary_last0_id" => $achievements[0]['id'],
"summary_last0_points" => $achievements[0]['points'],
"summary_last0_title" => addslashes($achievements[0]['title']),
"summary_last1_categoryId" => $achievements[1]['categoryId'],
"summary_last1_dateCompleted" => $achievements[1]['dateCompleted'],
"summary_last1_desc" => addslashes($achievements[1]['desc']),
"summary_last1_icon" => addslashes($achievements[1]['icon']),
"summary_last1_id" => $achievements[1]['id'],
"summary_last1_points" => $achievements[1]['points'],
"summary_last1_title" => addslashes($achievements[1]['title']),
"summary_last2_categoryId" => $achievements[2]['categoryId'],
"summary_last2_dateCompleted" => $achievements[2]['dateCompleted'],
"summary_last2_desc" => addslashes($achievements[2]['desc']),
"summary_last2_icon" => addslashes($achievements[2]['icon']),
"summary_last2_id" => $achievements[2]['id'],
"summary_last2_points" => $achievements[2]['points'],
"summary_last2_title" => addslashes($achievements[2]['title']),
"summary_last3_categoryId" => $achievements[3]['categoryId'],
"summary_last3_dateCompleted" => $achievements[3]['dateCompleted'],
"summary_last3_desc" => addslashes($achievements[3]['desc']),
"summary_last3_icon" => addslashes($achievements[3]['icon']),
"summary_last3_id" => $achievements[3]['id'],
"summary_last3_points" => $achievements[3]['points'],
"summary_last3_title" => addslashes($achievements[3]['title']),
"summary_last4_categoryId" => $achievements[4]['categoryId'],
"summary_last4_dateCompleted" => $achievements[4]['dateCompleted'],
"summary_last4_desc" => addslashes($achievements[4]['desc']),
"summary_last4_icon" => addslashes($achievements[4]['icon']),
"summary_last4_id" => $achievements[4]['id'],
"summary_last4_points" => $achievements[4]['points'],
"summary_last4_title" => addslashes($achievements[4]['title'])
);
return $char_Array;
}
//------------------------------------------------------------------
// Build the Character Array from the supplied guild XML stream
function buildCharacterArray($XMLstream) {
global $config;
$count_Members = 0;
$char_Array = array();
foreach ($XMLstream->guildInfo->guild->members->character as $char) {
$process_char = false;
$process_char_list = false;
if( $config['chars_to_process'] == -1 ) {
if ( $config['use_char_selction_list'] ) {
if (in_array($char['name'],$config['char_selction_list'])) $process_char = true;
} else { $process_char = true; }
} else {
if( $count_Members < $config['chars_to_process'] ) $process_char = true;
}
// BUGGY if ( $char['level'] >= $config['min_char_level'] ) $process_char = false; // Limits display Chars beyond a certain level
// BUGGY if ( $char['rank'] <= $config['min_char_rank'] ) $process_char = false; // Limits display to Guild Rank (depending on your guild ranks)
if( $process_char ) {
$toonrace = return_race($char['raceId'], $char['genderId']); // Maps Race and Sex
$toongender = return_gender($char['genderId']); // Maps Sex
$toonclass = return_class($char['classId']); // Maps class name
$toonrank = return_rank($char['rank']); // Maps guild rank name
$char_info_Array = array(
"name" => (string)$char['name'],
"level" => (string)$char['level'],
"class" => $toonclass,
"gender" => $toongender,
"race" => $toonrace,
"rank" => $char['rank'].' - '.$toonrank,
"achPoints" => (string)$char['achPoints'],
"url" => $config['url_prefix_char'].(string)$char['url'] );
$char_Array[] = $char_info_Array;
}
$count_Members++;
}
return $char_Array;
}
//------------------------------------------------------------------
// Print the supplied Character Array
function printCharacterArray($charArray, $array_sort_field, $array_sort_direction) {
global $config;
if ( count($charArray) != 0 ) {
switch($array_sort_direction){
case 'asc' : $sortDir = 'desc'; break;
case 'desc' : $sortDir = 'asc'; break;
}
switch($array_sort_field){
case 'name' : $sortFieldname = ' ['.$array_sort_direction.']'; break;
case 'level' : $sortFieldlevel = ' ['.$array_sort_direction.']'; break;
case 'class' : $sortFieldclass = ' ['.$array_sort_direction.']'; break;
case 'gender' : $sortFieldgender = ' ['.$array_sort_direction.']'; break;
case 'race' : $sortFieldrace = ' ['.$array_sort_direction.']'; break;
case 'rank' : $sortFieldrank = ' ['.$array_sort_direction.']'; break;
case 'achPoints' : $sortFieldachPoints = ' ['.$array_sort_direction.']'; break;
case 'url' : $sortFieldlink = ' ['.$array_sort_direction.']'; break;
}
echo '<b>DISPLAY GUILD DATA:</b><BR/><table width="100%" border="1">';
echo '<td width=""><a href="'.$config['base_filename'].'?sort=name&direction='.$sortDir.'">NAME'.$sortFieldname.'</a></td>';
echo '<td width=""><a href="'.$config['base_filename'].'?sort=level&direction='.$sortDir.'">LEVEL'.$sortFieldlevel.'</a></td>';
echo '<td width=""><a href="'.$config['base_filename'].'?sort=class&direction='.$sortDir.'">CLASS'.$sortFieldclass.'</a></td>';
echo '<td width=""><a href="'.$config['base_filename'].'?sort=gender&direction='.$sortDir.'">GENDER'.$sortFieldgender.'</a></td>';
echo '<td width=""><a href="'.$config['base_filename'].'?sort=race&direction='.$sortDir.'">RACE'.$sortFieldrace.'</a></td>';
echo '<td width=""><a href="'.$config['base_filename'].'?sort=rank&direction='.$sortDir.'">RANK'.$sortFieldrank.'</a></td>';
echo '<td width=""><a href="'.$config['base_filename'].'?sort=achPoints&direction='.$sortDir.'">POINTS'.$sortFieldachPoints.'</a></td>';
echo '<td width=""><a href="'.$config['base_filename'].'?sort=url&direction='.$sortDir.'">URL'.$sortFieldlink.'</a></td>';
echo '</tr>';
foreach ($charArray as $char) {
echo '<tr id="'.$char['name'].'">';
echo '<td>'.$char['name'].' </td>';
echo '<td>'.$char['level'].' </td>';
echo '<td>'.$char['class'].' </td>';
echo '<td>'.$char['gender'].' </td>';
echo '<td>'.$char['race'].' </td>';
echo '<td>'.$char['rank'].' </td>';
echo '<td>'.$char['achPoints'].' </td>';
echo '<td><a href="'.$char['url'].'" target="_blank">'.$char['url'].'</a></td>';
echo '</tr>';
$count_Members++;
}
echo '</table>';
}
}
//------------------------------------------------------------------
// Prints everything in the supplied Character Array
function printCompleteCharacterArray($charArray) {
global $config;
echo '<br /><P><b>DISPLAY GUILD DATA:</b><BR/><table width="100%" border="1">';
foreach ($charArray[0] as $key => $value ) {
echo '<td width=""><b>'.$key.'</b></td>';
}
echo '</tr>';
foreach ($charArray as $char) {
echo '<tr id="'.$char['name'].'">';
foreach ($char as $value) {
echo '<td>'.$value.' </td>';
}
echo '</tr>';
}
echo '</table>';
}
//------------------------------------------------------------------
// Dynamically builds the supplied Character Array as a SQL IMPORT Statement
function printSQLCharacterArray($charArray,$guildCount,$guildBG) {
global $config;
if ( count($charArray) != 0 ) {
if ( ($config['show_sql_import_structure']) || ($config['show_sql_import_data']) ) {
// BUILD THE TABLE STRUCTURE
$sql_import_structure = "";
$sql_table_structure_row = "CREATE TABLE `".$config['sql_table']."` (
`ID` bigint(255) NOT NULL AUTO_INCREMENT,
";
$countKey = 0;
foreach ($charArray[0] as $key => $value ) {
if ( $countKey == 0 ) {
$sql_import_structure .= $key;
} else {
$sql_import_structure .= ", ".$key;
}
$sql_table_structure_row .= " `".$key."` text(600) CHARACTER SET utf8 DEFAULT NULL,
";
$countKey++;
}
$sql_table_structure_row .= " PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;";
// START BUILDING THE SQL IMPORT STATEMENT
$sql_table_structure = "SET NAMES utf8;
SET CHARACTER SET utf8;
SET SQL_MODE='';
USE ".$config['sql_database'].";
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
/*Table structure for table `".$config['sql_table']."` */
DROP TABLE IF EXISTS `".$config['sql_table']."`;
".$sql_table_structure_row."
SET SQL_MODE=@OLD_SQL_MODE;";
$sql_string = "USE ".$config['sql_database']."; TRUNCATE TABLE ".$config['sql_table'].";
UPDATE guild_information SET guild_members = '".$guildCount."', battlegroup = '".$guildBG."' WHERE guild_name='".$config['guild_name']."';
";
// BUILD THE CHARACTER INSERT STATEMENTS
$countChar = 0;
foreach ($charArray as $char) {
// BUILD VALUE STRING
$sql_import_values = "";
$countValue = 0;
foreach ($charArray[$countChar] as $key => $value ) {
if ( $countValue == 0 ) {
$sql_import_values .= "'".$value."'";
} else {
$sql_import_values .= ", '".$value."'";
}
$countValue++;
}
$sql_row = "INSERT INTO ".$config['sql_table']." (".$sql_import_structure.") VALUES (".$sql_import_values.");
";
$sql_string .= $sql_row;
$countChar++;
}
}
if ( $config['show_sql_import_structure'] ) {
echo '<br /><P><b>SQL TABLE STRUCTURE IMPORT STATEMENT:</b> '.$countKey.' keys with Text(600) limit each, equals '.($countKey*600).' total potential characters...<BR/><textarea rows="20" cols="180" wrap="off">'.$sql_table_structure.'</textarea><P>';
}
if ( $config['show_sql_import_data'] ) {
echo '<br /><P><b>SQL TABLE DATA IMPORT STATEMENT:</b><BR/><textarea rows="30" cols="180" wrap="off">'.$sql_string.'</textarea><P>';
}
// SAVE SQL TO FILE
$newSQLfile = $config['DIR_sql'].'guild_sql-'.date('Y.m.d-H.i.s').'.sql'; // GET THE LATEST CACHE GUILD XML FILE
$fh = fopen($newSQLfile, 'wb');
$numbytes = fwrite($fh, $sql_string);
fclose($fh);
}
}
//------------------------------------------------------------------
// Sort the supplied Character Array
function sortCharacterArray($charArray, $array_sort_field, $array_sort_direction) {
// OBTAIN A LIST OF COLUMNS TO SORT
foreach ($charArray as $key => $row) {
$name[] = $row['name'];
$level[] = $row['level'];
$class[] = $row['class'];
$gender[] = $row['gender'];
$race[] = $row['race'];
$rank[] = $row['rank'];
$achPoints[] = $row['achPoints'];
$url[] = $row['url'];
}
// SETUP SORT SETTINGS
switch($array_sort_field){
case 'name' : $sortField = $name; $sortType = SORT_STRING; break;
case 'level' : $sortField = $level; $sortType = SORT_NUMERIC; break;
case 'class' : $sortField = $class; $sortType = SORT_STRING; break;
case 'gender' : $sortField = $gender; $sortType = SORT_STRING; break;
case 'race' : $sortField = $race; $sortType = SORT_STRING; break;
case 'rank' : $sortField = $rank; $sortType = SORT_NUMERIC; break;
case 'achPoints' : $sortField = $achPoints; $sortType = SORT_NUMERIC; break;
case 'url' : $sortField = $url; $sortType = SORT_STRING; break;
}
// SORT THE ARRAY
switch($array_sort_direction){
case 'asc' : array_multisort($sortField, SORT_ASC, $sortType, $level, SORT_DESC, SORT_NUMERIC, $name, SORT_ASC, SORT_STRING, $charArray); break;
case 'desc' : array_multisort($sortField, SORT_DESC, $sortType, $level, SORT_DESC, SORT_NUMERIC, $name, SORT_ASC, SORT_STRING, $charArray); break;
}
return $charArray ;
}
// PREVIOUSLY DECLARED CLASSES
static $browser_user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
function return_class($classid) {
switch ($classid) {
case 1:
$class = "Warrior";
break;
case 2:
$class = "Paladin";
break;
case 3:
$class = "Hunter";
break;
case 4:
$class = "Rogue";
break;
case 5:
$class = "Priest";
break;
case 6:
$class = "Death Knight";
break;
case 7:
$class = "Shaman";
break;
case 8:
$class = "Mage";
break;
case 9:
$class = "Warlock";
break;
case 11:
$class = "Druid";
break;
}
return $class;
}
function return_rank($rankid) { // Adjust the names here for the guild rank names. 0 is always the Guild owner
switch ($rankid) {
case 0:
$class = "Guild Master";
break;
case 1:
$class = "Guild Leader";
break;
case 2:
$class = "VIP";
break;
case 3:
$class = "Member";
break;
case 4:
$class = "Initiate";
break;
case 5:
$class = "-";
break;
case 6:
$class = "-";
break;
case 7:
$class = "-";
break;
case 8:
$class = "-";
break;
}
return $class;
}
function return_race2($raceid, $sex) {
switch ($raceid) {
case 1:
if ($sex == "0") {$race = "Human Male";}
if ($sex == "1") {$race = "Human Female";}
break;
case 2:
if ($sex == "0") {$race = "Orc Male";}
if ($sex == "1") {$race = "Orc Female";}
break;
case 3:
if ($sex == "0") {$race = "Dwarf Male";}
if ($sex == "1") {$race = "Dwarf Female";}
break;
case 4:
if ($sex == "0") {$race = "Night Elf Male";}
if ($sex == "1") {$race = "Night Elf Female";}
break;
case 5:
if ($sex == "0") {$race = "Undead Male";}
if ($sex == "1") {$race = "Undead Female";}
break;
case 6:
if ($sex == "0") {$race = "Tauren Male";}
if ($sex == "1") {$race = "Tauren Female";}
break;
case 7:
if ($sex == "0") {$race = "Gnome Male";}
if ($sex == "1") {$race = "Gnome Female";}
break;
case 8:
if ($sex == "0") {$race = "Troll Male";}
if ($sex == "1") {$race = "Troll Female";}
break;
case 10:
if ($sex == "0") {$race = "Blood Elf Male";}
if ($sex == "1") {$race = "Blood Elf Female";}
break;
case 11:
if ($sex == "0") {$race = "Draenei Male";}
if ($sex == "1") {$race = "Draenei Female";}
break;
}
return $race;
}
function return_race($raceid, $sex) {
switch ($raceid) {
case 1:
$race = "Human";
break;
case 2:
$race = "Orc";
break;
case 3:
$race = "Dwarf";
break;
case 4:
$race = "Night Elf";
break;
case 5:
$race = "Undead";
break;
case 6:
$race = "Tauren";
break;
case 7:
$race = "Gnome";
break;
case 8:
$race = "Troll";
break;
case 10:
$race = "Blood Elf";
break;
case 11:
$race = "Draenei";
break;
}
return $race;
}
function return_gender($genderid) {
if ($genderid == "0") {$gender = "Male";}
if ($genderid == "1") {$gender = "Female";}
return $gender;
}
?>
Last edited by DJRavine : 03-18-2010 at 01:28 PM.
Reason: Added link to my guild.. hehe... :D
|