Забиндеды недостающие функции. Исправлены опечатки

This commit is contained in:
Kernell 2015-03-13 07:38:11 +03:00
parent 47b0769647
commit 96c0084e02
6 changed files with 183 additions and 15 deletions

View File

@ -28,6 +28,15 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Server, SetPassword );
MONO_DECLARE( Server, GetVersion );
MONO_DECLARE( Server, GetGameType );
MONO_DECLARE( Server, GetMapName );
MONO_DECLARE( Server, SetGameType );
MONO_DECLARE( Server, SetMapName );
MONO_DECLARE( Server, GetRuleValue );
MONO_DECLARE( Server, SetRuleValue );
MONO_DECLARE( Server, RemoveRuleValue );
// Element create/destroy
MONO_DECLARE( Element, Create );
MONO_DECLARE( Element, Destroy );
@ -115,6 +124,7 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Player, GetAccount );
MONO_DECLARE( Player, GetVersion );
MONO_DECLARE( Player, GetACInfo );
MONO_DECLARE( Player, GetPlayerAnnounceValue );
// Player set functions
MONO_DECLARE( Player, SetMoney );
@ -134,6 +144,7 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Player, DetonateSatchels );
MONO_DECLARE( Player, TakeScreenShot );
MONO_DECLARE( Player, SetTeam );
MONO_DECLARE( Player, SetPlayerAnnounceValue );
// Input funcs
MONO_DECLARE( Player, BindKey );
@ -607,7 +618,7 @@ void CMonoFunctions::Debug::Info( MonoString *string )
{
if( RESOURCE )
{
g_pModuleManager->DebugPrintf( RESOURCE->GetLua(), "%s\n", mono_string_to_utf8( string ) );
g_pModuleManager->DebugPrintf( RESOURCE->GetLua(), "%s", mono_string_to_utf8( string ) );
}
}
@ -748,3 +759,85 @@ MonoObject* CMonoFunctions::Server::GetVersion( void )
return NULL;
}
MonoString* CMonoFunctions::Server::GetGameType( void )
{
if( RESOURCE )
{
return RESOURCE->NewString( CLuaFunctionDefinitions::GetGameType( RESOURCE->GetLua() ) );
}
return NULL;
}
MonoString* CMonoFunctions::Server::GetMapName( void )
{
if( RESOURCE )
{
return RESOURCE->NewString( CLuaFunctionDefinitions::GetMapName( RESOURCE->GetLua() ) );
}
return NULL;
}
bool CMonoFunctions::Server::SetGameType( MonoString* msGameType )
{
if( RESOURCE )
{
const char* szGameType = mono_string_to_utf8( msGameType );
return CLuaFunctionDefinitions::SetGameType( RESOURCE->GetLua(), szGameType );
}
return false;
}
bool CMonoFunctions::Server::SetMapName( MonoString* msMapName )
{
if( RESOURCE )
{
const char* szMapName = mono_string_to_utf8( msMapName );
return CLuaFunctionDefinitions::SetMapName( RESOURCE->GetLua(), szMapName );
}
return false;
}
MonoString* CMonoFunctions::Server::GetRuleValue( MonoString* msKey )
{
if( RESOURCE )
{
const char* szKey = mono_string_to_utf8( msKey );
return RESOURCE->NewString( CLuaFunctionDefinitions::GetRuleValue( RESOURCE->GetLua(), szKey ) );
}
return false;
}
bool CMonoFunctions::Server::SetRuleValue( MonoString* msKey, MonoString* msValue )
{
if( RESOURCE )
{
const char* szKey = mono_string_to_utf8( msKey );
const char* szValue = mono_string_to_utf8( msValue );
return CLuaFunctionDefinitions::SetRuleValue( RESOURCE->GetLua(), szKey, szValue );
}
return false;
}
bool CMonoFunctions::Server::RemoveRuleValue( MonoString* msKey )
{
if( RESOURCE )
{
const char* szKey = mono_string_to_utf8( msKey );
return CLuaFunctionDefinitions::RemoveRuleValue( RESOURCE->GetLua(), szKey );
}
return false;
}

View File

@ -59,6 +59,15 @@ public:
static bool OutputConsole ( MonoString* szText, DWORD pElement );
static bool SetPassword ( MonoString* msPassword, bool bSave );
static MonoObject* GetVersion ( void );
static MonoString* GetGameType ( void );
static MonoString* GetMapName ( void );
static bool SetGameType ( MonoString* msGameType );
static bool SetMapName ( MonoString* msMapName );
static MonoString* GetRuleValue ( MonoString* msKey );
static bool SetRuleValue ( MonoString* msKey, MonoString* msValue );
static bool RemoveRuleValue ( MonoString* msKey );
};
class Element
@ -158,6 +167,7 @@ public:
static DWORD GetAccount ( DWORD pUserData );
static MonoString* GetVersion ( DWORD pUserData );
static MonoObject* GetACInfo ( DWORD pUserData );
static MonoString* GetPlayerAnnounceValue ( DWORD pElement, MonoString* msKey );
// Player set functions
static bool SetMoney ( DWORD pUserData, int iAmount, bool bInstant );
@ -177,6 +187,7 @@ public:
static bool DetonateSatchels ( DWORD pUserData );
static bool TakeScreenShot ( DWORD pUserData, int iWidth, int iHeight, MonoString* sTag, int iQuality, int iMaxBandwith );
static bool SetTeam ( DWORD pUserData, DWORD pTeam );
static bool SetPlayerAnnounceValue ( DWORD pElement, MonoString* msKey, MonoString* msValue );
// Input funcs
static bool BindKey ( DWORD pUserData, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName, MonoString* msArguments );
@ -669,11 +680,11 @@ public:
static DWORD Create ( MonoString* msResourceName, MonoString* msOrganizationalDir );
static DWORD Copy ( DWORD pResource, MonoString* msNewResourceName, MonoString* msOrganizationalDir );
static DWORD GetRootElement ( DWORD pResource = NULL );
static DWORD GetMapRootElement ( MonoString* msMap );
static DWORD GetMapRootElement ( DWORD pResource, MonoString* msMap );
static DWORD GetDynamicElementRoot ( DWORD pResource );
// static CXMLNode* AddMap ( MonoString* msFilePath, MonoString* msMapName, int iDimension );
// static CXMLNode* AddConfig ( MonoString* msFilePath, MonoString* msConfigName, int iType );
static bool RemoveFile ( MonoString* msFilename );
static bool RemoveFile ( DWORD pResource, MonoString* msFilename );
// static CXMLNode AddConfig ( MonoString* msFilePath, MonoString* msFileType );
// static CXMLNode AddMap ( MonoString* msFilePath, unsigned int uiDimension = 0 );
// static CXMLNode GetConfig ( MonoString* msFilePath );

View File

@ -358,7 +358,7 @@ MonoObject* CMonoFunctions::Player::GetACInfo( DWORD pUserData )
&msD3D9SHA256
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "ServerVersion", args, 8 );
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "PlayerACInfo", args, 4 );
if( pObject )
{
@ -369,6 +369,18 @@ MonoObject* CMonoFunctions::Player::GetACInfo( DWORD pUserData )
return NULL;
}
MonoString* CMonoFunctions::Player::GetPlayerAnnounceValue( DWORD pElement, MonoString* msKey )
{
if( RESOURCE )
{
const char* szKey = mono_string_to_utf8( msKey );
return RESOURCE->NewString( CLuaFunctionDefinitions::GetPlayerAnnounceValue( RESOURCE->GetLua(), (void*)pElement, szKey ) );
}
return NULL;
}
// Player set functions
bool CMonoFunctions::Player::SetMoney( DWORD pUserData, int iAmount, bool bInstant )
@ -558,6 +570,20 @@ bool CMonoFunctions::Player::SetTeam( DWORD pUserData, DWORD pTeam )
return false;
}
bool CMonoFunctions::Player::SetPlayerAnnounceValue( DWORD pElement, MonoString* msKey, MonoString* msValue )
{
if( RESOURCE )
{
const char* szKey = mono_string_to_utf8( msKey );
const char* szValue = mono_string_to_utf8( msValue );
return CLuaFunctionDefinitions::SetPlayerAnnounceValue( RESOURCE->GetLua(), (void*)pElement, szKey, szValue );
}
return NULL;
}
// Input funcs
bool CMonoFunctions::Player::BindKey( DWORD pUserData, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName, MonoString* msArguments )

View File

@ -49,13 +49,13 @@ DWORD CMonoFunctions::Resource::GetRootElement( DWORD pResource )
return NULL;
}
DWORD CMonoFunctions::Resource::GetMapRootElement( MonoString* msMap )
DWORD CMonoFunctions::Resource::GetMapRootElement( DWORD pResource, MonoString* msMap )
{
if( RESOURCE )
{
const char* szMap = mono_string_to_utf8( msMap );
return (DWORD)CLuaFunctionDefinitions::GetResourceMapRootElement( RESOURCE->GetLua(), szMap );
return (DWORD)CLuaFunctionDefinitions::GetResourceMapRootElement( RESOURCE->GetLua(), (void*)pResource, szMap );
}
return NULL;
@ -71,13 +71,13 @@ DWORD CMonoFunctions::Resource::GetDynamicElementRoot( DWORD pResource )
return NULL;
}
bool CMonoFunctions::Resource::RemoveFile( MonoString* msFilename )
bool CMonoFunctions::Resource::RemoveFile( DWORD pResource, MonoString* msFilename )
{
if( RESOURCE )
{
const char* szFileName = mono_string_to_utf8( msFilename );
return CLuaFunctionDefinitions::RemoveResourceFile( RESOURCE->GetLua(), szFileName );
return CLuaFunctionDefinitions::RemoveResourceFile( RESOURCE->GetLua(), (void*)pResource, szFileName );
}
return false;
@ -89,7 +89,7 @@ DWORD CMonoFunctions::Resource::GetFromName( MonoString* msResourceName )
{
const char* szResourceName = mono_string_to_utf8( msResourceName );
return (DWORD)CLuaFunctionDefinitions::RemoveResourceFile( RESOURCE->GetLua(), szResourceName );
return (DWORD)CLuaFunctionDefinitions::GetResourceFromName( RESOURCE->GetLua(), szResourceName );
}
return false;

View File

@ -164,6 +164,42 @@ bool CLuaFunctionDefinitions::SetRuleValue( lua_State *pLuaVM, const char* szKey
return false;
}
string CLuaFunctionDefinitions::GetPlayerAnnounceValue( lua_State* pLuaVM, void* pElement, const char* szKey )
{
CLuaArguments pLuaArguments;
pLuaArguments.PushUserData( pElement );
pLuaArguments.PushString( szKey );
if( pLuaArguments.Call( pLuaVM, "getPlayerAnnounceValue", 1 ) )
{
CLuaArgument pLuaArgument( pLuaVM, -1 );
if( const char *szString = pLuaArgument.GetString() )
return string( szString );
}
return string();
}
bool CLuaFunctionDefinitions::SetPlayerAnnounceValue( lua_State* pLuaVM, void* pElement, const char* szKey, const char* szValue )
{
CLuaArguments pLuaArguments;
pLuaArguments.PushUserData( pElement );
pLuaArguments.PushString( szKey );
pLuaArguments.PushString( szValue );
if( pLuaArguments.Call( pLuaVM, "setPlayerAnnounceValue", 1 ) )
{
CLuaArgument pLuaArgument( pLuaVM, -1 );
return pLuaArgument.GetBoolean();
}
return false;
}
// Element create/destroy
void* CLuaFunctionDefinitions::CreateElement( lua_State* pLuaVM, const char* szTypeName, const char* szID )
@ -7907,10 +7943,11 @@ void* CLuaFunctionDefinitions::GetResourceRootElement( lua_State* pLuaVM, void*
return NULL;
}
void* CLuaFunctionDefinitions::GetResourceMapRootElement( lua_State* pLuaVM, const char* szMap )
void* CLuaFunctionDefinitions::GetResourceMapRootElement( lua_State* pLuaVM, void* pResource, const char* szMap )
{
CLuaArguments pLuaArguments;
pLuaArguments.PushUserData( pResource );
pLuaArguments.PushString( szMap );
if( pLuaArguments.Call( pLuaVM, "getResourceMapRootElement", 1 ) )
@ -7939,10 +7976,11 @@ void* CLuaFunctionDefinitions::GetResourceDynamicElementRoot( lua_State* pLuaVM,
return NULL;
}
bool CLuaFunctionDefinitions::RemoveResourceFile( lua_State* pLuaVM, const char* szFilename )
bool CLuaFunctionDefinitions::RemoveResourceFile( lua_State* pLuaVM, void* pResource, const char* szFilename )
{
CLuaArguments pLuaArguments;
pLuaArguments.PushUserData( pResource );
pLuaArguments.PushString( szFilename );
if( pLuaArguments.Call( pLuaVM, "removeResourceFile", 1 ) )

View File

@ -29,8 +29,8 @@ public:
static string GetRuleValue ( lua_State* pLuaVM, const char* szKey );
static bool SetRuleValue ( lua_State* pLuaVM, const char* szKey, const char* szValue );
static bool RemoveRuleValue ( lua_State* pLuaVM, const char* szKey );
static string GetPlayerAnnounceValue ( lua_State* pLuaVM, void* pElement, const string& strKey );
static string SetPlayerAnnounceValue ( lua_State* pLuaVM, void* pElement, const string& strKey );
static string GetPlayerAnnounceValue ( lua_State* pLuaVM, void* pElement, const char* szKey );
static bool SetPlayerAnnounceValue ( lua_State* pLuaVM, void* pElement, const char* szKey, const char* szValue );
static string Get ( lua_State* pLuaVM, const char* szKey );
static bool Set ( lua_State* pLuaVM, const char* szKey, const char* szValue );
@ -604,11 +604,11 @@ public:
static void* CreateResource ( lua_State* pLuaVM, const char* szResourceName, const char* szOrganizationalDir );
static void* CopyResource ( lua_State* pLuaVM, void* pResource, const char* szNewResourceName, const char* szOrganizationalDir );
static void* GetResourceRootElement ( lua_State* pLuaVM, void* pResource = NULL );
static void* GetResourceMapRootElement ( lua_State* pLuaVM, const char* szMap );
static void* GetResourceMapRootElement ( lua_State* pLuaVM, void* pResource, const char* szMap );
static void* GetResourceDynamicElementRoot ( lua_State* pLuaVM, void* pResource );
// static CXMLNode* AddResourceMap ( lua_State* pLuaVM, const string& strFilePath, const std::string& strMapName, int iDimension );
// static CXMLNode* AddResourceConfig ( lua_State* pLuaVM, const string& strFilePath, const std::string& strConfigName, int iType );
static bool RemoveResourceFile ( lua_State* pLuaVM, const char* szFilename );
static bool RemoveResourceFile ( lua_State* pLuaVM, void* pResource, const char* szFilename );
// static CXMLNode AddResourceConfig ( lua_State* pLuaVM, const char* szFilePath, const char* szFileType = "server" );
// static CXMLNode AddResourceMap ( lua_State* pLuaVM, const char* szFilePath, unsigned int uiDimension = 0 );
// static CXMLNode GetResourceConfig ( lua_State* pLuaVM, const char* szFilePath );