Skip to content

Commit bb93e29

Browse files
authored
Update DOTA2/MatchPlayer & Test (#121)
1 parent 61be5e1 commit bb93e29

File tree

6 files changed

+99
-4
lines changed

6 files changed

+99
-4
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
namespace Steam.Models.DOTA2
2+
{
3+
public class MatchPlayerAdditionalUnitModel
4+
{
5+
public string Unitname { get; set; }
6+
7+
public uint Item0 { get; set; }
8+
9+
public uint Item1 { get; set; }
10+
11+
public uint Item2 { get; set; }
12+
13+
public uint Item3 { get; set; }
14+
15+
public uint Item4 { get; set; }
16+
17+
public uint Item5 { get; set; }
18+
19+
public uint Backpack0 { get; set; }
20+
21+
public uint Backpack1 { get; set; }
22+
23+
public uint Backpack2 { get; set; }
24+
25+
public uint ItemNeutral { get; set; }
26+
}
27+
}

src/Steam.Models/DOTA2/MatchPlayerModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ public class MatchPlayerModel
5050

5151
public uint GoldSpent { get; set; }
5252

53+
public uint NetWorth { get; set; }
54+
55+
public uint AghanimsScepter { get; set; }
56+
57+
public uint AghanimsShard { get; set; }
58+
59+
public uint Moonshard { get; set; }
60+
5361
public uint HeroDamage { get; set; }
5462

5563
public uint ScaledHeroDamage { get; set; }
@@ -65,5 +73,7 @@ public class MatchPlayerModel
6573
public uint Level { get; set; }
6674

6775
public IReadOnlyCollection<MatchPlayerAbilityUpgradeModel> AbilityUpgrades { get; set; }
76+
77+
public IReadOnlyCollection<MatchPlayerAdditionalUnitModel> AdditionalUnits { get; set; }
6878
}
6979
}

src/Steam.UnitTests/DOTA2MatchTests.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ public async Task GetLiveLeagueGamesAsync_Should_Succeed()
3030
[Fact]
3131
public async Task GetMatchDetailsAsync_Should_Succeed()
3232
{
33-
var response = await steamInterface.GetMatchDetailsAsync(5327512468);
34-
Assert.NotNull(response);
35-
Assert.NotNull(response.Data);
33+
//Old game without some params
34+
var responseOld = await steamInterface.GetMatchDetailsAsync(5327512468);
35+
//game played - 31.10.2021
36+
var responseNew = await steamInterface.GetMatchDetailsAsync(6249820594);
37+
Assert.NotNull(responseOld);
38+
Assert.NotNull(responseOld.Data);
39+
Assert.NotNull(responseNew);
40+
Assert.NotNull(responseNew.Data);
3641
}
3742

3843
[Fact]

src/Steam.UnitTests/SteamUserTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using SteamWebAPI2.Utilities;
44
using System;
55
using System.Collections.Generic;
6+
using System.Globalization;
67
using System.Net.Http;
78
using System.Text;
89
using System.Threading.Tasks;
@@ -80,7 +81,9 @@ public async Task ResolveVanityUrlAsync_Should_Succeed()
8081
[Fact]
8182
public async Task GetCommunityProfileAsync_Should_Succeed()
8283
{
83-
var response = await steamInterface.GetCommunityProfileAsync(76561198050013009);
84+
//for other cultures (for example ru) automaper will not be able to convert floating point numbers and will throw an error
85+
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("en");
86+
var response = await steamInterface.GetCommunityProfileAsync(76561198064401017);
8487
Assert.NotNull(response);
8588
}
8689
}

src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public DOTA2MatchProfile()
4040
CreateMap<MatchDetailResult, MatchDetailModel>()
4141
.ForMember(dest => dest.StartTime, opts => opts.MapFrom(src => src.StartTime.ToDateTime()));
4242
CreateMap<MatchPlayer, MatchPlayerModel>();
43+
CreateMap<MatchPlayerAdditionalUnit, MatchPlayerAdditionalUnitModel>();
4344
CreateMap<MatchPlayerAbilityUpgrade, MatchPlayerAbilityUpgradeModel>();
4445
CreateMap<MatchPickBan, MatchPickBanModel>();
4546
CreateMap<MatchDetailResultContainer, MatchDetailModel>().ConvertUsing((src, dest, context) =>

src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,41 @@ internal class MatchPlayerAbilityUpgrade
1010
public uint Level { get; set; }
1111
}
1212

13+
internal class MatchPlayerAdditionalUnit
14+
{
15+
public string Unitname { get; set; }
16+
17+
[JsonProperty(PropertyName = "item_0")]
18+
public uint Item0 { get; set; }
19+
20+
[JsonProperty(PropertyName = "item_1")]
21+
public uint Item1 { get; set; }
22+
23+
[JsonProperty(PropertyName = "item_2")]
24+
public uint Item2 { get; set; }
25+
26+
[JsonProperty(PropertyName = "item_3")]
27+
public uint Item3 { get; set; }
28+
29+
[JsonProperty(PropertyName = "item_4")]
30+
public uint Item4 { get; set; }
31+
32+
[JsonProperty(PropertyName = "item_5")]
33+
public uint Item5 { get; set; }
34+
35+
[JsonProperty(PropertyName = "backpack_0")]
36+
public uint Backpack0 { get; set; }
37+
38+
[JsonProperty(PropertyName = "backpack_1")]
39+
public uint Backpack1 { get; set; }
40+
41+
[JsonProperty(PropertyName = "backpack_2")]
42+
public uint Backpack2 { get; set; }
43+
44+
[JsonProperty(PropertyName = "item_neutral")]
45+
public uint ItemNeutral { get; set; }
46+
}
47+
1348
internal class MatchPlayer
1449
{
1550
[JsonProperty(PropertyName = "account_id")]
@@ -74,6 +109,17 @@ internal class MatchPlayer
74109
[JsonProperty(PropertyName = "gold_spent")]
75110
public uint GoldSpent { get; set; }
76111

112+
[JsonProperty(PropertyName = "net_worth")]
113+
public uint NetWorth { get; set; }
114+
115+
[JsonProperty(PropertyName = "aghanims_scepter")]
116+
public uint AghanimsScepter { get; set; }
117+
118+
[JsonProperty(PropertyName = "aghanims_shard")]
119+
public uint AghanimsShard { get; set; }
120+
121+
public uint Moonshard { get; set; }
122+
77123
[JsonProperty(PropertyName = "hero_damage")]
78124
public uint HeroDamage { get; set; }
79125

@@ -96,6 +142,9 @@ internal class MatchPlayer
96142

97143
[JsonProperty(PropertyName = "ability_upgrades")]
98144
public IList<MatchPlayerAbilityUpgrade> AbilityUpgrades { get; set; }
145+
146+
[JsonProperty(PropertyName = "additional_units")]
147+
public IList<MatchPlayerAdditionalUnit> AdditionalUnits { get; set; }
99148
}
100149

101150
internal class MatchPickBan

0 commit comments

Comments
 (0)