/// <summary> /// Returns the creature with the highest enmity on this enemy's enmity table. /// If no target can be determined, OBJECT_INVALID will be returned. /// </summary> /// <returns>The creature with the highest enmity, or OBJECT_INVALID if it cannot be determined.</returns> private static uint GetTarget() { var self = OBJECT_SELF; var enmityTable = Enmity.GetEnmityTable(self); if (enmityTable.Count <= 0) { return(OBJECT_INVALID); } var highest = enmityTable.OrderByDescending(o => o.Value).First(); return(highest.Key); }
/// <summary> /// Returns the creature with the highest enmity on this enemy's enmity table. /// If no target can be determined, OBJECT_INVALID will be returned. /// </summary> /// <returns>The creature with the highest enmity, or OBJECT_INVALID if it cannot be determined.</returns> private static uint GetTarget() { var self = OBJECT_SELF; var enmityTable = Enmity.GetEnmityTable(self); if (enmityTable.Count <= 0) { return(OBJECT_INVALID); } var highest = enmityTable.OrderByDescending(o => o.Value).First(); //Console.WriteLine($"target = {GetName(highest.Key)}, enmity = {highest.Value}"); // todo debugging return(highest.Key); }