Core/Conditions: Added CONDITION_SCENARIO_STEP
Port From (https://github.com/TrinityCore/TrinityCore/commit/5002e5d3524eab201c6c219cd60a9f7d6188ed54)
This commit is contained in:
@@ -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
|
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
|
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
|
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
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using Framework.Constants;
|
|||||||
using Game.DataStorage;
|
using Game.DataStorage;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
|
using Game.Scenarios;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
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);
|
condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue3, player.GetSession().GetBattlePetMgr().GetPetCount(CliDB.BattlePetSpeciesStorage.LookupByKey(ConditionValue1), player.GetGUID()), ConditionValue2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ConditionTypes.ScenarioStep:
|
||||||
|
{
|
||||||
|
Scenario scenario = obj.GetScenario();
|
||||||
|
if (scenario != null)
|
||||||
|
{
|
||||||
|
ScenarioStepRecord step = scenario.GetStep();
|
||||||
|
if (step != null)
|
||||||
|
condMeets = step.Id == ConditionValue1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
condMeets = false;
|
condMeets = false;
|
||||||
break;
|
break;
|
||||||
@@ -512,6 +524,9 @@ namespace Game.Conditions
|
|||||||
case ConditionTypes.BattlePetCount:
|
case ConditionTypes.BattlePetCount:
|
||||||
mask |= GridMapTypeMask.Player;
|
mask |= GridMapTypeMask.Player;
|
||||||
break;
|
break;
|
||||||
|
case ConditionTypes.ScenarioStep:
|
||||||
|
mask |= GridMapTypeMask.All;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Cypher.Assert(false, "Condition.GetSearcherTypeMaskForCondition - missing condition handling!");
|
Cypher.Assert(false, "Condition.GetSearcherTypeMaskForCondition - missing condition handling!");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1758,6 +1758,15 @@ namespace Game
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
Log.outError(LogFilter.Sql, $"{cond.ToString()} Invalid ConditionType in `condition` table, ignoring.");
|
Log.outError(LogFilter.Sql, $"{cond.ToString()} Invalid ConditionType in `condition` table, ignoring.");
|
||||||
return false;
|
return false;
|
||||||
@@ -2976,6 +2985,8 @@ namespace Game
|
|||||||
new ConditionTypeInfo("Is Gamemaster", true, false, false),
|
new ConditionTypeInfo("Is Gamemaster", true, false, false),
|
||||||
new ConditionTypeInfo("Object Entry or Guid", true, true, true),
|
new ConditionTypeInfo("Object Entry or Guid", true, true, true),
|
||||||
new ConditionTypeInfo("Object TypeMask", true, false, false),
|
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
|
public struct ConditionTypeInfo
|
||||||
|
|||||||
@@ -8537,9 +8537,18 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
Unit unitCaster = spell.GetCaster().ToUnit();
|
Unit unitCaster = spell.GetCaster().ToUnit();
|
||||||
if (unitCaster != null)
|
if (unitCaster != null)
|
||||||
|
{
|
||||||
unitCaster.AtTargetAttacked(unit, spell.m_spellInfo.HasInitialAggro());
|
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);
|
unit.SetStandState(UnitStandStateType.Stand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user