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" />
|
<Import Project="..\..\default.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Google.Protobuf" Version="4.0.0-rc2" />
|
<PackageReference Include="Google.Protobuf" Version="4.0.0-rc2" />
|
||||||
<PackageReference Include="MySqlConnector" Version="1.3.9" />
|
<PackageReference Include="MySqlConnector" Version="2.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -520,11 +520,11 @@ namespace Game.AI
|
|||||||
// default predicate function to select target based on distance, player and/or aura criteria
|
// default predicate function to select target based on distance, player and/or aura criteria
|
||||||
public class DefaultTargetSelector : ICheck<Unit>
|
public class DefaultTargetSelector : ICheck<Unit>
|
||||||
{
|
{
|
||||||
Unit me;
|
Unit _me;
|
||||||
float m_dist;
|
float _dist;
|
||||||
bool m_playerOnly;
|
bool _playerOnly;
|
||||||
Unit except;
|
Unit _exception;
|
||||||
int m_aura;
|
int _aura;
|
||||||
|
|
||||||
/// <param name="unit">the reference unit</param>
|
/// <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>
|
/// <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>
|
/// <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)
|
public DefaultTargetSelector(Unit unit, float dist, bool playerOnly, bool withTank, int aura)
|
||||||
{
|
{
|
||||||
me = unit;
|
_me = unit;
|
||||||
m_dist = dist;
|
_dist = dist;
|
||||||
m_playerOnly = playerOnly;
|
_playerOnly = playerOnly;
|
||||||
except = !withTank ? me.GetThreatManager().GetCurrentVictim() : null;
|
_exception = !withTank ? _me.GetThreatManager().GetCurrentVictim() : null;
|
||||||
m_aura = aura;
|
_aura = aura;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Invoke(Unit target)
|
public bool Invoke(Unit target)
|
||||||
{
|
{
|
||||||
if (me == null)
|
if (_me == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (except != null && target == except)
|
if (_exception != null && target == _exception)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_playerOnly && !target.IsTypeId(TypeId.Player))
|
if (_playerOnly && !target.IsTypeId(TypeId.Player))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_dist > 0.0f && !me.IsWithinCombatRange(target, m_dist))
|
if (_dist > 0.0f && !_me.IsWithinCombatRange(target, _dist))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_dist < 0.0f && me.IsWithinCombatRange(target, -m_dist))
|
if (_dist < 0.0f && _me.IsWithinCombatRange(target, -_dist))
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (target.HasAura((uint)-m_aura))
|
if (target.HasAura((uint)-_aura))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,20 +57,20 @@ namespace Game.Movement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MotionMasterDelayedAction
|
class DelayedAction
|
||||||
{
|
{
|
||||||
|
Action Action;
|
||||||
Func<bool> Validator;
|
Func<bool> Validator;
|
||||||
public Action Action;
|
MotionMasterDelayedActionType Type;
|
||||||
public MotionMasterDelayedActionType Type;
|
|
||||||
|
|
||||||
public MotionMasterDelayedAction(Action action, Func<bool> validator, MotionMasterDelayedActionType type)
|
public DelayedAction(Action action, Func<bool> validator, MotionMasterDelayedActionType type)
|
||||||
{
|
{
|
||||||
Action = action;
|
Action = action;
|
||||||
Validator = validator;
|
Validator = validator;
|
||||||
Type = type;
|
Type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MotionMasterDelayedAction(Action action, MotionMasterDelayedActionType type)
|
public DelayedAction(Action action, MotionMasterDelayedActionType type)
|
||||||
{
|
{
|
||||||
Action = action;
|
Action = action;
|
||||||
Validator = () => true;
|
Validator = () => true;
|
||||||
@@ -96,7 +96,7 @@ namespace Game.Movement
|
|||||||
SortedSet<MovementGenerator> _generators { get; } = new(new MovementGeneratorComparator());
|
SortedSet<MovementGenerator> _generators { get; } = new(new MovementGeneratorComparator());
|
||||||
|
|
||||||
MultiMap<uint, MovementGenerator> _baseUnitStatesMap { get; } = new();
|
MultiMap<uint, MovementGenerator> _baseUnitStatesMap { get; } = new();
|
||||||
Queue<MotionMasterDelayedAction> _delayedActions { get; } = new();
|
Queue<DelayedAction> _delayedActions { get; } = new();
|
||||||
MotionMasterFlags _flags { get; set; }
|
MotionMasterFlags _flags { get; set; }
|
||||||
|
|
||||||
public MotionMaster(Unit unit)
|
public MotionMaster(Unit unit)
|
||||||
@@ -108,7 +108,7 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
if (HasFlag(MotionMasterFlags.Update))
|
if (HasFlag(MotionMasterFlags.Update))
|
||||||
{
|
{
|
||||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Initialize(), MotionMasterDelayedActionType.Initialize));
|
_delayedActions.Enqueue(new DelayedAction(() => Initialize(), MotionMasterDelayedActionType.Initialize));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ namespace Game.Movement
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (HasFlag(MotionMasterFlags.Update))
|
if (HasFlag(MotionMasterFlags.Update))
|
||||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Add(movement, slot), MotionMasterDelayedActionType.Add));
|
_delayedActions.Enqueue(new DelayedAction(() => Add(movement, slot), MotionMasterDelayedActionType.Add));
|
||||||
else
|
else
|
||||||
DirectAdd(movement, slot);
|
DirectAdd(movement, slot);
|
||||||
}
|
}
|
||||||
@@ -343,7 +343,7 @@ namespace Game.Movement
|
|||||||
|
|
||||||
if (HasFlag(MotionMasterFlags.Update))
|
if (HasFlag(MotionMasterFlags.Update))
|
||||||
{
|
{
|
||||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Remove(movement, slot), MotionMasterDelayedActionType.Remove));
|
_delayedActions.Enqueue(new DelayedAction(() => Remove(movement, slot), MotionMasterDelayedActionType.Remove));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ namespace Game.Movement
|
|||||||
|
|
||||||
if (HasFlag(MotionMasterFlags.Update))
|
if (HasFlag(MotionMasterFlags.Update))
|
||||||
{
|
{
|
||||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Remove(type, slot), MotionMasterDelayedActionType.RemoveType));
|
_delayedActions.Enqueue(new DelayedAction(() => Remove(type, slot), MotionMasterDelayedActionType.RemoveType));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
if (HasFlag(MotionMasterFlags.Update))
|
if (HasFlag(MotionMasterFlags.Update))
|
||||||
{
|
{
|
||||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Clear(), MotionMasterDelayedActionType.Clear));
|
_delayedActions.Enqueue(new DelayedAction(() => Clear(), MotionMasterDelayedActionType.Clear));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ namespace Game.Movement
|
|||||||
|
|
||||||
if (HasFlag(MotionMasterFlags.Update))
|
if (HasFlag(MotionMasterFlags.Update))
|
||||||
{
|
{
|
||||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Clear(slot), MotionMasterDelayedActionType.ClearSlot));
|
_delayedActions.Enqueue(new DelayedAction(() => Clear(slot), MotionMasterDelayedActionType.ClearSlot));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,7 +444,7 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
if (HasFlag(MotionMasterFlags.Update))
|
if (HasFlag(MotionMasterFlags.Update))
|
||||||
{
|
{
|
||||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Clear(mode), MotionMasterDelayedActionType.ClearMode));
|
_delayedActions.Enqueue(new DelayedAction(() => Clear(mode), MotionMasterDelayedActionType.ClearMode));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ namespace Game.Movement
|
|||||||
|
|
||||||
if (HasFlag(MotionMasterFlags.Update))
|
if (HasFlag(MotionMasterFlags.Update))
|
||||||
{
|
{
|
||||||
_delayedActions.Enqueue(new MotionMasterDelayedAction(() => Clear(priority), MotionMasterDelayedActionType.ClearPriority));
|
_delayedActions.Enqueue(new DelayedAction(() => Clear(priority), MotionMasterDelayedActionType.ClearPriority));
|
||||||
return;
|
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
|
// VIOLET HOLD SPELLS
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ namespace Game
|
|||||||
sum += diff * diff;
|
sum += diff * diff;
|
||||||
weightsum += diff;
|
weightsum += diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (weightsum == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return sum / weightsum;
|
return sum / weightsum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3822,6 +3822,29 @@ namespace Scripts.Spells.Generic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[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
|
[Script] // 169869 - Transformation Sickness
|
||||||
class spell_gen_decimatus_transformation_sickness : SpellScript
|
class spell_gen_decimatus_transformation_sickness : SpellScript
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user