|
2 | 2 | // |
3 | 3 | // Authors: Orsell & Nanoman2525 & NULLderef |
4 | 4 | // Purpose: P2SourceModPlusPlus plugin |
5 | | -// |
| 5 | +// |
6 | 6 | //===========================================================================// |
7 | 7 |
|
8 | 8 | #pragma once |
9 | 9 |
|
10 | 10 | #ifndef P2SM_HPP |
11 | 11 | #define P2SM_HPP |
12 | 12 |
|
13 | | -#include "engine/iserverplugin.h" |
| 13 | +#include "interfaces/serverplugin.hpp" |
| 14 | +#include "interfaces/gameevents.hpp" |
14 | 15 |
|
15 | 16 | #define P2SMPLUSPLUS_PLUGIN_VERSION "1.2.0 PREVIEW" // Update this when a new version of the plugin is released. |
16 | 17 |
|
17 | 18 | //--------------------------------------------------------------------------------- |
18 | 19 | // Purpose: P2SourceModPlusPlus server plugin class |
19 | 20 | //--------------------------------------------------------------------------------- |
20 | 21 |
|
21 | | -class CP2SMPlusPlusPlugin : public IServerPluginCallbacks |
| 22 | +class CP2SMPlusPlusPlugin : public IServerPluginCallbacks, public IGameEventListener2 |
22 | 23 | { |
23 | 24 | public: |
24 | 25 | CP2SMPlusPlusPlugin(); |
25 | 26 | virtual ~CP2SMPlusPlusPlugin() = default; |
26 | 27 |
|
27 | | - // IServerPluginCallbacks methods. |
28 | | - virtual bool Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory); |
29 | | - virtual void Unload(void); |
30 | | - virtual void Pause(void); |
31 | | - virtual void UnPause(void); |
32 | | - virtual const char* GetPluginDescription(void); |
33 | | - virtual void LevelInit(char const* pMapName); |
34 | | - virtual void ServerActivate(edict_t* pEdictList, int edictCount, int clientMax); |
35 | | - virtual void GameFrame(bool simulating); |
36 | | - virtual void LevelShutdown(void); |
37 | | - virtual void ClientActive(edict_t* pEntity); |
38 | | - virtual void ClientDisconnect(edict_t* pEntity); |
39 | | - virtual void ClientPutInServer(edict_t* pEntity, char const* playerName); |
40 | | - virtual void SetCommandClient(int index); |
41 | | - virtual void ClientSettingsChanged(edict_t* pEdict); |
42 | | - virtual PLUGIN_RESULT ClientConnect(bool* bAllowConnect, edict_t* pEntity, const char* pszName, const char* pszAddress, char* reject, int maxRejectLen); |
43 | | - virtual void ClientFullyConnect(edict_t* pEntity); |
44 | | - virtual PLUGIN_RESULT ClientCommand(edict_t* pEntity, const CCommand& args); |
45 | | - virtual PLUGIN_RESULT NetworkIDValidated(const char* pszUserName, const char* pszNetworkID); |
46 | | - virtual void OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, edict_t* pPlayerEntity, EQueryCvarValueStatus eStatus, const char* pCvarName, const char* pCvarValue); |
47 | | - virtual void OnEdictAllocated(edict_t* edict); |
48 | | - virtual void OnEdictFreed(const edict_t* edict); |
49 | | - virtual bool BNetworkCryptKeyCheckRequired(uint32 unFromIP, uint16 usFromPort, uint32 unAccountIdProvidedByClient, bool bClientWantsToUseCryptKey); |
50 | | - virtual bool BNetworkCryptKeyValidate(uint32 unFromIP, uint16 usFromPort, uint32 unAccountIdProvidedByClient, int nEncryptionKeyIndexFromClient, int numEncryptedBytesFromClient, byte* pbEncryptedBufferFromClient, byte* pbPlainTextKeyForNetchan); |
| 28 | + bool Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory) override; |
| 29 | + void Unload() override; |
| 30 | + void Pause() override; |
| 31 | + void UnPause() override; |
| 32 | + const char* GetPluginDescription() override; |
| 33 | + void LevelInit(const char* mapName) override; |
| 34 | + void ServerActivate(Edict* edictList, int edictCount, int clientMax) override; |
| 35 | + void GameFrame(bool simulating) override; |
| 36 | + void LevelShutdown() override; |
| 37 | + void ClientActive(Edict* edict) override; |
| 38 | + void ClientFullyConnect(Edict* edict) override; |
| 39 | + void ClientDisconnect(Edict* edict) override; |
| 40 | + void ClientPutInServer(Edict* edict, char const* playerName) override; |
| 41 | + void SetCommandClient(int index) override; |
| 42 | + void ClientSettingsChanged(Edict* edict) override; |
| 43 | + PluginResult ClientConnect(bool* allowConnect, Edict* edict, const char* name, const char* ipAddress, char* reject, int maxRejectLen) override; |
| 44 | + PluginResult ClientCommand(Edict* edict, const CCommand& args) override; |
| 45 | + PluginResult NetworkIDValidated(const char* username, const char* networkID) override; |
| 46 | + void OnQueryCvarValueFinished(QueryCvarCookie cookie, Edict* edict, QueryCvarValueStatus status, const char* cvarName, const char* cvarValue) override; |
| 47 | + void OnEdictAllocated(Edict* edict) override; |
| 48 | + void OnEdictFreed(const Edict* edict) override; |
| 49 | + |
| 50 | + // IGameEventListener2 methods |
| 51 | + virtual void FireGameEvent(IGameEvent* event); |
| 52 | + virtual int GetEventDebugID(void) { return m_nDebugID; } |
| 53 | + |
| 54 | + virtual int GetCommandIndex() { return m_iClientCommandIndex; } |
51 | 55 |
|
52 | 56 | private: |
53 | 57 | // Plugin state member variables. |
54 | 58 | bool m_bPluginLoaded; |
55 | 59 | bool m_bNoUnload; |
| 60 | + |
| 61 | + int m_nDebugID; |
| 62 | + int m_iClientCommandIndex; |
56 | 63 | }; |
57 | 64 |
|
58 | 65 | static CP2SMPlusPlusPlugin g_P2SMPlusPlusPlugin; |
|
0 commit comments