Core/Items: Add helper function to get item name including suffix

Port From (https://github.com/TrinityCore/TrinityCore/commit/ecdf3d1a141af4cc0c1ced1bd23e8148ed3a2000)
This commit is contained in:
hondacrx
2020-04-26 01:04:13 -04:00
parent a229f29a27
commit 24a1bb6331
4 changed files with 31 additions and 12 deletions
@@ -2085,18 +2085,17 @@ namespace Game.Entities
return GetGoInfo().ScriptId;
}
public override string GetName(LocaleConstant loc_idx = LocaleConstant.enUS)
public override string GetName(LocaleConstant locale = LocaleConstant.enUS)
{
if (loc_idx != LocaleConstant.enUS)
if (locale != LocaleConstant.enUS)
{
byte uloc_idx = (byte)loc_idx;
GameObjectLocale cl = Global.ObjectMgr.GetGameObjectLocale(GetEntry());
if (cl != null)
if (cl.Name.Length > uloc_idx && !string.IsNullOrEmpty(cl.Name[uloc_idx]))
return cl.Name[uloc_idx];
if (cl.Name.Length > (int)locale && !cl.Name[(int)locale].IsEmpty())
return cl.Name[(int)locale];
}
return base.GetName(loc_idx);
return base.GetName(locale);
}
public void UpdatePackedRotation()