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
+5 -5
View File
@@ -2506,19 +2506,19 @@ namespace Game.Entities
return vCount.count;
}
public override string GetName(LocaleConstant locale_idx = LocaleConstant.enUS)
public override string GetName(LocaleConstant locale = LocaleConstant.enUS)
{
if (locale_idx != LocaleConstant.enUS)
if (locale != LocaleConstant.enUS)
{
CreatureLocale cl = Global.ObjectMgr.GetCreatureLocale(GetEntry());
if (cl != null)
{
if (cl.Name.Length > (byte)locale_idx && !string.IsNullOrEmpty(cl.Name[(byte)locale_idx]))
return cl.Name[(byte)locale_idx];
if (cl.Name.Length > (int)locale && !cl.Name[(int)locale].IsEmpty())
return cl.Name[(int)locale];
}
}
return base.GetName(locale_idx);
return base.GetName(locale);
}
public virtual byte GetPetAutoSpellSize() { return 4; }