/// <summary> /// Updates a client on everyone's ExtPlayerList (Ex. Client changed maps.) /// </summary> /// <param name="client">Client that has moved maps.</param> public static void UpdateExtPlayerList(NetworkClient client) { var toUpdate = new ExtAddPlayerName { NameId = client.CS.NameId, ListName = client.CS.FormattedName, PlayerName = client.CS.LoginName, GroupName = ServerCore.TextFormats.ExtPlayerList + client.CS.CurrentMap.CWMap.MapName, GroupRank = 0 }; lock (ServerCore.Nh.ClientLock) { foreach (var c in ServerCore.Nh.Clients) { if (c.CS.CPEExtensions.ContainsKey("ExtPlayerList")) c.SendQueue.Enqueue(toUpdate); } } }
/// <summary> /// Does initial setup of ExtPlayerList for a player that is logging in. /// </summary> /// <param name="client">Client logging in</param> public static void SetupExtPlayerList(NetworkClient client) { var extPlayerListPacket = new ExtAddPlayerName {GroupRank = 0}; lock (ServerCore.Nh.ClientLock) { foreach (var c in ServerCore.Nh.Clients) { if (c != client) { if (c.CS.CPEExtensions.ContainsKey("ExtPlayerList")) { extPlayerListPacket.NameId = client.CS.NameId; extPlayerListPacket.ListName = client.CS.FormattedName; extPlayerListPacket.PlayerName = client.CS.LoginName; extPlayerListPacket.GroupName = ServerCore.TextFormats.ExtPlayerList + client.CS.CurrentMap.CWMap.MapName; c.SendQueue.Enqueue(extPlayerListPacket); } if (!client.CS.CPEExtensions.ContainsKey("ExtPlayerList")) continue; extPlayerListPacket.NameId = c.CS.NameId; extPlayerListPacket.ListName = c.CS.FormattedName; extPlayerListPacket.PlayerName = c.CS.LoginName; extPlayerListPacket.GroupName = ServerCore.TextFormats.ExtPlayerList + c.CS.CurrentMap.CWMap.MapName; client.SendQueue.Enqueue(extPlayerListPacket); } else { if (!client.CS.CPEExtensions.ContainsKey("ExtPlayerList")) continue; extPlayerListPacket.NameId = client.CS.NameId; extPlayerListPacket.ListName = client.CS.FormattedName; extPlayerListPacket.PlayerName = client.CS.LoginName; extPlayerListPacket.GroupName = ServerCore.TextFormats.ExtPlayerList + client.CS.CurrentMap.CWMap.MapName; client.SendQueue.Enqueue(extPlayerListPacket); } } } }