private bool MatchesCondition(DiaObject actor) { if (actor.IsValid) { switch (Type) { case BountyScriptItemType.InteractWithGizmo: if (actor is DiaGizmo) { var gizmo = actor as DiaGizmo; return(gizmo.IsFullyValid() && ActorFinder.IsGizmoInteractable(gizmo)); } return(false); case BountyScriptItemType.InteractWithMonster: if (actor is DiaUnit) { var unit = actor as DiaUnit; return(ActorFinder.IsUnitInteractable(unit)); } return(false); default: return(false); } } return(false); }
private void PulseChecks() { var gizmos = ZetaDia.Actors.GetActorsOfType <DiaGizmo>(true).Where(g => g.IsFullyValid() && g.ActorSnoId == GizmoSNO && g.Distance < ObjectSearchRadius); foreach (var gizmo in gizmos.Where(gizmo => gizmo.IsFullyValid())) { Vector3 position; bool hasBeenOperated; bool untargetable; try { position = gizmo.Position; hasBeenOperated = !ActorFinder.IsGizmoInteractable(gizmo); untargetable = gizmo.CommonData.GetAttribute <int>(ActorAttributeType.Untargetable) == 1; } catch (ACDAttributeLookupFailedException) { continue; } catch (Exception ex) { if (ex.Message.Contains("ReadProcessMemory")) { continue; } throw; } GuardedGizmo guardedGizmo; if (!_guardedGizmos.ContainsKey(position)) { guardedGizmo = new GuardedGizmo(); guardedGizmo.Position = position; guardedGizmo.InteractDistance = (int)Math.Round(gizmo.CollisionSphere.Radius + 1, MidpointRounding.AwayFromZero); _guardedGizmos.Add(position, guardedGizmo); } else { guardedGizmo = _guardedGizmos[gizmo.Position]; } guardedGizmo.HasBeenOperated = !ActorFinder.IsGizmoInteractable(gizmo); guardedGizmo.Untargateble = untargetable; } }