mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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:
3
sql/updates/world/master/2022_09_11_00_world.sql
Normal file
3
sql/updates/world/master/2022_09_11_00_world.sql
Normal file
@@ -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');
|
||||
@@ -9018,7 +9018,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type, bool aeLooting/* = fa
|
||||
|
||||
if (loot_type == LOOT_PICKPOCKETING)
|
||||
{
|
||||
if (loot->loot_type != LOOT_PICKPOCKETING)
|
||||
if (!loot || loot->loot_type != LOOT_PICKPOCKETING)
|
||||
{
|
||||
if (creature->CanGeneratePickPocketLoot())
|
||||
{
|
||||
|
||||
@@ -2223,13 +2223,7 @@ void Spell::EffectPickPocket()
|
||||
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()
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Item.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
#include "Map.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Pet.h"
|
||||
@@ -2132,10 +2133,12 @@ SpellCastResult SpellInfo::CheckTarget(WorldObject const* caster, WorldObject co
|
||||
|
||||
if (HasAttribute(SPELL_ATTR0_CU_PICKPOCKET))
|
||||
{
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
else if ((unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
|
||||
return SPELL_FAILED_TARGET_NO_POCKETS;
|
||||
Creature const* targetCreature = unitTarget->ToCreature();
|
||||
if (!targetCreature)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (!LootTemplates_Pickpocketing.HaveLootFor(targetCreature->GetCreatureTemplate()->pickpocketLootId))
|
||||
return SPELL_FAILED_TARGET_NO_POCKETS;
|
||||
}
|
||||
|
||||
// Not allow disarm unarmed player
|
||||
|
||||
@@ -402,6 +402,24 @@ class spell_rog_mastery_main_gauche : 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);
|
||||
}
|
||||
};
|
||||
|
||||
// 79096 - Restless Blades
|
||||
class spell_rog_restless_blades : public AuraScript
|
||||
{
|
||||
@@ -976,6 +994,7 @@ void AddSC_rogue_spell_scripts()
|
||||
RegisterSpellScript(spell_rog_grand_melee);
|
||||
RegisterSpellAndAuraScriptPair(spell_rog_killing_spree, spell_rog_killing_spree_aura);
|
||||
RegisterSpellScript(spell_rog_mastery_main_gauche);
|
||||
RegisterSpellScript(spell_rog_pickpocket);
|
||||
RegisterSpellScript(spell_rog_restless_blades);
|
||||
RegisterSpellScript(spell_rog_roll_the_bones);
|
||||
RegisterSpellScript(spell_rog_rupture);
|
||||
|
||||
Reference in New Issue
Block a user