diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index a0f83eda3..c577e67bb 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -6371,7 +6371,7 @@ namespace Game.Entities if (loot_type == LootType.Pickpocketing) { - if (loot.loot_type != LootType.Pickpocketing) + if (loot == null || loot.loot_type != LootType.Pickpocketing) { if (creature.CanGeneratePickPocketLoot()) { diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index b57c688e8..664d4fbab 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -1912,13 +1912,7 @@ namespace Game.Spells if (!m_caster.IsTypeId(TypeId.Player)) return; - // victim must be creature and attackable - if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Unit) || m_caster.IsFriendlyTo(unitTarget)) - return; - - // victim have to be alive and humanoid or undead - if (unitTarget.IsAlive() && (unitTarget.GetCreatureTypeMask() & (uint)CreatureType.MaskHumanoidOrUndead) != 0) - m_caster.ToPlayer().SendLoot(unitTarget.GetGUID(), LootType.Pickpocketing); + m_caster.ToPlayer().SendLoot(unitTarget.GetGUID(), LootType.Pickpocketing); } [SpellEffectHandler(SpellEffectName.AddFarsight)] diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 52c8a104d..7f789732b 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -1039,9 +1039,11 @@ namespace Game.Spells if (HasAttribute(SpellCustomAttributes.PickPocket)) { - if (unitTarget.IsTypeId(TypeId.Player)) + Creature targetCreature = unitTarget.ToCreature(); + if (targetCreature == null) return SpellCastResult.BadTargets; - else if ((unitTarget.GetCreatureTypeMask() & (uint)CreatureType.MaskHumanoidOrUndead) == 0) + + if (!Loots.LootStorage.Pickpocketing.HaveLootFor(targetCreature.GetCreatureTemplate().PickPocketId)) return SpellCastResult.TargetNoPockets; } diff --git a/Source/Scripts/Spells/Rogue.cs b/Source/Scripts/Spells/Rogue.cs index a85352c0e..463f2117e 100644 --- a/Source/Scripts/Spells/Rogue.cs +++ b/Source/Scripts/Spells/Rogue.cs @@ -271,7 +271,7 @@ namespace Scripts.Spells.Rogue void FilterTargets(List targets) { if (targets.Empty() || GetCaster().GetVehicleBase()) - FinishCast( SpellCastResult.OutOfRange); + FinishCast(SpellCastResult.OutOfRange); } void HandleDummy(uint effIndex) @@ -369,6 +369,23 @@ namespace Scripts.Spells.Rogue } } + [Script] + class spell_rog_pickpocket : SpellScript + { + SpellCastResult CheckCast() + { + if (!GetExplTargetUnit() || !GetCaster().IsValidAttackTarget(GetExplTargetUnit(), GetSpellInfo())) + return SpellCastResult.BadTargets; + + return SpellCastResult.SpellCastOk; + } + + public override void Register() + { + OnCheckCast.Add(new CheckCastHandler(CheckCast)); + } + } + [Script] // 79096 - Restless Blades class spell_rog_restless_blades : AuraScript {