Core/Spells: Implemented SPELL_ATTR9_ITEM_PASSIVE_ON_CLIENT
Port From (https://github.com/TrinityCore/TrinityCore/commit/321161230fe557f930bb155729d9150c42c5758c)
This commit is contained in:
@@ -37,6 +37,7 @@ namespace Game.Entities
|
||||
public List<ItemSetEffect> ItemSetEff = new();
|
||||
List<EnchantDuration> m_enchantDuration = new();
|
||||
List<Item> m_itemDuration = new();
|
||||
List<uint> m_itemPassives = new();
|
||||
List<ObjectGuid> m_itemSoulboundTradeable = new();
|
||||
List<ObjectGuid> m_refundableItems = new();
|
||||
public List<Item> ItemUpdateQueue = new();
|
||||
|
||||
@@ -2419,6 +2419,17 @@ namespace Game.Entities
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SendItemPassives()
|
||||
{
|
||||
if (m_itemPassives.Empty())
|
||||
return;
|
||||
|
||||
SendItemPassives sendItemPassives = new();
|
||||
sendItemPassives.SpellID.AddRange(m_itemPassives);
|
||||
SendPacket(sendItemPassives);
|
||||
}
|
||||
|
||||
public void SendNewItem(Item item, uint quantity, bool pushed, bool created, bool broadcast = false, uint dungeonEncounterId = 0)
|
||||
{
|
||||
if (item == null) // prevent crash
|
||||
@@ -3785,6 +3796,17 @@ namespace Game.Entities
|
||||
|
||||
Log.outDebug(LogFilter.Player, "WORLD: cast {0} Equip spellId - {1}", (item != null ? "item" : "itemset"), spellInfo.Id);
|
||||
|
||||
if (spellInfo.HasAttribute(SpellAttr9.ItemPassiveOnClient))
|
||||
{
|
||||
m_itemPassives.Add(spellInfo.Id);
|
||||
if (IsInWorld)
|
||||
{
|
||||
AddItemPassive addItemPassive = new();
|
||||
addItemPassive.SpellID = spellInfo.Id;
|
||||
SendPacket(addItemPassive);
|
||||
}
|
||||
}
|
||||
|
||||
CastSpell(this, spellInfo.Id, new CastSpellExtraArgs(item));
|
||||
}
|
||||
else
|
||||
@@ -3796,6 +3818,17 @@ namespace Game.Entities
|
||||
return; // and remove only not compatible at form change
|
||||
}
|
||||
|
||||
if (spellInfo.HasAttribute(SpellAttr9.ItemPassiveOnClient))
|
||||
{
|
||||
m_itemPassives.Remove(spellInfo.Id);
|
||||
if (IsInWorld)
|
||||
{
|
||||
RemoveItemPassive removeItemPassive = new();
|
||||
removeItemPassive.SpellID = spellInfo.Id;
|
||||
SendPacket(removeItemPassive);
|
||||
}
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
RemoveAurasDueToItemSpell(spellInfo.Id, item.GetGUID()); // un-apply all spells, not only at-equipped
|
||||
else
|
||||
|
||||
@@ -5798,6 +5798,7 @@ namespace Game.Entities
|
||||
SendAurasForTarget(this);
|
||||
SendEnchantmentDurations(); // must be after add to map
|
||||
SendItemDurations(); // must be after add to map
|
||||
SendItemPassives(); // must be after add to map
|
||||
|
||||
// raid downscaling - send difficulty to player
|
||||
if (GetMap().IsRaid())
|
||||
|
||||
Reference in New Issue
Block a user