Run clang-format

This commit is contained in:
Yunfan Li
2024-08-04 10:23:36 +08:00
parent 44da167492
commit 53611c9040
835 changed files with 35085 additions and 31861 deletions

View File

@@ -1,8 +1,10 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "DebugAction.h"
#include "ChooseTravelTargetAction.h"
#include "MapMgr.h"
#include "Playerbots.h"
@@ -26,7 +28,8 @@ bool DebugAction::Execute(Event event)
uint32 areaId = 0;
uint32 zoneId = 0;
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(), pos.getZ());
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(),
pos.getZ());
std::ostringstream out;
out << zoneId << "," << areaId << "," << (pos.getAreaName().empty() ? "none" : pos.getAreaName()) << ",";
@@ -71,7 +74,8 @@ bool DebugAction::Execute(Event event)
std::vector<WorldPosition> beginPath, endPath;
TravelNodeRoute route = sTravelNodeMap->getRoute(botPos, *points.front(), beginPath, bot);
std::ostringstream out; out << "Traveling to " << dest->getTitle() << ": ";
std::ostringstream out;
out << "Traveling to " << dest->getTitle() << ": ";
for (auto node : route.getNodes())
{
@@ -228,18 +232,19 @@ bool DebugAction::Execute(Event event)
}
else if (text.find("reset node") != std::string::npos)
{
for (auto& node : sTravelNodeMap->getNodes()) node->setLinked(false);
for (auto& node : sTravelNodeMap->getNodes())
node->setLinked(false);
return true;
}
else if (text.find("reset path") != std::string::npos)
{
for (auto& node : sTravelNodeMap->getNodes())
for (auto& path : *node->getLinks()) node->removeLinkTo(path.first, true);
for (auto& path : *node->getLinks())
node->removeLinkTo(path.first, true);
return true;
}
else if (text.find("gen node") != std::string::npos)
{
// Pathfinder
sTravelNodeMap->generateNodes();
return true;
@@ -262,11 +267,12 @@ bool DebugAction::Execute(Event event)
}
else if (text.find("load node") != std::string::npos)
{
std::thread t([]
{
sTravelNodeMap->removeNodes();
sTravelNodeMap->loadNodeStore();
});
std::thread t(
[]
{
sTravelNodeMap->removeNodes();
sTravelNodeMap->loadNodeStore();
});
t.detach();
@@ -282,7 +288,7 @@ bool DebugAction::Execute(Event event)
{
for (auto& l : *node->getLinks())
{
Unit* start = nullptr;
Unit* start = nullptr;
GuidVector units;
uint32 time = 60 * IN_MILLISECONDS;
@@ -291,15 +297,16 @@ bool DebugAction::Execute(Event event)
for (auto p : ppath)
{
Creature* wpCreature = bot->SummonCreature(1, p.getX(), p.getY(), p.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
//addAura(246, wpCreature);
Creature* wpCreature =
bot->SummonCreature(1, p.getX(), p.getY(), p.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
// addAura(246, wpCreature);
units.push_back(wpCreature->GetGUID());
if (!start)
start = wpCreature;
}
//FakeSpell(1064, bot, start, units.front(), units, {}, pos, pos);
// FakeSpell(1064, bot, start, units.front(), units, {}, pos, pos);
}
}
return true;
@@ -312,7 +319,7 @@ bool DebugAction::Execute(Event event)
for (float i = 0; i < 60; i++)
{
float ang = i / 60 * static_cast<float>(M_PI) * 4;
float ang = i / 60 * static_cast<float>(M_PI) * 4;
float dist = i / 60 * 30;
WorldPosition botPos(bot);
@@ -322,7 +329,8 @@ bool DebugAction::Execute(Event event)
botPos.setY(botPos.getY() + sin(ang) * dist);
botPos.setZ(botPos.getHeight() + 2);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
FakeSpell(spellEffect, wpCreature, wpCreature, prev->GetGUID(), {}, {}, botPos, botPos);
@@ -338,7 +346,7 @@ bool DebugAction::Execute(Event event)
for (float i = 0; i < 60; i++)
{
float ang = i / 60 * static_cast<float>(M_PI) * 4;
float ang = i / 60 * static_cast<float>(M_PI) * 4;
float dist = i / 60 * 30;
WorldPosition botPos(bot);
@@ -348,13 +356,14 @@ bool DebugAction::Execute(Event event)
botPos.setY(botPos.getY() + sin(ang) * dist);
botPos.setZ(botPos.getHeight() + 2);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
if (wpCreature)
{
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
data << wpCreature->GetGUID();
data << uint32(spellEffect); // index from SpellVisualKit.dbc
data << uint32(spellEffect); // index from SpellVisualKit.dbc
wpCreature->SendMessageToSet(&data, true);
}
}
@@ -368,7 +377,7 @@ bool DebugAction::Execute(Event event)
for (float i = 0; i < 60; i++)
{
float ang = i / 60 * static_cast<float>(M_PI) * 4;
float ang = i / 60 * static_cast<float>(M_PI) * 4;
float dist = i / 60 * 30;
WorldPosition botPos(bot);
@@ -378,7 +387,8 @@ bool DebugAction::Execute(Event event)
botPos.setY(botPos.getY() + sin(ang) * dist);
botPos.setZ(botPos.getHeight() + 2);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
wpCreature->SetObjectScale(0.5f);
if (wpCreature)
@@ -396,7 +406,7 @@ bool DebugAction::Execute(Event event)
for (float i = 0; i < 60; i++)
{
float ang = i / 60 * static_cast<float>(M_PI) * 4;
float ang = i / 60 * static_cast<float>(M_PI) * 4;
float dist = i / 60 * 30;
WorldPosition botPos(bot);
@@ -405,7 +415,8 @@ bool DebugAction::Execute(Event event)
botPos.setY(botPos.getY() + sin(ang) * dist);
botPos.setZ(botPos.getHeight() + 2);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
units.push_back(wpCreature->GetGUID());
}
@@ -438,12 +449,12 @@ bool DebugAction::Execute(Event event)
}
{
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
data << bot->GetPackGUID();
data << bot->GetPackGUID();
data << uint32(spellEffect); // spellID
data << uint8(0) << uint8(1); // flags
data << uint8(1); // amount of targets
data << uint32(spellEffect); // spellID
data << uint8(0) << uint8(1); // flags
data << uint8(1); // amount of targets
data << master->GetGUID();
data << uint8(0);
data << uint16(2);
@@ -465,15 +476,17 @@ bool DebugAction::Execute(Event event)
{
for (int32 dy = 0; dy < 10; dy++)
{
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
WorldPosition botPos(bot);
botPos.setX(botPos.getX() + (dx - 5) * 5);
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature =
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
if (wpCreature)
{
@@ -495,15 +508,16 @@ bool DebugAction::Execute(Event event)
{
for (int32 dy = 0; dy < 10; dy++)
{
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
WorldPosition botPos(bot);
botPos.setX(botPos.getX() + (dx - 5) * 5);
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
}
}
return true;
@@ -514,8 +528,8 @@ bool DebugAction::Execute(Event event)
{
for (int32 dy = 0; dy < 10; dy++)
{
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
WorldPosition botPos(bot);
botPos.setX(botPos.getX() + (dx - 5) * 5);
@@ -534,26 +548,28 @@ bool DebugAction::Execute(Event event)
{
for (int32 dy = 0; dy < 10; dy++)
{
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
WorldPosition botPos(bot);
botPos.setX(botPos.getX() + (dx - 5) * 5);
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
if (wpCreature)
{
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
data << wpCreature->GetGUID();
data << uint32(effect);
; // index from SpellVisualKit.dbc
; // index from SpellVisualKit.dbc
// wpCreature->SendMessageToSet(&data, true);
datMap.push_back(data);
//wpCreature->MonsterMoveWithSpeed(botPos.getX(), botPos.getY() + 80, botPos.getZ(), 8.0f, true, true);
// wpCreature->MonsterMoveWithSpeed(botPos.getX(), botPos.getY() + 80, botPos.getZ(), 8.0f, true,
// true);
}
}
}
@@ -580,21 +596,23 @@ bool DebugAction::Execute(Event event)
{
for (int32 dy = 0; dy < 10; dy++)
{
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
WorldPosition botPos(bot);
botPos.setX(botPos.getX() + (dx - 5) * 5);
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature =
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
if (wpCreature)
{
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4); // visual effect on player
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4); // visual effect on player
data << wpCreature->GetGUID();
data << uint32(effect); // index from SpellVisualKit.dbc
data << uint32(effect); // index from SpellVisualKit.dbc
// wpCreature->SendMessageToSet(&data, true);
datMap.push_back(data);
}
@@ -619,20 +637,21 @@ bool DebugAction::Execute(Event event)
else if (text.find("cspellmap") != std::string::npos)
{
Creature* wpCreature = nullptr;
Creature* lCreature = nullptr;
Creature* lCreature = nullptr;
for (int32 dx = 0; dx < 10; dx++)
{
for (int32 dy = 0; dy < 10; dy++)
{
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
WorldPosition botPos(bot);
botPos.setX(botPos.getX() + (dx - 5) * 5);
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(),
botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
if (wpCreature && lCreature)
{
@@ -652,15 +671,16 @@ bool DebugAction::Execute(Event event)
{
for (int32 dy = 0; dy < 10; dy++)
{
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
WorldPosition botPos(bot);
botPos.setX(botPos.getX() + (dx - 5) * 5);
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
if (wpCreature)
{
@@ -672,7 +692,7 @@ bool DebugAction::Execute(Event event)
}
else if (text.find("gspellmap") != std::string::npos)
{
GuidVector all_targets; // = { bot->GetGUID(), master->GetGUID() };
GuidVector all_targets; // = { bot->GetGUID(), master->GetGUID() };
// std::GuidVector all_dummies = { bot->GetGUID(), master->GetGUID() };
/*GuidVector a_targets = *context->GetValue<GuidVector >("all targets");
@@ -692,7 +712,8 @@ bool DebugAction::Execute(Event event)
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
all_targets.push_back(wpCreature->GetGUID());
}
@@ -709,9 +730,9 @@ bool DebugAction::Execute(Event event)
for (int32 dy = 0; dy < 10; dy++)
{
uint32 spellEffect = stoi(text.substr(10));
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 effect = dx + dy * 10 + spellEffect * 100;
uint32 i = dx + dy * 10;
uint32 i = dx + dy * 10;
GuidVector hits, miss;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effect);
@@ -722,21 +743,23 @@ bool DebugAction::Execute(Event event)
switch (urand(0, 10))
{
case 0:
hits.push_back(tar);
break;
case 1:
miss.push_back(tar);
break;
case 2:
case 3:
break;
case 0:
hits.push_back(tar);
break;
case 1:
miss.push_back(tar);
break;
case 2:
case 3:
break;
}
}
Unit* realCaster = botAI->GetUnit(all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
Unit* caster = botAI->GetUnit(all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
Unit* target = botAI->GetUnit(all_targets[i + 1]);
Unit* realCaster = botAI->GetUnit(
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
Unit* caster = botAI->GetUnit(
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
Unit* target = botAI->GetUnit(all_targets[i + 1]);
if (!realCaster)
realCaster = bot;
@@ -747,7 +770,8 @@ bool DebugAction::Execute(Event event)
if (!target)
target = master;
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster), WorldPosition(target));
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster),
WorldPosition(target));
std::this_thread::sleep_for(std::chrono::milliseconds(20));
}
@@ -768,7 +792,8 @@ bool DebugAction::Execute(Event event)
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
all_targets.push_back(wpCreature->GetGUID());
}
@@ -808,8 +833,10 @@ bool DebugAction::Execute(Event event)
}
}
Unit* realCaster = botAI->GetUnit(all_targets[i]);//botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
Unit* caster = botAI->GetUnit(all_targets[i]);//botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
Unit* realCaster = botAI->GetUnit(
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
Unit* caster = botAI->GetUnit(
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
Unit* target = botAI->GetUnit(all_targets[i + 1]);
if (!realCaster)
@@ -822,13 +849,14 @@ bool DebugAction::Execute(Event event)
target = master;
master->SendPlaySpellVisual(caster->GetGUID(), 5036);
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster), WorldPosition(target));
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster),
WorldPosition(target));
std::this_thread::sleep_for(std::chrono::milliseconds(20));
}
}
return true;
return true;
}
else if (text.find("soundmap") != std::string::npos)
{
@@ -844,7 +872,9 @@ bool DebugAction::Execute(Event event)
botPos.setY(botPos.getY() + (dy - 5) * 5);
botPos.setZ(botPos.getHeight());
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
Creature* wpCreature =
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
wpCreature->PlayDistanceSound(effect);
}
@@ -886,33 +916,35 @@ bool DebugAction::Execute(Event event)
return true;
}
void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target, GuidVector otherTargets, GuidVector missTargets, WorldPosition source, WorldPosition dest, bool forceDest)
void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target, GuidVector otherTargets,
GuidVector missTargets, WorldPosition source, WorldPosition dest, bool forceDest)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
{
uint32 castFlags = CAST_FLAG_HAS_TRAJECTORY;
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) ||
spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
castFlags |= CAST_FLAG_PROJECTILE;
WorldPacket data(SMSG_SPELL_START, (8 + 8 + 4 + 2 + 4));
data << truecaster->GetPackGUID(); //truecaster
data << truecaster->GetPackGUID(); // truecaster
if (caster)
data << caster->GetPackGUID(); //m_caster->GetPackGUID();
data << caster->GetPackGUID(); // m_caster->GetPackGUID();
else
data << ObjectGuid::Empty;
data << uint32(spellId); // spellId
data << uint16(castFlags); // cast flags
data << uint32(1000.0f); // delay?
data << uint32(spellId); // spellId
data << uint16(castFlags); // cast flags
data << uint32(1000.0f); // delay?
SpellCastTargets m_targets;
m_targets.Write(data);
//projectile info
// projectile info
if (castFlags & CAST_FLAG_PROJECTILE)
{
data << uint32(5996);
@@ -935,16 +967,18 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
m_targets.SetSrc(source.getX(), source.getY(), source.getZ());
if (!forceDest && target)
if (!spellInfo || !(spellInfo->Targets & TARGET_FLAG_DEST_LOCATION && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION))
if (!spellInfo ||
!(spellInfo->Targets & TARGET_FLAG_DEST_LOCATION && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION))
m_targets.SetUnitTarget(botAI->GetUnit(target));
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) ||
spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual
if (spellInfo->HasEffect(SPELL_EFFECT_ACTIVATE_RUNE))
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
if (m_targets.HasTraj())
castFlags |= CAST_FLAG_ADJUST_MISSILE;
@@ -952,43 +986,43 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
if (!spellInfo->StartRecoveryTime)
castFlags |= CAST_FLAG_NO_GCD;
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
data << truecaster->GetPackGUID(); //truecaster
data << truecaster->GetPackGUID(); // truecaster
if (caster)
data << caster->GetPackGUID(); //m_caster->GetPackGUID();
data << caster->GetPackGUID(); // m_caster->GetPackGUID();
else
data << ObjectGuid::Empty;
data << uint32(spellId); // spellId
data << uint16(castFlags); // cast flags
data << uint32(spellId); // spellId
data << uint16(castFlags); // cast flags
//WriteSpellGoTargets
// WriteSpellGoTargets
uint32 hits = otherTargets.size() + (target ? 1 : 0);
data << uint8(hits); // Hits
data << uint8(hits); // Hits
if (target)
data << target;
//Hit targets here.
// Hit targets here.
for (auto otherTarget : otherTargets)
data << otherTarget;
data << (uint8)missTargets.size(); //miss
data << (uint8)missTargets.size(); // miss
for (auto missTarget : missTargets)
{
data << missTarget;
data << uint8(SPELL_MISS_RESIST); //Miss condition
data << uint8(SPELL_MISS_NONE); //Miss condition
data << uint8(SPELL_MISS_RESIST); // Miss condition
data << uint8(SPELL_MISS_NONE); // Miss condition
}
m_targets.Write(data);
//projectile info
// projectile info
if (castFlags & CAST_FLAG_PROJECTILE)
{
data << uint32(5996);
@@ -1011,7 +1045,8 @@ void DebugAction::addAura(uint32 spellId, Unit* target)
if (!spellInfo)
return;
if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) &&
!spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
return;
target->AddAura(spellInfo, MAX_EFFECT_MASK, target);