Misc fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\default.props" />
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="4.0.0-rc2" />
|
||||
<PackageReference Include="MySqlConnector" Version="1.3.9" />
|
||||
<PackageReference Include="MySqlConnector" Version="2.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -520,11 +520,11 @@ namespace Game.AI
|
||||
// default predicate function to select target based on distance, player and/or aura criteria
|
||||
public class DefaultTargetSelector : ICheck<Unit>
|
||||
{
|
||||
Unit me;
|
||||
float m_dist;
|
||||
bool m_playerOnly;
|
||||
Unit except;
|
||||
int m_aura;
|
||||
Unit _me;
|
||||
float _dist;
|
||||
bool _playerOnly;
|
||||
Unit _exception;
|
||||
int _aura;
|
||||
|
||||
/// <param name="unit">the reference unit</param>
|
||||
/// <param name="dist">if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit</param>
|
||||
@@ -533,43 +533,43 @@ namespace Game.AI
|
||||
/// <param name="aura">if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura</param>
|
||||
public DefaultTargetSelector(Unit unit, float dist, bool playerOnly, bool withTank, int aura)
|
||||
{
|
||||
me = unit;
|
||||
m_dist = dist;
|
||||
m_playerOnly = playerOnly;
|
||||
except = !withTank ? me.GetThreatManager().GetCurrentVictim() : null;
|
||||
m_aura = aura;
|
||||
_me = unit;
|
||||
_dist = dist;
|
||||
_playerOnly = playerOnly;
|
||||
_exception = !withTank ? _me.GetThreatManager().GetCurrentVictim() : null;
|
||||
_aura = aura;
|
||||
}
|
||||
|
||||
public bool Invoke(Unit target)
|
||||
{
|
||||
if (me == null)
|
||||
if (_me == null)
|
||||
return false;
|
||||
|
||||
if (target == null)
|
||||
return false;
|
||||
|
||||
if (except != null && target == except)
|
||||
if (_exception != null && target == _exception)
|
||||
return false;
|
||||
|
||||
if (m_playerOnly && !target.IsTypeId(TypeId.Player))
|
||||
if (_playerOnly && !target.IsTypeId(TypeId.Player))
|
||||
return false;
|
||||
|
||||
if (m_dist > 0.0f && !me.IsWithinCombatRange(target, m_dist))
|
||||
if (_dist > 0.0f && !_me.IsWithinCombatRange(target, _dist))
|
||||
return false;
|
||||
|
||||
if (m_dist < 0.0f && me.IsWithinCombatRange(target, -m_dist))
|
||||
if (_dist < 0.0f && _me.IsWithinCombatRange(target, -_dist))
|
||||
return false;
|
||||
|
||||
if (m_aura != 0)
|
||||
if (_aura != 0)
|
||||
{
|
||||
if (m_aura > 0)
|
||||
if (_aura > 0)
|
||||
{
|
||||
if (!target.HasAura((uint)m_aura))
|
||||
if (!target.HasAura((uint)_aura))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target.HasAura((uint)-m_aura))
|
||||
if (target.HasAura((uint)-_aura))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,20 +57,20 @@ namespace Game.Movement
|
||||
}
|
||||
}
|
||||
|
||||
class MotionMasterDelayedAction
|
||||
class DelayedAction
|
||||
{
|
||||
Action Action;
|
||||
Func<bool> Validator;
|
||||
public Action Action;
|
||||
public MotionMasterDelayedActionType Type;
|
||||
MotionMasterDelayedActionType Type;
|
||||
|
||||
public MotionMasterDelayedAction(Action action, Func<bool> validator, MotionMasterDelayedActionType type)
|
||||
public DelayedAction(Action action, Func<bool> validator, MotionMasterDelayedActionType type)
|
||||
{
|
||||
Action = action;
|
||||
Validator = validator;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public MotionMasterDelayedAction(Action action, MotionMasterDelayedActionType type)
|
||||
public DelayedAction(Action action, MotionMasterDelayedActionType type)
|
||||
{
|
||||
Action = action;
|
||||
Validator = () => true;
|
||||
@@ -96,7 +96,7 @@ namespace Game.Movement
|
||||
SortedSet<MovementGenerator> _generators { get; } = new(new MovementGeneratorComparator());
|
||||
|
||||
MultiMap<uint, MovementGenerator> _baseUnitStatesMap { get; } = new();
|
||||
Queue<MotionMasterDelayedAction> _delayedActions { get; } = new();
|
||||
Queue<DelayedAction> _delayedActions { get; } = new();
|
||||
MotionMasterFlags _flags { get; set; }
|
||||
|
||||
public MotionMaster(Unit unit)
|
||||
@@ -108,7 +108,7 @@ namespace Game.Movement
|
||||
{
|
||||
if (HasFlag(MotionMasterFlags.Update))
|
||||
{
|
||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Initialize(), MotionMasterDelayedActionType.Initialize));
|
||||
_delayedActions.Enqueue(new DelayedAction(() => Initialize(), MotionMasterDelayedActionType.Initialize));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace Game.Movement
|
||||
return;
|
||||
|
||||
if (HasFlag(MotionMasterFlags.Update))
|
||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Add(movement, slot), MotionMasterDelayedActionType.Add));
|
||||
_delayedActions.Enqueue(new DelayedAction(() => Add(movement, slot), MotionMasterDelayedActionType.Add));
|
||||
else
|
||||
DirectAdd(movement, slot);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ namespace Game.Movement
|
||||
|
||||
if (HasFlag(MotionMasterFlags.Update))
|
||||
{
|
||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Remove(movement, slot), MotionMasterDelayedActionType.Remove));
|
||||
_delayedActions.Enqueue(new DelayedAction(() => Remove(movement, slot), MotionMasterDelayedActionType.Remove));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ namespace Game.Movement
|
||||
|
||||
if (HasFlag(MotionMasterFlags.Update))
|
||||
{
|
||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Remove(type, slot), MotionMasterDelayedActionType.RemoveType));
|
||||
_delayedActions.Enqueue(new DelayedAction(() => Remove(type, slot), MotionMasterDelayedActionType.RemoveType));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace Game.Movement
|
||||
{
|
||||
if (HasFlag(MotionMasterFlags.Update))
|
||||
{
|
||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Clear(), MotionMasterDelayedActionType.Clear));
|
||||
_delayedActions.Enqueue(new DelayedAction(() => Clear(), MotionMasterDelayedActionType.Clear));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ namespace Game.Movement
|
||||
|
||||
if (HasFlag(MotionMasterFlags.Update))
|
||||
{
|
||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Clear(slot), MotionMasterDelayedActionType.ClearSlot));
|
||||
_delayedActions.Enqueue(new DelayedAction(() => Clear(slot), MotionMasterDelayedActionType.ClearSlot));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ namespace Game.Movement
|
||||
{
|
||||
if (HasFlag(MotionMasterFlags.Update))
|
||||
{
|
||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Clear(mode), MotionMasterDelayedActionType.ClearMode));
|
||||
_delayedActions.Enqueue(new DelayedAction(() => Clear(mode), MotionMasterDelayedActionType.ClearMode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ namespace Game.Movement
|
||||
|
||||
if (HasFlag(MotionMasterFlags.Update))
|
||||
{
|
||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Clear(priority), MotionMasterDelayedActionType.ClearPriority));
|
||||
_delayedActions.Enqueue(new DelayedAction(() => Clear(priority), MotionMasterDelayedActionType.ClearPriority));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3597,6 +3597,62 @@ namespace Game.Entities
|
||||
});
|
||||
});
|
||||
|
||||
// Tag Greater Felfire Diemetradon
|
||||
ApplySpellFix(new[] {
|
||||
37851, // Tag Greater Felfire Diemetradon
|
||||
37918 // Arcano-pince
|
||||
}, spellInfo =>
|
||||
{
|
||||
spellInfo.RecoveryTime = 3000;
|
||||
});
|
||||
|
||||
// Jormungar Strike
|
||||
ApplySpellFix(new[] { 56513 }, spellInfo =>
|
||||
{
|
||||
spellInfo.RecoveryTime = 2000;
|
||||
});
|
||||
|
||||
ApplySpellFix(new[] {
|
||||
54997, // Cast Net (tooltip says 10s but sniffs say 6s)
|
||||
56524 // Acid Breath
|
||||
}, spellInfo =>
|
||||
{
|
||||
spellInfo.RecoveryTime = 6000;
|
||||
});
|
||||
|
||||
ApplySpellFix(new[] {
|
||||
47911, // EMP
|
||||
48620, // Wing Buffet
|
||||
51752 // Stampy's Stompy-Stomp
|
||||
}, spellInfo =>
|
||||
{
|
||||
spellInfo.RecoveryTime = 10000;
|
||||
});
|
||||
|
||||
ApplySpellFix(new[] {
|
||||
37727, // Touch of Darkness
|
||||
54996 // Ice Slick (tooltip says 20s but sniffs say 12s)
|
||||
}, spellInfo =>
|
||||
{
|
||||
spellInfo.RecoveryTime = 12000;
|
||||
});
|
||||
|
||||
// Signal Helmet to Attack
|
||||
ApplySpellFix(new[] { 51748 }, spellInfo =>
|
||||
{
|
||||
spellInfo.RecoveryTime = 15000;
|
||||
});
|
||||
|
||||
// Charge
|
||||
ApplySpellFix(new[] {
|
||||
51756, // Charge
|
||||
37919, //Arcano-dismantle
|
||||
37917 //Arcano-Cloak
|
||||
}, spellInfo =>
|
||||
{
|
||||
spellInfo.RecoveryTime = 20000;
|
||||
});
|
||||
|
||||
//
|
||||
// VIOLET HOLD SPELLS
|
||||
//
|
||||
|
||||
@@ -27,6 +27,10 @@ namespace Game
|
||||
sum += diff * diff;
|
||||
weightsum += diff;
|
||||
}
|
||||
|
||||
if (weightsum == 0)
|
||||
return 0;
|
||||
|
||||
return sum / weightsum;
|
||||
}
|
||||
|
||||
|
||||
@@ -3821,6 +3821,29 @@ namespace Scripts.Spells.Generic
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleDamage, 1, SpellEffectName.SchoolDamage));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Used for some spells cast by vehicles or charmed creatures that do not send a cooldown event on their own
|
||||
class spell_gen_charmed_unit_spell_cooldown : SpellScript
|
||||
{
|
||||
void HandleCast()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Player owner = caster.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (owner != null)
|
||||
{
|
||||
SpellCooldownPkt spellCooldown = new();
|
||||
spellCooldown.Caster = owner.GetGUID();
|
||||
spellCooldown.Flags = SpellCooldownFlags.None;
|
||||
spellCooldown.SpellCooldowns.Add(new SpellCooldownStruct(GetSpellInfo().Id, GetSpellInfo().RecoveryTime));
|
||||
owner.SendPacket(spellCooldown);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCast.Add(new CastHandler(HandleCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 169869 - Transformation Sickness
|
||||
class spell_gen_decimatus_transformation_sickness : SpellScript
|
||||
|
||||
Reference in New Issue
Block a user