Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MATCH-V5 Support #685

Merged
merged 8 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 10 additions & 28 deletions RiotSharp/Endpoints/Interfaces/IMatchEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,31 @@ namespace RiotSharp.Endpoints.Interfaces
/// </summary>
public interface IMatchEndpoint
{
/// <summary>
/// Get the matches' ID of the specified tournament asynchronously.
/// </summary>
/// <param name="region">Region in which the tournament took place.</param>
/// <param name="tournamentCode">The tournament ID to be retrieved.</param>
/// <returns>A list containing the matches' ID.</returns>
Task<List<long>> GetMatchIdsByTournamentCodeAsync(Region region, string tournamentCode);

/// <summary>
/// Get match information about a specific match asynchronously.
/// </summary>
/// <param name="region">Region in which the match took place.</param>
/// <param name="region">Region in which the match took place. (Europe, Asia, America)</param>
/// <param name="matchId">The match ID to be retrieved.</param>
/// <returns>A match object containing information about the match.</returns>
Task<Match> GetMatchAsync(Region region, long matchId);
Task<Match> GetMatchAsync(Region region, string matchId);

/// <summary>
/// Get the list of matches of a specific summoner asynchronously.
/// </summary>
/// <param name="region">Region in which the summoner is.</param>
/// <param name="accountId">Account ID for which you want to retrieve the match list.</param>
/// <param name="championIds">List of champion IDS to use for fetching games.</param>
/// <param name="queues">List of queue types to use for fetching games.</param>
/// <param name="seasons">[DEPRECATED] This field should not be considered reliable for the purposes of filtering matches by season.</param>
/// <param name="beginTime">The earliest date you wish to get matches from.</param>
/// <param name="endTime">The latest date you wish to get matches from.</param>
/// <param name="beginIndex">The begin index to use for fetching matches.</param>
/// <param name="endIndex">The end index to use for fetching matches.</param>
/// <returns>A list of Match references object.</returns>
Task<MatchList> GetMatchListAsync(Region region, string accountId,
List<int> championIds = null,
List<int> queues = null,
List<MatchEndpoint.Enums.Season> seasons = null,
DateTime? beginTime = null,
DateTime? endTime = null,
long? beginIndex = null,
long? endIndex = null);
/// <param name="puuidId">PuuID for which you want to retrieve the match list.</param>
/// <param name="start">The begin index to use for fetching matches.</param>
/// <param name="count">The amount of matches to fetch.</param>
/// <returns>A list of MatchIds.</returns>
Task<List<string>> GetMatchListAsync(Region region, string puuidId,
long? start = null,
long? count = null);

/// <summary>
/// Get match timeline by match ID asynchronously.
/// </summary>
/// <param name="region">Region in which the summoner is.</param>
/// <param name="matchId">The match ID of the timeline to be retrieved.</param>
Task<MatchTimeline> GetMatchTimelineAsync(Region region, long matchId);
Task<MatchTimeline> GetMatchTimelineAsync(Region region, string matchId);
}
}
111 changes: 111 additions & 0 deletions RiotSharp/Endpoints/MatchEndpoint/ChampionStats.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace RiotSharp.Endpoints.MatchEndpoint
{
public class ChampionStats
{
internal ChampionStats() { }

[JsonProperty("abilityHaste")]
public int AbilityHaste { get; set; }


[JsonProperty("abilityPower")]
public int AbilityPower { get; set; }


[JsonProperty("armor")]
public int Armor { get; set; }


[JsonProperty("armorPen")]
public int ArmorPen { get; set; }


[JsonProperty("armorPenPercent")]
public int ArmorPenPercent { get; set; }


[JsonProperty("attackDamage")]
public int AttackDamage { get; set; }


[JsonProperty("attackSpeed")]
public int AttackSpeed { get; set; }


[JsonProperty("bonusArmorPenPercent")]
public int BonusArmorPenPercent { get; set; }


[JsonProperty("bonusMagicPenPercent")]
public int BonusMagicPenPercent { get; set; }


[JsonProperty("ccReduction")]
public int CcReduction { get; set; }


[JsonProperty("cooldownReduction")]
public int CooldownReduction { get; set; }


[JsonProperty("health")]
public int Health { get; set; }


[JsonProperty("healthMax")]
public int HealthMax { get; set; }


[JsonProperty("healthRegen")]
public int HealthRegen { get; set; }


[JsonProperty("lifesteal")]
public int Lifesteal { get; set; }


[JsonProperty("magicPen")]
public int MagicPen { get; set; }


[JsonProperty("magicPenPercent")]
public int MagicPenPercent { get; set; }


[JsonProperty("magicResist")]
public int MagicResist { get; set; }


[JsonProperty("movementSpeed")]
public int MovementSpeed { get; set; }


[JsonProperty("omnivamp")]
public int Omnivamp { get; set; }


[JsonProperty("physicalVamp")]
public int PhysicalVamp { get; set; }


[JsonProperty("power")]
public int Power { get; set; }


[JsonProperty("powerMax")]
public int PowerMax { get; set; }


[JsonProperty("powerRegen")]
public int PowerRegen { get; set; }


[JsonProperty("spellVamp")]
public int SpellVamp { get; set; }
}
}
61 changes: 61 additions & 0 deletions RiotSharp/Endpoints/MatchEndpoint/DamageStats.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace RiotSharp.Endpoints.MatchEndpoint
{
public class DamageStats
{
internal DamageStats() { }


[JsonProperty("magicDamageDone")]
public int MagicDamageDone { get; set; }


[JsonProperty("magicDamageDoneToChampions")]
public int MagicDamageDoneToChampions { get; set; }


[JsonProperty("magicDamageTaken")]
public int MagicDamageTaken { get; set; }


[JsonProperty("physicalDamageDone")]
public int PhysicalDamageDone { get; set; }


[JsonProperty("physicalDamageDoneToChampions")]
public int PhysicalDamageDoneToChampions { get; set; }


[JsonProperty("physicalDamageTaken")]
public int PhysicalDamageTaken { get; set; }


[JsonProperty("totalDamageDone")]
public int TotalDamageDone { get; set; }


[JsonProperty("totalDamageDoneToChampions")]
public int TotalDamageDoneToChampions { get; set; }


[JsonProperty("totalDamageTaken")]
public int TotalDamageTaken { get; set; }


[JsonProperty("trueDamageDone")]
public int TrueDamageDone { get; set; }


[JsonProperty("trueDamageDoneToChampions")]
public int TrueDamageDoneToChampions { get; set; }


[JsonProperty("trueDamageTaken")]
public int TrueDamageTaken { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
return MatchEventType.ItemSold;
case "ITEM_UNDO":
return MatchEventType.ItemUndo;
case "PAUSE_END":
return MatchEventType.PauseEnd;
case "SKILL_LEVEL_UP":
return MatchEventType.SkillLevelUp;
case "WARD_KILL":
Expand Down
12 changes: 12 additions & 0 deletions RiotSharp/Endpoints/MatchEndpoint/Enums/MatchEventType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ public enum MatchEventType
/// </summary>
ItemUndo,

/// <summary>
/// Triggers on champion level up.
/// </summary>
LevelUp,

/// <summary>
/// Triggers on start of the game
/// </summary>
PauseEnd,

/// <summary>
/// Triggers on skill level ups.
/// </summary>
Expand Down Expand Up @@ -94,6 +104,8 @@ public static string ToCustomString(this MatchEventType eventType)
return "ITEM_SOLD";
case MatchEventType.ItemUndo:
return "ITEM_UNDO";
case MatchEventType.PauseEnd:
return "PAUSE_END";
case MatchEventType.SkillLevelUp:
return "SKILL_LEVEL_UP";
case MatchEventType.WardKill:
Expand Down
74 changes: 6 additions & 68 deletions RiotSharp/Endpoints/MatchEndpoint/Match.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,77 +11,15 @@ namespace RiotSharp.Endpoints.MatchEndpoint
public class Match
{
/// <summary>
/// The season ID.
/// Metadata of the match.
/// </summary>
[JsonProperty("seasonId")]
public int SeasonId { get; set; }
[JsonProperty("metadata")]
public MatchMetadata Metadata { get; set; }

/// <summary>
/// Specifies the Queue ID.
/// Info containing the most information about the match.
/// </summary>
[JsonProperty("queueId")]
public int QueueId { get; set; }

/// <summary>
/// Equivalent to match id
/// </summary>
[JsonProperty("gameId")]
public long GameId { get; set; }

/// <summary>
/// The participants identities.
/// </summary>
[JsonProperty("participantIdentities")]
public List<ParticipantIdentity> ParticipantIdentities { get; set; }

/// <summary>
/// The game version.
/// </summary>
[JsonProperty("gameVersion")]
public string GameVersion { get; set; }

/// <summary>
/// The game mode.
/// </summary>
[JsonProperty("gameMode")]
public string GameMode { get; set; }

/// <summary>
/// The map ID.
/// </summary>
[JsonProperty("MapId")]
public int MapId { get; set; }

/// <summary>
/// The game type.
/// </summary>
[JsonProperty("gameType")]
public string GameType { get; set; }

/// <summary>
/// The teams.
/// </summary>
[JsonProperty("teams")]
public List<TeamStats> Teams { get; set; }

/// <summary>
/// The participants.
/// </summary>
[JsonProperty("participants")]
public List<Participant> Participants { get; set; }

/// <summary>
/// The game duration.
/// </summary>
[JsonProperty("gameDuration")]
[JsonConverter(typeof(TimeSpanConverterFromSeconds))]
public TimeSpan GameDuration { get; set; }

/// <summary>
/// The date time of the game creation.
/// </summary>
[JsonProperty("gameCreation")]
[JsonConverter(typeof(DateTimeConverterFromLong))]
public DateTime GameCreation { get; set; }
[JsonProperty("info")]
public MatchInfo Info { get; set; }
}
}
Loading