diff --git a/Source/Framework/Constants/ConditionConst.cs b/Source/Framework/Constants/ConditionConst.cs index 9a8a1c022..2083e97ec 100644 --- a/Source/Framework/Constants/ConditionConst.cs +++ b/Source/Framework/Constants/ConditionConst.cs @@ -73,6 +73,7 @@ namespace Framework.Constants ObjectEntryGuid = 51, // TypeID entry guid true if object is type TypeID and the entry is 0 or matches entry of the object or matches guid of the object TypeMask = 52, // TypeMask 0 0 true if object is type object's TypeMask matches provided TypeMask BattlePetCount = 53, // SpecieId count ComparisonType true if player has `count` of battle pet species + ScenarioStep = 54, // ScenarioStepId 0 0 true if player is at scenario with current step equal to ScenarioStepID Max } diff --git a/Source/Game/Conditions/Condition.cs b/Source/Game/Conditions/Condition.cs index f66c81ca9..e4f155de0 100644 --- a/Source/Game/Conditions/Condition.cs +++ b/Source/Game/Conditions/Condition.cs @@ -19,6 +19,7 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; using Game.Maps; +using Game.Scenarios; using System; using System.Collections.Generic; using System.Text; @@ -399,6 +400,17 @@ namespace Game.Conditions condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue3, player.GetSession().GetBattlePetMgr().GetPetCount(CliDB.BattlePetSpeciesStorage.LookupByKey(ConditionValue1), player.GetGUID()), ConditionValue2); break; } + case ConditionTypes.ScenarioStep: + { + Scenario scenario = obj.GetScenario(); + if (scenario != null) + { + ScenarioStepRecord step = scenario.GetStep(); + if (step != null) + condMeets = step.Id == ConditionValue1; + } + break; + } default: condMeets = false; break; @@ -512,6 +524,9 @@ namespace Game.Conditions case ConditionTypes.BattlePetCount: mask |= GridMapTypeMask.Player; break; + case ConditionTypes.ScenarioStep: + mask |= GridMapTypeMask.All; + break; default: Cypher.Assert(false, "Condition.GetSearcherTypeMaskForCondition - missing condition handling!"); break; diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index b17bb0258..0eb573378 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -1758,6 +1758,15 @@ namespace Game return false; } break; + case ConditionTypes.ScenarioStep: + { + if (!CliDB.ScenarioStepStorage.ContainsKey(cond.ConditionValue1)) + { + Log.outError(LogFilter.Sql, $"{cond.ToString(true)} has non existing ScenarioStep in value1 ({cond.ConditionValue1}), skipped."); + return false; + } + break; + } default: Log.outError(LogFilter.Sql, $"{cond.ToString()} Invalid ConditionType in `condition` table, ignoring."); return false; @@ -2976,6 +2985,8 @@ namespace Game new ConditionTypeInfo("Is Gamemaster", true, false, false), new ConditionTypeInfo("Object Entry or Guid", true, true, true), new ConditionTypeInfo("Object TypeMask", true, false, false), + new ConditionTypeInfo("BattlePet Species Learned", true, true, true), + new ConditionTypeInfo("On Scenario Step", true, false, false) }; public struct ConditionTypeInfo diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index bb29fb8f6..5dba32e29 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -8537,9 +8537,18 @@ namespace Game.Spells { Unit unitCaster = spell.GetCaster().ToUnit(); if (unitCaster != null) + { unitCaster.AtTargetAttacked(unit, spell.m_spellInfo.HasInitialAggro()); + if (spell.m_spellInfo.HasAttribute(SpellAttr6.TapsImmediately)) + { + Creature targetCreature = unit.ToCreature(); + if (targetCreature != null) + if (!targetCreature.HasLootRecipient() && unitCaster.IsPlayer()) + targetCreature.SetLootRecipient(unitCaster); + } + } - if (!spell.m_spellInfo.HasAttribute(SpellAttr3.DoNotTriggerTargetStand) && !unit.IsStandState()) + if (!spell.m_spellInfo.HasAttribute(SpellAttr3.DoNotTriggerTargetStand) && !unit.IsStandState()) unit.SetStandState(UnitStandStateType.Stand); }