Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
zone_dalaran.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
/* Script Data Start
7
SDName: Dalaran
8
SDAuthor: WarHead, MaXiMiUS
9
SD%Complete: 99%
10
SDComment: For what is 63990+63991? Same function but don't work correct...
11
SDCategory: Dalaran
12
Script Data End */
13
14
#include "
ScriptMgr.h
"
15
#include "
ScriptedCreature.h
"
16
#include "
ScriptedGossip.h
"
17
#include "
Player.h
"
18
#include "
WorldSession.h
"
19
20
/*******************************************************
21
* npc_mageguard_dalaran
22
*******************************************************/
23
24
enum
Spells
25
{
26
SPELL_TRESPASSER_A
= 54028,
27
SPELL_TRESPASSER_H
= 54029,
28
29
SPELL_SUNREAVER_DISGUISE_FEMALE
= 70973,
30
SPELL_SUNREAVER_DISGUISE_MALE
= 70974,
31
SPELL_SILVER_COVENANT_DISGUISE_FEMALE
= 70971,
32
SPELL_SILVER_COVENANT_DISGUISE_MALE
= 70972,
33
};
34
35
enum
NPCs
// All outdoor guards are within 35.0f of these NPCs
36
{
37
NPC_APPLEBOUGH_A
= 29547,
38
NPC_SWEETBERRY_H
= 29715,
39
};
40
41
class
npc_mageguard_dalaran
:
public
CreatureScript
42
{
43
public
:
44
npc_mageguard_dalaran
() :
CreatureScript
(
"npc_mageguard_dalaran"
) { }
45
46
struct
npc_mageguard_dalaranAI
:
public
ScriptedAI
47
{
48
npc_mageguard_dalaranAI
(
Creature
* creature) :
ScriptedAI
(creature)
49
{
50
creature->
SetFlag
(
UNIT_FIELD_FLAGS
,
UNIT_FLAG_NON_ATTACKABLE
);
51
creature->
ApplySpellImmune
(0,
IMMUNITY_DAMAGE
,
SPELL_SCHOOL_NORMAL
,
true
);
52
creature->
ApplySpellImmune
(0,
IMMUNITY_DAMAGE
,
SPELL_SCHOOL_MASK_MAGIC
,
true
);
53
}
54
55
void
Reset
()
OVERRIDE
{ }
56
57
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
58
59
void
AttackStart
(
Unit
*
/*who*/
)
OVERRIDE
{ }
60
61
void
MoveInLineOfSight
(
Unit
* who)
OVERRIDE
62
63
{
64
if
(!who || !who->IsInWorld() || who->GetZoneId() != 4395)
65
return
;
66
67
if
(!
me
->IsWithinDist(who, 65.0f,
false
))
68
return
;
69
70
Player
* player = who->
GetCharmerOrOwnerPlayerOrPlayerItself
();
71
72
if
(!player || player->
IsGameMaster
() || player->
IsBeingTeleported
() ||
73
// If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass
74
player->
HasAura
(
SPELL_SUNREAVER_DISGUISE_FEMALE
) || player->
HasAura
(
SPELL_SUNREAVER_DISGUISE_MALE
) ||
75
player->
HasAura
(
SPELL_SILVER_COVENANT_DISGUISE_FEMALE
) || player->
HasAura
(
SPELL_SILVER_COVENANT_DISGUISE_MALE
))
76
return
;
77
78
switch
(
me
->GetEntry())
79
{
80
case
29254:
81
if
(player->
GetTeam
() ==
HORDE
)
// Horde unit found in Alliance area
82
{
83
if
(
GetClosestCreatureWithEntry
(
me
,
NPC_APPLEBOUGH_A
, 32.0f))
84
{
85
if
(
me
->isInBackInMap(who, 12.0f))
// In my line of sight, "outdoors", and behind me
86
DoCast
(who,
SPELL_TRESPASSER_A
);
// Teleport the Horde unit out
87
}
88
else
// In my line of sight, and "indoors"
89
DoCast
(who,
SPELL_TRESPASSER_A
);
// Teleport the Horde unit out
90
}
91
break
;
92
case
29255:
93
if
(player->
GetTeam
() ==
ALLIANCE
)
// Alliance unit found in Horde area
94
{
95
if
(
GetClosestCreatureWithEntry
(
me
,
NPC_SWEETBERRY_H
, 32.0f))
96
{
97
if
(
me
->isInBackInMap(who, 12.0f))
// In my line of sight, "outdoors", and behind me
98
DoCast
(who,
SPELL_TRESPASSER_H
);
// Teleport the Alliance unit out
99
}
100
else
// In my line of sight, and "indoors"
101
DoCast
(who,
SPELL_TRESPASSER_H
);
// Teleport the Alliance unit out
102
}
103
break
;
104
}
105
me
->SetOrientation(
me
->GetHomePosition().GetOrientation());
106
return
;
107
}
108
109
void
UpdateAI
(
uint32
/*diff*/
)
OVERRIDE
{ }
110
};
111
112
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
113
{
114
return
new
npc_mageguard_dalaranAI
(creature);
115
}
116
};
117
118
void
AddSC_dalaran
()
119
{
120
new
npc_mageguard_dalaran
;
121
}
Spells
Spells
Definition
BattlegroundIC.h:645
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
Player.h
ScriptMgr.h
GetClosestCreatureWithEntry
Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive)
Definition
ScriptedCreature.cpp:662
NPCs
NPCs
Definition
ScriptedCreature.cpp:400
ScriptedCreature.h
ScriptedGossip.h
SPELL_SCHOOL_NORMAL
@ SPELL_SCHOOL_NORMAL
Definition
SharedDefines.h:256
IMMUNITY_DAMAGE
@ IMMUNITY_DAMAGE
Definition
SharedDefines.h:1599
ALLIANCE
@ ALLIANCE
Definition
SharedDefines.h:877
HORDE
@ HORDE
Definition
SharedDefines.h:876
SPELL_SCHOOL_MASK_MAGIC
@ SPELL_SCHOOL_MASK_MAGIC
Definition
SharedDefines.h:285
UNIT_FLAG_NON_ATTACKABLE
@ UNIT_FLAG_NON_ATTACKABLE
Definition
Unit.h:626
UNIT_FIELD_FLAGS
@ UNIT_FIELD_FLAGS
Definition
UpdateFields.h:82
WorldSession.h
CreatureAI
Definition
CreatureAI.h:54
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
Object::SetFlag
void SetFlag(uint16 index, uint32 newFlag)
Definition
Object.cpp:1261
Player
Definition
Player.h:1289
Player::GetTeam
uint32 GetTeam() const
Definition
Player.h:2527
Player::IsGameMaster
bool IsGameMaster() const
Definition
Player.h:1369
Player::IsBeingTeleported
bool IsBeingTeleported() const
Definition
Player.h:2493
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
Unit
Definition
Unit.h:1367
Unit::GetCharmerOrOwnerPlayerOrPlayerItself
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition
Unit.cpp:2355
Unit::HasAura
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
Definition
UnitAuraState.cpp:1182
Unit::ApplySpellImmune
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition
Unit.cpp:3580
npc_mageguard_dalaran
Definition
zone_dalaran.cpp:42
npc_mageguard_dalaran::npc_mageguard_dalaran
npc_mageguard_dalaran()
Definition
zone_dalaran.cpp:44
npc_mageguard_dalaran::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
zone_dalaran.cpp:112
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_mageguard_dalaran::npc_mageguard_dalaranAI
Definition
zone_dalaran.cpp:47
npc_mageguard_dalaran::npc_mageguard_dalaranAI::AttackStart
void AttackStart(Unit *) OVERRIDE
Definition
zone_dalaran.cpp:59
npc_mageguard_dalaran::npc_mageguard_dalaranAI::Reset
void Reset() OVERRIDE
Definition
zone_dalaran.cpp:55
npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight
void MoveInLineOfSight(Unit *who) OVERRIDE
Definition
zone_dalaran.cpp:61
npc_mageguard_dalaran::npc_mageguard_dalaranAI::UpdateAI
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================
Definition
zone_dalaran.cpp:109
npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI
npc_mageguard_dalaranAI(Creature *creature)
Definition
zone_dalaran.cpp:48
npc_mageguard_dalaran::npc_mageguard_dalaranAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
zone_dalaran.cpp:57
SPELL_SUNREAVER_DISGUISE_MALE
@ SPELL_SUNREAVER_DISGUISE_MALE
Definition
zone_dalaran.cpp:30
SPELL_SILVER_COVENANT_DISGUISE_FEMALE
@ SPELL_SILVER_COVENANT_DISGUISE_FEMALE
Definition
zone_dalaran.cpp:31
SPELL_TRESPASSER_H
@ SPELL_TRESPASSER_H
Definition
zone_dalaran.cpp:27
SPELL_SILVER_COVENANT_DISGUISE_MALE
@ SPELL_SILVER_COVENANT_DISGUISE_MALE
Definition
zone_dalaran.cpp:32
SPELL_TRESPASSER_A
@ SPELL_TRESPASSER_A
Definition
zone_dalaran.cpp:26
SPELL_SUNREAVER_DISGUISE_FEMALE
@ SPELL_SUNREAVER_DISGUISE_FEMALE
Definition
zone_dalaran.cpp:29
AddSC_dalaran
void AddSC_dalaran()
Definition
zone_dalaran.cpp:118
NPC_SWEETBERRY_H
@ NPC_SWEETBERRY_H
Definition
zone_dalaran.cpp:38
NPC_APPLEBOUGH_A
@ NPC_APPLEBOUGH_A
Definition
zone_dalaran.cpp:37
src
server
scripts
Northrend
zone_dalaran.cpp
Generated on
for Project SkyFire Core by
1.17.0