aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDDuarte <dnpd.dd@gmail.com>2014-08-23 16:30:45 +0100
committerDDuarte <dnpd.dd@gmail.com>2014-08-23 16:30:45 +0100
commitf5f9df0483fbf847eb9ee4e6ec4ecc6cf66d3a47 (patch)
tree3655c2d722d7e426ad9c940c8a4c1bea6125d435 /src
parent1255434882777053bca06656786abc1a598deda9 (diff)
Core/Auctionhouse: Better fix for 809fb9894ec5ee5a
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp12
-rw-r--r--src/server/game/Entities/Player/Player.cpp51
2 files changed, 29 insertions, 34 deletions
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 6d8e695f02a..f4699f0519e 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -544,16 +544,8 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
continue;
- if (usable != 0x00)
- {
- if (player->CanUseItem(item) != EQUIP_ERR_OK)
- continue;
-
- if (proto->Class == ITEM_CLASS_RECIPE)
- if (SpellEntry const* spell = sSpellStore.LookupEntry(proto->Spells[0].SpellId))
- if (player->HasSpell(spell->EffectTriggerSpell[EFFECT_INDEX_0]))
- continue;
- }
+ if (usable != 0x00 && player->CanUseItem(item) != EQUIP_ERR_OK)
+ continue;
// Allow search by suffix (ie: of the Monkey) or partial name (ie: Monkey)
// No need to do any of this if no search term was entered
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index c9ac4e73374..357e1a34c09 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeam() != HORDE)
- return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
+ if (!proto)
+ return EQUIP_ERR_ITEM_NOT_FOUND;
- if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
- return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
+ if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeam() != HORDE)
+ 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->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeam() != ALLIANCE)
+ 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->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
+ return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
- if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
+ 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 (getLevel() < proto->RequiredLevel)
- return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
+ if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
+ return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
- // 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;
+ if (getLevel() < proto->RequiredLevel)
+ return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
- return EQUIP_ERR_OK;
- }
+ // 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_ITEM_NOT_FOUND;
+ // 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