How do I check if the HasAura("spells name") is from me or another player?
private static WoWPlayer AddedCheck()
{
return (from Unit in ObjectManager.GetObjectsOfType<WoWPlayer>(false)
orderby Unit.HealthPercent
where Unit.IsAlive
where Unit.IsPlayer
where Unit.Distance < 20
where !Unit.IsFriendly
where !Unit.IsPet
where Unit.InLineOfSpellSight
where !Unit.HasAura("Spell Name")
[B]where Unit.ActiveAuras["Spell Name"].CreatorGuid != Me.Guid[/B]
select Unit).LastOrDefault();
}
[BGBuddy PVP Suite] Targetting Error: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at BGBuddyPVPSuite.Targeting.<AddedCheck>b__c(WoWPlayer Unit) in c:\U\Honorbuddy_2.0.0.5883\Plugins\pvp\Targeting.cs:line 118
at System.Linq.Enumerable.<>c__DisplayClassf`1.<CombinePredicates>b__e(TSource x)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
at BGBuddyPVPSuite.Targeting.AddedCheck() in c:\U\Honorbuddy_2.0.0.5883\Plugins\pvp\Targeting.cs:line 109
at BGBuddyPVPSuite.Targeting.PulseTargeting() in c:\U\Honorbuddy_2.0.0.5883\Plugins\pvp\Targeting.cs:line 88
where !Unit.HasAura("Corruption")
where Unit.ActiveAuras["Corruption"].CreatorGuid != Me.Guid
private static WoWPlayer EnemyNewbie()
{
return (from Unit in ObjectManager.GetObjectsOfType<WoWPlayer>(false)
orderby Unit.HealthPercent
where Unit.IsAlive
where Unit.IsPlayer
where Unit.Distance < 39
where !Unit.IsFriendly
where !Unit.IsPet
where Unit.InLineOfSpellSight
where !Unit.HasAura("Corruption")
where Unit.ActiveAuras["Corruption"].CreatorGuid != Me.Guid
select Unit).FirstOrDefault();
}
#region MyCreatedAuraTimeLeft
private double MyCreatedAuraTimeLeft(string auraName, WoWUnit unit)
{
using (new FrameLock())
{
if (unit == null)
return 0;
WoWAura aura = (from a in unit.Auras
where a.Value.CreatorGuid == Me.Guid &&
0 == string.Compare(a.Value.Name, auraName, true)
select a.Value).FirstOrDefault();
if (aura == null)
{
return 0;
}
else
{
return aura.TimeLeft.TotalMilliseconds;
}
}
}
#endregion
#region MyCreatedAuraStackCount
private double MyCreatedAuraStackCount(string auraName, WoWUnit unit)
{
using (new FrameLock())
{
if (unit == null)
return 0;
WoWAura aura = (from a in unit.Auras
where a.Value.CreatorGuid == Me.Guid &&
0 == string.Compare(a.Value.Name, auraName, true)
select a.Value).FirstOrDefault();
if (aura == null)
{
return 0;
}
else
{
return aura.StackCount;
}
}
}
#endregion
we're talkin bout a simple LINQ expression, or if u prefer the easy way with time-consuming loops the it is a simple for eachI don't want to copy paste another mans work<wowplayer>
Source: http://www.thebuddyforum.com/honorb.../12433-rules-cc-plugin-development-rules.html</wowplayer>If using code from another CC, you must give credit for the code. No questions asked. [Simple snippets, such as object searches, simple Lua calls, etc, may be excluded]
where [B]![/B]Unit.HasAura("Corruption")
where Unit.ActiveAuras["Corruption"].CreatorGuid != Me.Guid