Add bot and bot pet checks to various spells, auras and targeting checks that were missing.

This commit is contained in:
nytmyr
2025-01-25 07:01:39 -06:00
parent 2df4a4e436
commit abaefc8e7f
12 changed files with 42 additions and 42 deletions
+5 -5
View File
@@ -2811,7 +2811,7 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
const uint32 con_level = give_exp->GetLevelCon(GetLevel());
if (con_level != ConsiderColor::Gray) {
if (!GetOwner() || (GetOwner() && !GetOwner()->IsClient())) {
if (!GetOwner() || (GetOwner() && !GetOwner()->IsOfClientBot())) {
give_exp_client->AddEXP(ExpSource::Kill, final_exp, con_level, false, this);
if (
@@ -6486,7 +6486,7 @@ void Mob::CommonOutgoingHitSuccess(Mob* defender, DamageHitInfo &hit, ExtraAttac
int mod = GetSpecialAbilityParam(SpecialAbility::Rampage, 2);
if (mod > 0)
spec_mod = mod;
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) {
if ((IsPet() || IsTempPet()) && IsPetOwnerOfClientBot()) {
//SE_PC_Pet_Rampage SPA 464 on pet, damage modifier
int spell_mod = spellbonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD] + itembonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD] + aabonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD];
if (spell_mod > spec_mod)
@@ -6497,7 +6497,7 @@ void Mob::CommonOutgoingHitSuccess(Mob* defender, DamageHitInfo &hit, ExtraAttac
int mod = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 2);
if (mod > 0)
spec_mod = mod;
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) {
if ((IsPet() || IsTempPet()) && IsPetOwnerOfClientBot()) {
//SE_PC_Pet_AE_Rampage SPA 465 on pet, damage modifier
int spell_mod = spellbonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD] + itembonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD] + aabonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD];
if (spell_mod > spec_mod)
@@ -6929,7 +6929,7 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts, bool ram
Attack(target, EQ::invslot::slotPrimary, false, false, false, opts);
if (CanThisClassDoubleAttack() && CheckDoubleAttack()) {
Attack(target, EQ::invslot::slotPrimary, false, false, false, opts);
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) {
if ((IsPet() || IsTempPet()) && IsPetOwnerOfClientBot()) {
int chance = spellbonuses.PC_Pet_Flurry + itembonuses.PC_Pet_Flurry + aabonuses.PC_Pet_Flurry;
if (chance && zone->random.Roll(chance)) {
Flurry(nullptr);
@@ -6990,7 +6990,7 @@ void Mob::DoOffHandAttackRounds(Mob *target, ExtraAttackOptions *opts, bool ramp
if (CanThisClassDoubleAttack() && GetLevel() > 35 && CheckDoubleAttack() && !rampage) {
Attack(target, EQ::invslot::slotSecondary, false, false, false, opts);
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) {
if ((IsPet() || IsTempPet()) && IsPetOwnerOfClientBot()) {
int chance = spellbonuses.PC_Pet_Flurry + itembonuses.PC_Pet_Flurry + aabonuses.PC_Pet_Flurry;
if (chance && zone->random.Roll(chance)) {
Flurry(nullptr);
+17 -17
View File
@@ -81,7 +81,7 @@ void Aura::ProcessOnAllFriendlies(Mob *owner)
if (!mob) {
continue;
}
if (mob->IsClient() || mob->IsPetOwnerClient() || mob->IsMerc() || mob->IsBot()) {
if (mob->IsOfClientBotMerc() || mob->IsPetOwnerOfClientBot()) {
auto it = casted_on.find(mob->GetID());
if (it != casted_on.end()) { // we are already on the list, let's check for removal
@@ -131,7 +131,7 @@ void Aura::ProcessOnAllGroupMembers(Mob *owner)
std::set<int> delayed_remove;
bool is_buff = IsBuffSpell(spell_id); // non-buff spells don't cast on enter
if (owner->IsRaidGrouped() && owner->IsClient()) { // currently raids are just client, but safety check
if (owner->IsRaidGrouped() && owner->IsOfClientBot()) { // currently raids are just client, but safety check
auto raid = owner->GetRaid();
if (raid == nullptr) { // well shit
owner->RemoveAura(GetID(), false, true);
@@ -198,17 +198,17 @@ void Aura::ProcessOnAllGroupMembers(Mob *owner)
auto it = casted_on.find(mob->GetID());
if (it != casted_on.end()) {
// verify still good!
if (mob->IsClient()) {
if (mob->IsOfClientBot()) {
if (!verify_raid_client(mob->CastToClient())) {
delayed_remove.insert(mob->GetID());
}
}
else if (mob->IsPet() && mob->IsPetOwnerClient() && mob->GetOwner()) {
else if (mob->IsPet() && mob->IsPetOwnerOfClientBot() && mob->GetOwner()) {
if (!verify_raid_client_pet(mob)) {
delayed_remove.insert(mob->GetID());
}
}
else if (mob->IsNPC() && mob->IsPetOwnerClient()) {
else if (mob->IsNPC() && mob->IsPetOwnerOfClientBot()) {
auto npc = mob->CastToNPC();
if (!verify_raid_client_swarm(npc)) {
delayed_remove.insert(mob->GetID());
@@ -216,19 +216,19 @@ void Aura::ProcessOnAllGroupMembers(Mob *owner)
}
}
else { // we're not on it!
if (mob->IsClient() && verify_raid_client(mob->CastToClient())) {
if (mob->IsOfClientBot() && verify_raid_client(mob->CastToClient())) {
casted_on.insert(mob->GetID());
if (is_buff) {
SpellFinished(spell_id, mob);
}
}
else if (mob->IsPet() && mob->IsPetOwnerClient() && mob->GetOwner() && verify_raid_client_pet(mob)) {
else if (mob->IsPet() && mob->IsPetOwnerOfClientBot() && mob->GetOwner() && verify_raid_client_pet(mob)) {
casted_on.insert(mob->GetID());
if (is_buff) {
SpellFinished(spell_id, mob);
}
}
else if (mob->IsNPC() && mob->IsPetOwnerClient()) {
else if (mob->IsNPC() && mob->IsPetOwnerOfClientBot()) {
auto npc = mob->CastToNPC();
if (verify_raid_client_swarm(npc)) {
casted_on.insert(mob->GetID());
@@ -376,7 +376,7 @@ void Aura::ProcessOnGroupMembersPets(Mob *owner)
auto group_member = owner->GetOwnerOrSelf();
if (group_member->IsRaidGrouped() &&
group_member->IsClient()) { // currently raids are just client, but safety check
group_member->IsOfClientBot()) { // currently raids are just client, but safety check
auto raid = group_member->GetRaid();
if (raid == nullptr) { // well shit
owner->RemoveAura(GetID(), false, true);
@@ -428,12 +428,12 @@ void Aura::ProcessOnGroupMembersPets(Mob *owner)
auto it = casted_on.find(mob->GetID());
if (it != casted_on.end()) {
// verify still good!
if (mob->IsPet() && mob->IsPetOwnerClient() && mob->GetOwner()) {
if (mob->IsPet() && mob->IsPetOwnerOfClientBot() && mob->GetOwner()) {
if (!verify_raid_client_pet(mob)) {
delayed_remove.insert(mob->GetID());
}
}
else if (mob->IsNPC() && mob->IsPetOwnerClient()) {
else if (mob->IsNPC() && mob->IsPetOwnerOfClientBot()) {
auto npc = mob->CastToNPC();
if (!verify_raid_client_swarm(npc)) {
delayed_remove.insert(mob->GetID());
@@ -441,16 +441,16 @@ void Aura::ProcessOnGroupMembersPets(Mob *owner)
}
}
else { // we're not on it!
if (mob->IsClient()) {
if (mob->IsOfClientBot()) {
continue; // never hit client
}
else if (mob->IsPet() && mob->IsPetOwnerClient() && mob->GetOwner() && verify_raid_client_pet(mob)) {
else if (mob->IsPet() && mob->IsPetOwnerOfClientBot() && mob->GetOwner() && verify_raid_client_pet(mob)) {
casted_on.insert(mob->GetID());
if (is_buff) {
SpellFinished(spell_id, mob);
}
}
else if (mob->IsNPC() && mob->IsPetOwnerClient()) {
else if (mob->IsNPC() && mob->IsPetOwnerOfClientBot()) {
auto npc = mob->CastToNPC();
if (verify_raid_client_swarm(npc)) {
casted_on.insert(mob->GetID());
@@ -499,7 +499,7 @@ void Aura::ProcessOnGroupMembersPets(Mob *owner)
}
}
else { // not on, check if we should be!
if (mob->IsClient()) {
if (mob->IsOfClientBot()) {
continue;
}
else if (mob->IsPet() && verify_group_pet(mob)) {
@@ -690,7 +690,7 @@ void Aura::ProcessSpawns()
continue;
}
if (!e.second->IsClient()) {
if (!e.second->IsOfClientBot()) {
continue;
}
@@ -800,7 +800,7 @@ bool Aura::ShouldISpawnFor(Client *c)
return true;
}
if (owner->IsRaidGrouped() && owner->IsClient()) {
if (owner->IsRaidGrouped() && owner->IsOfClientBot()) {
auto raid = owner->GetRaid();
if (raid == nullptr) {
return false;
+1 -1
View File
@@ -31,7 +31,7 @@
/*
TODO bot rewrite:
--go through IsPetOwnerClient checks for pets
--move togglehelm and bottoggleranged to new window format
--command cleanup (move to new help window, make more descriptive)
--Add quest methods for functions
*/
+2 -2
View File
@@ -8807,10 +8807,10 @@ void Client::ProcessAggroMeter()
// probably should have PVP rules ...
if (cur_tar && cur_tar != this) {
if (cur_tar->IsNPC() && !cur_tar->IsPetOwnerClient() && cur_tar->GetID() != m_aggrometer.get_target_id()) {
if (cur_tar->IsNPC() && !cur_tar->IsPetOwnerOfClientBot() && cur_tar->GetID() != m_aggrometer.get_target_id()) {
m_aggrometer.set_target_id(cur_tar->GetID());
send_targetinfo = true;
} else if ((cur_tar->IsPetOwnerClient() || cur_tar->IsClient()) && cur_tar->GetTarget() && cur_tar->GetTarget()->GetID() != m_aggrometer.get_target_id()) {
} else if ((cur_tar->IsPetOwnerOfClientBot() || cur_tar->IsClient()) && cur_tar->GetTarget() && cur_tar->GetTarget()->GetID() != m_aggrometer.get_target_id()) {
m_aggrometer.set_target_id(cur_tar->GetTarget()->GetID());
send_targetinfo = true;
}
+1 -1
View File
@@ -15230,7 +15230,7 @@ void Client::Handle_OP_TargetMouse(const EQApplicationPacket *app)
GetTarget()->IsTargeted(1);
return;
}
else if (GetTarget()->IsPetOwnerClient())
else if (GetTarget()->IsPetOwnerOfClientBot())
{
GetTarget()->IsTargeted(1);
return;
+1 -1
View File
@@ -1142,7 +1142,7 @@ void EntityList::AESpell(
continue;
}
if (spells[spell_id].target_type == ST_TargetAENoPlayersPets && current_mob->IsPetOwnerClient()) {
if (spells[spell_id].target_type == ST_TargetAENoPlayersPets && current_mob->IsPetOwnerOfClientBot()) {
continue;
}
+1 -1
View File
@@ -5549,7 +5549,7 @@ Mob *EntityList::GetClosestMobByBodyType(Mob *sender, uint8 BodyType, bool skip_
continue;
// Do not detect client pets
if (skip_client_pets && CurrentMob->IsPet() && CurrentMob->IsPetOwnerClient())
if (skip_client_pets && CurrentMob->IsPet() && CurrentMob->IsPetOwnerOfClientBot())
continue;
CurrentDistance = ((CurrentMob->GetY() - sender->GetY()) * (CurrentMob->GetY() - sender->GetY())) +
+1 -1
View File
@@ -4891,7 +4891,7 @@ bool Mob::HateSummon() {
} else {
bool target_is_client_pet = (
target->IsPet() &&
target->IsPetOwnerClient()
target->IsPetOwnerOfClientBot()
);
bool set_new_guard_spot = !(IsNPC() && target_is_client_pet);
+6 -6
View File
@@ -139,7 +139,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
if (
(spells[AIspells[i].spellid].target_type == ST_Target || tar == this)
&& tar->DontHealMeBefore() < Timer::GetCurrentTime()
&& !(tar->IsPet() && tar->GetOwner()->IsClient()) //no buffing PC's pets
&& !(tar->IsPet() && tar->GetOwner()->IsOfClientBot()) //no buffing PC's pets
) {
auto hp_ratio = tar->GetIntHPRatio();
@@ -180,7 +180,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
&& tar->DontBuffMeBefore() < Timer::GetCurrentTime()
&& !tar->IsImmuneToSpell(AIspells[i].spellid, this)
&& tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0
&& !(tar->IsPet() && tar->GetOwner()->IsClient() && this != tar) //no buffing PC's pets, but they can buff themself
&& !(tar->IsPet() && tar->GetOwner()->IsOfClientBot() && this != tar) //no buffing PC's pets, but they can buff themself
)
{
if(!checked_los) {
@@ -1219,7 +1219,7 @@ void Mob::AI_Process() {
//SE_PC_Pet_Rampage SPA 464 on pet, chance modifier
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) {
if ((IsPet() || IsTempPet()) && IsPetOwnerOfClientBot()) {
int chance = spellbonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_CHANCE] + itembonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_CHANCE] + aabonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_CHANCE];
if (chance && zone->random.Roll(chance)) {
Rampage(nullptr);
@@ -1262,7 +1262,7 @@ void Mob::AI_Process() {
}
//SE_PC_Pet_Rampage SPA 465 on pet, chance modifier
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) {
if ((IsPet() || IsTempPet()) && IsPetOwnerOfClientBot()) {
int chance = spellbonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_CHANCE] + itembonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_CHANCE] + aabonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_CHANCE];
if (chance && zone->random.Roll(chance)) {
Rampage(nullptr);
@@ -1945,8 +1945,8 @@ void Mob::StartEnrage()
return;
}
if(RuleB(NPC, LiveLikeEnrage) && !((IsPet() && !IsCharmed() && GetOwner() && GetOwner()->IsClient()) ||
(CastToNPC()->GetSwarmOwner() && entity_list.GetMob(CastToNPC()->GetSwarmOwner())->IsClient()))) {
if(RuleB(NPC, LiveLikeEnrage) && !((IsPet() && !IsCharmed() && GetOwner() && GetOwner()->IsOfClientBot()) ||
(CastToNPC()->GetSwarmOwner() && entity_list.GetMob(CastToNPC()->GetSwarmOwner())->IsOfClientBot()))) {
return;
}
+1 -1
View File
@@ -555,7 +555,7 @@ void NPC::SetTarget(Mob* mob) {
// either normal pet and owner is client or charmed pet and owner is client
Mob *owner = nullptr;
if (IsPet() && IsPetOwnerClient()) {
if (IsPet() && IsPetOwnerOfClientBot()) {
owner = GetOwner();
} else if (IsCharmed()) {
owner = GetOwner();
+4 -4
View File
@@ -2708,7 +2708,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
// it can affect up to 7 people if the targeted group is not our own
// Allow pets who cast group spells to affect the group.
if (spell_target->IsPetOwnerClient() && IsPetOwnerClient()) {
if (spell_target->IsPetOwnerOfClientBot() && IsPetOwnerOfClientBot()) {
Mob* owner = spell_target->GetOwner();
if (owner) {
@@ -5389,7 +5389,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
// JULY 24, 2002 changes
int level = GetLevel();
if (RuleB(Spells,July242002PetResists) && IsPetOwnerClient() && caster->IsNPC() && !caster->IsPetOwnerClient()) {
if (RuleB(Spells,July242002PetResists) && IsPetOwnerOfClientBot() && caster->IsNPC() && !caster->IsPetOwnerOfClientBot()) {
auto owner = GetOwner();
if (owner != nullptr) {
target_resist = std::max(target_resist, owner->GetResist(resist_type));
@@ -7029,7 +7029,7 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust)
float b = (GetY() * dX - dY * GetX()) / (dX - GetX());
while (iter != targets_in_range.end()) {
if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient())) ||
if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerOfClientBot())) ||
(*iter)->BehindMob(this, (*iter)->GetX(), (*iter)->GetY())) {
++iter;
continue;
@@ -7113,7 +7113,7 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust)
auto iter = targets_in_range.begin();
while (iter != targets_in_range.end()) {
if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient()))) {
if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerOfClientBot()))) {
++iter;
continue;
}
+2 -2
View File
@@ -1556,7 +1556,7 @@ void Mob::TuneCommonOutgoingHitSuccess(Mob* defender, DamageHitInfo &hit, ExtraA
int mod = GetSpecialAbilityParam(SpecialAbility::Rampage, 2);
if (mod > 0)
spec_mod = mod;
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) {
if ((IsPet() || IsTempPet()) && IsPetOwnerOfClientBot()) {
//SE_PC_Pet_Rampage SPA 464 on pet, damage modifier
int spell_mod = spellbonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD] + itembonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD] + aabonuses.PC_Pet_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD];
if (spell_mod > spec_mod)
@@ -1567,7 +1567,7 @@ void Mob::TuneCommonOutgoingHitSuccess(Mob* defender, DamageHitInfo &hit, ExtraA
int mod = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 2);
if (mod > 0)
spec_mod = mod;
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) {
if ((IsPet() || IsTempPet()) && IsPetOwnerOfClientBot()) {
//SE_PC_Pet_AE_Rampage SPA 465 on pet, damage modifier
int spell_mod = spellbonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD] + itembonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD] + aabonuses.PC_Pet_AE_Rampage[SBIndex::PET_RAMPAGE_DMG_MOD];
if (spell_mod > spec_mod)