public ICellMovement MoveToElement(uint id, int maxDistance) { var element = StatedElements.GetValue((int)id); if (element == null) { throw new Exception($"could not find element[{id}]"); } return(MoveToCellWithDistance((int)element.CellId, maxDistance, true)); }
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)); } } }
public ICellMovement MoveToSecureElement(int id) { var element = StatedElements.GetValue(id); return(element != null?MoveToCellWithDistance((int)element.CellId, 1, true) : null); }