internal void SendPacket(int toWho, int fromWho) { ModPacket packet = GetPacket(fromWho); AnimPlayer fromPlayer = Main.player[fromWho].GetModPlayer <AnimPlayer>(); var modsToUpdate = (from pair in fromPlayer.characters.dict where pair.Value.abilityManager?.netUpdate ?? false select pair).ToList(); packet.WriteLowestCast(modsToUpdate.Count, ModNet.NetModCount); foreach ((Mod mod, AnimCharacter character) in modsToUpdate) { packet.Write(mod.Name); var abilities = character.abilityManager?.abilityArray; var abilitiesToUpdate = (from a in abilities where a.netUpdate select a).ToList(); if (abilities is null) { packet.Write((byte)0); continue; } packet.WriteLowestCast(abilitiesToUpdate.Count, abilities.Length); foreach (Ability ability in abilitiesToUpdate) { packet.WriteLowestCast(ability.Id, abilities.Length); ability.PreWritePacket(packet); } } packet.Send(toWho, fromWho); }