mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 15:46:24 +00:00
refactor(Scripts/EasternKingdoms): code cleanup (part 5) - also fix potential crash (#6923)
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "PetAI.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
@@ -672,14 +671,14 @@ uint32 acherus_soul_prison[12] =
|
||||
191590
|
||||
};
|
||||
|
||||
uint32 acherus_unworthy_initiate[5] =
|
||||
{
|
||||
29519,
|
||||
29520,
|
||||
29565,
|
||||
29566,
|
||||
29567
|
||||
};
|
||||
//uint32 acherus_unworthy_initiate[5] =
|
||||
//{
|
||||
// 29519,
|
||||
// 29520,
|
||||
// 29565,
|
||||
// 29566,
|
||||
// 29567
|
||||
//};
|
||||
|
||||
class npc_unworthy_initiate : public CreatureScript
|
||||
{
|
||||
@@ -782,7 +781,7 @@ public:
|
||||
{
|
||||
if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i], 100))
|
||||
{
|
||||
if (temp_prison && me->IsWithinDist(temp_prison, dist, false))
|
||||
if (me->IsWithinDist(temp_prison, dist, false))
|
||||
{
|
||||
dist = me->GetDistance2d(temp_prison);
|
||||
prison = temp_prison;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
@@ -64,11 +64,17 @@ public:
|
||||
{
|
||||
Player* player = nullptr;
|
||||
if (me->IsSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
if (Unit * summoner = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
player = summoner->ToPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
if (!player)
|
||||
{
|
||||
phase = 3;
|
||||
}
|
||||
|
||||
switch (phase)
|
||||
{
|
||||
@@ -78,17 +84,23 @@ public:
|
||||
FlyBackTimer = 500;
|
||||
break;
|
||||
case 1:
|
||||
player->GetClosePoint(x, y, z, me->GetObjectSize());
|
||||
if (player)
|
||||
{
|
||||
player->GetClosePoint(x, y, z, me->GetObjectSize());
|
||||
}
|
||||
z += 2.5f;
|
||||
x -= 2.0f;
|
||||
y -= 1.5f;
|
||||
me->GetMotionMaster()->MovePoint(0, x, y, z);
|
||||
me->SetTarget(player->GetGUID());
|
||||
if (player)
|
||||
{
|
||||
me->SetTarget(player->GetGUID());
|
||||
}
|
||||
me->SetVisible(true);
|
||||
FlyBackTimer = 4500;
|
||||
break;
|
||||
case 2:
|
||||
if (!player->isResurrectRequested())
|
||||
if (player && !player->isResurrectRequested())
|
||||
{
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01);
|
||||
DoCast(player, SPELL_REVIVE, true);
|
||||
|
||||
Reference in New Issue
Block a user