TC Ports:
Core/Misc: 522f537048 followup (https://github.com/TrinityCore/TrinityCore/commit/9a57e95f102a9d35ac8416d02e24c0dddbc755ed) Core/CreatureAI: b6b0353bff followup (https://github.com/TrinityCore/TrinityCore/commit/5d411e0b21b1f1a4653d274d9b1cc7fef17f232b) Core/Spell: move creature focus (https://github.com/TrinityCore/TrinityCore/commit/8c12f36915b2fddd48a5e4c9244c2b0498a64ae9) Core/Unit: 2170541a51 followup (https://github.com/TrinityCore/TrinityCore/commit/2d4549023a6655d19671f7f7e6b4f7c9b71ae632) Core/Misc: cleanup SetInFront uses (https://github.com/TrinityCore/TrinityCore/commit/104e745edfb89f95e34cad7840eae0b6e183bf94) Core/Unit: 229444b74a follow-up (https://github.com/TrinityCore/TrinityCore/commit/6a96addadd5dea633b3066b8d0427302ba514364) Core/Unit: revert 3ea46e57af (https://github.com/TrinityCore/TrinityCore/commit/a46286a803b41b375ed9352858c742626bb85720) Core/Scripts: remove OnDummyEffect hook/sOnDummyEffect ai hook (https://github.com/TrinityCore/TrinityCore/commit/1929ca3aa14f6cd83ea3ac9d7e8c0e2ed0e87a26) Core/Entities: moved PetAura handling to Player where it belongs (https://github.com/TrinityCore/TrinityCore/commit/4f6d38fe9d5c07e6e8eb88e517af71b6cdc4f9f8) Core/Spells: Fixed Chilled to the Bone (https://github.com/TrinityCore/TrinityCore/commit/08635c740a7ee04da9b0cd5045075a9432121b06) Core/Spell: implement pvp trinket immunity against Judgement of Justice (https://github.com/TrinityCore/TrinityCore/commit/05ba662d5daaa3428cc01cdaa3794bf5a073ef17)
This commit is contained in:
@@ -35,6 +35,7 @@ namespace Framework.Constants
|
||||
|
||||
public struct SmartScriptTypeMaskId
|
||||
{
|
||||
public const uint None = 0;
|
||||
public const uint Creature = 1;
|
||||
public const uint Gameobject = 2;
|
||||
public const uint Areatrigger = 4;
|
||||
@@ -203,7 +204,7 @@ namespace Framework.Constants
|
||||
JustCreated = 63, // None
|
||||
GossipHello = 64, // noReportUse (for GOs)
|
||||
FollowCompleted = 65, // None
|
||||
DummyEffect = 66, // Spellid, Effectindex
|
||||
Unused66 = 66,
|
||||
IsBehindTarget = 67, // Cooldownmin, Cooldownmax
|
||||
GameEventStart = 68, // GameEvent.Entry
|
||||
GameEventEnd = 69, // GameEvent.Entry
|
||||
|
||||
@@ -155,9 +155,9 @@ namespace Game.AI
|
||||
me.SendAIReaction(AiReaction.Alert);
|
||||
|
||||
// Face the unit (stealthed player) and set distracted state for 5 seconds
|
||||
me.SetFacingTo(me.GetAngle(who.GetPositionX(), who.GetPositionY()), true);
|
||||
me.StopMoving();
|
||||
me.GetMotionMaster().MoveDistract(5 * Time.InMilliseconds);
|
||||
me.StopMoving();
|
||||
me.SetFacingTo(me.GetAngle(who));
|
||||
}
|
||||
|
||||
// Called for reaction at stopping attack at no attackers or targets
|
||||
@@ -193,7 +193,7 @@ namespace Game.AI
|
||||
|
||||
void SetGazeOn(Unit target)
|
||||
{
|
||||
if (me.IsValidAttackTarget(target))
|
||||
if (me.IsValidAttackTarget(target) && target != me.GetVictim())
|
||||
{
|
||||
if (!me.IsFocusing(null, true))
|
||||
AttackStart(target);
|
||||
@@ -217,7 +217,7 @@ namespace Game.AI
|
||||
Unit victim = me.SelectVictim();
|
||||
if (victim != null)
|
||||
{
|
||||
if (!me.IsFocusing(null, true))
|
||||
if (!me.IsFocusing(null, true) && victim != me.GetVictim())
|
||||
AttackStart(victim);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ namespace Game.AI
|
||||
i_victimGuid = victim.GetGUID();
|
||||
|
||||
// attack
|
||||
me.SetInFront(victim); // client change orientation by self
|
||||
me.CastSpell(victim, me.ToTotem().GetSpell(), false);
|
||||
me.CastSpell(victim, me.ToTotem().GetSpell());
|
||||
}
|
||||
else
|
||||
i_victimGuid.Clear();
|
||||
|
||||
@@ -385,7 +385,6 @@ namespace Game.AI
|
||||
public virtual void QuestSelect(Player player, Quest quest) { }
|
||||
public virtual void QuestComplete(Player player, Quest quest) { }
|
||||
public virtual void QuestReward(Player player, Quest quest, uint opt) { }
|
||||
public virtual bool OnDummyEffect(Unit caster, uint spellId, int effIndex) { return false; }
|
||||
public virtual void OnGameEvent(bool start, ushort eventId) { }
|
||||
|
||||
public static AISpellInfoType[] AISpellInfo;
|
||||
|
||||
@@ -811,12 +811,6 @@ namespace Game.AI
|
||||
GetScript().ProcessEventsFor(SmartEvents.RewardQuest, player, quest.Id, opt);
|
||||
}
|
||||
|
||||
public override bool OnDummyEffect(Unit caster, uint spellId, int effIndex)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.DummyEffect, caster, spellId, (uint)effIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetCombatMove(bool on)
|
||||
{
|
||||
if (mCanCombatMove == on)
|
||||
|
||||
@@ -641,15 +641,6 @@ namespace Game.AI
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SmartEvents.DummyEffect:
|
||||
{
|
||||
if (!IsSpellValid(e, e.Event.dummy.spell))
|
||||
return false;
|
||||
|
||||
if (e.Event.dummy.effIndex > 2)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SmartEvents.IsBehindTarget:
|
||||
{
|
||||
if (!IsMinMaxValid(e, e.Event.behindTarget.cooldownMin, e.Event.behindTarget.cooldownMax))
|
||||
@@ -1579,7 +1570,7 @@ namespace Game.AI
|
||||
{
|
||||
{ SmartEvents.UpdateIc, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.TimedActionlist },
|
||||
{ SmartEvents.UpdateOoc, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject + SmartScriptTypeMaskId.Instance },
|
||||
{ SmartEvents.HealthPct, SmartScriptTypeMaskId.Creature },
|
||||
{ SmartEvents.HealthPct, SmartScriptTypeMaskId.Creature },
|
||||
{ SmartEvents.ManaPct, SmartScriptTypeMaskId.Creature },
|
||||
{ SmartEvents.Aggro, SmartScriptTypeMaskId.Creature },
|
||||
{ SmartEvents.Kill, SmartScriptTypeMaskId.Creature },
|
||||
@@ -1643,7 +1634,7 @@ namespace Game.AI
|
||||
{ SmartEvents.JustCreated, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
{ SmartEvents.GossipHello, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
{ SmartEvents.FollowCompleted, SmartScriptTypeMaskId.Creature },
|
||||
{ SmartEvents.DummyEffect, SmartScriptTypeMaskId.Spell },
|
||||
{ SmartEvents.Unused66, SmartScriptTypeMaskId.None },
|
||||
{ SmartEvents.IsBehindTarget, SmartScriptTypeMaskId.Creature },
|
||||
{ SmartEvents.GameEventStart, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
{ SmartEvents.GameEventEnd, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
|
||||
@@ -3624,13 +3624,6 @@ namespace Game.AI
|
||||
ProcessAction(e, unit, var0, var1);
|
||||
break;
|
||||
}
|
||||
case SmartEvents.DummyEffect:
|
||||
{
|
||||
if (e.Event.dummy.spell != var0 || e.Event.dummy.effIndex != var1)
|
||||
return;
|
||||
ProcessAction(e, unit, var0, var1);
|
||||
break;
|
||||
}
|
||||
case SmartEvents.GameEventStart:
|
||||
case SmartEvents.GameEventEnd:
|
||||
{
|
||||
|
||||
@@ -930,6 +930,27 @@ namespace Game.Entities
|
||||
&& !GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.NoXpAtKill);
|
||||
}
|
||||
|
||||
public override bool IsMovementPreventedByCasting()
|
||||
{
|
||||
// first check if currently a movement allowed channel is active and we're not casting
|
||||
Spell spell = GetCurrentSpell(CurrentSpellTypes.Channeled);
|
||||
if (spell != null)
|
||||
{
|
||||
if (spell.GetState() != SpellState.Finished && spell.IsChannelActive())
|
||||
if (spell.GetSpellInfo().IsMoveAllowedChannel())
|
||||
if (HasUnitState(UnitState.Casting))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsFocusing(null, true))
|
||||
return true;
|
||||
|
||||
if (HasUnitState(UnitState.Casting))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void StartPickPocketRefillTimer()
|
||||
{
|
||||
_pickpocketLootRestore = Time.UnixTime + WorldConfig.GetIntValue(WorldCfg.CreaturePickpocketRefill);
|
||||
@@ -2768,19 +2789,19 @@ namespace Game.Entities
|
||||
bool canTurnDuringCast = !focusSpell.GetSpellInfo().HasAttribute(SpellAttr5.DontTurnDuringCast);
|
||||
// Face the target - we need to do this before the unit state is modified for no-turn spells
|
||||
if (target)
|
||||
SetFacingToObject(target);
|
||||
SetFacingToObject(target, false);
|
||||
else if (!canTurnDuringCast)
|
||||
{
|
||||
Unit victim = GetVictim();
|
||||
if (victim)
|
||||
SetFacingToObject(victim); // ensure server-side orientation is correct at beginning of cast
|
||||
SetFacingToObject(victim, false); // ensure server-side orientation is correct at beginning of cast
|
||||
}
|
||||
|
||||
if (!canTurnDuringCast)
|
||||
AddUnitState(UnitState.CannotTurn);
|
||||
}
|
||||
|
||||
public override bool IsFocusing(Spell focusSpell = null, bool withDelay = false)
|
||||
public bool IsFocusing(Spell focusSpell = null, bool withDelay = false)
|
||||
{
|
||||
if (!IsAlive()) // dead creatures cannot focus
|
||||
{
|
||||
@@ -2821,10 +2842,10 @@ namespace Game.Entities
|
||||
{
|
||||
WorldObject objTarget = Global.ObjAccessor.GetWorldObject(this, m_suppressedTarget);
|
||||
if (objTarget)
|
||||
SetFacingToObject(objTarget);
|
||||
SetFacingToObject(objTarget, false);
|
||||
}
|
||||
else
|
||||
SetFacingTo(m_suppressedOrientation);
|
||||
SetFacingTo(m_suppressedOrientation, false);
|
||||
}
|
||||
else
|
||||
// tell the creature that it should reacquire its actual target after the delay expires (this is handled in ::Update)
|
||||
@@ -3156,7 +3177,7 @@ namespace Game.Entities
|
||||
|
||||
if (target != null && _IsTargetAcceptable(target) && CanCreatureAttack(target))
|
||||
{
|
||||
if (!IsFocusing())
|
||||
if (!IsFocusing(null, true))
|
||||
SetInFront(target);
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -1386,11 +1386,9 @@ namespace Game.Entities
|
||||
|
||||
void CastPetAuras(bool current)
|
||||
{
|
||||
Unit owner = GetOwner();
|
||||
if (!owner || !owner.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
Player owner = GetOwner();
|
||||
|
||||
if (!IsPermanentPetFor(owner.ToPlayer()))
|
||||
if (!IsPermanentPetFor(owner))
|
||||
return;
|
||||
|
||||
foreach (var pa in owner.m_petAuras)
|
||||
@@ -1419,10 +1417,7 @@ namespace Game.Entities
|
||||
|
||||
bool IsPetAura(Aura aura)
|
||||
{
|
||||
Unit owner = GetOwner();
|
||||
|
||||
if (!owner || !owner.IsTypeId(TypeId.Player))
|
||||
return false;
|
||||
Player owner = GetOwner();
|
||||
|
||||
// if the owner has that pet aura, return true
|
||||
foreach (var petAura in owner.m_petAuras)
|
||||
|
||||
@@ -129,6 +129,7 @@ namespace Game.Entities
|
||||
public bool m_mailsUpdated;
|
||||
|
||||
//Pets
|
||||
public List<PetAura> m_petAuras = new List<PetAura>();
|
||||
public uint m_stableSlots;
|
||||
uint m_temporaryUnsummonedPetNumber;
|
||||
uint m_lastpetnumber;
|
||||
|
||||
@@ -4995,6 +4995,24 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPetAura(PetAura petSpell)
|
||||
{
|
||||
m_petAuras.Add(petSpell);
|
||||
|
||||
Pet pet = GetPet();
|
||||
if (pet != null)
|
||||
pet.CastPetAura(petSpell);
|
||||
}
|
||||
|
||||
public void RemovePetAura(PetAura petSpell)
|
||||
{
|
||||
m_petAuras.Remove(petSpell);
|
||||
|
||||
Pet pet = GetPet();
|
||||
if (pet != null)
|
||||
pet.RemoveAurasDueToSpell(petSpell.GetAura(pet.GetEntry()));
|
||||
}
|
||||
|
||||
public bool InArena()
|
||||
{
|
||||
Battleground bg = GetBattleground();
|
||||
|
||||
@@ -184,7 +184,9 @@ namespace Game.Entities
|
||||
if (target && target == taunter)
|
||||
return;
|
||||
|
||||
SetInFront(taunter);
|
||||
if (!IsFocusing(null, true))
|
||||
SetInFront(taunter);
|
||||
|
||||
if (creature.IsAIEnabled)
|
||||
creature.GetAI().AttackStart(taunter);
|
||||
}
|
||||
@@ -219,7 +221,8 @@ namespace Game.Entities
|
||||
|
||||
if (target && target != taunter)
|
||||
{
|
||||
SetInFront(target);
|
||||
if (!IsFocusing(null, true))
|
||||
SetInFront(target);
|
||||
if (creature.IsAIEnabled)
|
||||
creature.GetAI().AttackStart(target);
|
||||
}
|
||||
@@ -597,7 +600,7 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
|
||||
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
|
||||
|
||||
// melee attack spell casted at main hand attack only - no normal melee dmg dealt
|
||||
if (attType == WeaponAttackType.BaseAttack && GetCurrentSpell(CurrentSpellTypes.Melee) != null && !extra)
|
||||
@@ -678,7 +681,7 @@ namespace Game.Entities
|
||||
return; // ignore ranged case
|
||||
|
||||
if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
|
||||
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
|
||||
|
||||
CalcDamageInfo damageInfo = new CalcDamageInfo();
|
||||
damageInfo.attacker = this;
|
||||
|
||||
@@ -92,7 +92,6 @@ namespace Game.Entities
|
||||
SpellHistory _spellHistory;
|
||||
|
||||
//Auras
|
||||
public List<PetAura> m_petAuras = new List<PetAura>();
|
||||
List<AuraEffect> AuraEffectList = new List<AuraEffect>();
|
||||
MultiMap<AuraType, AuraEffect> m_modAuras = new MultiMap<AuraType, AuraEffect>();
|
||||
List<Aura> m_removedAuras = new List<Aura>();
|
||||
|
||||
@@ -164,9 +164,10 @@ namespace Game.Entities
|
||||
Orientation = GetAngle(target.GetPosition());
|
||||
}
|
||||
|
||||
public void SetFacingTo(float ori, bool force = false)
|
||||
public void SetFacingTo(float ori, bool force = true)
|
||||
{
|
||||
if (!force && !IsStopped())
|
||||
// do not face when already moving
|
||||
if (!force && (!IsStopped() || !MoveSpline.Finalized()))
|
||||
return;
|
||||
|
||||
MoveSplineInit init = new MoveSplineInit(this);
|
||||
@@ -175,10 +176,10 @@ namespace Game.Entities
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
public void SetFacingToObject(WorldObject obj, bool force = false)
|
||||
public void SetFacingToObject(WorldObject obj, bool force = true)
|
||||
{
|
||||
// do not face when already moving
|
||||
if (!force && !IsStopped())
|
||||
if (!force && (!IsStopped() || !MoveSpline.Finalized()))
|
||||
return;
|
||||
|
||||
// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
||||
|
||||
@@ -26,28 +26,6 @@ namespace Game.Entities
|
||||
{
|
||||
public partial class Unit
|
||||
{
|
||||
public void AddPetAura(PetAura petSpell)
|
||||
{
|
||||
if (!IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
m_petAuras.Add(petSpell);
|
||||
Pet pet = ToPlayer().GetPet();
|
||||
if (pet)
|
||||
pet.CastPetAura(petSpell);
|
||||
}
|
||||
|
||||
public void RemovePetAura(PetAura petSpell)
|
||||
{
|
||||
if (!IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
m_petAuras.Remove(petSpell);
|
||||
Pet pet = ToPlayer().GetPet();
|
||||
if (pet)
|
||||
pet.RemoveAurasDueToSpell(petSpell.GetAura(pet.GetEntry()));
|
||||
}
|
||||
|
||||
public CharmInfo GetCharmInfo() { return m_charmInfo; }
|
||||
|
||||
public CharmInfo InitCharmInfo()
|
||||
|
||||
@@ -30,11 +30,6 @@ namespace Game.Entities
|
||||
{
|
||||
public virtual bool HasSpell(uint spellId) { return false; }
|
||||
|
||||
public virtual bool IsFocusing(Spell focusSpell = null, bool withDelay = false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetInstantCast(bool set) { _instantCast = set; }
|
||||
public bool CanInstantCast() { return _instantCast; }
|
||||
|
||||
@@ -1388,7 +1383,12 @@ namespace Game.Entities
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool IsMovementPreventedByCasting()
|
||||
public virtual bool IsFocusing(Spell focusSpell = null, bool withDelay = false) { return false; }
|
||||
|
||||
/// <summary>
|
||||
/// Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING
|
||||
/// </summary>
|
||||
public virtual bool IsMovementPreventedByCasting()
|
||||
{
|
||||
// can always move when not casting
|
||||
if (!HasUnitState(UnitState.Casting))
|
||||
@@ -1401,9 +1401,6 @@ namespace Game.Entities
|
||||
if (spell.GetSpellInfo().IsMoveAllowedChannel())
|
||||
return false;
|
||||
|
||||
if (IsFocusing(null, true))
|
||||
return false;
|
||||
|
||||
// prohibit movement for all other spell casts
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -322,14 +322,16 @@ namespace Game
|
||||
Unit unit_target2 = spell.m_targets.GetUnitTarget();
|
||||
if (unit_target)
|
||||
{
|
||||
pet.SetInFront(unit_target);
|
||||
if (!pet.IsFocusing())
|
||||
pet.SetInFront(unit_target);
|
||||
Player player = unit_target.ToPlayer();
|
||||
if (player)
|
||||
pet.SendUpdateToPlayer(player);
|
||||
}
|
||||
else if (unit_target2)
|
||||
{
|
||||
pet.SetInFront(unit_target2);
|
||||
if (!pet.IsFocusing())
|
||||
pet.SetInFront(unit_target2);
|
||||
Player player = unit_target2.ToPlayer();
|
||||
if (player)
|
||||
pet.SendUpdateToPlayer(player);
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
using Framework.Constants;
|
||||
/*
|
||||
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Game.Entities;
|
||||
using Game.Loots;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Game.Loots;
|
||||
using Framework.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Game.Loots
|
||||
{
|
||||
|
||||
@@ -268,9 +268,6 @@ namespace Game.Scripting
|
||||
|
||||
public override bool IsDatabaseBound() { return true; }
|
||||
|
||||
// Called when a dummy spell effect is triggered on the item.
|
||||
public virtual bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, Item target) { return false; }
|
||||
|
||||
// Called when a player accepts a quest from the item.
|
||||
public virtual bool OnQuestAccept(Player player, Item item, Quest quest) { return false; }
|
||||
|
||||
@@ -336,9 +333,6 @@ namespace Game.Scripting
|
||||
|
||||
public override bool IsDatabaseBound() { return true; }
|
||||
|
||||
// Called when a dummy spell effect is triggered on the creature.
|
||||
public virtual bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, Creature target) { return false; }
|
||||
|
||||
// Called when a player opens a gossip dialog with the creature.
|
||||
public virtual bool OnGossipHello(Player player, Creature creature) { return false; }
|
||||
|
||||
@@ -381,9 +375,6 @@ namespace Game.Scripting
|
||||
|
||||
public override bool IsDatabaseBound() { return true; }
|
||||
|
||||
// Called when a dummy spell effect is triggered on the gameobject.
|
||||
public virtual bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, GameObject target) { return false; }
|
||||
|
||||
// Called when a player opens a gossip dialog with the gameobject.
|
||||
public virtual bool OnGossipHello(Player player, GameObject go) { return false; }
|
||||
|
||||
|
||||
@@ -709,13 +709,6 @@ namespace Game.Scripting
|
||||
}
|
||||
|
||||
//ItemScript
|
||||
public bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, Item target)
|
||||
{
|
||||
Cypher.Assert(caster != null);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
return RunScriptRet<ItemScript>(p => p.OnDummyEffect(caster, spellId, effIndex, target), target.GetScriptId());
|
||||
}
|
||||
public bool OnQuestAccept(Player player, Item item, Quest quest)
|
||||
{
|
||||
Cypher.Assert(player != null);
|
||||
@@ -756,13 +749,6 @@ namespace Game.Scripting
|
||||
}
|
||||
|
||||
//CreatureScript
|
||||
public bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, Creature target)
|
||||
{
|
||||
Cypher.Assert(caster);
|
||||
Cypher.Assert(target);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnDummyEffect(caster, spellId, effIndex, target), target.GetScriptId());
|
||||
}
|
||||
public bool OnGossipHello(Player player, Creature creature)
|
||||
{
|
||||
Cypher.Assert(player);
|
||||
@@ -848,13 +834,6 @@ namespace Game.Scripting
|
||||
}
|
||||
|
||||
//GameObjectScript
|
||||
public bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, GameObject target)
|
||||
{
|
||||
Cypher.Assert(caster != null);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
return RunScriptRet<GameObjectScript>(p => p.OnDummyEffect(caster, spellId, effIndex, target), target.GetScriptId());
|
||||
}
|
||||
public bool OnGossipHello(Player player, GameObject go)
|
||||
{
|
||||
Cypher.Assert(player != null);
|
||||
|
||||
@@ -3812,7 +3812,7 @@ namespace Game.Spells
|
||||
[AuraEffectHandler(AuraType.ModMeleeRangedHaste2)]
|
||||
void HandleModMeleeRangedSpeedPct(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||
{
|
||||
if (!mode.HasAnyFlag((AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat)))
|
||||
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat))
|
||||
return;
|
||||
|
||||
//! ToDo: Haste auras with the same handler _CAN'T_ stack together
|
||||
@@ -4223,16 +4223,16 @@ namespace Game.Spells
|
||||
|
||||
Unit caster = GetCaster();
|
||||
|
||||
if (mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||
// pet auras
|
||||
if (target.GetTypeId() == TypeId.Player && mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||
{
|
||||
// pet auras
|
||||
PetAura petSpell = Global.SpellMgr.GetPetAura(GetId(), m_effIndex);
|
||||
if (petSpell != null)
|
||||
{
|
||||
if (apply)
|
||||
target.AddPetAura(petSpell);
|
||||
target.ToPlayer().AddPetAura(petSpell);
|
||||
else
|
||||
target.RemovePetAura(petSpell);
|
||||
target.ToPlayer().RemovePetAura(petSpell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5332,12 +5332,7 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Creature c = target.ToCreature();
|
||||
if (c == null || caster == null || !Global.ScriptMgr.OnDummyEffect(caster, GetId(), GetEffIndex(), target.ToCreature()) ||
|
||||
!c.GetAI().OnDummyEffect(caster, GetId(), GetEffIndex()))
|
||||
Log.outDebug(LogFilter.Spells, "AuraEffect.HandlePeriodicTriggerSpellAuraTick: Spell {0} has non-existent spell {1} in EffectTriggered[{2}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
|
||||
}
|
||||
Log.outDebug(LogFilter.Spells, "AuraEffect.HandlePeriodicTriggerSpellAuraTick: Spell {0} has non-existent spell {1} in EffectTriggered[{2}] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
|
||||
}
|
||||
|
||||
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit target, Unit caster)
|
||||
|
||||
+12
-11
@@ -2436,17 +2436,6 @@ namespace Game.Spells
|
||||
else
|
||||
m_casttime = m_spellInfo.CalcCastTime(m_caster.GetLevel(), this);
|
||||
|
||||
if (m_caster.IsTypeId(TypeId.Unit) && !m_caster.HasUnitFlag(UnitFlags.PlayerControlled)) // _UNIT actually means creature. for some reason.
|
||||
{
|
||||
if (!(m_spellInfo.IsNextMeleeSwingSpell() || IsAutoRepeat() || _triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreSetFacing)))
|
||||
{
|
||||
if (m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
|
||||
m_caster.ToCreature().FocusTarget(this, m_targets.GetObjectTarget());
|
||||
else if (m_spellInfo.HasAttribute(SpellAttr5.DontTurnDuringCast))
|
||||
m_caster.ToCreature().FocusTarget(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
// don't allow channeled spells / spells with cast time to be casted while moving
|
||||
// exception are only channeled spells that have no casttime and SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING
|
||||
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
|
||||
@@ -2463,6 +2452,18 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
|
||||
// focus if not controlled creature
|
||||
if (m_caster.GetTypeId() == TypeId.Unit && !m_caster.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
{
|
||||
if (!(m_spellInfo.IsNextMeleeSwingSpell() || IsAutoRepeat() || _triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreSetFacing)))
|
||||
{
|
||||
if (m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
|
||||
m_caster.ToCreature().FocusTarget(this, m_targets.GetObjectTarget());
|
||||
else if (m_spellInfo.HasAttribute(SpellAttr5.DontTurnDuringCast))
|
||||
m_caster.ToCreature().FocusTarget(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
// set timer base at cast time
|
||||
ReSetTimer();
|
||||
|
||||
|
||||
@@ -306,25 +306,19 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
// pet auras
|
||||
PetAura petSpell = Global.SpellMgr.GetPetAura(m_spellInfo.Id, (byte)effIndex);
|
||||
if (petSpell != null)
|
||||
if (m_caster.GetTypeId() == TypeId.Player)
|
||||
{
|
||||
m_caster.AddPetAura(petSpell);
|
||||
return;
|
||||
PetAura petSpell = Global.SpellMgr.GetPetAura(m_spellInfo.Id, (byte)effIndex);
|
||||
if (petSpell != null)
|
||||
{
|
||||
m_caster.ToPlayer().AddPetAura(petSpell);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// normal DB scripted effect
|
||||
Log.outDebug(LogFilter.Spells, "Spell ScriptStart spellid {0} in EffectDummy({1})", m_spellInfo.Id, effIndex);
|
||||
m_caster.GetMap().ScriptsStart(ScriptsType.Spell, (uint)((int)m_spellInfo.Id | (int)(effIndex << 24)), m_caster, unitTarget);
|
||||
|
||||
// Script based implementation. Must be used only for not good for implementation in core spell effects
|
||||
// So called only for not proccessed cases
|
||||
if (gameObjTarget)
|
||||
Global.ScriptMgr.OnDummyEffect(m_caster, m_spellInfo.Id, effIndex, gameObjTarget);
|
||||
else if (unitTarget && unitTarget.IsTypeId(TypeId.Unit))
|
||||
Global.ScriptMgr.OnDummyEffect(m_caster, m_spellInfo.Id, effIndex, unitTarget.ToCreature());
|
||||
else if (itemTarget)
|
||||
Global.ScriptMgr.OnDummyEffect(m_caster, m_spellInfo.Id, effIndex, itemTarget);
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.TriggerSpell)]
|
||||
@@ -1957,11 +1951,11 @@ namespace Game.Spells
|
||||
if (unitTarget.HasUnitState(UnitState.Confused | UnitState.Stunned | UnitState.Fleeing))
|
||||
return;
|
||||
|
||||
unitTarget.SetFacingTo(unitTarget.GetAngle(destTarget));
|
||||
unitTarget.ClearUnitState(UnitState.Moving);
|
||||
|
||||
if (unitTarget.IsTypeId(TypeId.Unit))
|
||||
unitTarget.GetMotionMaster().MoveDistract((uint)(damage * Time.InMilliseconds));
|
||||
|
||||
unitTarget.StopMoving();
|
||||
unitTarget.SetFacingTo(unitTarget.GetAngle(destTarget));
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.Pickpocket)]
|
||||
|
||||
@@ -2304,11 +2304,14 @@ namespace Game.Spells
|
||||
{
|
||||
switch (Id)
|
||||
{
|
||||
case 42292: // PvP trinket
|
||||
case 59752: // Every Man for Himself
|
||||
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
|
||||
immuneInfo.AuraTypeImmune.Add(AuraType.UseNormalMovementSpeed);
|
||||
break;
|
||||
case 34471: // The Beast Within
|
||||
case 19574: // Bestial Wrath
|
||||
case 42292: // PvP trinket
|
||||
case 46227: // Medallion of Immunity
|
||||
case 59752: // Every Man for Himself
|
||||
case 53490: // Bullheaded
|
||||
case 65547: // PvP Trinket
|
||||
case 134946: // Supremacy of the Alliance
|
||||
|
||||
@@ -2976,6 +2976,10 @@ namespace Game.Entities
|
||||
break;
|
||||
case 69846: // Frost Bomb
|
||||
spellInfo.Speed = 0.0f; // This spell's summon happens instantly
|
||||
break;
|
||||
case 70106: // Chilled to the Bone
|
||||
spellInfo.AttributesEx3 |= SpellAttr3.NoDoneBonus;
|
||||
spellInfo.AttributesEx6 |= SpellAttr6.NoDonePctDamageMods;
|
||||
break;
|
||||
case 71614: // Ice Lock
|
||||
spellInfo.Mechanic = Mechanics.Stun;
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls.DevourerOfSouls
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(3), tickTask =>
|
||||
{
|
||||
beamAngle += beamAngleDiff;
|
||||
me.SetFacingTo(beamAngle, true);
|
||||
me.SetFacingTo(beamAngle);
|
||||
me.StopMoving();
|
||||
|
||||
DoCast(me, SpellIds.WailingSouls);
|
||||
|
||||
@@ -703,7 +703,7 @@ namespace Scripts.World.NpcSpecial
|
||||
{
|
||||
if (me.IsWithinLOS(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ()) && me.IsWithinDistInMap(player, 30.0f))
|
||||
{
|
||||
me.SetInFront(player);
|
||||
me.SetFacingToObject(player);
|
||||
Active = false;
|
||||
|
||||
switch (emote)
|
||||
|
||||
Reference in New Issue
Block a user