mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Implement one hand wielding two-hand weapon ability (warrior talent 46917)
Signed-off-by: TERRANZ <TERRANZ@mangos.ru> Small slot checking fixes and make dual wielding dependent from related ability. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
4f55ef857a
commit
558909614a
4 changed files with 53 additions and 35 deletions
|
|
@ -366,6 +366,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
|
||||||
m_canParry = false;
|
m_canParry = false;
|
||||||
m_canBlock = false;
|
m_canBlock = false;
|
||||||
m_canDualWield = false;
|
m_canDualWield = false;
|
||||||
|
m_canTitanGrip = false;
|
||||||
m_ammoDPS = 0.0f;
|
m_ammoDPS = 0.0f;
|
||||||
|
|
||||||
m_temporaryUnsummonedPetNumber = 0;
|
m_temporaryUnsummonedPetNumber = 0;
|
||||||
|
|
@ -7984,7 +7985,8 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap
|
||||||
// (this will be replace mainhand weapon at auto equip instead unwonted "you don't known dual wielding" ...
|
// (this will be replace mainhand weapon at auto equip instead unwonted "you don't known dual wielding" ...
|
||||||
if(CanDualWield())
|
if(CanDualWield())
|
||||||
slots[1] = EQUIPMENT_SLOT_OFFHAND;
|
slots[1] = EQUIPMENT_SLOT_OFFHAND;
|
||||||
};break;
|
break;
|
||||||
|
};
|
||||||
case INVTYPE_SHIELD:
|
case INVTYPE_SHIELD:
|
||||||
slots[0] = EQUIPMENT_SLOT_OFFHAND;
|
slots[0] = EQUIPMENT_SLOT_OFFHAND;
|
||||||
break;
|
break;
|
||||||
|
|
@ -7993,6 +7995,8 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap
|
||||||
break;
|
break;
|
||||||
case INVTYPE_2HWEAPON:
|
case INVTYPE_2HWEAPON:
|
||||||
slots[0] = EQUIPMENT_SLOT_MAINHAND;
|
slots[0] = EQUIPMENT_SLOT_MAINHAND;
|
||||||
|
if (CanDualWield() && CanTitanGrip())
|
||||||
|
slots[1] = EQUIPMENT_SLOT_OFFHAND;
|
||||||
break;
|
break;
|
||||||
case INVTYPE_TABARD:
|
case INVTYPE_TABARD:
|
||||||
slots[0] = EQUIPMENT_SLOT_TABARD;
|
slots[0] = EQUIPMENT_SLOT_TABARD;
|
||||||
|
|
@ -8067,14 +8071,8 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap
|
||||||
{
|
{
|
||||||
if ( slots[i] != NULL_SLOT && !GetItemByPos( INVENTORY_SLOT_BAG_0, slots[i] ) )
|
if ( slots[i] != NULL_SLOT && !GetItemByPos( INVENTORY_SLOT_BAG_0, slots[i] ) )
|
||||||
{
|
{
|
||||||
// in case 2hand equipped weapon offhand slot empty but not free
|
// in case 2hand equipped weapon (without titan grip) offhand slot empty but not free
|
||||||
if(slots[i]==EQUIPMENT_SLOT_OFFHAND)
|
if(slots[i]!=EQUIPMENT_SLOT_OFFHAND || !IsTwoHandUsed())
|
||||||
{
|
|
||||||
Item* mainItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND );
|
|
||||||
if(!mainItem || mainItem->GetProto()->InventoryType != INVTYPE_2HWEAPON)
|
|
||||||
return slots[i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return slots[i];
|
return slots[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -9751,33 +9749,42 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
|
||||||
|
|
||||||
if(eslot == EQUIPMENT_SLOT_OFFHAND)
|
if(eslot == EQUIPMENT_SLOT_OFFHAND)
|
||||||
{
|
{
|
||||||
if( type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND )
|
if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
|
||||||
{
|
{
|
||||||
if(!CanDualWield())
|
if(!CanDualWield())
|
||||||
return EQUIP_ERR_CANT_DUAL_WIELD;
|
return EQUIP_ERR_CANT_DUAL_WIELD;
|
||||||
}
|
}
|
||||||
|
else if (type == INVTYPE_2HWEAPON)
|
||||||
Item *mainItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND );
|
|
||||||
if(mainItem)
|
|
||||||
{
|
{
|
||||||
if(mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON)
|
if(!CanDualWield() || !CanTitanGrip())
|
||||||
return EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED;
|
return EQUIP_ERR_CANT_DUAL_WIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(IsTwoHandUsed())
|
||||||
|
return EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// equip two-hand weapon case (with possible unequip 2 items)
|
// equip two-hand weapon case (with possible unequip 2 items)
|
||||||
if( type == INVTYPE_2HWEAPON )
|
if( type == INVTYPE_2HWEAPON )
|
||||||
{
|
{
|
||||||
if(eslot != EQUIPMENT_SLOT_MAINHAND)
|
if (eslot == EQUIPMENT_SLOT_OFFHAND)
|
||||||
|
{
|
||||||
|
if (!CanTitanGrip())
|
||||||
|
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
|
||||||
|
}
|
||||||
|
else if (eslot != EQUIPMENT_SLOT_MAINHAND)
|
||||||
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
|
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
|
||||||
|
|
||||||
// offhand item must can be stored in inventory for offhand item and it also must be unequipped
|
if (!CanTitanGrip())
|
||||||
Item *offItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND );
|
{
|
||||||
ItemPosCountVec off_dest;
|
// offhand item must can be stored in inventory for offhand item and it also must be unequipped
|
||||||
if( offItem && (!not_loading ||
|
Item *offItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND );
|
||||||
CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND,false) != EQUIP_ERR_OK ||
|
ItemPosCountVec off_dest;
|
||||||
CanStoreItem( NULL_BAG, NULL_SLOT, off_dest, offItem, false ) != EQUIP_ERR_OK ) )
|
if( offItem && (!not_loading ||
|
||||||
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_INVENTORY_FULL;
|
CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND,false) != EQUIP_ERR_OK ||
|
||||||
|
CanStoreItem( NULL_BAG, NULL_SLOT, off_dest, offItem, false ) != EQUIP_ERR_OK ) )
|
||||||
|
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_INVENTORY_FULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dest = ((INVENTORY_SLOT_BAG_0 << 8) | eslot);
|
dest = ((INVENTORY_SLOT_BAG_0 << 8) | eslot);
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
|
|
@ -18184,9 +18191,8 @@ void Player::AutoUnequipOffhandIfNeed()
|
||||||
if(!offItem)
|
if(!offItem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Item *mainItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND );
|
// need unequip for 2h-weapon without TitanGrip
|
||||||
|
if (!IsTwoHandUsed())
|
||||||
if(!mainItem || mainItem->GetProto()->InventoryType != INVTYPE_2HWEAPON)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemPosCountVec off_dest;
|
ItemPosCountVec off_dest;
|
||||||
|
|
|
||||||
|
|
@ -1179,6 +1179,11 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
// disarm applied only to mainhand weapon
|
// disarm applied only to mainhand weapon
|
||||||
return !IsInFeralForm() && (!mainhand || !HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISARMED) );
|
return !IsInFeralForm() && (!mainhand || !HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISARMED) );
|
||||||
}
|
}
|
||||||
|
bool IsTwoHandUsed() const
|
||||||
|
{
|
||||||
|
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||||
|
return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
|
||||||
|
}
|
||||||
void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false );
|
void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false );
|
||||||
bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint64 bagguid, uint8 slot);
|
bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint64 bagguid, uint8 slot);
|
||||||
|
|
||||||
|
|
@ -1817,6 +1822,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void SetCanBlock(bool value);
|
void SetCanBlock(bool value);
|
||||||
bool CanDualWield() const { return m_canDualWield; }
|
bool CanDualWield() const { return m_canDualWield; }
|
||||||
void SetCanDualWield(bool value) { m_canDualWield = value; }
|
void SetCanDualWield(bool value) { m_canDualWield = value; }
|
||||||
|
bool CanTitanGrip() const { return m_canTitanGrip ; }
|
||||||
|
void SetCanTitanGrip(bool value) { m_canTitanGrip = value; }
|
||||||
|
|
||||||
void SetRegularAttackTime();
|
void SetRegularAttackTime();
|
||||||
void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; }
|
void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; }
|
||||||
|
|
@ -2309,8 +2316,10 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
bool m_canParry;
|
bool m_canParry;
|
||||||
bool m_canBlock;
|
bool m_canBlock;
|
||||||
bool m_canDualWield;
|
bool m_canDualWield;
|
||||||
|
bool m_canTitanGrip;
|
||||||
uint8 m_swingErrorMsg;
|
uint8 m_swingErrorMsg;
|
||||||
float m_ammoDPS;
|
float m_ammoDPS;
|
||||||
|
|
||||||
////////////////////Rest System/////////////////////
|
////////////////////Rest System/////////////////////
|
||||||
int time_inn_enter;
|
int time_inn_enter;
|
||||||
uint32 inn_pos_mapid;
|
uint32 inn_pos_mapid;
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,7 @@ class Spell
|
||||||
void EffectKillCredit(uint32 i);
|
void EffectKillCredit(uint32 i);
|
||||||
void EffectQuestFail(uint32 i);
|
void EffectQuestFail(uint32 i);
|
||||||
void EffectActivateRune(uint32 i);
|
void EffectActivateRune(uint32 i);
|
||||||
|
void EffectTitanGrip(uint32 i);
|
||||||
|
|
||||||
Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL );
|
Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL );
|
||||||
~Spell();
|
~Spell();
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
||||||
&Spell::EffectNULL, //152 SPELL_EFFECT_152 summon Refer-a-Friend
|
&Spell::EffectNULL, //152 SPELL_EFFECT_152 summon Refer-a-Friend
|
||||||
&Spell::EffectNULL, //153 SPELL_EFFECT_CREATE_PET misc value is creature entry
|
&Spell::EffectNULL, //153 SPELL_EFFECT_CREATE_PET misc value is creature entry
|
||||||
&Spell::EffectNULL, //154 unused
|
&Spell::EffectNULL, //154 unused
|
||||||
&Spell::EffectNULL, //155 Allows you to equip two-handed axes, maces and swords in one hand, but you attack $49152s1% slower than normal.
|
&Spell::EffectTitanGrip, //155 Allows you to equip two-handed axes, maces and swords in one hand, but you attack $49152s1% slower than normal.
|
||||||
&Spell::EffectNULL, //156 Add Socket
|
&Spell::EffectNULL, //156 Add Socket
|
||||||
&Spell::EffectNULL, //157 create/learn random item/spell for profession
|
&Spell::EffectNULL, //157 create/learn random item/spell for profession
|
||||||
&Spell::EffectMilling, //158 milling
|
&Spell::EffectMilling, //158 milling
|
||||||
|
|
@ -3443,7 +3443,7 @@ void Spell::EffectDispel(uint32 i)
|
||||||
|
|
||||||
void Spell::EffectDualWield(uint32 /*i*/)
|
void Spell::EffectDualWield(uint32 /*i*/)
|
||||||
{
|
{
|
||||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
|
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||||
((Player*)unitTarget)->SetCanDualWield(true);
|
((Player*)unitTarget)->SetCanDualWield(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5532,18 +5532,14 @@ void Spell::EffectAddExtraAttacks(uint32 /*i*/)
|
||||||
|
|
||||||
void Spell::EffectParry(uint32 /*i*/)
|
void Spell::EffectParry(uint32 /*i*/)
|
||||||
{
|
{
|
||||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
|
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
|
||||||
((Player*)unitTarget)->SetCanParry(true);
|
((Player*)unitTarget)->SetCanParry(true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectBlock(uint32 /*i*/)
|
void Spell::EffectBlock(uint32 /*i*/)
|
||||||
{
|
{
|
||||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||||
return;
|
((Player*)unitTarget)->SetCanBlock(true);
|
||||||
|
|
||||||
((Player*)unitTarget)->SetCanBlock(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectMomentMove(uint32 i)
|
void Spell::EffectMomentMove(uint32 i)
|
||||||
|
|
@ -6340,3 +6336,9 @@ void Spell::EffectActivateRune(uint32 i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Spell::EffectTitanGrip(uint32 i)
|
||||||
|
{
|
||||||
|
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
((Player*)unitTarget)->SetCanTitanGrip(true);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue