mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 07:07:29 +01:00
Revert "Core: more more cleanup" - Build test anyone?
This reverts commit 20cd4c71ee.
This commit is contained in:
@@ -86,53 +86,53 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
Item* item = pUser->GetUseableItemByPos(bagIndex, slot);
|
||||
if (!item)
|
||||
Item* pItem = pUser->GetUseableItemByPos(bagIndex, slot);
|
||||
if (!pItem)
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetGUID() != itemGUID)
|
||||
if (pItem->GetGUID() != itemGUID)
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
sLog->outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, item->GetEntry(), glyphIndex, (uint32)recvPacket.size());
|
||||
sLog->outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size());
|
||||
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
ItemTemplate const* proto = pItem->GetTemplate();
|
||||
if (!proto)
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// some item classes can be used only in equipped state
|
||||
if (proto->InventoryType != INVTYPE_NON_EQUIP && !item->IsEquipped())
|
||||
if (proto->InventoryType != INVTYPE_NON_EQUIP && !pItem->IsEquipped())
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
InventoryResult msg = pUser->CanUseItem(item);
|
||||
InventoryResult msg = pUser->CanUseItem(pItem);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pUser->SendEquipError(msg, item, NULL);
|
||||
pUser->SendEquipError(msg, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// only allow conjured consumable, bandage, poisons (all should have the 2^21 item flag set in DB)
|
||||
if (proto->Class == ITEM_CLASS_CONSUMABLE && !(proto->Flags & ITEM_PROTO_FLAG_USEABLE_IN_ARENA) && pUser->InArena())
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// don't allow items banned in arena
|
||||
if (proto->Flags & ITEM_PROTO_FLAG_NOT_USEABLE_IN_ARENA && pUser->InArena())
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
if (!spellInfo->CanBeUsedInCombat())
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, item, NULL);
|
||||
pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -152,12 +152,12 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
|
||||
// check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
|
||||
if (item->GetTemplate()->Bonding == BIND_WHEN_USE || item->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || item->GetTemplate()->Bonding == BIND_QUEST_ITEM)
|
||||
if (pItem->GetTemplate()->Bonding == BIND_WHEN_USE || pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM)
|
||||
{
|
||||
if (!item->IsSoulBound())
|
||||
if (!pItem->IsSoulBound())
|
||||
{
|
||||
item->SetState(ITEM_CHANGED, pUser);
|
||||
item->SetBinding(true);
|
||||
pItem->SetState(ITEM_CHANGED, pUser);
|
||||
pItem->SetBinding(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,10 +166,10 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
HandleClientCastFlags(recvPacket, castFlags, targets);
|
||||
|
||||
// Note: If script stop casting it must send appropriate data to client to prevent stuck item in gray state.
|
||||
if (!sScriptMgr->OnItemUse(pUser, item, targets))
|
||||
if (!sScriptMgr->OnItemUse(pUser, pItem, targets))
|
||||
{
|
||||
// no script or script not process request by self
|
||||
pUser->CastItemUseSpell(item, targets, castCount, glyphIndex);
|
||||
pUser->CastItemUseSpell(pItem, targets, castCount, glyphIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user