Core/Spells: Remove all hardcoded restrictions for pick pocket spell effect and rely only on presence of pickpocket loot in db

This commit is contained in:
Shauren authored and Ovahlord committed 2022-10-04 12:42:10 +02:00
1 parent cf2bf7f77f
commit 0ca955897f
5 files changed
+28 -10

No files matched your search

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_rog_pickpocket';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(921,'spell_rog_pickpocket');
+1 -1
View File
@@ -8597,7 +8597,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
loot = &creature->loot;
if (loot_type == LOOT_PICKPOCKETING)
if (!loot || loot->loot_type != LOOT_PICKPOCKETING)
{
if (loot->loot_type != LOOT_PICKPOCKETING)
{
+1 -7
View File
@@ -2188,13 +2188,7 @@ void Spell::EffectPickPocket(SpellEffIndex /*effIndex*/)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// victim must be creature and attackable
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);
m_caster->ToPlayer()->SendLoot(unitTarget->GetGUID(), LOOT_PICKPOCKETING);
}
void Spell::EffectAddFarsight(SpellEffIndex effIndex)
+5 -2
View File
@@ -25,6 +25,7 @@
#include "Item.h"
#include "ItemTemplate.h"
#include "Log.h"
#include "LootMgr.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Random.h"
@@ -1882,9 +1883,11 @@ SpellCastResult SpellInfo::CheckTarget(WorldObject const* caster, WorldObject co
if (HasAttribute(SPELL_ATTR0_CU_PICKPOCKET))
{
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
Creature const* targetCreature = unitTarget->ToCreature();
if (!targetCreature)
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;
}
+18
View File
@@ -1553,6 +1553,23 @@ class spell_rog_vanish : public AuraScript
}
};
// 921 - Pick Pocket
class spell_rog_pickpocket : public SpellScript
{
SpellCastResult CheckCast()
{
if (!GetExplTargetUnit() || !GetCaster()->IsValidAttackTarget(GetExplTargetUnit(), GetSpellInfo()))
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void Register() override
{
OnCheckCast.Register(&spell_rog_pickpocket::CheckCast);
}
};
void AddSC_rogue_spell_scripts()
{
RegisterSpellScript(spell_rog_bandits_guile);
@@ -1574,6 +1591,7 @@ void AddSC_rogue_spell_scripts()
RegisterSpellScript(spell_rog_murderous_intent);
new spell_rog_nerves_of_steel();
new spell_rog_overkill();
RegisterSpellScript(spell_rog_pickpocket);
new spell_rog_preparation();
new spell_rog_prey_on_the_weak();
RegisterSpellScript(spell_rog_recuperate);