Core/Creatures: Check fallback difficulty data for creature static flags override
Port From (https://github.com/TrinityCore/TrinityCore/commit/e51670741023a7ea6309c16c9233848da49db1fa)
This commit is contained in:
@@ -10119,12 +10119,15 @@ namespace Game
|
|||||||
Log.outError(LogFilter.Sql, $"Table `creature_static_flags_override` has data for nonexistent creature (SpawnId: {spawnId}), skipped");
|
Log.outError(LogFilter.Sql, $"Table `creature_static_flags_override` has data for nonexistent creature (SpawnId: {spawnId}), skipped");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// DIFFICULTY_NONE is always a valid fallback
|
||||||
|
if (difficultyId != Difficulty.None)
|
||||||
|
{
|
||||||
if (!creatureData.SpawnDifficulties.Contains(difficultyId))
|
if (!creatureData.SpawnDifficulties.Contains(difficultyId))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, $"Table `creature_static_flags_override` has data for a creature that is not available for the specified DifficultyId (SpawnId: {spawnId}, DifficultyId: {difficultyId}), skipped");
|
Log.outError(LogFilter.Sql, $"Table `creature_static_flags_override` has data for a creature that is not available for the specified DifficultyId (SpawnId: {spawnId}, DifficultyId: {difficultyId}), skipped");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CreatureStaticFlagsOverride staticFlagsOverride = new();
|
CreatureStaticFlagsOverride staticFlagsOverride = new();
|
||||||
if (!result.IsNull(2))
|
if (!result.IsNull(2))
|
||||||
@@ -10571,6 +10574,7 @@ namespace Game
|
|||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetTaxiPath(uint source, uint destination, out uint path, out uint cost)
|
public void GetTaxiPath(uint source, uint destination, out uint path, out uint cost)
|
||||||
{
|
{
|
||||||
var pathSet = CliDB.TaxiPathSetBySource.LookupByKey(source);
|
var pathSet = CliDB.TaxiPathSetBySource.LookupByKey(source);
|
||||||
@@ -10592,6 +10596,7 @@ namespace Game
|
|||||||
cost = dest_i.price;
|
cost = dest_i.price;
|
||||||
path = dest_i.Id;
|
path = dest_i.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetTaxiMountDisplayId(uint id, Team team, bool allowed_alt_team = false)
|
public uint GetTaxiMountDisplayId(uint id, Team team, bool allowed_alt_team = false)
|
||||||
{
|
{
|
||||||
CreatureModel mountModel = new();
|
CreatureModel mountModel = new();
|
||||||
@@ -10638,14 +10643,17 @@ namespace Game
|
|||||||
{
|
{
|
||||||
return _areaTriggerStorage.LookupByKey(trigger);
|
return _areaTriggerStorage.LookupByKey(trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccessRequirement GetAccessRequirement(uint mapid, Difficulty difficulty)
|
public AccessRequirement GetAccessRequirement(uint mapid, Difficulty difficulty)
|
||||||
{
|
{
|
||||||
return _accessRequirementStorage.LookupByKey(MathFunctions.MakePair64(mapid, (uint)difficulty));
|
return _accessRequirementStorage.LookupByKey(MathFunctions.MakePair64(mapid, (uint)difficulty));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsTavernAreaTrigger(uint Trigger_ID)
|
public bool IsTavernAreaTrigger(uint Trigger_ID)
|
||||||
{
|
{
|
||||||
return _tavernAreaTriggerStorage.Contains(Trigger_ID);
|
return _tavernAreaTriggerStorage.Contains(Trigger_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AreaTriggerStruct GetGoBackTrigger(uint Map)
|
public AreaTriggerStruct GetGoBackTrigger(uint Map)
|
||||||
{
|
{
|
||||||
uint? parentId = null;
|
uint? parentId = null;
|
||||||
@@ -10672,6 +10680,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AreaTriggerStruct GetMapEntranceTrigger(uint Map)
|
public AreaTriggerStruct GetMapEntranceTrigger(uint Map)
|
||||||
{
|
{
|
||||||
foreach (var pair in _areaTriggerStorage)
|
foreach (var pair in _areaTriggerStorage)
|
||||||
@@ -10685,27 +10694,42 @@ namespace Game
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SceneTemplate GetSceneTemplate(uint sceneId)
|
public SceneTemplate GetSceneTemplate(uint sceneId)
|
||||||
{
|
{
|
||||||
return _sceneTemplateStorage.LookupByKey(sceneId);
|
return _sceneTemplateStorage.LookupByKey(sceneId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TempSummonData> GetSummonGroup(uint summonerId, SummonerType summonerType, byte group)
|
public List<TempSummonData> GetSummonGroup(uint summonerId, SummonerType summonerType, byte group)
|
||||||
{
|
{
|
||||||
Tuple<uint, SummonerType, byte> key = Tuple.Create(summonerId, summonerType, group);
|
Tuple<uint, SummonerType, byte> key = Tuple.Create(summonerId, summonerType, group);
|
||||||
return _tempSummonDataStorage.LookupByKey(key);
|
return _tempSummonDataStorage.LookupByKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsReservedName(string name)
|
public bool IsReservedName(string name)
|
||||||
{
|
{
|
||||||
return _reservedNamesStorage.Contains(name.ToLower());
|
return _reservedNamesStorage.Contains(name.ToLower());
|
||||||
}
|
}
|
||||||
|
|
||||||
public JumpChargeParams GetJumpChargeParams(int id)
|
public JumpChargeParams GetJumpChargeParams(int id)
|
||||||
{
|
{
|
||||||
return _jumpChargeParams.LookupByKey(id);
|
return _jumpChargeParams.LookupByKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreatureStaticFlagsOverride GetCreatureStaticFlagsOverride(ulong spawnId, Difficulty difficultyId)
|
public CreatureStaticFlagsOverride GetCreatureStaticFlagsOverride(ulong spawnId, Difficulty difficultyId)
|
||||||
{
|
{
|
||||||
return _creatureStaticFlagsOverrideStorage.LookupByKey((spawnId, difficultyId));
|
CreatureStaticFlagsOverride staticFlagsOverride = _creatureStaticFlagsOverrideStorage.LookupByKey((spawnId, difficultyId));
|
||||||
|
if (staticFlagsOverride != null)
|
||||||
|
return staticFlagsOverride;
|
||||||
|
|
||||||
|
// If there is no data for the difficulty, try to get data for the fallback difficulty
|
||||||
|
var difficultyEntry = CliDB.DifficultyStorage.LookupByKey(difficultyId);
|
||||||
|
if (difficultyEntry != null)
|
||||||
|
return GetCreatureStaticFlagsOverride(spawnId, (Difficulty)difficultyEntry.FallbackDifficultyID);
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetPhaseName(uint phaseId)
|
public string GetPhaseName(uint phaseId)
|
||||||
{
|
{
|
||||||
return _phaseNameStorage.TryGetValue(phaseId, out string value) ? value : "Unknown Name";
|
return _phaseNameStorage.TryGetValue(phaseId, out string value) ? value : "Unknown Name";
|
||||||
|
|||||||
Reference in New Issue
Block a user