All pastes #907370 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-02-17 15:29 UTC
rendered paste body
Index: src/game/NPCHandler.cpp
===================================================================
--- src/game/NPCHandler.cpp	(revision 5237)
+++ src/game/NPCHandler.cpp	(working copy)
@@ -414,7 +414,7 @@
     _player->m_homebindX = _player->GetPositionX();
     _player->m_homebindY = _player->GetPositionY();
     _player->m_homebindZ = _player->GetPositionZ();
-
+/*
     // if a player lost/dropped hist hearthstone, he will get a new one
     if ( !_player->HasItemCount(hearthstone_itemid, 1) && _player->GetBankItemCount(hearthstone_itemid) <1)
     {
@@ -429,33 +429,12 @@
         {
             _player->SendEquipError( msg, NULL, NULL );
         }
-    }
+    }*/
 
     // send spell for bind 3286 bind magic
-    WorldPacket data(SMSG_SPELL_START, (8+8+4+2+4+2+8) );
-    data.append(npc->GetPackGUID());
-    data.append(npc->GetPackGUID());
-    data << bindspell;                                      // spell id
-    data << uint8(0);                                       // unk 2.3.0
-    data << uint16(0);                                      // cast flags
-    data << uint32(0);                                      // time
-    data << uint16(0x0002);                                 // target mask
-    data.append(_player->GetPackGUID());                    // target's packed guid
-    SendPacket( &data );
+    npc->CastSpell(_player, bindspell, true);
 
-    data.Initialize(SMSG_SPELL_GO, (8+8+4+2+1+8+1+2+8));
-    data.append(npc->GetPackGUID());
-    data.append(npc->GetPackGUID());
-    data << bindspell;                                      // spell id
-    data << uint16(0x0100);                                 // cast flags
-    data << uint8(0x01);                                    // targets count
-    data << _player->GetGUID();                             // target's full guid
-    data << uint8(0x00);                                    // ?
-    data << uint16(0x0002);                                 // target mask
-    data.append(_player->GetPackGUID());                    // target's packed guid
-    SendPacket( &data );
-
-    data.Initialize( SMSG_TRAINER_BUY_SUCCEEDED, (8+4));
+    WorldPacket data( SMSG_TRAINER_BUY_SUCCEEDED, (8+4));
     data << npc->GetGUID();
     data << bindspell;
     SendPacket( &data );
Index: src/game/SkillHandler.cpp
===================================================================
--- src/game/SkillHandler.cpp	(revision 5237)
+++ src/game/SkillHandler.cpp	(working copy)
@@ -162,20 +162,8 @@
         return;
     }
 
-    // send spell 14867
-    WorldPacket data(SMSG_SPELL_START, (2+2+2+4+2+8+8));
-    data.append(_player->GetPackGUID());
-    data.append(unit->GetPackGUID());
-    data << uint16(14867) << uint8(0);
-    data << uint16(0x00) << uint16(0x0F) << uint32(0x00)<< uint16(0x00);
-    SendPacket( &data );
+    unit->CastSpell(_player, 14867, true);                  //spell: "Untalent Visual Effect"
 
-    data.Initialize(SMSG_SPELL_GO, (2+2+1+1+1+8+4+2+2+8+8));
-    data.append(_player->GetPackGUID());
-    data.append(unit->GetPackGUID());
-    data << uint16(14867) << uint16(0x00) << uint8(0x0D) <<  uint8(0x01)<< uint8(0x01) << _player->GetGUID();
-    data << uint32(0x00) << uint16(0x0200) << uint16(0x00);
-    SendPacket( &data );
 }
 
 void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data)
Index: src/game/SpellEffects.cpp
===================================================================
--- src/game/SpellEffects.cpp	(revision 5237)
+++ src/game/SpellEffects.cpp	(working copy)
@@ -1861,10 +1861,10 @@
 
 void Spell::DoCreateItem(uint32 i, uint32 itemtype)
 {
-    if (m_caster->GetTypeId() != TYPEID_PLAYER)
+    if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
         return;
 
-    Player* player = (Player*)m_caster;
+    Player* player = (Player*)unitTarget;
 
     uint32 newitemid = itemtype;
     ItemPrototype const *pProto = objmgr.GetItemPrototype( newitemid );