Skip to content

Commit 948d370

Browse files
author
babelshift
committed
Added simpler to consume TowerStates class for consumers of live league games.
1 parent 688dbe0 commit 948d370

4 files changed

Lines changed: 46 additions & 0 deletions

File tree

SteamWebAPI2.Net452/SteamWebAPI2.Net452.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@
196196
<Compile Include="..\SteamWebAPI2\Models\DOTA2\TeamInfoResultContainer.cs">
197197
<Link>Models\DOTA2\TeamInfoResultContainer.cs</Link>
198198
</Compile>
199+
<Compile Include="..\SteamWebAPI2\Models\DOTA2\TowerStates.cs">
200+
<Link>Models\DOTA2\TowerStates.cs</Link>
201+
</Compile>
199202
<Compile Include="..\SteamWebAPI2\Models\GameClientResultContainer.cs">
200203
<Link>Models\GameClientResultContainer.cs</Link>
201204
</Compile>

SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public class LiveLeagueGameTeamRadiantDetail
3131
public IList<LiveLeagueGameBan> Bans { get; set; }
3232
public IList<LiveLeagueGamePlayerDetail> Players { get; set; }
3333
public IList<LiveLeagueGameAbility> Abilities { get; set; }
34+
35+
public TowerState TowerStates { get { return new TowerState(TowerState); } }
3436
}
3537

3638
public class LiveLeagueGameTeamDireInfo
@@ -61,6 +63,8 @@ public class LiveLeagueGameTeamDireDetail
6163
public IList<LiveLeagueGameBan> Bans { get; set; }
6264
public IList<LiveLeagueGamePlayerDetail> Players { get; set; }
6365
public IList<LiveLeagueGameAbility> Abilities { get; set; }
66+
67+
public TowerState TowerStates { get { return new TowerState(TowerState); } }
6468
}
6569

6670
public class LiveLeagueGameScoreboard
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace SteamWebAPI2.Models.DOTA2
8+
{
9+
public class TowerState
10+
{
11+
public TowerState(int towerState)
12+
{
13+
IsAncientTopAlive = ((towerState >> 10) & 1) == 1 ? true : false;
14+
IsAncientBottomAlive = ((towerState >> 9) & 1) == 1 ? true : false;
15+
IsBottomTier3Alive = ((towerState >> 8) & 1) == 1 ? true : false;
16+
IsBottomTier2Alive = ((towerState >> 7) & 1) == 1 ? true : false;
17+
IsBottomTier1Alive = ((towerState >> 6) & 1) == 1 ? true : false;
18+
IsMiddleTier3Alive = ((towerState >> 5) & 1) == 1 ? true : false;
19+
IsMiddleTier2Alive = ((towerState >> 4) & 1) == 1 ? true : false;
20+
IsMiddleTier1Alive = ((towerState >> 3) & 1) == 1 ? true : false;
21+
IsTopTier3Alive = ((towerState >> 2) & 1) == 1 ? true : false;
22+
IsTopTier2Alive = ((towerState >> 1) & 1) == 1 ? true : false;
23+
IsTopTier1Alive = ((towerState >> 0) & 1) == 1 ? true : false;
24+
}
25+
26+
public bool IsAncientTopAlive { get; set; }
27+
public bool IsAncientBottomAlive { get; set; }
28+
public bool IsBottomTier3Alive { get; set; }
29+
public bool IsBottomTier2Alive { get; set; }
30+
public bool IsBottomTier1Alive { get; set; }
31+
public bool IsMiddleTier3Alive { get; set; }
32+
public bool IsMiddleTier2Alive { get; set; }
33+
public bool IsMiddleTier1Alive { get; set; }
34+
public bool IsTopTier3Alive { get; set; }
35+
public bool IsTopTier2Alive { get; set; }
36+
public bool IsTopTier1Alive { get; set; }
37+
}
38+
}

SteamWebAPI2/SteamWebAPI2.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<Compile Include="Models\DOTA2\ItemIconPathResultContainer.cs" />
9191
<Compile Include="Models\DOTA2\LeagueResultContainer.cs" />
9292
<Compile Include="Models\DOTA2\LiveLeagueGameResultContainer.cs" />
93+
<Compile Include="Models\DOTA2\TowerState.cs" />
9394
<Compile Include="Models\DOTA2\MatchDetailResultContainer.cs" />
9495
<Compile Include="Models\DOTA2\MatchHistoryBySequenceNumberResultContainer.cs" />
9596
<Compile Include="Models\DOTA2\MatchHistoryResultContainer.cs" />

0 commit comments

Comments
 (0)