refactor(Scripts/EasternKingdoms): code cleanup (part 5) - also fix potential crash (#6923)

This commit is contained in:
Francesco Borzì
2021-07-19 11:23:27 +02:00
committed by GitHub
parent fab0fc421b
commit e5f1104849
37 changed files with 118 additions and 144 deletions

View File

@@ -100,8 +100,7 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
Talk(SAY_SPIDER_SPAWN);
Creature* Spider = nullptr;
Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Spider)
Spider->AI()->AttackStart(target);
Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);

View File

@@ -91,8 +91,7 @@ public:
{
if (Ambush_Timer <= diff)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
{
me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation());
@@ -127,14 +126,17 @@ public:
{
if (Aggro_Timer <= diff)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 1);
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (DoGetThreat(me->GetVictim()))
{
DoModifyThreatPercent(me->GetVictim(), -50);
}
if (target)
{
AttackStart(target);
}
Aggro_Timer = urand(7000, 20000);
}

View File

@@ -4,7 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "ObjectMgr.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "Spell.h"

View File

@@ -102,22 +102,16 @@ public:
{
case DATA_LORKHAN:
return _zealotLorkhanGUID;
break;
case DATA_ZATH:
return _zealotZathGUID;
break;
case DATA_THEKAL:
return _highPriestTekalGUID;
break;
case DATA_JINDO:
return _jindoTheHexxerGUID;
break;
case NPC_ARLOKK:
return _arlokkGUID;
break;
case GO_GONG_OF_BETHEKK:
return _goGongOfBethekkGUID;
break;
}
return ObjectGuid::Empty;