LibBeImba
LibBeImba is a library for the .NET framework that interfaces with the BeImba SOAP API. BeImba (http://be.imba.hu) is an online character auditor for World of Warcraft.
Be sure to check out my other WoW-related projects:
LibWowArmoryLibWowHeroes
Requirements
- Json.Net - A free JSON library for .NET. Download it for free from http://www.codeplex.com/Json. You can either add a reference to the project and reference the project, or compile Json.Net yourself and drop the resulting .DLL into the bin directory of the LibBeImba project.
- A BeImba API Client Key - Required to access the BeImba SOAP API. See http://be.imba.hu/forums/viewtopic.php?id=975 for information on how to obtain a client key.
Version History
0.1.1 beta - 7/29/2009
- Added ability to update toons on BeImba programmaticly via the new BeImbaUpdate.UpdateCharacter shared function.
- Added the LibBeImbaDemo application to give a functional example of how to use LibBeImba.
0.1 beta - 9/24/2008
Usage
Watch HowTo: LibBeImba for .NET on Youtube - This video covers what LibBeImba is and gives an example for retrieving a single player's scores using LibBeImba version 0.1 beta.
Be sure to include a reference to LibBeImba in your class with the following declaration:
VB.Net:
Imports roncliProductions.LibBeImba
C#:
using roncliProductions.LibBeImba;
Steps:
- Update the toons you wish to query on BeImba so that you can retrieve the latest score data
- Create an instance of the BeImbaCharacters class and add toons to your BeImbaCharacters object
- Query the BeImba SOAP API with your BeImbaCharacters object, obtaining a BeImbaGetScoresResult object
- Extract data from the BeImbaGetScoresResult object
Update your toons
This call can and does fail when the BeImba servers are overloaded. It is a good idea to catch any exceptions that occur. Also, never try to run multiple calls to this function asynchronously, as hitting the BeImba servers too frequently can result in timeout errors.
VB.Net:
Try
BeImbaUpdate.UpdateCharacter("US", "Korialstrasz", "Roncli")
Catch ex As Exception
End Try
C#:
try {
BeImbaUpdate.UpdateCharacter("US", "Korialstrasz", "Roncli");
} catch (ex as Exception) {}
Setup your BeImbaCharacters object
VB.Net:
Dim characters As New BeImbaCharacters()
characters.AddCharacter("US", "Korialstrasz", "Roncli")
characters.AddCharacter("US", "Korialstrasz", "Albarith")
characters.AddCharacter("US", "Korialstrasz", "Solitha")
characters.AddCharacter("US", "Korialstrasz", "Talililis")
C#:
BeImbaCharacters characters = new BeImbaCharacters();
characters.AddCharacter("US", "Korialstrasz", "Roncli");
characters.AddCharacter("US", "Korialstrasz", "Albarith");
characters.AddCharacter("US", "Korialstrasz", "Solitha");
characters.AddCharacter("US", "Korialstrasz", "Talililis");
Query the BeImba SOAP API
Note that the variable
clientKey below should be a string containing your BeImba API Client Key.
VB.Net:
Dim result As BeImbaGetScoresResult
result = BeImbaAPICalls.GetScores(clientKey, characters)
C#:
BeImbaGetScoresResult result;
result = BeImbaAPICalls.GetScores(clientKey, characters);
Extract the data from the result
Option 1: Query for individual toons
VB.Net:
Dim score as BeImbaScore
Dim gearScore as Double
Dim gemScore as Double
Dim enchantScore as Double
Dim totalScore as Double
Dim highestScore as Double
Dim lastUpdate as Date
score = result.GetScore("US", "Korialstrasz", "Roncli")
If score Is Not Nothing Then
gearScore = score.GearScore
gemScore = score.GemScore
enchantScore = score.EnchantScore
totalScore = score.TotalScore
highestScore = score.HighestScore
lastUpdate = score.LastUpdate
End If
C#:
BeImbaScore score;
double gearScore;
double gemScore;
double enchantScore;
double totalScore;
double highestScore;
double lastUpdate;
score = result.GetScore("US", "Korialstrasz", "Roncli");
if (score != null) {
gearScore = score.GearScore;
gemScore = score.GemScore;
enchantScore = score.EnchantScore;
totalScore = score.TotalScore;
highestScore = score.HighestScore;
lastUpdate = score.LastUpdate;
}
Option 2: Loop through the results
VB.Net:
Dim score As BeImbaScore
Dim enchantScore As Double
Dim gearScore As Double
Dim gemScore As Double
Dim totalScore As Double
Dim highestScore As Double
Dim lastUpdate As Date
For Each zone As String In result.Scores.Keys
For Each server As String In result.Scores(zone).Keys
For Each toon As String In result.Scores(zone)(server).Keys
score = result.Scores(zone)(server)(toon)
enchantScore = score.EnchantScore
gearScore = score.GearScore
gemScore = score.GemScore
totalScore = score.TotalScore
highestScore = score.HighestScore
lastUpdate = score.LastUpdate
Next
Next
Next
C#:
BeImbaScore score;
double gearScore;
double gemScore;
double enchantScore;
double totalScore;
double highestScore;
DateTime lastUpdate;
foreach (string zone in result.Scores.Keys) {
foreach (string server in result.Scores(zone).Keys) {
foreach (string toon in result.Scores(zone)(server).Keys) {
score = result.Scores(zone)(server)(toon);
gearScore = score.GearScore;
gemScore = score.GemScore;
enchantScore = score.EnchantScore;
totalScore = score.TotalScore;
highestScore = score.HighestScore;
lastUpdate = score.LastUpdate;
}
}
}