/// <summary> /// Starts the ObjectUpdates /// </summary> public void Start() { ActiveWoWObjects = AmeisenCore.GetAllWoWObjects(); foreach (WowObject t in ActiveWoWObjects) { if (t.GetType() == typeof(Me)) { Me = (Me)t; break; } } objectUpdateTimer = new System.Timers.Timer(AmeisenDataHolder.Settings.dataRefreshRate); objectUpdateTimer.Elapsed += ObjectUpdateTimer; objectUpdateThread = new Thread(new ThreadStart(StartTimer)); objectUpdateThread.Start(); nodeDBUpdateTimer = new System.Timers.Timer(AmeisenDataHolder.Settings.dataRefreshRate); nodeDBUpdateTimer.Elapsed += NodeDBUpdateTimer; nodeDBUpdateTimer.Start(); }
private void RefreshObjects() { ActiveWoWObjects = AmeisenCore.GetAllWoWObjects(); foreach (WowObject t in ActiveWoWObjects) { if (t.GetType() == typeof(Me)) { Me = (Me)t; } if (Me != null && t.Guid == Me.TargetGuid) { t.Update(); if (t.GetType() == typeof(Player)) { t.Distance = Utils.GetDistance(Me.pos, t.pos); Target = (Player)t; break; } else if (t.GetType() == typeof(Unit)) { t.Distance = Utils.GetDistance(Me.pos, t.pos); Target = (Unit)t; break; } else if (t.GetType() == typeof(Me)) { Target = (Me)t; break; } } } // Best place for this :^) AntiAFK(); }
private void RefreshObjects() { if (AmeisenCore.IsInLoadingScreen()) { return; } ActiveWoWObjects = AmeisenCore.GetAllWoWObjects(); foreach (WowObject t in ActiveWoWObjects) { // update objects that are new if (t == null && t.Guid == 0) { t.Update(); } // Get the Me object if (t.GetType() == typeof(Me)) { t.Update(); Me = (Me)t; Me.ZoneId = AmeisenCore.GetZoneId(); Me.MapId = AmeisenCore.GetMapId(); continue; } // Get our Pet object if (Me != null && t.Guid == Me.PetGuid) { t.Update(); t.Distance = Utils.GetDistance(Me.pos, t.pos); Pet = (Unit)t; continue; } // Get our Target object if (Me != null && t.Guid == Me.TargetGuid) { t.Update(); if (t.GetType() == typeof(Me)) { Target = (Me)t; continue; } else if (t.GetType() == typeof(Player)) { t.Distance = Utils.GetDistance(Me.pos, t.pos); Target = (Player)t; continue; } else if (t.GetType() == typeof(Unit)) { t.Distance = Utils.GetDistance(Me.pos, t.pos); Target = (Unit)t; continue; } } } // Get Partymembers // will be mainly handled by an event but should get refreshed once in a while // AmeisenDataHolder.Partymembers = CombatUtils.GetPartymembers(Me, ActiveWoWObjects); // Update Partymembers if (AmeisenDataHolder.Partymembers != null) { foreach (Unit unit in AmeisenDataHolder.Partymembers) { if (unit != null) { unit.Update(); } } } // Best place for this :^) AntiAFK(); }