Core/Spells: Implemented SPELL_ATTR9_ITEM_PASSIVE_ON_CLIENT
Port From (https://github.com/TrinityCore/TrinityCore/commit/321161230fe557f930bb155729d9150c42c5758c)
This commit is contained in:
@@ -1992,7 +1992,7 @@ namespace Framework.Constants
|
||||
JumpchargeNoFacingControl = 0x800000, // JumpCharge - no facing control
|
||||
IgnoreCasterHealingModifiers = 0x1000000, // Ignore Caster Healing Modifiers
|
||||
DontConsumeChargeIfItemDeleted = 0x2000000, // NYI - some sort of bugfix attribute to prevent double item deletion? // (Programmer Only) Don't consume charge if item deleted
|
||||
Unk26 = 0x4000000, // 26
|
||||
ItemPassiveOnClient = 0x4000000, // Item Passive On Client
|
||||
Unk27 = 0x8000000, // 27
|
||||
Unk28 = 0x10000000, // 28
|
||||
Unk29 = 0x20000000, // 29
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -751,6 +751,45 @@ namespace Game.Networking.Packets
|
||||
}
|
||||
}
|
||||
|
||||
class AddItemPassive : ServerPacket
|
||||
{
|
||||
public uint SpellID;
|
||||
|
||||
public AddItemPassive() : base(ServerOpcodes.AddItemPassive, ConnectionType.Instance) { }
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteUInt32(SpellID);
|
||||
}
|
||||
}
|
||||
|
||||
class RemoveItemPassive : ServerPacket
|
||||
{
|
||||
public uint SpellID;
|
||||
|
||||
public RemoveItemPassive() : base(ServerOpcodes.RemoveItemPassive, ConnectionType.Instance) { }
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteUInt32(SpellID);
|
||||
}
|
||||
}
|
||||
|
||||
class SendItemPassives : ServerPacket
|
||||
{
|
||||
public List<uint> SpellID = new();
|
||||
|
||||
public SendItemPassives() : base(ServerOpcodes.SendItemPassives, ConnectionType.Instance) { }
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteInt32(SpellID.Count);
|
||||
if (!SpellID.Empty())
|
||||
foreach (uint id in SpellID)
|
||||
_worldPacket.WriteUInt32(id);
|
||||
}
|
||||
}
|
||||
|
||||
//Structs
|
||||
public class ItemBonuses
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user