BeDKP

I recently wrote a little World of Warcraft addon for my raid group that covers 1 or 2 perhaps interesting topics. The complete source code is posted here - if you need something similar and have some coding skills you probably can adjust it for your needs.

First of all some background info on what the tool is good for:

In online role playing games you basicly distinguish two kinds of playing: PvP and PvE. PvP (Player versus player) means that humon opponents fight against each other (either in teams or solo). PvE (Player versus environment) is a team effort of humans versus enemies controlled by the game. In World of Warcraft PvE's end content is called raiding. This means teaming up with 10 or 25 players to take down opponents. The places were you do this reset every week, which means that you can kill the same opponent each week. For a kill you get Loot (equipment) which is then divided amongst the players in the raid.

To make this a fair thing, several systems have come up. Probably the one most used is DKP (Dragon kill points). There are many flavours of DKP, however the main concept is, that each player recieves points for taking part in a raid and killing an enemy. Then, when it comes to Loot, players can bid their points in silent auctions and the highest bid wins. There are full blown solutions to manage DKP, having a website where playes register with the option to link the points up to the World of Warcraft client. A well known one for instance is EqDKP.

The group I'm raiding with does DKP mostly manually. The current points are posted and updated in a forum, so people need to go there to find their current status which is annoying to do ingame since an auction for an item takes about 10 seconds.

My idea was to grab the points from the forum and make them available to my raid members. Unfortunately the environment you write addons for World of Warcraft in does not allow connecting to external resources for security reasons. So the first step is to extract the data from the forum and make it available to the addon. To accomplish this is created an Internet Explorer menu extension that saves the currently displayed page to a specific location on disk for later analysis. This is quite easy to do. You create a registry entry like this:

[HKEY_USERS\S-1-5-21-2052111302-1078081533-682003330-1003\Software\Microsoft\Internet Explorer\MenuExt\BeDKP]
"Context"=dword:00000033
@="file://C:\\Programme\\World of Warcraft\\Interface\\Addons\\BeDKP\\BeDKP.htm"

Inside this BeDKP.htm a javascript block persists the whole page to disk and executes a batch afterwards that extracts the important information:

<script>
    var fso = new ActiveXObject ("Scripting.FileSystemObject");
    var file = fso.CreateTextFile ("C:\\Programme\\World of Warcraft\\Interface\\Addons\\BeDKP\\DKP.htm");
    file.Write (external.menuArguments.document.getElementsByTagName ("body") [0].outerHTML);
    file.Close ();
   
  var shell = new ActiveXObject("WScript.Shell");
  shell.Run ("\"C:\\Programme\\World of Warcraft\\Interface\\Addons\\BeDKP\\extract.cmd\"");

</script>

At first I thought about handling the actual conversion inside this script, however the reason why I did not was

  • string manipulations in javascript are not as comfortable as in c#
  • encoding could be an issue

The batch command will first invoke a c# console application that extracts the data from dkp.htm and stores it in LUA format to a specific location. Then notepad will be opened with the results. LUA is the language addons are developed in. It's a mixture of c, pascal and perl. For your addons you can specify variables that are persisted. This is what I use to get to my data. First of all the format of the extracted data reminds a little of JSON notation. It implicitly defines an object graph. Here is a little extract:


DKP = {
    ["Player1"] = 1520,
    ["Player2"] = 1420,
...

}

You see, that it's just a simple associative array. There is also a dedicated entry indicating the last update. I noticed, that on the forum some character names are spelled differently to their ingame name. So the configuration for the c# tool contains a mapping table. Furthermore you can make members admins by adding an asterisk to their name. Being admin does not only allow to query your own DKP but also the DKP of others.

The addon will start listening for whispers with the text "dkp". Whispering means talking to someone privately. Furthermore you have the following options as an admin:

  • dkp all -> shows everyone's DKP points
  • dkp [pattern] -> shows DKP of everyone who's name starts with [pattern]
  • dkp announce-> show a note on how to use the addon to the raid channel

The whole package at it's attached to the post won't help you without customisation since it is tailored to our forum. However if you do your own conversion you will be able to adapt it to your needs with little effort. Look at the paths used in the scripts. You will have to make changes here as well.

Enjoy. 

BeDKP.zip (14,99 kb)

About the author

for comments and suggestions contact:

 

Month List