Core/Conditions: Added CONDITION_SCENARIO_STEP

Port From (https://github.com/TrinityCore/TrinityCore/commit/5002e5d3524eab201c6c219cd60a9f7d6188ed54)
This commit is contained in:
hondacrx
2022-06-01 17:06:38 -04:00
parent b68bbda363
commit a99d430a9c
4 changed files with 37 additions and 1 deletions
+15
View File
@@ -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;
@@ -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
+10 -1
View File
@@ -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);
}