mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[10206] Implement ITEM_FLAGS2_HORDE_ONLY and ITEM_FLAGS2_ALLIANCE_ONLY
* Check item_template data * Check at equip/use * Skip at loot if not compatible * Skip in vendor list if not compatible
This commit is contained in:
parent
f2e3881a77
commit
9882bc811f
7 changed files with 84 additions and 52 deletions
|
|
@ -10477,8 +10477,9 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
|
|||
if (slot - BANK_SLOT_BAG_START >= GetBankBagSlotCount())
|
||||
return EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT;
|
||||
|
||||
if (uint8 cantuse = CanUseItem( pItem, not_loading ) != EQUIP_ERR_OK)
|
||||
return cantuse;
|
||||
res = CanUseItem( pItem, not_loading );
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
}
|
||||
|
||||
res = _CanStoreItem_InSpecificSlot(bag,slot,dest,pProto,count,swap,pItem);
|
||||
|
|
@ -10641,8 +10642,9 @@ uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const
|
|||
if (pItem->IsBindedNotWith(this))
|
||||
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
||||
|
||||
if ((pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0)
|
||||
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
|
||||
uint8 msg = CanUseItem(pProto);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
return msg;
|
||||
|
||||
if (uint32 item_use_skill = pItem->GetSkill())
|
||||
{
|
||||
|
|
@ -10682,52 +10684,47 @@ uint8 Player::CanUseItem( Item *pItem, bool not_loading ) const
|
|||
}
|
||||
}
|
||||
|
||||
if (pProto->RequiredSkill != 0)
|
||||
{
|
||||
if (GetSkillValue( pProto->RequiredSkill ) == 0)
|
||||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||
|
||||
if (GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank)
|
||||
return EQUIP_ERR_CANT_EQUIP_SKILL;
|
||||
}
|
||||
|
||||
if (pProto->RequiredSpell != 0 && !HasSpell(pProto->RequiredSpell))
|
||||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||
|
||||
if (pProto->RequiredReputationFaction && uint32(GetReputationRank(pProto->RequiredReputationFaction)) < pProto->RequiredReputationRank)
|
||||
return EQUIP_ERR_CANT_EQUIP_REPUTATION;
|
||||
|
||||
if (getLevel() < pProto->RequiredLevel)
|
||||
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
|
||||
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
}
|
||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||
}
|
||||
|
||||
bool Player::CanUseItem( ItemPrototype const *pProto )
|
||||
uint8 Player::CanUseItem( ItemPrototype const *pProto ) const
|
||||
{
|
||||
// Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
|
||||
|
||||
if( pProto )
|
||||
{
|
||||
if( (pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0 )
|
||||
return false;
|
||||
if ((pProto->Flags2 & ITEM_FLAGS2_HORDE_ONLY) && GetTeam() != HORDE)
|
||||
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
|
||||
|
||||
if ((pProto->Flags2 & ITEM_FLAGS2_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
|
||||
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
|
||||
|
||||
if ((pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0)
|
||||
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
|
||||
|
||||
if( pProto->RequiredSkill != 0 )
|
||||
{
|
||||
if( GetSkillValue( pProto->RequiredSkill ) == 0 )
|
||||
return false;
|
||||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||
else if( GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank )
|
||||
return false;
|
||||
return EQUIP_ERR_CANT_EQUIP_SKILL;
|
||||
}
|
||||
|
||||
if( pProto->RequiredSpell != 0 && !HasSpell( pProto->RequiredSpell ) )
|
||||
return false;
|
||||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||
|
||||
if( getLevel() < pProto->RequiredLevel )
|
||||
return false;
|
||||
return true;
|
||||
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
|
||||
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
return false;
|
||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||
}
|
||||
|
||||
uint8 Player::CanUseAmmo( uint32 item ) const
|
||||
|
|
@ -10742,22 +10739,14 @@ uint8 Player::CanUseAmmo( uint32 item ) const
|
|||
{
|
||||
if( pProto->InventoryType!= INVTYPE_AMMO )
|
||||
return EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE;
|
||||
if( (pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0 )
|
||||
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
|
||||
if( pProto->RequiredSkill != 0 )
|
||||
{
|
||||
if( GetSkillValue( pProto->RequiredSkill ) == 0 )
|
||||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||
else if( GetSkillValue( pProto->RequiredSkill ) < pProto->RequiredSkillRank )
|
||||
return EQUIP_ERR_CANT_EQUIP_SKILL;
|
||||
}
|
||||
if( pProto->RequiredSpell != 0 && !HasSpell( pProto->RequiredSpell ) )
|
||||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||
/*if( GetReputationMgr().GetReputation() < pProto->RequiredReputation )
|
||||
|
||||
uint8 msg = CanUseItem(pProto);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
return msg;
|
||||
|
||||
/*if ( GetReputationMgr().GetReputation() < pProto->RequiredReputation )
|
||||
return EQUIP_ERR_CANT_EQUIP_REPUTATION;
|
||||
*/
|
||||
if( getLevel() < pProto->RequiredLevel )
|
||||
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
|
||||
|
||||
// Requires No Ammo
|
||||
if(GetDummyAura(46699))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue