mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 09:03:47 +00:00
feat(Core/SAI): implement SMART_ACTION_DISABLE_REWARD (#21105)
This commit is contained in:
@@ -286,7 +286,9 @@ Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(),
|
||||
m_ProhibitSchoolTime[i] = 0;
|
||||
|
||||
m_CreatureSpellCooldowns.clear();
|
||||
DisableReputationGain = false;
|
||||
|
||||
DisableReputationReward = false;
|
||||
DisableLootReward = false;
|
||||
|
||||
m_SightDistance = sWorld->getFloatConfig(CONFIG_SIGHT_MONSTER);
|
||||
m_CombatDistance = 0.0f;
|
||||
|
||||
@@ -359,8 +359,10 @@ public:
|
||||
|
||||
Unit* SelectVictim();
|
||||
|
||||
void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
|
||||
[[nodiscard]] bool IsReputationGainDisabled() const { return DisableReputationGain; }
|
||||
void SetReputationRewardDisabled(bool disable) { DisableReputationReward = disable; }
|
||||
[[nodiscard]] bool IsReputationRewardDisabled() const { return DisableReputationReward; }
|
||||
void SetLootRewardDisabled(bool disable) { DisableLootReward = disable; }
|
||||
[[nodiscard]] bool IsLootRewardDisabled() const { return DisableLootReward; }
|
||||
[[nodiscard]] bool IsDamageEnoughForLootingAndReward() const;
|
||||
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer = true);
|
||||
void ResetPlayerDamageReq();
|
||||
@@ -478,7 +480,8 @@ protected:
|
||||
Position m_homePosition;
|
||||
Position m_transportHomePosition;
|
||||
|
||||
bool DisableReputationGain;
|
||||
bool DisableReputationReward;
|
||||
bool DisableLootReward;
|
||||
|
||||
CreatureTemplate const* m_creatureInfo; // in difficulty mode > 0 can different from sObjectMgr->GetCreatureTemplate(GetEntry())
|
||||
CreatureData const* m_creatureData;
|
||||
|
||||
@@ -5982,7 +5982,7 @@ void Player::RewardReputation(Unit* victim)
|
||||
if (!victim || victim->IsPlayer())
|
||||
return;
|
||||
|
||||
if (victim->ToCreature()->IsReputationGainDisabled())
|
||||
if (victim->ToCreature()->IsReputationRewardDisabled())
|
||||
return;
|
||||
|
||||
ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(victim->ToCreature()->GetCreatureTemplate()->Entry);
|
||||
|
||||
@@ -5619,7 +5619,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
|
||||
|
||||
bool Player::isAllowedToLoot(Creature const* creature)
|
||||
{
|
||||
if (!creature->isDead() || !creature->IsDamageEnoughForLootingAndReward())
|
||||
if (!creature->isDead() || !creature->IsDamageEnoughForLootingAndReward() || creature->IsLootRewardDisabled())
|
||||
return false;
|
||||
|
||||
if (HasPendingBind())
|
||||
|
||||
@@ -17781,7 +17781,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
|
||||
bool isRewardAllowed = true;
|
||||
if (creature)
|
||||
{
|
||||
isRewardAllowed = creature->IsDamageEnoughForLootingAndReward();
|
||||
isRewardAllowed = (creature->IsDamageEnoughForLootingAndReward() && !creature->IsLootRewardDisabled());
|
||||
if (!isRewardAllowed)
|
||||
creature->SetLootRecipient(nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user