From 5e9b5a529737bb9aecec92bfc9994568b8ca75f0 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 21 Sep 2010 10:34:01 +0400 Subject: [PATCH] [10512] Fixed cast item remove at trade enchanting in some cases Also nit allow item use spels casts if item in trade. --- src/game/Spell.cpp | 5 ++++- src/game/SpellHandler.cpp | 8 ++++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 77a0bd499..f4cab1a3f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3892,7 +3892,7 @@ void Spell::TakeCastItem() return; // not remove cast item at triggered spell (equipping, weapon damage, etc) - if(m_IsTriggeredSpell) + if(m_IsTriggeredSpell && !(m_targets.m_targetMask & TARGET_FLAG_TRADE_ITEM)) return; ItemPrototype const *proto = m_CastItem->GetProto(); @@ -5726,6 +5726,9 @@ SpellCastResult Spell::CheckItems() // cast item checks if(m_CastItem) { + if (m_CastItem->IsInTrade()) + return SPELL_FAILED_ITEM_NOT_FOUND; + uint32 itemid = m_CastItem->GetEntry(); if( !p_caster->HasItemCount(itemid, 1) ) return SPELL_FAILED_ITEM_NOT_FOUND; diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 2f25c48c7..73ea8710d 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -99,6 +99,14 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } + // not allow use item from trade (cheat way only) + if (pItem->IsInTrade()) + { + recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, 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_FLAGS_USEABLE_IN_ARENA) && diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1b61c633f..d4567e9e7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10511" + #define REVISION_NR "10512" #endif // __REVISION_NR_H__