namespace Supercell.Laser.Logic.Command.Home { using Supercell.Laser.Logic.Club; using Supercell.Laser.Logic.Friends; using Supercell.Laser.Logic.Home; using Supercell.Laser.Logic.Listener; using Supercell.Laser.Logic.Message.Friends; using Supercell.Laser.Titan.DataStream; public class LogicSetPlayerNamecolorCommand : Command { public int NameColorInstanceId; public int Namecolor; public override void Decode(ByteStream stream) { base.Decode(stream); stream.ReadVInt(); NameColorInstanceId = stream.ReadVInt(); Namecolor = NameColorInstanceId; } public override int Execute(HomeMode homeMode) { if (NameColorInstanceId < 0) return 1; if (NameColorInstanceId > 24) return 3; homeMode.Home.Namecolor = NameColorInstanceId; if (homeMode.Avatar.AllianceId > 0) { Alliance alliance = LogicServerListener.Instance.GetAlliance(homeMode.Avatar.AllianceId); if (alliance != null) { AllianceMember member = alliance.GetMemberById(homeMode.Avatar.AccountId); if (member != null) member.DisplayData.Namecolor = NameColorInstanceId; } } foreach (Friend friend in homeMode.Avatar.Friends) { if (friend.Avatar == null) continue; Friend entry = friend.Avatar.GetFriendById(homeMode.Avatar.AccountId); if (entry == null) continue; entry.DisplayData.Namecolor = NameColorInstanceId; if (LogicServerListener.Instance.IsPlayerOnline(friend.AccountId)) { LogicServerListener.Instance.GetGameListener(friend.AccountId) .SendTCPMessage(new FriendListUpdateMessage { Entry = entry }); } } return 0; } public override int GetCommandType() => 527; } }