aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/SpellHandler.cpp')
-rw-r--r--src/game/SpellHandler.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 10b955fb7af..6caab76e061 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
@@ -55,6 +55,12 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
return;
}
+ if(pItem->GetGUID() != item_guid)
+ {
+ pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
+ return;
+ }
+
sLog.outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, spell_count: %u , cast_count: %u, Item: %u, data length = %i", bagIndex, slot, spell_count, cast_count, pItem->GetEntry(), recvPacket.size());
ItemPrototype const *proto = pItem->GetProto();
@@ -238,7 +244,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
uint32 flags = fields[1].GetUInt32();
pItem->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, 0);
- pItem->SetUInt32Value(OBJECT_FIELD_ENTRY, entry);
+ pItem->SetEntry(entry);
pItem->SetUInt32Value(ITEM_FIELD_FLAGS, flags);
pItem->SetState(ITEM_CHANGED, pUser);
delete result;
@@ -260,7 +266,6 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
CHECK_PACKET_SIZE(recv_data,8);
uint64 guid;
- uint32 spellId = OPEN_CHEST;
recv_data >> guid;
@@ -323,7 +328,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
}
Spell *spell = new Spell(_player, spellInfo, false);
- spell->m_cast_count = cast_count; //set count of casts
+ spell->m_cast_count = cast_count; // set count of casts
spell->prepare(&targets);
}
@@ -364,10 +369,11 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_CHARM ||
spellInfo->EffectApplyAuraName[i] == SPELL_AURA_BIND_SIGHT)
{
+ // Fix me: creature may be killed during player aura cancel
_player->RemoveAurasDueToSpellByCancel(spellId);
if (_player->GetCharm())
_player->GetCharm()->RemoveAurasDueToSpellByCancel(spellId);
- else if (_player->GetFarsightTarget()->GetTypeId() != TYPEID_DYNAMICOBJECT)
+ else if (_player->GetFarsightTarget() && _player->GetFarsightTarget()->GetTypeId() != TYPEID_DYNAMICOBJECT)
((Unit*)_player->GetFarsightTarget())->RemoveAurasDueToSpellByCancel(spellId);
return;
}