Core/Misc: Add helper table phase_name and improve .npc info and .gps
Port From (https://github.com/TrinityCore/TrinityCore/commit/833e17998571a57ada61f5ca92341dc242114458)
This commit is contained in:
@@ -9923,7 +9923,33 @@ namespace Game
|
|||||||
|
|
||||||
} while (result.NextRow());
|
} while (result.NextRow());
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, $"Loaded {_jumpChargeParams.Count} Player Choice locale strings in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
Log.outInfo(LogFilter.ServerLoading, $"Loaded {_jumpChargeParams.Count} Jump Charge Params in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
||||||
|
}
|
||||||
|
public void LoadPhaseNames()
|
||||||
|
{
|
||||||
|
uint oldMSTime = Time.GetMSTime();
|
||||||
|
_phaseNameStorage.Clear();
|
||||||
|
|
||||||
|
// 0 1
|
||||||
|
SQLResult result = DB.World.Query("SELECT `ID`, `Name` FROM `phase_name`");
|
||||||
|
if (result.IsEmpty())
|
||||||
|
{
|
||||||
|
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 phase names. DB table `phase_name` is empty.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint count = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
uint phaseId = result.Read<uint>(0);
|
||||||
|
string name = result.Read<string>(1);
|
||||||
|
|
||||||
|
_phaseNameStorage[phaseId] = name;
|
||||||
|
|
||||||
|
++count;
|
||||||
|
} while (result.NextRow());
|
||||||
|
|
||||||
|
Log.outInfo(LogFilter.ServerLoading, $"Loaded {count} phase names in {Time.GetMSTimeDiffToNow(oldMSTime)} ms.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailLevelReward GetMailLevelReward(uint level, ulong raceMask)
|
public MailLevelReward GetMailLevelReward(uint level, ulong raceMask)
|
||||||
@@ -10297,27 +10323,27 @@ 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 string GetPhaseName(uint phaseId)
|
||||||
|
{
|
||||||
|
return _phaseNameStorage.TryGetValue(phaseId, out string value) ? value : "Unknown Name";
|
||||||
|
}
|
||||||
|
|
||||||
//Vehicles
|
//Vehicles
|
||||||
public void LoadVehicleTemplate()
|
public void LoadVehicleTemplate()
|
||||||
@@ -10477,6 +10503,7 @@ namespace Game
|
|||||||
List<string> _reservedNamesStorage = new();
|
List<string> _reservedNamesStorage = new();
|
||||||
Dictionary<uint, SceneTemplate> _sceneTemplateStorage = new();
|
Dictionary<uint, SceneTemplate> _sceneTemplateStorage = new();
|
||||||
Dictionary<int, JumpChargeParams> _jumpChargeParams = new();
|
Dictionary<int, JumpChargeParams> _jumpChargeParams = new();
|
||||||
|
Dictionary<uint, string> _phaseNameStorage = new();
|
||||||
|
|
||||||
Dictionary<byte, RaceUnlockRequirement> _raceUnlockRequirementStorage = new();
|
Dictionary<byte, RaceUnlockRequirement> _raceUnlockRequirementStorage = new();
|
||||||
List<RaceClassAvailability> _classExpansionRequirementStorage = new();
|
List<RaceClassAvailability> _classExpansionRequirementStorage = new();
|
||||||
|
|||||||
@@ -540,12 +540,13 @@ namespace Game
|
|||||||
string personal = Global.ObjectMgr.GetCypherString(CypherStrings.PhaseFlagPersonal, chat.GetSessionDbcLocale());
|
string personal = Global.ObjectMgr.GetCypherString(CypherStrings.PhaseFlagPersonal, chat.GetSessionDbcLocale());
|
||||||
foreach (var pair in phaseShift.Phases)
|
foreach (var pair in phaseShift.Phases)
|
||||||
{
|
{
|
||||||
phases.Append(pair.Key);
|
phases.Append("\r\n");
|
||||||
|
phases.Append(" ");
|
||||||
|
phases.Append($"{pair.Key} ({Global.ObjectMgr.GetPhaseName(pair.Key)})'");
|
||||||
if (pair.Value.Flags.HasFlag(PhaseFlags.Cosmetic))
|
if (pair.Value.Flags.HasFlag(PhaseFlags.Cosmetic))
|
||||||
phases.Append(' ' + '(' + cosmetic + ')');
|
phases.Append(' ' + '(' + cosmetic + ')');
|
||||||
if (pair.Value.Flags.HasFlag(PhaseFlags.Personal))
|
if (pair.Value.Flags.HasFlag(PhaseFlags.Personal))
|
||||||
phases.Append(' ' + '(' + personal + ')');
|
phases.Append(' ' + '(' + personal + ')');
|
||||||
phases.Append(", ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chat.SendSysMessage(CypherStrings.PhaseshiftPhases, phases.ToString());
|
chat.SendSysMessage(CypherStrings.PhaseshiftPhases, phases.ToString());
|
||||||
|
|||||||
@@ -1079,6 +1079,9 @@ namespace Game
|
|||||||
Log.outInfo(LogFilter.ServerLoading, "Loading scenario poi data");
|
Log.outInfo(LogFilter.ServerLoading, "Loading scenario poi data");
|
||||||
Global.ScenarioMgr.LoadScenarioPOI();
|
Global.ScenarioMgr.LoadScenarioPOI();
|
||||||
|
|
||||||
|
Log.outInfo(LogFilter.ServerLoading, "Loading phase names...");
|
||||||
|
Global.ObjectMgr.LoadPhaseNames();
|
||||||
|
|
||||||
// Preload all cells, if required for the base maps
|
// Preload all cells, if required for the base maps
|
||||||
if (WorldConfig.GetBoolValue(WorldCfg.BasemapLoadGrids))
|
if (WorldConfig.GetBoolValue(WorldCfg.BasemapLoadGrids))
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user