mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Updated spells stuff
This commit is contained in:
parent
f7049657c9
commit
629da9de32
9 changed files with 479 additions and 370 deletions
|
|
@ -35,15 +35,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)
|
||||
|
|
@ -58,7 +60,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)
|
||||
|
|
@ -125,14 +127,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;
|
||||
}
|
||||
|
|
@ -169,7 +172,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;
|
||||
|
|
@ -224,7 +228,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;
|
||||
|
|
@ -260,10 +264,9 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
|||
|
||||
void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8);
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
uint64 guid;
|
||||
uint32 spellId = OPEN_CHEST;
|
||||
|
||||
recv_data >> guid;
|
||||
|
||||
|
|
@ -281,15 +284,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 );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue