public void Handle(NetworkManager nm, Bot core) { if (!core.EnableCpe) core.RaiseErrorMessage("Protocol error: Received ExtRemovePlayerName while CPE Disabled."); if (!core.ClientSupportedExtensions.Contains(CPEExtensions.ExtPlayerList)) core.RaiseErrorMessage("Protocol error: Received ExtPlayerList packet, which client does not support."); if (!core.NumberPlayerList.ContainsKey(NameId)) { core.RaiseErrorMessage("Protocol error: Received ExtRemovePlayerName for non-existant Name ID."); } else { core.ExtPlayerList.Remove(core.NumberPlayerList[NameId].PlayerName); core.NumberPlayerList.Remove(NameId); core.RaiseExtPlayerListUpdate(); } }
public void Handle(NetworkManager nm, Bot core) { if (!core.EnableCpe) core.RaiseErrorMessage("Protocol error: Received ExtAddPlayerName while CPE Disabled."); if (!core.ClientSupportedExtensions.Contains(CPEExtensions.ExtPlayerList)) core.RaiseErrorMessage("Protocol error: Received ExtPlayerList packet, which client does not support."); var newEntry = new ExtPlayerListEntry { NameId = NameId, PlayerName = PlayerName, ListName = ListName, GroupName = GroupName, GroupRank = GroupRank }; if (!core.NumberPlayerList.ContainsKey(NameId)) { core.ExtPlayerList.Add(PlayerName, newEntry); core.NumberPlayerList.Add(NameId, newEntry); } else { core.ExtPlayerList.Remove(core.NumberPlayerList[NameId].PlayerName); core.ExtPlayerList.Add(PlayerName, newEntry); core.NumberPlayerList[NameId] = newEntry; } core.RaiseExtPlayerListUpdate(); }