aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/SpellHandler.cpp
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
committerariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
commit85a7d5ce9ac68b30da2277cc91d4b70358f1880d (patch)
treedf3d2084ee2e35008903c03178039b9c986e2d08 /src/server/game/Handlers/SpellHandler.cpp
parent052fc24315ace866ea1cf610e85df119b68100c9 (diff)
Core: ported headers cleanup from master branch
Diffstat (limited to 'src/server/game/Handlers/SpellHandler.cpp')
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp49
1 files changed, 26 insertions, 23 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index bea6cb7bbe5..e5336d4af21 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -16,22 +16,26 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
#include "Common.h"
+#include "Config.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
#include "DBCStores.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
+#include "Item.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "SpellMgr.h"
-#include "Log.h"
#include "Opcodes.h"
-#include "Spell.h"
-#include "Totem.h"
+#include "Player.h"
#include "ScriptMgr.h"
-#include "GameObjectAI.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
-#include "Player.h"
-#include "Config.h"
-#include "QueryCallback.h"
+#include "SpellMgr.h"
+#include "Totem.h"
+#include "World.h"
+#include "WorldPacket.h"
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
{
@@ -75,20 +79,20 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
if (glyphIndex >= MAX_GLYPH_SLOT_INDEX)
{
- pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
+ pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
return;
}
Item* pItem = pUser->GetUseableItemByPos(bagIndex, slot);
if (!pItem)
{
- pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
+ pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
return;
}
if (pItem->GetGUID() != itemGUID)
{
- pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
+ pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
return;
}
@@ -97,35 +101,35 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
ItemTemplate const* proto = pItem->GetTemplate();
if (!proto)
{
- pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL);
+ pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr);
return;
}
// some item classes can be used only in equipped state
if (proto->InventoryType != INVTYPE_NON_EQUIP && !pItem->IsEquipped())
{
- pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL);
+ pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr);
return;
}
InventoryResult msg = pUser->CanUseItem(pItem);
if (msg != EQUIP_ERR_OK)
{
- pUser->SendEquipError(msg, pItem, NULL);
+ pUser->SendEquipError(msg, pItem, nullptr);
return;
}
// only allow conjured consumable, bandage, poisons (all should have the 2^21 item flag set in DB)
if (proto->Class == ITEM_CLASS_CONSUMABLE && !(proto->Flags & ITEM_FLAG_IGNORE_DEFAULT_ARENA_RESTRICTIONS) && pUser->InArena())
{
- pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL);
+ pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, nullptr);
return;
}
// don't allow items banned in arena
if ((proto->Flags & ITEM_FLAG_NOT_USEABLE_IN_ARENA) && pUser->InArena())
{
- pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, NULL);
+ pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, nullptr);
return;
}
@@ -137,7 +141,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
{
if (!spellInfo->CanBeUsedInCombat())
{
- pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL);
+ pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, nullptr);
return;
}
}
@@ -205,7 +209,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
// Verify that the bag is an actual bag or wrapped item that can be used "normally"
if (!(proto->Flags & ITEM_FLAG_HAS_LOOT) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
{
- player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
+ player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
TC_LOG_ERROR("entities.player.cheat", "Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!",
player->GetName().c_str(), player->GetGUID().GetCounter(), item->GetGUID().GetCounter(), proto->ItemId);
return;
@@ -485,7 +489,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
return;
}
- Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
+ Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
if (!pet)
{
@@ -546,8 +550,7 @@ void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket)
if (!_player->m_SummonSlot[slotId])
return;
- Creature* totem = GetPlayer()->GetMap()->GetCreature(_player->m_SummonSlot[slotId]);
-
+ Creature* totem = ObjectAccessor::GetCreature(*_player, _player->m_SummonSlot[slotId]);
if (totem && totem->IsTotem())
totem->ToTotem()->UnSummon();
}