Skip to content

Instantly share code, notes, and snippets.

@Daniel-sims
Created April 5, 2018 18:16
Show Gist options
  • Save Daniel-sims/28d6d3243fd0ea93b1c8479afa929f38 to your computer and use it in GitHub Desktop.
Save Daniel-sims/28d6d3243fd0ea93b1c8479afa929f38 to your computer and use it in GitHub Desktop.
private ICollection<Models.DbMatch.PlayerItem> GetItemsForParticipant(RiotSharp.Endpoints.MatchEndpoint.Participant participant)
{
ICollection<Models.DbMatch.PlayerItem> items = new List<Models.DbMatch.PlayerItem>();
try
{
if (participant?.Stats?.Item0 != 0)
{
items.Add(new Models.DbMatch.PlayerItem() { ItemId = participant.Stats.Item0, ItemSlot = 0});
}
if (participant?.Stats.Item1 != 0)
{
items.Add(new Models.DbMatch.PlayerItem() { ItemId = participant.Stats.Item1, ItemSlot = 1 });
}
if (participant?.Stats?.Item2 != 0)
{
items.Add(new Models.DbMatch.PlayerItem() { ItemId = participant.Stats.Item2, ItemSlot = 2 });
}
if (participant?.Stats?.Item3 != 0)
{
items.Add(new Models.DbMatch.PlayerItem() { ItemId = participant.Stats.Item3, ItemSlot = 3 });
}
if (participant?.Stats?.Item4 != 0)
{
items.Add(new Models.DbMatch.PlayerItem() { ItemId = participant.Stats.Item4, ItemSlot = 4 });
}
if (participant?.Stats?.Item5 != 0)
{
items.Add(new Models.DbMatch.PlayerItem() { ItemId = participant.Stats.Item5, ItemSlot = 5 });
}
}
catch(Exception ex)
{
_logging.LogEvent(" Exception hit when getting items for participant : " + ex.Message);
}
return items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment