mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-24 20:00:05 +02:00
Some new data entities
This commit is contained in:
1 parent
50ecb57591
commit
3eeda15491
8 files changed
+227
-6
No files matched your search
@@ -73,7 +73,7 @@
|
|||||||
public long? MaxXp { get; set; }
|
public long? MaxXp { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Tank Id which created max experiense per battle
|
/// Tank Id which created max experience per battle
|
||||||
///</summary>
|
///</summary>
|
||||||
public long? MaxXpTankId { get; set; }
|
public long? MaxXpTankId { get; set; }
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
public long? SurvivedBattles { get; set; }
|
public long? SurvivedBattles { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total count of suvived and winned battles
|
/// Total count of survived and winned battles
|
||||||
///</summary>
|
///</summary>
|
||||||
public long? WinAndSurvived { get; set; }
|
public long? WinAndSurvived { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||||
|
{
|
||||||
|
public class TankInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
-3
@@ -1,15 +1,30 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using AutoMapper;
|
||||||
using WotBlitzStatisticsPro.Logic.Pipeline;
|
using WotBlitzStatisticsPro.Logic.Pipeline;
|
||||||
|
using WotBlitzStatisticsPro.WgApiClient;
|
||||||
|
|
||||||
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.Operations
|
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.Operations
|
||||||
{
|
{
|
||||||
public class GetTanksInfoOperation: IOperation<AccountInformationPipelineContext>
|
public class GetTanksInfoOperation: IOperation<AccountInformationPipelineContext>
|
||||||
{
|
{
|
||||||
public Task Invoke(AccountInformationPipelineContext context, Func<AccountInformationPipelineContext, Task> next)
|
private readonly IWargamingTanksApiClient _wargamingApi;
|
||||||
{
|
private readonly IMapper _mapper;
|
||||||
return next.Invoke(context);
|
|
||||||
|
|
||||||
|
public GetTanksInfoOperation(
|
||||||
|
IWargamingTanksApiClient wargamingApi,
|
||||||
|
IMapper mapper)
|
||||||
|
{
|
||||||
|
_wargamingApi = wargamingApi;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Invoke(AccountInformationPipelineContext context, Func<AccountInformationPipelineContext, Task> next)
|
||||||
|
{
|
||||||
|
var tanksInfo = await
|
||||||
|
_wargamingApi.GetPlayerAccountTanksInfo(context.AccountId, context.RealmType, context.RequestLanguage);
|
||||||
|
|
||||||
|
await next.Invoke(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,7 @@ namespace WotBlitzStatisticsPro.Logic
|
|||||||
services.AddAutoMapper(typeof(WotBlitzStatisticsLogicInstaller));
|
services.AddAutoMapper(typeof(WotBlitzStatisticsLogicInstaller));
|
||||||
services.AddHttpClient<IWargamingApiClient, WargamingApiClient>();
|
services.AddHttpClient<IWargamingApiClient, WargamingApiClient>();
|
||||||
services.AddHttpClient<IWargamingDictionariesApiClient, WargamingApiClient>();
|
services.AddHttpClient<IWargamingDictionariesApiClient, WargamingApiClient>();
|
||||||
|
services.AddHttpClient<IWargamingTanksApiClient, WargamingApiClient>();
|
||||||
services.AddTransient<IWargamingSearch, WargamingSearch>();
|
services.AddTransient<IWargamingSearch, WargamingSearch>();
|
||||||
services.AddTransient<IWargamingDictionaries, WargamingDictionaries>();
|
services.AddTransient<IWargamingDictionaries, WargamingDictionaries>();
|
||||||
services.AddTransient<IWargamingAccounts, WargamingAccounts>();
|
services.AddTransient<IWargamingAccounts, WargamingAccounts>();
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WotBlitzStatisticsPro.Common.Model;
|
||||||
|
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||||
|
|
||||||
|
namespace WotBlitzStatisticsPro.WgApiClient
|
||||||
|
{
|
||||||
|
public interface IWargamingTanksApiClient
|
||||||
|
{
|
||||||
|
Task<List<WotAccountTanksStatistics>> GetPlayerAccountTanksInfo(long accountId,
|
||||||
|
RealmType realmType = RealmType.Ru,
|
||||||
|
RequestLanguage language = RequestLanguage.En);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||||
|
{
|
||||||
|
public class WotAccountTanksFullStatistics
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
/// Battles count
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("battles")]
|
||||||
|
public long? Battles { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Base capture points
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("capture_points")]
|
||||||
|
public long? CapturePoints { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Damage dealt
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("damage_dealt")]
|
||||||
|
public long? DamageDealt { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Damage received
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("damage_received")]
|
||||||
|
public long? DamageReceived { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Base dropped capture points
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("dropped_capture_points")]
|
||||||
|
public long? DroppedCapturePoints { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Frags count
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("frags")]
|
||||||
|
public long? Frags { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Frags count after 8 tier
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("frags8p")]
|
||||||
|
public long? Frags8P { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Hits count
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("hits")]
|
||||||
|
public long? Hits { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Losses count
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("losses")]
|
||||||
|
public long? Losses { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Max frags per battle
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("max_frags")]
|
||||||
|
public long? MaxFrags { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Max XP per battle
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("max_xp")]
|
||||||
|
public long? MaxXp { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Shots count
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("shots")]
|
||||||
|
public long? Shots { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Spotted vehicles count
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("spotted")]
|
||||||
|
public long? Spotted { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Amount of survived battles
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("survived_battles")]
|
||||||
|
public long? SurvivedBattles { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Amount of survived and wined battles
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("win_and_survived")]
|
||||||
|
public long? WinAndSurvived { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Wins count
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("wins")]
|
||||||
|
public long? Wins { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total experience
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("xp")]
|
||||||
|
public long? Xp { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using WotBlitzStatisticsPro.Common.Model;
|
||||||
|
|
||||||
|
namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||||
|
{
|
||||||
|
public class WotAccountTanksStatistics
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
/// Player account identifier
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("account_id")]
|
||||||
|
public long AccountId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("battle_life_time")]
|
||||||
|
public int BattleLifeTimeInSeconds { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Last battle
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("last_battle_time")]
|
||||||
|
private int LastBattleTime { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("in_garage")]
|
||||||
|
public bool? InGarage { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("in_garage_updated")]
|
||||||
|
private int? InGarageUpdated { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Mastery:
|
||||||
|
///
|
||||||
|
/// 0 — None
|
||||||
|
/// 1 — Rank 3
|
||||||
|
/// 2 — Rank 2
|
||||||
|
/// 3 — Rank 1
|
||||||
|
/// 4 — Mastery
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("mark_of_mastery")]
|
||||||
|
private long _markOfMastery { get; set; }
|
||||||
|
public MarkOfMastery MarkOfMastery => (MarkOfMastery)_markOfMastery;
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Tank identifier
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("tank_id")]
|
||||||
|
public long TankId { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Whole statistics
|
||||||
|
///</summary>
|
||||||
|
[JsonProperty("all")]
|
||||||
|
public WotAccountTanksFullStatistics All { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("frags")]
|
||||||
|
public Dictionary<string, string> Frags { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,8 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
|||||||
{
|
{
|
||||||
public class WargamingApiClient : WagramingApiClientBase,
|
public class WargamingApiClient : WagramingApiClientBase,
|
||||||
IWargamingApiClient,
|
IWargamingApiClient,
|
||||||
IWargamingDictionariesApiClient
|
IWargamingDictionariesApiClient,
|
||||||
|
IWargamingTanksApiClient
|
||||||
{
|
{
|
||||||
public WargamingApiClient(
|
public WargamingApiClient(
|
||||||
HttpClient httpClient,
|
HttpClient httpClient,
|
||||||
@@ -141,7 +142,21 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
|||||||
// https://api.wotblitz.ru/wotb/encyclopedia/achievements/?application_id=adc1387489cf9fc8d9a1d85dbd27763d
|
// https://api.wotblitz.ru/wotb/encyclopedia/achievements/?application_id=adc1387489cf9fc8d9a1d85dbd27763d
|
||||||
|
|
||||||
|
|
||||||
|
#region Tanks methods
|
||||||
|
|
||||||
|
public async Task<List<WotAccountTanksStatistics>> GetPlayerAccountTanksInfo(
|
||||||
|
long accountId,
|
||||||
|
RealmType realmType = RealmType.Ru,
|
||||||
|
RequestLanguage language = RequestLanguage.En)
|
||||||
|
{
|
||||||
|
var tanks = await GetFromBlitzApi<Dictionary<string, List<WotAccountTanksStatistics>>>(
|
||||||
|
realmType,
|
||||||
|
language,
|
||||||
|
"tanks/stats/",
|
||||||
|
$"account_id={accountId}").ConfigureAwait(false);
|
||||||
|
return tanks[accountId.ToString()];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user