diff options
author | Machiavelli <none@none> | 2009-06-09 21:56:56 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2009-06-09 21:56:56 +0200 |
commit | 1afdfd91066805cac42e4d73fcac78591c139c89 (patch) | |
tree | fdeb525bd9bd8dd84351dea70e0c8766a04a101d /src/game/SpellHandler.cpp | |
parent | 41baf8b0d34dba1bd579831fe77bcc785f857f9b (diff) | |
parent | c5232138f870a8a4e5a59ecb3e0a3228373f58e2 (diff) |
Merge
--HG--
branch : trunk
Diffstat (limited to 'src/game/SpellHandler.cpp')
-rw-r--r-- | src/game/SpellHandler.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 7e72fd4e749..b3655448a1a 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -123,9 +123,29 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) } SpellCastTargets targets; - if(!targets.read(&recvPacket, pUser)) + if (!targets.read(&recvPacket, pUser)) return; + targets.Update(pUser); + + if (!pItem->IsTargetValidForItemUse(targets.getUnitTarget())) + { + // free greay item aftre use faul + pUser->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); + + // send spell error + if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid)) + { + // for implicit area/coord target spells + if(!targets.getUnitTarget()) + Spell::SendCastResult(_player,spellInfo,cast_count,SPELL_FAILED_NO_VALID_TARGETS); + // for explicit target spells + else + Spell::SendCastResult(_player,spellInfo,cast_count,SPELL_FAILED_BAD_TARGETS); + } + return; + } + //Note: If script stop casting it must send appropriate data to client to prevent stuck item in gray state. if(!Script->ItemUse(pUser,pItem,targets)) { @@ -313,6 +333,12 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) } } + // Client is resending autoshot cast opcode when other spell is casted during shoot rotation + // Skip it to prevent "interrupt" message + if (IsAutoRepeatRangedSpell(spellInfo) && _player->m_currentSpells[CURRENT_AUTOREPEAT_SPELL] + && _player->m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo == spellInfo) + return; + // can't use our own spells when we're in possession of another unit, if(_player->isPossessing()) return; |