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

Revision 5, 3.3 kB (checked in by yumileroy, 17 years ago)

[svn] * Continue Trinity Script conversion.

Original author: Seline
Date: 2008-10-03 19:21:26-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
26//MAX visible range (size of grid)
27#define VISIBLE_RANGE   (166.0f)
28
29#define DEFAULT_TEXT    "<Trinity Script Text Entry Missing!>"
30
31//
32struct Script
33{
34    Script() :
35pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
36pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL),
37pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
38pGOChooseReward(NULL),pReceiveEmote(NULL),pItemUse(NULL), GetAI(NULL), GetInstanceData(NULL)
39{}
40
41std::string Name;
42
43// -- Quest/gossip Methods to be scripted --
44bool (*pGossipHello         )(Player*, Creature*);
45bool (*pQuestAccept         )(Player*, Creature*, Quest const* );
46bool (*pGossipSelect        )(Player*, Creature*, uint32 , uint32  );
47bool (*pGossipSelectWithCode)(Player*, Creature*, uint32 , uint32 , const char* );
48bool (*pQuestSelect         )(Player*, Creature*, Quest const* );
49bool (*pQuestComplete       )(Player*, Creature*, Quest const* );
50uint32 (*pNPCDialogStatus   )(Player*, Creature* );
51uint32 (*pGODialogStatus    )(Player *player, GameObject * _GO );
52bool (*pChooseReward        )(Player*, Creature*, Quest const*, uint32 );
53bool (*pItemHello           )(Player*, Item*, Quest const* );
54bool (*pGOHello             )(Player*, GameObject* );
55bool (*pAreaTrigger         )(Player*, AreaTriggerEntry* );
56bool (*pItemQuestAccept     )(Player*, Item *, Quest const* );
57bool (*pGOQuestAccept       )(Player*, GameObject*, Quest const* );
58bool (*pGOChooseReward      )(Player*, GameObject*_GO, Quest const*, uint32 );
59bool (*pReceiveEmote        )(Player*, Creature*, uint32 );
60bool (*pItemUse             )(Player*, Item*, SpellCastTargets const& );
61
62CreatureAI* (*GetAI)(Creature*);
63InstanceData* (*GetInstanceData)(Map*);
64// -----------------------------------------
65};
66
67extern int nrscripts;
68extern Script *m_scripts[MAX_SCRIPTS];
69
70// Localized Text function
71const char* GetEventAILocalizedText(uint32 entry);
72const char* GetScriptLocalizedText(uint32 entry);
73
74//EventAI text function
75const char* GetEventAIText(uint32 entry); // TODO: Locales
76
77// Script Text function
78void ProcessScriptText(uint32 id, WorldObject* pSource, Unit* target = NULL); // TODO: Locales
79
80#if COMPILER == COMPILER_GNU
81#define FUNC_PTR(name,callconvention,returntype,parameters)    typedef returntype(*name)parameters __attribute__ ((callconvention));
82#else
83#define FUNC_PTR(name, callconvention, returntype, parameters)    typedef returntype(callconvention *name)parameters;
84#endif
85
86#ifdef WIN32
87  #define MANGOS_DLL_EXPORT extern "C" __declspec(dllexport)
88#elif defined( __GNUC__ )
89  #define MANGOS_DLL_EXPORT extern "C"
90#else
91  #define MANGOS_DLL_EXPORT extern "C" export
92#endif
93
94#endif
Note: See TracBrowser for help on using the browser.