diff --git a/sql/updates/world/4.3.4/2022_10_04_00_world.sql b/sql/updates/world/4.3.4/2022_10_04_00_world.sql new file mode 100644 index 0000000000..4f16b84e39 --- /dev/null +++ b/sql/updates/world/4.3.4/2022_10_04_00_world.sql @@ -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'); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 7f38976282..05f1b2f278 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -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) { diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c2042af6f6..d136b3b5db 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -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) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 2002ebd7ad..21b2112d3f 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -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; } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index bc3b96190a..72e487c3a3 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -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);