if (!NumXTargets() && !PullTarget && !bResting) {
bool dogroupwatch = false;
bool ineedrest = false;
bool theyneedrest = false;
if (PSPAWNINFO me = GetCharInfo()->pSpawn) {
if (iGroupWatch != Watch_SelfOnly) {
for (int i = 0; i < GroupSize(); i++) {
if (GroupMember(i) && GroupMember(i)->pSpawn) {
if (dogroupwatch) dogroupwatch = false;
signed int gMemberClass = GroupMember(i)->pSpawn->GetClass();
switch (iGroupWatch) {
case Watch_All://What it says, lets keep track of everyone.
//WriteOut("Watch All-Watching: %s the %s", GroupMember(i)->pSpawn->Name, GetClassDesc(gMemberClass));
dogroupwatch = true;
break;
case Watch_HealerAndCrowdControl://Healer and Crowd Control (Cleric, Druid, Shaman, Bard, Enchanter)
switch (gMemberClass) {
case EQData::Cleric:
case EQData::Druid:
case EQData::Shaman:
case EQData::Bard:
case EQData::Enchanter:
//WriteOut("CCHealer-Watching: %s the %s", GroupMember(i)->pSpawn->Name, GetClassDesc(gMemberClass));
dogroupwatch = true;
break;
default:
break;
}
break;
case Watch_HealerOnly://Healer Only. (Cleric, Druid, Shaman)
switch (gMemberClass) {
case EQData::Cleric:
case EQData::Druid:
case EQData::Shaman:
//WriteOut("Healer Only-Watching: %s the %s", GroupMember(i)->pSpawn->Name, GetClassDesc(gMemberClass));
dogroupwatch = true;
break;
default:
break;
}
break;
default://GroupWatch is probably off, or SelfOnly or something to that effect.
break;
}
if (dogroupwatch && !bResting) {
if (hasMana(GroupMember(i)->pSpawn->GetClass()) ? GroupMember(i)->pSpawn->GetCurrentMana() < 30 : false) {
if (bDebugging) WriteOut("%s\ar%s needs mana %i/30.", pluginmsg.c_str(), GetClassDesc(gMemberClass), GroupMember(i)->pSpawn->GetCurrentMana());
theyneedrest = true;
}
if (GroupMember(i)->pSpawn->HPCurrent < 75) {
if (bDebugging) WriteOut("%s\ar%s needs health %lli/75.", pluginmsg.c_str(), GetClassDesc(gMemberClass), GroupMember(i)->pSpawn->HPCurrent);
theyneedrest = true;
}
if (hasMana(GroupMember(i)->pSpawn->GetClass()) ? false : GroupMember(i)->pSpawn->GetCurrentEndurance() < 5) {
if (bDebugging) WriteOut("%s\ar%s needs endurance %i/5.", pluginmsg.c_str(), GetClassDesc(gMemberClass), GroupMember(i)->pSpawn->GetCurrentEndurance());
theyneedrest = true;
}
}
}
}
}
if (!theyneedrest && PercentHealth(me) > 80 && (hasMana(me->GetClass()) ? PercentMana(me) >= 20 : true) && PercentEndurance(me) > 5) {
PullTarget = SearchSpawns(searchString);
if (bReturningToCamp) bReturningToCamp = false;
}
else if (PercentHealth(me) <= 80 || (hasMana(me->GetClass()) ? PercentMana(me) <= 20 : false) || PercentEndurance(me) <= 5)
ineedrest = true;
if (ineedrest || theyneedrest) {
if (DistanceFromCamp() > 15) {
if (!NavActive()) Navigate(Camp.Y, Camp.X, Camp.Z);
return;
}
else {
bResting = true;
if (ineedrest) WriteOut("%sI need to rest.", pluginmsg.c_str());
if (theyneedrest) WriteOut("%sGroup needs rest.", pluginmsg.c_str());
}
}
}
}
else if (bResting) {
bool needrest = false;
bool dogroupwatch = false;
if (PSPAWNINFO me = GetCharInfo()->pSpawn) {
for (int i = 0; i < GroupSize(); i++) {
if (GroupMember(i) && GroupMember(i)->pSpawn) {
signed int gMemberClass = GroupMember(i)->pSpawn->GetClass();
switch (iGroupWatch) {
case Watch_All://What it says, lets keep track of everyone.
dogroupwatch = true;
break;
case Watch_HealerAndCrowdControl://Healer and Crowd Control (Cleric, Druid, Shaman, Bard, Enchanter)
switch (gMemberClass) {
case EQData::Cleric:
case EQData::Druid:
case EQData::Shaman:
case EQData::Bard:
case EQData::Enchanter:
dogroupwatch = true;
break;
default:
break;
}
case Watch_HealerOnly://Healer Only. (Cleric, Druid, Shaman)
switch (gMemberClass) {
case EQData::Cleric:
case EQData::Druid:
case EQData::Shaman:
dogroupwatch = true;
break;
default:
break;
}
break;
default://GroupWatch is probably off, or SelfOnly or something to that effect.
break;
}
if (dogroupwatch) {
if (hasMana(GroupMember(i)->pSpawn->GetClass()) ? GroupMember(i)->pSpawn->GetCurrentMana() < 80 : false)
needrest = true;
if (GroupMember(i)->pSpawn->HPCurrent < 85)
needrest = true;
if (hasMana(GroupMember(i)->pSpawn->GetClass()) ? false : GroupMember(i)->pSpawn->GetCurrentEndurance() < 20)
needrest = true;
}
}
}
if (PercentHealth(me) <= 80 || (hasMana(me->GetClass()) ? PercentMana(me) <= 80 : false) || PercentEndurance(me) <= 20)
needrest = true;
}
if (!needrest) {
bResting = false;
}
else if (DistanceFromCamp() > 15) {
if (!NavActive()) Navigate(Camp.Y, Camp.X, Camp.Z);
return;
}
else if (ImStanding() && !NumXTargets() && !Casting() && WhenLastStood + 1000 < GetTickCount64()) {
if (PSPAWNINFO me = GetCharInfo()->pSpawn) {
if (!Moving(me)) {
EzCommand("/sit");
WriteOut("%sGroup still needs rest, please wait.", pluginmsg.c_str());
}
}
}
}