root/trunk/src/bindings/scripts/ScriptMgr.h @ 37

Revision 37, 3.2 kB (checked in by yumileroy, 17 years ago)

[svn] * svn:eol-style native set on all files that need it

Original author: Neo2003
Date: 2008-10-11 14:16:25-05:00

Line 
1/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2 * This program is free software licensed under GPL version 2
3 * Please see the included DOCS/LICENSE.TXT for more information */
4
5#ifndef SCRIPTMGR_H
6#define SCRIPTMGR_H
7
8#include "Common.h"
9#include "Platform/CompilerDefs.h"
10#include "Database/DBCStructure.h"
11
12class Player;
13class Creature;
14class CreatureAI;
15class InstanceData;
16class Quest;
17class Item;
18class GameObject;
19class SpellCastTargets;
20class Map;
21class Unit;
22class WorldObject;
23
24#define MAX_SCRIPTS         1000                            //72 bytes each (approx 71kb)
25#define VISIBLE_RANGE       (166.0f)                        //MAX visible range (size of grid)
26#define DEFAULT_TEXT        "<Trinity Script Text Entry Missing!>"
27
28struct Script
29{
30    Script() :
31pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
32pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL),
33pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
34pGOChooseReward(NULL),pReceiveEmote(NULL),pItemUse(NULL), GetAI(NULL), GetInstanceData(NULL)
35{}
36
37std::string Name;
38
39// Quest/gossip Methods to be scripted
40bool (*pGossipHello         )(Player*, Creature*);
41bool (*pQuestAccept         )(Player*, Creature*, Quest const* );
42bool (*pGossipSelect        )(Player*, Creature*, uint32 , uint32  );
43bool (*pGossipSelectWithCode)(Player*, Creature*, uint32 , uint32 , const char* );
44bool (*pQuestSelect         )(Player*, Creature*, Quest const* );
45bool (*pQuestComplete       )(Player*, Creature*, Quest const* );
46uint32 (*pNPCDialogStatus   )(Player*, Creature* );
47uint32 (*pGODialogStatus    )(Player *player, GameObject * _GO );
48bool (*pChooseReward        )(Player*, Creature*, Quest const*, uint32 );
49bool (*pItemHello           )(Player*, Item*, Quest const* );
50bool (*pGOHello             )(Player*, GameObject* );
51bool (*pAreaTrigger         )(Player*, AreaTriggerEntry* );
52bool (*pItemQuestAccept     )(Player*, Item *, Quest const* );
53bool (*pGOQuestAccept       )(Player*, GameObject*, Quest const* );
54bool (*pGOChooseReward      )(Player*, GameObject*_GO, Quest const*, uint32 );
55bool (*pReceiveEmote        )(Player*, Creature*, uint32 );
56bool (*pItemUse             )(Player*, Item*, SpellCastTargets const& );
57
58CreatureAI* (*GetAI)(Creature*);
59InstanceData* (*GetInstanceData)(Map*);
60};
61
62extern int nrscripts;
63extern Script *m_scripts[MAX_SCRIPTS];
64
65// Localized Text function
66const char* GetEventAILocalizedText(uint32 entry);
67
68//EventAI text function
69const char* GetEventAIText(uint32 entry);                   // TODO: Locales
70
71//Generic scripting text function
72void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL);
73
74#if COMPILER == COMPILER_GNU
75#define FUNC_PTR(name,callconvention,returntype,parameters)    typedef returntype(*name)parameters __attribute__ ((callconvention));
76#else
77#define FUNC_PTR(name, callconvention, returntype, parameters)    typedef returntype(callconvention *name)parameters;
78#endif
79
80#ifdef WIN32
81  #define MANGOS_DLL_EXPORT extern "C" __declspec(dllexport)
82#elif defined( __GNUC__ )
83  #define MANGOS_DLL_EXPORT extern "C"
84#else
85  #define MANGOS_DLL_EXPORT extern "C" export
86#endif
87
88#endif
Note: See TracBrowser for help on using the browser.