Kastang Ramblings of a Geek

10Jun/110

Vanilla2: Enable HTML in Inbox Conversations

For an unknown reason, Vanilla2 does not allow HTML in Inbox conversations. As far as I can tell, this issue has existed since the release of Vanilla2 last year. This bug has remained at least until the latest revision of Vanilla - 2.0.17.10. This solution can be easily fixed by modifying one line:

/applications/conversations/views/messages/messages.php:

On or around Line 36, change Gdn_Format::To to Gdn_Format::Html.

After the change, HTML will render properly in Inbox Conversations.

Tagged as: , No Comments
25Apr/110

xkcd Comic Downloader

I have created a simple Perl script that will locally store every xkcd comic and generate a HTML file to view all xkcd comics on a single page. After the initial run of this script, each additional run will do incremental updates (only new comics will be downloaded since the last time the script was executed).

The script can be run from a command line:

perl xkcd.pl

or, by setting xkcd.pl to executable and running it as:

./xkcd.pl

The latest revision of the code can be found on Github. Please read the README file on Github for Perl requirements.

Tagged as: , , No Comments
19Mar/110

WoW Realm Status PHP Class

I am working on a PHP Class called RealmStatus that will pull WoW Realm information from the WoW Realm Status Page without XML feeds available.

The RealmStatus Class currently supports the following operations:
--getAllServers() - Returns an associative array of all Server Names, Statuses, Populations, Types, and Locale.
--getServerType($) - Returns the type of a given server.
--getServerStatus($) - Returns the status of a given server.
--getServerPopulation($) - Returns the population of a given server.
--getServerLocale($) - Returns the locale of a given server.

For a detailed explanation of the operations, please read the function headers in the RealmStatus.php and example.php files.

The files can be pulled from GitHub here.

Filed under: Coding, PHP, WoW No Comments
13Jan/118

WoW Roster PHP Class

I am working on a PHP Class called RosterAPI that will parse the WoW Armory without XML Files. Unlike my previous two posts (Part 1 and Part 2), the information for each character can be pulled through get methods. Also included in RosterAPI are guild specific functions not included in my previous posts.

The following methods are currently included:

Character Specific:
* getLevel()
* getGender()
* getClass()
* getRace()
* getAchievementPoints()
* getProfessions(): Returns an associative array containing the name and value of each profession.
* getTalents(): Returns an associative array containing the name and value of each talent tree.
* getStat($stat): Please view the comment header of the getStat() function for a list of valid $stats.

Guild Specific:
* getGuildMembers($rank): If $rank is true, an associative array containing guild names and ranks will be returned. If $rank is false, an array will be returned containing all names in the guild.
* getTopWeeklyContributers(): Returns an array of the Top 5 Weekly Contributers in the guild.
* getGuildPerks(): Returns an array of the perks a guild currently has.

UPDATE:

I have received several emails with suggestions over the past week. In addition to everything listed above, my RosterAPI will also:

*getItems: Returns an Associative Array that will return every item equipped on a character along with the Item Level, Enchants, and Gems.
*getStatistics: Given a specific Statistic (ex: Number of deaths), the value of the statistic will be returned.

The code can be obtained via GitHub. While it is still a work in progress, it should be stable enough for personal use. This class is being used to power the backend of the We Know Roster. Please read the README file along with the example.php file for a brief introduction on how to use the class. I recommend reading the comments above each function in RosterAPI to understand what exactly will be returned (especially with those functions that return associative arrays).

Update #2

The Roster API now returns Glyphs for each character.

EDIT #2:

By request in the comments, here is a Paypal Donate button:


7Jan/111

Parsing the WoW Armory without XML – Part 2

This post is a continuation of my original post about parsing the WoW Armory with no XML feeds available. In my original post, I showed how to pull basic character information, such as professions and talents, from each member in a specified guild. This post will expand on more specific character information such as HP, MP, and Stats.

The getCharacterInformation($charName) function in my previous post can be expanded to include additional information available on the WoW Armory. (Please view my original post for the sample code). For the most part, the code below can be directly copied into the existing method. As in my previous post, I assume you have the knowledge to make minor changes to the method (such as modifying the return array).

Exact Health and Mana:

$health = $xpath->query('//li[@class="health"]/span[@class="value"]');
$mana = $xpath->query('//li[@id="summary-power"]/span[@class="value"]');
echo $health->item(0)->nodeValue."<br />";
echo $mana->item(0)->nodeValue."<br />";

Exact Talents:
This will return the exact talent in the form of xx/xx/xx for both talents.

$exactBuilds = $xpath->query('//span[@class="name-build"]/span[@class="build"]');
echo $exactBuilds->item(0)->nodeValue."<br />";
echo $exactBuilds->item(1)->nodeValue;

Stats and Resistances:
A stat listed in the comment above the code needs to be added to the $stat variable.

/**
 * Valid $stat values:
 * strength, agility, stamina, intellect,
 * spirit, mastery, meleedamage, meleedps,
 * meleeattackpower, meleespeed, meleehaste,
 * meleehit, meleecrit, meleecrip, expertise,
 * rangeddamage, rangeddps, rangedattackpower,
 * rangedspeed, rangedhaste, rangedhit, rangedcrit,
 * spellpower, spellhaste, spellhit, spellcrit,
 * spellpenetration, manaregen, combatregen, armor,
 * dodge, parry, block, resilience, arcaneres, fireres,
 * frostres, natureres, shadowres,
 */
 
$stat = "ADD_STAT_FROM_ABOVE_HERE";
$statName = $xpath->query('//li[@data-id="'.$stat.'"]/span[@class="name"]');
$statValue = $xpath->query('//li[@data-id="'.$stat.'"]/span[@class="value"]');
echo $statName->item(0)->nodeValue."<br />";
echo $statValue->item(0)->nodeValue."<br />";

Battleground Rating and Kills

$rating = $xpath->query('//li[@class="rating"]/span[@class="value"]');
$kills = $xpath->query('//li[@class="kills"]/span[@class="value"]');
echo $rating->item(0)->nodeValue."<br />";
echo $kills->item(0)->nodeValue."<br />";

My next post will cover looking into more interesting character information such as Achievements, Reputation, or Statistics.

~