Core/Transmog: Implemented TransmogIllusionFlags::PlayerConditionGrantsOnLogin and fixed transmog illusion validation when transmogging items

Port From (https://github.com/TrinityCore/TrinityCore/commit/f820ff178decf7d844b7c398b79be7269feeb53e)
This commit is contained in:
hondacrx
2022-06-14 23:15:49 -04:00
parent 286294a108
commit c60fa1d1a3
6 changed files with 46 additions and 23 deletions
@@ -136,20 +136,14 @@ namespace Game
return;
}
SpellItemEnchantmentRecord illusion = CliDB.SpellItemEnchantmentStorage.LookupByKey(transmogItem.SpellItemEnchantmentID);
TransmogIllusionRecord illusion = Global.DB2Mgr.GetTransmogIllusionForEnchantment((uint)transmogItem.SpellItemEnchantmentID);
if (illusion == null)
{
Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify illusion using invalid enchant ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.SpellItemEnchantmentID);
return;
}
if (illusion.ItemVisual == 0 || !illusion.GetFlags().HasFlag(SpellItemEnchantmentFlags.AllowTransmog))
{
Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify illusion using not allowed enchant ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.SpellItemEnchantmentID);
return;
}
PlayerConditionRecord condition = CliDB.PlayerConditionStorage.LookupByKey(illusion.TransmogUseConditionID);
var condition = CliDB.PlayerConditionStorage.LookupByKey(illusion.UnlockConditionID);
if (condition != null)
{
if (!ConditionManager.IsPlayerMeetingCondition(player, condition))
@@ -159,12 +153,6 @@ namespace Game
}
}
if (illusion.ScalingClassRestricted > 0 && illusion.ScalingClassRestricted != (byte)player.GetClass())
{
Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify illusion using not allowed class enchant ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.SpellItemEnchantmentID);
return;
}
illusionItems[itemTransmogrified] = (uint)transmogItem.SpellItemEnchantmentID;
cost += illusion.TransmogCost;
}