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

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

*DB script table stucture change. Source Mangos. Also fix some bugs. Hopefully this rev will make program usable again.

Original author: megamage
Date: 2008-11-20 10:43:20-06:00

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