Misc fixes

This commit is contained in:
Hondacrx
2025-09-01 22:41:28 -04:00
parent 7faf096ba9
commit 100a9d74e7
3 changed files with 25 additions and 26 deletions
+6 -6
View File
@@ -362,17 +362,17 @@ namespace Game.Combat
public void TauntUpdate() public void TauntUpdate()
{ {
var tauntEffects = _owner.GetAuraEffectsByType(AuraType.ModTaunt); var tauntEffects = _owner.GetAuraEffectsByType(AuraType.ModTaunt);
TauntState state = TauntState.Taunt; uint tauntPriority = 0; // lowest is highest
Dictionary<ObjectGuid, TauntState> tauntStates = new(); Dictionary<ObjectGuid, uint> tauntStates = new();
// Only the last taunt effect applied by something still on our threat list is considered // Only the last taunt effect applied by something still on our threat list is considered
foreach (var auraEffect in tauntEffects) foreach (AuraEffect tauntEffect in tauntEffects)
tauntStates[auraEffect.GetCasterGUID()] = state++; tauntStates[tauntEffect.GetCasterGUID()] = ++tauntPriority;
foreach (var pair in _myThreatListEntries) foreach (var pair in _myThreatListEntries)
{ {
if (tauntStates.TryGetValue(pair.Key, out TauntState tauntState)) if (tauntStates.TryGetValue(pair.Key, out uint tauntState))
pair.Value.UpdateTauntState(tauntState); pair.Value.UpdateTauntState((TauntState)((uint)TauntState.Taunt + tauntStates.Count - tauntState));
else else
pair.Value.UpdateTauntState(); pair.Value.UpdateTauntState();
} }
+11 -10
View File
@@ -1838,38 +1838,37 @@ namespace Game.Spells
Unit target = aurApp.GetTarget(); Unit target = aurApp.GetTarget();
//Prevent handling aura twice
AuraType type = GetAuraType(); AuraType type = GetAuraType();
if (apply ? target.GetAuraEffectsByType(type).Count > 1 : target.HasAuraType(type)) if (apply ? target.GetAuraEffectsByType(type).Count > 1 : target.HasAuraType(type))
return; return;
Action<Unit> flagChangeFunc = null; Func<Unit, bool> flagChangeFunc = null;
byte slot; byte slot;
WeaponAttackType attType; WeaponAttackType attType;
switch (type) switch (type)
{ {
case AuraType.ModDisarm: case AuraType.ModDisarm:
if (apply) if (apply)
flagChangeFunc = unit => { unit.SetUnitFlag(UnitFlags.Disarmed); }; flagChangeFunc = unit => { if (unit.HasUnitFlag(UnitFlags.Disarmed)) { return false; } unit.SetUnitFlag(UnitFlags.Disarmed); return true; };
else else
flagChangeFunc = unit => { unit.RemoveUnitFlag(UnitFlags.Disarmed); }; flagChangeFunc = unit => { if (unit.HasAuraType(AuraType.ModDisarm)) { return false; } unit.RemoveUnitFlag(UnitFlags.Disarmed); return true; };
slot = EquipmentSlot.MainHand; slot = EquipmentSlot.MainHand;
attType = WeaponAttackType.BaseAttack; attType = WeaponAttackType.BaseAttack;
break; break;
case AuraType.ModDisarmOffhand: case AuraType.ModDisarmOffhand:
if (apply) if (apply)
flagChangeFunc = unit => { unit.SetUnitFlag2(UnitFlags2.DisarmOffhand); }; flagChangeFunc = unit => { if (unit.HasUnitFlag2(UnitFlags2.DisarmOffhand)) { return false; } unit.SetUnitFlag2(UnitFlags2.DisarmOffhand); return true; };
else else
flagChangeFunc = unit => { unit.RemoveUnitFlag2(UnitFlags2.DisarmOffhand); }; flagChangeFunc = unit => { if (unit.HasAuraType(AuraType.ModDisarmOffhand)) { return false; } unit.RemoveUnitFlag2(UnitFlags2.DisarmOffhand); return true; };
slot = EquipmentSlot.OffHand; slot = EquipmentSlot.OffHand;
attType = WeaponAttackType.OffAttack; attType = WeaponAttackType.OffAttack;
break; break;
case AuraType.ModDisarmRanged: case AuraType.ModDisarmRanged:
if (apply) if (apply)
flagChangeFunc = unit => { unit.SetUnitFlag2(UnitFlags2.DisarmRanged); }; flagChangeFunc = unit => { if (unit.HasUnitFlag2(UnitFlags2.DisarmRanged)) { return false; } unit.SetUnitFlag2(UnitFlags2.DisarmRanged); return true; };
else else
flagChangeFunc = unit => { unit.RemoveUnitFlag2(UnitFlags2.DisarmRanged); }; flagChangeFunc = unit => { if (unit.HasAuraType(AuraType.ModDisarmRanged)) { return false; } unit.RemoveUnitFlag2(UnitFlags2.DisarmRanged); return true; };
slot = EquipmentSlot.MainHand; slot = EquipmentSlot.MainHand;
attType = WeaponAttackType.RangedAttack; attType = WeaponAttackType.RangedAttack;
break; break;
@@ -1878,10 +1877,12 @@ namespace Game.Spells
} }
// set/remove flag before weapon bonuses so it's properly reflected in CanUseAttackType // set/remove flag before weapon bonuses so it's properly reflected in CanUseAttackType
flagChangeFunc?.Invoke(target); if (flagChangeFunc != null)
if (!flagChangeFunc(target)) //Prevent handling aura twice
return;
// Handle damage modification, shapeshifted druids are not affected // Handle damage modification, shapeshifted druids are not affected
if (target.IsTypeId(TypeId.Player) && !target.IsInFeralForm()) if (target.IsPlayer() && !target.IsInFeralForm())
{ {
Player player = target.ToPlayer(); Player player = target.ToPlayer();
+8 -10
View File
@@ -748,19 +748,17 @@ namespace Game
bool isNodeFullyFilled(Node node) bool isNodeFullyFilled(Node node)
{ {
if (node.Data.GetNodeType() == TraitNodeType.Selection) bool nodeEntryMatches(NodeEntry nodeEntry)
return node.Entries.Any(nodeEntry =>
{
TraitEntryPacket traitEntry = getNodeEntry(node.Data.Id, nodeEntry.Data.Id);
return traitEntry != null && (traitEntry.Rank + traitEntry.GrantedRanks) == nodeEntry.Data.MaxRanks;
});
return node.Entries.All(nodeEntry =>
{ {
TraitEntryPacket traitEntry = getNodeEntry(node.Data.Id, nodeEntry.Data.Id); TraitEntryPacket traitEntry = getNodeEntry(node.Data.Id, nodeEntry.Data.Id);
return traitEntry != null && (traitEntry.Rank + traitEntry.GrantedRanks) == nodeEntry.Data.MaxRanks; return traitEntry != null && (traitEntry.Rank + traitEntry.GrantedRanks) == nodeEntry.Data.MaxRanks;
}); };
};
if (node.Data.GetNodeType() == TraitNodeType.Selection)
return node.Entries.Any(nodeEntryMatches);
return node.Entries.All(nodeEntryMatches);
}
Dictionary<int, int> spentCurrencies = new(); Dictionary<int, int> spentCurrencies = new();
FillSpentCurrenciesMap(traitConfig.Entries, spentCurrencies); FillSpentCurrenciesMap(traitConfig.Entries, spentCurrencies);