private WoWPlayer CheckPrayerOfHealing()
{
if (Me.IsInParty || Me.IsInRaid)
{
WoWPlayer[] targets = new WoWPlayer[(Me.RaidMembers.Count / 5)];
int[] count = new int[(Me.RaidMembers.Count / 5)];
int CurrentPlayerInParty = 0;
int CurrentParty = 0;
int MeCount = 0;
int CompareCounts = 0;
foreach (WoWPlayer p in Me.PartyMembers)
{
if (p.Distance < 30
&& p.HealthPercent < DiscSettings.Instance.PrayerHealingMax_SET
&& p.HealthPercent > DiscSettings.Instance.PrayerHealingMin_SET
&& !p.HasAura("Divine Aegis"))
{
MeCount++;
}
}
if (Me.Distance < 30
&& Me.HealthPercent < DiscSettings.Instance.PrayerHealingMax_SET
&& Me.HealthPercent > DiscSettings.Instance.PrayerHealingMin_SET
&& !Me.HasAura("Divine Aegis"))
{
MeCount++;
}
if (!Me.IsInRaid)
{
if (MeCount >= DiscSettings.Instance.PrayerHealingNum_SET)
{
Logging.Write("PoH Party Count: " + MeCount);
return Me;
}
else
{
return null;
}
}
foreach (int c in count)
{
count[c] = 0;
}
foreach (WoWPlayer p in Me.RaidMembers)
{
if (!p.IsMe && !p.IsInMyParty)
{
if (CurrentPlayerInParty > 4)
{
CurrentPlayerInParty = 0;
CurrentParty++;
}
if (CurrentPlayerInParty == 0)
{
targets[CurrentParty] = p;
}
if (p.Distance < 30
&& p.HealthPercent < DiscSettings.Instance.PrayerHealingMax_SET
&& p.HealthPercent > DiscSettings.Instance.PrayerHealingMin_SET
&& !p.HasAura("Divine Aegis"))
{
count[CurrentParty]++;
}
CurrentPlayerInParty++;
}
}
for (int i = 0; i < targets.Length; i++)
{
if (count[i] > count[CompareCounts])
{
CompareCounts = i;
}
}
if (MeCount >= DiscSettings.Instance.PrayerHealingNum_SET
|| count[CompareCounts] >= DiscSettings.Instance.PrayerHealingNum_SET)
{
if (count[CompareCounts] == null)
{
return Me;
}
if (MeCount >= count[CompareCounts])
{
return Me;
}
else
{
return targets[CompareCounts];
}
}
}
return null;
}