internal void OnTargetChanged(TargetChangedArgs e) { Logger.Write(LogLevel.Target, "Changed Object: {0}", MakeStringSingleLine(e.newObject.DebugString)); LastChangeOfTarget = DateTime.Now; if (Bot.Settings.EnableWaitAfterContainers && CurrentTarget.targetType == TargetType.Container) { //Herbfunks delay for container loot. lastHadContainerAsTarget = DateTime.Now; if (CurrentTarget.IsResplendantChest) { lastHadRareChestAsTarget = DateTime.Now; } } // We're sticking to the same target, so update the target's health cache to check for stucks if (CurrentTarget.targetType == TargetType.Unit) { CurrentUnitTarget = (CacheUnit)CurrentTarget; //Used to pause after no targets found. lastHadUnitInSights = DateTime.Now; // And record when we last saw any form of elite if (CurrentUnitTarget.IsBoss || CurrentUnitTarget.IsEliteRareUnique || CurrentUnitTarget.IsTreasureGoblin) { lastHadEliteUnitInSights = DateTime.Now; } } bWholeNewTarget = true; bPickNewAbilities = true; TargetChangeHandler handler = TargetChanged; if (handler != null) { handler(this, e); } }
internal void OnTargetChanged(TargetChangedArgs e) { Logger.Write(LogLevel.Target, "Changed Object: {0}", MakeStringSingleLine(e.newObject.DebugString)); LastChangeOfTarget = DateTime.Now; FleeingLastTarget = false; AvoidanceLastTarget = false; CurrentUnitTarget = null; FunkyGame.Hero.Class.PowerPrime = FunkyGame.Hero.Class.DefaultAttack; if (CurrentTarget.targetType == TargetType.Container && FunkyBaseExtension.Settings.General.EnableWaitAfterContainers) { //Herbfunks delay for container loot. lastHadContainerAsTarget = DateTime.Now; if (CurrentTarget.IsResplendantChest) { lastHadRareChestAsTarget = DateTime.Now; } } else if (CurrentTarget.targetType == TargetType.Unit) { CurrentUnitTarget = (CacheUnit)CurrentTarget; //Used to pause after no targets found. lastHadUnitInSights = DateTime.Now; // And record when we last saw any form of elite if (CurrentUnitTarget.IsBoss || CurrentUnitTarget.IsEliteRareUnique || CurrentUnitTarget.IsTreasureGoblin) { lastHadEliteUnitInSights = DateTime.Now; } } else if (CurrentTarget.targetType == TargetType.Avoidance) { LastAvoidanceMovement = DateTime.Now; AvoidanceLastTarget = true; } else if (CurrentTarget.targetType.Value == TargetType.Fleeing) { LastFleeAction = DateTime.Now; FleeingLastTarget = true; } else if (CurrentTarget.targetType.Value == TargetType.Item) { //Reset Item Vars FunkyGame.Targeting.Cache.recheckCount = 0; FunkyGame.Targeting.Cache.reCheckedFinished = false; FunkyGame.Targeting.Cache.CheckItemLootStackCount = 0; FunkyGame.Targeting.Cache.ShouldCheckItemLooted = false; } bWholeNewTarget = true; bPickNewAbilities = true; TargetChangeHandler handler = TargetChanged; if (handler != null) { handler(this, e); } }