public void UpdateStatedElement(StatedElementUpdatedMessage update) { if (!update.StatedElement.OnCurrentMap) { return; } StatedElements.Remove( StatedElements.Find(x => x.ElementId == update.StatedElement.ElementId)); StatedElements.Add(update.StatedElement); }
private void HandleStatedElementUpdatedMessage(IAccount account, StatedElementUpdatedMessage message) { lock (CheckLock) { if (!message.StatedElement.OnCurrentMap) { return; } var statedElement = StatedElements.GetValue(message.StatedElement.ElementId); if (statedElement != null) { StatedElements.Remove((int)statedElement.Id); } StatedElements.Add(message.StatedElement.ElementId, new StatedElement(message.StatedElement.ElementCellId, (uint)message.StatedElement.ElementId, message.StatedElement.ElementState)); } }
private void HandleStatedMapUpdateMessage(IAccount account, StatedMapUpdateMessage message) { lock (CheckLock) { foreach (var statedElementDofus in message.StatedElements) { if (!statedElementDofus.OnCurrentMap) { continue; } var selectedStatedElement = StatedElements.GetValue(statedElementDofus.ElementId); if (selectedStatedElement != null) { StatedElements.Remove((int)selectedStatedElement.Id); } StatedElements.Add(statedElementDofus.ElementId, new StatedElement(statedElementDofus.ElementCellId, (uint)statedElementDofus.ElementId, statedElementDofus.ElementState)); } } }