mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Misc: added missing changes for 412c5416f9
This commit is contained in:
@@ -54,6 +54,13 @@ Item* NewItemOrBag(ItemTemplate const* proto)
|
||||
return new Item();
|
||||
}
|
||||
|
||||
struct ItemSetEffect
|
||||
{
|
||||
uint32 ItemSetID;
|
||||
std::unordered_set<Item const*> EquippedItems;
|
||||
std::unordered_set<ItemSetSpellEntry const*> SetBonuses;
|
||||
};
|
||||
|
||||
void AddItemsSetItem(Player* player, Item const* item)
|
||||
{
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
@@ -195,6 +202,28 @@ void RemoveItemsSetItem(Player* player, Item const* item)
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateItemSetAuras(Player* player, bool formChange)
|
||||
{
|
||||
// item set bonuses not dependent from item broken state
|
||||
for (ItemSetEffect* eff : player->ItemSetEff)
|
||||
{
|
||||
if (!eff)
|
||||
continue;
|
||||
|
||||
for (ItemSetSpellEntry const* itemSetSpell : eff->SetBonuses)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itemSetSpell->SpellID, DIFFICULTY_NONE);
|
||||
player->ApplyEquipSpell(spellInfo, nullptr, false, formChange); // remove spells that not fit to form - removal is skipped if shapeshift condition is satisfied
|
||||
player->ApplyEquipSpell(spellInfo, nullptr, true, formChange); // add spells that fit form but not active
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteItemSetEffects(ItemSetEffect* itemSetEffect)
|
||||
{
|
||||
delete itemSetEffect;
|
||||
}
|
||||
|
||||
bool ItemCanGoIntoBag(ItemTemplate const* pProto, ItemTemplate const* pBagProto)
|
||||
{
|
||||
if (!pProto || !pBagProto)
|
||||
|
||||
@@ -37,13 +37,6 @@ namespace WorldPackets
|
||||
}
|
||||
}
|
||||
|
||||
struct ItemSetEffect
|
||||
{
|
||||
uint32 ItemSetID;
|
||||
std::unordered_set<Item const*> EquippedItems;
|
||||
std::unordered_set<ItemSetSpellEntry const*> SetBonuses;
|
||||
};
|
||||
|
||||
#define MAX_GEM_SOCKETS MAX_ITEM_PROTO_SOCKETS// (BONUS_ENCHANTMENT_SLOT-SOCK_ENCHANTMENT_SLOT) and item proto size, equal value expected
|
||||
|
||||
#define MAX_ENCHANTMENT_OFFSET 3
|
||||
|
||||
@@ -363,8 +363,8 @@ Player::~Player()
|
||||
for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter)
|
||||
delete iter->second; //if item is duplicated... then server may crash ... but that item should be deallocated
|
||||
|
||||
for (size_t x = 0; x < ItemSetEff.size(); x++)
|
||||
delete ItemSetEff[x];
|
||||
for (ItemSetEffect* itemSetEff : ItemSetEff)
|
||||
DeleteItemSetEffects(itemSetEff);
|
||||
|
||||
for (uint8 i = 0; i < VOID_STORAGE_MAX_SLOT; ++i)
|
||||
delete _voidStorageItems[i];
|
||||
@@ -7818,25 +7818,7 @@ void Player::UpdateEquipSpellsAtFormChange()
|
||||
}
|
||||
}
|
||||
|
||||
UpdateItemSetAuras(true);
|
||||
}
|
||||
|
||||
void Player::UpdateItemSetAuras(bool formChange /*= false*/)
|
||||
{
|
||||
// item set bonuses not dependent from item broken state
|
||||
for (size_t setindex = 0; setindex < ItemSetEff.size(); ++setindex)
|
||||
{
|
||||
ItemSetEffect* eff = ItemSetEff[setindex];
|
||||
if (!eff)
|
||||
continue;
|
||||
|
||||
for (ItemSetSpellEntry const* itemSetSpell : eff->SetBonuses)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itemSetSpell->SpellID, DIFFICULTY_NONE);
|
||||
ApplyEquipSpell(spellInfo, nullptr, false, formChange); // remove spells that not fit to form - removal is skipped if shapeshift condition is satisfied
|
||||
ApplyEquipSpell(spellInfo, nullptr, true, formChange); // add spells that fit form but not active
|
||||
}
|
||||
}
|
||||
UpdateItemSetAuras(this, true);
|
||||
}
|
||||
|
||||
void Player::CastItemCombatSpell(DamageInfo const& damageInfo)
|
||||
@@ -27922,7 +27904,7 @@ void Player::SetActiveTalentGroup(uint8 group, bool withUpdate /*= true*/, bool
|
||||
SetPower(POWER_MANA, 0); // Mana must be 0 even if it isn't the active power type.
|
||||
|
||||
SetPower(pw, 0);
|
||||
UpdateItemSetAuras(false);
|
||||
UpdateItemSetAuras(this, false);
|
||||
// update visible transmog
|
||||
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
|
||||
if (Item* equippedItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||
|
||||
@@ -2320,7 +2320,6 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
void ApplyItemEquipSpell(Item* item, bool apply, bool formChange = false);
|
||||
void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool formChange = false);
|
||||
void UpdateEquipSpellsAtFormChange();
|
||||
void UpdateItemSetAuras(bool formChange = false);
|
||||
|
||||
void CastItemCombatSpell(DamageInfo const& damageInfo);
|
||||
void CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemTemplate const* proto);
|
||||
@@ -3191,6 +3190,8 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
|
||||
TC_GAME_API void AddItemsSetItem(Player* player, Item const* item);
|
||||
TC_GAME_API void RemoveItemsSetItem(Player* player, Item const* item);
|
||||
TC_GAME_API void UpdateItemSetAuras(Player* player, bool formChange);
|
||||
TC_GAME_API void DeleteItemSetEffects(ItemSetEffect* itemSetEffect);
|
||||
|
||||
// Transforms a container of customization choices with continuous storage into iterator pair that does not depend on container
|
||||
// and doesn't force implementations in header files
|
||||
|
||||
Reference in New Issue
Block a user