Displaying a Player’s Latest World of Warcraft Achievements in VB.Net and C#

Setup

To fetch the achievement data of the World of Warcraft character we are going to make use of armoryapi, the armoryapi library currently requires that the project’s target framework be 3.5 or higher so set your project up to use 3.5 or higher in the project properties.

After creating your project and setting up the target framework the next step is to add the reference to the armoryapi library. Download and extract the latest armoryapi package and you will find a DLL and an XML file inside, make note of where you have extracted these files and head back to Visual Studio. Open the “Add Reference” dialog (see http://msdn.microsoft.com/en-us/library/wkze6zky(v=vs.80).aspx) and click the tab labelled “Browse” and navigate to the armoryapi DLL that you extracted.

Note: in order for the intellisense documentation to work you must also extract the XML file to the same directory as the DLL

Code

Now that your project is setup let’s get started with some code, first thing’s first let’s create a very simple form that we can use to fetch and display the data. Create a form and add the following controls:

characterNameTextBox – TextBox
realmTextBox – TextBox
achievementList – ListBox
fetchButton – Button

You should now have something similar to this (I have added a few labels and a groupbox, but you obviously don’t have to do this to get started):

The main form

Now that we have our GUI sorted double click on fetchButton to create the click event handler for the button. Once you are in the code view we need to add an import to the ArmoryAPI namespace, to do this add the following line at the top of the file:

VB.Net

Imports ArmoryAPI

C#

using ArmoryAPI;

Once you’ve added the namespace import go back to the event handler for the button click and add the following code:

VB.Net

Dim armory As Armory = New Armory(BattleNetRegion.Europe, BattleNetLocale.en_GB)
Dim character As Character = armory.GetCharacter(characterNameTextBox.Text, realmTextBox.Text)

For Each a As UnlockedAchievement In character.Achievements
    If (DateTime.Now.AddDays(-14) < a.Unlocked) Then
        achievementList.Items.Add(String.Format("{0} ({1} points)", a.Title, a.Points))
    End If
Next

C#

Armory armory = new Armory(BattleNetRegion.Europe, BattleNetLocale.en_GB);
Character character = armory.GetCharacter(characterNameTextBox.Text, realmTextBox.Text);

foreach (UnlockedAchievement a in character.Achievements)
{
    if (DateTime.Now.AddDays(-14) < a.Unlocked)
    {
        achievementList.Items.Add(String.Format("{0} ({1} points)", a.Title, a.Points));
    }
}

If you debug the project now you will be able to fetch the achievements the character entered has unlocked within the last two weeks as can be seen below.

Main screen with achievement data

This code queries the European servers and returns the data in English, if you need a different configuration simply change the line that creates the Armory object, the following regions and locales are supported:

Regions

  • America
  • China
  • Europe
  • Korea
  • Taiwan

Locales

  • de_DE
  • en_GB
  • en_US
  • es_ES
  • es_MX
  • fr_FR
  • ko_KR
  • ru_RU
  • zh_CN
  • zh_TW

Extra Steps

In order to improve upon this project, you can utiilise the caching functionality of armoryapi, to do this you’ll have to setup a database (see http://code.google.com/p/armoryapi/wiki/GettingStarted#Setting_up_a_Database) and simply pass the connection string to the Armory object and the time in minutes that the data should be cached for as shown in the example below.

armory.ConnectionString = "Data Source=(local)\SQLEXPRESS;Initial Catalog=armoryapi;User ID=username;Password=password"
armory.RefreshInterval = 120
Posted in Gaming, Programming, Technology, Tutorials at October 8th, 2011. 2 Comments.

Enabling Last.FM Scrobbling in VLC

Open the preferences window by going to Tools > Preferences or pressing CTRL + P and switch the “Show Settings” radio button to “All”.

Drop the “Interface” menu option and click “Control interfaces”, you will now see an option labelled “Submission of played songs to last.fm”; check this option.

Drop down the “Control interfaces” menu option and click on “Audioscrobbler”, enter your login details on this screen, hit save and restart VLC.

Posted in Music, Networking, Software, Technology at July 2nd, 2011. No Comments.

Google+

I finally got myself an invite to the new Google+ network, and it is awesome! If you haven’t heard of it, it’s essentially Google’s attempt to combat Facebook; and to be frank, if the beta is anything to go by it’s going to be a Fatality.

As you can see in the two screenshots below, the Stream is the equivalent to Facebook’s Wall, and looks and works in a similar way (I think at this point doing anything radically different wouldn’t be a smart move on their part). It contains people’s latest activity such as photo uploads, people being tagged in photos, messages etc. The key feature in this which a lot of people seem excited about, is the ability to select only certain “circles” to share information with (see the third screenshot below).

The other big thing that is causing some hype is the “Hangouts”, these are essentially chat rooms which you can start with members of your circles but with the ability to utilise both audio and video. I’ve unfortunately not been able to try this out as of yet, but if the quality of this feature is up to the same standard that the rest of the system is, it will be very impressive. In terms of problems I’ve surprisingly not ran into any yet, for a product that hasn’t even been finished yet I’d say that is quite a promising sign.

Modded NES Controller

As an avid gamer I like to revisit some of the classics that I used to play as a kid, most notably Super Mario Bros. As I sold the system back in 1995 to get a SNES my only option is to play my old games on my PC, but playing Super Mario Bros just isn’t the same when you haven’t got a square brick for a controller that is giving you cramp in your hands! This ended up leading to me thinking – why not just convert an old controller to work via USB? And so I have. See below some pictures and a little demonstration video of the controller in use :)

Posted in Gaming, Hacking, Hardware, Software, Technology at April 15th, 2011. 2 Comments.

Minecraft Server Backup Script

As I mentioned in my previous post, I have started hosting a dedicated Minecraft server and I have created a script that will backup all the world data every night so that should any of the files get damaged at all we can easily restore to a given date.

For anyone else who needs this sort of solution you can find the script below, make sure to change the MC_PATH and BACKUP_PATH variables to the location of your server and the folder you want the backups to be stored to.

Note: this will create the following folder structure in the backups folder: Year/Month/Day


#!/bin/sh

MC_PATH="$HOME/minecraft"
BACKUP_PATH="$HOME/minecraft_backups"
NEW_FOLDER=`date +%Y/%m/%d`

echo "Creating backup directory..."
mkdir -p $BACKUP_PATH/$NEW_FOLDER

echo "Starting backup..."
cp -R $MC_PATH/world $BACKUP_PATH/$NEW_FOLDER

 

echo "Successfully backed up to: $BACKUP_PATH/$NEW_FOLDER"

Posted in Gaming, Programming, Software, Technology at April 11th, 2011. 3 Comments.

Mario & Yoshi Minecraft Statues

A friend of mine has been running a Minecraft server for a while from his house but as it is a bit of an inconvenience for people to not be able to play when he decides to shut down I have migrated it to a dedicated server. Along the way I decided to pick up a copy of Minecraft and give it a try myself and I can’t stop playing it now! After seeing someone building a Megaman statue on our server I decided to throw up a Mario and Yoshi statue to accompany it. Click on the thumbnail to view the full size image.

If you’re interested in joining us contact me for the details.

 

Posted in Gaming, Software, Technology at April 10th, 2011. No Comments.

Setting up a ReadyNAS Shutdown Button in Ubuntu

If you’re as lazy as me, you’ll hate having to login to the web front end for your ReadyNAS every time you want to shut it down or getting up and holding down the power button for 5 seconds (it isn’t just me that hates doing this, right?). I finally decided to make an easier means of doing this which I thought I’d share with you all.

Although the title says this is for Ubuntu it should work in pretty much any Linux distribution seeing as it’s all pretty standard stuff. If you are using a different distribution you’ll have to use your distribution’s alternative to apt-get if it isn’t Debian.

The first thing you will need to do is install the Expect package using the following command:

sudo apt-get install expect

The reason we need Expect is to make the automation of the commands easier.

The second thing you will need to do is install the EnableRootSSH addon which is available from the official Netgear site (http://www.readynas.com/download/addons/4.00/EnableRootSSH_1.0.bin). Once you have downloaded this, login to your ReadyNAS web panel and make sure you are in Advanced Mode. Once logged in click the “Update” option underneath the System section and then click the “Local” tab. This screen will allow you to select the bin file you have just downloaded and install it to your ReadyNAS by pressing the “Upload and verify image” button. After the installation is complete you will have to restart your ReadyNAS.

Now that we have root access via SSH to the ReadyNAS and have Expect installed create a new document on your desktop and call it “ShutdownNAS.sh” and open it up in a text editor.

Copy and paste the following into the file, replacing IPADDRESSOFTHENAS with the I.P address of the ReadyNAS and YOURPASSWORD with the password you use to login to the web panel for the ReadyNAS (be sure to leave the \r at the end of the password) and save it:

Note: for some reason my blog is replacing the double quotation marks with a different character that will not work, so if you copy and paste this be sure to replace any quotation mark manually.

#!/usr/bin/expect

spawn ssh IPADDRESSOFTHENAS -l root
expect “*password:”
send “YOURPASSWORD\r”
send “\r”
expect “*:~#”
send “poweroff\r”
expect eof

Now run the following command to make the file executable:

chmod 755 ~/Desktop/ShutdownNAS.sh

Now if you drag the file into a terminal or double click and press Run it will login to your NAS and shut it down for you; simples :)

If you have any problems with this or want any help / information for expanding on this script feel free to ask.

Running Spotify in Ubuntu 10.10

I’ve recently switched back to Ubuntu as my main operating system and wanted to continue to use Spotify but ran into a dead end after following Spotify’s own guide to run it in Ubuntu. I thought I would post up how I got it working as there are a number of people who have the exact same problem I had (that being that Spotify would display a message saying “There is a problem with your sound card”).

First of all, remove your existing WINE installation as we are going to be using the version that is currently in Beta. Do this by running:

  • sudo apt-get remove wine

Note: you will have to manually remove the .wine directory from your home directory (if you can’t see it press CTRL + H when viewing your home directory)

Now open the Software Sources menu by going to Applications->Ubuntu Software Center, then selecting Edit->Software Sources. Choose the Other Software tab and click Add then copy and paste the line below.

  • ppa:ubuntu-wine/ppa

Now that you have the repository setup use the following command to install the latest version

  • sudo apt-get install wine1.3

Once WINE 1.3 is installed grab the Spotify Installer from This Page, save it to your desktop, name it “spotify.exe” and run the following command to begin the installation:

  • wine ~/Desktop/spotify.exe

After the installation has finished use the following command to open the WINE configuration window:

  • winecfg

In the configuration window that appears go to the Audio tab and you will most likely be presented with a message box telling you that a driver has been automatically selected for you (this is fine). Make sure that only the ALSA Driver box is selected and then press OK.

You can now run Spotify by using the following command:

  • wine ‘C:\Program Files\Spotify\spotify.exe’

You can also create a launcher on your desktop using this command so you don’t have to load up a terminal every time you want to open Spotify.

Posted in Hacking, Music, Software, Technology at March 27th, 2011. 4 Comments.

Kickup Goes Live on App Store

I finally managed to get my first iOS game on to the App Store two days ago and it has took off much better than I had originally anticipated. Within the first 48 hours it has had a total of 64 purchases and some quite good feedback. The game is compatible with all of the iOS product family so if you have an iPod Touch, an iPhone or an iPad go check it out at: http://itunes.apple.com/gb/app/kickup/id397618387?mt=8

Version 1.1 is currently in the hands of the Apple review team at the moment, which makes a small change to how the game ends. As it stands at the moment you have to restart the application to begin a new game, once version 1.1 is approved and made available you will be able to start a new game from within the application itself to avoid restarting.

I’d also like to point out to iPad users that this game is not just an iPhone game that will scale to the resolution of your iPad, it comes with a complete set of high definition graphics especially for the iPad so it will look just as good (if not better) than the low resolution versions.

Posted in Gaming, Software, Technology at October 20th, 2010. No Comments.

Netgear ReadyNAS RND2110

Netgear ReadyNASYesterday I decided to set up a new NAS on my home network and opted in for the Netgear ReadyNAS RND2110. I managed to pick it up for just £136 and included was a 1TB Seagate Barracuda drive and if I send off my invoice and serial number to Netgear they will mail out another one for free.

At the moment I have the Barracuda installed as my primary drive and a 1TB Samsung SpinPoint F2 that I had lying around as the secondary drive in the RAID array. Getting it all set up was much faster than I had anticipated, the caddies are very easy to remove and install and the NAS unit auto detected the second drive and began synchronising them instantly. Although I will always keep the mirroring enabled you can also set up the drives in RAID0 which is a pretty nifty feature.

While I am very impressed with this, I am having a rather strange bottleneck. I hooked my PC up straight to the NAS via Gigabit Ethernet but the write speeds were not exceeding 18MB/s. The read speeds seem to be fine as I was able to read from the drive at around 40MB/s (which is normal for the hard drive I was copying to), but the write speeds are very inconvenient when copying large amounts of data as I have been doing over the past 24 hours.

If anyone has any idea what may be causing this bottleneck or how I can fix it please contact me, it would be much appreciated.

Posted in Hardware, Networking, Technology at October 17th, 2010. 1 Comment.