mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix(Core/Spells): Remove all hardcoded restrictions for pick pocket sp… (#14788)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_rog_pickpocket';
|
||||||
|
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||||
|
(921,'spell_rog_pickpocket');
|
||||||
@@ -7878,7 +7878,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||||||
|
|
||||||
if (loot_type == LOOT_PICKPOCKETING)
|
if (loot_type == LOOT_PICKPOCKETING)
|
||||||
{
|
{
|
||||||
if (loot->loot_type != LOOT_PICKPOCKETING)
|
if (!loot || loot->loot_type != LOOT_PICKPOCKETING)
|
||||||
{
|
{
|
||||||
if (creature->CanGeneratePickPocketLoot())
|
if (creature->CanGeneratePickPocketLoot())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13778,9 +13778,9 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const
|
|||||||
return !HasUnitState(UNIT_STATE_UNATTACKABLE) && (!checkFakeDeath || !HasUnitState(UNIT_STATE_DIED));
|
return !HasUnitState(UNIT_STATE_UNATTACKABLE) && (!checkFakeDeath || !HasUnitState(UNIT_STATE_DIED));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::IsValidAttackTarget(Unit const* target) const
|
bool Unit::IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const
|
||||||
{
|
{
|
||||||
return _IsValidAttackTarget(target, nullptr);
|
return _IsValidAttackTarget(target, bySpell);
|
||||||
}
|
}
|
||||||
|
|
||||||
// function based on function Unit::CanAttack from 13850 client
|
// function based on function Unit::CanAttack from 13850 client
|
||||||
|
|||||||
@@ -1713,7 +1713,7 @@ public:
|
|||||||
|
|
||||||
bool isTargetableForAttack(bool checkFakeDeath = true, Unit const* byWho = nullptr) const;
|
bool isTargetableForAttack(bool checkFakeDeath = true, Unit const* byWho = nullptr) const;
|
||||||
|
|
||||||
bool IsValidAttackTarget(Unit const* target) const;
|
bool IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell = nullptr) const;
|
||||||
bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = nullptr) const;
|
bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = nullptr) const;
|
||||||
|
|
||||||
bool IsValidAssistTarget(Unit const* target) const;
|
bool IsValidAssistTarget(Unit const* target) const;
|
||||||
|
|||||||
@@ -2719,13 +2719,7 @@ void Spell::EffectPickPocket(SpellEffIndex /*effIndex*/)
|
|||||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// victim must be creature and attackable
|
m_caster->ToPlayer()->SendLoot(unitTarget->GetGUID(), LOOT_PICKPOCKETING);
|
||||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->IsFriendlyTo(unitTarget))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// victim have to be alive and humanoid or undead
|
|
||||||
if (unitTarget->IsAlive() && (unitTarget->GetCreatureTypeMask() &CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0)
|
|
||||||
m_caster->ToPlayer()->SendLoot(unitTarget->GetGUID(), LOOT_PICKPOCKETING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectAddFarsight(SpellEffIndex effIndex)
|
void Spell::EffectAddFarsight(SpellEffIndex effIndex)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "ConditionMgr.h"
|
#include "ConditionMgr.h"
|
||||||
#include "DBCStores.h"
|
#include "DBCStores.h"
|
||||||
|
#include "LootMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "Spell.h"
|
#include "Spell.h"
|
||||||
@@ -1777,11 +1778,13 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
|
|||||||
if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer()))
|
if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer()))
|
||||||
return SPELL_FAILED_CANT_CAST_ON_TAPPED;
|
return SPELL_FAILED_CANT_CAST_ON_TAPPED;
|
||||||
|
|
||||||
if (AttributesCu & SPELL_ATTR0_CU_PICKPOCKET)
|
if (HasAttribute(SPELL_ATTR0_CU_PICKPOCKET))
|
||||||
{
|
{
|
||||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
|
Creature const* targetCreature = unitTarget->ToCreature();
|
||||||
|
if (!targetCreature)
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
else if ((unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
|
|
||||||
|
if (!LootTemplates_Pickpocketing.HaveLootFor(targetCreature->GetCreatureTemplate()->pickpocketLootId))
|
||||||
return SPELL_FAILED_TARGET_NO_POCKETS;
|
return SPELL_FAILED_TARGET_NO_POCKETS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -675,6 +675,24 @@ class spell_rog_tricks_of_the_trade_proc : public AuraScript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class spell_rog_pickpocket : public SpellScript
|
||||||
|
{
|
||||||
|
PrepareSpellScript(spell_rog_pickpocket);
|
||||||
|
|
||||||
|
SpellCastResult CheckCast()
|
||||||
|
{
|
||||||
|
if (!GetExplTargetUnit() || !GetCaster()->IsValidAttackTarget(GetExplTargetUnit(), GetSpellInfo()))
|
||||||
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
|
|
||||||
|
return SPELL_CAST_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnCheckCast += SpellCheckCastFn(spell_rog_pickpocket::CheckCast);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void AddSC_rogue_spell_scripts()
|
void AddSC_rogue_spell_scripts()
|
||||||
{
|
{
|
||||||
RegisterSpellScript(spell_rog_savage_combat);
|
RegisterSpellScript(spell_rog_savage_combat);
|
||||||
@@ -690,4 +708,5 @@ void AddSC_rogue_spell_scripts()
|
|||||||
RegisterSpellScript(spell_rog_shiv);
|
RegisterSpellScript(spell_rog_shiv);
|
||||||
RegisterSpellScript(spell_rog_tricks_of_the_trade);
|
RegisterSpellScript(spell_rog_tricks_of_the_trade);
|
||||||
RegisterSpellScript(spell_rog_tricks_of_the_trade_proc);
|
RegisterSpellScript(spell_rog_tricks_of_the_trade_proc);
|
||||||
|
RegisterSpellScript(spell_rog_pickpocket);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user