Rev 31 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#include "pch.h"
#pragma hdrstop
#include "GameUI.h"
#include <Console/ConsoleClient.h>
#include <FrameScript/FrameScript.h>
/****************************************************************************
*
* Memory addresses
*
***/
#define CGGAMEUI__INITIALIZE 0x0052A980;
#define CGGAMEUI__CANPERFORMACTION 0x005191C0;
#define CGGAMEUI__SHUTDOWN 0x00528F00;
/****************************************************************************
*
* Function pointers
*
***/
void (__cdecl* InitializePtr) () = *(void(__cdecl*)())CGGAMEUI__INITIALIZE;
bool (__cdecl* CanPerformActionPtr) (ACTIONTYPE action) = *(bool(__cdecl*)(ACTIONTYPE))CGGAMEUI__CANPERFORMACTION;
void (__cdecl* ShutdownPtr2) () = *(void(__cdecl*)())CGGAMEUI__SHUTDOWN;
/****************************************************************************
*
* Private
*
***/
static CVar *s_enableTaintEnforcement;
//===========================================================================
void __cdecl Initialize () {
InitializePtr();
s_enableTaintEnforcement = CVar::Register("enableTaintEnforcement",
"Enables enforcement of taint in GM clients",
NULL,
"0",
NULL,
GAME,
false,
NULL,
false);
CGGameUI::RegisterScriptFunctions();
CGGameUI::RegisterConsoleCommands();
}
//===========================================================================
void __cdecl Shutdown () {
ShutdownPtr2();
CGGameUI::UnregisterScriptFunctions();
CGGameUI::UnregisterConsoleCommands();
}
//===========================================================================
int __cdecl CCommand_Script (const char* cmd,
const char* arguments) {
FrameScript_Execute(arguments,arguments,NULL);
return 0;
}
/****************************************************************************
*
* External functions
*
***/
//===========================================================================
void WowGM::CGGameUI::Initialize()
{
DETOUR_INIT;
DETOUR_ATTACH(::InitializePtr,::Initialize);
DETOUR_ATTACH(::CanPerformActionPtr,::CGGameUI::CanPerformAction);
DETOUR_ATTACH(::ShutdownPtr2,::Shutdown);
DETOUR_COMMIT;
}
//===========================================================================
void WowGM::CGGameUI::Shutdown()
{
DETOUR_INIT;
DETOUR_DETACH(::InitializePtr,::Initialize);
DETOUR_DETACH(::CanPerformActionPtr,::CGGameUI::CanPerformAction);
DETOUR_DETACH(::ShutdownPtr2,::Shutdown);
DETOUR_COMMIT;
}
/****************************************************************************
*
* CGGameUI class implementation
*
***/
//===========================================================================
bool __cdecl CGGameUI::CanPerformAction(ACTIONTYPE action)
{
if (s_enableTaintEnforcement) {
// Always enable any action
// if this option is enabled by the client
if (s_enableTaintEnforcement->m_intValue == 0)
return true;
}
return CanPerformActionPtr(action);
}
//===========================================================================
void __cdecl CGGameUI::RegisterConsoleCommands () {
ConsoleCommandRegister("script",CCommand_Script,DEFAULT,NULL);
}
//===========================================================================
void __cdecl CGGameUI::UnregisterConsoleCommands () {
ConsoleCommandUnregister("script");
}
//===========================================================================
void __cdecl CGGameUI::RegisterScriptFunctions () {
// Register scripts here
}
//===========================================================================
void __cdecl CGGameUI::UnregisterScriptFunctions () {
// Unregister scripts here
}
Generated by GNU Enscript 1.6.5.90.