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:
@@ -2448,4 +2448,11 @@ namespace Framework.Constants
|
|||||||
UnitItemOffHandIgnoreDisarmed = 9,
|
UnitItemOffHandIgnoreDisarmed = 9,
|
||||||
UnitItemRangedIgnoreDisarmed = 10
|
UnitItemRangedIgnoreDisarmed = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum TransmogIllusionFlags
|
||||||
|
{
|
||||||
|
HideUntilCollected = 0x1,
|
||||||
|
PlayerConditionGrantsOnLogin = 0x2,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ namespace Game.DataStorage
|
|||||||
public int TransmogCost;
|
public int TransmogCost;
|
||||||
public int SpellItemEnchantmentID;
|
public int SpellItemEnchantmentID;
|
||||||
public int Flags;
|
public int Flags;
|
||||||
|
|
||||||
|
public TransmogIllusionFlags GetFlags() { return (TransmogIllusionFlags)Flags; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class TransmogSetRecord
|
public sealed class TransmogSetRecord
|
||||||
|
|||||||
@@ -909,23 +909,28 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTransmogIllusion(ushort illusionId)
|
public void AddTransmogIllusion(uint transmogIllusionId)
|
||||||
{
|
{
|
||||||
Player owner = _owner.GetPlayer();
|
Player owner = _owner.GetPlayer();
|
||||||
if (_transmogIllusions.Count <= illusionId)
|
if (_transmogIllusions.Count <= transmogIllusionId)
|
||||||
{
|
{
|
||||||
uint numBlocks = (uint)(_transmogIllusions.Count << 2);
|
uint numBlocks = (uint)(_transmogIllusions.Count << 2);
|
||||||
_transmogIllusions.Length = illusionId + 1;
|
_transmogIllusions.Length = (int)transmogIllusionId + 1;
|
||||||
numBlocks = (uint)(_transmogIllusions.Count << 2) - numBlocks;
|
numBlocks = (uint)(_transmogIllusions.Count << 2) - numBlocks;
|
||||||
while (numBlocks-- != 0)
|
while (numBlocks-- != 0)
|
||||||
owner.AddIllusionBlock(0);
|
owner.AddIllusionBlock(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_transmogIllusions.Set(illusionId, true);
|
_transmogIllusions.Set((int)transmogIllusionId, true);
|
||||||
int blockIndex = illusionId / 32;
|
uint blockIndex = transmogIllusionId / 32;
|
||||||
int bitIndex = illusionId % 32;
|
uint bitIndex = transmogIllusionId % 32;
|
||||||
|
|
||||||
owner.AddIllusionFlag(blockIndex, (uint)(1 << bitIndex));
|
owner.AddIllusionFlag((int)blockIndex, (uint)(1 << (int)bitIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasTransmogIllusion(uint transmogIllusionId)
|
||||||
|
{
|
||||||
|
return transmogIllusionId < _transmogIllusions.Count && _transmogIllusions.Get((int)transmogIllusionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasToy(uint itemId) { return _toys.ContainsKey(itemId); }
|
public bool HasToy(uint itemId) { return _toys.ContainsKey(itemId); }
|
||||||
|
|||||||
@@ -3354,6 +3354,23 @@ namespace Game.Entities
|
|||||||
m_questObjectiveCriteriaMgr.CheckAllQuestObjectiveCriteria(this);
|
m_questObjectiveCriteriaMgr.CheckAllQuestObjectiveCriteria(this);
|
||||||
|
|
||||||
PushQuests();
|
PushQuests();
|
||||||
|
|
||||||
|
foreach (var transmogIllusion in CliDB.TransmogIllusionStorage.Values)
|
||||||
|
{
|
||||||
|
if (!transmogIllusion.GetFlags().HasFlag(TransmogIllusionFlags.PlayerConditionGrantsOnLogin))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (GetSession().GetCollectionMgr().HasTransmogIllusion(transmogIllusion.Id))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var playerCondition = CliDB.PlayerConditionStorage.LookupByKey(transmogIllusion.UnlockConditionID);
|
||||||
|
if (playerCondition != null)
|
||||||
|
if (!ConditionManager.IsPlayerMeetingCondition(this, playerCondition))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
GetSession().GetCollectionMgr().AddTransmogIllusion(transmogIllusion.Id);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,20 +136,14 @@ namespace Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellItemEnchantmentRecord illusion = CliDB.SpellItemEnchantmentStorage.LookupByKey(transmogItem.SpellItemEnchantmentID);
|
TransmogIllusionRecord illusion = Global.DB2Mgr.GetTransmogIllusionForEnchantment((uint)transmogItem.SpellItemEnchantmentID);
|
||||||
if (illusion == null)
|
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);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (illusion.ItemVisual == 0 || !illusion.GetFlags().HasFlag(SpellItemEnchantmentFlags.AllowTransmog))
|
var condition = CliDB.PlayerConditionStorage.LookupByKey(illusion.UnlockConditionID);
|
||||||
{
|
|
||||||
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);
|
|
||||||
if (condition != null)
|
if (condition != null)
|
||||||
{
|
{
|
||||||
if (!ConditionManager.IsPlayerMeetingCondition(player, condition))
|
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;
|
illusionItems[itemTransmogrified] = (uint)transmogItem.SpellItemEnchantmentID;
|
||||||
cost += illusion.TransmogCost;
|
cost += illusion.TransmogCost;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5666,7 +5666,11 @@ namespace Game.Spells
|
|||||||
if (player == null)
|
if (player == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.GetSession().GetCollectionMgr().AddTransmogIllusion((ushort)effectInfo.MiscValue);
|
uint illusionId = (uint)effectInfo.MiscValue;
|
||||||
|
if (!CliDB.TransmogIllusionStorage.ContainsKey(illusionId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
player.GetSession().GetCollectionMgr().AddTransmogIllusion(illusionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user