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

Port From (https://github.com/TrinityCore/TrinityCore/commit/78698463ff6b20255148fb647e9ad33a487bb09d)
This commit is contained in:
hondacrx
2022-09-11 14:40:24 -04:00
parent f9b7f3fa9f
commit 595ac58013
4 changed files with 24 additions and 11 deletions
+1 -1
View File
@@ -6371,7 +6371,7 @@ namespace Game.Entities
if (loot_type == LootType.Pickpocketing) if (loot_type == LootType.Pickpocketing)
{ {
if (loot.loot_type != LootType.Pickpocketing) if (loot == null || loot.loot_type != LootType.Pickpocketing)
{ {
if (creature.CanGeneratePickPocketLoot()) if (creature.CanGeneratePickPocketLoot())
{ {
+1 -7
View File
@@ -1912,13 +1912,7 @@ namespace Game.Spells
if (!m_caster.IsTypeId(TypeId.Player)) if (!m_caster.IsTypeId(TypeId.Player))
return; return;
// victim must be creature and attackable m_caster.ToPlayer().SendLoot(unitTarget.GetGUID(), LootType.Pickpocketing);
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);
} }
[SpellEffectHandler(SpellEffectName.AddFarsight)] [SpellEffectHandler(SpellEffectName.AddFarsight)]
+4 -2
View File
@@ -1039,9 +1039,11 @@ namespace Game.Spells
if (HasAttribute(SpellCustomAttributes.PickPocket)) if (HasAttribute(SpellCustomAttributes.PickPocket))
{ {
if (unitTarget.IsTypeId(TypeId.Player)) Creature targetCreature = unitTarget.ToCreature();
if (targetCreature == null)
return SpellCastResult.BadTargets; return SpellCastResult.BadTargets;
else if ((unitTarget.GetCreatureTypeMask() & (uint)CreatureType.MaskHumanoidOrUndead) == 0)
if (!Loots.LootStorage.Pickpocketing.HaveLootFor(targetCreature.GetCreatureTemplate().PickPocketId))
return SpellCastResult.TargetNoPockets; return SpellCastResult.TargetNoPockets;
} }
+18 -1
View File
@@ -271,7 +271,7 @@ namespace Scripts.Spells.Rogue
void FilterTargets(List<WorldObject> targets) void FilterTargets(List<WorldObject> targets)
{ {
if (targets.Empty() || GetCaster().GetVehicleBase()) if (targets.Empty() || GetCaster().GetVehicleBase())
FinishCast( SpellCastResult.OutOfRange); FinishCast(SpellCastResult.OutOfRange);
} }
void HandleDummy(uint effIndex) 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 [Script] // 79096 - Restless Blades
class spell_rog_restless_blades : AuraScript class spell_rog_restless_blades : AuraScript
{ {