mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7368] Implement unequip unexpected offhand weapons at talent reset (mostly for warror talent case).
Signed-off-by: VladimirMangos <vladimir@getmangos.com> Implemented OffhandCheckAtTalentsReset option for unequip at zone change (default) and at talent reset itself (can be enabled).
This commit is contained in:
parent
98750bd95b
commit
2f02dc7642
5 changed files with 32 additions and 4 deletions
|
|
@ -3342,6 +3342,13 @@ bool Player::resetTalents(bool no_cost)
|
|||
//FIXME: remove pet before or after unlearn spells? for now after unlearn to allow removing of talent related, pet affecting auras
|
||||
RemovePet(NULL,PET_SAVE_NOT_IN_SLOT, true);
|
||||
|
||||
if(m_canTitanGrip)
|
||||
{
|
||||
m_canTitanGrip = false;
|
||||
if(sWorld.getConfig(CONFIG_OFFHAND_CHECK_AT_TALENTS_RESET))
|
||||
AutoUnequipOffhandIfNeed();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -6417,6 +6424,9 @@ void Player::UpdateZone(uint32 newZone)
|
|||
if(isAlive())
|
||||
DestroyZoneLimitedItem( true, newZone );
|
||||
|
||||
// check some item equip limitations (in result lost CanTitanGrip at talent reset, for example)
|
||||
AutoUnequipOffhandIfNeed();
|
||||
|
||||
// recent client version not send leave/join channel packets for built-in local channels
|
||||
UpdateLocalChannels( newZone );
|
||||
|
||||
|
|
@ -18806,8 +18816,8 @@ void Player::AutoUnequipOffhandIfNeed()
|
|||
if(!offItem)
|
||||
return;
|
||||
|
||||
// need unequip for 2h-weapon without TitanGrip
|
||||
if (!IsTwoHandUsed())
|
||||
// need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
|
||||
if (CanTitanGrip() || (offItem->GetProto()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed()))
|
||||
return;
|
||||
|
||||
ItemPosCountVec off_dest;
|
||||
|
|
@ -18819,7 +18829,16 @@ void Player::AutoUnequipOffhandIfNeed()
|
|||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("Player::EquipItem: Can's store offhand item at 2hand item equip for player (GUID: %u).",GetGUIDLow());
|
||||
MailItemsInfo mi;
|
||||
mi.AddItem(offItem->GetGUIDLow(), offItem->GetEntry(), offItem);
|
||||
MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND, true);
|
||||
CharacterDatabase.BeginTransaction();
|
||||
offItem->DeleteFromInventoryDB(); // deletes item from character's inventory
|
||||
offItem->SaveToDB(); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
std::string subject = GetSession()->GetMangosString(LANG_NOT_EQUIPPED_ITEM);
|
||||
WorldSession::SendMailTo(this, MAIL_NORMAL, MAIL_STATIONERY_GM, GetGUIDLow(), GetGUIDLow(), subject, 0, &mi, 0, 0, MAIL_CHECK_MASK_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue