-
Notifications
You must be signed in to change notification settings - Fork 19
/
ScriptMgr.h
135 lines (114 loc) · 5.36 KB
/
ScriptMgr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* Copyright (C) 2006-2012 ScriptDev2 <http://www.scriptdev2.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SC_SCRIPTMGR_H
#define SC_SCRIPTMGR_H
#include "Common.h"
#include "DBCStructure.h"
class Player;
class Creature;
class CreatureAI;
class InstanceData;
class Quest;
class Item;
class GameObject;
class SpellCastTargets;
class Map;
class Unit;
class WorldObject;
class Aura;
class Object;
class ObjectGuid;
// *********************************************************
// ************** Some defines used globally ***************
// Basic defines
#define VISIBLE_RANGE (166.0f) // MAX visible range (size of grid)
#define DEFAULT_TEXT "<ScriptDev2 Text Entry Missing!>"
/* Escort Factions
* TODO: find better namings and definitions.
* N=Neutral, A=Alliance, H=Horde.
* NEUTRAL or FRIEND = Hostility to player surroundings (not a good definition)
* ACTIVE or PASSIVE = Hostility to environment surroundings.
*/
enum EscortFaction
{
FACTION_ESCORT_A_NEUTRAL_PASSIVE = 10,
FACTION_ESCORT_H_NEUTRAL_PASSIVE = 33,
FACTION_ESCORT_N_NEUTRAL_PASSIVE = 113,
FACTION_ESCORT_A_NEUTRAL_ACTIVE = 231,
FACTION_ESCORT_H_NEUTRAL_ACTIVE = 232,
FACTION_ESCORT_N_NEUTRAL_ACTIVE = 250,
FACTION_ESCORT_N_FRIEND_PASSIVE = 290,
FACTION_ESCORT_N_FRIEND_ACTIVE = 495,
FACTION_ESCORT_A_PASSIVE = 774,
FACTION_ESCORT_H_PASSIVE = 775,
FACTION_ESCORT_N_ACTIVE = 1986,
FACTION_ESCORT_H_ACTIVE = 2046
};
// *********************************************************
// ************* Some structures used globally *************
struct Script
{
Script() :
pGossipHello(NULL), pGossipHelloGO(NULL), pGossipSelect(NULL), pGossipSelectGO(NULL),
pGossipSelectWithCode(NULL), pGossipSelectGOWithCode(NULL),
pDialogStatusNPC(NULL), pDialogStatusGO(NULL),
pQuestAcceptNPC(NULL), pQuestAcceptGO(NULL), pQuestAcceptItem(NULL),
pQuestRewardedNPC(NULL), pQuestRewardedGO(NULL),
pGOUse(NULL), pItemUse(NULL), pAreaTrigger(NULL), pProcessEventId(NULL),
pEffectDummyNPC(NULL), pEffectDummyGO(NULL), pEffectDummyItem(NULL), pEffectAuraDummy(NULL),
GetAI(NULL), GetInstanceData(NULL)
{}
std::string Name;
bool (*pGossipHello )(Player*, Creature*);
bool (*pGossipHelloGO )(Player*, GameObject*);
bool (*pGossipSelect )(Player*, Creature*, uint32, uint32);
bool (*pGossipSelectGO )(Player*, GameObject*, uint32, uint32);
bool (*pGossipSelectWithCode )(Player*, Creature*, uint32, uint32, const char*);
bool (*pGossipSelectGOWithCode )(Player*, GameObject*, uint32, uint32, const char*);
uint32 (*pDialogStatusNPC )(Player*, Creature*);
uint32 (*pDialogStatusGO )(Player*, GameObject*);
bool (*pQuestAcceptNPC )(Player*, Creature*, Quest const*);
bool (*pQuestAcceptGO )(Player*, GameObject*, Quest const*);
bool (*pQuestAcceptItem )(Player*, Item*, Quest const*);
bool (*pQuestRewardedNPC )(Player*, Creature*, Quest const*);
bool (*pQuestRewardedGO )(Player*, GameObject*, Quest const*);
bool (*pGOUse )(Player*, GameObject*);
bool (*pItemUse )(Player*, Item*, SpellCastTargets const&);
bool (*pAreaTrigger )(Player*, AreaTriggerEntry const*);
bool (*pProcessEventId )(uint32, Object*, Object*, bool);
bool (*pEffectDummyNPC )(Unit*, uint32, SpellEffectIndex, Creature*);
bool (*pEffectDummyGO )(Unit*, uint32, SpellEffectIndex, GameObject*);
bool (*pEffectDummyItem )(Unit*, uint32, SpellEffectIndex, Item*);
bool (*pEffectAuraDummy )(const Aura*, bool);
CreatureAI* (*GetAI )(Creature*);
InstanceData* (*GetInstanceData )(Map*);
void RegisterSelf(bool bReportError = true);
};
// *********************************************************
// ************* Some functions used globally **************
// Generic scripting text function
void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget = NULL);
void DoOrSimulateScriptTextForMap(int32 iTextEntry, uint32 uiCreatureEntry, Map* pMap, Creature* pCreatureSource = NULL, Unit* pTarget = NULL);
// *********************************************************
// **************** Internal hook mechanics ****************
#if COMPILER == COMPILER_GNU
#define FUNC_PTR(name,callconvention,returntype,parameters) typedef returntype(*name)parameters __attribute__ ((callconvention));
#else
#define FUNC_PTR(name, callconvention, returntype, parameters) typedef returntype(callconvention *name)parameters;
#endif
#endif