Hello fellow goblins ! This is a console application, called World of Auctions, designed to help us make the most out of the data available out there about the auction house and its items.
- You need a Blizzard API Client. You can create one there : https://develop.battle.net/
- You need a tradeskillmaster account
- Clone the repository
- Add a secrets.config file inside src/WorldOfAuctions/ looking like this :
<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<add key="Blizzard_ClientId" value="{The ClientId of your blizzard client}" />
<add key="Blizzard_ClientSecret" value="{The ClientSecret of your blizzard client" />
<add key="TSM_ApiKey" value="{The TSM API Key located in your TSM 'My Account' page}" />
<add key="DefaultRealm" value="{Your realm}" />
</appSettings>By default the databse (SQLite) will be located in C:\temp\woa.db. If you want you can set it elsewhere by adding <add key="DatabasePath" value="{elsewhere}" /> in secrets.config
- Profit !
The application will query TradeSkillMaster API with your given API KEY to get all items data for your realm and store it inside the database. This can happen at most once per hour for each realm. Keep in mind the TSM API is limited to 25 of these calls per day, so if you have many realms and switch between them multiple times during the day, it might end up limited by quota. There is room for improvement on the handling of the TSM API quotas.
The application will query Blizzard API for auctions every time you load it up or every time you change realm (with the chrealm {realm} command in the app).
The application will also refresh auctions every 10 minutes when it's running.
Blizzard allows for 36,000 calls per hour to this API so this should be ok.
The application's code uses MediatR to define notifications (the commands + their data) and notification handlers (the classes that do the work based on the command's data). To define a Notification, simply create a class that implements INotification.
The main command, called by the running code, is the ParseCommand. Its handler will scan the assembly for any class decorated with [WoACommand]. It then browses these classes to check which command has a RegexToMatch matching the user input. When a command is found matching the input, it's instantiated with the resulting Match object to allow it to fill its properties. Finally the command is published through the mediator.
[WoACommand(RegexToMatch = "^see (?<itemDesc>.+)", Usage = "see <item>", Description = "See all auctions for given item", DisplayedInHelp = true)]
public class SeeAuctionsCommand : INotification
{
public string ItemDescription { get; set; }
public SeeAuctionsCommand(Match m)
{
ItemDescription = m.Groups["itemDesc"].Value;
}
}