public static dynamic SerializeAnimal(FarmAnimal animal) { if (!animal.modData.ContainsKey(Utils.TrackingIdKey)) { animal.modData[Utils.TrackingIdKey] = System.Guid.NewGuid().ToString(); } string trackingId = animal.modData[Utils.TrackingIdKey]; var position = new List <float> { animal.Position.X, animal.Position.Y }; bool isMature = (int)animal.age >= (byte)animal.ageWhenMature; int currentProduce = animal.currentProduce.Value; bool readyForHarvest = isMature && currentProduce > 0; var center = new List <int> { animal.getStandingX(), animal.getStandingY() }; return(new { trackingId, position, center, tileX = animal.getTileX(), tileY = animal.getTileY(), wasPet = animal.wasPet.Value, type = animal.type.Value, name = animal.Name, isMature, currentProduce, readyForHarvest, toolUsedForHarvest = animal.toolUsedForHarvest.Value, location = animal.currentLocation.NameOrUniqueName, }); }