From 09553c9d4f299f9ba803b71fb30bab719e9fe483 Mon Sep 17 00:00:00 2001 From: Spirtix Date: Sun, 2 Jul 2023 11:02:06 +0200 Subject: [PATCH] fix dragon update --- src/Controllers/Common/ContentController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Controllers/Common/ContentController.cs b/src/Controllers/Common/ContentController.cs index 234606b..23acd64 100644 --- a/src/Controllers/Common/ContentController.cs +++ b/src/Controllers/Common/ContentController.cs @@ -546,17 +546,19 @@ public class ContentController : Controller { // Attributes is special - the entire list isn't re-sent, so we need to manually update each if (dragonData.Attributes is null) dragonData.Attributes = new RaisedPetAttribute[] { }; + List attribs = dragonData.Attributes.ToList(); if (newDragonData.Attributes is not null) { foreach (RaisedPetAttribute newAttribute in newDragonData.Attributes) { - RaisedPetAttribute? attribute = dragonData.Attributes.FirstOrDefault(a => a.Key == newAttribute.Key); + RaisedPetAttribute? attribute = attribs.Find(a => a.Key == newAttribute.Key); if (attribute is null) { - dragonData.Attributes.Append(newAttribute); + attribs.Add(newAttribute); } else { attribute.Value = newAttribute.Value; attribute.Type = newAttribute.Type; } } + dragonData.Attributes = attribs.ToArray(); } return dragonData;