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
+20
View File
@@ -106,6 +106,16 @@ namespace Game.Entities
return true;
}
public override string GetName(LocaleConstant locale = LocaleConstant.enUS)
{
ItemTemplate itemTemplate = GetTemplate();
var suffix = CliDB.ItemNameDescriptionStorage.LookupByKey(_bonusData.Suffix);
if (suffix != null)
return $"{itemTemplate.GetName(locale)} {suffix.Description[locale]}";
return itemTemplate.GetName(locale);
}
public bool IsNotEmptyBag()
{
Bag bag = ToBag();
@@ -2861,6 +2871,7 @@ namespace Game.Entities
CanDisenchant = !proto.GetFlags().HasAnyFlag(ItemFlags.NoDisenchant);
CanScrap = proto.GetFlags4().HasAnyFlag(ItemFlags4.Scrapable);
_state.SuffixPriority = int.MaxValue;
_state.AppearanceModPriority = int.MaxValue;
_state.ScalingStatDistributionPriority = int.MaxValue;
_state.AzeriteTierUnlockSetPriority = int.MaxValue;
@@ -2914,6 +2925,13 @@ namespace Game.Entities
else if ((uint)Quality < values[0])
Quality = (ItemQuality)values[0];
break;
case ItemBonusType.Suffix:
if (values[1] < _state.SuffixPriority)
{
Suffix = (uint)values[0];
_state.SuffixPriority = values[1];
}
break;
case ItemBonusType.Socket:
{
uint socketCount = (uint)values[0];
@@ -2994,6 +3012,7 @@ namespace Game.Entities
public int RelicType;
public int RequiredLevelOverride;
public uint AzeriteTierUnlockSetId;
public uint Suffix;
public bool CanDisenchant;
public bool CanScrap;
public bool HasFixedLevel;
@@ -3001,6 +3020,7 @@ namespace Game.Entities
struct State
{
public int SuffixPriority;
public int AppearanceModPriority;
public int ScalingStatDistributionPriority;
public int AzeriteTierUnlockSetPriority;