From e850d80656b667866e4c317d00edcdbe2be3a020 Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Wed, 26 Jan 2022 18:17:25 -0500 Subject: [PATCH] [Bug Fix (faction)] Do not award faction if NPC is charmed. (#1945) * Do not award faction if npc is charmed. * No faction on kill of charmed mob or questreward of same --- zone/attack.cpp | 2 +- zone/client.cpp | 4 ++-- zone/questmgr.cpp | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 1c8c0da6e..122f43d31 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2411,7 +2411,7 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy give_exp_client = give_exp->CastToClient(); //do faction hits even if we are a merchant, so long as a player killed us - if (give_exp_client && !RuleB(NPC, EnableMeritBasedFaction)) + if (!IsCharmed() && give_exp_client && !RuleB(NPC, EnableMeritBasedFaction)) hate_list.DoFactionHits(GetNPCFactionID()); bool IsLdonTreasure = (this->GetClass() == LDON_TREASURE); diff --git a/zone/client.cpp b/zone/client.cpp index dd45cbbc7..7a1a43d65 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8678,7 +8678,7 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold, if (faction) { - if (target && target->IsNPC()) + if (target && target->IsNPC() && !target->IsCharmed()) { int32 nfl_id = target->CastToNPC()->GetNPCFactionID(); SetFactionLevel(CharacterID(), nfl_id, GetBaseClass(), GetBaseRace(), GetDeity(), true); @@ -8714,7 +8714,7 @@ void Client::QuestReward(Mob* target, const QuestReward_Struct &reward, bool fac if (faction) { - if (target && target->IsNPC()) + if (target && target->IsNPC() && !target->IsCharmed()) { int32 nfl_id = target->CastToNPC()->GetNPCFactionID(); SetFactionLevel(CharacterID(), nfl_id, GetBaseClass(), GetBaseRace(), GetDeity(), true); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 7ee12f466..5bcbbfb14 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1353,7 +1353,8 @@ void QuestManager::save() { void QuestManager::faction(int faction_id, int faction_value, int temp) { QuestManagerCurrentQuestVars(); - if (initiator && initiator->IsClient()) { + running_quest run = quests_running_.top(); + if(run.owner->IsCharmed() == false && initiator && initiator->IsClient()) { if(faction_id != 0 && faction_value != 0) { initiator->SetFactionLevel2( initiator->CharacterID(),