private bool OnGameData(GameDataObject lcds) { draftData = lcds.Content; if (draftData.AfkCheckState?.Inventory != null) { var src = draftData.AfkCheckState.Inventory; this.inventory = new Model.Inventory { AvailableSpells = src.SpellIds, PickableChamps = src.LastSelectedSkins.Keys.Select(int.Parse).ToList(), BannableChamps = src.AllChampionIds }; } switch (lcds.Content.CurrentPhase) { case Phase.DRAFT_PREMADE: OnAdvancedToLobby(); break; case Phase.MATCHMAKING: case Phase.AFK_CHECK: OnAdvancedToMatchmaking(); break; case Phase.CHAMPION_SELECT: if (state.Chatroom == Guid.Empty) { state.Chatroom = rooms.JoinDraft(draftData.ChampSelectState); } state.IsBlue = draftData.ChampSelectState.MyCellId < 5; state.Inventory = this.inventory; state.Remaining = draftData.ChampSelectState.CurrentRemainingMillis; state.Turn = draftData.ChampSelectState.CurrentActionIndex; state.AlliedBans = draftData.ChampSelectState.Bans.AlliedBans; state.EnemyBans = draftData.ChampSelectState.Bans.EnemyBans; state.Phase = GetPhase(draftData.ChampSelectState); var current = draftData.ChampSelectState.GetCurrentAction(); var tradesByCell = draftData.ChampSelectState.Trades.ToDictionary(t => t.CellId); draftMembers = new Dictionary <object, Cell>(); state.Allies = (from c in draftData.ChampSelectState.Cells.AlliedTeam orderby c.CellId select GetMember(c, current, tradesByCell)).ToList(); state.Enemies = (from c in draftData.ChampSelectState.Cells.EnemyTeam orderby c.CellId select GetMember(c, current, tradesByCell)).ToList(); OnStateChanged(); break; } return(true); }
private bool OnGameData(GameDataObject lcds) { if (lcds != null) { draftData = lcds.Content; } switch (lcds.Content.CurrentPhase) { case Phase.DRAFT_PREMADE: if (state.Chatroom == Guid.Empty) { state.Chatroom = rooms.JoinDraft(draftData.PremadeState); } state.Members = new List <LobbyMember>(); foreach (var slot in draftData.PremadeState.Slots) { var member = new LobbyMember(slot); if (slot.SlotId == draftData.PremadeState.MySlot) { state.Me = member; } state.Members.Add(member); } state.CanMatch = draftData.PremadeState.ReadyToMatchmake; OnStateChanged(); break; case Phase.MATCHMAKING: OnAdvancedToMatchmaking(); break; } return(true); }