Изменён метод работы с библиотеками. Исправлены ошибки

This commit is contained in:
Kernell 2015-11-28 04:41:37 +03:00
parent 9b0242c67b
commit 31a0c20137
18 changed files with 4118 additions and 4443 deletions

View File

@ -1,189 +1,189 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
void CMonoFunctions::AddInternals( void )
{
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
void CMonoFunctions::AddInternals( void )
{
mono_add_internal_call( "MultiTheftAuto.Debug::Log", CMonoFunctions::Debug::Log );
mono_add_internal_call( "MultiTheftAuto.Debug::Info", CMonoFunctions::Debug::Info );
mono_add_internal_call( "MultiTheftAuto.Debug::Error", CMonoFunctions::Debug::Error );
MONO_DECLARE( Config, Get );
MONO_DECLARE( Config, Set );
MONO_DECLARE( Server, GetMaxPlayers );
MONO_DECLARE( Server, SetMaxPlayers );
MONO_DECLARE( Server, OutputChatBox );
MONO_DECLARE( Server, OutputConsole );
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 );
MONO_DECLARE( Element, Clone );
// Element get funcs
MONO_DECLARE( Element, GetByType );
MONO_DECLARE( Element, IsElement );
MONO_DECLARE( Element, GetType );
MONO_DECLARE( Element, GetByID );
MONO_DECLARE( Element, GetByIndex );
MONO_DECLARE( Element, GetChild );
MONO_DECLARE( Element, GetChildrenCount );
MONO_DECLARE( Element, GetID );
MONO_DECLARE( Element, GetParent );
MONO_DECLARE( Element, GetPosition );
MONO_DECLARE( Element, GetRotation );
MONO_DECLARE( Element, GetVelocity );
MONO_DECLARE( Element, GetInterior );
MONO_DECLARE( Element, IsWithinColShape );
MONO_DECLARE( Element, IsWithinMarker );
MONO_DECLARE( Element, GetDimension );
MONO_DECLARE( Element, GetZoneName );
MONO_DECLARE( Element, IsAttached );
MONO_DECLARE( Element, GetAttachedTo );
MONO_DECLARE( Element, GetColShape );
MONO_DECLARE( Element, GetAlpha );
MONO_DECLARE( Element, IsDoubleSided );
MONO_DECLARE( Element, GetHealth );
MONO_DECLARE( Element, GetModel );
MONO_DECLARE( Element, IsInWater );
MONO_DECLARE( Element, GetAttachedOffsetPosition );
MONO_DECLARE( Element, GetAttachedOffsetRotation );
MONO_DECLARE( Element, GetSyncer );
MONO_DECLARE( Element, GetCollisionsEnabled );
MONO_DECLARE( Element, IsFrozen );
MONO_DECLARE( Element, GetLowLod );
MONO_DECLARE( Element, IsLowLod );
// Element set funcs
MONO_DECLARE( Element, ClearVisibleTo );
MONO_DECLARE( Element, SetID );
MONO_DECLARE( Element, SetData );
MONO_DECLARE( Element, RemoveData );
MONO_DECLARE( Element, SetParent );
MONO_DECLARE( Element, SetPosition );
MONO_DECLARE( Element, SetRotation );
MONO_DECLARE( Element, SetVelocity );
MONO_DECLARE( Element, SetVisibleTo );
MONO_DECLARE( Element, SetInterior );
MONO_DECLARE( Element, SetDimension );
MONO_DECLARE( Element, Attach );
MONO_DECLARE( Element, Detach );
MONO_DECLARE( Element, SetAlpha );
MONO_DECLARE( Element, SetDoubleSided );
MONO_DECLARE( Element, SetHealth );
MONO_DECLARE( Element, SetModel );
MONO_DECLARE( Element, SetAttachedOffsets );
MONO_DECLARE( Element, SetSyncer );
MONO_DECLARE( Element, SetCollisionsEnabled );
MONO_DECLARE( Element, SetFrozen );
MONO_DECLARE( Element, SetLowLod );
// Player get functions
MONO_DECLARE( Player, GetCount );
MONO_DECLARE( Player, GetFromName );
MONO_DECLARE( Player, GetPing );
MONO_DECLARE( Player, GetMoney );
MONO_DECLARE( Player, GetRandom );
MONO_DECLARE( Player, IsMuted );
MONO_DECLARE( Player, GetTeam );
MONO_DECLARE( Player, GetWantedLevel );
MONO_DECLARE( Player, GetAlivePlayers );
MONO_DECLARE( Player, GetDeadPlayers );
MONO_DECLARE( Player, GetIdleTime );
MONO_DECLARE( Player, IsMapForced );
MONO_DECLARE( Player, GetNametagText );
MONO_DECLARE( Player, GetNametagColor );
MONO_DECLARE( Player, IsNametagShowing );
MONO_DECLARE( Player, GetSerial );
MONO_DECLARE( Player, GetUserName );
MONO_DECLARE( Player, GetBlurLevel );
MONO_DECLARE( Player, GetName );
MONO_DECLARE( Player, GetIP );
MONO_DECLARE( Player, GetAccount );
MONO_DECLARE( Player, GetVersion );
MONO_DECLARE( Player, GetACInfo );
MONO_DECLARE( Player, GetPlayerAnnounceValue );
// Player set functions
MONO_DECLARE( Player, SetMoney );
MONO_DECLARE( Player, GiveMoney );
MONO_DECLARE( Player, TakeMoney );
MONO_DECLARE( Player, Spawn );
MONO_DECLARE( Player, ShowHudComponent );
MONO_DECLARE( Player, SetWantedLevel );
MONO_DECLARE( Player, ForceMap );
MONO_DECLARE( Player, SetNametagText );
MONO_DECLARE( Player, SetNametagColor );
MONO_DECLARE( Player, SetNametagShowing );
MONO_DECLARE( Player, SetMuted );
MONO_DECLARE( Player, SetBlurLevel );
MONO_DECLARE( Player, Redirect );
MONO_DECLARE( Player, SetName );
MONO_DECLARE( Player, DetonateSatchels );
MONO_DECLARE( Player, TakeScreenShot );
MONO_DECLARE( Player, SetTeam );
MONO_DECLARE( Player, SetPlayerAnnounceValue );
// Input funcs
MONO_DECLARE( Player, BindKey );
MONO_DECLARE( Player, UnbindKey );
MONO_DECLARE( Player, GetControlState );
MONO_DECLARE( Player, IsControlEnabled );
MONO_DECLARE( Player, SetControlState );
MONO_DECLARE( Player, ToggleControl );
MONO_DECLARE( Player, ToggleAllControls );
// Log in/out funcs
MONO_DECLARE( Player, LogIn );
MONO_DECLARE( Player, LogOut );
// Admin funcs
MONO_DECLARE( Player, Kick );
MONO_DECLARE( Player, Ban );
// Cursor get funcs
MONO_DECLARE( Player, IsCursorShowing );
// Cursor set funcs
MONO_DECLARE( Player, ShowCursor );
// Chat funcs
MONO_DECLARE( Player, ShowChat );
// Camera get functions
MONO_DECLARE( Player, GetCameraMatrix );
MONO_DECLARE( Player, GetCameraTarget );
MONO_DECLARE( Player, GetCameraInterior );
// Camera set functions
MONO_DECLARE( Player, SetCameraMatrix );
MONO_DECLARE( Player, SetCameraTarget );
MONO_DECLARE( Player, SetCameraInterior );
MONO_DECLARE( Player, FadeCamera );
MONO_DECLARE( Config, Get );
MONO_DECLARE( Config, Set );
MONO_DECLARE( Server, GetMaxPlayers );
MONO_DECLARE( Server, SetMaxPlayers );
MONO_DECLARE( Server, OutputChatBox );
MONO_DECLARE( Server, OutputConsole );
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 );
MONO_DECLARE( Element, Clone );
// Element get funcs
MONO_DECLARE( Element, GetByType );
MONO_DECLARE( Element, IsElement );
MONO_DECLARE( Element, GetType );
MONO_DECLARE( Element, GetByID );
MONO_DECLARE( Element, GetByIndex );
MONO_DECLARE( Element, GetChild );
MONO_DECLARE( Element, GetChildrenCount );
MONO_DECLARE( Element, GetID );
MONO_DECLARE( Element, GetParent );
MONO_DECLARE( Element, GetPosition );
MONO_DECLARE( Element, GetRotation );
MONO_DECLARE( Element, GetVelocity );
MONO_DECLARE( Element, GetInterior );
MONO_DECLARE( Element, IsWithinColShape );
MONO_DECLARE( Element, IsWithinMarker );
MONO_DECLARE( Element, GetDimension );
MONO_DECLARE( Element, GetZoneName );
MONO_DECLARE( Element, IsAttached );
MONO_DECLARE( Element, GetAttachedTo );
MONO_DECLARE( Element, GetColShape );
MONO_DECLARE( Element, GetAlpha );
MONO_DECLARE( Element, IsDoubleSided );
MONO_DECLARE( Element, GetHealth );
MONO_DECLARE( Element, GetModel );
MONO_DECLARE( Element, IsInWater );
MONO_DECLARE( Element, GetAttachedOffsetPosition );
MONO_DECLARE( Element, GetAttachedOffsetRotation );
MONO_DECLARE( Element, GetSyncer );
MONO_DECLARE( Element, GetCollisionsEnabled );
MONO_DECLARE( Element, IsFrozen );
MONO_DECLARE( Element, GetLowLod );
MONO_DECLARE( Element, IsLowLod );
// Element set funcs
MONO_DECLARE( Element, ClearVisibleTo );
MONO_DECLARE( Element, SetID );
MONO_DECLARE( Element, SetData );
MONO_DECLARE( Element, RemoveData );
MONO_DECLARE( Element, SetParent );
MONO_DECLARE( Element, SetPosition );
MONO_DECLARE( Element, SetRotation );
MONO_DECLARE( Element, SetVelocity );
MONO_DECLARE( Element, SetVisibleTo );
MONO_DECLARE( Element, SetInterior );
MONO_DECLARE( Element, SetDimension );
MONO_DECLARE( Element, Attach );
MONO_DECLARE( Element, Detach );
MONO_DECLARE( Element, SetAlpha );
MONO_DECLARE( Element, SetDoubleSided );
MONO_DECLARE( Element, SetHealth );
MONO_DECLARE( Element, SetModel );
MONO_DECLARE( Element, SetAttachedOffsets );
MONO_DECLARE( Element, SetSyncer );
MONO_DECLARE( Element, SetCollisionsEnabled );
MONO_DECLARE( Element, SetFrozen );
MONO_DECLARE( Element, SetLowLod );
// Player get functions
MONO_DECLARE( Player, GetCount );
MONO_DECLARE( Player, GetFromName );
MONO_DECLARE( Player, GetPing );
MONO_DECLARE( Player, GetMoney );
MONO_DECLARE( Player, GetRandom );
MONO_DECLARE( Player, IsMuted );
MONO_DECLARE( Player, GetTeam );
MONO_DECLARE( Player, GetWantedLevel );
MONO_DECLARE( Player, GetAlivePlayers );
MONO_DECLARE( Player, GetDeadPlayers );
MONO_DECLARE( Player, GetIdleTime );
MONO_DECLARE( Player, IsMapForced );
MONO_DECLARE( Player, GetNametagText );
MONO_DECLARE( Player, GetNametagColor );
MONO_DECLARE( Player, IsNametagShowing );
MONO_DECLARE( Player, GetSerial );
MONO_DECLARE( Player, GetUserName );
MONO_DECLARE( Player, GetBlurLevel );
MONO_DECLARE( Player, GetName );
MONO_DECLARE( Player, GetIP );
MONO_DECLARE( Player, GetAccount );
MONO_DECLARE( Player, GetVersion );
MONO_DECLARE( Player, GetACInfo );
MONO_DECLARE( Player, GetPlayerAnnounceValue );
// Player set functions
MONO_DECLARE( Player, SetMoney );
MONO_DECLARE( Player, GiveMoney );
MONO_DECLARE( Player, TakeMoney );
MONO_DECLARE( Player, Spawn );
MONO_DECLARE( Player, ShowHudComponent );
MONO_DECLARE( Player, SetWantedLevel );
MONO_DECLARE( Player, ForceMap );
MONO_DECLARE( Player, SetNametagText );
MONO_DECLARE( Player, SetNametagColor );
MONO_DECLARE( Player, SetNametagShowing );
MONO_DECLARE( Player, SetMuted );
MONO_DECLARE( Player, SetBlurLevel );
MONO_DECLARE( Player, Redirect );
MONO_DECLARE( Player, SetName );
MONO_DECLARE( Player, DetonateSatchels );
MONO_DECLARE( Player, TakeScreenShot );
MONO_DECLARE( Player, SetTeam );
MONO_DECLARE( Player, SetPlayerAnnounceValue );
// Input funcs
MONO_DECLARE( Player, BindKey );
MONO_DECLARE( Player, UnbindKey );
MONO_DECLARE( Player, GetControlState );
MONO_DECLARE( Player, IsControlEnabled );
MONO_DECLARE( Player, SetControlState );
MONO_DECLARE( Player, ToggleControl );
MONO_DECLARE( Player, ToggleAllControls );
// Log in/out funcs
MONO_DECLARE( Player, LogIn );
MONO_DECLARE( Player, LogOut );
// Admin funcs
MONO_DECLARE( Player, Kick );
MONO_DECLARE( Player, Ban );
// Cursor get funcs
MONO_DECLARE( Player, IsCursorShowing );
// Cursor set funcs
MONO_DECLARE( Player, ShowCursor );
// Chat funcs
MONO_DECLARE( Player, ShowChat );
// Camera get functions
MONO_DECLARE( Player, GetCameraMatrix );
MONO_DECLARE( Player, GetCameraTarget );
MONO_DECLARE( Player, GetCameraInterior );
// Camera set functions
MONO_DECLARE( Player, SetCameraMatrix );
MONO_DECLARE( Player, SetCameraTarget );
MONO_DECLARE( Player, SetCameraInterior );
MONO_DECLARE( Player, FadeCamera );
// Ped get functions
MONO_DECLARE( Ped, Create );
MONO_DECLARE( Ped, GetArmor );
@ -246,8 +246,8 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Ped, GiveWeapon );
MONO_DECLARE( Ped, TakeWeapon );
MONO_DECLARE( Ped, TakeAllWeapons );
MONO_DECLARE( Ped, SetWeaponAmmo );
MONO_DECLARE( Ped, SetWeaponAmmo );
// Vehicle create/destroy functions
MONO_DECLARE( Vehicle, Create );
@ -341,8 +341,8 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Vehicle, SetSirens );
MONO_DECLARE( Vehicle, GetSirens );
MONO_DECLARE( Vehicle, GetSirenParams );
MONO_DECLARE( Vehicle, SetPlateText );
MONO_DECLARE( Vehicle, SetPlateText );
// Marker create/destroy functions
MONO_DECLARE( Marker, Create );
@ -603,241 +603,234 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Resource, Rename );
MONO_DECLARE( Resource, Delete );
// MONO_DECLARE( Resource, GetACLRequests );
MONO_DECLARE( Resource, UpdateACLRequest );
}
void CMonoFunctions::Debug::Log( MonoString *string )
{
if( RESOURCE )
{
g_pModuleManager->Printf( "%s\n", mono_string_to_utf8( string ) );
}
}
void CMonoFunctions::Debug::Info( MonoString *string )
{
if( RESOURCE )
{
g_pModuleManager->DebugPrintf( RESOURCE->GetLua(), "%s", mono_string_to_utf8( string ) );
}
}
void CMonoFunctions::Debug::Error( MonoString *string )
{
if( RESOURCE )
{
g_pModuleManager->ErrorPrintf( "%s\n", mono_string_to_utf8( string ) );
}
}
MonoString *CMonoFunctions::Config::Get( MonoString *msKey )
{
if( RESOURCE )
{
string sValue = CLuaFunctionDefinitions::Get( RESOURCE->GetLua(), mono_string_to_utf8( msKey ) );
return mono_string_new( mono_domain_get(), sValue.c_str() );
}
return mono_string_new( mono_domain_get(), "" );
}
bool CMonoFunctions::Config::Set( MonoString *msKey, MonoString *msValue )
{
if( RESOURCE )
{
const char* szKey = mono_string_to_utf8( msKey );
const char* szValue = mono_string_to_utf8( msValue );
return CLuaFunctionDefinitions::Set( RESOURCE->GetLua(), szKey, szValue );
}
return false;
}
unsigned int CMonoFunctions::Server::GetMaxPlayers( void )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::GetMaxPlayers( RESOURCE->GetLua() );
}
return 0;
}
bool CMonoFunctions::Server::SetMaxPlayers( unsigned int uiMax )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetMaxPlayers( RESOURCE->GetLua(), uiMax );
}
return 0;
}
bool CMonoFunctions::Server::OutputChatBox( MonoString* msText, DWORD pElement, MonoObject* mpColor, bool bColorCoded )
{
if( RESOURCE )
{
const char* szText = mono_string_to_utf8( msText );
CMonoObject pColor( mpColor );
unsigned char ucRed = pColor.GetPropertyValue< unsigned char >( "R" );
unsigned char ucGreen = pColor.GetPropertyValue< unsigned char >( "G" );
unsigned char ucBlue = pColor.GetPropertyValue< unsigned char >( "B" );
return CLuaFunctionDefinitions::OutputChatBox( RESOURCE->GetLua(), szText, (void*)pElement, ucRed, ucGreen, ucBlue, bColorCoded );
}
return false;
}
bool CMonoFunctions::Server::OutputConsole( MonoString* msText, DWORD pElement )
{
if( RESOURCE )
{
const char* szText = mono_string_to_utf8( msText );
return CLuaFunctionDefinitions::OutputConsole( RESOURCE->GetLua(), szText, (void*)pElement );
}
return false;
}
bool CMonoFunctions::Server::SetPassword( MonoString* msPassword, bool bSave )
{
if( RESOURCE )
{
const char* szPassword = mono_string_to_utf8( msPassword );
return CLuaFunctionDefinitions::SetServerPassword( RESOURCE->GetLua(), szPassword, bSave );
}
return false;
}
MonoObject* CMonoFunctions::Server::GetVersion( void )
{
if( RESOURCE )
{
LuaTable pLuaTable = CLuaFunctionDefinitions::GetVersion( RESOURCE->GetLua() );
if( !pLuaTable.empty() )
{
unsigned long ulNumber = pLuaTable[ "number" ]->GetNumber< unsigned long >();
const char* szString = pLuaTable[ "mta" ]->GetString();
const char* szName = pLuaTable[ "name" ]->GetString();
const char* szBuildType = pLuaTable[ "type" ]->GetString();
unsigned long ulNetcode = pLuaTable[ "netcode" ]->GetNumber< unsigned long >();
const char* szOS = pLuaTable[ "os" ]->GetString();
const char* szBuildTag = pLuaTable[ "tag" ]->GetString();
const char* szSortable = pLuaTable[ "sortable" ]->GetString();
void *args[] =
{
&ulNumber,
&szString,
&szName,
&szBuildType,
&ulNetcode,
&szOS,
&szBuildTag,
&szSortable
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "ServerVersion", args, 8 );
if( pObject )
{
return pObject->GetObject();
}
}
}
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;
}
MONO_DECLARE( Resource, UpdateACLRequest );
}
void CMonoFunctions::Debug::Log( MonoString *string )
{
if( RESOURCE )
{
g_pModuleManager->Printf( "%s\n", mono_string_to_utf8( string ) );
}
}
void CMonoFunctions::Debug::Info( MonoString *string )
{
if( RESOURCE )
{
g_pModuleManager->DebugPrintf( RESOURCE->GetLua(), "%s", mono_string_to_utf8( string ) );
}
}
void CMonoFunctions::Debug::Error( MonoString *string )
{
if( RESOURCE )
{
g_pModuleManager->ErrorPrintf( "%s\n", mono_string_to_utf8( string ) );
}
}
MonoString *CMonoFunctions::Config::Get( MonoString *msKey )
{
if( RESOURCE )
{
string sValue = CLuaFunctionDefinitions::Get( RESOURCE->GetLua(), mono_string_to_utf8( msKey ) );
return mono_string_new( mono_domain_get(), sValue.c_str() );
}
return mono_string_new( mono_domain_get(), "" );
}
bool CMonoFunctions::Config::Set( MonoString *msKey, MonoString *msValue )
{
if( RESOURCE )
{
const char* szKey = mono_string_to_utf8( msKey );
const char* szValue = mono_string_to_utf8( msValue );
return CLuaFunctionDefinitions::Set( RESOURCE->GetLua(), szKey, szValue );
}
return false;
}
unsigned int CMonoFunctions::Server::GetMaxPlayers( void )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::GetMaxPlayers( RESOURCE->GetLua() );
}
return 0;
}
bool CMonoFunctions::Server::SetMaxPlayers( unsigned int uiMax )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetMaxPlayers( RESOURCE->GetLua(), uiMax );
}
return 0;
}
bool CMonoFunctions::Server::OutputChatBox( MonoString* msText, DWORD pElement, MonoObject* mpColor, bool bColorCoded )
{
if( RESOURCE )
{
const char* szText = mono_string_to_utf8( msText );
unsigned char ucRed = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "R" );
unsigned char ucGreen = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "G" );
unsigned char ucBlue = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "B" );
return CLuaFunctionDefinitions::OutputChatBox( RESOURCE->GetLua(), szText, (void*)pElement, ucRed, ucGreen, ucBlue, bColorCoded );
}
return false;
}
bool CMonoFunctions::Server::OutputConsole( MonoString* msText, DWORD pElement )
{
if( RESOURCE )
{
const char* szText = mono_string_to_utf8( msText );
return CLuaFunctionDefinitions::OutputConsole( RESOURCE->GetLua(), szText, (void*)pElement );
}
return false;
}
bool CMonoFunctions::Server::SetPassword( MonoString* msPassword, bool bSave )
{
if( RESOURCE )
{
const char* szPassword = mono_string_to_utf8( msPassword );
return CLuaFunctionDefinitions::SetServerPassword( RESOURCE->GetLua(), szPassword, bSave );
}
return false;
}
MonoObject* CMonoFunctions::Server::GetVersion( void )
{
if( RESOURCE )
{
LuaTable pLuaTable = CLuaFunctionDefinitions::GetVersion( RESOURCE->GetLua() );
if( !pLuaTable.empty() )
{
unsigned long ulNumber = pLuaTable[ "number" ]->GetNumber< unsigned long >();
const char* szString = pLuaTable[ "mta" ]->GetString();
const char* szName = pLuaTable[ "name" ]->GetString();
const char* szBuildType = pLuaTable[ "type" ]->GetString();
unsigned long ulNetcode = pLuaTable[ "netcode" ]->GetNumber< unsigned long >();
const char* szOS = pLuaTable[ "os" ]->GetString();
const char* szBuildTag = pLuaTable[ "tag" ]->GetString();
const char* szSortable = pLuaTable[ "sortable" ]->GetString();
void *args[] =
{
&ulNumber,
&szString,
&szName,
&szBuildType,
&ulNetcode,
&szOS,
&szBuildTag,
&szSortable
};
return RESOURCE->NewObject( "MultiTheftAuto", "ServerVersion", args, 8 );
}
}
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

@ -1,36 +1,34 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Audio funcs
bool CMonoFunctions::Audio::PlayFrontEnd( DWORD pUserData, unsigned char ucSound )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::PlaySoundFrontEnd( RESOURCE->GetLua(), (void*)pUserData, ucSound );
}
return false;
}
bool CMonoFunctions::Audio::PlayMission( DWORD pUserData, MonoObject* pPosition, unsigned short usSlot )
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
return CLuaFunctionDefinitions::PlayMissionAudio( RESOURCE->GetLua(), (void*)pUserData, vecPosition, usSlot );
}
return false;
}
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Audio funcs
bool CMonoFunctions::Audio::PlayFrontEnd( DWORD pUserData, unsigned char ucSound )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::PlaySoundFrontEnd( RESOURCE->GetLua(), (void*)pUserData, ucSound );
}
return false;
}
bool CMonoFunctions::Audio::PlayMission( DWORD pUserData, MonoObject* pPosition, unsigned short usSlot )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::PlayMissionAudio( RESOURCE->GetLua(), (void*)pUserData, Vector3( pPosition ), usSlot );
}
return false;
}

View File

@ -1,175 +1,168 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Blip create/destroy functions
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Blip create/destroy functions
DWORD CMonoFunctions::Blip::Create( MonoObject* pPosition, unsigned char ucIcon, unsigned char ucSize, MonoObject* color, short sOrdering, unsigned short usVisibleDistance, DWORD pVisibleTo )
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
SColor pColor = CMonoObject( color ).GetColor();
return (DWORD)CLuaFunctionDefinitions::CreateBlip( RESOURCE->GetLua(), vecPosition, ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, (void*)pVisibleTo );
}
if( RESOURCE )
{
Vector3 vecPosition( pPosition );
SColor pColor = CMonoObject::GetColor( color );
return (DWORD)CLuaFunctionDefinitions::CreateBlip( RESOURCE->GetLua(), vecPosition, ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, (void*)pVisibleTo );
}
return NULL;
}
DWORD CMonoFunctions::Blip::CreateAttachedTo( DWORD pTarget, unsigned char ucIcon, unsigned char ucSize, MonoObject* color, short sOrdering, unsigned short usVisibleDistance, DWORD pVisibleTo )
{
if( RESOURCE )
{
SColor pColor = CMonoObject( color ).GetColor();
return (DWORD)CLuaFunctionDefinitions::CreateBlipAttachedTo( RESOURCE->GetLua(), (void*)pTarget, ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, (void*)pVisibleTo );
}
if( RESOURCE )
{
SColor pColor = CMonoObject::GetColor( color );
return (DWORD)CLuaFunctionDefinitions::CreateBlipAttachedTo( RESOURCE->GetLua(), (void*)pTarget, ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, (void*)pVisibleTo );
}
return NULL;
}
// Blip get functions
// Blip get functions
unsigned char CMonoFunctions::Blip::GetIcon( DWORD pUserData )
{
if( RESOURCE )
{
unsigned char ucIcon;
if( CLuaFunctionDefinitions::GetBlipIcon( RESOURCE->GetLua(), (void*)pUserData, ucIcon ) )
{
return ucIcon;
}
if( RESOURCE )
{
unsigned char ucIcon;
if( CLuaFunctionDefinitions::GetBlipIcon( RESOURCE->GetLua(), (void*)pUserData, ucIcon ) )
{
return ucIcon;
}
}
return 0;
}
unsigned char CMonoFunctions::Blip::GetSize( DWORD pUserData )
{
if( RESOURCE )
{
unsigned char ucSize;
if( CLuaFunctionDefinitions::GetBlipSize( RESOURCE->GetLua(), (void*)pUserData, ucSize ) )
{
return ucSize;
}
if( RESOURCE )
{
unsigned char ucSize;
if( CLuaFunctionDefinitions::GetBlipSize( RESOURCE->GetLua(), (void*)pUserData, ucSize ) )
{
return ucSize;
}
}
return 0;
}
MonoObject* CMonoFunctions::Blip::GetColor( DWORD pUserData )
{
if( RESOURCE )
{
SColor outColor;
if( CLuaFunctionDefinitions::GetBlipColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
CMonoObject* pObject = RESOURCE->NewObject( outColor );
if( pObject )
{
return pObject->GetObject();
}
}
if( RESOURCE )
{
SColor outColor;
if( CLuaFunctionDefinitions::GetBlipColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
return RESOURCE->NewObject( outColor );
}
}
return NULL;
}
short CMonoFunctions::Blip::GetOrdering( DWORD pUserData )
{
if( RESOURCE )
{
short sOrdering;
if( CLuaFunctionDefinitions::GetBlipOrdering( RESOURCE->GetLua(), (void*)pUserData, sOrdering ) )
{
return sOrdering;
}
if( RESOURCE )
{
short sOrdering;
if( CLuaFunctionDefinitions::GetBlipOrdering( RESOURCE->GetLua(), (void*)pUserData, sOrdering ) )
{
return sOrdering;
}
}
return 0;
}
unsigned short CMonoFunctions::Blip::GetVisibleDistance( DWORD pUserData )
{
if( RESOURCE )
{
unsigned short usVisibleDistance;
if( CLuaFunctionDefinitions::GetBlipVisibleDistance( RESOURCE->GetLua(), (void*)pUserData, usVisibleDistance ) )
{
return usVisibleDistance;
}
if( RESOURCE )
{
unsigned short usVisibleDistance;
if( CLuaFunctionDefinitions::GetBlipVisibleDistance( RESOURCE->GetLua(), (void*)pUserData, usVisibleDistance ) )
{
return usVisibleDistance;
}
}
return 0;
}
// Blip set functions
// Blip set functions
bool CMonoFunctions::Blip::SetIcon( DWORD pUserData, unsigned char ucIcon )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipIcon( RESOURCE->GetLua(), (void*)pUserData, ucIcon );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipIcon( RESOURCE->GetLua(), (void*)pUserData, ucIcon );
}
return false;
}
bool CMonoFunctions::Blip::SetSize( DWORD pUserData, unsigned char ucSize )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipSize( RESOURCE->GetLua(), (void*)pUserData, ucSize );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipSize( RESOURCE->GetLua(), (void*)pUserData, ucSize );
}
return false;
}
bool CMonoFunctions::Blip::SetColor( DWORD pUserData, MonoObject* color )
{
if( RESOURCE )
{
SColor pColor = CMonoObject( color ).GetColor();
return CLuaFunctionDefinitions::SetBlipColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipColor( RESOURCE->GetLua(), (void*)pUserData, CMonoObject::GetColor( color ) );
}
return false;
}
bool CMonoFunctions::Blip::SetOrdering( DWORD pUserData, short sOrdering )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipOrdering( RESOURCE->GetLua(), (void*)pUserData, sOrdering );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipOrdering( RESOURCE->GetLua(), (void*)pUserData, sOrdering );
}
return false;
}
bool CMonoFunctions::Blip::SetVisibleDistance( DWORD pUserData, unsigned short usVisibleDistance )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipVisibleDistance( RESOURCE->GetLua(), (void*)pUserData, usVisibleDistance );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetBlipVisibleDistance( RESOURCE->GetLua(), (void*)pUserData, usVisibleDistance );
}
return false;

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,24 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Explosion funcs
bool CMonoFunctions::Explosion::Create( MonoObject* pPosition, unsigned char ucType, DWORD pCreator )
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
return (DWORD)CLuaFunctionDefinitions::CreateExplosion( RESOURCE->GetLua(), vecPosition, ucType, (void*)pCreator );
}
return NULL;
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Explosion funcs
bool CMonoFunctions::Explosion::Create( MonoObject* pPosition, unsigned char ucType, DWORD pCreator )
{
if( RESOURCE )
{
return (DWORD)CLuaFunctionDefinitions::CreateExplosion( RESOURCE->GetLua(), Vector3( pPosition ), ucType, (void*)pCreator );
}
return NULL;
}

View File

@ -1,217 +1,173 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Marker create/destroy functions
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Marker create/destroy functions
DWORD CMonoFunctions::Marker::Create( MonoObject* pPosition, MonoString* msType, float fSize, MonoObject* pColor, DWORD pVisibleTo )
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
const char* szType = mono_string_to_utf8( msType );
CMonoObject pMonoColor( pColor );
SColor pColor;
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
return (DWORD)CLuaFunctionDefinitions::CreateMarker( RESOURCE->GetLua(), vecPosition, szType, fSize, pColor, (void*)pVisibleTo );
}
return NULL;
}
// Marker get functions
unsigned int CMonoFunctions::Marker::GetCount()
{
if( RESOURCE )
{
unsigned int uiCount;
if( CLuaFunctionDefinitions::GetMarkerCount( RESOURCE->GetLua(), uiCount ) )
{
return uiCount;
}
if( RESOURCE )
{
const char* szType = mono_string_to_utf8( msType );
return (DWORD)CLuaFunctionDefinitions::CreateMarker( RESOURCE->GetLua(), Vector3( pPosition ), szType, fSize, CMonoObject::GetColor( pColor ), (void*)pVisibleTo );
}
return 0;
}
return NULL;
}
// Marker get functions
unsigned int CMonoFunctions::Marker::GetCount()
{
if( RESOURCE )
{
unsigned int uiCount;
if( CLuaFunctionDefinitions::GetMarkerCount( RESOURCE->GetLua(), uiCount ) )
{
return uiCount;
}
}
return 0;
}
MonoString* CMonoFunctions::Marker::GetType( DWORD pUserData )
{
if( RESOURCE )
{
char* szType = NULL;
if( CLuaFunctionDefinitions::GetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szType ) )
{
return RESOURCE->NewString( szType );
}
if( RESOURCE )
{
char* szType = NULL;
if( CLuaFunctionDefinitions::GetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szType ) )
{
return RESOURCE->NewString( szType );
}
}
return NULL;
}
float CMonoFunctions::Marker::GetSize( DWORD pUserData )
{
if( RESOURCE )
{
float fSize;
if( CLuaFunctionDefinitions::GetMarkerSize( RESOURCE->GetLua(), (void*)pUserData, fSize ) )
{
return fSize;
}
if( RESOURCE )
{
float fSize;
if( CLuaFunctionDefinitions::GetMarkerSize( RESOURCE->GetLua(), (void*)pUserData, fSize ) )
{
return fSize;
}
}
return 0.0f;
}
MonoObject* CMonoFunctions::Marker::GetColor( DWORD pUserData )
{
if( RESOURCE )
{
SColor outColor;
if( CLuaFunctionDefinitions::GetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
CMonoObject* pObject = RESOURCE->NewObject( outColor );
if( pObject )
{
return pObject->GetObject();
}
}
if( RESOURCE )
{
SColor outColor;
if( CLuaFunctionDefinitions::GetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
return RESOURCE->NewObject( outColor );
}
}
return NULL;
}
MonoObject* CMonoFunctions::Marker::GetTarget( DWORD pUserData )
{
if( RESOURCE )
{
Vector3 vecPosition;
if( CLuaFunctionDefinitions::GetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
if( pObject )
{
return pObject->GetObject();
}
}
if( RESOURCE )
{
Vector3 vecPosition;
if( CLuaFunctionDefinitions::GetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
return RESOURCE->NewObject( vecPosition );
}
}
return NULL;
}
MonoString* CMonoFunctions::Marker::GetIcon( DWORD pUserData )
{
if( RESOURCE )
{
char* szIcon = NULL;
if( CLuaFunctionDefinitions::GetMarkerIcon( RESOURCE->GetLua(), (void*)pUserData, szIcon ) )
{
return RESOURCE->NewString( szIcon );
}
if( RESOURCE )
{
char* szIcon = NULL;
if( CLuaFunctionDefinitions::GetMarkerIcon( RESOURCE->GetLua(), (void*)pUserData, szIcon ) )
{
return RESOURCE->NewString( szIcon );
}
}
return NULL;
}
// Marker set functions
// Marker set functions
bool CMonoFunctions::Marker::SetType( DWORD pUserData, MonoString* msType )
{
if( RESOURCE )
{
const char* szType = mono_string_to_utf8( msType );
return CLuaFunctionDefinitions::SetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szType );
if( RESOURCE )
{
const char* szType = mono_string_to_utf8( msType );
return CLuaFunctionDefinitions::SetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szType );
}
return false;
}
bool CMonoFunctions::Marker::SetSize( DWORD pUserData, float fSize )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetMarkerSize( RESOURCE->GetLua(), (void*)pUserData, fSize );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetMarkerSize( RESOURCE->GetLua(), (void*)pUserData, fSize );
}
return false;
}
bool CMonoFunctions::Marker::SetColor( DWORD pUserData, MonoObject* color )
bool CMonoFunctions::Marker::SetColor( DWORD pUserData, MonoObject* pColor )
{
if( RESOURCE )
{
SColor pColor;
CMonoObject pMonoColor( color );
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
return CLuaFunctionDefinitions::SetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, CMonoObject::GetColor( pColor ) );
}
return false;
}
bool CMonoFunctions::Marker::SetTarget( DWORD pUserData, MonoObject* pTarget )
{
if( RESOURCE )
{
Vector3* vecPosition = new Vector3;
CMonoObject pTarget( pTarget );
vecPosition->fX = pTarget.GetPropertyValue< float >( "X" );
vecPosition->fY = pTarget.GetPropertyValue< float >( "Y" );
vecPosition->fZ = pTarget.GetPropertyValue< float >( "Z" );
return CLuaFunctionDefinitions::SetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, vecPosition );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, Vector3( pTarget ) );
}
return false;
}
bool CMonoFunctions::Marker::SetIcon( DWORD pUserData, MonoString* msIcon )
{
if( RESOURCE )
{
const char* szIcon = mono_string_to_utf8( msIcon );
return CLuaFunctionDefinitions::SetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szIcon );
if( RESOURCE )
{
const char* szIcon = mono_string_to_utf8( msIcon );
return CLuaFunctionDefinitions::SetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szIcon );
}
return false;

View File

@ -1,117 +1,81 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Object create/destroy functions
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Object create/destroy functions
DWORD CMonoFunctions::Object::Create( unsigned short usModelID, MonoObject* pPosition, MonoObject* pRotation, bool bIsLowLod )
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
CMonoObject pRotation( pRotation );
float fRX = pRotation.GetPropertyValue< float >( "X" );
float fRY = pRotation.GetPropertyValue< float >( "Y" );
float fRZ = pRotation.GetPropertyValue< float >( "Z" );
Vector3 vecRotation( fRX, fRY, fRZ );
return (DWORD)CLuaFunctionDefinitions::CreateObject( RESOURCE->GetLua(), usModelID, vecPosition, vecRotation, bIsLowLod );
}
if( RESOURCE )
{
Vector3 vecPosition( pPosition );
Vector3 vecRotation( pRotation );
return (DWORD)CLuaFunctionDefinitions::CreateObject( RESOURCE->GetLua(), usModelID, vecPosition, vecRotation, bIsLowLod );
}
return NULL;
}
// Object get functions
// Object get functions
MonoObject* CMonoFunctions::Object::GetScale( DWORD pUserData )
{
if( RESOURCE )
{
Vector3 vecScale;
if( CLuaFunctionDefinitions::GetObjectScale( RESOURCE->GetLua(), (void*)pUserData, vecScale ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecScale );
if( pObject )
{
return pObject->GetObject();
}
}
if( RESOURCE )
{
Vector3 vecScale;
if( CLuaFunctionDefinitions::GetObjectScale( RESOURCE->GetLua(), (void*)pUserData, vecScale ) )
{
return RESOURCE->NewObject( vecScale );
}
}
return NULL;
}
// Object set functions
// Object set functions
bool CMonoFunctions::Object::SetScale( DWORD pUserData, MonoObject* pScale )
{
if( RESOURCE )
{
Vector3 vecScale;
CMonoObject pScale( pScale );
vecScale.fX = pScale.GetPropertyValue< float >( "X" );
vecScale.fY = pScale.GetPropertyValue< float >( "Y" );
vecScale.fZ = pScale.GetPropertyValue< float >( "Z" );
return CLuaFunctionDefinitions::SetObjectScale( RESOURCE->GetLua(), (void*)pUserData, vecScale );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetObjectScale( RESOURCE->GetLua(), (void*)pUserData, Vector3( pScale ) );
}
return false;
}
bool CMonoFunctions::Object::Move( DWORD pUserData, unsigned long ulTime, MonoObject* pPosition, MonoObject* pRotation, MonoString* msEasingType, float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot )
{
if( RESOURCE )
{
Vector3 vecPosition, vecRotation;
CMonoObject pPosition( pPosition );
vecPosition.fX = pPosition.GetPropertyValue< float >( "X" );
vecPosition.fY = pPosition.GetPropertyValue< float >( "Y" );
vecPosition.fZ = pPosition.GetPropertyValue< float >( "Z" );
CMonoObject pRotation( pRotation );
vecRotation.fX = pRotation.GetPropertyValue< float >( "X" );
vecRotation.fY = pRotation.GetPropertyValue< float >( "Y" );
vecRotation.fZ = pRotation.GetPropertyValue< float >( "Z" );
const char* szEasingType = mono_string_to_utf8( msEasingType );
return CLuaFunctionDefinitions::MoveObject( RESOURCE->GetLua(), (void*)pUserData, ulTime, vecPosition, vecRotation, szEasingType, fEasingPeriod, fEasingAmplitude, fEasingOvershoot );
if( RESOURCE )
{
Vector3
vecPosition( pPosition ),
vecRotation( pRotation );
const char* szEasingType = mono_string_to_utf8( msEasingType );
return CLuaFunctionDefinitions::MoveObject( RESOURCE->GetLua(), (void*)pUserData, ulTime, vecPosition, vecRotation, szEasingType, fEasingPeriod, fEasingAmplitude, fEasingOvershoot );
}
return false;
}
bool CMonoFunctions::Object::Stop( DWORD pUserData )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::StopObject( RESOURCE->GetLua(), (void*)pUserData );
if( RESOURCE )
{
return CLuaFunctionDefinitions::StopObject( RESOURCE->GetLua(), (void*)pUserData );
}
return false;

View File

@ -1,134 +1,128 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#ifndef _CMONO_FUNCS_PED
#define _CMONO_FUNCS_PED
#include "CMonoFunctions.h"
// Ped get functions
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#ifndef _CMONO_FUNCS_PED
#define _CMONO_FUNCS_PED
#include "CMonoFunctions.h"
// Ped get functions
DWORD CMonoFunctions::Ped::Create( int iModelid, MonoObject* pMonoPosition, float fRot, bool bSynced )
{
if( RESOURCE )
{
CMonoObject pPosition( pMonoPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
return (DWORD)CLuaFunctionDefinitions::CreatePed( RESOURCE->GetLua(), iModelid, vecPosition, fRot, bSynced );
}
if( RESOURCE )
{
Vector3 vecPosition( pMonoPosition );
return (DWORD)CLuaFunctionDefinitions::CreatePed( RESOURCE->GetLua(), iModelid, vecPosition, fRot, bSynced );
}
return NULL;
}
float CMonoFunctions::Ped::GetArmor( DWORD pUserData )
{
if( RESOURCE )
{
float fArmor;
if( CLuaFunctionDefinitions::GetPedArmor( RESOURCE->GetLua(), (void*)pUserData, fArmor ) )
{
return fArmor;
}
}
if( RESOURCE )
{
float fArmor;
if( CLuaFunctionDefinitions::GetPedArmor( RESOURCE->GetLua(), (void*)pUserData, fArmor ) )
{
return fArmor;
}
}
return 0.0f;
}
bool CMonoFunctions::Ped::IsChoking( DWORD pUserData )
{
if( RESOURCE )
{
bool bChoking;
if( CLuaFunctionDefinitions::IsPedChoking( RESOURCE->GetLua(), (void*)pUserData, bChoking ) )
{
return bChoking;
}
}
if( RESOURCE )
{
bool bChoking;
if( CLuaFunctionDefinitions::IsPedChoking( RESOURCE->GetLua(), (void*)pUserData, bChoking ) )
{
return bChoking;
}
}
return false;
}
bool CMonoFunctions::Ped::IsDead( DWORD pUserData )
{
if( RESOURCE )
{
bool bDead;
if( CLuaFunctionDefinitions::IsPedDead( RESOURCE->GetLua(), (void*)pUserData, bDead ) )
{
return bDead;
}
}
if( RESOURCE )
{
bool bDead;
if( CLuaFunctionDefinitions::IsPedDead( RESOURCE->GetLua(), (void*)pUserData, bDead ) )
{
return bDead;
}
}
return false;
}
bool CMonoFunctions::Ped::IsDucked( DWORD pUserData )
{
if( RESOURCE )
{
bool bDucked;
if( CLuaFunctionDefinitions::IsPedDucked( RESOURCE->GetLua(), (void*)pUserData, bDucked ) )
{
return bDucked;
}
}
if( RESOURCE )
{
bool bDucked;
if( CLuaFunctionDefinitions::IsPedDucked( RESOURCE->GetLua(), (void*)pUserData, bDucked ) )
{
return bDucked;
}
}
return false;
}
float CMonoFunctions::Ped::GetStat( DWORD pUserData, unsigned short usStat )
{
if( RESOURCE )
{
float fStat;
if( CLuaFunctionDefinitions::GetPedStat( RESOURCE->GetLua(), (void*)pUserData, usStat, fStat ) )
{
return fStat;
}
}
if( RESOURCE )
{
float fStat;
if( CLuaFunctionDefinitions::GetPedStat( RESOURCE->GetLua(), (void*)pUserData, usStat, fStat ) )
{
return fStat;
}
}
return 0.0f;
}
DWORD CMonoFunctions::Ped::GetTarget( DWORD pUserData )
{
if( RESOURCE )
{
return (DWORD)CLuaFunctionDefinitions::GetPedTarget( RESOURCE->GetLua(), (void*)pUserData );
}
if( RESOURCE )
{
return (DWORD)CLuaFunctionDefinitions::GetPedTarget( RESOURCE->GetLua(), (void*)pUserData );
}
return NULL;
}
int CMonoFunctions::Ped::GetWeapon( DWORD pUserData, int iWeaponSlot )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::GetPedWeapon( RESOURCE->GetLua(), (void*)pUserData, iWeaponSlot );
}
if( RESOURCE )
{
return CLuaFunctionDefinitions::GetPedWeapon( RESOURCE->GetLua(), (void*)pUserData, iWeaponSlot );
}
return NULL;
}
MonoString* CMonoFunctions::Ped::GetClothesTexture( DWORD pUserData, unsigned char ucType )
{
if( RESOURCE )
@ -143,7 +137,7 @@ MonoString* CMonoFunctions::Ped::GetClothesTexture( DWORD pUserData, unsigned ch
return NULL;
}
MonoString* CMonoFunctions::Ped::GetClothesModel( DWORD pUserData, unsigned char ucType )
{
if( RESOURCE )
@ -158,7 +152,7 @@ MonoString* CMonoFunctions::Ped::GetClothesModel( DWORD pUserData, unsigned char
return NULL;
}
bool CMonoFunctions::Ped::DoesHaveJetPack( DWORD pUserData )
{
if( RESOURCE )
@ -173,7 +167,7 @@ bool CMonoFunctions::Ped::DoesHaveJetPack( DWORD pUserData )
return false;
}
bool CMonoFunctions::Ped::IsOnGround( DWORD pUserData )
{
if( RESOURCE )
@ -188,7 +182,7 @@ bool CMonoFunctions::Ped::IsOnGround( DWORD pUserData )
return false;
}
unsigned char CMonoFunctions::Ped::GetFightingStyle( DWORD pUserData )
{
if( RESOURCE )
@ -203,7 +197,7 @@ unsigned char CMonoFunctions::Ped::GetFightingStyle( DWORD pUserData )
return 0;
}
unsigned int CMonoFunctions::Ped::GetMoveAnim( DWORD pUserData )
{
if( RESOURCE )
@ -218,7 +212,7 @@ unsigned int CMonoFunctions::Ped::GetMoveAnim( DWORD pUserData )
return 0;
}
float CMonoFunctions::Ped::GetGravity( DWORD pUserData )
{
if( RESOURCE )
@ -233,7 +227,7 @@ float CMonoFunctions::Ped::GetGravity( DWORD pUserData )
return 0.0f;
}
DWORD CMonoFunctions::Ped::GetContactElement( DWORD pUserData )
{
if( RESOURCE )
@ -243,7 +237,7 @@ DWORD CMonoFunctions::Ped::GetContactElement( DWORD pUserData )
return NULL;
}
unsigned char CMonoFunctions::Ped::GetWeaponSlot( DWORD pUserData )
{
if( RESOURCE )
@ -258,7 +252,7 @@ unsigned char CMonoFunctions::Ped::GetWeaponSlot( DWORD pUserData )
return 0;
}
bool CMonoFunctions::Ped::IsDoingGangDriveby( DWORD pUserData )
{
if( RESOURCE )
@ -273,7 +267,7 @@ bool CMonoFunctions::Ped::IsDoingGangDriveby( DWORD pUserData )
return false;
}
bool CMonoFunctions::Ped::IsOnFire( DWORD pUserData )
{
if( RESOURCE )
@ -288,7 +282,7 @@ bool CMonoFunctions::Ped::IsOnFire( DWORD pUserData )
return false;
}
bool CMonoFunctions::Ped::IsHeadless( DWORD pUserData )
{
if( RESOURCE )
@ -303,7 +297,7 @@ bool CMonoFunctions::Ped::IsHeadless( DWORD pUserData )
return false;
}
bool CMonoFunctions::Ped::IsFrozen( DWORD pUserData )
{
if( RESOURCE )
@ -318,7 +312,7 @@ bool CMonoFunctions::Ped::IsFrozen( DWORD pUserData )
return false;
}
DWORD CMonoFunctions::Ped::GetOccupiedVehicle( DWORD pUserData )
{
if( RESOURCE )
@ -328,7 +322,7 @@ DWORD CMonoFunctions::Ped::GetOccupiedVehicle( DWORD pUserData )
return NULL;
}
unsigned int CMonoFunctions::Ped::GetOccupiedVehicleSeat( DWORD pUserData )
{
if( RESOURCE )
@ -343,7 +337,7 @@ unsigned int CMonoFunctions::Ped::GetOccupiedVehicleSeat( DWORD pUserData )
return 0;
}
bool CMonoFunctions::Ped::IsInVehicle( DWORD pUserData )
{
if( RESOURCE )
@ -358,7 +352,7 @@ bool CMonoFunctions::Ped::IsInVehicle( DWORD pUserData )
return false;
}
short CMonoFunctions::Ped::GetWeaponProperty( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty )
{
if( RESOURCE )
@ -376,7 +370,7 @@ short CMonoFunctions::Ped::GetWeaponProperty( unsigned char ucWeaponID, MonoStri
return 0;
}
short CMonoFunctions::Ped::GetOriginalWeaponProperty( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty )
{
if( RESOURCE )
@ -394,9 +388,9 @@ short CMonoFunctions::Ped::GetOriginalWeaponProperty( unsigned char ucWeaponID,
return 0;
}
// Ped set functions
// Ped set functions
bool CMonoFunctions::Ped::SetArmor( DWORD pUserData, float fArmor )
{
if( RESOURCE )
@ -406,7 +400,7 @@ bool CMonoFunctions::Ped::SetArmor( DWORD pUserData, float fArmor )
return false;
}
bool CMonoFunctions::Ped::Kill( DWORD pUserData, DWORD pKiller, unsigned char ucKillerWeapon, unsigned char ucBodyPart, bool bStealth )
{
if( RESOURCE )
@ -416,7 +410,7 @@ bool CMonoFunctions::Ped::Kill( DWORD pUserData, DWORD pKiller, unsigned char uc
return false;
}
bool CMonoFunctions::Ped::SetStat( DWORD pUserData, unsigned short usStat, float fValue )
{
if( RESOURCE )
@ -426,7 +420,7 @@ bool CMonoFunctions::Ped::SetStat( DWORD pUserData, unsigned short usStat, float
return false;
}
bool CMonoFunctions::Ped::AddClothes( DWORD pUserData, MonoString* msTexture, MonoString* msModel, unsigned char ucType )
{
if( RESOURCE )
@ -439,7 +433,7 @@ bool CMonoFunctions::Ped::AddClothes( DWORD pUserData, MonoString* msTexture, Mo
return false;
}
bool CMonoFunctions::Ped::RemoveClothes( DWORD pUserData, unsigned char ucType, MonoString* msTexture, MonoString* msModel )
{
if( RESOURCE )
@ -452,7 +446,7 @@ bool CMonoFunctions::Ped::RemoveClothes( DWORD pUserData, unsigned char ucType,
return false;
}
bool CMonoFunctions::Ped::GiveJetPack( DWORD pUserData )
{
if( RESOURCE )
@ -462,7 +456,7 @@ bool CMonoFunctions::Ped::GiveJetPack( DWORD pUserData )
return false;
}
bool CMonoFunctions::Ped::RemoveJetPack( DWORD pUserData )
{
if( RESOURCE )
@ -472,7 +466,7 @@ bool CMonoFunctions::Ped::RemoveJetPack( DWORD pUserData )
return false;
}
bool CMonoFunctions::Ped::SetFightingStyle( DWORD pUserData, unsigned char ucStyle )
{
if( RESOURCE )
@ -482,7 +476,7 @@ bool CMonoFunctions::Ped::SetFightingStyle( DWORD pUserData, unsigned char ucSty
return false;
}
bool CMonoFunctions::Ped::SetMoveAnim( DWORD pUserData, unsigned int iMoveAnim )
{
if( RESOURCE )
@ -492,7 +486,7 @@ bool CMonoFunctions::Ped::SetMoveAnim( DWORD pUserData, unsigned int iMoveAnim )
return false;
}
bool CMonoFunctions::Ped::SetGravity( DWORD pUserData, float fGravity )
{
if( RESOURCE )
@ -502,7 +496,7 @@ bool CMonoFunctions::Ped::SetGravity( DWORD pUserData, float fGravity )
return false;
}
bool CMonoFunctions::Ped::SetChoking( DWORD pUserData, bool bChoking )
{
if( RESOURCE )
@ -512,7 +506,7 @@ bool CMonoFunctions::Ped::SetChoking( DWORD pUserData, bool bChoking )
return false;
}
bool CMonoFunctions::Ped::SetWeaponSlot( DWORD pUserData, unsigned char ucWeaponSlot )
{
if( RESOURCE )
@ -522,7 +516,7 @@ bool CMonoFunctions::Ped::SetWeaponSlot( DWORD pUserData, unsigned char ucWeapon
return false;
}
bool CMonoFunctions::Ped::WarpIntoVehicle( DWORD pUserData, DWORD pVehicle, unsigned int uiSeat )
{
if( RESOURCE )
@ -532,7 +526,7 @@ bool CMonoFunctions::Ped::WarpIntoVehicle( DWORD pUserData, DWORD pVehicle, unsi
return false;
}
bool CMonoFunctions::Ped::RemoveFromVehicle( DWORD pUserData )
{
if( RESOURCE )
@ -542,7 +536,7 @@ bool CMonoFunctions::Ped::RemoveFromVehicle( DWORD pUserData )
return false;
}
bool CMonoFunctions::Ped::SetDoingGangDriveby( DWORD pUserData, bool bGangDriveby )
{
if( RESOURCE )
@ -552,7 +546,7 @@ bool CMonoFunctions::Ped::SetDoingGangDriveby( DWORD pUserData, bool bGangDriveb
return false;
}
bool CMonoFunctions::Ped::SetAnimation( DWORD pUserData, MonoString* msBlockName, MonoString* msAnimName, int iTime, bool bLoop, bool bUpdatePosition, bool bInterruptable, bool bFreezeLastFrame )
{
if( RESOURCE )
@ -565,7 +559,7 @@ bool CMonoFunctions::Ped::SetAnimation( DWORD pUserData, MonoString* msBlockName
return false;
}
bool CMonoFunctions::Ped::SetAnimationProgress( DWORD pUserData, MonoString* msAnimName, float fProgress )
{
if( RESOURCE )
@ -577,7 +571,7 @@ bool CMonoFunctions::Ped::SetAnimationProgress( DWORD pUserData, MonoString* msA
return false;
}
bool CMonoFunctions::Ped::SetOnFire( DWORD pUserData, bool bIsOnFire )
{
if( RESOURCE )
@ -587,7 +581,7 @@ bool CMonoFunctions::Ped::SetOnFire( DWORD pUserData, bool bIsOnFire )
return false;
}
bool CMonoFunctions::Ped::SetHeadless( DWORD pUserData, bool bIsHeadless )
{
if( RESOURCE )
@ -597,7 +591,7 @@ bool CMonoFunctions::Ped::SetHeadless( DWORD pUserData, bool bIsHeadless )
return false;
}
bool CMonoFunctions::Ped::SetFrozen( DWORD pUserData, bool bIsFrozen )
{
if( RESOURCE )
@ -607,7 +601,7 @@ bool CMonoFunctions::Ped::SetFrozen( DWORD pUserData, bool bIsFrozen )
return false;
}
bool CMonoFunctions::Ped::ReloadWeapon( DWORD pUserData )
{
if( RESOURCE )
@ -617,7 +611,7 @@ bool CMonoFunctions::Ped::ReloadWeapon( DWORD pUserData )
return false;
}
bool CMonoFunctions::Ped::SetWeaponProperty( unsigned char ucWeaponID, MonoString* msWeaponSkill, MonoString* msProperty, short uData )
{
if( RESOURCE )
@ -630,9 +624,9 @@ bool CMonoFunctions::Ped::SetWeaponProperty( unsigned char ucWeaponID, MonoStrin
return false;
}
// Ped body?
// Ped body?
MonoString* CMonoFunctions::Ped::GetBodyPartName( unsigned char ucID )
{
if( RESOURCE )
@ -647,7 +641,7 @@ MonoString* CMonoFunctions::Ped::GetBodyPartName( unsigned char ucID )
return NULL;
}
MonoArray* CMonoFunctions::Ped::GetClothesByTypeIndex( unsigned char ucType, unsigned char ucIndex )
{
if( RESOURCE )
@ -671,7 +665,7 @@ MonoArray* CMonoFunctions::Ped::GetClothesByTypeIndex( unsigned char ucType, uns
return NULL;
}
MonoArray* CMonoFunctions::Ped::GetTypeIndexFromClothes( MonoString* msTexture, MonoString* msModel )
{
if( RESOURCE )
@ -697,7 +691,7 @@ MonoArray* CMonoFunctions::Ped::GetTypeIndexFromClothes( MonoString* msTexture,
return NULL;
}
MonoString* CMonoFunctions::Ped::GetClothesTypeName( unsigned char ucType )
{
if( RESOURCE )
@ -712,9 +706,9 @@ MonoString* CMonoFunctions::Ped::GetClothesTypeName( unsigned char ucType )
return NULL;
}
// Weapon give/take functions
// Weapon give/take functions
bool CMonoFunctions::Ped::GiveWeapon( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo, bool bSetAsCurrent )
{
if( RESOURCE )
@ -724,7 +718,7 @@ bool CMonoFunctions::Ped::GiveWeapon( DWORD pPed, unsigned char ucWeaponID, unsi
return false;
}
bool CMonoFunctions::Ped::TakeWeapon( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo )
{
if( RESOURCE )
@ -734,7 +728,7 @@ bool CMonoFunctions::Ped::TakeWeapon( DWORD pPed, unsigned char ucWeaponID, unsi
return false;
}
bool CMonoFunctions::Ped::TakeAllWeapons( DWORD pPed )
{
if( RESOURCE )
@ -744,7 +738,7 @@ bool CMonoFunctions::Ped::TakeAllWeapons( DWORD pPed )
return false;
}
bool CMonoFunctions::Ped::SetWeaponAmmo( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo, unsigned short usAmmoInClip )
{
if( RESOURCE )

View File

@ -1,155 +1,149 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Pickup create/destroy funcs
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Pickup create/destroy funcs
DWORD CMonoFunctions::Pickup::Create( MonoObject* pPosition, unsigned char ucType, double dFive, unsigned long ulRespawnInterval, double dSix )
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
return (DWORD)CLuaFunctionDefinitions::CreatePickup( RESOURCE->GetLua(), vecPosition, ucType, dFive, ulRespawnInterval, dSix );
}
if( RESOURCE )
{
Vector3 vecPosition( pPosition );
return (DWORD)CLuaFunctionDefinitions::CreatePickup( RESOURCE->GetLua(), vecPosition, ucType, dFive, ulRespawnInterval, dSix );
}
return NULL;
}
// Pickup get funcs
// Pickup get funcs
unsigned char CMonoFunctions::Pickup::GetType( DWORD pUserData )
{
if( RESOURCE )
{
unsigned char ucType;
if( CLuaFunctionDefinitions::GetPickupType( RESOURCE->GetLua(), (void*)pUserData, ucType ) )
{
return ucType;
}
if( RESOURCE )
{
unsigned char ucType;
if( CLuaFunctionDefinitions::GetPickupType( RESOURCE->GetLua(), (void*)pUserData, ucType ) )
{
return ucType;
}
}
return 0;
}
unsigned char CMonoFunctions::Pickup::GetWeapon( DWORD pUserData )
{
if( RESOURCE )
{
unsigned char ucWeapon;
if( CLuaFunctionDefinitions::GetPickupWeapon( RESOURCE->GetLua(), (void*)pUserData, ucWeapon ) )
{
return ucWeapon;
}
if( RESOURCE )
{
unsigned char ucWeapon;
if( CLuaFunctionDefinitions::GetPickupWeapon( RESOURCE->GetLua(), (void*)pUserData, ucWeapon ) )
{
return ucWeapon;
}
}
return 0;
}
float CMonoFunctions::Pickup::GetAmount( DWORD pUserData )
{
if( RESOURCE )
{
float fAmount;
if( CLuaFunctionDefinitions::GetPickupAmount( RESOURCE->GetLua(), (void*)pUserData, fAmount ) )
{
return fAmount;
}
if( RESOURCE )
{
float fAmount;
if( CLuaFunctionDefinitions::GetPickupAmount( RESOURCE->GetLua(), (void*)pUserData, fAmount ) )
{
return fAmount;
}
}
return 0;
}
unsigned short CMonoFunctions::Pickup::GetAmmo( DWORD pUserData )
{
if( RESOURCE )
{
unsigned short usAmmo;
if( CLuaFunctionDefinitions::GetPickupAmmo( RESOURCE->GetLua(), (void*)pUserData, usAmmo ) )
{
return usAmmo;
}
if( RESOURCE )
{
unsigned short usAmmo;
if( CLuaFunctionDefinitions::GetPickupAmmo( RESOURCE->GetLua(), (void*)pUserData, usAmmo ) )
{
return usAmmo;
}
}
return 0;
}
unsigned long CMonoFunctions::Pickup::GetRespawnInterval( DWORD pUserData )
{
if( RESOURCE )
{
unsigned long ulInterval;
if( CLuaFunctionDefinitions::GetPickupRespawnInterval( RESOURCE->GetLua(), (void*)pUserData, ulInterval ) )
{
return ulInterval;
}
if( RESOURCE )
{
unsigned long ulInterval;
if( CLuaFunctionDefinitions::GetPickupRespawnInterval( RESOURCE->GetLua(), (void*)pUserData, ulInterval ) )
{
return ulInterval;
}
}
return 0;
}
bool CMonoFunctions::Pickup::IsSpawned( DWORD pUserData )
{
if( RESOURCE )
{
bool bSpawned;
if( CLuaFunctionDefinitions::IsPickupSpawned( RESOURCE->GetLua(), (void*)pUserData, bSpawned ) )
{
return bSpawned;
}
if( RESOURCE )
{
bool bSpawned;
if( CLuaFunctionDefinitions::IsPickupSpawned( RESOURCE->GetLua(), (void*)pUserData, bSpawned ) )
{
return bSpawned;
}
}
return false;
}
// Pickup set funcs
// Pickup set funcs
bool CMonoFunctions::Pickup::SetType( DWORD pUserData, unsigned char ucType, double dThree, double dFour )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetPickupType( RESOURCE->GetLua(), (void*)pUserData, ucType, dThree, dFour );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetPickupType( RESOURCE->GetLua(), (void*)pUserData, ucType, dThree, dFour );
}
return false;
}
bool CMonoFunctions::Pickup::SetRespawnInterval( DWORD pUserData, unsigned long ulInterval )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetPickupRespawnInterval( RESOURCE->GetLua(), (void*)pUserData, ulInterval );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetPickupRespawnInterval( RESOURCE->GetLua(), (void*)pUserData, ulInterval );
}
return false;
}
bool CMonoFunctions::Pickup::Use( DWORD pUserData, DWORD pPlayer )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::UsePickup( RESOURCE->GetLua(), (void*)pUserData, (void*)pPlayer );
if( RESOURCE )
{
return CLuaFunctionDefinitions::UsePickup( RESOURCE->GetLua(), (void*)pUserData, (void*)pPlayer );
}
return false;

File diff suppressed because it is too large Load Diff

View File

@ -1,166 +1,128 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Radar area create/destroy funcs
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Radar area create/destroy funcs
DWORD CMonoFunctions::RadarArea::Create( MonoObject* pPosition, MonoObject* pSize, MonoObject* color, DWORD pVisibleTo )
{
if( RESOURCE )
{
Vector2 vecPosition, vecSize;
CMonoObject pPosition( pPosition );
vecPosition.fX = pPosition.GetPropertyValue< float >( "X" );
vecPosition.fY = pPosition.GetPropertyValue< float >( "Y" );
CMonoObject pSize( pSize );
vecSize.fX = pSize.GetPropertyValue< float >( "X" );
vecSize.fY = pSize.GetPropertyValue< float >( "Y" );
CMonoObject pMonoColor( color );
SColor pColor;
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
return (DWORD)CLuaFunctionDefinitions::CreateRadarArea( RESOURCE->GetLua(), vecPosition, vecSize, pColor, (void*)pVisibleTo );
}
if( RESOURCE )
{
Vector2 vecPosition( pPosition );
Vector2 vecSize( pSize );
SColor pColor = CMonoObject::GetColor( color );
return (DWORD)CLuaFunctionDefinitions::CreateRadarArea( RESOURCE->GetLua(), vecPosition, vecSize, pColor, (void*)pVisibleTo );
}
return NULL;
}
// Radar area get funcs
// Radar area get funcs
MonoObject* CMonoFunctions::RadarArea::GetSize( DWORD pUserData )
{
if( RESOURCE )
{
Vector2 vecSize;
if( CLuaFunctionDefinitions::GetRadarAreaSize( RESOURCE->GetLua(), (void*)pUserData, vecSize ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecSize );
if( pObject )
{
return pObject->GetObject();
}
}
if( RESOURCE )
{
Vector2 vecSize;
if( CLuaFunctionDefinitions::GetRadarAreaSize( RESOURCE->GetLua(), (void*)pUserData, vecSize ) )
{
return RESOURCE->NewObject( vecSize );
}
}
return NULL;
}
MonoObject* CMonoFunctions::RadarArea::GetColor( DWORD pUserData )
{
if( RESOURCE )
{
SColor outColor;
if( CLuaFunctionDefinitions::GetRadarAreaColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
CMonoObject* pObject = RESOURCE->NewObject( outColor );
if( pObject )
{
return pObject->GetObject();
}
}
if( RESOURCE )
{
SColor outColor;
if( CLuaFunctionDefinitions::GetRadarAreaColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
return RESOURCE->NewObject( outColor );
}
}
return NULL;
}
bool CMonoFunctions::RadarArea::IsFlashing( DWORD pUserData )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::IsRadarAreaFlashing( RESOURCE->GetLua(), (void*)pUserData );
if( RESOURCE )
{
return CLuaFunctionDefinitions::IsRadarAreaFlashing( RESOURCE->GetLua(), (void*)pUserData );
}
return false;
}
bool CMonoFunctions::RadarArea::IsInside( DWORD pUserData, MonoObject* pPosition )
{
if( RESOURCE )
{
bool bInside;
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
Vector2 vecPosition( fX, fY );
if( CLuaFunctionDefinitions::IsInsideRadarArea( RESOURCE->GetLua(), (void*)pUserData, vecPosition, bInside ) )
{
return bInside;
}
if( RESOURCE )
{
bool bInside;
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
Vector2 vecPosition( fX, fY );
if( CLuaFunctionDefinitions::IsInsideRadarArea( RESOURCE->GetLua(), (void*)pUserData, vecPosition, bInside ) )
{
return bInside;
}
}
return false;
}
// Radar area set funcs
// Radar area set funcs
bool CMonoFunctions::RadarArea::SetSize( DWORD pUserData, MonoObject* pSize )
{
if( RESOURCE )
{
CMonoObject pSize( pSize );
float fX = pSize.GetPropertyValue< float >( "X" );
float fY = pSize.GetPropertyValue< float >( "Y" );
Vector2 vecPosition( fX, fY );
return CLuaFunctionDefinitions::SetRadarAreaSize( RESOURCE->GetLua(), (void*)pUserData, vecPosition );
if( RESOURCE )
{
float fX = CMonoObject::GetPropertyValue< float >( pSize, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pSize, "Y" );
Vector2 vecPosition( fX, fY );
return CLuaFunctionDefinitions::SetRadarAreaSize( RESOURCE->GetLua(), (void*)pUserData, vecPosition );
}
return false;
}
bool CMonoFunctions::RadarArea::SetColor( DWORD pUserData, MonoObject* color )
{
if( RESOURCE )
{
SColor pColor;
CMonoObject pObject( color );
pColor.R = pObject.GetPropertyValue< unsigned char >( "R" );
pColor.G = pObject.GetPropertyValue< unsigned char >( "G" );
pColor.B = pObject.GetPropertyValue< unsigned char >( "B" );
pColor.A = pObject.GetPropertyValue< unsigned char >( "A" );
return CLuaFunctionDefinitions::SetRadarAreaColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
if( RESOURCE )
{
SColor pColor = CMonoObject::GetColor( color );
return CLuaFunctionDefinitions::SetRadarAreaColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
}
return false;
}
bool CMonoFunctions::RadarArea::SetFlashing( DWORD pUserData, bool bFlashing )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetRadarAreaFlashing( RESOURCE->GetLua(), (void*)pUserData, bFlashing );
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetRadarAreaFlashing( RESOURCE->GetLua(), (void*)pUserData, bFlashing );
}
return false;

View File

@ -1,100 +1,98 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Shape create funcs
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Shape create funcs
DWORD CMonoFunctions::Shape::CreateCircle( MonoObject* pPosition, float fRadius )
{
if( RESOURCE )
{
Vector2 vecPosition = CMonoObject( pPosition ).GetVector2();
return (DWORD)CLuaFunctionDefinitions::CreateColCircle( RESOURCE->GetLua(), vecPosition, fRadius );
}
if( RESOURCE )
{
Vector2 vecPosition( pPosition );
return (DWORD)CLuaFunctionDefinitions::CreateColCircle( RESOURCE->GetLua(), vecPosition, fRadius );
}
return NULL;
}
DWORD CMonoFunctions::Shape::CreateCuboid( MonoObject* pPosition, MonoObject* pSize )
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
Vector3 vecSize = CMonoObject( pSize ).GetVector3();
return (DWORD)CLuaFunctionDefinitions::CreateColCuboid( RESOURCE->GetLua(), vecPosition, vecSize );
}
if( RESOURCE )
{
Vector3 vecPosition( pPosition );
Vector3 vecSize( pSize );
return (DWORD)CLuaFunctionDefinitions::CreateColCuboid( RESOURCE->GetLua(), vecPosition, vecSize );
}
return NULL;
}
DWORD CMonoFunctions::Shape::CreateSphere( MonoObject* pPosition, float fRadius )
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
return (DWORD)CLuaFunctionDefinitions::CreateColSphere( RESOURCE->GetLua(), vecPosition, fRadius );
}
if( RESOURCE )
{
Vector3 vecPosition( pPosition );
return (DWORD)CLuaFunctionDefinitions::CreateColSphere( RESOURCE->GetLua(), vecPosition, fRadius );
}
return NULL;
}
DWORD CMonoFunctions::Shape::CreateRectangle( MonoObject* pPosition, MonoObject* pSize )
{
if( RESOURCE )
{
Vector2 vecPosition = CMonoObject( pPosition ).GetVector2();
Vector2 vecSize = CMonoObject( pSize ).GetVector2();
return (DWORD)CLuaFunctionDefinitions::CreateColRectangle( RESOURCE->GetLua(), vecPosition, vecSize );
}
if( RESOURCE )
{
Vector2 vecPosition( pPosition );
Vector2 vecSize( pSize );
return (DWORD)CLuaFunctionDefinitions::CreateColRectangle( RESOURCE->GetLua(), vecPosition, vecSize );
}
return NULL;
}
DWORD CMonoFunctions::Shape::CreatePolygon( MonoArray* pPointList )
{
if( RESOURCE )
{
vector< Vector2 > vecPointList;
for( unsigned int i = 0; i < mono_array_length( pPointList ); i++ )
{
MonoObject* pObject = mono_array_get( pPointList, MonoObject*, i );
if( pObject )
{
Vector2 vecPosition = CMonoObject( pObject ).GetVector2();
vecPointList.push_back( vecPosition );
}
}
return (DWORD)CLuaFunctionDefinitions::CreateColPolygon( RESOURCE->GetLua(), vecPointList );
}
if( RESOURCE )
{
vector< Vector2 > vecPointList;
for( unsigned int i = 0; i < mono_array_length( pPointList ); i++ )
{
MonoObject* pObject = mono_array_get( pPointList, MonoObject*, i );
if( pObject )
{
vecPointList.push_back( Vector2( pObject ) );
}
}
return (DWORD)CLuaFunctionDefinitions::CreateColPolygon( RESOURCE->GetLua(), vecPointList );
}
return NULL;
}
DWORD CMonoFunctions::Shape::CreateTube( MonoObject* pPosition, float fRadius, float fHeight )
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
return (DWORD)CLuaFunctionDefinitions::CreateColTube( RESOURCE->GetLua(), vecPosition, fRadius, fHeight );
}
if( RESOURCE )
{
Vector3 vecPosition( pPosition );
return (DWORD)CLuaFunctionDefinitions::CreateColTube( RESOURCE->GetLua(), vecPosition, fRadius, fHeight );
}
return NULL;
}

View File

@ -1,140 +1,135 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Team get funcs
DWORD CMonoFunctions::Team::Create( MonoString* msTeamName, MonoObject* mColor )
{
if( RESOURCE )
{
const char* szTeamName = mono_string_to_utf8( msTeamName );
SColor pColor = CMonoObject( mColor ).GetColor();
return (DWORD)CLuaFunctionDefinitions::CreateTeam( RESOURCE->GetLua(), szTeamName, pColor.R, pColor.G, pColor.B );
}
return NULL;
}
DWORD CMonoFunctions::Team::GetFromName( MonoString* msTeamName )
{
if( RESOURCE )
{
const char* szTeamName = mono_string_to_utf8( msTeamName );
return (DWORD)CLuaFunctionDefinitions::GetTeamFromName( RESOURCE->GetLua(), szTeamName );
}
return NULL;
}
MonoString* CMonoFunctions::Team::GetName( DWORD pUserData )
{
if( RESOURCE )
{
string strOutName;
if( CLuaFunctionDefinitions::GetTeamName( RESOURCE->GetLua(), (void*)pUserData, strOutName ) )
{
return RESOURCE->NewString( strOutName );
}
}
return NULL;
}
MonoObject* CMonoFunctions::Team::GetColor( DWORD pUserData )
{
if( RESOURCE )
{
SColor pColor;
if( CLuaFunctionDefinitions::GetTeamColor( RESOURCE->GetLua(), (void*)pUserData, pColor.R, pColor.G, pColor.B ) )
{
CMonoObject* pObject = RESOURCE->NewObject( pColor );
if( pObject )
{
return pObject->GetObject();
}
}
}
return NULL;
}
unsigned int CMonoFunctions::Team::CountPlayers( DWORD pUserData )
{
if( RESOURCE )
{
unsigned int uiCount;
if( CLuaFunctionDefinitions::CountPlayersInTeam( RESOURCE->GetLua(), (void*)pUserData, uiCount ) )
{
return uiCount;
}
}
return 0;
}
bool CMonoFunctions::Team::GetFriendlyFire( DWORD pUserData )
{
if( RESOURCE )
{
bool bFriendlyFire;
if( CLuaFunctionDefinitions::GetTeamFriendlyFire( RESOURCE->GetLua(), (void*)pUserData, bFriendlyFire ) )
{
return bFriendlyFire;
}
}
return false;
}
// Team set funcs
bool CMonoFunctions::Team::SetName( DWORD pUserData, MonoString* msTeamName )
{
if( RESOURCE )
{
const char* szTeamName = mono_string_to_utf8( msTeamName );
return CLuaFunctionDefinitions::SetTeamName( RESOURCE->GetLua(), (void*)pUserData, szTeamName );
}
return false;
}
bool CMonoFunctions::Team::SetColor( DWORD pUserData, MonoObject* mColor )
{
if( RESOURCE )
{
SColor pColor = CMonoObject( mColor ).GetColor();
return CLuaFunctionDefinitions::SetTeamColor( RESOURCE->GetLua(), (void*)pUserData, pColor.R, pColor.G, pColor.B );
}
return false;
}
bool CMonoFunctions::Team::SetFriendlyFire( DWORD pUserData, bool bFriendlyFire )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetTeamFriendlyFire( RESOURCE->GetLua(), (void*)pUserData, bFriendlyFire );
}
return false;
}
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Team get funcs
DWORD CMonoFunctions::Team::Create( MonoString* msTeamName, MonoObject* mColor )
{
if( RESOURCE )
{
const char* szTeamName = mono_string_to_utf8( msTeamName );
SColor pColor = CMonoObject::GetColor( mColor );
return (DWORD)CLuaFunctionDefinitions::CreateTeam( RESOURCE->GetLua(), szTeamName, pColor.R, pColor.G, pColor.B );
}
return NULL;
}
DWORD CMonoFunctions::Team::GetFromName( MonoString* msTeamName )
{
if( RESOURCE )
{
const char* szTeamName = mono_string_to_utf8( msTeamName );
return (DWORD)CLuaFunctionDefinitions::GetTeamFromName( RESOURCE->GetLua(), szTeamName );
}
return NULL;
}
MonoString* CMonoFunctions::Team::GetName( DWORD pUserData )
{
if( RESOURCE )
{
string strOutName;
if( CLuaFunctionDefinitions::GetTeamName( RESOURCE->GetLua(), (void*)pUserData, strOutName ) )
{
return RESOURCE->NewString( strOutName );
}
}
return NULL;
}
MonoObject* CMonoFunctions::Team::GetColor( DWORD pUserData )
{
if( RESOURCE )
{
SColor pColor;
if( CLuaFunctionDefinitions::GetTeamColor( RESOURCE->GetLua(), (void*)pUserData, pColor.R, pColor.G, pColor.B ) )
{
return RESOURCE->NewObject( pColor );
}
}
return NULL;
}
unsigned int CMonoFunctions::Team::CountPlayers( DWORD pUserData )
{
if( RESOURCE )
{
unsigned int uiCount;
if( CLuaFunctionDefinitions::CountPlayersInTeam( RESOURCE->GetLua(), (void*)pUserData, uiCount ) )
{
return uiCount;
}
}
return 0;
}
bool CMonoFunctions::Team::GetFriendlyFire( DWORD pUserData )
{
if( RESOURCE )
{
bool bFriendlyFire;
if( CLuaFunctionDefinitions::GetTeamFriendlyFire( RESOURCE->GetLua(), (void*)pUserData, bFriendlyFire ) )
{
return bFriendlyFire;
}
}
return false;
}
// Team set funcs
bool CMonoFunctions::Team::SetName( DWORD pUserData, MonoString* msTeamName )
{
if( RESOURCE )
{
const char* szTeamName = mono_string_to_utf8( msTeamName );
return CLuaFunctionDefinitions::SetTeamName( RESOURCE->GetLua(), (void*)pUserData, szTeamName );
}
return false;
}
bool CMonoFunctions::Team::SetColor( DWORD pUserData, MonoObject* mColor )
{
if( RESOURCE )
{
SColor pColor = CMonoObject::GetColor( mColor );
return CLuaFunctionDefinitions::SetTeamColor( RESOURCE->GetLua(), (void*)pUserData, pColor.R, pColor.G, pColor.B );
}
return false;
}
bool CMonoFunctions::Team::SetFriendlyFire( DWORD pUserData, bool bFriendlyFire )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetTeamFriendlyFire( RESOURCE->GetLua(), (void*)pUserData, bFriendlyFire );
}
return false;
}

View File

@ -1,132 +1,123 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Vehicle create/destroy functions
DWORD CMonoFunctions::Vehicle::Create( int model, MonoObject* position, MonoObject* rotation, MonoString* numberplate, bool direction, int variant1, int variant2 )
{
if( RESOURCE )
{
CMonoObject pPosition( position );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
CMonoObject pRotation( rotation );
float fRX = pRotation.GetPropertyValue< float >( "X" );
float fRY = pRotation.GetPropertyValue< float >( "Y" );
float fRZ = pRotation.GetPropertyValue< float >( "Z" );
string sNumberplate = "";
if( numberplate && mono_string_length( numberplate ) > 0 )
{
sNumberplate = string( mono_string_to_utf8( numberplate ) );
}
return (DWORD)CLuaFunctionDefinitions::CreateVehicle( RESOURCE->GetLua(), model, fX, fY, fZ, fRX, fRY, fRZ, sNumberplate, direction, variant1, variant2 );
}
return NULL;
}
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Vehicle create/destroy functions
DWORD CMonoFunctions::Vehicle::Create( int model, MonoObject* position, MonoObject* rotation, MonoString* numberplate, bool direction, int variant1, int variant2 )
{
if( RESOURCE )
{
float fX = CMonoObject::GetPropertyValue< float >( position, "X" );
float fY = CMonoObject::GetPropertyValue< float >( position, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( position, "Z" );
float fRX = CMonoObject::GetPropertyValue< float >( rotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( rotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( rotation, "Z" );
string sNumberplate = "";
if( numberplate && mono_string_length( numberplate ) > 0 )
{
sNumberplate = string( mono_string_to_utf8( numberplate ) );
}
return (DWORD)CLuaFunctionDefinitions::CreateVehicle( RESOURCE->GetLua(), model, fX, fY, fZ, fRX, fRY, fRZ, sNumberplate, direction, variant1, variant2 );
}
return NULL;
}
// Vehicle get functions
MonoString* CMonoFunctions::Vehicle::GetType( DWORD pUserData )
{
if( RESOURCE )
{
string strType;
if( CLuaFunctionDefinitions::GetVehicleType( RESOURCE->GetLua(), (void*)pUserData, strType ) )
{
return RESOURCE->NewString( strType );
}
}
if( RESOURCE )
{
string strType;
if( CLuaFunctionDefinitions::GetVehicleType( RESOURCE->GetLua(), (void*)pUserData, strType ) )
{
return RESOURCE->NewString( strType );
}
}
return NULL;
}
MonoArray* CMonoFunctions::Vehicle::GetVariant( DWORD pUserData )
{
if( RESOURCE )
{
unsigned char ucVariant;
unsigned char ucVariant2;
if( CLuaFunctionDefinitions::GetVehicleVariant( RESOURCE->GetLua(), (void*)pUserData, ucVariant, ucVariant2 ) )
{
MonoArray* pArray = mono_array_new( RESOURCE->m_pMonoDomain, mono_get_char_class(), 2 );
if( pArray )
{
mono_array_set( pArray, unsigned char, 0, ucVariant );
mono_array_set( pArray, unsigned char, 1, ucVariant2 );
return pArray;
}
}
}
if( RESOURCE )
{
unsigned char ucVariant;
unsigned char ucVariant2;
if( CLuaFunctionDefinitions::GetVehicleVariant( RESOURCE->GetLua(), (void*)pUserData, ucVariant, ucVariant2 ) )
{
MonoArray* pArray = mono_array_new( RESOURCE->m_pMonoDomain, mono_get_char_class(), 2 );
if( pArray )
{
mono_array_set( pArray, unsigned char, 0, ucVariant );
mono_array_set( pArray, unsigned char, 1, ucVariant2 );
return pArray;
}
}
}
return NULL;
}
MonoObject* CMonoFunctions::Vehicle::GetColor( DWORD pUserData )
{
if( RESOURCE )
{
CVehicleColor pColor;
if( CLuaFunctionDefinitions::GetVehicleColor( RESOURCE->GetLua(), (void*)pUserData, pColor ) )
{
SColor pColor1 = pColor.GetRGBColor( 0 );
SColor pColor2 = pColor.GetRGBColor( 1 );
SColor pColor3 = pColor.GetRGBColor( 2 );
SColor pColor4 = pColor.GetRGBColor( 3 );
void* args[] =
{
&pColor1,
&pColor2,
&pColor3,
&pColor4
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "VehicleColor", args, 4 );
if( pObject )
{
return pObject->GetObject();
}
}
}
if( RESOURCE )
{
CVehicleColor pColor;
if( CLuaFunctionDefinitions::GetVehicleColor( RESOURCE->GetLua(), (void*)pUserData, pColor ) )
{
SColor pColor1 = pColor.GetRGBColor( 0 );
SColor pColor2 = pColor.GetRGBColor( 1 );
SColor pColor3 = pColor.GetRGBColor( 2 );
SColor pColor4 = pColor.GetRGBColor( 3 );
void* args[] =
{
&pColor1,
&pColor2,
&pColor3,
&pColor4
};
return RESOURCE->NewObject( "MultiTheftAuto", "VehicleColor", args, 4 );
}
}
return NULL;
}
unsigned short CMonoFunctions::Vehicle::GetModelFromName( MonoString* msName )
{
if( RESOURCE )
{
const char* szName = mono_string_to_utf8( msName );
unsigned short usModel;
if( CLuaFunctionDefinitions::GetVehicleModelFromName( RESOURCE->GetLua(), szName, usModel ) )
{
return usModel;
}
if( RESOURCE )
{
const char* szName = mono_string_to_utf8( msName );
unsigned short usModel;
if( CLuaFunctionDefinitions::GetVehicleModelFromName( RESOURCE->GetLua(), szName, usModel ) )
{
return usModel;
}
}
return 0;
@ -134,14 +125,14 @@ unsigned short CMonoFunctions::Vehicle::GetModelFromName( MonoString* msName )
bool CMonoFunctions::Vehicle::GetLandingGearDown( DWORD pUserData )
{
if( RESOURCE )
{
bool bGearDown;
if( CLuaFunctionDefinitions::GetVehicleLandingGearDown( RESOURCE->GetLua(), (void*)pUserData, bGearDown ) )
{
return bGearDown;
}
if( RESOURCE )
{
bool bGearDown;
if( CLuaFunctionDefinitions::GetVehicleLandingGearDown( RESOURCE->GetLua(), (void*)pUserData, bGearDown ) )
{
return bGearDown;
}
}
return false;
@ -149,14 +140,14 @@ bool CMonoFunctions::Vehicle::GetLandingGearDown( DWORD pUserData )
unsigned char CMonoFunctions::Vehicle::GetMaxPassengers( DWORD pUserData )
{
if( RESOURCE )
{
unsigned char ucPassengers;
if( CLuaFunctionDefinitions::GetVehicleMaxPassengers( RESOURCE->GetLua(), (void*)pUserData, ucPassengers ) )
{
return ucPassengers;
}
if( RESOURCE )
{
unsigned char ucPassengers;
if( CLuaFunctionDefinitions::GetVehicleMaxPassengers( RESOURCE->GetLua(), (void*)pUserData, ucPassengers ) )
{
return ucPassengers;
}
}
return 0;
@ -164,14 +155,14 @@ unsigned char CMonoFunctions::Vehicle::GetMaxPassengers( DWORD pUserData )
MonoString* CMonoFunctions::Vehicle::GetName( DWORD pUserData )
{
if( RESOURCE )
{
string strOutName;
if( CLuaFunctionDefinitions::GetVehicleName( RESOURCE->GetLua(), (void*)pUserData, strOutName ) )
{
return RESOURCE->NewString( strOutName );
}
if( RESOURCE )
{
string strOutName;
if( CLuaFunctionDefinitions::GetVehicleName( RESOURCE->GetLua(), (void*)pUserData, strOutName ) )
{
return RESOURCE->NewString( strOutName );
}
}
return NULL;
@ -179,14 +170,14 @@ MonoString* CMonoFunctions::Vehicle::GetName( DWORD pUserData )
MonoString* CMonoFunctions::Vehicle::GetNameFromModel( unsigned short usModel )
{
if( RESOURCE )
{
string strOutName;
if( CLuaFunctionDefinitions::GetVehicleNameFromModel( RESOURCE->GetLua(), usModel, strOutName ) )
{
return RESOURCE->NewString( strOutName );
}
if( RESOURCE )
{
string strOutName;
if( CLuaFunctionDefinitions::GetVehicleNameFromModel( RESOURCE->GetLua(), usModel, strOutName ) )
{
return RESOURCE->NewString( strOutName );
}
}
return NULL;
@ -247,12 +238,7 @@ MonoObject* CMonoFunctions::Vehicle::GetTurnVelocity( DWORD pUserData )
if( CLuaFunctionDefinitions::GetVehicleTurnVelocity( RESOURCE->GetLua(), (void*)pUserData, vecVelocity ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecVelocity );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecVelocity );
}
}
@ -267,12 +253,7 @@ MonoObject* CMonoFunctions::Vehicle::GetTurretPosition( DWORD pUserData )
if( CLuaFunctionDefinitions::GetVehicleTurretPosition( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecPosition );
}
}
@ -335,14 +316,14 @@ MonoArray* CMonoFunctions::Vehicle::GetUpgrades( DWORD pUserData )
MonoString* CMonoFunctions::Vehicle::GetUpgradeSlotName( unsigned short usUpgrade )
{
if( RESOURCE )
{
string strOutName;
if( CLuaFunctionDefinitions::GetVehicleUpgradeSlotName( RESOURCE->GetLua(), usUpgrade, strOutName ) )
{
return RESOURCE->NewString( strOutName );
}
if( RESOURCE )
{
string strOutName;
if( CLuaFunctionDefinitions::GetVehicleUpgradeSlotName( RESOURCE->GetLua(), usUpgrade, strOutName ) )
{
return RESOURCE->NewString( strOutName );
}
}
return NULL;
@ -388,12 +369,7 @@ MonoObject* CMonoFunctions::Vehicle::GetWheelStates( DWORD pUserData )
&ucFrontLeft, &ucRearLeft, &ucFrontRight, &ucRearRight
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto.Vehicle", "VehicleWheelsState", args, 4 );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( "MultiTheftAuto.Vehicle", "VehicleWheelsState", args, 4 );
}
}
@ -482,14 +458,14 @@ unsigned char CMonoFunctions::Vehicle::GetPaintjob( DWORD pUserData )
MonoString* CMonoFunctions::Vehicle::GetPlateText( DWORD pUserData )
{
if( RESOURCE )
{
char* szPlateText = NULL;
if( CLuaFunctionDefinitions::GetVehiclePlateText( RESOURCE->GetLua(), (void*)pUserData, szPlateText ) )
{
return RESOURCE->NewString( szPlateText );
}
if( RESOURCE )
{
char* szPlateText = NULL;
if( CLuaFunctionDefinitions::GetVehiclePlateText( RESOURCE->GetLua(), (void*)pUserData, szPlateText ) )
{
return RESOURCE->NewString( szPlateText );
}
}
return NULL;
@ -648,12 +624,7 @@ MonoObject* CMonoFunctions::Vehicle::GetHeadLightColor( DWORD pUserData )
if( CLuaFunctionDefinitions::GetVehicleHeadLightColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
CMonoObject* pMonoObject = RESOURCE->NewObject( outColor );
if( pMonoObject )
{
return pMonoObject->GetObject();
}
return RESOURCE->NewObject( outColor );
}
}
@ -716,11 +687,9 @@ bool CMonoFunctions::Vehicle::SetTurnVelocity( DWORD pUserData, MonoObject* pVel
{
if( RESOURCE )
{
CMonoObject pVelocity( pVelocity );
float fX = pVelocity.GetPropertyValue< float >( "X" );
float fY = pVelocity.GetPropertyValue< float >( "Y" );
float fZ = pVelocity.GetPropertyValue< float >( "Z" );
float fX = CMonoObject::GetPropertyValue< float >( pVelocity, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pVelocity, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pVelocity, "Z" );
return CLuaFunctionDefinitions::SetVehicleTurnVelocity( RESOURCE->GetLua(), (void*)pUserData, fX, fY, fZ );
}
@ -732,29 +701,21 @@ bool CMonoFunctions::Vehicle::SetColor( DWORD pUserData, MonoObject* pColor1, Mo
{
if( RESOURCE )
{
CMonoObject pColor1( pColor1 );
unsigned char ucR1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "R" );
unsigned char ucG1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "G" );
unsigned char ucB1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "B" );
unsigned char ucR1 = pColor1.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG1 = pColor1.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB1 = pColor1.GetPropertyValue< unsigned char >( "B" );
unsigned char ucR2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "R" );
unsigned char ucG2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "G" );
unsigned char ucB2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "B" );
CMonoObject pColor2( pColor2 );
unsigned char ucR3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "R" );
unsigned char ucG3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "G" );
unsigned char ucB3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "B" );
unsigned char ucR2 = pColor2.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG2 = pColor2.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB2 = pColor2.GetPropertyValue< unsigned char >( "B" );
CMonoObject pColor3( pColor3 );
unsigned char ucR3 = pColor3.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG3 = pColor3.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB3 = pColor3.GetPropertyValue< unsigned char >( "B" );
CMonoObject pColor4( pColor4 );
unsigned char ucR4 = pColor4.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG4 = pColor4.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB4 = pColor4.GetPropertyValue< unsigned char >( "B" );
unsigned char ucR4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "R" );
unsigned char ucG4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "G" );
unsigned char ucB4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "B" );
return CLuaFunctionDefinitions::SetVehicleColor( RESOURCE->GetLua(), (void*)pUserData, ucR1, ucG1, ucB1, ucR2, ucG2, ucB2, ucR3, ucG3, ucB3, ucR4, ucG4, ucB4 );
}
@ -896,17 +857,13 @@ bool CMonoFunctions::Vehicle::SetRespawnPosition( DWORD pUserData, MonoObject* p
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "X" );
float fZ = pPosition.GetPropertyValue< float >( "X" );
CMonoObject pRotation( pRotation );
float fRX = pRotation.GetPropertyValue< float >( "X" );
float fRY = pRotation.GetPropertyValue< float >( "X" );
float fRZ = pRotation.GetPropertyValue< float >( "X" );
float fRX = CMonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( pRotation, "Z" );
return CLuaFunctionDefinitions::SetVehicleRespawnPosition( RESOURCE->GetLua(), (void*)pUserData, fX, fY, fZ, fRX, fRY, fRZ );
}
@ -948,17 +905,13 @@ bool CMonoFunctions::Vehicle::Spawn( DWORD pUserData, MonoObject* pPosition, Mon
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "X" );
float fZ = pPosition.GetPropertyValue< float >( "X" );
CMonoObject pRotation( pRotation );
float fRX = pRotation.GetPropertyValue< float >( "X" );
float fRY = pRotation.GetPropertyValue< float >( "X" );
float fRZ = pRotation.GetPropertyValue< float >( "X" );
float fRX = CMonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( pRotation, "Z" );
return CLuaFunctionDefinitions::SpawnVehicle( RESOURCE->GetLua(), (void*)pUserData, fX, fY, fZ, fRX, fRY, fRZ );
}
@ -1100,11 +1053,9 @@ bool CMonoFunctions::Vehicle::SetHeadLightColor( DWORD pUserData, MonoObject* pC
{
if( RESOURCE )
{
CMonoObject pColor1( pColor );
unsigned char ucR1 = pColor1.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG1 = pColor1.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB1 = pColor1.GetPropertyValue< unsigned char >( "B" );
unsigned char ucR1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "R" );
unsigned char ucG1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "G" );
unsigned char ucB1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "B" );
return CLuaFunctionDefinitions::SetVehicleHeadLightColor( RESOURCE->GetLua(), (void*)pUserData, ucR1, ucG1, ucB1 );
}
@ -1116,10 +1067,8 @@ bool CMonoFunctions::Vehicle::SetTurretPosition( DWORD pUserData, MonoObject* pP
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
return CLuaFunctionDefinitions::SetVehicleTurretPosition( RESOURCE->GetLua(), (void*)pUserData, fX, fY );
}
@ -1171,18 +1120,14 @@ bool CMonoFunctions::Vehicle::SetSirens( DWORD pUserData, unsigned char ucSirenI
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
CMonoObject pColor( pColor );
float fRed = pColor.GetPropertyValue< float >( "R" );
float fGreen = pColor.GetPropertyValue< float >( "G" );
float fBlue = pColor.GetPropertyValue< float >( "B" );
float fAlpha = pColor.GetPropertyValue< float >( "A" );
float fRed = CMonoObject::GetPropertyValue< float >( pColor, "R" );
float fGreen = CMonoObject::GetPropertyValue< float >( pColor, "G" );
float fBlue = CMonoObject::GetPropertyValue< float >( pColor, "B" );
float fAlpha = CMonoObject::GetPropertyValue< float >( pColor, "A" );
return CLuaFunctionDefinitions::SetVehicleSirens( RESOURCE->GetLua(), (void*)pUserData, ucSirenID, fX, fY, fZ, fRed, fGreen, fBlue, fAlpha, fMinAlpha );
}

View File

@ -1,137 +1,133 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Water funcs
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CMonoFunctions.h"
// Water funcs
DWORD CMonoFunctions::Water::Create( MonoObject* pV1, MonoObject* pV2, MonoObject* pV3, MonoObject* pV4, bool bShallow )
{
if( RESOURCE )
{
Vector3* vec1 = &CMonoObject( pV1 ).GetVector3();
Vector3* vec2 = &CMonoObject( pV2 ).GetVector3();
Vector3* vec3 = &CMonoObject( pV3 ).GetVector3();
Vector3* vec4 = pV4 ? &CMonoObject( pV4 ).GetVector3() : NULL;
return (DWORD)CLuaFunctionDefinitions::CreateWater( RESOURCE->GetLua(), vec1, vec2, vec3, vec4, bShallow );
}
if( RESOURCE )
{
Vector3 vec1( pV1 );
Vector3 vec2( pV2 );
Vector3 vec3( pV3 );
Vector3 vec4 = pV4 ? Vector3( pV4 ) : NULL;
return (DWORD)CLuaFunctionDefinitions::CreateWater( RESOURCE->GetLua(), &vec1, &vec2, &vec3, &vec4, bShallow );
}
return NULL;
}
bool CMonoFunctions::Water::SetLevel( DWORD pUserData, float fLevel )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetElementWaterLevel( RESOURCE->GetLua(), (void*)pUserData, fLevel );
}
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetElementWaterLevel( RESOURCE->GetLua(), (void*)pUserData, fLevel );
}
return false;
}
bool CMonoFunctions::Water::SetLevelAll( float fLevel )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetAllElementWaterLevel( RESOURCE->GetLua(), fLevel );
}
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetAllElementWaterLevel( RESOURCE->GetLua(), fLevel );
}
return false;
}
bool CMonoFunctions::Water::SetLevelWorld( float fLevel, bool bIncludeWorldNonSeaLevel )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetWorldWaterLevel( RESOURCE->GetLua(), fLevel, bIncludeWorldNonSeaLevel );
}
if( RESOURCE )
{
return CLuaFunctionDefinitions::SetWorldWaterLevel( RESOURCE->GetLua(), fLevel, bIncludeWorldNonSeaLevel );
}
return false;
}
bool CMonoFunctions::Water::ResetLevelWorld( void )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::ResetWorldWaterLevel( RESOURCE->GetLua() );
}
if( RESOURCE )
{
return CLuaFunctionDefinitions::ResetWorldWaterLevel( RESOURCE->GetLua() );
}
return false;
}
MonoObject* CMonoFunctions::Water::GetVertexPosition( DWORD pUserData, int iVertexIndex )
{
if( RESOURCE )
{
Vector3 vecPosition;
if( CLuaFunctionDefinitions::GetWaterVertexPosition( RESOURCE->GetLua(), (void*)pUserData, iVertexIndex, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
return pObject ? pObject->GetObject() : NULL;
}
}
if( RESOURCE )
{
Vector3 vecPosition;
if( CLuaFunctionDefinitions::GetWaterVertexPosition( RESOURCE->GetLua(), (void*)pUserData, iVertexIndex, vecPosition ) )
{
return RESOURCE->NewObject( vecPosition );
}
}
return NULL;
}
bool CMonoFunctions::Water::SetVertexPosition( DWORD pUserData, int iVertexIndex, MonoObject* mPosition )
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( mPosition ).GetVector3();
return CLuaFunctionDefinitions::SetWaterVertexPosition( RESOURCE->GetLua(), (void*)pUserData, iVertexIndex, vecPosition );
}
if( RESOURCE )
{
Vector3 vecPosition( mPosition );
return CLuaFunctionDefinitions::SetWaterVertexPosition( RESOURCE->GetLua(), (void*)pUserData, iVertexIndex, vecPosition );
}
return false;
}
MonoObject* CMonoFunctions::Water::GetColor( void )
{
if( RESOURCE )
{
SColor pColor;
if( CLuaFunctionDefinitions::GetWaterColor( RESOURCE->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A ) )
{
CMonoObject* pObject = RESOURCE->NewObject( pColor );
return pObject ? pObject->GetObject() : NULL;
}
}
if( RESOURCE )
{
SColor pColor;
if( CLuaFunctionDefinitions::GetWaterColor( RESOURCE->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A ) )
{
return RESOURCE->NewObject( pColor );
}
}
return NULL;
}
bool CMonoFunctions::Water::SetColor( MonoObject* mColor )
{
if( RESOURCE )
{
SColor pColor = CMonoObject( mColor ).GetColor();
return CLuaFunctionDefinitions::SetWaterColor( RESOURCE->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A );
}
if( RESOURCE )
{
SColor pColor = CMonoObject::GetColor( mColor );
return CLuaFunctionDefinitions::SetWaterColor( RESOURCE->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A );
}
return false;
}
bool CMonoFunctions::Water::ResetColor( void )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::ResetWaterColor( RESOURCE->GetLua() );
}
if( RESOURCE )
{
return CLuaFunctionDefinitions::ResetWaterColor( RESOURCE->GetLua() );
}
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,270 +1,265 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CResource.h"
#include "CResourceManager.h"
#include "include/ILuaModuleManager.h"
#include "lua/CLuaFunctionDefinitions.h"
extern ILuaModuleManager10 *g_pModuleManager;
extern CResourceManager *g_pResourceManager;
CResource::CResource( lua_State *pLuaVM, string sName )
{
this->m_pLuaVM = pLuaVM;
this->m_sName = sName;
this->m_pMonoAssembly = NULL;
this->m_pMonoAssemblyLib = NULL;
this->m_pMonoGCHandle = NULL;
this->m_pMonoDomain = NULL;
this->m_pMonoImage = NULL;
this->m_pMonoImageLib = NULL;
this->m_pMonoClass = NULL;
}
CResource::~CResource( void )
{
mono_domain_set( mono_get_root_domain(), false );
if( this->m_pMonoDomain )
{
mono_domain_unload( this->m_pMonoDomain );
}
mono_gc_collect( mono_gc_max_generation() );
g_pResourceManager->RemoveFromList( this );
this->m_pMonoAssembly = NULL;
this->m_pMonoAssemblyLib = NULL;
this->m_pMonoGCHandle = NULL;
this->m_pMonoDomain = NULL;
this->m_pMonoImage = NULL;
this->m_pMonoImageLib = NULL;
this->m_pMonoClass = NULL;
this->m_pLuaVM = NULL;
}
bool CResource::Init( void )
{
if( this->m_pLuaVM )
{
string sDirectory ( "mods/deathmatch/resources/[ire]/" + this->m_sName + "/" );
string sPath ( sDirectory + this->m_sName + ".dll" );
string sNamespace ( this->m_sName );
string sClass ( "Program" );
this->m_pMonoDomain = mono_domain_create_appdomain( const_cast< char* >( this->m_sName.c_str( ) ), NULL );
if( !this->m_pMonoDomain )
{
g_pModuleManager->ErrorPrintf( "%s - failed to create appdomain\n", this->m_sName.c_str() );
return false;
}
mono_domain_set( this->m_pMonoDomain, false );
this->m_pMonoAssemblyLib = mono_domain_assembly_open( this->m_pMonoDomain, ( sDirectory + "MultiTheftAuto.dll" ).c_str() );
if( this->m_pMonoAssemblyLib )
{
this->m_pMonoImageLib = mono_assembly_get_image( this->m_pMonoAssemblyLib );
}
this->m_pMonoAssembly = mono_domain_assembly_open( this->m_pMonoDomain, sPath.c_str() );
if( !this->m_pMonoAssembly )
{
g_pModuleManager->ErrorPrintf( "failed to open assembly '%s.dll'\n", this->m_sName.c_str() );
return false;
}
this->m_pMonoImage = mono_assembly_get_image( this->m_pMonoAssembly );
this->m_pMonoClass = mono_class_from_name( this->m_pMonoImage, sNamespace.c_str(), sClass.c_str() );
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CResource.h"
#include "CResourceManager.h"
#include "include/ILuaModuleManager.h"
#include "lua/CLuaFunctionDefinitions.h"
extern ILuaModuleManager10 *g_pModuleManager;
extern CResourceManager *g_pResourceManager;
CResource::CResource( lua_State *pLuaVM, string sName )
{
this->m_pLuaVM = pLuaVM;
this->m_sName = sName;
this->m_pMonoAssembly = NULL;
this->m_pMonoAssemblyLib = NULL;
this->m_pMonoGCHandle = NULL;
this->m_pMonoDomain = NULL;
this->m_pMonoImage = NULL;
this->m_pMonoImageLib = NULL;
this->m_pMonoClass = NULL;
}
CResource::~CResource( void )
{
mono_domain_set( mono_get_root_domain(), false );
if( this->m_pMonoDomain )
{
mono_domain_unload( this->m_pMonoDomain );
}
mono_gc_collect( mono_gc_max_generation() );
g_pResourceManager->RemoveFromList( this );
this->m_pMonoAssembly = NULL;
this->m_pMonoAssemblyLib = NULL;
this->m_pMonoGCHandle = NULL;
this->m_pMonoDomain = NULL;
this->m_pMonoImage = NULL;
this->m_pMonoImageLib = NULL;
this->m_pMonoClass = NULL;
this->m_pLuaVM = NULL;
}
bool CResource::Init( void )
{
if( this->m_pLuaVM )
{
string sDirectory ( "mods/deathmatch/resources/[ire]/" + this->m_sName + "/" );
string sPath ( sDirectory + this->m_sName + ".dll" );
string sNamespace ( this->m_sName );
string sClass ( "Program" );
this->m_pMonoDomain = mono_domain_create_appdomain( const_cast< char* >( this->m_sName.c_str( ) ), NULL );
if( !this->m_pMonoDomain )
{
g_pModuleManager->ErrorPrintf( "%s - failed to create appdomain\n", this->m_sName.c_str() );
return false;
}
mono_domain_set( this->m_pMonoDomain, false );
this->m_pMonoAssemblyLib = mono_domain_assembly_open( this->m_pMonoDomain, ( sDirectory + "MultiTheftAuto.dll" ).c_str() );
if( this->m_pMonoAssemblyLib )
{
this->m_pMonoImageLib = mono_assembly_get_image( this->m_pMonoAssemblyLib );
}
this->m_pMonoAssembly = mono_domain_assembly_open( this->m_pMonoDomain, sPath.c_str() );
if( !this->m_pMonoAssembly )
{
g_pModuleManager->ErrorPrintf( "failed to open assembly '%s.dll'\n", this->m_sName.c_str() );
return false;
}
this->m_pMonoImage = mono_assembly_get_image( this->m_pMonoAssembly );
this->m_pMonoClass = mono_class_from_name( this->m_pMonoImage, sNamespace.c_str(), sClass.c_str() );
MonoObject *pMonoObject = mono_object_new( this->m_pMonoDomain, this->m_pMonoClass );
mono_gchandle_new( pMonoObject, false );
mono_runtime_object_init( pMonoObject );
return true;
}
return false;
}
void CResource::OnStopping( void )
{
}
void CResource::DoPulse( void )
{
}
bool CResource::RegisterFunction( const char *szFunctionName, lua_CFunction Func )
{
if( !g_pModuleManager->RegisterFunction( this->m_pLuaVM, szFunctionName, Func ) )
{
g_pModuleManager->ErrorPrintf( "Failed to register function '%s' for %s", szFunctionName, this->m_sName.c_str() );
return false;
}
return true;
}
CMonoClass* CResource::GetClassFromName( const char* szNamespace, const char* szName )
{
MonoClass* pMonoClass = mono_class_from_name( this->m_pMonoImage, szNamespace, szName );
if( !pMonoClass )
{
pMonoClass = mono_class_from_name( this->m_pMonoImageLib, szNamespace, szName );
}
if( pMonoClass )
{
return new CMonoClass( pMonoClass );
}
return NULL;
}
CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName )
{
CMonoClass* pClass = this->GetClassFromName( szNamespace, szName );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get() );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of '%s::%s'\n", __FILE__, __LINE__, szNamespace, szName );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class '%s::%s' not found\n", __FILE__, __LINE__, szNamespace, szName );
}
return NULL;
}
CMonoObject* CResource::NewObject( SColor& pColor )
{
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Color" );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), pColor );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector2'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector2' not found\n", __FILE__, __LINE__ );
}
return NULL;
}
CMonoObject* CResource::NewObject( Vector2& vecVector )
{
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector2" );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), vecVector );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector2'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector2' not found\n", __FILE__, __LINE__ );
}
return NULL;
}
CMonoObject* CResource::NewObject( Vector3& vecVector )
{
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector3" );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), vecVector );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector3'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector3' not found\n", __FILE__, __LINE__ );
}
return NULL;
}
CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName, void** args, int argc )
{
CMonoClass* pClass = this->GetClassFromName( szNamespace, szName );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), args, argc );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of '%s::%s'\n", __FILE__, __LINE__, szNamespace, szName );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class '%s::%s' not found\n", __FILE__, __LINE__, szNamespace, szName );
}
return NULL;
}
mono_runtime_object_init( pMonoObject );
return true;
}
return false;
}
void CResource::OnStopping( void )
{
}
void CResource::DoPulse( void )
{
}
bool CResource::RegisterFunction( const char *szFunctionName, lua_CFunction Func )
{
if( !g_pModuleManager->RegisterFunction( this->m_pLuaVM, szFunctionName, Func ) )
{
g_pModuleManager->ErrorPrintf( "Failed to register function '%s' for %s", szFunctionName, this->m_sName.c_str() );
return false;
}
return true;
}
MonoClass* CResource::GetClassFromName( const char* szNamespace, const char* szName )
{
MonoClass* pMonoClass = mono_class_from_name( this->m_pMonoImage, szNamespace, szName );
if( !pMonoClass )
{
pMonoClass = mono_class_from_name( this->m_pMonoImageLib, szNamespace, szName );
}
return pMonoClass;
}
MonoObject* CResource::NewObject( const char* szNamespace, const char* szName )
{
MonoClass* pClass = this->GetClassFromName( szNamespace, szName );
if( pClass )
{
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get() );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of '%s::%s'\n", __FILE__, __LINE__, szNamespace, szName );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class '%s::%s' not found\n", __FILE__, __LINE__, szNamespace, szName );
}
return nullptr;
}
MonoObject* CResource::NewObject( SColor& pColor )
{
MonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Color" );
if( pClass )
{
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get(), pColor );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Color'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Color' not found\n", __FILE__, __LINE__ );
}
return nullptr;
}
MonoObject* CResource::NewObject( Vector2& vecVector )
{
MonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector2" );
if( pClass )
{
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get(), vecVector );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector2'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector2' not found\n", __FILE__, __LINE__ );
}
return nullptr;
}
MonoObject* CResource::NewObject( Vector3& vecVector )
{
MonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector3" );
if( pClass )
{
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get(), vecVector );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector3'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector3' not found\n", __FILE__, __LINE__ );
}
return nullptr;
}
MonoObject* CResource::NewObject( const char* szNamespace, const char* szName, void** args, int argc )
{
MonoClass* pClass = this->GetClassFromName( szNamespace, szName );
if( pClass )
{
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get(), args, argc );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of '%s::%s'\n", __FILE__, __LINE__, szNamespace, szName );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class '%s::%s' not found\n", __FILE__, __LINE__, szNamespace, szName );
}
return nullptr;
}

View File

@ -1,104 +1,104 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
class CResource;
#ifndef __CRESOURCE_H
#define __CRESOURCE_H
#include "Common.h"
#include "CMonoClass.h"
#include "extra/CLuaArguments.h"
class CResource
{
private:
string m_sName;
MonoAssembly *m_pMonoAssembly;
MonoAssembly *m_pMonoAssemblyLib;
MonoImage *m_pMonoImage;
MonoImage *m_pMonoImageLib;
MonoClass *m_pMonoClass;
uint32_t m_pMonoGCHandle;
public:
lua_State *m_pLuaVM;
MonoDomain *m_pMonoDomain;
CResource ( lua_State *pLuaVM, string sName );
~CResource ( void );
bool Init ( void );
void OnStopping ( void );
void DoPulse ( void );
bool RegisterFunction ( const char *szFunctionName, lua_CFunction Func );
CMonoClass* GetClassFromName( const char* szNamespace, const char* szName );
CMonoObject* NewObject( const char* szNamespace, const char* szName );
CMonoObject* NewObject( SColor& pColor );
CMonoObject* NewObject( Vector2& vecVector );
CMonoObject* NewObject( Vector3& vecVector );
CMonoObject* NewObject( const char* szNamespace, const char* szName, void** args, int argc );
MonoString* NewString( const char* szText )
{
return mono_string_new( this->m_pMonoDomain, szText );
}
MonoString* NewString( string strText )
{
return mono_string_new( this->m_pMonoDomain, strText.c_str() );
}
template <class T, int LuaType> MonoArray* NewArray( MonoClass* pMonoClass, CLuaArguments* pLuaArguments = NULL )
{
MonoArray* pArray = mono_array_new( this->m_pMonoDomain, pMonoClass, pLuaArguments ? pLuaArguments->Count() : 0 );
if( pLuaArguments )
{
vector< CLuaArgument* >::const_iterator iter = pLuaArguments->IterBegin();
for( unsigned int i = 0; iter != pLuaArguments->IterEnd(); iter++, i++ )
{
if( LuaType == LUA_TBOOLEAN )
{
mono_array_set( pArray, T, i, (T)( ( *iter )->GetBoolean() ) );
}
else if( LuaType == LUA_TLIGHTUSERDATA )
{
mono_array_set( pArray, T, i, (T)( ( *iter )->GetLightUserData() ) );
}
else if( LuaType == LUA_TNUMBER )
{
mono_array_set( pArray, T, i, ( *iter )->GetNumber< T >() );
}
else if( LuaType == LUA_TSTRING )
{
mono_array_set( pArray, T, i, (T)( ( *iter )->GetString() ) );
}
else if( LuaType == LUA_TUSERDATA )
{
mono_array_set( pArray, T, i, (T)( ( *iter )->GetLightUserData() ) );
}
}
}
return pArray;
}
string GetName ( void ) { return this->m_sName; }
lua_State *GetLua ( void ) { return this->m_pLuaVM; }
};
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
class CResource;
#ifndef __CRESOURCE_H
#define __CRESOURCE_H
#include "Common.h"
#include "CMonoClass.h"
#include "extra/CLuaArguments.h"
class CResource
{
private:
string m_sName;
MonoAssembly *m_pMonoAssembly;
MonoAssembly *m_pMonoAssemblyLib;
MonoImage *m_pMonoImage;
MonoImage *m_pMonoImageLib;
MonoClass *m_pMonoClass;
uint32_t m_pMonoGCHandle;
public:
lua_State *m_pLuaVM;
MonoDomain *m_pMonoDomain;
CResource ( lua_State *pLuaVM, string sName );
~CResource ( void );
bool Init ( void );
void OnStopping ( void );
void DoPulse ( void );
bool RegisterFunction ( const char *szFunctionName, lua_CFunction Func );
MonoClass* GetClassFromName( const char* szNamespace, const char* szName );
MonoObject* NewObject( const char* szNamespace, const char* szName );
MonoObject* NewObject( SColor& pColor );
MonoObject* NewObject( Vector2& vecVector );
MonoObject* NewObject( Vector3& vecVector );
MonoObject* NewObject( const char* szNamespace, const char* szName, void** args, int argc );
MonoString* NewString( const char* szText )
{
return mono_string_new( this->m_pMonoDomain, szText );
}
MonoString* NewString( string strText )
{
return mono_string_new( this->m_pMonoDomain, strText.c_str() );
}
template <class T, int LuaType> MonoArray* NewArray( MonoClass* pMonoClass, CLuaArguments* pLuaArguments = NULL )
{
MonoArray* pArray = mono_array_new( this->m_pMonoDomain, pMonoClass, pLuaArguments ? pLuaArguments->Count() : 0 );
if( pLuaArguments )
{
vector< CLuaArgument* >::const_iterator iter = pLuaArguments->IterBegin();
for( unsigned int i = 0; iter != pLuaArguments->IterEnd(); iter++, i++ )
{
if( LuaType == LUA_TBOOLEAN )
{
mono_array_set( pArray, T, i, (T)( ( *iter )->GetBoolean() ) );
}
else if( LuaType == LUA_TLIGHTUSERDATA )
{
mono_array_set( pArray, T, i, (T)( ( *iter )->GetLightUserData() ) );
}
else if( LuaType == LUA_TNUMBER )
{
mono_array_set( pArray, T, i, ( *iter )->GetNumber< T >() );
}
else if( LuaType == LUA_TSTRING )
{
mono_array_set( pArray, T, i, (T)( ( *iter )->GetString() ) );
}
else if( LuaType == LUA_TUSERDATA )
{
mono_array_set( pArray, T, i, (T)( ( *iter )->GetLightUserData() ) );
}
}
}
return pArray;
}
string GetName ( void ) { return this->m_sName; }
lua_State *GetLua ( void ) { return this->m_pLuaVM; }
};
#endif