Core/Auctionhouse: Better fix for 809fb9894e

This commit is contained in:
DDuarte committed 2014-08-23 16:30:45 +01:00
1 parent 1255434882
commit f5f9df0483
2 files changed
+34 -39

No files matched your search

+32 -29
View File
@@ -11976,39 +11976,42 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
{
// Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
if (proto)
if (!proto)
return EQUIP_ERR_ITEM_NOT_FOUND;
if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeam() != HORDE)
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if (proto->RequiredSkill != 0)
{
if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeam() != HORDE)
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if (proto->RequiredSkill != 0)
{
if (GetSkillValue(proto->RequiredSkill) == 0)
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
return EQUIP_ERR_CANT_EQUIP_SKILL;
}
if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
if (GetSkillValue(proto->RequiredSkill) == 0)
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
if (getLevel() < proto->RequiredLevel)
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
// If World Event is not active, prevent using event dependant items
if (proto->HolidayId && !IsHolidayActive((HolidayIds)proto->HolidayId))
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
return EQUIP_ERR_OK;
else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
return EQUIP_ERR_CANT_EQUIP_SKILL;
}
return EQUIP_ERR_ITEM_NOT_FOUND;
if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
if (getLevel() < proto->RequiredLevel)
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
// If World Event is not active, prevent using event dependant items
if (proto->HolidayId && !IsHolidayActive((HolidayIds)proto->HolidayId))
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
// learning (recipes, mounts, pets, etc.)
if (proto->Spells[0].SpellId == 483 || proto->Spells[0].SpellId == 55884)
if (HasSpell(proto->Spells[1].SpellId))
return EQUIP_ERR_NONE;
return EQUIP_ERR_OK;
}
InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObject const* lootedObject) const