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.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 9b77e19b30b..d31c5610ee8 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -38,15 +38,17 @@
void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
{
// TODO: add targets.read() check
- CHECK_PACKET_SIZE(recvPacket,1+1+1+1+8);
+ CHECK_PACKET_SIZE(recvPacket,1+1+1+4+8+4+1);
Player* pUser = _player;
uint8 bagIndex, slot;
- uint8 spell_count; // number of spells at item, not used
+ uint8 unk_flags; // flags (if 0x02 - some additional data are received)
uint8 cast_count; // next cast if exists (single or not)
uint64 item_guid;
+ uint32 glyphIndex; // something to do with glyphs?
+ uint32 spellid; // casted spell id
- recvPacket >> bagIndex >> slot >> spell_count >> cast_count >> item_guid;
+ recvPacket >> bagIndex >> slot >> cast_count >> spellid >> item_guid >> glyphIndex >> unk_flags;
Item *pItem = pUser->GetItemByPos(bagIndex, slot);
if(!pItem)
@@ -61,7 +63,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
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());
+ sLog.outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, cast_count: %u, spellid: %u, Item: %u, glyphIndex: %u, unk_flags: %u, data length = %i", bagIndex, slot, cast_count, spellid, pItem->GetEntry(), glyphIndex, unk_flags, recvPacket.size());
ItemPrototype const *proto = pItem->GetProto();
if(!proto)
@@ -128,14 +130,15 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
// no script or script not process request by self
// special learning case
- if(pItem->GetProto()->Spells[0].SpellId==SPELL_ID_GENERIC_LEARN)
+ if((pItem->GetProto()->Spells[0].SpellId==SPELL_ID_GENERIC_LEARN) || (pItem->GetProto()->Spells[0].SpellId==SPELL_ID_GENERIC_LEARN_PET))
{
+ uint32 learn_spell_id = pItem->GetProto()->Spells[0].SpellId;
uint32 learning_spell_id = pItem->GetProto()->Spells[1].SpellId;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(SPELL_ID_GENERIC_LEARN);
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry(learn_spell_id);
if(!spellInfo)
{
- sLog.outError("Item (Entry: %u) in have wrong spell id %u, ignoring ",proto->ItemId, SPELL_ID_GENERIC_LEARN);
+ sLog.outError("Item (Entry: %u) in have wrong spell id %u, ignoring ",proto->ItemId, learn_spell_id);
pUser->SendEquipError(EQUIP_ERR_NONE,pItem,NULL);
return;
}
@@ -172,7 +175,8 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
Spell *spell = new Spell(pUser, spellInfo, (count > 0));
spell->m_CastItem = pItem;
- spell->m_cast_count = cast_count; //set count of casts
+ spell->m_cast_count = cast_count; // set count of casts
+ spell->m_glyphIndex = glyphIndex; // glyph index
spell->prepare(&targets);
++count;
@@ -227,7 +231,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
}
// required picklocking
- if(lockInfo->requiredlockskill || lockInfo->requiredminingskill)
+ if(lockInfo->Skill[1] || lockInfo->Skill[0])
{
pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL );
return;
@@ -283,15 +287,16 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
{
- CHECK_PACKET_SIZE(recvPacket,4+1+2);
+ CHECK_PACKET_SIZE(recvPacket,1+4+1);
uint32 spellId;
- uint8 cast_count;
- recvPacket >> spellId;
+ uint8 cast_count, unk_flags;
recvPacket >> cast_count;
+ recvPacket >> spellId;
+ recvPacket >> unk_flags; // flags (if 0x02 - some additional data are received)
- sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u data length = %i",
- spellId, cast_count, recvPacket.size());
+ sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i",
+ spellId, cast_count, unk_flags, recvPacket.size());
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
@@ -334,9 +339,12 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket)
{
- CHECK_PACKET_SIZE(recvPacket,4);
+ CHECK_PACKET_SIZE(recvPacket,5);
+ // increments with every CANCEL packet, don't use for now
+ uint8 counter;
uint32 spellId;
+ recvPacket >> counter;
recvPacket >> spellId;
//FIXME: hack, ignore unexpected client cancel Deadly Throw cast