Core/Conditions: Added CONDITION_PLAYER_CONDITION to integrate conditions with db2 data
Port From (https://github.com/TrinityCore/TrinityCore/commit/3a56b914c64dd44303f63fe8f6cb9ac4865e5a59)
This commit is contained in:
@@ -75,6 +75,7 @@ namespace Framework.Constants
|
|||||||
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
|
ScenarioStep = 54, // ScenarioStepId 0 0 true if player is at scenario with current step equal to ScenarioStepID
|
||||||
SceneInProgress = 55, // SceneScriptPackageId 0 0 true if player is playing a scene with ScriptPackageId equal to given value
|
SceneInProgress = 55, // SceneScriptPackageId 0 0 true if player is playing a scene with ScriptPackageId equal to given value
|
||||||
|
PlayerCondition = 56, // PlayerConditionId 0 0 true if player satisfies PlayerCondition
|
||||||
Max
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -438,6 +438,16 @@ namespace Game.Conditions
|
|||||||
condMeets = player.GetSceneMgr().GetActiveSceneCount(ConditionValue1) > 0;
|
condMeets = player.GetSceneMgr().GetActiveSceneCount(ConditionValue1) > 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ConditionTypes.PlayerCondition:
|
||||||
|
{
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(ConditionValue1);
|
||||||
|
if (playerCondition != null)
|
||||||
|
condMeets = ConditionManager.IsPlayerMeetingCondition(player, playerCondition);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -556,6 +566,9 @@ namespace Game.Conditions
|
|||||||
case ConditionTypes.SceneInProgress:
|
case ConditionTypes.SceneInProgress:
|
||||||
mask |= GridMapTypeMask.Player;
|
mask |= GridMapTypeMask.Player;
|
||||||
break;
|
break;
|
||||||
|
case ConditionTypes.PlayerCondition:
|
||||||
|
mask |= GridMapTypeMask.Player;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Cypher.Assert(false, "Condition.GetSearcherTypeMaskForCondition - missing condition handling!");
|
Cypher.Assert(false, "Condition.GetSearcherTypeMaskForCondition - missing condition handling!");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1823,6 +1823,15 @@ namespace Game
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ConditionTypes.PlayerCondition:
|
||||||
|
{
|
||||||
|
if (!CliDB.PlayerConditionStorage.ContainsKey(cond.ConditionValue1))
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"{cond.ToString(true)} has non existing PlayerConditionId 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;
|
||||||
@@ -3055,8 +3064,9 @@ namespace Game
|
|||||||
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("BattlePet Species Learned", true, true, true),
|
||||||
new ConditionTypeInfo("On Scenario Step", true, false, false),
|
new ConditionTypeInfo("On Scenario Step", true, false, false),
|
||||||
new ConditionTypeInfo("Scene In Progress", true, false, false)
|
new ConditionTypeInfo("Scene In Progress", true, false, false),
|
||||||
|
new ConditionTypeInfo("Player Condition", true, false, false)
|
||||||
};
|
};
|
||||||
|
|
||||||
public struct ConditionTypeInfo
|
public struct ConditionTypeInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user