The development is suspended

This commit is contained in:
Kernell 2017-02-23 16:08:59 +03:00
parent 4654d1ae15
commit 93dd86570d
81 changed files with 1913 additions and 1892 deletions

View File

@ -10,7 +10,7 @@ namespace MultiTheftAuto
}
[MethodImpl( MethodImplOptions.InternalCall )]
static extern public Ban Add( string ip, string username, string serial, Element responsible, string responsibleName, string reason, int unban );
static extern public Ban Add( string ip, string username, string serial, Element responsible, string reason, int unban );
[MethodImpl( MethodImplOptions.InternalCall )]
extern public bool Remove( Ban ban, Element responsible );

View File

@ -14,7 +14,7 @@ namespace MultiTheftAuto
}
[MethodImpl( MethodImplOptions.InternalCall )]
public static extern bool Output( string text, Element element = null );
public static extern bool Output( string text, Element player = null );
public static int Read()
{

View File

@ -29,11 +29,6 @@ namespace MultiTheftAuto
{
}
~Element()
{
Debug.Info( "~Element() [0x" + this + "]" );
}
#endregion
#region Methods

View File

@ -133,7 +133,8 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>pdb2mdb $(TargetPath)</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -15,7 +15,7 @@ namespace MultiTheftAuto
{
get
{
return Resource.GetCurrent().GetRoot();
return Resource.GetCurrent().GetRootElement();
}
}
@ -38,7 +38,7 @@ namespace MultiTheftAuto
public extern Resource Copy( string newResourceName, string organizationalDir );
[MethodImpl( MethodImplOptions.InternalCall )]
public extern Element GetRoot();
public extern Element GetRootElement();
[MethodImpl( MethodImplOptions.InternalCall )]
public extern Element GetMapRootElement( UInt32 resource, string map );

View File

@ -247,11 +247,6 @@ namespace MultiTheftAuto
}
~Vehicle()
{
Debug.Info( "~Vehicle() [" + this.GetName() + "]" );
}
#endregion
#region Static Methods

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# mta-mono
Mono .NET Framework module for Multi Theft Auto (blue)

View File

@ -1,69 +1,39 @@
using System;
using System.Linq;
using System.Collections.Generic;
using MultiTheftAuto;
using MultiTheftAuto.EventArgs;
using Console = MultiTheftAuto.Console;
namespace Test
{
public class Program
{
static void MonoCommandHandler( Player player, string command, string[] args )
{
Debug.Info( player.GetName() + " executed command '" + command + "' with args: " + string.Join( " ", args ) );
}
static void Main( string[] args )
{
Server.AddCommandHandler( "mono", new CommandHandler( MonoCommandHandler ) );
Event.AddHandler( "onElementDestroy", Resource.Root, new Action<Vehicle>( Vehicle_OnElementDestroy ) );
Element.Root.OnPlayerJoin += Root_OnPlayerJoin;
for( int i = 0; i < 8; i++ )
{
Vehicle vehicle = new Vehicle( VehicleModel.SULTAN + i, Vector3.Zero, Vector3.Zero );
}
//Element.Root.OnElementDestroy += ( Element sender, ElementEventArgs e ) =>
//{
// Debug.Info( "lambda " + sender.GetType() + " " + e.This.GetType() );
//};
Debug.Info( "------------------------------------" );
Element vehicle = new Vehicle( VehicleModel.ADMIRAL, Vector3.Zero, Vector3.Zero );
Debug.Info( vehicle.GetType().ToString() );
vehicle.OnElementDestroy += Root_ElementDestroy;
//Event.Add( "onTest", true );
//Event.AddHandler( "onTest", vehicle, new Action<Element, string, bool, bool>( testEvent_OnTrigger ) );
//Event.Trigger( "onTest", vehicle, "test", true, false, 123, 456.7f, 1337.01d, null, vehicle );
foreach( Vehicle vehicle in Element.GetByType( "vehicle" ) )
{
Debug.Info( string.Format( "{0} {1}", vehicle.GetVehicleType(), vehicle.GetName() ) );
vehicle.Destroy();
Debug.Info( Color.Aquamarine.ToString() );
}
static void Root_OnPlayerJoin( Element sender, ElementEventArgs e )
{
Player player = sender as Player;
Debug.Info( "Player '" + player.GetName() + "' joined" );
player.FadeCamera( true, 1.0f, Color.Black );
Debug.Info( "------------------------------------" );
}
static void Root_OnPlayerConnect( Element sender, PlayerConnectEventArgs e )
static void Vehicle_OnElementDestroy( Vehicle sender )
{
//Player player = sender as Player;
Debug.Info( "Player '" + sender.GetType() + "' connected" );
}
static void testEvent_OnTrigger( Element sender, string a, bool b, bool c )
{
Debug.Info( "testEvent_OnTrigger " + sender.GetType() + " " + a + " " + b + " " + c );
}
static void Root_ElementDestroy( Element sender, ElementEventArgs e )
{
Debug.Info( "Root_ElementDestroy " + sender.GetType() + " " + e.This.GetType() );
Console.WriteLine( "onElementDestroy: " + sender.GetName() );
}
}
}

View File

@ -14,90 +14,46 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj",
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_SGen|Any CPU = Debug_SGen|Any CPU
Debug_SGen|Mixed Platforms = Debug_SGen|Mixed Platforms
Debug_SGen|Win32 = Debug_SGen|Win32
Debug_SGen|x64 = Debug_SGen|x64
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release_SGen|Any CPU = Release_SGen|Any CPU
Release_SGen|Mixed Platforms = Release_SGen|Mixed Platforms
Release_SGen|Win32 = Release_SGen|Win32
Release_SGen|x64 = Release_SGen|x64
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug_SGen|Any CPU.ActiveCfg = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug_SGen|Mixed Platforms.ActiveCfg = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug_SGen|Mixed Platforms.Build.0 = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug_SGen|Win32.ActiveCfg = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug_SGen|Win32.Build.0 = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug_SGen|x64.ActiveCfg = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug|Any CPU.ActiveCfg = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug|Win32.ActiveCfg = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug|Win32.Build.0 = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Debug|x64.ActiveCfg = Debug|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release_SGen|Any CPU.ActiveCfg = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release_SGen|Mixed Platforms.ActiveCfg = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release_SGen|Mixed Platforms.Build.0 = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release_SGen|Win32.ActiveCfg = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release_SGen|Win32.Build.0 = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release_SGen|x64.ActiveCfg = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release|Any CPU.ActiveCfg = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release|Mixed Platforms.Build.0 = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release|Win32.ActiveCfg = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release|Win32.Build.0 = Release|Win32
{5E5C7A85-A869-4D86-88FF-05DCEFC07AC3}.Release|x64.ActiveCfg = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug_SGen|Any CPU.ActiveCfg = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug_SGen|Mixed Platforms.ActiveCfg = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug_SGen|Mixed Platforms.Build.0 = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug_SGen|Win32.ActiveCfg = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug_SGen|Win32.Build.0 = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug_SGen|x64.ActiveCfg = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug|Any CPU.ActiveCfg = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug|Win32.ActiveCfg = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug|Win32.Build.0 = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Debug|x64.ActiveCfg = Debug|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release_SGen|Any CPU.ActiveCfg = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release_SGen|Mixed Platforms.ActiveCfg = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release_SGen|Mixed Platforms.Build.0 = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release_SGen|Win32.ActiveCfg = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release_SGen|Win32.Build.0 = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release_SGen|x64.ActiveCfg = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release|Any CPU.ActiveCfg = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release|Mixed Platforms.Build.0 = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release|Win32.ActiveCfg = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release|Win32.Build.0 = Release|Win32
{E2629417-52DF-854E-B510-C15A87AB4BE3}.Release|x64.ActiveCfg = Release|Win32
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug_SGen|Any CPU.ActiveCfg = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug_SGen|Any CPU.Build.0 = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug_SGen|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug_SGen|Mixed Platforms.Build.0 = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug_SGen|Win32.ActiveCfg = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug_SGen|x64.ActiveCfg = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug|Win32.ActiveCfg = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Debug|x64.ActiveCfg = Debug|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release_SGen|Any CPU.ActiveCfg = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release_SGen|Any CPU.Build.0 = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release_SGen|Mixed Platforms.ActiveCfg = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release_SGen|Mixed Platforms.Build.0 = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release_SGen|Win32.ActiveCfg = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release_SGen|x64.ActiveCfg = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release|Any CPU.Build.0 = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
@ -105,24 +61,12 @@ Global
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release|Win32.ActiveCfg = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release|Win32.Build.0 = Release|Any CPU
{2E5D4B1E-405E-453F-BEED-25735E25ACD8}.Release|x64.ActiveCfg = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug_SGen|Any CPU.ActiveCfg = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug_SGen|Any CPU.Build.0 = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug_SGen|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug_SGen|Mixed Platforms.Build.0 = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug_SGen|Win32.ActiveCfg = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug_SGen|x64.ActiveCfg = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug|Win32.ActiveCfg = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Debug|x64.ActiveCfg = Debug|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release_SGen|Any CPU.ActiveCfg = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release_SGen|Any CPU.Build.0 = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release_SGen|Mixed Platforms.ActiveCfg = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release_SGen|Mixed Platforms.Build.0 = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release_SGen|Win32.ActiveCfg = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release_SGen|x64.ActiveCfg = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release|Any CPU.Build.0 = Release|Any CPU
{CBD7F8D5-39F2-4AA5-9FFF-2D3185533DDD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
@ -138,9 +82,9 @@ Global
{E2629417-52DF-854E-B510-C15A87AB4BE3} = {AC4FC54A-60A7-4EB0-A40D-14768DD633F1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
AMDCaPersistentConfig = Debug|Win32
AMDCaPersistentStartup = mono
AMDCaProjectFile = C:\Users\Owner\Development\monogit\mono\msvc\CodeAnalyst\mono.caw
AMDCaPersistentStartup = mono
AMDCaPersistentConfig = Debug|Win32
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}

Binary file not shown.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@ -19,13 +19,13 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
@ -173,11 +173,11 @@
<ClCompile Include="src\CMonoInterface.cpp" />
<ClCompile Include="src\CMonoMethod.cpp" />
<ClCompile Include="src\CMonoMTALib.cpp" />
<ClCompile Include="src\CMonoObject.cpp" />
<ClCompile Include="src\Common.cpp" />
<ClCompile Include="src\CRegisteredCommands.cpp" />
<ClCompile Include="src\CResource.cpp" />
<ClCompile Include="src\CResourceManager.cpp" />
<ClCompile Include="src\extra\CVehicleColor.cpp" />
<ClCompile Include="src\extra\SColor.cpp" />
<ClCompile Include="src\extra\Vector2.cpp" />
<ClCompile Include="src\extra\Vector3.cpp" />
<ClCompile Include="src\mta-mono.cpp" />
@ -185,6 +185,7 @@
<ClCompile Include="src\extra\CLuaArgument.cpp" />
<ClCompile Include="src\extra\CLuaArguments.cpp" />
<ClCompile Include="src\lua\CLuaFunctionDefinitions.cpp" />
<ClCompile Include="src\SharedUtil\SharedUtil.MonoObject.cpp" />
<ClCompile Include="src\StdInc.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
@ -206,10 +207,11 @@
<ClInclude Include="src\CMonoInterface.h" />
<ClInclude Include="src\CMonoMethod.h" />
<ClInclude Include="src\CMonoMTALib.h" />
<ClInclude Include="src\CMonoObject.h" />
<ClInclude Include="src\CRegisteredCommands.h" />
<ClInclude Include="src\CResource.h" />
<ClInclude Include="src\CResourceManager.h" />
<ClInclude Include="src\extra\CVehicleColor.h" />
<ClInclude Include="src\extra\SColor.h" />
<ClInclude Include="src\extra\Vector2.h" />
<ClInclude Include="src\extra\Vector3.h" />
<ClInclude Include="src\include\mono\jit\jit.h" />
@ -243,13 +245,16 @@
<ClInclude Include="src\include\mono\utils\mono-logger.h" />
<ClInclude Include="src\include\mono\utils\mono-publib.h" />
<ClInclude Include="src\CFunctions.h" />
<ClInclude Include="src\Common.h" />
<ClInclude Include="src\extra\CLuaArgument.h" />
<ClInclude Include="src\extra\CLuaArguments.h" />
<ClInclude Include="src\include\ILuaModuleManager.h" />
<ClInclude Include="src\lua\CLuaFunctionDefinitions.h" />
<ClInclude Include="src\SharedUtil\SharedUtil.h" />
<ClInclude Include="src\StdInc.h" />
</ItemGroup>
<ItemGroup>
<None Include="src\SharedUtil\SharedUtil.MonoObject.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -73,9 +73,6 @@
<ClCompile Include="src\CMonoFunctions_Event.cpp">
<Filter>MonoInternals</Filter>
</ClCompile>
<ClCompile Include="src\CMonoObject.cpp">
<Filter>MonoInterface</Filter>
</ClCompile>
<ClCompile Include="src\CMonoClass.cpp">
<Filter>MonoInterface</Filter>
</ClCompile>
@ -103,7 +100,6 @@
<ClCompile Include="src\CMonoFunctions.cpp">
<Filter>MonoInternals</Filter>
</ClCompile>
<ClCompile Include="src\Common.cpp" />
<ClCompile Include="src\mta-mono.cpp" />
<ClCompile Include="src\StdInc.cpp" />
<ClCompile Include="src\CResource.cpp">
@ -134,6 +130,15 @@
<ClCompile Include="src\CMonoArguments.cpp">
<Filter>MonoInterface</Filter>
</ClCompile>
<ClCompile Include="src\extra\SColor.cpp">
<Filter>extra</Filter>
</ClCompile>
<ClCompile Include="src\extra\CVehicleColor.cpp">
<Filter>extra</Filter>
</ClCompile>
<ClCompile Include="src\SharedUtil\SharedUtil.MonoObject.cpp">
<Filter>SharedUtil</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\include\ILuaModuleManager.h">
@ -253,9 +258,6 @@
<ClInclude Include="src\CMonoMTALib.h">
<Filter>MonoInterface</Filter>
</ClInclude>
<ClInclude Include="src\CMonoObject.h">
<Filter>MonoInterface</Filter>
</ClInclude>
<ClInclude Include="src\CMonoFunctions.h">
<Filter>MonoInternals</Filter>
</ClInclude>
@ -274,7 +276,6 @@
<ClInclude Include="src\extra\Vector3.h">
<Filter>extra</Filter>
</ClInclude>
<ClInclude Include="src\Common.h" />
<ClInclude Include="src\StdInc.h" />
<ClInclude Include="src\CResourceManager.h">
<Filter>ResourceInterface</Filter>
@ -304,6 +305,15 @@
<ClInclude Include="src\CMonoArguments.h">
<Filter>MonoInterface</Filter>
</ClInclude>
<ClInclude Include="src\SharedUtil\SharedUtil.h">
<Filter>SharedUtil</Filter>
</ClInclude>
<ClInclude Include="src\extra\SColor.h">
<Filter>extra</Filter>
</ClInclude>
<ClInclude Include="src\extra\CVehicleColor.h">
<Filter>extra</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="MonoInterface">
@ -336,5 +346,13 @@
<Filter Include="MonoInternals">
<UniqueIdentifier>{bf9a17ba-d06a-45ef-a342-7297bfd9a22e}</UniqueIdentifier>
</Filter>
<Filter Include="SharedUtil">
<UniqueIdentifier>{10d1db59-4ba0-4c7c-81d2-7fa9b9283bc2}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="src\SharedUtil\SharedUtil.MonoObject.h">
<Filter>SharedUtil</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -13,7 +13,7 @@
#include "StdInc.h"
#include "CElement.h"
const map<eElementType, pair<string, string>> CElement::_eElementType =
const map< eElementType, pair< string, string > > CElement::_eElementType =
{
{ eElementType::Dummy, { "dummy", "Element" } },
{ eElementType::Player, { "player", "Player" } },
@ -31,16 +31,16 @@ const map<eElementType, pair<string, string>> CElement::_eElementType =
{ eElementType::Water, { "water", "Water" } },
{ eElementType::Weapon, { "weapon", "Weapon" } },
{ eElementType::DatabaseConnection, { "db-connection", "DbConnection" } },
{ eElementType::Resource, { "resource", "Resource" } },
{ eElementType::Resource, { "resource", "Element" } },
{ eElementType::Root, { "root", "Element" } },
{ eElementType::Unknown, { "unknown", "Element" } },
};
CElement::CElement( CElementManager* pManager, MonoObject* pObject, PVOID pUserdata, const CResource* pParent )
CElement::CElement( CElementManager* pManager, MonoObject* pObject, PVOID pLuaUserdata, const CResource* pParent )
{
this->m_pLuaUserdata = pLuaUserdata;
this->m_pElementManager = pManager;
this->m_pMonoObject = pObject;
this->m_pLuaUserdata = pUserdata;
this->m_pParent = pParent;
this->m_iType = eElementType::Unknown;
@ -77,9 +77,14 @@ const string CElement::GetTypeName( void )
return CElement::GetTypeName( this->m_iType );
}
const char* CElement::GetTypeClassName( void )
{
return CElement::GetTypeClassName( this->m_iType );
}
CElement* CElement::GetParent( void ) const
{
MonoObject* pMonoObject = CMonoFunctions::Element::GetParent( this->ToMonoObject() );
MonoObject* pMonoObject = CMonoFunctions::Element::GetParent( this->m_pMonoObject );
if( pMonoObject )
{

View File

@ -49,7 +49,7 @@ enum class eElementType
class CElement
{
public:
static const map<eElementType, pair<string, string>> _eElementType;
static const map< eElementType, pair< string, string > > _eElementType;
inline static const string GetTypeName( eElementType iType )
{
@ -114,18 +114,21 @@ private:
uint32_t m_uiGCHandle;
public:
CElement ( CElementManager* pManager, MonoObject* pObject, PVOID pUserdata, const CResource* pParent = nullptr );
CElement ( CElementManager* pManager, MonoObject* pObject, PVOID pLuaUserdata, const CResource* pParent = nullptr );
virtual ~CElement ( void );
inline eElementType GetType ( void ) const { return this->m_iType; }
inline void SetType ( eElementType iType ) { this->m_iType = iType; }
void SetTypeName ( const string& strTypeName );
const string GetTypeName ( void );
const char* GetTypeClassName ( void );
CElement* GetParent ( void ) const;
inline MonoObject* ToMonoObject ( void ) const { return this->m_pMonoObject; }
inline PVOID ToLuaUserData ( void ) const { return this->m_pLuaUserdata; }
inline PVOID GetLuaUserdata ( void ) const { return this->m_pLuaUserdata; }
inline MonoObject* GetMonoObject ( void ) const { return this->m_pMonoObject; }
};
#endif

View File

@ -37,18 +37,19 @@ void CElementManager::DeleteAll( void )
}
}
CElement* CElementManager::Create( MonoObject* pObject, PVOID pUserData )
CElement* CElementManager::Create( MonoObject* pObject, PVOID pUserdata )
{
string strTypeName;
if( pObject == nullptr )
{
string _tmp;
string strTypeName;
if( CLuaFunctionDefinitions::IsElement( this->m_pResource->GetLua(), pUserData ) )
if( CLuaFunctionDefinitions::IsElement( this->m_pResource->GetLua(), pUserdata ) )
{
strTypeName = CLuaFunctionDefinitions::GetElementType( this->m_pResource->GetLua(), pUserData );
strTypeName = CLuaFunctionDefinitions::GetElementType( this->m_pResource->GetLua(), pUserdata );
}
else if( CLuaFunctionDefinitions::GetResourceName( this->m_pResource->GetLua(), pUserData, _tmp ) )
else if( CLuaFunctionDefinitions::GetResourceName( this->m_pResource->GetLua(), pUserdata, _tmp ) )
{
strTypeName = "resource";
}
@ -69,21 +70,25 @@ CElement* CElementManager::Create( MonoObject* pObject, PVOID pUserData )
if( pObject )
{
return new CElement( this, pObject, pUserData, this->m_pResource );
CElement* pElement = new CElement( this, pObject, pUserdata, this->m_pResource );
pElement->SetTypeName( strTypeName );
return pElement;
}
return nullptr;
}
CElement* CElementManager::FindOrCreate( PVOID pUserData )
CElement* CElementManager::FindOrCreate( PVOID pUserdata )
{
CElement* pElement;
pElement = this->GetFromList( pUserData );
pElement = this->GetFromList( pUserdata );
if( !pElement )
{
pElement = this->Create( nullptr, pUserData );
pElement = this->Create( nullptr, pUserdata );
}
return pElement;
@ -103,7 +108,7 @@ CElement* CElementManager::GetFromList( PVOID pUserdata )
{
for( const auto& pElement : this->m_List )
{
if( pElement->ToLuaUserData() == pUserdata )
if( pElement->GetLuaUserdata() == pUserdata )
{
return pElement;
}
@ -116,7 +121,7 @@ CElement* CElementManager::GetFromList( MonoObject* pMonoObject )
{
for( const auto& pElement : this->m_List )
{
if( pElement->ToMonoObject() == pMonoObject )
if( pElement->GetMonoObject() == pMonoObject )
{
return pElement;
}

View File

@ -64,6 +64,8 @@ bool CEvent::Call( CElement* pThis, PVOID* params ) const
ASSERT( pMTALib );
pResource->GetDomain()->Set( false );
MonoObject* pException = nullptr;
mono_runtime_delegate_invoke( this->m_pMonoDelegate, params, &pException );

View File

@ -105,10 +105,12 @@ bool CEventManager::Call( const string& strName, CElement* pThis, list< CLuaArgu
}
}
CMonoClass* pClass = pMTALib->GetClass( "Element" );
CMonoClass* pClass = pMTALib->GetClass( pThis->GetTypeClassName() );
ASSERT( pClass );
if( pClass )
{
string strEventName = strName;
strEventName[ 0 ] = toupper( strEventName[ 0 ] );
@ -117,10 +119,11 @@ bool CEventManager::Call( const string& strName, CElement* pThis, list< CLuaArgu
if( pEvent )
{
return pEvent->Call( pThis->ToMonoObject(), Arguments );
return pEvent->Call( pThis, Arguments );
}
}
return true;
return false;
}
void CEventManager::ReadArgumens( list< CLuaArgument* > Arguments, CMonoArguments& pArguments )
@ -168,9 +171,9 @@ void CEventManager::ReadArgumens( list< CLuaArgument* > Arguments, CMonoArgument
{
CElement* pElement = pElementManager->FindOrCreate( iter->GetLightUserData() );
MonoObject* pValue = pElement->ToMonoObject();
ASSERT( pElement );
pArguments.Push( pValue );
pArguments.Push( pElement->GetMonoObject() );
break;
}

View File

@ -67,7 +67,9 @@ int CFunctions::monoEventHandler( lua_State *pLuaVM )
list< CLuaArgument* > argv;
for( const auto& iter : pLuaArgs.GetArguments() )
vector < CLuaArgument* > _args = pLuaArgs.GetArguments();
for( const auto& iter : _args )
{
eLuaType iLuaType = iter->GetType();

View File

@ -15,6 +15,8 @@
CModule::CModule( ILuaModuleManager10* pModule )
{
g_pModule = this;
this->m_pModuleManager = pModule;
this->m_pMonoInterface = new CMonoInterface( this );
@ -27,6 +29,8 @@ CModule::~CModule( void )
SAFE_DELETE( this->m_pMonoInterface );
this->m_pModuleManager = nullptr;
g_pModule = nullptr;
}
void CModule::DoPulse( void )

View File

@ -19,6 +19,11 @@ CMonoArguments::CMonoArguments( void )
}
CMonoArguments::~CMonoArguments( void )
{
this->Clear();
}
void CMonoArguments::Clear( void )
{
for( auto iter : this->m_pArgs )
{
@ -52,8 +57,11 @@ bool CMonoArguments::Push( MonoObject* pObject )
PVOID* CMonoArguments::GetArgs( void )
{
if( this->m_pTmpArgs == nullptr )
if( this->m_pTmpArgs )
{
delete [] this->m_pTmpArgs;
}
this->m_pTmpArgs = new PVOID[ this->Length() ];
uint i = 0;
@ -62,7 +70,6 @@ PVOID* CMonoArguments::GetArgs( void )
{
this->m_pTmpArgs[ i++ ] = iter.first;
}
}
return this->m_pTmpArgs;
}
@ -72,14 +79,14 @@ const size_t CMonoArguments::Length( void ) const
return this->m_pArgs.size();
}
PVOID CMonoArguments::operator[]( int index )
PVOID CMonoArguments::operator [] ( int index )
{
ASSERT( index < this->Length() );
return this->GetArgs()[ index ];
return this->m_pArgs[ index ].first;
}
PVOID* CMonoArguments::operator*( void )
PVOID* CMonoArguments::operator * ( void )
{
return this->GetArgs();
}

View File

@ -25,6 +25,8 @@ public:
CMonoArguments ( void );
~CMonoArguments ( void );
void Clear ( void );
template< typename Type >
bool Push ( Type Value )
{
@ -43,8 +45,8 @@ public:
PVOID* GetArgs ( void );
const size_t Length ( void ) const;
PVOID operator[] ( int index );
PVOID* operator* ( void );
PVOID operator [] ( int index );
PVOID* operator * ( void );
};
#endif

View File

@ -98,7 +98,7 @@ CMonoClass::~CMonoClass( void )
this->m_Methods.clear();
}
MonoObject* CMonoClass::New( void )
MonoObject* CMonoClass::New( void ) const
{
MonoObject* pObject = this->m_pDomain->CreateObject( this->m_pClass );
@ -112,28 +112,28 @@ MonoObject* CMonoClass::New( void )
return pObject;
}
MonoObject* CMonoClass::New( SColor& pColor )
MonoObject* CMonoClass::New( SColor& pColor ) const
{
void *args[] = { &pColor.R, &pColor.G, &pColor.B, &pColor.A };
PVOID args[] = { &pColor.R, &pColor.G, &pColor.B, &pColor.A };
return this->New( args, 4 );
}
MonoObject* CMonoClass::New( Vector2& vecVector )
MonoObject* CMonoClass::New( Vector2& vecVector ) const
{
void *args[] = { &vecVector.fX, &vecVector.fY };
PVOID args[] = { &vecVector.fX, &vecVector.fY };
return this->New( args, 2 );
}
MonoObject* CMonoClass::New( Vector3& vecVector )
MonoObject* CMonoClass::New( Vector3& vecVector ) const
{
void *args[] = { &vecVector.fX, &vecVector.fY, &vecVector.fZ };
PVOID args[] = { &vecVector.fX, &vecVector.fY, &vecVector.fZ };
return this->New( args, 3 );
}
MonoObject* CMonoClass::New( void** args, int argc )
MonoObject* CMonoClass::New( void** args, int argc ) const
{
MonoObject* pObject = this->m_pDomain->CreateObject( this->m_pClass );
@ -161,27 +161,27 @@ MonoObject* CMonoClass::New( void** args, int argc )
return pObject;
}
MonoObject* CMonoClass::Box( void* value )
MonoObject* CMonoClass::Box( void* value ) const
{
return mono_value_box( this->m_pDomain->GetMonoPtr(), this->m_pClass, value );
return mono_value_box( **this->m_pDomain, this->m_pClass, value );
}
const char* CMonoClass::GetName( void )
const char* CMonoClass::GetName( void ) const
{
return mono_class_get_name( this->m_pClass );
}
const char* CMonoClass::GetNameSpace( void )
const char* CMonoClass::GetNameSpace( void ) const
{
return mono_class_get_namespace( this->m_pClass );
}
MonoMethod* CMonoClass::GetMethodFromName( string strMethodName, int iParamCount )
MonoMethod* CMonoClass::GetMethodFromName( const string& strMethodName, int iParamCount ) const
{
return mono_class_get_method_from_name( this->m_pClass, strMethodName.c_str(), iParamCount );
}
MonoMethod* CMonoClass::GetMethod( string strMethodName )
MonoMethod* CMonoClass::GetMethod( const string& strMethodName ) const
{
MonoMethodDesc* pMonoMethodDesc = mono_method_desc_new( strMethodName.c_str(), false );
@ -197,13 +197,13 @@ MonoMethod* CMonoClass::GetMethod( string strMethodName )
return nullptr;
}
CMonoMethod* CMonoClass::GetMethod( string strMethodName, uint uiIndex )
CMonoMethod* CMonoClass::GetMethod( const string& strMethodName, uint uiIndex )
{
if( this->m_Methods[ strMethodName ].size() > 0 )
{
uint i = 0;
for( auto ptr : this->m_Methods[ strMethodName ] )
for( const auto& ptr : this->m_Methods[ strMethodName ] )
{
if( i++ == uiIndex )
{
@ -215,17 +215,17 @@ CMonoMethod* CMonoClass::GetMethod( string strMethodName, uint uiIndex )
return nullptr;
}
list< CMonoMethod* > CMonoClass::GetMethods( string strMethodName )
list< CMonoMethod* > CMonoClass::GetMethods( const string& strMethodName )
{
return this->m_Methods[ strMethodName ];
}
CMonoEvent* CMonoClass::GetEvent( string strEventName )
CMonoEvent* CMonoClass::GetEvent( const string& strEventName )
{
return this->m_Events.count( strEventName ) ? this->m_Events[ strEventName ] : nullptr;
}
MonoClassField* CMonoClass::GetField( string strFieldName )
MonoClassField* CMonoClass::GetField( const string& strFieldName )
{
return this->m_Fields.count( strFieldName ) ? this->m_Fields[ strFieldName ] : nullptr;
}

View File

@ -40,29 +40,29 @@ public:
CMonoClass ( MonoClass* pMonoClass, CMonoDomain* pDomain );
~CMonoClass ( void );
MonoObject* New ( void );
MonoObject* New ( SColor& pColor );
MonoObject* New ( Vector2& vecVector );
MonoObject* New ( Vector3& vecVector );
MonoObject* New ( void** args, int argc );
MonoObject* New ( void ) const;
MonoObject* New ( SColor& pColor ) const;
MonoObject* New ( Vector2& vecVector ) const;
MonoObject* New ( Vector3& vecVector ) const;
MonoObject* New ( PVOID* args, int argc ) const;
MonoObject* Box ( void* value );
MonoObject* Box ( PVOID value ) const;
const char* GetName ( void );
const char* GetNameSpace ( void );
const char* GetName ( void ) const;
const char* GetNameSpace ( void ) const;
MonoMethod* GetMethodFromName ( string strMethodName, int iParamCount );
MonoMethod* GetMethod ( string strMethodName );
CMonoMethod* GetMethod ( string strMethodName, uint uiIndex );
list< CMonoMethod* > GetMethods ( string strMethodName );
MonoMethod* GetMethodFromName ( const string& strMethodName, int iParamCount ) const;
MonoMethod* GetMethod ( const string& strMethodName ) const;
CMonoMethod* GetMethod ( const string& strMethodName, uint uiIndex );
list< CMonoMethod* > GetMethods ( const string& strMethodName );
CMonoEvent* GetEvent ( string strEventName );
MonoClassField* GetField ( string strFieldName );
CMonoEvent* GetEvent ( const string& strEventName );
MonoClassField* GetField ( const string& strFieldName );
MonoEventMap GetAllEvents ( void ) { return this->m_Events; }
inline MonoEventMap GetAllEvents ( void ) const { return this->m_Events; }
inline CMonoDomain* GetDomain ( void ) const { return this->m_pDomain; }
MonoClass* GetMonoPtr ( void ) { return this->m_pClass; }
CMonoDomain* GetDomain ( void ) { return this->m_pDomain; }
inline MonoClass* operator * ( void ) const { return this->m_pClass; }
};
#endif

View File

@ -19,26 +19,26 @@ CMonoCorlib::CMonoCorlib( CMonoDomain* pDomain )
this->m_pImage = mono_get_corlib();
this->m_pAssembly = mono_image_get_assembly( this->m_pImage );
this->Class[ "intptr" ] = this->GetDomain()->FindOrAdd( mono_get_intptr_class() );
this->Class[ "uintptr" ] = this->GetDomain()->FindOrAdd( mono_get_uintptr_class() );
this->Class[ "boolean" ] = this->GetDomain()->FindOrAdd( mono_get_boolean_class() );
this->Class[ "char" ] = this->GetDomain()->FindOrAdd( mono_get_char_class() );
this->Class[ "sbyte" ] = this->GetDomain()->FindOrAdd( mono_get_sbyte_class() );
this->Class[ "byte" ] = this->GetDomain()->FindOrAdd( mono_get_byte_class() );
this->Class[ "int16" ] = this->GetDomain()->FindOrAdd( mono_get_int16_class() );
this->Class[ "uint16" ] = this->GetDomain()->FindOrAdd( mono_get_uint16_class() );
this->Class[ "int32" ] = this->GetDomain()->FindOrAdd( mono_get_int32_class() );
this->Class[ "uint32" ] = this->GetDomain()->FindOrAdd( mono_get_uint32_class() );
this->Class[ "int64" ] = this->GetDomain()->FindOrAdd( mono_get_int64_class() );
this->Class[ "uint64" ] = this->GetDomain()->FindOrAdd( mono_get_uint64_class() );
this->Class[ "float" ] = this->GetDomain()->FindOrAdd( mono_get_single_class() );
this->Class[ "double" ] = this->GetDomain()->FindOrAdd( mono_get_double_class() );
this->Class[ "string" ] = this->GetDomain()->FindOrAdd( mono_get_string_class() );
this->Class[ "array" ] = this->GetDomain()->FindOrAdd( mono_get_array_class() );
this->Class[ "enum" ] = this->GetDomain()->FindOrAdd( mono_get_enum_class() );
this->Class[ "exception" ] = this->GetDomain()->FindOrAdd( mono_get_exception_class() );
this->Class[ "object" ] = this->GetDomain()->FindOrAdd( mono_get_object_class() );
this->Class[ "thread" ] = this->GetDomain()->FindOrAdd( mono_get_thread_class() );
this->Class[ "intptr" ] = pDomain->FindOrAdd( mono_get_intptr_class() );
this->Class[ "uintptr" ] = pDomain->FindOrAdd( mono_get_uintptr_class() );
this->Class[ "boolean" ] = pDomain->FindOrAdd( mono_get_boolean_class() );
this->Class[ "char" ] = pDomain->FindOrAdd( mono_get_char_class() );
this->Class[ "sbyte" ] = pDomain->FindOrAdd( mono_get_sbyte_class() );
this->Class[ "byte" ] = pDomain->FindOrAdd( mono_get_byte_class() );
this->Class[ "int16" ] = pDomain->FindOrAdd( mono_get_int16_class() );
this->Class[ "uint16" ] = pDomain->FindOrAdd( mono_get_uint16_class() );
this->Class[ "int32" ] = pDomain->FindOrAdd( mono_get_int32_class() );
this->Class[ "uint32" ] = pDomain->FindOrAdd( mono_get_uint32_class() );
this->Class[ "int64" ] = pDomain->FindOrAdd( mono_get_int64_class() );
this->Class[ "uint64" ] = pDomain->FindOrAdd( mono_get_uint64_class() );
this->Class[ "float" ] = pDomain->FindOrAdd( mono_get_single_class() );
this->Class[ "double" ] = pDomain->FindOrAdd( mono_get_double_class() );
this->Class[ "string" ] = pDomain->FindOrAdd( mono_get_string_class() );
this->Class[ "array" ] = pDomain->FindOrAdd( mono_get_array_class() );
this->Class[ "enum" ] = pDomain->FindOrAdd( mono_get_enum_class() );
this->Class[ "exception" ] = pDomain->FindOrAdd( mono_get_exception_class() );
this->Class[ "object" ] = pDomain->FindOrAdd( mono_get_object_class() );
this->Class[ "thread" ] = pDomain->FindOrAdd( mono_get_thread_class() );
this->Class[ "Type" ] = this->GetClass( "System", "Type" );
this->Class[ "ValueType" ] = this->GetClass( "System", "ValueType" );

View File

@ -34,7 +34,7 @@ public:
CMonoClass* GetClass ( const char *szNameSpace, const char *szClassName );
CMonoDomain* GetDomain ( void ) { return this->m_pDomain; }
inline CMonoDomain* GetDomain ( void ) const { return this->m_pDomain; }
};
#endif

View File

@ -46,7 +46,7 @@ CMonoDomain::~CMonoDomain( void )
{
mono_domain_finalize( this->m_pDomain, 2000 );
MonoObject *pException = nullptr;
MonoObject* pException = nullptr;
mono_domain_try_unload( this->m_pDomain, &pException );
@ -80,7 +80,7 @@ CMonoClass* CMonoDomain::FindOrAdd( MonoClass* klass )
{
for( const auto& iter : this->m_ClassPool )
{
if( iter->GetMonoPtr() == klass )
if( **iter == klass )
{
return iter;
}
@ -147,15 +147,17 @@ bool CMonoDomain::Start( void )
return false;
}
MonoString* pString1 = this->NewString( this->m_strName.c_str() );
const char* szStrings[] =
{
this->m_strName.c_str(),
};
MonoArray* pArray = mono_array_new( this->m_pDomain, mono_get_string_class(), 1 );
MonoArray* pArray = this->NewArray( sizeof( szStrings ) / sizeof( char* ), szStrings );
mono_array_set( pArray, MonoString*, 0, pString1 );
void* params[ 1 ];
params[ 0 ] = pArray;
PVOID params[] =
{
pArray,
};
MonoObject* pException = nullptr;
@ -176,7 +178,7 @@ void CMonoDomain::Unload( void )
bool CMonoDomain::Set( bool bForce )
{
return mono_domain_set( this->m_pDomain, static_cast<mono_bool>( bForce ) ) == 1;
return mono_domain_set( this->m_pDomain, bForce ? 1 : 0 ) == 1;
}
MonoAssembly* CMonoDomain::OpenAssembly( const char *szName )
@ -204,7 +206,7 @@ MonoString* CMonoDomain::NewString( const string& strText ) const
return mono_string_new( this->m_pDomain, strText.c_str() );
}
MonoArray* CMonoDomain::NewElementArray( MonoClass* pMonoClass, CLuaArgumentsVector pLuaArguments )
MonoArray* CMonoDomain::NewArray( MonoClass* pMonoClass, CLuaArgumentsVector pLuaArguments ) const
{
MonoArray* pArray = mono_array_new( this->m_pDomain, pMonoClass, pLuaArguments.size() );
@ -220,10 +222,24 @@ MonoArray* CMonoDomain::NewElementArray( MonoClass* pMonoClass, CLuaArgumentsVec
{
CElement* pElement = this->m_pResource->GetElementManager()->FindOrCreate( pUserData );
mono_array_set( pArray, MonoObject*, i++, pElement->ToMonoObject() );
mono_array_set( pArray, MonoObject*, i++, pElement->GetMonoObject() );
}
}
}
return pArray;
}
MonoArray* CMonoDomain::NewArray( uint uiLength, const char** szStrings ) const
{
MonoArray* pArray = mono_array_new( this->m_pDomain, mono_get_string_class(), uiLength );
for( uint i = 0; i < uiLength; i++ )
{
const char* szValue = szStrings[ i ];
mono_array_set( pArray, MonoString*, i, this->NewString( szValue ) );
}
return pArray;
}

View File

@ -61,7 +61,8 @@ public:
MonoString* NewString ( const char* szText ) const;
MonoString* NewString ( const string& strText ) const;
MonoArray* NewElementArray ( MonoClass* pMonoClass, CLuaArgumentsVector pLuaArguments );
MonoArray* NewArray ( MonoClass* pMonoClass, CLuaArgumentsVector pLuaArguments ) const;
MonoArray* NewArray ( uint uiLength, const char** szStrings ) const;
template< class T, int iLuaType >
MonoArray* NewArray ( MonoClass* pMonoClass, CLuaArgumentsVector pLuaArguments )
@ -110,8 +111,6 @@ public:
return pArray;
}
inline MonoDomain* GetMonoPtr ( void ) const { return this->m_pDomain; }
inline CMonoInterface* GetMono ( void ) const { return this->m_pMono; }
inline CResource* GetResource ( void ) const { return this->m_pResource; }
@ -119,6 +118,8 @@ public:
inline CMonoMTALib* GetMTALib ( void ) const { return this->m_pMTALib; }
inline string GetName ( void ) const { return this->m_strName; }
inline MonoDomain* operator * ( void ) const { return this->m_pDomain; }
};
#endif

View File

@ -35,9 +35,9 @@ CMonoEvent::~CMonoEvent( void )
this->m_pRaiseMethod = nullptr;
}
bool CMonoEvent::Call( MonoObject* pThis, list< CLuaArgument* > argv )
bool CMonoEvent::Call( CElement* pThis, list< CLuaArgument* > argv )
{
CMonoMethod* pMethod = this->GetRaiseMethod();
const CMonoMethod* pMethod = this->GetRaiseMethod();
if( !pMethod )
{
@ -46,18 +46,18 @@ bool CMonoEvent::Call( MonoObject* pThis, list< CLuaArgument* > argv )
CMonoArguments pArguments;
if( !this->ParseArguments( pArguments, argv ) )
if( !this->ParseArguments( pMethod, pArguments, argv ) )
{
this->m_pResource->ErrorPrintf( "Raise method for event '%s' not found\n", this->GetName().c_str() );
this->m_pResource->ErrorPrintf( "Raise method for event '%s' not found\n", this->m_strName.c_str() );
return false;
}
pMethod->Invoke( pThis, *pArguments, nullptr );
pMethod->Invoke( pThis->GetMonoObject(), *pArguments, nullptr );
const auto& iter = *argv.begin();
if( iter->GetType() == eLuaType::LightUserdata )
if( iter->GetType() == eLuaType::LightUserdata && iter->GetLightUserData() != pThis->GetLuaUserdata() )
{
pMethod->Invoke( pArguments[ 0 ], *pArguments, nullptr );
}
@ -65,20 +65,13 @@ bool CMonoEvent::Call( MonoObject* pThis, list< CLuaArgument* > argv )
return true;
}
bool CMonoEvent::ParseArguments( CMonoArguments& pArguments, list< CLuaArgument* > argv )
bool CMonoEvent::ParseArguments( const CMonoMethod* pMethod, CMonoArguments& pArguments, list< CLuaArgument* > argv )
{
CMonoMTALib* pMTALib = this->m_pClass->GetDomain()->GetMTALib();
CMonoCorlib* pCorlib = this->m_pClass->GetDomain()->GetCorlib();
const auto& pMethods = this->m_pClass->GetMethods( "raise_" + this->GetName() );
for( const auto& pMethod : pMethods )
{
vector< SMonoType > pArgList = pMethod->GetArguments();
if( pArgList.size() != argv.size() )
{
continue;
return false;
}
auto iter = argv.begin();
@ -275,7 +268,13 @@ bool CMonoEvent::ParseArguments( CMonoArguments& pArguments, list< CLuaArgument*
{
CElement* pElement = this->m_pResource->GetElementManager()->FindOrCreate( (*iter)->GetLightUserData() );
pValue = pElement->ToMonoObject();
ASSERT( pElement );
auto typeName = pElement->GetTypeName();
auto className = pElement->GetTypeClassName();
pValue = pElement->GetMonoObject();
}
pArguments.Push( pValue );
@ -286,28 +285,27 @@ bool CMonoEvent::ParseArguments( CMonoArguments& pArguments, list< CLuaArgument*
case MONO_TYPE_U:
default:
{
this->m_pResource->ErrorPrintf( "Unsupported type '%s (0x%i)' for '%s'\n", pType->strName.c_str(), pType->iType, this->GetName().c_str() );
this->m_pResource->ErrorPrintf( "Unsupported type '%s (0x%X)' for '%s'\n", pType->strName.c_str(), pType->iType, this->m_strName.c_str() );
break;
}
}
}
}
return false;
}
CMonoMethod* CMonoEvent::GetAddMethod( void )
CMonoMethod* CMonoEvent::GetAddMethod( void ) const
{
return this->m_pClass->GetMethod( "add_" + this->GetName(), 0 );
return this->m_pClass->GetMethod( "add_" + this->m_strName, 0 );
}
CMonoMethod* CMonoEvent::GetRemoveMethod( void )
CMonoMethod* CMonoEvent::GetRemoveMethod( void ) const
{
return this->m_pClass->GetMethod( "remove_" + this->GetName(), 0 );
return this->m_pClass->GetMethod( "remove_" + this->m_strName, 0 );
}
CMonoMethod* CMonoEvent::GetRaiseMethod( void )
CMonoMethod* CMonoEvent::GetRaiseMethod( void ) const
{
return this->m_pClass->GetMethod( "raise_" + this->GetName(), 0 );
return this->m_pClass->GetMethod( "raise_" + this->m_strName, 0 );
}

View File

@ -19,6 +19,7 @@ class CMonoEvent;
#include "CMonoClass.h"
#include "CMonoMethod.h"
#include "CMonoArguments.h"
#include "CElement.h"
#include "extra/CLuaArgument.h"
@ -39,17 +40,17 @@ public:
CMonoEvent ( CMonoClass* pClass, MonoEvent* pEvent );
~CMonoEvent ( void );
bool Call ( MonoObject* pThis, list< CLuaArgument* > argv );
bool ParseArguments ( CMonoArguments& pArguments, list< CLuaArgument* > argv );
bool Call ( CElement* pThis, list< CLuaArgument* > argv );
bool ParseArguments ( const CMonoMethod* pMethod, CMonoArguments& pArguments, list< CLuaArgument* > argv );
CMonoMethod* GetAddMethod ( void );
CMonoMethod* GetRemoveMethod ( void );
CMonoMethod* GetRaiseMethod ( void );
CMonoMethod* GetAddMethod ( void ) const;
CMonoMethod* GetRemoveMethod ( void ) const;
CMonoMethod* GetRaiseMethod ( void ) const;
CMonoClass* GetClass ( void ) { return this->m_pClass; }
MonoEvent* GetMonoPtr ( void ) { return this->m_pEvent; }
inline CMonoClass* GetClass ( void ) const { return this->m_pClass; }
inline MonoEvent* GetMonoPtr ( void ) const { return this->m_pEvent; }
string GetName ( void ) { return this->m_strName; }
inline const string GetName ( void ) const { return this->m_strName; }
};
#endif

View File

@ -21,6 +21,7 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Console, Write );
MONO_DECLARE( Console, WriteLine );
MONO_DECLARE( Console, Output );
MONO_DECLARE( Config, Get );
MONO_DECLARE( Config, Set );
@ -28,7 +29,7 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Server, GetMaxPlayers );
MONO_DECLARE( Server, SetMaxPlayers );
MONO_DECLARE( Server, OutputChatBox );
MONO_DECLARE( Server, OutputConsole );
// MONO_DECLARE( Server, OutputLog );
MONO_DECLARE( Server, SetPassword );
MONO_DECLARE( Server, GetVersion );
@ -556,22 +557,22 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Account, GetAll );
MONO_DECLARE( Account, GetPlayer );
MONO_DECLARE( Account, IsGuest );
// MONO_DECLARE( Account, GetData );
MONO_DECLARE( Account, GetData );
// MONO_DECLARE( Account, GetAllData );
MONO_DECLARE( Account, GetSerial );
// MONO_DECLARE( Account, GetBySerial );
MONO_DECLARE( Account, GetBySerial );
// Account set funcs
MONO_DECLARE( Account, Add );
MONO_DECLARE( Account, Remove );
MONO_DECLARE( Account, SetPassword );
// MONO_DECLARE( Account, SetData );
MONO_DECLARE( Account, SetData );
MONO_DECLARE( Account, CopyData );
MONO_DECLARE( Ban, Add );
MONO_DECLARE( Ban, Remove );
// MONO_DECLARE( Ban, GetBans );
MONO_DECLARE( Ban, GetAll );
MONO_DECLARE( Ban, Reload );
MONO_DECLARE( Ban, GetIP );
@ -686,15 +687,38 @@ void CMonoFunctions::Console::WriteLine( MonoString* pString )
}
}
MonoString* CMonoFunctions::Config::Get( MonoString *msKey )
bool CMonoFunctions::Console::Output( MonoString* msText, MonoObject* pElementObj )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource )
{
string sValue = CLuaFunctionDefinitions::Get( pResource->GetLua(), mono_string_to_utf8( msKey ) );
const char* szText = mono_string_to_utf8( msText );
return mono_string_new( mono_domain_get(), sValue.c_str() );
PVOID pUserData = nullptr;
if( pElementObj )
{
pUserData = pResource->GetElementManager()->GetFromList( pElementObj )->GetMonoObject();
}
return CLuaFunctionDefinitions::OutputConsole( pResource->GetLua(), szText, pUserData );
}
return false;
}
MonoString* CMonoFunctions::Config::Get( MonoString* msKey )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource )
{
const char* szKey = mono_string_to_utf8( msKey );
string strValue = CLuaFunctionDefinitions::Get( pResource->GetLua(), szKey );
return pResource->GetDomain()->NewString( strValue );
}
return nullptr;
@ -756,34 +780,11 @@ bool CMonoFunctions::Server::OutputChatBox( MonoString* msText, MonoObject* pEle
return false;
}
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" );
unsigned char ucRed = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( mpColor, "R" );
unsigned char ucGreen = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( mpColor, "G" );
unsigned char ucBlue = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( mpColor, "B" );
return CLuaFunctionDefinitions::OutputChatBox( pResource->GetLua(), szText, pElement->ToLuaUserData(), ucRed, ucGreen, ucBlue, bColorCoded );
}
return false;
}
bool CMonoFunctions::Server::OutputConsole( MonoString* msText, MonoObject* pElementObj )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource )
{
const char* szText = mono_string_to_utf8( msText );
CElement* pElement = pResource->GetElementManager()->GetFromList( pElementObj );
if( !pElement )
{
pResource->ErrorPrintf( "Invalid argument #2 in method 'Server::OutputChatBox'\n" );
return false;
}
return CLuaFunctionDefinitions::OutputConsole( pResource->GetLua(), szText, pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::OutputChatBox( pResource->GetLua(), szText, pElement->GetLuaUserdata(), ucRed, ucGreen, ucBlue, bColorCoded );
}
return false;
@ -869,7 +870,7 @@ bool CMonoFunctions::Server::ExecuteCommandHandler( MonoString* msCommand, MonoO
string strArguments = mono_string_to_utf8( msArgs );
return CLuaFunctionDefinitions::ExecuteCommandHandler( pResource->GetLua(), strCommandName.c_str(), pPlayer->ToLuaUserData(), strArguments.c_str() );
return CLuaFunctionDefinitions::ExecuteCommandHandler( pResource->GetLua(), strCommandName.c_str(), pPlayer->GetLuaUserdata(), strArguments.c_str() );
}
return false;

View File

@ -24,9 +24,9 @@ class CMonoFunctions;
#include "CMonoDomain.h"
#include "CMonoClass.h"
#include "CMonoObject.h"
#include "CMonoCorlib.h"
#include "CMonoMTALib.h"
#include "CElementManager.h"
extern CModule* g_pModule;
@ -39,7 +39,7 @@ typedef MonoObject* TElement;
class CMonoFunctions
{
public:
static void AddInternals( void );
static void AddInternals ( void );
class Debug
{
@ -54,6 +54,7 @@ public:
public:
static void Write ( MonoString* pString );
static void WriteLine ( MonoString* pString );
static bool Output ( MonoString* szText, MonoObject* pThis );
};
class Config
@ -68,8 +69,7 @@ public:
public:
static unsigned int GetMaxPlayers ( void );
static bool SetMaxPlayers ( unsigned int uiMax );
static bool OutputChatBox ( MonoString* szText, MonoObject* pThis, MonoObject* pColor, bool bColorCoded );
static bool OutputConsole ( MonoString* szText, MonoObject* pThis );
static bool OutputChatBox ( MonoString* szText, MonoObject* pElement, MonoObject* pColor, bool bColorCoded );
static bool SetPassword ( MonoString* msPassword, bool bSave );
static MonoObject* GetVersion ( void );
@ -696,26 +696,26 @@ public:
static MonoArray* GetAll ( void );
static TElement GetPlayer ( TElement pAccount );
static bool IsGuest ( TElement pAccount );
// static CLuaArgument* GetData ( TElement pAccount, MonoString* szKey );
static MonoObject* GetData ( TElement pAccount, MonoString* szKey );
// static MonoArray* GetAllData ( TElement pAccount );
static MonoString* GetSerial ( TElement pAccount );
// static MonoArray* GetBySerial ( MonoString* msSerial );
static MonoArray* GetBySerial ( MonoString* msSerial );
// Account set funcs
static TElement Add ( MonoString* msName, MonoString* msPassword );
static bool Remove ( TElement pAccount );
static bool SetPassword ( TElement pAccount, MonoString* msPassword );
// static bool SetData ( TElement pAccount, MonoString* msKey, CLuaArgument* pArgument );
static bool SetData ( TElement pAccount, MonoString* msKey, MonoObject* pArgument );
static bool CopyData ( TElement pAccount, TElement pFromAccount );
};
class Ban
{
public:
static TElement Add ( MonoString* msIP, MonoString* msUsername, MonoString* msSerial, TElement pResponsible, MonoString* msResponsible, MonoString* msReason, int iUnban );
static TElement Add ( MonoString* msIP, MonoString* msUsername, MonoString* msSerial, TElement pResponsible, MonoString* msReason, int iUnban );
static bool Remove ( TElement pBan, TElement pResponsible );
// static MonoArray* GetBans ( void );
static MonoArray* GetAll ( void );
static bool Reload ( void );
static MonoString* GetIP ( TElement pBan );

View File

@ -27,7 +27,7 @@ TElement CMonoFunctions::Account::Get( MonoString* msName, MonoString* msPasswor
if( pUserData )
{
return pResource->GetElementManager()->Create( nullptr, pUserData )->ToMonoObject();
return pResource->GetElementManager()->Create( nullptr, pUserData )->GetMonoObject();
}
}
@ -44,7 +44,7 @@ MonoArray* CMonoFunctions::Account::GetAll( void )
if( pLuaTable.size() > 0 )
{
return pResource->GetDomain()->NewElementArray( pResource->GetDomain()->GetMTALib()->GetClass( "Account" )->GetMonoPtr(), pLuaTable );
return pResource->GetDomain()->NewArray( **pResource->GetDomain()->GetMTALib()->GetClass( "Account" ), pLuaTable );
}
}
@ -59,11 +59,11 @@ TElement CMonoFunctions::Account::GetPlayer( TElement pAccount )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
PVOID pUserData = CLuaFunctionDefinitions::GetAccountPlayer( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetAccountPlayer( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->Create( nullptr, pUserData )->ToMonoObject();
return pResource->GetElementManager()->Create( nullptr, pUserData )->GetMonoObject();
}
}
@ -80,7 +80,7 @@ bool CMonoFunctions::Account::IsGuest( TElement pAccount )
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
if( CLuaFunctionDefinitions::IsGuestAccount( pResource->GetLua(), pElement->ToLuaUserData(), bIsGuest ) )
if( CLuaFunctionDefinitions::IsGuestAccount( pResource->GetLua(), pElement->GetLuaUserdata(), bIsGuest ) )
{
return bIsGuest;
}
@ -89,6 +89,55 @@ bool CMonoFunctions::Account::IsGuest( TElement pAccount )
return false;
}
MonoObject* CMonoFunctions::Account::GetData( TElement pAccount, MonoString* msKey )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource )
{
const char* szKey = mono_string_to_utf8( msKey );
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
CLuaArgument pLuaArgument = CLuaFunctionDefinitions::GetAccountData( pResource->GetLua(), pElement->GetLuaUserdata(), szKey );
CMonoCorlib* pCorlib = pResource->GetDomain()->GetCorlib();
eLuaType iLuaType = pLuaArgument.GetType();
switch( iLuaType )
{
case eLuaType::Boolean:
{
bool bValue = pLuaArgument.GetBoolean();
return pCorlib->Class[ "boolean" ]->Box( &bValue );
}
case eLuaType::Number:
{
double dValue = pLuaArgument.GetNumber();
return pCorlib->Class[ "double" ]->Box( &dValue );
}
case eLuaType::String:
{
const char* szString = pLuaArgument.GetString();
return reinterpret_cast< MonoObject* >( pResource->GetDomain()->NewString( szString ) );
}
case eLuaType::Userdata:
case eLuaType::LightUserdata:
{
DWORD pUserData = reinterpret_cast< DWORD >( pLuaArgument.GetLightUserData() );
return pCorlib->Class[ "uint32" ]->Box( &pUserData );
}
}
}
return nullptr;
}
MonoString* CMonoFunctions::Account::GetSerial( TElement pAccount )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
@ -99,7 +148,7 @@ MonoString* CMonoFunctions::Account::GetSerial( TElement pAccount )
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
if( CLuaFunctionDefinitions::GetAccountSerial( pResource->GetLua(), pElement->ToLuaUserData(), strSerial ) )
if( CLuaFunctionDefinitions::GetAccountSerial( pResource->GetLua(), pElement->GetLuaUserdata(), strSerial ) )
{
return pResource->GetDomain()->NewString( strSerial );
}
@ -108,6 +157,25 @@ MonoString* CMonoFunctions::Account::GetSerial( TElement pAccount )
return nullptr;
}
MonoArray* CMonoFunctions::Account::GetBySerial( MonoString* msSerial )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource )
{
const string strSerial = mono_string_to_utf8( msSerial );
CLuaArgumentsVector pLuaTable = CLuaFunctionDefinitions::GetAccountsBySerial( pResource->GetLua(), strSerial );
if( pLuaTable.size() > 0 )
{
return pResource->GetDomain()->NewArray( **pResource->GetDomain()->GetMTALib()->GetClass( "Account" ), pLuaTable );
}
}
return nullptr;
}
// Account set funcs
TElement CMonoFunctions::Account::Add( MonoString* msName, MonoString* msPassword )
{
@ -122,7 +190,7 @@ TElement CMonoFunctions::Account::Add( MonoString* msName, MonoString* msPasswor
if( pUserData )
{
return pResource->GetElementManager()->Create( nullptr, pUserData )->ToMonoObject();
return pResource->GetElementManager()->Create( nullptr, pUserData )->GetMonoObject();
}
}
@ -137,7 +205,7 @@ bool CMonoFunctions::Account::Remove( TElement pAccount )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
return CLuaFunctionDefinitions::RemoveAccount( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::RemoveAccount( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -153,7 +221,37 @@ bool CMonoFunctions::Account::SetPassword( TElement pAccount, MonoString* msPass
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
return CLuaFunctionDefinitions::SetAccountPassword( pResource->GetLua(), pElement->ToLuaUserData(), szPassword );
return CLuaFunctionDefinitions::SetAccountPassword( pResource->GetLua(), pElement->GetLuaUserdata(), szPassword );
}
return false;
}
bool CMonoFunctions::Account::SetData( TElement pAccount, MonoString* msKey, MonoObject* pObject )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
const char* szKey = mono_string_to_utf8( msKey );
CLuaArgument pArgument;
MonoClass* pClass = mono_object_get_class( pObject );
ASSERT( pClass );
MonoType* pType = mono_class_get_type( pClass );
ASSERT( pType );
int iType = mono_type_get_type( pType );
//CMonoObject::GetValue( pObject );
return CLuaFunctionDefinitions::SetAccountData( pResource->GetLua(), pElement->GetLuaUserdata(), szKey, &pArgument );
}
return false;
@ -168,7 +266,7 @@ bool CMonoFunctions::Account::CopyData( TElement pAccount, TElement pFromAccount
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
CElement* pFromElement = pResource->GetElementManager()->GetFromList( pFromAccount );
return CLuaFunctionDefinitions::CopyAccountData( pResource->GetLua(), pElement->ToLuaUserData(), pFromElement->ToLuaUserData() );
return CLuaFunctionDefinitions::CopyAccountData( pResource->GetLua(), pElement->GetLuaUserdata(), pFromElement->GetLuaUserdata() );
}
return false;

View File

@ -22,7 +22,7 @@ bool CMonoFunctions::Audio::PlayFrontEnd( TElement pThis, unsigned char ucSound
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::PlaySoundFrontEnd( pResource->GetLua(), pElement->ToLuaUserData(), ucSound );
return CLuaFunctionDefinitions::PlaySoundFrontEnd( pResource->GetLua(), pElement->GetLuaUserdata(), ucSound );
}
return false;
@ -38,7 +38,7 @@ bool CMonoFunctions::Audio::PlayMission( TElement pThis, MonoObject* pPosition,
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::PlayMissionAudio( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition, usSlot );
return CLuaFunctionDefinitions::PlayMissionAudio( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition, usSlot );
}
return false;

View File

@ -13,7 +13,7 @@
#include "StdInc.h"
#include "CMonoFunctions.h"
TElement CMonoFunctions::Ban::Add( MonoString* msIP, MonoString* msUsername, MonoString* msSerial, TElement pResponsible, MonoString* msResponsible, MonoString* msReason, int iUnban )
TElement CMonoFunctions::Ban::Add( MonoString* msIP, MonoString* msUsername, MonoString* msSerial, TElement pResponsible, MonoString* msReason, int iUnban )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
@ -23,16 +23,15 @@ TElement CMonoFunctions::Ban::Add( MonoString* msIP, MonoString* msUsername, Mon
strIP ( mono_string_to_utf8( msIP ) ),
strUsername ( mono_string_to_utf8( msUsername ) ),
strSerial ( mono_string_to_utf8( msSerial ) ),
strResponsible ( mono_string_to_utf8( msResponsible ) ),
strReason ( mono_string_to_utf8( msReason ) );
CElement* pElement = pResource->GetElementManager()->GetFromList( pResponsible );
PVOID pUserData = CLuaFunctionDefinitions::AddBan( pResource->GetLua(), strIP, strUsername, strSerial, pElement->ToLuaUserData(), strResponsible, strReason, iUnban );
PVOID pUserData = CLuaFunctionDefinitions::AddBan( pResource->GetLua(), strIP, strUsername, strSerial, pElement->GetLuaUserdata(), strReason, iUnban );
if( pUserData )
{
return pResource->GetElementManager()->Create( nullptr, pUserData )->ToMonoObject();
return pResource->GetElementManager()->Create( nullptr, pUserData )->GetMonoObject();
}
}
@ -48,12 +47,28 @@ bool CMonoFunctions::Ban::Remove( TElement pBan, TElement pResponsible )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
CElement* pResponsibleElement = pResource->GetElementManager()->GetFromList( pResponsible );
return CLuaFunctionDefinitions::RemoveBan( pResource->GetLua(), pElement->ToLuaUserData(), pResponsibleElement->ToLuaUserData() );
return CLuaFunctionDefinitions::RemoveBan( pResource->GetLua(), pElement->GetLuaUserdata(), pResponsibleElement->GetLuaUserdata() );
}
return false;
}
MonoArray* CMonoFunctions::Ban::GetAll( void )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource )
{
CLuaArgumentsVector pLuaTable = CLuaFunctionDefinitions::GetBans( pResource->GetLua() );
if( pLuaTable.size() > 0 )
{
return pResource->GetDomain()->NewArray( **pResource->GetDomain()->GetMTALib()->GetClass( "Ban" ), pLuaTable );
}
}
return nullptr;
}
bool CMonoFunctions::Ban::Reload( void )
{
@ -78,7 +93,7 @@ MonoString* CMonoFunctions::Ban::GetIP( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
if( CLuaFunctionDefinitions::GetBanIP( pResource->GetLua(), pElement->ToLuaUserData(), strIP ) )
if( CLuaFunctionDefinitions::GetBanIP( pResource->GetLua(), pElement->GetLuaUserdata(), strIP ) )
{
return pResource->GetDomain()->NewString( strIP );
}
@ -97,7 +112,7 @@ MonoString* CMonoFunctions::Ban::GetSerial( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
if( CLuaFunctionDefinitions::GetBanSerial( pResource->GetLua(), pElement->ToLuaUserData(), strSerial ) )
if( CLuaFunctionDefinitions::GetBanSerial( pResource->GetLua(), pElement->GetLuaUserdata(), strSerial ) )
{
return pResource->GetDomain()->NewString( strSerial );
}
@ -116,7 +131,7 @@ MonoString* CMonoFunctions::Ban::GetUsername( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
if( CLuaFunctionDefinitions::GetBanUsername( pResource->GetLua(), pElement->ToLuaUserData(), strUsername ) )
if( CLuaFunctionDefinitions::GetBanUsername( pResource->GetLua(), pElement->GetLuaUserdata(), strUsername ) )
{
return pResource->GetDomain()->NewString( strUsername );
}
@ -135,7 +150,7 @@ MonoString* CMonoFunctions::Ban::GetNick( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
if( CLuaFunctionDefinitions::GetBanNick( pResource->GetLua(), pElement->ToLuaUserData(), strNick ) )
if( CLuaFunctionDefinitions::GetBanNick( pResource->GetLua(), pElement->GetLuaUserdata(), strNick ) )
{
return pResource->GetDomain()->NewString( strNick );
}
@ -154,7 +169,7 @@ MonoString* CMonoFunctions::Ban::GetReason( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
if( CLuaFunctionDefinitions::GetBanReason( pResource->GetLua(), pElement->ToLuaUserData(), strReason ) )
if( CLuaFunctionDefinitions::GetBanReason( pResource->GetLua(), pElement->GetLuaUserdata(), strReason ) )
{
return pResource->GetDomain()->NewString( strReason );
}
@ -173,7 +188,7 @@ MonoString* CMonoFunctions::Ban::GetAdmin( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
if( CLuaFunctionDefinitions::GetBanAdmin( pResource->GetLua(), pElement->ToLuaUserData(), strAdmin ) )
if( CLuaFunctionDefinitions::GetBanAdmin( pResource->GetLua(), pElement->GetLuaUserdata(), strAdmin ) )
{
return pResource->GetDomain()->NewString( strAdmin );
}
@ -193,7 +208,7 @@ int CMonoFunctions::Ban::GetBanTime( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
if( CLuaFunctionDefinitions::GetBanTime( pResource->GetLua(), pElement->ToLuaUserData(), tTime ) )
if( CLuaFunctionDefinitions::GetBanTime( pResource->GetLua(), pElement->GetLuaUserdata(), tTime ) )
{
return (int)tTime;
}
@ -212,7 +227,7 @@ int CMonoFunctions::Ban::GetUnbanTime( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
if( CLuaFunctionDefinitions::GetUnbanTime( pResource->GetLua(), pElement->ToLuaUserData(), tTime ) )
if( CLuaFunctionDefinitions::GetUnbanTime( pResource->GetLua(), pElement->GetLuaUserdata(), tTime ) )
{
return (int)tTime;
}
@ -230,7 +245,7 @@ bool CMonoFunctions::Ban::SetUnbanTime( TElement pBan, int time )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
return CLuaFunctionDefinitions::SetUnbanTime( pResource->GetLua(), pElement->ToLuaUserData(), time );
return CLuaFunctionDefinitions::SetUnbanTime( pResource->GetLua(), pElement->GetLuaUserdata(), time );
}
return false;
@ -246,7 +261,7 @@ bool CMonoFunctions::Ban::SetReason( TElement pBan, MonoString* msReason )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
return CLuaFunctionDefinitions::SetBanReason( pResource->GetLua(), pElement->ToLuaUserData(), strReason );
return CLuaFunctionDefinitions::SetBanReason( pResource->GetLua(), pElement->GetLuaUserdata(), strReason );
}
return false;
@ -262,7 +277,7 @@ bool CMonoFunctions::Ban::SetAdmin( TElement pBan, MonoString* msAdminName )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
return CLuaFunctionDefinitions::SetBanAdmin( pResource->GetLua(), pElement->ToLuaUserData(), strAdmin );
return CLuaFunctionDefinitions::SetBanAdmin( pResource->GetLua(), pElement->GetLuaUserdata(), strAdmin );
}
return false;

View File

@ -25,7 +25,7 @@ void CMonoFunctions::Blip::Ctor( TElement pThis, MonoObject* pTarget, unsigned c
if( pArgColor )
{
pColor = CMonoObject::GetColor( pArgColor );
pColor = SharedUtil::MonoObject::GetColor( pArgColor );
}
if( pArgVisibleTo )
@ -34,7 +34,7 @@ void CMonoFunctions::Blip::Ctor( TElement pThis, MonoObject* pTarget, unsigned c
if( pVisibleToElement )
{
pVisibleTo = pVisibleToElement->ToLuaUserData();
pVisibleTo = pVisibleToElement->GetLuaUserdata();
}
}
@ -50,7 +50,7 @@ void CMonoFunctions::Blip::Ctor( TElement pThis, MonoObject* pTarget, unsigned c
{
CElement* pTargetElement = pResource->GetElementManager()->GetFromList( pTarget );
pUserData = CLuaFunctionDefinitions::CreateBlipAttachedTo( pResource->GetLua(), pTargetElement->ToLuaUserData(), ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, pVisibleTo );
pUserData = CLuaFunctionDefinitions::CreateBlipAttachedTo( pResource->GetLua(), pTargetElement->GetLuaUserdata(), ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, pVisibleTo );
}
if( pUserData )
@ -71,7 +71,7 @@ unsigned char CMonoFunctions::Blip::GetIcon( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetBlipIcon( pResource->GetLua(), pElement->ToLuaUserData(), ucIcon ) )
if( CLuaFunctionDefinitions::GetBlipIcon( pResource->GetLua(), pElement->GetLuaUserdata(), ucIcon ) )
{
return ucIcon;
}
@ -90,7 +90,7 @@ unsigned char CMonoFunctions::Blip::GetSize( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetBlipSize( pResource->GetLua(), pElement->ToLuaUserData(), ucSize ) )
if( CLuaFunctionDefinitions::GetBlipSize( pResource->GetLua(), pElement->GetLuaUserdata(), ucSize ) )
{
return ucSize;
}
@ -109,7 +109,7 @@ MonoObject* CMonoFunctions::Blip::GetColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetBlipColor( pResource->GetLua(), pElement->ToLuaUserData(), outColor ) )
if( CLuaFunctionDefinitions::GetBlipColor( pResource->GetLua(), pElement->GetLuaUserdata(), outColor ) )
{
return pResource->GetDomain()->GetMTALib()->Color->New( outColor );
}
@ -128,7 +128,7 @@ short CMonoFunctions::Blip::GetOrdering( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetBlipOrdering( pResource->GetLua(), pElement->ToLuaUserData(), sOrdering ) )
if( CLuaFunctionDefinitions::GetBlipOrdering( pResource->GetLua(), pElement->GetLuaUserdata(), sOrdering ) )
{
return sOrdering;
}
@ -147,7 +147,7 @@ unsigned short CMonoFunctions::Blip::GetVisibleDistance( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetBlipVisibleDistance( pResource->GetLua(), pElement->ToLuaUserData(), usVisibleDistance ) )
if( CLuaFunctionDefinitions::GetBlipVisibleDistance( pResource->GetLua(), pElement->GetLuaUserdata(), usVisibleDistance ) )
{
return usVisibleDistance;
}
@ -166,7 +166,7 @@ bool CMonoFunctions::Blip::SetIcon( TElement pThis, unsigned char ucIcon )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetBlipIcon( pResource->GetLua(), pElement->ToLuaUserData(), ucIcon );
return CLuaFunctionDefinitions::SetBlipIcon( pResource->GetLua(), pElement->GetLuaUserdata(), ucIcon );
}
return false;
@ -180,7 +180,7 @@ bool CMonoFunctions::Blip::SetSize( TElement pThis, unsigned char ucSize )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetBlipSize( pResource->GetLua(), pElement->ToLuaUserData(), ucSize );
return CLuaFunctionDefinitions::SetBlipSize( pResource->GetLua(), pElement->GetLuaUserdata(), ucSize );
}
return false;
@ -194,7 +194,7 @@ bool CMonoFunctions::Blip::SetColor( TElement pThis, MonoObject* color )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetBlipColor( pResource->GetLua(), pElement->ToLuaUserData(), CMonoObject::GetColor( color ) );
return CLuaFunctionDefinitions::SetBlipColor( pResource->GetLua(), pElement->GetLuaUserdata(), SharedUtil::MonoObject::GetColor( color ) );
}
return false;
@ -208,7 +208,7 @@ bool CMonoFunctions::Blip::SetOrdering( TElement pThis, short sOrdering )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetBlipOrdering( pResource->GetLua(), pElement->ToLuaUserData(), sOrdering );
return CLuaFunctionDefinitions::SetBlipOrdering( pResource->GetLua(), pElement->GetLuaUserdata(), sOrdering );
}
return false;
@ -222,7 +222,7 @@ bool CMonoFunctions::Blip::SetVisibleDistance( TElement pThis, unsigned short us
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetBlipVisibleDistance( pResource->GetLua(), pElement->ToLuaUserData(), usVisibleDistance );
return CLuaFunctionDefinitions::SetBlipVisibleDistance( pResource->GetLua(), pElement->GetLuaUserdata(), usVisibleDistance );
}
return false;

View File

@ -41,7 +41,7 @@ bool CMonoFunctions::Element::Destroy( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::DestroyElement( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::DestroyElement( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -55,11 +55,11 @@ TElement CMonoFunctions::Element::Clone( TElement pThis, MonoObject* vecPosition
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::CloneElement( pResource->GetLua(), pElement->ToLuaUserData(), Vector3( vecPosition ), bCloneElement );
PVOID pUserData = CLuaFunctionDefinitions::CloneElement( pResource->GetLua(), pElement->GetLuaUserdata(), Vector3( vecPosition ), bCloneElement );
if( pUserData )
{
return pResource->GetElementManager()->Create( nullptr, pUserData )->ToMonoObject();
return pResource->GetElementManager()->Create( nullptr, pUserData )->GetMonoObject();
}
}
@ -78,7 +78,7 @@ TElement CMonoFunctions::Element::GetRootElement( void )
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -97,7 +97,7 @@ MonoArray* CMonoFunctions::Element::GetByType( MonoString* msType, TElement pArg
if( pArgStartElement )
{
pStartElement = pResource->GetElementManager()->GetFromList( pArgStartElement )->ToLuaUserData();
pStartElement = pResource->GetElementManager()->GetFromList( pArgStartElement )->GetLuaUserdata();
}
CLuaArgumentsVector pLuaArguments = CLuaFunctionDefinitions::GetElementsByType( pResource->GetLua(), szType, pStartElement );
@ -118,7 +118,7 @@ MonoArray* CMonoFunctions::Element::GetByType( MonoString* msType, TElement pArg
pElementClass = pResource->GetDomain()->GetMTALib()->GetClass( "Element" );
}
return pResource->GetDomain()->NewElementArray( pElementClass->GetMonoPtr(), pLuaArguments );
return pResource->GetDomain()->NewArray( **pElementClass, pLuaArguments );
}
}
@ -135,7 +135,7 @@ bool CMonoFunctions::Element::IsElement( TElement pThis )
ASSERT( pElement );
return CLuaFunctionDefinitions::IsElement( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::IsElement( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -151,7 +151,7 @@ uint32_t CMonoFunctions::Element::GetUserData( TElement pThis )
if( pElement )
{
return reinterpret_cast< uint32_t >( pElement->ToLuaUserData() );
return reinterpret_cast< uint32_t >( pElement->GetLuaUserdata() );
}
}
@ -166,7 +166,7 @@ MonoString* CMonoFunctions::Element::GetElementType( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
const string strType = CLuaFunctionDefinitions::GetElementType( pResource->GetLua(), pElement->ToLuaUserData() );
const string strType = CLuaFunctionDefinitions::GetElementType( pResource->GetLua(), pElement->GetLuaUserdata() );
return pResource->GetDomain()->NewString( strType );
}
@ -186,7 +186,7 @@ TElement CMonoFunctions::Element::GetByID( MonoString* msID, unsigned int uiInde
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -203,7 +203,7 @@ TElement CMonoFunctions::Element::GetByIndex( int iIndex )
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -218,11 +218,11 @@ TElement CMonoFunctions::Element::GetChild( TElement pThis, int iIndex )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetElementChild( pResource->GetLua(), pElement->ToLuaUserData(), iIndex );
PVOID pUserData = CLuaFunctionDefinitions::GetElementChild( pResource->GetLua(), pElement->GetLuaUserdata(), iIndex );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -237,7 +237,7 @@ int CMonoFunctions::Element::GetChildrenCount( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GetElementChildrenCount( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::GetElementChildrenCount( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return 0;
@ -251,7 +251,7 @@ MonoString* CMonoFunctions::Element::GetID( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
const string strID = CLuaFunctionDefinitions::GetElementID( pResource->GetLua(), pElement->ToLuaUserData() );
const string strID = CLuaFunctionDefinitions::GetElementID( pResource->GetLua(), pElement->GetLuaUserdata() );
return mono_string_new( mono_domain_get(), strID.c_str() );
}
@ -267,11 +267,11 @@ TElement CMonoFunctions::Element::GetParent( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetElementParent( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetElementParent( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -288,7 +288,7 @@ MonoObject* CMonoFunctions::Element::GetPosition( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementPosition( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition ) )
if( CLuaFunctionDefinitions::GetElementPosition( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
}
@ -307,7 +307,7 @@ MonoObject* CMonoFunctions::Element::GetRotation( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementRotation( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition ) )
if( CLuaFunctionDefinitions::GetElementRotation( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
}
@ -326,7 +326,7 @@ MonoObject* CMonoFunctions::Element::GetVelocity( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementVelocity( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition ) )
if( CLuaFunctionDefinitions::GetElementVelocity( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
}
@ -345,7 +345,7 @@ unsigned char CMonoFunctions::Element::GetInterior( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementInterior( pResource->GetLua(), pElement->ToLuaUserData(), ucInterior ) )
if( CLuaFunctionDefinitions::GetElementInterior( pResource->GetLua(), pElement->GetLuaUserdata(), ucInterior ) )
{
return ucInterior;
}
@ -364,7 +364,7 @@ bool CMonoFunctions::Element::IsWithinColShape( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsElementWithinColShape( pResource->GetLua(), pElement->ToLuaUserData(), bWithin ) )
if( CLuaFunctionDefinitions::IsElementWithinColShape( pResource->GetLua(), pElement->GetLuaUserdata(), bWithin ) )
{
return bWithin;
}
@ -383,7 +383,7 @@ bool CMonoFunctions::Element::IsWithinMarker( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsElementWithinMarker( pResource->GetLua(), pElement->ToLuaUserData(), bWithin ) )
if( CLuaFunctionDefinitions::IsElementWithinMarker( pResource->GetLua(), pElement->GetLuaUserdata(), bWithin ) )
{
return bWithin;
}
@ -402,7 +402,7 @@ unsigned short CMonoFunctions::Element::GetDimension( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementDimension( pResource->GetLua(), pElement->ToLuaUserData(), usDimension ) )
if( CLuaFunctionDefinitions::GetElementDimension( pResource->GetLua(), pElement->GetLuaUserdata(), usDimension ) )
{
return usDimension;
}
@ -421,7 +421,7 @@ MonoString* CMonoFunctions::Element::GetZoneName( TElement pThis, bool bCitiesOn
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementZoneName( pResource->GetLua(), pElement->ToLuaUserData(), strOutName, bCitiesOnly ) )
if( CLuaFunctionDefinitions::GetElementZoneName( pResource->GetLua(), pElement->GetLuaUserdata(), strOutName, bCitiesOnly ) )
{
return pResource->GetDomain()->NewString( strOutName );
}
@ -438,7 +438,7 @@ bool CMonoFunctions::Element::IsAttached( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::IsElementAttached( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::IsElementAttached( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -452,11 +452,11 @@ TElement CMonoFunctions::Element::GetAttachedTo( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetElementAttachedTo( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetElementAttachedTo( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -471,11 +471,11 @@ TElement CMonoFunctions::Element::GetColShape( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetElementColShape( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetElementColShape( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -492,7 +492,7 @@ unsigned char CMonoFunctions::Element::GetAlpha( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementAlpha( pResource->GetLua(), pElement->ToLuaUserData(), ucAlpha ) )
if( CLuaFunctionDefinitions::GetElementAlpha( pResource->GetLua(), pElement->GetLuaUserdata(), ucAlpha ) )
{
return ucAlpha;
}
@ -511,7 +511,7 @@ bool CMonoFunctions::Element::IsDoubleSided( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsElementDoubleSided( pResource->GetLua(), pElement->ToLuaUserData(), bDoubleSided ) )
if( CLuaFunctionDefinitions::IsElementDoubleSided( pResource->GetLua(), pElement->GetLuaUserdata(), bDoubleSided ) )
{
return bDoubleSided;
}
@ -530,7 +530,7 @@ float CMonoFunctions::Element::GetHealth( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementHealth( pResource->GetLua(), pElement->ToLuaUserData(), fHealth ) )
if( CLuaFunctionDefinitions::GetElementHealth( pResource->GetLua(), pElement->GetLuaUserdata(), fHealth ) )
{
return fHealth;
}
@ -549,7 +549,7 @@ unsigned short CMonoFunctions::Element::GetModel( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementModel( pResource->GetLua(), pElement->ToLuaUserData(), usModel ) )
if( CLuaFunctionDefinitions::GetElementModel( pResource->GetLua(), pElement->GetLuaUserdata(), usModel ) )
{
return usModel;
}
@ -568,7 +568,7 @@ bool CMonoFunctions::Element::IsInWater( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsElementInWater( pResource->GetLua(), pElement->ToLuaUserData(), bInWater ) )
if( CLuaFunctionDefinitions::IsElementInWater( pResource->GetLua(), pElement->GetLuaUserdata(), bInWater ) )
{
return bInWater;
}
@ -587,7 +587,7 @@ MonoObject* CMonoFunctions::Element::GetAttachedOffsetPosition( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementAttachedOffsets( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition, vecRotation ) )
if( CLuaFunctionDefinitions::GetElementAttachedOffsets( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition, vecRotation ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
}
@ -606,7 +606,7 @@ MonoObject* CMonoFunctions::Element::GetAttachedOffsetRotation( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementAttachedOffsets( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition, vecRotation ) )
if( CLuaFunctionDefinitions::GetElementAttachedOffsets( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition, vecRotation ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecRotation );
}
@ -623,11 +623,11 @@ TElement CMonoFunctions::Element::GetSyncer( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetElementSyncer( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetElementSyncer( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -642,7 +642,7 @@ bool CMonoFunctions::Element::GetCollisionsEnabled( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GetElementCollisionsEnabled( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::GetElementCollisionsEnabled( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -658,7 +658,7 @@ bool CMonoFunctions::Element::IsFrozen( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsElementFrozen( pResource->GetLua(), pElement->ToLuaUserData(), bFrozen ) )
if( CLuaFunctionDefinitions::IsElementFrozen( pResource->GetLua(), pElement->GetLuaUserdata(), bFrozen ) )
{
return bFrozen;
}
@ -677,11 +677,11 @@ TElement CMonoFunctions::Element::GetLowLod( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetLowLodElement( pResource->GetLua(), pElement->ToLuaUserData(), pLODUserData ) )
if( CLuaFunctionDefinitions::GetLowLodElement( pResource->GetLua(), pElement->GetLuaUserdata(), pLODUserData ) )
{
if( pLODUserData )
{
return pResource->GetElementManager()->FindOrCreate( pLODUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pLODUserData )->GetMonoObject();
}
}
}
@ -699,7 +699,7 @@ bool CMonoFunctions::Element::IsLowLod( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsElementLowLod( pResource->GetLua(), pElement->ToLuaUserData(), bIsLowLod ) )
if( CLuaFunctionDefinitions::IsElementLowLod( pResource->GetLua(), pElement->GetLuaUserdata(), bIsLowLod ) )
{
return bIsLowLod;
}
@ -718,7 +718,7 @@ bool CMonoFunctions::Element::ClearVisibleTo( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ClearElementVisibleTo( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::ClearElementVisibleTo( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -732,7 +732,7 @@ bool CMonoFunctions::Element::SetID( TElement pThis, MonoString* msID )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementID( pResource->GetLua(), pElement->ToLuaUserData(), mono_string_to_utf8( msID ) );
return CLuaFunctionDefinitions::SetElementID( pResource->GetLua(), pElement->GetLuaUserdata(), mono_string_to_utf8( msID ) );
}
return false;
@ -748,7 +748,7 @@ bool CMonoFunctions::Element::SetData( TElement pThis, MonoString* msKey, CLuaAr
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementData( pResource->GetLua(), pElement->ToLuaUserData(), strKey, Variable );
return CLuaFunctionDefinitions::SetElementData( pResource->GetLua(), pElement->GetLuaUserdata(), strKey, Variable );
}
return false;
@ -764,7 +764,7 @@ bool CMonoFunctions::Element::RemoveData( TElement pThis, MonoString* msKey )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveElementData( pResource->GetLua(), pElement->ToLuaUserData(), strKey );
return CLuaFunctionDefinitions::RemoveElementData( pResource->GetLua(), pElement->GetLuaUserdata(), strKey );
}
return false;
@ -779,7 +779,7 @@ bool CMonoFunctions::Element::SetParent( TElement pThis, TElement pTarget )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementTarget = pResource->GetElementManager()->GetFromList( pTarget );
return CLuaFunctionDefinitions::SetElementParent( pResource->GetLua(), pElement->ToLuaUserData(), pElementTarget->ToLuaUserData() );
return CLuaFunctionDefinitions::SetElementParent( pResource->GetLua(), pElement->GetLuaUserdata(), pElementTarget->GetLuaUserdata() );
}
return false;
@ -793,7 +793,7 @@ bool CMonoFunctions::Element::SetPosition( TElement pThis, MonoObject* pPosition
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementPosition( pResource->GetLua(), pElement->ToLuaUserData(), Vector3( pPosition ), bWarp );
return CLuaFunctionDefinitions::SetElementPosition( pResource->GetLua(), pElement->GetLuaUserdata(), Vector3( pPosition ), bWarp );
}
return false;
@ -809,7 +809,7 @@ bool CMonoFunctions::Element::SetRotation( TElement pThis, MonoObject* pRotation
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementRotation( pResource->GetLua(), pElement->ToLuaUserData(), Vector3( pRotation ), szRotationOrder, bNewWay );
return CLuaFunctionDefinitions::SetElementRotation( pResource->GetLua(), pElement->GetLuaUserdata(), Vector3( pRotation ), szRotationOrder, bNewWay );
}
return false;
@ -823,7 +823,7 @@ bool CMonoFunctions::Element::SetVelocity( TElement pThis, MonoObject* pVelocity
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementVelocity( pResource->GetLua(), pElement->ToLuaUserData(), Vector3( pVelocity ) );
return CLuaFunctionDefinitions::SetElementVelocity( pResource->GetLua(), pElement->GetLuaUserdata(), Vector3( pVelocity ) );
}
return false;
@ -838,7 +838,7 @@ bool CMonoFunctions::Element::SetVisibleTo( TElement pThis, TElement pTarget, bo
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementTarget = pResource->GetElementManager()->GetFromList( pTarget );
return CLuaFunctionDefinitions::SetElementVisibleTo( pResource->GetLua(), pElement->ToLuaUserData(), pElementTarget->ToLuaUserData(), bVisible );
return CLuaFunctionDefinitions::SetElementVisibleTo( pResource->GetLua(), pElement->GetLuaUserdata(), pElementTarget->GetLuaUserdata(), bVisible );
}
return false;
@ -852,7 +852,7 @@ bool CMonoFunctions::Element::SetInterior( TElement pThis, int iInterior )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementInterior( pResource->GetLua(), pElement->ToLuaUserData(), iInterior );
return CLuaFunctionDefinitions::SetElementInterior( pResource->GetLua(), pElement->GetLuaUserdata(), iInterior );
}
return false;
@ -866,7 +866,7 @@ bool CMonoFunctions::Element::SetDimension( TElement pThis, int iDimension )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementDimension( pResource->GetLua(), pElement->ToLuaUserData(), iDimension );
return CLuaFunctionDefinitions::SetElementDimension( pResource->GetLua(), pElement->GetLuaUserdata(), iDimension );
}
return false;
@ -885,7 +885,7 @@ bool CMonoFunctions::Element::Attach( TElement pThis, TElement pTarget, MonoObje
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementTarget = pResource->GetElementManager()->GetFromList( pTarget );
return CLuaFunctionDefinitions::AttachElements( pResource->GetLua(), pElement->ToLuaUserData(), pElementTarget->ToLuaUserData(), vecPosition, vecRotation );
return CLuaFunctionDefinitions::AttachElements( pResource->GetLua(), pElement->GetLuaUserdata(), pElementTarget->GetLuaUserdata(), vecPosition, vecRotation );
}
return false;
@ -900,7 +900,7 @@ bool CMonoFunctions::Element::Detach( TElement pThis, TElement pTarget )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementTarget = pResource->GetElementManager()->GetFromList( pTarget );
return CLuaFunctionDefinitions::DetachElements( pResource->GetLua(), pElement->ToLuaUserData(), pElementTarget->ToLuaUserData() );
return CLuaFunctionDefinitions::DetachElements( pResource->GetLua(), pElement->GetLuaUserdata(), pElementTarget->GetLuaUserdata() );
}
return false;
@ -914,7 +914,7 @@ bool CMonoFunctions::Element::SetAlpha( TElement pThis, int iAlpha )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementAlpha( pResource->GetLua(), pElement->ToLuaUserData(), iAlpha );
return CLuaFunctionDefinitions::SetElementAlpha( pResource->GetLua(), pElement->GetLuaUserdata(), iAlpha );
}
return false;
@ -928,7 +928,7 @@ bool CMonoFunctions::Element::SetDoubleSided( TElement pThis, bool bDoubleSided
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementDoubleSided( pResource->GetLua(), pElement->ToLuaUserData(), bDoubleSided );
return CLuaFunctionDefinitions::SetElementDoubleSided( pResource->GetLua(), pElement->GetLuaUserdata(), bDoubleSided );
}
return false;
@ -942,7 +942,7 @@ bool CMonoFunctions::Element::SetHealth( TElement pThis, float fHealth )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementHealth( pResource->GetLua(), pElement->ToLuaUserData(), fHealth );
return CLuaFunctionDefinitions::SetElementHealth( pResource->GetLua(), pElement->GetLuaUserdata(), fHealth );
}
return false;
@ -956,7 +956,7 @@ bool CMonoFunctions::Element::SetModel( TElement pThis, int iModel )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementModel( pResource->GetLua(), pElement->ToLuaUserData(), iModel );
return CLuaFunctionDefinitions::SetElementModel( pResource->GetLua(), pElement->GetLuaUserdata(), iModel );
}
return false;
@ -974,7 +974,7 @@ bool CMonoFunctions::Element::SetAttachedOffsets( TElement pThis, MonoObject* pM
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementAttachedOffsets( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition, vecRotation );
return CLuaFunctionDefinitions::SetElementAttachedOffsets( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition, vecRotation );
}
return false;
@ -989,7 +989,7 @@ bool CMonoFunctions::Element::SetSyncer( TElement pThis, TElement pPlayer )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementPlayer = pResource->GetElementManager()->GetFromList( pPlayer );
return CLuaFunctionDefinitions::SetElementSyncer( pResource->GetLua(), pElement->ToLuaUserData(), pElementPlayer->ToLuaUserData() );
return CLuaFunctionDefinitions::SetElementSyncer( pResource->GetLua(), pElement->GetLuaUserdata(), pElementPlayer->GetLuaUserdata() );
}
return false;
@ -1003,7 +1003,7 @@ bool CMonoFunctions::Element::SetCollisionsEnabled( TElement pThis, bool bEnable
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementCollisionsEnabled( pResource->GetLua(), pElement->ToLuaUserData(), bEnabled );
return CLuaFunctionDefinitions::SetElementCollisionsEnabled( pResource->GetLua(), pElement->GetLuaUserdata(), bEnabled );
}
return false;
@ -1017,7 +1017,7 @@ bool CMonoFunctions::Element::SetFrozen( TElement pThis, bool bFrozen )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementFrozen( pResource->GetLua(), pElement->ToLuaUserData(), bFrozen );
return CLuaFunctionDefinitions::SetElementFrozen( pResource->GetLua(), pElement->GetLuaUserdata(), bFrozen );
}
return false;
@ -1031,7 +1031,7 @@ bool CMonoFunctions::Element::SetLowLod( TElement pThis, bool bEnabled )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetLowLodElement( pResource->GetLua(), pElement->ToLuaUserData(), bEnabled );
return CLuaFunctionDefinitions::SetLowLodElement( pResource->GetLua(), pElement->GetLuaUserdata(), bEnabled );
}
return false;

View File

@ -118,7 +118,7 @@ bool CMonoFunctions::Event::Trigger( MonoString* msName, TElement pArgElement, M
CElement* pElement = pResource->GetElementManager()->GetFromList( pArgElement );
return CLuaFunctionDefinitions::TriggerEvent( pResource->GetLua(), szEventName, pElement->ToLuaUserData(), Arguments );
return CLuaFunctionDefinitions::TriggerEvent( pResource->GetLua(), szEventName, pElement->GetLuaUserdata(), Arguments );
}
return false;
@ -175,7 +175,7 @@ bool CMonoFunctions::Event::TriggerClient( TElement pSendTo, MonoString* msName,
CLuaArguments Arguments = CMonoInterface::MonoArrayToLuaArguments( mpArguments, pResource );
return CLuaFunctionDefinitions::TriggerClientEvent( pResource->GetLua(), pSendToElement->ToLuaUserData(), szEventName, pSourceElement->ToLuaUserData(), Arguments );
return CLuaFunctionDefinitions::TriggerClientEvent( pResource->GetLua(), pSendToElement->GetLuaUserdata(), szEventName, pSourceElement->GetLuaUserdata(), Arguments );
}
return false;

View File

@ -14,15 +14,20 @@
#include "CMonoFunctions.h"
// Explosion funcs
bool CMonoFunctions::Explosion::Create( MonoObject* pPosition, unsigned char ucType, TElement pCreator )
bool CMonoFunctions::Explosion::Create( MonoObject* pPosition, unsigned char ucType, TElement pArgCreator )
{
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pCreator );
PVOID pCreator = nullptr;
return CLuaFunctionDefinitions::CreateExplosion( pResource->GetLua(), Vector3( pPosition ), ucType, pElement->ToLuaUserData() );
if( pArgCreator )
{
pCreator = pResource->GetElementManager()->GetFromList( pArgCreator )->GetLuaUserdata();
}
return CLuaFunctionDefinitions::CreateExplosion( pResource->GetLua(), Vector3( pPosition ), ucType, pArgCreator );
}
return false;

View File

@ -26,10 +26,10 @@ void CMonoFunctions::Marker::Ctor( TElement pThis, MonoObject* pPosition, MonoSt
if( pArgVisibleTo )
{
pVisibleTo = pResource->GetElementManager()->GetFromList( pArgVisibleTo )->ToLuaUserData();
pVisibleTo = pResource->GetElementManager()->GetFromList( pArgVisibleTo )->GetLuaUserdata();
}
PVOID pUserData = CLuaFunctionDefinitions::CreateMarker( pResource->GetLua(), Vector3( pPosition ), szType, fSize, CMonoObject::GetColor( pColor ), pVisibleTo );
PVOID pUserData = CLuaFunctionDefinitions::CreateMarker( pResource->GetLua(), Vector3( pPosition ), szType, fSize, SharedUtil::MonoObject::GetColor( pColor ), pVisibleTo );
ASSERT( pUserData );
@ -66,7 +66,7 @@ MonoString* CMonoFunctions::Marker::GetMarkerType( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetMarkerType( pResource->GetLua(), pElement->ToLuaUserData(), szType ) )
if( CLuaFunctionDefinitions::GetMarkerType( pResource->GetLua(), pElement->GetLuaUserdata(), szType ) )
{
return pResource->GetDomain()->NewString( szType );
}
@ -85,7 +85,7 @@ float CMonoFunctions::Marker::GetSize( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetMarkerSize( pResource->GetLua(), pElement->ToLuaUserData(), fSize ) )
if( CLuaFunctionDefinitions::GetMarkerSize( pResource->GetLua(), pElement->GetLuaUserdata(), fSize ) )
{
return fSize;
}
@ -104,7 +104,7 @@ MonoObject* CMonoFunctions::Marker::GetColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetMarkerColor( pResource->GetLua(), pElement->ToLuaUserData(), outColor ) )
if( CLuaFunctionDefinitions::GetMarkerColor( pResource->GetLua(), pElement->GetLuaUserdata(), outColor ) )
{
return pResource->GetDomain()->GetMTALib()->Color->New( outColor );
}
@ -123,7 +123,7 @@ MonoObject* CMonoFunctions::Marker::GetTarget( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetMarkerTarget( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition ) )
if( CLuaFunctionDefinitions::GetMarkerTarget( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
}
@ -142,7 +142,7 @@ MonoString* CMonoFunctions::Marker::GetIcon( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetMarkerIcon( pResource->GetLua(), pElement->ToLuaUserData(), szIcon ) )
if( CLuaFunctionDefinitions::GetMarkerIcon( pResource->GetLua(), pElement->GetLuaUserdata(), szIcon ) )
{
return pResource->GetDomain()->NewString( szIcon );
}
@ -163,7 +163,7 @@ bool CMonoFunctions::Marker::SetType( TElement pThis, MonoString* msType )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetMarkerType( pResource->GetLua(), pElement->ToLuaUserData(), szType );
return CLuaFunctionDefinitions::SetMarkerType( pResource->GetLua(), pElement->GetLuaUserdata(), szType );
}
return false;
@ -177,7 +177,7 @@ bool CMonoFunctions::Marker::SetSize( TElement pThis, float fSize )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetMarkerSize( pResource->GetLua(), pElement->ToLuaUserData(), fSize );
return CLuaFunctionDefinitions::SetMarkerSize( pResource->GetLua(), pElement->GetLuaUserdata(), fSize );
}
return false;
@ -191,7 +191,7 @@ bool CMonoFunctions::Marker::SetColor( TElement pThis, MonoObject* pColor )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetMarkerColor( pResource->GetLua(), pElement->ToLuaUserData(), CMonoObject::GetColor( pColor ) );
return CLuaFunctionDefinitions::SetMarkerColor( pResource->GetLua(), pElement->GetLuaUserdata(), SharedUtil::MonoObject::GetColor( pColor ) );
}
return false;
@ -205,7 +205,7 @@ bool CMonoFunctions::Marker::SetTarget( TElement pThis, MonoObject* pTarget )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetMarkerTarget( pResource->GetLua(), pElement->ToLuaUserData(), Vector3( pTarget ) );
return CLuaFunctionDefinitions::SetMarkerTarget( pResource->GetLua(), pElement->GetLuaUserdata(), Vector3( pTarget ) );
}
return false;
@ -221,7 +221,7 @@ bool CMonoFunctions::Marker::SetIcon( TElement pThis, MonoString* msIcon )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetMarkerType( pResource->GetLua(), pElement->ToLuaUserData(), szIcon );
return CLuaFunctionDefinitions::SetMarkerType( pResource->GetLua(), pElement->GetLuaUserdata(), szIcon );
}
return false;

View File

@ -43,7 +43,7 @@ MonoObject* CMonoFunctions::Object::GetScale( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetObjectScale( pResource->GetLua(), pElement->ToLuaUserData(), vecScale ) )
if( CLuaFunctionDefinitions::GetObjectScale( pResource->GetLua(), pElement->GetLuaUserdata(), vecScale ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecScale );
}
@ -62,7 +62,7 @@ bool CMonoFunctions::Object::SetScale( TElement pThis, MonoObject* pScale )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetObjectScale( pResource->GetLua(), pElement->ToLuaUserData(), Vector3( pScale ) );
return CLuaFunctionDefinitions::SetObjectScale( pResource->GetLua(), pElement->GetLuaUserdata(), Vector3( pScale ) );
}
return false;
@ -82,7 +82,7 @@ bool CMonoFunctions::Object::Move( TElement pThis, unsigned long ulTime, MonoObj
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::MoveObject( pResource->GetLua(), pElement->ToLuaUserData(), ulTime, vecPosition, vecRotation, szEasingType, fEasingPeriod, fEasingAmplitude, fEasingOvershoot );
return CLuaFunctionDefinitions::MoveObject( pResource->GetLua(), pElement->GetLuaUserdata(), ulTime, vecPosition, vecRotation, szEasingType, fEasingPeriod, fEasingAmplitude, fEasingOvershoot );
}
return false;
@ -96,7 +96,7 @@ bool CMonoFunctions::Object::Stop( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::StopObject( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::StopObject( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;

View File

@ -40,7 +40,7 @@ float CMonoFunctions::Ped::GetArmor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedArmor( pResource->GetLua(), pElement->ToLuaUserData(), fArmor ) )
if( CLuaFunctionDefinitions::GetPedArmor( pResource->GetLua(), pElement->GetLuaUserdata(), fArmor ) )
{
return fArmor;
}
@ -59,7 +59,7 @@ bool CMonoFunctions::Ped::IsChoking( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedChoking( pResource->GetLua(), pElement->ToLuaUserData(), bChoking ) )
if( CLuaFunctionDefinitions::IsPedChoking( pResource->GetLua(), pElement->GetLuaUserdata(), bChoking ) )
{
return bChoking;
}
@ -78,7 +78,7 @@ bool CMonoFunctions::Ped::IsDead( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedDead( pResource->GetLua(), pElement->ToLuaUserData(), bDead ) )
if( CLuaFunctionDefinitions::IsPedDead( pResource->GetLua(), pElement->GetLuaUserdata(), bDead ) )
{
return bDead;
}
@ -97,7 +97,7 @@ bool CMonoFunctions::Ped::IsDucked( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedDucked( pResource->GetLua(), pElement->ToLuaUserData(), bDucked ) )
if( CLuaFunctionDefinitions::IsPedDucked( pResource->GetLua(), pElement->GetLuaUserdata(), bDucked ) )
{
return bDucked;
}
@ -116,7 +116,7 @@ float CMonoFunctions::Ped::GetStat( TElement pThis, unsigned short usStat )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedStat( pResource->GetLua(), pElement->ToLuaUserData(), usStat, fStat ) )
if( CLuaFunctionDefinitions::GetPedStat( pResource->GetLua(), pElement->GetLuaUserdata(), usStat, fStat ) )
{
return fStat;
}
@ -133,11 +133,11 @@ TElement CMonoFunctions::Ped::GetTarget( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetPedTarget( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetPedTarget( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -152,7 +152,7 @@ int CMonoFunctions::Ped::GetWeapon( TElement pThis, int iWeaponSlot )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GetPedWeapon( pResource->GetLua(), pElement->ToLuaUserData(), iWeaponSlot );
return CLuaFunctionDefinitions::GetPedWeapon( pResource->GetLua(), pElement->GetLuaUserdata(), iWeaponSlot );
}
return 0;
@ -168,7 +168,7 @@ MonoString* CMonoFunctions::Ped::GetClothesTexture( TElement pThis, unsigned cha
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedClothes( pResource->GetLua(), pElement->ToLuaUserData(), ucType, strOutTexture, strOutModel ) )
if( CLuaFunctionDefinitions::GetPedClothes( pResource->GetLua(), pElement->GetLuaUserdata(), ucType, strOutTexture, strOutModel ) )
{
return pResource->GetDomain()->NewString( strOutTexture );
}
@ -187,7 +187,7 @@ MonoString* CMonoFunctions::Ped::GetClothesModel( TElement pThis, unsigned char
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedClothes( pResource->GetLua(), pElement->ToLuaUserData(), ucType, strOutTexture, strOutModel ) )
if( CLuaFunctionDefinitions::GetPedClothes( pResource->GetLua(), pElement->GetLuaUserdata(), ucType, strOutTexture, strOutModel ) )
{
return pResource->GetDomain()->NewString( strOutModel );
}
@ -206,7 +206,7 @@ bool CMonoFunctions::Ped::DoesHaveJetPack( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::DoesPedHaveJetPack( pResource->GetLua(), pElement->ToLuaUserData(), bHasJetPack ) )
if( CLuaFunctionDefinitions::DoesPedHaveJetPack( pResource->GetLua(), pElement->GetLuaUserdata(), bHasJetPack ) )
{
return bHasJetPack;
}
@ -225,7 +225,7 @@ bool CMonoFunctions::Ped::IsOnGround( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedOnGround( pResource->GetLua(), pElement->ToLuaUserData(), bOnGround ) )
if( CLuaFunctionDefinitions::IsPedOnGround( pResource->GetLua(), pElement->GetLuaUserdata(), bOnGround ) )
{
return bOnGround;
}
@ -244,7 +244,7 @@ unsigned char CMonoFunctions::Ped::GetFightingStyle( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedFightingStyle( pResource->GetLua(), pElement->ToLuaUserData(), ucStyle ) )
if( CLuaFunctionDefinitions::GetPedFightingStyle( pResource->GetLua(), pElement->GetLuaUserdata(), ucStyle ) )
{
return ucStyle;
}
@ -263,7 +263,7 @@ unsigned int CMonoFunctions::Ped::GetMoveAnim( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedMoveAnim( pResource->GetLua(), pElement->ToLuaUserData(), uiMoveAnim ) )
if( CLuaFunctionDefinitions::GetPedMoveAnim( pResource->GetLua(), pElement->GetLuaUserdata(), uiMoveAnim ) )
{
return uiMoveAnim;
}
@ -282,7 +282,7 @@ float CMonoFunctions::Ped::GetGravity( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedGravity( pResource->GetLua(), pElement->ToLuaUserData(), fGravity ) )
if( CLuaFunctionDefinitions::GetPedGravity( pResource->GetLua(), pElement->GetLuaUserdata(), fGravity ) )
{
return fGravity;
}
@ -299,11 +299,11 @@ TElement CMonoFunctions::Ped::GetContactElement( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetPedContactElement( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetPedContactElement( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -320,7 +320,7 @@ unsigned char CMonoFunctions::Ped::GetWeaponSlot( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedWeaponSlot( pResource->GetLua(), pElement->ToLuaUserData(), ucWeaponSlot ) )
if( CLuaFunctionDefinitions::GetPedWeaponSlot( pResource->GetLua(), pElement->GetLuaUserdata(), ucWeaponSlot ) )
{
return ucWeaponSlot;
}
@ -339,7 +339,7 @@ bool CMonoFunctions::Ped::IsDoingGangDriveby( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedDoingGangDriveby( pResource->GetLua(), pElement->ToLuaUserData(), bDoingGangDriveby ) )
if( CLuaFunctionDefinitions::IsPedDoingGangDriveby( pResource->GetLua(), pElement->GetLuaUserdata(), bDoingGangDriveby ) )
{
return bDoingGangDriveby;
}
@ -358,7 +358,7 @@ bool CMonoFunctions::Ped::IsOnFire( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedOnFire( pResource->GetLua(), pElement->ToLuaUserData(), bOnFire ) )
if( CLuaFunctionDefinitions::IsPedOnFire( pResource->GetLua(), pElement->GetLuaUserdata(), bOnFire ) )
{
return bOnFire;
}
@ -377,7 +377,7 @@ bool CMonoFunctions::Ped::IsHeadless( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedHeadless( pResource->GetLua(), pElement->ToLuaUserData(), bHeadless ) )
if( CLuaFunctionDefinitions::IsPedHeadless( pResource->GetLua(), pElement->GetLuaUserdata(), bHeadless ) )
{
return bHeadless;
}
@ -396,7 +396,7 @@ bool CMonoFunctions::Ped::IsFrozen( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedFrozen( pResource->GetLua(), pElement->ToLuaUserData(), bFrozen ) )
if( CLuaFunctionDefinitions::IsPedFrozen( pResource->GetLua(), pElement->GetLuaUserdata(), bFrozen ) )
{
return bFrozen;
}
@ -413,11 +413,11 @@ TElement CMonoFunctions::Ped::GetOccupiedVehicle( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetPedOccupiedVehicle( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetPedOccupiedVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -434,7 +434,7 @@ unsigned int CMonoFunctions::Ped::GetOccupiedVehicleSeat( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedOccupiedVehicleSeat( pResource->GetLua(), pElement->ToLuaUserData(), uiSeat ) )
if( CLuaFunctionDefinitions::GetPedOccupiedVehicleSeat( pResource->GetLua(), pElement->GetLuaUserdata(), uiSeat ) )
{
return uiSeat;
}
@ -453,7 +453,7 @@ bool CMonoFunctions::Ped::IsInVehicle( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPedInVehicle( pResource->GetLua(), pElement->ToLuaUserData(), bInVehicle ) )
if( CLuaFunctionDefinitions::IsPedInVehicle( pResource->GetLua(), pElement->GetLuaUserdata(), bInVehicle ) )
{
return bInVehicle;
}
@ -512,7 +512,7 @@ bool CMonoFunctions::Ped::SetArmor( TElement pThis, float fArmor )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedArmor( pResource->GetLua(), pElement->ToLuaUserData(), fArmor );
return CLuaFunctionDefinitions::SetPedArmor( pResource->GetLua(), pElement->GetLuaUserdata(), fArmor );
}
return false;
@ -527,7 +527,7 @@ bool CMonoFunctions::Ped::Kill( TElement pThis, TElement pKiller, unsigned char
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pKillerElement = pResource->GetElementManager()->GetFromList( pKiller );
return CLuaFunctionDefinitions::KillPed( pResource->GetLua(), pElement->ToLuaUserData(), pKillerElement->ToLuaUserData(), ucKillerWeapon, ucBodyPart, bStealth );
return CLuaFunctionDefinitions::KillPed( pResource->GetLua(), pElement->GetLuaUserdata(), pKillerElement->GetLuaUserdata(), ucKillerWeapon, ucBodyPart, bStealth );
}
return false;
@ -541,7 +541,7 @@ bool CMonoFunctions::Ped::SetStat( TElement pThis, unsigned short usStat, float
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedStat( pResource->GetLua(), pElement->ToLuaUserData(), usStat, fValue );
return CLuaFunctionDefinitions::SetPedStat( pResource->GetLua(), pElement->GetLuaUserdata(), usStat, fValue );
}
return false;
@ -558,7 +558,7 @@ bool CMonoFunctions::Ped::AddClothes( TElement pThis, MonoString* msTexture, Mon
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::AddPedClothes( pResource->GetLua(), pElement->ToLuaUserData(), szTexture, szModel, ucType );
return CLuaFunctionDefinitions::AddPedClothes( pResource->GetLua(), pElement->GetLuaUserdata(), szTexture, szModel, ucType );
}
return false;
@ -575,7 +575,7 @@ bool CMonoFunctions::Ped::RemoveClothes( TElement pThis, unsigned char ucType, M
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemovePedClothes( pResource->GetLua(), pElement->ToLuaUserData(), ucType, szTexture, szModel );
return CLuaFunctionDefinitions::RemovePedClothes( pResource->GetLua(), pElement->GetLuaUserdata(), ucType, szTexture, szModel );
}
return false;
@ -589,7 +589,7 @@ bool CMonoFunctions::Ped::GiveJetPack( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GivePedJetPack( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::GivePedJetPack( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -603,7 +603,7 @@ bool CMonoFunctions::Ped::RemoveJetPack( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemovePedJetPack( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::RemovePedJetPack( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -617,7 +617,7 @@ bool CMonoFunctions::Ped::SetFightingStyle( TElement pThis, unsigned char ucStyl
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedFightingStyle( pResource->GetLua(), pElement->ToLuaUserData(), ucStyle );
return CLuaFunctionDefinitions::SetPedFightingStyle( pResource->GetLua(), pElement->GetLuaUserdata(), ucStyle );
}
return false;
@ -631,7 +631,7 @@ bool CMonoFunctions::Ped::SetMoveAnim( TElement pThis, unsigned int iMoveAnim )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedMoveAnim( pResource->GetLua(), pElement->ToLuaUserData(), iMoveAnim );
return CLuaFunctionDefinitions::SetPedMoveAnim( pResource->GetLua(), pElement->GetLuaUserdata(), iMoveAnim );
}
return false;
@ -645,7 +645,7 @@ bool CMonoFunctions::Ped::SetGravity( TElement pThis, float fGravity )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedGravity( pResource->GetLua(), pElement->ToLuaUserData(), fGravity );
return CLuaFunctionDefinitions::SetPedGravity( pResource->GetLua(), pElement->GetLuaUserdata(), fGravity );
}
return false;
@ -659,7 +659,7 @@ bool CMonoFunctions::Ped::SetChoking( TElement pThis, bool bChoking )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedChoking( pResource->GetLua(), pElement->ToLuaUserData(), bChoking );
return CLuaFunctionDefinitions::SetPedChoking( pResource->GetLua(), pElement->GetLuaUserdata(), bChoking );
}
return false;
@ -673,7 +673,7 @@ bool CMonoFunctions::Ped::SetWeaponSlot( TElement pThis, unsigned char ucWeaponS
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedWeaponSlot( pResource->GetLua(), pElement->ToLuaUserData(), ucWeaponSlot );
return CLuaFunctionDefinitions::SetPedWeaponSlot( pResource->GetLua(), pElement->GetLuaUserdata(), ucWeaponSlot );
}
return false;
@ -688,7 +688,7 @@ bool CMonoFunctions::Ped::WarpIntoVehicle( TElement pThis, TElement pVehicle, un
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pVehicleElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::WarpPedIntoVehicle( pResource->GetLua(), pElement->ToLuaUserData(), pVehicleElement->ToLuaUserData(), uiSeat );
return CLuaFunctionDefinitions::WarpPedIntoVehicle( pResource->GetLua(), pElement->GetLuaUserdata(), pVehicleElement->GetLuaUserdata(), uiSeat );
}
return false;
@ -702,7 +702,7 @@ bool CMonoFunctions::Ped::RemoveFromVehicle( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemovePedFromVehicle( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::RemovePedFromVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -716,7 +716,7 @@ bool CMonoFunctions::Ped::SetDoingGangDriveby( TElement pThis, bool bGangDriveby
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedDoingGangDriveby( pResource->GetLua(), pElement->ToLuaUserData(), bGangDriveby );
return CLuaFunctionDefinitions::SetPedDoingGangDriveby( pResource->GetLua(), pElement->GetLuaUserdata(), bGangDriveby );
}
return false;
@ -733,7 +733,7 @@ bool CMonoFunctions::Ped::SetAnimation( TElement pThis, MonoString* msBlockName,
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedAnimation( pResource->GetLua(), pElement->ToLuaUserData(), szBlockName, szAnimName, iTime, bLoop, bUpdatePosition, bInterruptable, bFreezeLastFrame );
return CLuaFunctionDefinitions::SetPedAnimation( pResource->GetLua(), pElement->GetLuaUserdata(), szBlockName, szAnimName, iTime, bLoop, bUpdatePosition, bInterruptable, bFreezeLastFrame );
}
return false;
@ -749,7 +749,7 @@ bool CMonoFunctions::Ped::SetAnimationProgress( TElement pThis, MonoString* msAn
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedAnimationProgress( pResource->GetLua(), pElement->ToLuaUserData(), szAnimName, fProgress );
return CLuaFunctionDefinitions::SetPedAnimationProgress( pResource->GetLua(), pElement->GetLuaUserdata(), szAnimName, fProgress );
}
return false;
@ -763,7 +763,7 @@ bool CMonoFunctions::Ped::SetOnFire( TElement pThis, bool bIsOnFire )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedOnFire( pResource->GetLua(), pElement->ToLuaUserData(), bIsOnFire );
return CLuaFunctionDefinitions::SetPedOnFire( pResource->GetLua(), pElement->GetLuaUserdata(), bIsOnFire );
}
return false;
@ -777,7 +777,7 @@ bool CMonoFunctions::Ped::SetHeadless( TElement pThis, bool bIsHeadless )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedHeadless( pResource->GetLua(), pElement->ToLuaUserData(), bIsHeadless );
return CLuaFunctionDefinitions::SetPedHeadless( pResource->GetLua(), pElement->GetLuaUserdata(), bIsHeadless );
}
return false;
@ -791,7 +791,7 @@ bool CMonoFunctions::Ped::SetFrozen( TElement pThis, bool bIsFrozen )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedFrozen( pResource->GetLua(), pElement->ToLuaUserData(), bIsFrozen );
return CLuaFunctionDefinitions::SetPedFrozen( pResource->GetLua(), pElement->GetLuaUserdata(), bIsFrozen );
}
return false;
@ -805,7 +805,7 @@ bool CMonoFunctions::Ped::ReloadWeapon( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ReloadPedWeapon( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::ReloadPedWeapon( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -856,7 +856,7 @@ MonoArray* CMonoFunctions::Ped::GetClothesByTypeIndex( unsigned char ucType, uns
if( CLuaFunctionDefinitions::GetClothesByTypeIndex( pResource->GetLua(), ucType, ucIndex, szTexture, szModel ) )
{
MonoArray* pArray = mono_array_new( pResource->GetDomain()->GetMonoPtr(), mono_get_string_class(), 2 );
MonoArray* pArray = mono_array_new( **pResource->GetDomain(), mono_get_string_class(), 2 );
if( pArray )
{
@ -884,7 +884,7 @@ MonoArray* CMonoFunctions::Ped::GetTypeIndexFromClothes( MonoString* msTexture,
if( CLuaFunctionDefinitions::GetTypeIndexFromClothes( pResource->GetLua(), szTexture, szModel, ucType, ucIndex ) )
{
MonoArray* pArray = mono_array_new( pResource->GetDomain()->GetMonoPtr(), mono_get_char_class(), 2 );
MonoArray* pArray = mono_array_new( **pResource->GetDomain(), mono_get_char_class(), 2 );
if( pArray )
{
@ -926,7 +926,7 @@ bool CMonoFunctions::Ped::GiveWeapon( TElement pThis, unsigned char ucWeaponID,
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GiveWeapon( pResource->GetLua(), pElement->ToLuaUserData(), ucWeaponID, usAmmo, bSetAsCurrent );
return CLuaFunctionDefinitions::GiveWeapon( pResource->GetLua(), pElement->GetLuaUserdata(), ucWeaponID, usAmmo, bSetAsCurrent );
}
return false;
@ -940,7 +940,7 @@ bool CMonoFunctions::Ped::TakeWeapon( TElement pThis, unsigned char ucWeaponID,
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::TakeWeapon( pResource->GetLua(), pElement->ToLuaUserData(), ucWeaponID, usAmmo );
return CLuaFunctionDefinitions::TakeWeapon( pResource->GetLua(), pElement->GetLuaUserdata(), ucWeaponID, usAmmo );
}
return false;
@ -954,7 +954,7 @@ bool CMonoFunctions::Ped::TakeAllWeapons( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::TakeAllWeapons( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::TakeAllWeapons( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -968,7 +968,7 @@ bool CMonoFunctions::Ped::SetWeaponAmmo( TElement pThis, unsigned char ucWeaponI
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetWeaponAmmo( pResource->GetLua(), pElement->ToLuaUserData(), ucWeaponID, usAmmo, usAmmoInClip );
return CLuaFunctionDefinitions::SetWeaponAmmo( pResource->GetLua(), pElement->GetLuaUserdata(), ucWeaponID, usAmmo, usAmmoInClip );
}
return false;

View File

@ -42,7 +42,7 @@ unsigned char CMonoFunctions::Pickup::GetPickupType( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPickupType( pResource->GetLua(), pElement->ToLuaUserData(), ucType ) )
if( CLuaFunctionDefinitions::GetPickupType( pResource->GetLua(), pElement->GetLuaUserdata(), ucType ) )
{
return ucType;
}
@ -61,7 +61,7 @@ unsigned char CMonoFunctions::Pickup::GetWeapon( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPickupWeapon( pResource->GetLua(), pElement->ToLuaUserData(), ucWeapon ) )
if( CLuaFunctionDefinitions::GetPickupWeapon( pResource->GetLua(), pElement->GetLuaUserdata(), ucWeapon ) )
{
return ucWeapon;
}
@ -80,7 +80,7 @@ float CMonoFunctions::Pickup::GetAmount( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPickupAmount( pResource->GetLua(), pElement->ToLuaUserData(), fAmount ) )
if( CLuaFunctionDefinitions::GetPickupAmount( pResource->GetLua(), pElement->GetLuaUserdata(), fAmount ) )
{
return fAmount;
}
@ -99,7 +99,7 @@ unsigned short CMonoFunctions::Pickup::GetAmmo( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPickupAmmo( pResource->GetLua(), pElement->ToLuaUserData(), usAmmo ) )
if( CLuaFunctionDefinitions::GetPickupAmmo( pResource->GetLua(), pElement->GetLuaUserdata(), usAmmo ) )
{
return usAmmo;
}
@ -118,7 +118,7 @@ unsigned long CMonoFunctions::Pickup::GetRespawnInterval( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPickupRespawnInterval( pResource->GetLua(), pElement->ToLuaUserData(), ulInterval ) )
if( CLuaFunctionDefinitions::GetPickupRespawnInterval( pResource->GetLua(), pElement->GetLuaUserdata(), ulInterval ) )
{
return ulInterval;
}
@ -137,7 +137,7 @@ bool CMonoFunctions::Pickup::IsSpawned( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPickupSpawned( pResource->GetLua(), pElement->ToLuaUserData(), bSpawned ) )
if( CLuaFunctionDefinitions::IsPickupSpawned( pResource->GetLua(), pElement->GetLuaUserdata(), bSpawned ) )
{
return bSpawned;
}
@ -156,7 +156,7 @@ bool CMonoFunctions::Pickup::SetType( TElement pThis, unsigned char ucType, doub
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPickupType( pResource->GetLua(), pElement->ToLuaUserData(), ucType, dThree, dFour );
return CLuaFunctionDefinitions::SetPickupType( pResource->GetLua(), pElement->GetLuaUserdata(), ucType, dThree, dFour );
}
return false;
@ -170,7 +170,7 @@ bool CMonoFunctions::Pickup::SetRespawnInterval( TElement pThis, unsigned long u
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPickupRespawnInterval( pResource->GetLua(), pElement->ToLuaUserData(), ulInterval );
return CLuaFunctionDefinitions::SetPickupRespawnInterval( pResource->GetLua(), pElement->GetLuaUserdata(), ulInterval );
}
return false;
@ -185,7 +185,7 @@ bool CMonoFunctions::Pickup::Use( TElement pThis, TElement pPlayer )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pPlayerElement = pResource->GetElementManager()->GetFromList( pPlayer );
return CLuaFunctionDefinitions::UsePickup( pResource->GetLua(), pElement->ToLuaUserData(), pPlayerElement->ToLuaUserData() );
return CLuaFunctionDefinitions::UsePickup( pResource->GetLua(), pElement->GetLuaUserdata(), pPlayerElement->GetLuaUserdata() );
}
return false;

View File

@ -38,7 +38,7 @@ TElement CMonoFunctions::Player::GetFromName( MonoString* msNick )
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -55,7 +55,7 @@ unsigned int CMonoFunctions::Player::GetPing( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerPing( pResource->GetLua(), pElement->ToLuaUserData(), uiPing ) )
if( CLuaFunctionDefinitions::GetPlayerPing( pResource->GetLua(), pElement->GetLuaUserdata(), uiPing ) )
{
return uiPing;
}
@ -74,7 +74,7 @@ long CMonoFunctions::Player::GetMoney( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerMoney( pResource->GetLua(), pElement->ToLuaUserData(), lMoney ) )
if( CLuaFunctionDefinitions::GetPlayerMoney( pResource->GetLua(), pElement->GetLuaUserdata(), lMoney ) )
{
return lMoney;
}
@ -93,7 +93,7 @@ TElement CMonoFunctions::Player::GetRandom( void )
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -110,7 +110,7 @@ bool CMonoFunctions::Player::IsMuted( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPlayerMuted( pResource->GetLua(), pElement->ToLuaUserData(), bMuted ) )
if( CLuaFunctionDefinitions::IsPlayerMuted( pResource->GetLua(), pElement->GetLuaUserdata(), bMuted ) )
{
return bMuted;
}
@ -127,11 +127,11 @@ TElement CMonoFunctions::Player::GetTeam( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetPlayerTeam( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetPlayerTeam( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -148,7 +148,7 @@ unsigned int CMonoFunctions::Player::GetWantedLevel( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerWantedLevel( pResource->GetLua(), pElement->ToLuaUserData(), uiWantedLevel ) )
if( CLuaFunctionDefinitions::GetPlayerWantedLevel( pResource->GetLua(), pElement->GetLuaUserdata(), uiWantedLevel ) )
{
return uiWantedLevel;
}
@ -167,7 +167,7 @@ MonoArray* CMonoFunctions::Player::GetAlivePlayers( void )
if( pLuaArguments.size() > 0 )
{
return pResource->GetDomain()->NewElementArray( mono_get_uint32_class(), pLuaArguments );
return pResource->GetDomain()->NewArray( mono_get_uint32_class(), pLuaArguments );
}
}
@ -184,7 +184,7 @@ MonoArray* CMonoFunctions::Player::GetDeadPlayers( void )
if( pLuaArguments.size() > 0 )
{
return pResource->GetDomain()->NewElementArray( pResource->GetDomain()->GetMTALib()->GetClass( "Player" )->GetMonoPtr(), pLuaArguments );
return pResource->GetDomain()->NewArray( **pResource->GetDomain()->GetMTALib()->GetClass( "Player" ), pLuaArguments );
}
}
@ -201,7 +201,7 @@ unsigned int CMonoFunctions::Player::GetIdleTime( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerIdleTime( pResource->GetLua(), pElement->ToLuaUserData(), uiIdleTime ) )
if( CLuaFunctionDefinitions::GetPlayerIdleTime( pResource->GetLua(), pElement->GetLuaUserdata(), uiIdleTime ) )
{
return uiIdleTime;
}
@ -220,7 +220,7 @@ bool CMonoFunctions::Player::IsMapForced( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPlayerMapForced( pResource->GetLua(), pElement->ToLuaUserData(), bForced ) )
if( CLuaFunctionDefinitions::IsPlayerMapForced( pResource->GetLua(), pElement->GetLuaUserdata(), bForced ) )
{
return bForced;
}
@ -239,7 +239,7 @@ MonoString* CMonoFunctions::Player::GetNametagText( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerNametagText( pResource->GetLua(), pElement->ToLuaUserData(), strOutText ) )
if( CLuaFunctionDefinitions::GetPlayerNametagText( pResource->GetLua(), pElement->GetLuaUserdata(), strOutText ) )
{
return pResource->GetDomain()->NewString( strOutText );
}
@ -258,7 +258,7 @@ MonoObject* CMonoFunctions::Player::GetNametagColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerNametagColor( pResource->GetLua(), pElement->ToLuaUserData(), ucR, ucG, ucB ) )
if( CLuaFunctionDefinitions::GetPlayerNametagColor( pResource->GetLua(), pElement->GetLuaUserdata(), ucR, ucG, ucB ) )
{
PVOID args[] =
{
@ -282,7 +282,7 @@ bool CMonoFunctions::Player::IsNametagShowing( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPlayerNametagShowing( pResource->GetLua(), pElement->ToLuaUserData(), bShowing ) )
if( CLuaFunctionDefinitions::IsPlayerNametagShowing( pResource->GetLua(), pElement->GetLuaUserdata(), bShowing ) )
{
return bShowing;
}
@ -299,7 +299,7 @@ MonoString* CMonoFunctions::Player::GetSerial( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return pResource->GetDomain()->NewString( CLuaFunctionDefinitions::GetPlayerSerial( pResource->GetLua(), pElement->ToLuaUserData() ) );
return pResource->GetDomain()->NewString( CLuaFunctionDefinitions::GetPlayerSerial( pResource->GetLua(), pElement->GetLuaUserdata() ) );
}
return nullptr;
@ -313,7 +313,7 @@ MonoString* CMonoFunctions::Player::GetUserName( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return pResource->GetDomain()->NewString( CLuaFunctionDefinitions::GetPlayerUserName( pResource->GetLua(), pElement->ToLuaUserData() ) );
return pResource->GetDomain()->NewString( CLuaFunctionDefinitions::GetPlayerUserName( pResource->GetLua(), pElement->GetLuaUserdata() ) );
}
return nullptr;
@ -329,7 +329,7 @@ unsigned char CMonoFunctions::Player::GetBlurLevel( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerBlurLevel( pResource->GetLua(), pElement->ToLuaUserData(), ucBlurLevel ) )
if( CLuaFunctionDefinitions::GetPlayerBlurLevel( pResource->GetLua(), pElement->GetLuaUserdata(), ucBlurLevel ) )
{
return ucBlurLevel;
}
@ -348,7 +348,7 @@ MonoString* CMonoFunctions::Player::GetName( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerName( pResource->GetLua(), pElement->ToLuaUserData(), strOutName ) )
if( CLuaFunctionDefinitions::GetPlayerName( pResource->GetLua(), pElement->GetLuaUserdata(), strOutName ) )
{
return pResource->GetDomain()->NewString( strOutName );
}
@ -367,7 +367,7 @@ MonoString* CMonoFunctions::Player::GetIP( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerIP( pResource->GetLua(), pElement->ToLuaUserData(), strIP ) )
if( CLuaFunctionDefinitions::GetPlayerIP( pResource->GetLua(), pElement->GetLuaUserdata(), strIP ) )
{
return pResource->GetDomain()->NewString( strIP );
}
@ -384,11 +384,11 @@ TElement CMonoFunctions::Player::GetAccount( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetPlayerAccount( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetPlayerAccount( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -403,7 +403,7 @@ MonoString* CMonoFunctions::Player::GetVersion( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return pResource->GetDomain()->NewString( CLuaFunctionDefinitions::GetPlayerVersion( pResource->GetLua(), pElement->ToLuaUserData() ) );
return pResource->GetDomain()->NewString( CLuaFunctionDefinitions::GetPlayerVersion( pResource->GetLua(), pElement->GetLuaUserdata() ) );
}
return nullptr;
@ -417,17 +417,17 @@ MonoObject* CMonoFunctions::Player::GetACInfo( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CLuaArgumentsMap* pLuaTable = CLuaFunctionDefinitions::GetPlayerACInfo( pResource->GetLua(), pElement->ToLuaUserData() );
CLuaArgumentsMap pLuaTable = CLuaFunctionDefinitions::GetPlayerACInfo( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pLuaTable )
if( pLuaTable.size() > 0 )
{
MonoString* msDetectedAC = pResource->GetDomain()->NewString( (*pLuaTable)[ "DetectedAC" ].GetString() );
MonoString* msD3D9MD5 = pResource->GetDomain()->NewString( (*pLuaTable)[ "d3d9MD5" ].GetString() );
MonoString* msD3D9SHA256 = pResource->GetDomain()->NewString( (*pLuaTable)[ "d3d9SHA256" ].GetString() );
MonoString* msDetectedAC = pResource->GetDomain()->NewString( pLuaTable[ "DetectedAC" ].GetString() );
MonoString* msD3D9MD5 = pResource->GetDomain()->NewString( pLuaTable[ "d3d9MD5" ].GetString() );
MonoString* msD3D9SHA256 = pResource->GetDomain()->NewString( pLuaTable[ "d3d9SHA256" ].GetString() );
unsigned int iD3D9Size = (*pLuaTable)[ "d3d9Size" ].GetNumber< unsigned int >();
unsigned int iD3D9Size = pLuaTable[ "d3d9Size" ].GetNumber< unsigned int >();
void *args[] =
PVOID args[] =
{
&msDetectedAC,
&iD3D9Size,
@ -467,7 +467,7 @@ bool CMonoFunctions::Player::SetMoney( TElement pThis, int iAmount, bool bInstan
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerMoney( pResource->GetLua(), pElement->ToLuaUserData(), iAmount, bInstant );
return CLuaFunctionDefinitions::SetPlayerMoney( pResource->GetLua(), pElement->GetLuaUserdata(), iAmount, bInstant );
}
return false;
@ -481,7 +481,7 @@ bool CMonoFunctions::Player::GiveMoney( TElement pThis, int iAmount )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GivePlayerMoney( pResource->GetLua(), pElement->ToLuaUserData(), iAmount );
return CLuaFunctionDefinitions::GivePlayerMoney( pResource->GetLua(), pElement->GetLuaUserdata(), iAmount );
}
return false;
@ -495,7 +495,7 @@ bool CMonoFunctions::Player::TakeMoney( TElement pThis, int iAmount )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::TakePlayerMoney( pResource->GetLua(), pElement->ToLuaUserData(), iAmount );
return CLuaFunctionDefinitions::TakePlayerMoney( pResource->GetLua(), pElement->GetLuaUserdata(), iAmount );
}
return false;
@ -511,7 +511,7 @@ bool CMonoFunctions::Player::Spawn( TElement pThis, MonoObject* pPosition, int i
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SpawnPlayer( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition, iRotation, iSkinID, iInterior, iDimension, (void*)pTeam );
return CLuaFunctionDefinitions::SpawnPlayer( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition, iRotation, iSkinID, iInterior, iDimension, (void*)pTeam );
}
return false;
@ -527,7 +527,7 @@ bool CMonoFunctions::Player::ShowHudComponent( TElement pThis, MonoString* msCom
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ShowPlayerHudComponent( pResource->GetLua(), pElement->ToLuaUserData(), strComponent, bShow );
return CLuaFunctionDefinitions::ShowPlayerHudComponent( pResource->GetLua(), pElement->GetLuaUserdata(), strComponent, bShow );
}
return false;
@ -541,7 +541,7 @@ bool CMonoFunctions::Player::SetWantedLevel( TElement pThis, int iLevel )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerWantedLevel( pResource->GetLua(), pElement->ToLuaUserData(), iLevel );
return CLuaFunctionDefinitions::SetPlayerWantedLevel( pResource->GetLua(), pElement->GetLuaUserdata(), iLevel );
}
return false;
@ -555,7 +555,7 @@ bool CMonoFunctions::Player::ForceMap( TElement pThis, bool bForceOn )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ForcePlayerMap( pResource->GetLua(), pElement->ToLuaUserData(), bForceOn );
return CLuaFunctionDefinitions::ForcePlayerMap( pResource->GetLua(), pElement->GetLuaUserdata(), bForceOn );
}
return false;
@ -569,7 +569,7 @@ bool CMonoFunctions::Player::SetNametagText( TElement pThis, MonoString* sText )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerNametagText( pResource->GetLua(), pElement->ToLuaUserData(), mono_string_to_utf8( sText ) );
return CLuaFunctionDefinitions::SetPlayerNametagText( pResource->GetLua(), pElement->GetLuaUserdata(), mono_string_to_utf8( sText ) );
}
return false;
@ -583,7 +583,7 @@ bool CMonoFunctions::Player::SetNametagColor( TElement pThis, int iRed, int iGre
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerNametagColor( pResource->GetLua(), pElement->ToLuaUserData(), iRed, iGreen, iBlue );
return CLuaFunctionDefinitions::SetPlayerNametagColor( pResource->GetLua(), pElement->GetLuaUserdata(), iRed, iGreen, iBlue );
}
return false;
@ -597,7 +597,7 @@ bool CMonoFunctions::Player::SetNametagShowing( TElement pThis, bool bShowing )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerNametagShowing( pResource->GetLua(), pElement->ToLuaUserData(), bShowing );
return CLuaFunctionDefinitions::SetPlayerNametagShowing( pResource->GetLua(), pElement->GetLuaUserdata(), bShowing );
}
return false;
@ -611,7 +611,7 @@ bool CMonoFunctions::Player::SetMuted( TElement pThis, bool bMuted )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerMuted( pResource->GetLua(), pElement->ToLuaUserData(), bMuted );
return CLuaFunctionDefinitions::SetPlayerMuted( pResource->GetLua(), pElement->GetLuaUserdata(), bMuted );
}
return false;
@ -625,7 +625,7 @@ bool CMonoFunctions::Player::SetBlurLevel( TElement pThis, int iLevel )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerBlurLevel( pResource->GetLua(), pElement->ToLuaUserData(), iLevel );
return CLuaFunctionDefinitions::SetPlayerBlurLevel( pResource->GetLua(), pElement->GetLuaUserdata(), iLevel );
}
return false;
@ -642,7 +642,7 @@ bool CMonoFunctions::Player::Redirect( TElement pThis, MonoString* sServerIP, in
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RedirectPlayer( pResource->GetLua(), pElement->ToLuaUserData(), szServerIP, iServerPort, szServerPassword );
return CLuaFunctionDefinitions::RedirectPlayer( pResource->GetLua(), pElement->GetLuaUserdata(), szServerIP, iServerPort, szServerPassword );
}
return false;
@ -658,7 +658,7 @@ bool CMonoFunctions::Player::SetName( TElement pThis, MonoString* sName )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerName( pResource->GetLua(), pElement->ToLuaUserData(), szName );
return CLuaFunctionDefinitions::SetPlayerName( pResource->GetLua(), pElement->GetLuaUserdata(), szName );
}
return false;
@ -672,7 +672,7 @@ bool CMonoFunctions::Player::DetonateSatchels( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::DetonateSatchels( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::DetonateSatchels( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -688,7 +688,7 @@ bool CMonoFunctions::Player::TakeScreenShot( TElement pThis, int iWidth, int iHe
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::TakePlayerScreenShot( pResource->GetLua(), pElement->ToLuaUserData(), iWidth, iHeight, strTag, iQuality, iMaxBandwith );
return CLuaFunctionDefinitions::TakePlayerScreenShot( pResource->GetLua(), pElement->GetLuaUserdata(), iWidth, iHeight, strTag, iQuality, iMaxBandwith );
}
return false;
@ -703,7 +703,7 @@ bool CMonoFunctions::Player::SetTeam( TElement pThis, TElement pTeam )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pTeaElement = pResource->GetElementManager()->GetFromList( pTeam );
return CLuaFunctionDefinitions::SetPlayerTeam( pResource->GetLua(), pElement->ToLuaUserData(), pTeaElement->ToLuaUserData() );
return CLuaFunctionDefinitions::SetPlayerTeam( pResource->GetLua(), pElement->GetLuaUserdata(), pTeaElement->GetLuaUserdata() );
}
return false;
@ -741,7 +741,7 @@ bool CMonoFunctions::Player::BindKey( TElement pThis, MonoString* msKey, MonoStr
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::BindKey( pResource->GetLua(), pElement->ToLuaUserData(), szKey, szHitState, szCommandName, szArguments );
return CLuaFunctionDefinitions::BindKey( pResource->GetLua(), pElement->GetLuaUserdata(), szKey, szHitState, szCommandName, szArguments );
}
return false;
@ -759,7 +759,7 @@ bool CMonoFunctions::Player::UnbindKey( TElement pThis, MonoString* msKey, MonoS
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::UnbindKey( pResource->GetLua(), pElement->ToLuaUserData(), szKey, szHitState, szCommandName );
return CLuaFunctionDefinitions::UnbindKey( pResource->GetLua(), pElement->GetLuaUserdata(), szKey, szHitState, szCommandName );
}
return false;
@ -777,7 +777,7 @@ bool CMonoFunctions::Player::GetControlState( TElement pThis, MonoString* msCont
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetControlState( pResource->GetLua(), pElement->ToLuaUserData(), szControl, bState ) )
if( CLuaFunctionDefinitions::GetControlState( pResource->GetLua(), pElement->GetLuaUserdata(), szControl, bState ) )
{
return bState;
}
@ -798,7 +798,7 @@ bool CMonoFunctions::Player::IsControlEnabled( TElement pThis, MonoString* msCon
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsControlEnabled( pResource->GetLua(), pElement->ToLuaUserData(), szControl, bEnabled ) )
if( CLuaFunctionDefinitions::IsControlEnabled( pResource->GetLua(), pElement->GetLuaUserdata(), szControl, bEnabled ) )
{
return bEnabled;
}
@ -818,7 +818,7 @@ bool CMonoFunctions::Player::SetControlState( TElement pThis, MonoString* msCont
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetControlState( pResource->GetLua(), pElement->ToLuaUserData(), szControl, bState );
return CLuaFunctionDefinitions::SetControlState( pResource->GetLua(), pElement->GetLuaUserdata(), szControl, bState );
}
return false;
@ -834,7 +834,7 @@ bool CMonoFunctions::Player::ToggleControl( TElement pThis, MonoString* msContro
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ToggleControl( pResource->GetLua(), pElement->ToLuaUserData(), szControl, bEnabled );
return CLuaFunctionDefinitions::ToggleControl( pResource->GetLua(), pElement->GetLuaUserdata(), szControl, bEnabled );
}
return false;
@ -848,7 +848,7 @@ bool CMonoFunctions::Player::ToggleAllControls( TElement pThis, bool bGTAControl
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ToggleAllControls( pResource->GetLua(), pElement->ToLuaUserData(), bGTAControls, bMTAControls, bEnabled );
return CLuaFunctionDefinitions::ToggleAllControls( pResource->GetLua(), pElement->GetLuaUserdata(), bGTAControls, bMTAControls, bEnabled );
}
return false;
@ -865,7 +865,7 @@ bool CMonoFunctions::Player::LogIn( TElement pThis, TElement pAccount, MonoStrin
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pAccountElement = pResource->GetElementManager()->GetFromList( pAccount );
return CLuaFunctionDefinitions::LogIn( pResource->GetLua(), pElement->ToLuaUserData(), pAccountElement->ToLuaUserData(), mono_string_to_utf8( msPassword ) );
return CLuaFunctionDefinitions::LogIn( pResource->GetLua(), pElement->GetLuaUserdata(), pAccountElement->GetLuaUserdata(), mono_string_to_utf8( msPassword ) );
}
return false;
@ -879,7 +879,7 @@ bool CMonoFunctions::Player::LogOut( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::LogOut( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::LogOut( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -899,7 +899,7 @@ bool CMonoFunctions::Player::Kick( TElement pThis, MonoString* msResponsible, Mo
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::KickPlayer( pResource->GetLua(), pElement->ToLuaUserData(), strResponsible, strReason );
return CLuaFunctionDefinitions::KickPlayer( pResource->GetLua(), pElement->GetLuaUserdata(), strResponsible, strReason );
}
return false;
@ -921,14 +921,14 @@ TElement CMonoFunctions::Player::Ban( TElement pThis, bool bIP, bool bUsername,
if( pArgResponsible )
{
pResponsible = pResource->GetElementManager()->GetFromList( pArgResponsible )->ToLuaUserData();
pResponsible = pResource->GetElementManager()->GetFromList( pArgResponsible )->GetLuaUserdata();
}
PVOID pUserData = CLuaFunctionDefinitions::BanPlayer( pResource->GetLua(), pElement->ToLuaUserData(), bIP, bUsername, bSerial, pResponsible, strResponsible, strReason, iUnban );
PVOID pUserData = CLuaFunctionDefinitions::BanPlayer( pResource->GetLua(), pElement->GetLuaUserdata(), bIP, bUsername, bSerial, pResponsible, strResponsible, strReason, iUnban );
if( pUserData )
{
return pResource->GetElementManager()->Create( nullptr, pUserData )->ToMonoObject();
return pResource->GetElementManager()->Create( nullptr, pUserData )->GetMonoObject();
}
}
@ -947,7 +947,7 @@ bool CMonoFunctions::Player::IsCursorShowing( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsCursorShowing( pResource->GetLua(), pElement->ToLuaUserData(), bShowing ) )
if( CLuaFunctionDefinitions::IsCursorShowing( pResource->GetLua(), pElement->GetLuaUserdata(), bShowing ) )
{
return bShowing;
}
@ -966,7 +966,7 @@ bool CMonoFunctions::Player::ShowCursor( TElement pThis, bool bShow, bool bToggl
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ShowCursor( pResource->GetLua(), pElement->ToLuaUserData(), bShow, bToggleControls );
return CLuaFunctionDefinitions::ShowCursor( pResource->GetLua(), pElement->GetLuaUserdata(), bShow, bToggleControls );
}
return false;
@ -982,7 +982,7 @@ bool CMonoFunctions::Player::ShowChat( TElement pThis, bool bShow )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ShowChat( pResource->GetLua(), pElement->ToLuaUserData(), bShow );
return CLuaFunctionDefinitions::ShowChat( pResource->GetLua(), pElement->GetLuaUserdata(), bShow );
}
return false;
@ -1002,7 +1002,7 @@ MonoObject* CMonoFunctions::Player::GetCameraMatrix( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetCameraMatrix( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition, vecLookAt, fRoll, fFOV ) )
if( CLuaFunctionDefinitions::GetCameraMatrix( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition, vecLookAt, fRoll, fFOV ) )
{
PVOID args[] =
{
@ -1031,11 +1031,11 @@ TElement CMonoFunctions::Player::GetCameraTarget( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetCameraTarget( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetCameraTarget( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -1052,7 +1052,7 @@ unsigned char CMonoFunctions::Player::GetCameraInterior( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetCameraInterior( pResource->GetLua(), pElement->ToLuaUserData(), ucInterior ) )
if( CLuaFunctionDefinitions::GetCameraInterior( pResource->GetLua(), pElement->GetLuaUserdata(), ucInterior ) )
{
return ucInterior;
}
@ -1069,20 +1069,20 @@ bool CMonoFunctions::Player::SetCameraMatrix( TElement pThis, MonoObject* pCamer
if( pResource )
{
MonoObject* msPosition = CMonoObject::GetPropertyValue< MonoObject* >( pCameraMatrix, "Position" );
MonoObject* msPosition = SharedUtil::MonoObject::GetPropertyValue< MonoObject* >( pCameraMatrix, "Position" );
Vector3 vecPosition( msPosition );
MonoObject* msLookAt = CMonoObject::GetPropertyValue< MonoObject* >( pCameraMatrix, "LookAt" );
MonoObject* msLookAt = SharedUtil::MonoObject::GetPropertyValue< MonoObject* >( pCameraMatrix, "LookAt" );
Vector3 vecLookAt( msLookAt );
float fRoll = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "Roll" );
float fFOV = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "FOV" );
float fRoll = SharedUtil::MonoObject::GetPropertyValue< float >( pCameraMatrix, "Roll" );
float fFOV = SharedUtil::MonoObject::GetPropertyValue< float >( pCameraMatrix, "FOV" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetCameraMatrix( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition, vecLookAt, fRoll, fFOV );
return CLuaFunctionDefinitions::SetCameraMatrix( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition, vecLookAt, fRoll, fFOV );
}
return false;
@ -1096,7 +1096,7 @@ bool CMonoFunctions::Player::SetCameraTarget( TElement pThis, TElement pTarget )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetCameraTarget( pResource->GetLua(), pElement->ToLuaUserData(), (void*)pTarget );
return CLuaFunctionDefinitions::SetCameraTarget( pResource->GetLua(), pElement->GetLuaUserdata(), (void*)pTarget );
}
return false;
@ -1110,7 +1110,7 @@ bool CMonoFunctions::Player::SetCameraInterior( TElement pThis, unsigned char uc
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetCameraInterior( pResource->GetLua(), pElement->ToLuaUserData(), ucInterior );
return CLuaFunctionDefinitions::SetCameraInterior( pResource->GetLua(), pElement->GetLuaUserdata(), ucInterior );
}
return false;
@ -1122,13 +1122,13 @@ bool CMonoFunctions::Player::FadeCamera( TElement pThis, bool bFadeIn, float fFa
if( pResource )
{
unsigned char ucReed = CMonoObject::GetPropertyValue< unsigned char >( pColor, "R" );
unsigned char ucGreen = CMonoObject::GetPropertyValue< unsigned char >( pColor, "G" );
unsigned char ucBlue = CMonoObject::GetPropertyValue< unsigned char >( pColor, "B" );
unsigned char ucReed = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "R" );
unsigned char ucGreen = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "G" );
unsigned char ucBlue = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "B" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::FadeCamera( pResource->GetLua(), pElement->ToLuaUserData(), bFadeIn, fFadeTime, ucReed, ucGreen, ucBlue );
return CLuaFunctionDefinitions::FadeCamera( pResource->GetLua(), pElement->GetLuaUserdata(), bFadeIn, fFadeTime, ucReed, ucGreen, ucBlue );
}
return false;

View File

@ -22,13 +22,13 @@ void CMonoFunctions::RadarArea::Ctor( TElement pThis, MonoObject* pPosition, Mon
{
Vector2 vecPosition ( pPosition );
Vector2 vecSize ( pSize );
SColor pColor = CMonoObject::GetColor( color );
SColor pColor = SharedUtil::MonoObject::GetColor( color );
PVOID pElementVisibleTo = nullptr;
if( pVisibleTo )
{
pElementVisibleTo = pResource->GetElementManager()->GetFromList( pVisibleTo )->ToLuaUserData();
pElementVisibleTo = pResource->GetElementManager()->GetFromList( pVisibleTo )->GetLuaUserdata();
}
PVOID pUserData = CLuaFunctionDefinitions::CreateRadarArea( pResource->GetLua(), vecPosition, vecSize, pColor, pElementVisibleTo );
@ -51,7 +51,7 @@ MonoObject* CMonoFunctions::RadarArea::GetSize( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetRadarAreaSize( pResource->GetLua(), pElement->ToLuaUserData(), vecSize ) )
if( CLuaFunctionDefinitions::GetRadarAreaSize( pResource->GetLua(), pElement->GetLuaUserdata(), vecSize ) )
{
return pResource->GetDomain()->GetMTALib()->Vector2->New( vecSize );
}
@ -70,7 +70,7 @@ MonoObject* CMonoFunctions::RadarArea::GetColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetRadarAreaColor( pResource->GetLua(), pElement->ToLuaUserData(), outColor ) )
if( CLuaFunctionDefinitions::GetRadarAreaColor( pResource->GetLua(), pElement->GetLuaUserdata(), outColor ) )
{
return pResource->GetDomain()->GetMTALib()->Color->New( outColor );
}
@ -87,7 +87,7 @@ bool CMonoFunctions::RadarArea::IsFlashing( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::IsRadarAreaFlashing( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::IsRadarAreaFlashing( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -101,14 +101,14 @@ bool CMonoFunctions::RadarArea::IsInside( TElement pThis, MonoObject* pPosition
{
bool bInside;
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
Vector2 vecPosition( fX, fY );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsInsideRadarArea( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition, bInside ) )
if( CLuaFunctionDefinitions::IsInsideRadarArea( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition, bInside ) )
{
return bInside;
}
@ -125,14 +125,14 @@ bool CMonoFunctions::RadarArea::SetSize( TElement pThis, MonoObject* pSize )
if( pResource )
{
float fX = CMonoObject::GetPropertyValue< float >( pSize, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pSize, "Y" );
float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pSize, "X" );
float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pSize, "Y" );
Vector2 vecPosition( fX, fY );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetRadarAreaSize( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition );
return CLuaFunctionDefinitions::SetRadarAreaSize( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition );
}
return false;
@ -144,11 +144,11 @@ bool CMonoFunctions::RadarArea::SetColor( TElement pThis, MonoObject* color )
if( pResource )
{
SColor pColor = CMonoObject::GetColor( color );
SColor pColor = SharedUtil::MonoObject::GetColor( color );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetRadarAreaColor( pResource->GetLua(), pElement->ToLuaUserData(), pColor );
return CLuaFunctionDefinitions::SetRadarAreaColor( pResource->GetLua(), pElement->GetLuaUserdata(), pColor );
}
return false;
@ -162,7 +162,7 @@ bool CMonoFunctions::RadarArea::SetFlashing( TElement pThis, bool bFlashing )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetRadarAreaFlashing( pResource->GetLua(), pElement->ToLuaUserData(), bFlashing );
return CLuaFunctionDefinitions::SetRadarAreaFlashing( pResource->GetLua(), pElement->GetLuaUserdata(), bFlashing );
}
return false;

View File

@ -42,11 +42,11 @@ TElement CMonoFunctions::Resource::Copy( TElement pThis, MonoString* msNewResour
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::CopyResource( pResource->GetLua(), pElement->ToLuaUserData(), szResourceName, szOrganizationalDir );
PVOID pUserData = CLuaFunctionDefinitions::CopyResource( pResource->GetLua(), pElement->GetLuaUserdata(), szResourceName, szOrganizationalDir );
if( pUserData )
{
return pResource->GetElementManager()->Create( nullptr, pUserData )->ToMonoObject();
return pResource->GetElementManager()->Create( nullptr, pUserData )->GetMonoObject();
}
}
@ -61,11 +61,11 @@ TElement CMonoFunctions::Resource::GetRootElement( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetResourceRootElement( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetResourceRootElement( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->Create( nullptr, pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -82,11 +82,11 @@ TElement CMonoFunctions::Resource::GetMapRootElement( TElement pThis, MonoString
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetResourceMapRootElement( pResource->GetLua(), pElement->ToLuaUserData(), szMap );
PVOID pUserData = CLuaFunctionDefinitions::GetResourceMapRootElement( pResource->GetLua(), pElement->GetLuaUserdata(), szMap );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -101,11 +101,11 @@ TElement CMonoFunctions::Resource::GetDynamicElementRoot( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetResourceDynamicElementRoot( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetResourceDynamicElementRoot( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -122,7 +122,7 @@ bool CMonoFunctions::Resource::RemoveFile( TElement pThis, MonoString* msFilenam
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveResourceFile( pResource->GetLua(), pElement->ToLuaUserData(), szFileName );
return CLuaFunctionDefinitions::RemoveResourceFile( pResource->GetLua(), pElement->GetLuaUserdata(), szFileName );
}
return false;
@ -140,7 +140,7 @@ TElement CMonoFunctions::Resource::GetFromName( MonoString* msResourceName )
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -159,7 +159,7 @@ MonoString* CMonoFunctions::Resource::GetInfo( TElement pThis, MonoString* msAtt
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetResourceInfo( pResource->GetLua(), pElement->ToLuaUserData(), szAttribute, strOutInfo ) )
if( CLuaFunctionDefinitions::GetResourceInfo( pResource->GetLua(), pElement->GetLuaUserdata(), szAttribute, strOutInfo ) )
{
return pResource->GetDomain()->NewString( strOutInfo );
}
@ -178,7 +178,7 @@ unsigned int CMonoFunctions::Resource::GetLastStartTime( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetResourceLastStartTime( pResource->GetLua(), pElement->ToLuaUserData(), uiTime ) )
if( CLuaFunctionDefinitions::GetResourceLastStartTime( pResource->GetLua(), pElement->GetLuaUserdata(), uiTime ) )
{
return uiTime;
}
@ -197,7 +197,7 @@ MonoString* CMonoFunctions::Resource::GetLoadFailureReason( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetResourceLoadFailureReason( pResource->GetLua(), pElement->ToLuaUserData(), strOutReason ) )
if( CLuaFunctionDefinitions::GetResourceLoadFailureReason( pResource->GetLua(), pElement->GetLuaUserdata(), strOutReason ) )
{
return pResource->GetDomain()->NewString( strOutReason );
}
@ -216,7 +216,7 @@ unsigned int CMonoFunctions::Resource::GetLoadTime( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetResourceLoadTime( pResource->GetLua(), pElement->ToLuaUserData(), uiTime ) )
if( CLuaFunctionDefinitions::GetResourceLoadTime( pResource->GetLua(), pElement->GetLuaUserdata(), uiTime ) )
{
return uiTime;
}
@ -235,7 +235,7 @@ MonoString* CMonoFunctions::Resource::GetName( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetResourceName( pResource->GetLua(), pElement->ToLuaUserData(), strOut ) )
if( CLuaFunctionDefinitions::GetResourceName( pResource->GetLua(), pElement->GetLuaUserdata(), strOut ) )
{
return pResource->GetDomain()->NewString( strOut );
}
@ -254,7 +254,7 @@ MonoArray* CMonoFunctions::Resource::GetResources( void )
if( pLuaTable.size() > 0 )
{
return pResource->GetDomain()->NewElementArray( pResource->GetDomain()->GetMTALib()->GetClass( "Resource" )->GetMonoPtr(), pLuaTable );
return pResource->GetDomain()->NewArray( **pResource->GetDomain()->GetMTALib()->GetClass( "Resource" ), pLuaTable );
}
}
@ -271,7 +271,7 @@ MonoString* CMonoFunctions::Resource::GetState( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetResourceState( pResource->GetLua(), pElement->ToLuaUserData(), strOut ) )
if( CLuaFunctionDefinitions::GetResourceState( pResource->GetLua(), pElement->GetLuaUserdata(), strOut ) )
{
return pResource->GetDomain()->NewString( strOut );
}
@ -290,7 +290,7 @@ TElement CMonoFunctions::Resource::GetCurrent( void )
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -319,7 +319,7 @@ bool CMonoFunctions::Resource::RemoveDefaultSetting( TElement pThis, MonoString*
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveResourceDefaultSetting( pResource->GetLua(), pElement->ToLuaUserData(), szSettingName );
return CLuaFunctionDefinitions::RemoveResourceDefaultSetting( pResource->GetLua(), pElement->GetLuaUserdata(), szSettingName );
}
return false;
@ -333,7 +333,7 @@ bool CMonoFunctions::Resource::Start( TElement pThis, bool persistent, bool star
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::StartResource( pResource->GetLua(), pElement->ToLuaUserData(), persistent, startIncludedResources, loadServerConfigs, loadMaps, loadServerScripts, loadHTML, loadClientConfigs, loadClientScripts, loadFiles );
return CLuaFunctionDefinitions::StartResource( pResource->GetLua(), pElement->GetLuaUserdata(), persistent, startIncludedResources, loadServerConfigs, loadMaps, loadServerScripts, loadHTML, loadClientConfigs, loadClientScripts, loadFiles );
}
return false;
@ -347,7 +347,7 @@ bool CMonoFunctions::Resource::Restart( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RestartResource( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::RestartResource( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -361,7 +361,7 @@ bool CMonoFunctions::Resource::Stop( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::StopResource( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::StopResource( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -378,7 +378,7 @@ bool CMonoFunctions::Resource::SetDefaultSetting( TElement pThis, MonoString* ms
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetResourceDefaultSetting( pResource->GetLua(), pElement->ToLuaUserData(), szSettingName, szSettingValue );
return CLuaFunctionDefinitions::SetResourceDefaultSetting( pResource->GetLua(), pElement->GetLuaUserdata(), szSettingName, szSettingValue );
}
return false;
@ -395,7 +395,7 @@ bool CMonoFunctions::Resource::SetInfo( TElement pThis, MonoString* msAttribute,
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetResourceInfo( pResource->GetLua(), pElement->ToLuaUserData(), szAttribute, szValue );
return CLuaFunctionDefinitions::SetResourceInfo( pResource->GetLua(), pElement->GetLuaUserdata(), szAttribute, szValue );
}
return false;
@ -442,7 +442,7 @@ bool CMonoFunctions::Resource::UpdateACLRequest( TElement pThis, MonoString* msR
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::UpdateResourceACLRequest( pResource->GetLua(), pElement->ToLuaUserData(), szRightName, bAccess, szByWho );
return CLuaFunctionDefinitions::UpdateResourceACLRequest( pResource->GetLua(), pElement->GetLuaUserdata(), szRightName, bAccess, szByWho );
}
return false;

View File

@ -21,7 +21,7 @@ void CMonoFunctions::Team::Ctor( TElement pThis, MonoString* msTeamName, MonoObj
if( pResource )
{
const char* szTeamName = mono_string_to_utf8( msTeamName );
SColor pColor = CMonoObject::GetColor( mColor );
SColor pColor = SharedUtil::MonoObject::GetColor( mColor );
PVOID pUserData = CLuaFunctionDefinitions::CreateTeam( pResource->GetLua(), szTeamName, pColor.R, pColor.G, pColor.B );
@ -43,7 +43,7 @@ TElement CMonoFunctions::Team::GetFromName( MonoString* msTeamName )
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -60,7 +60,7 @@ MonoString* CMonoFunctions::Team::GetName( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetTeamName( pResource->GetLua(), pElement->ToLuaUserData(), strOutName ) )
if( CLuaFunctionDefinitions::GetTeamName( pResource->GetLua(), pElement->GetLuaUserdata(), strOutName ) )
{
return pResource->GetDomain()->NewString( strOutName );
}
@ -79,7 +79,7 @@ MonoObject* CMonoFunctions::Team::GetColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetTeamColor( pResource->GetLua(), pElement->ToLuaUserData(), pColor.R, pColor.G, pColor.B ) )
if( CLuaFunctionDefinitions::GetTeamColor( pResource->GetLua(), pElement->GetLuaUserdata(), pColor.R, pColor.G, pColor.B ) )
{
return pResource->GetDomain()->GetMTALib()->Color->New( pColor );
}
@ -98,7 +98,7 @@ unsigned int CMonoFunctions::Team::CountPlayers( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::CountPlayersInTeam( pResource->GetLua(), pElement->ToLuaUserData(), uiCount ) )
if( CLuaFunctionDefinitions::CountPlayersInTeam( pResource->GetLua(), pElement->GetLuaUserdata(), uiCount ) )
{
return uiCount;
}
@ -117,7 +117,7 @@ bool CMonoFunctions::Team::GetFriendlyFire( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetTeamFriendlyFire( pResource->GetLua(), pElement->ToLuaUserData(), bFriendlyFire ) )
if( CLuaFunctionDefinitions::GetTeamFriendlyFire( pResource->GetLua(), pElement->GetLuaUserdata(), bFriendlyFire ) )
{
return bFriendlyFire;
}
@ -138,7 +138,7 @@ bool CMonoFunctions::Team::SetName( TElement pThis, MonoString* msTeamName )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTeamName( pResource->GetLua(), pElement->ToLuaUserData(), szTeamName );
return CLuaFunctionDefinitions::SetTeamName( pResource->GetLua(), pElement->GetLuaUserdata(), szTeamName );
}
return false;
@ -150,11 +150,11 @@ bool CMonoFunctions::Team::SetColor( TElement pThis, MonoObject* mColor )
if( pResource )
{
SColor pColor = CMonoObject::GetColor( mColor );
SColor pColor = SharedUtil::MonoObject::GetColor( mColor );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTeamColor( pResource->GetLua(), pElement->ToLuaUserData(), pColor.R, pColor.G, pColor.B );
return CLuaFunctionDefinitions::SetTeamColor( pResource->GetLua(), pElement->GetLuaUserdata(), pColor.R, pColor.G, pColor.B );
}
return false;
@ -168,7 +168,7 @@ bool CMonoFunctions::Team::SetFriendlyFire( TElement pThis, bool bFriendlyFire )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTeamFriendlyFire( pResource->GetLua(), pElement->ToLuaUserData(), bFriendlyFire );
return CLuaFunctionDefinitions::SetTeamFriendlyFire( pResource->GetLua(), pElement->GetLuaUserdata(), bFriendlyFire );
}
return false;

View File

@ -30,16 +30,16 @@ void CMonoFunctions::Vehicle::Ctor( TElement pThis, int model, MonoObject* posit
if( position )
{
fX = CMonoObject::GetPropertyValue< float >( position, "X" );
fY = CMonoObject::GetPropertyValue< float >( position, "Y" );
fZ = CMonoObject::GetPropertyValue< float >( position, "Z" );
fX = SharedUtil::MonoObject::GetPropertyValue< float >( position, "X" );
fY = SharedUtil::MonoObject::GetPropertyValue< float >( position, "Y" );
fZ = SharedUtil::MonoObject::GetPropertyValue< float >( position, "Z" );
}
if( rotation )
{
fRX = CMonoObject::GetPropertyValue< float >( rotation, "X" );
fRY = CMonoObject::GetPropertyValue< float >( rotation, "Y" );
fRZ = CMonoObject::GetPropertyValue< float >( rotation, "Z" );
fRX = SharedUtil::MonoObject::GetPropertyValue< float >( rotation, "X" );
fRY = SharedUtil::MonoObject::GetPropertyValue< float >( rotation, "Y" );
fRZ = SharedUtil::MonoObject::GetPropertyValue< float >( rotation, "Z" );
}
string sNumberplate = "";
@ -68,7 +68,7 @@ MonoString* CMonoFunctions::Vehicle::GetVehicleType( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleType( pResource->GetLua(), pElement->ToLuaUserData(), strType ) )
if( CLuaFunctionDefinitions::GetVehicleType( pResource->GetLua(), pElement->GetLuaUserdata(), strType ) )
{
return pResource->GetDomain()->NewString( strType );
}
@ -88,9 +88,9 @@ MonoArray* CMonoFunctions::Vehicle::GetVariant( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleVariant( pResource->GetLua(), pElement->ToLuaUserData(), ucVariant, ucVariant2 ) )
if( CLuaFunctionDefinitions::GetVehicleVariant( pResource->GetLua(), pElement->GetLuaUserdata(), ucVariant, ucVariant2 ) )
{
MonoArray* pArray = mono_array_new( pResource->GetDomain()->GetMonoPtr(), mono_get_char_class(), 2 );
MonoArray* pArray = mono_array_new( **pResource->GetDomain(), mono_get_char_class(), 2 );
if( pArray )
{
@ -115,7 +115,7 @@ MonoObject* CMonoFunctions::Vehicle::GetColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleColor( pResource->GetLua(), pElement->ToLuaUserData(), pVehicleColor ) )
if( CLuaFunctionDefinitions::GetVehicleColor( pResource->GetLua(), pElement->GetLuaUserdata(), pVehicleColor ) )
{
CMonoMTALib* pMTALib = pResource->GetDomain()->GetMTALib();
@ -164,7 +164,7 @@ bool CMonoFunctions::Vehicle::GetLandingGearDown( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleLandingGearDown( pResource->GetLua(), pElement->ToLuaUserData(), bGearDown ) )
if( CLuaFunctionDefinitions::GetVehicleLandingGearDown( pResource->GetLua(), pElement->GetLuaUserdata(), bGearDown ) )
{
return bGearDown;
}
@ -183,7 +183,7 @@ unsigned char CMonoFunctions::Vehicle::GetMaxPassengers( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleMaxPassengers( pResource->GetLua(), pElement->ToLuaUserData(), ucPassengers ) )
if( CLuaFunctionDefinitions::GetVehicleMaxPassengers( pResource->GetLua(), pElement->GetLuaUserdata(), ucPassengers ) )
{
return ucPassengers;
}
@ -202,7 +202,7 @@ MonoString* CMonoFunctions::Vehicle::GetName( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleName( pResource->GetLua(), pElement->ToLuaUserData(), strOutName ) )
if( CLuaFunctionDefinitions::GetVehicleName( pResource->GetLua(), pElement->GetLuaUserdata(), strOutName ) )
{
return pResource->GetDomain()->NewString( strOutName );
}
@ -236,11 +236,11 @@ TElement CMonoFunctions::Vehicle::GetOccupant( TElement pThis, unsigned int uiSe
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleOccupant( pResource->GetLua(), pElement->ToLuaUserData(), uiSeat );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleOccupant( pResource->GetLua(), pElement->GetLuaUserdata(), uiSeat );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -255,11 +255,11 @@ MonoArray* CMonoFunctions::Vehicle::GetOccupants( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CLuaArgumentsVector pLuaArguments = CLuaFunctionDefinitions::GetVehicleOccupants( pResource->GetLua(), pElement->ToLuaUserData() );
CLuaArgumentsVector pLuaArguments = CLuaFunctionDefinitions::GetVehicleOccupants( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pLuaArguments.size() > 0 )
{
return pResource->GetDomain()->NewElementArray( pResource->GetDomain()->GetMTALib()->GetClass( "Ped" )->GetMonoPtr(), pLuaArguments );
return pResource->GetDomain()->NewArray( **pResource->GetDomain()->GetMTALib()->GetClass( "Ped" ), pLuaArguments );
}
}
@ -274,11 +274,11 @@ TElement CMonoFunctions::Vehicle::GetController( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleController( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleController( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -295,7 +295,7 @@ bool CMonoFunctions::Vehicle::GetSirensOn( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleSirensOn( pResource->GetLua(), pElement->ToLuaUserData(), bSirensOn ) )
if( CLuaFunctionDefinitions::GetVehicleSirensOn( pResource->GetLua(), pElement->GetLuaUserdata(), bSirensOn ) )
{
return bSirensOn;
}
@ -314,7 +314,7 @@ MonoObject* CMonoFunctions::Vehicle::GetTurnVelocity( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleTurnVelocity( pResource->GetLua(), pElement->ToLuaUserData(), vecVelocity ) )
if( CLuaFunctionDefinitions::GetVehicleTurnVelocity( pResource->GetLua(), pElement->GetLuaUserdata(), vecVelocity ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecVelocity );
}
@ -333,7 +333,7 @@ MonoObject* CMonoFunctions::Vehicle::GetTurretPosition( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleTurretPosition( pResource->GetLua(), pElement->ToLuaUserData(), vecPosition ) )
if( CLuaFunctionDefinitions::GetVehicleTurretPosition( pResource->GetLua(), pElement->GetLuaUserdata(), vecPosition ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
}
@ -352,7 +352,7 @@ bool CMonoFunctions::Vehicle::IsLocked( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsVehicleLocked( pResource->GetLua(), pElement->ToLuaUserData(), bLocked ) )
if( CLuaFunctionDefinitions::IsVehicleLocked( pResource->GetLua(), pElement->GetLuaUserdata(), bLocked ) )
{
return bLocked;
}
@ -371,7 +371,7 @@ MonoArray* CMonoFunctions::Vehicle::GetOfType( unsigned int uiModel )
if( pLuaArguments.size() > 0 )
{
return pResource->GetDomain()->NewElementArray( pResource->GetDomain()->GetMTALib()->GetClass( "Vehicle" )->GetMonoPtr(), pLuaArguments );
return pResource->GetDomain()->NewArray( **pResource->GetDomain()->GetMTALib()->GetClass( "Vehicle" ), pLuaArguments );
}
}
@ -388,7 +388,7 @@ unsigned short CMonoFunctions::Vehicle::GetUpgradeOnSlot( TElement pThis, unsign
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleUpgradeOnSlot( pResource->GetLua(), pElement->ToLuaUserData(), ucSlot, ucUpgrade ) )
if( CLuaFunctionDefinitions::GetVehicleUpgradeOnSlot( pResource->GetLua(), pElement->GetLuaUserdata(), ucSlot, ucUpgrade ) )
{
return ucUpgrade;
}
@ -405,7 +405,7 @@ MonoArray* CMonoFunctions::Vehicle::GetUpgrades( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CLuaArgumentsVector pLuaArguments = CLuaFunctionDefinitions::GetVehicleUpgrades( pResource->GetLua(), pElement->ToLuaUserData() );
CLuaArgumentsVector pLuaArguments = CLuaFunctionDefinitions::GetVehicleUpgrades( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pLuaArguments.size() > 0 )
{
@ -441,7 +441,7 @@ MonoArray* CMonoFunctions::Vehicle::GetCompatibleUpgrades( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CLuaArgumentsVector pLuaArguments = CLuaFunctionDefinitions::GetVehicleCompatibleUpgrades( pResource->GetLua(), pElement->ToLuaUserData() );
CLuaArgumentsVector pLuaArguments = CLuaFunctionDefinitions::GetVehicleCompatibleUpgrades( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pLuaArguments.size() > 0 )
{
@ -462,7 +462,7 @@ unsigned char CMonoFunctions::Vehicle::GetDoorState( TElement pThis, unsigned ch
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleDoorState( pResource->GetLua(), pElement->ToLuaUserData(), ucDoor, ucState ) )
if( CLuaFunctionDefinitions::GetVehicleDoorState( pResource->GetLua(), pElement->GetLuaUserdata(), ucDoor, ucState ) )
{
return ucState;
}
@ -481,7 +481,7 @@ MonoObject* CMonoFunctions::Vehicle::GetWheelStates( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleWheelStates( pResource->GetLua(), pElement->ToLuaUserData(), ucFrontLeft, ucRearLeft, ucFrontRight, ucRearRight ) )
if( CLuaFunctionDefinitions::GetVehicleWheelStates( pResource->GetLua(), pElement->GetLuaUserdata(), ucFrontLeft, ucRearLeft, ucFrontRight, ucRearRight ) )
{
void *args[] =
{
@ -505,7 +505,7 @@ unsigned char CMonoFunctions::Vehicle::GetLightState( TElement pThis, unsigned c
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleLightState( pResource->GetLua(), pElement->ToLuaUserData(), ucLight, ucState ) )
if( CLuaFunctionDefinitions::GetVehicleLightState( pResource->GetLua(), pElement->GetLuaUserdata(), ucLight, ucState ) )
{
return ucState;
}
@ -524,7 +524,7 @@ unsigned char CMonoFunctions::Vehicle::GetPanelState( TElement pThis, unsigned c
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehiclePanelState( pResource->GetLua(), pElement->ToLuaUserData(), ucPanel, ucState ) )
if( CLuaFunctionDefinitions::GetVehiclePanelState( pResource->GetLua(), pElement->GetLuaUserdata(), ucPanel, ucState ) )
{
return ucState;
}
@ -543,7 +543,7 @@ unsigned char CMonoFunctions::Vehicle::GetOverrideLights( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleOverrideLights( pResource->GetLua(), pElement->ToLuaUserData(), ucLights ) )
if( CLuaFunctionDefinitions::GetVehicleOverrideLights( pResource->GetLua(), pElement->GetLuaUserdata(), ucLights ) )
{
return ucLights;
}
@ -560,11 +560,11 @@ TElement CMonoFunctions::Vehicle::GetTowedByVehicle( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleTowedByVehicle( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleTowedByVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -579,11 +579,11 @@ TElement CMonoFunctions::Vehicle::GetTowingVehicle( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleTowingVehicle( pResource->GetLua(), pElement->ToLuaUserData() );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleTowingVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData )
{
return pResource->GetElementManager()->FindOrCreate( pUserData )->ToMonoObject();
return pResource->GetElementManager()->FindOrCreate( pUserData )->GetMonoObject();
}
}
@ -600,7 +600,7 @@ unsigned char CMonoFunctions::Vehicle::GetPaintjob( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehiclePaintjob( pResource->GetLua(), pElement->ToLuaUserData(), ucPaintjob ) )
if( CLuaFunctionDefinitions::GetVehiclePaintjob( pResource->GetLua(), pElement->GetLuaUserdata(), ucPaintjob ) )
{
return ucPaintjob;
}
@ -619,7 +619,7 @@ MonoString* CMonoFunctions::Vehicle::GetPlateText( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehiclePlateText( pResource->GetLua(), pElement->ToLuaUserData(), szPlateText ) )
if( CLuaFunctionDefinitions::GetVehiclePlateText( pResource->GetLua(), pElement->GetLuaUserdata(), szPlateText ) )
{
return pResource->GetDomain()->NewString( szPlateText );
}
@ -638,7 +638,7 @@ bool CMonoFunctions::Vehicle::IsDamageProof( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsVehicleDamageProof( pResource->GetLua(), pElement->ToLuaUserData(), bDamageProof ) )
if( CLuaFunctionDefinitions::IsVehicleDamageProof( pResource->GetLua(), pElement->GetLuaUserdata(), bDamageProof ) )
{
return bDamageProof;
}
@ -657,7 +657,7 @@ bool CMonoFunctions::Vehicle::IsFuelTankExplodable( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsVehicleFuelTankExplodable( pResource->GetLua(), pElement->ToLuaUserData(), bExplodable ) )
if( CLuaFunctionDefinitions::IsVehicleFuelTankExplodable( pResource->GetLua(), pElement->GetLuaUserdata(), bExplodable ) )
{
return bExplodable;
}
@ -676,7 +676,7 @@ bool CMonoFunctions::Vehicle::IsFrozen( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsVehicleFrozen( pResource->GetLua(), pElement->ToLuaUserData(), bFrozen ) )
if( CLuaFunctionDefinitions::IsVehicleFrozen( pResource->GetLua(), pElement->GetLuaUserdata(), bFrozen ) )
{
return bFrozen;
}
@ -695,7 +695,7 @@ bool CMonoFunctions::Vehicle::IsOnGround( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsVehicleOnGround( pResource->GetLua(), pElement->ToLuaUserData(), bOnGround ) )
if( CLuaFunctionDefinitions::IsVehicleOnGround( pResource->GetLua(), pElement->GetLuaUserdata(), bOnGround ) )
{
return bOnGround;
}
@ -714,7 +714,7 @@ bool CMonoFunctions::Vehicle::GetEngineState( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleEngineState( pResource->GetLua(), pElement->ToLuaUserData(), bState ) )
if( CLuaFunctionDefinitions::GetVehicleEngineState( pResource->GetLua(), pElement->GetLuaUserdata(), bState ) )
{
return bState;
}
@ -733,7 +733,7 @@ bool CMonoFunctions::Vehicle::IsTrainDerailed( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsTrainDerailed( pResource->GetLua(), pElement->ToLuaUserData(), bDerailed ) )
if( CLuaFunctionDefinitions::IsTrainDerailed( pResource->GetLua(), pElement->GetLuaUserdata(), bDerailed ) )
{
return bDerailed;
}
@ -752,7 +752,7 @@ bool CMonoFunctions::Vehicle::IsTrainDerailable( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsTrainDerailable( pResource->GetLua(), pElement->ToLuaUserData(), bDerailed ) )
if( CLuaFunctionDefinitions::IsTrainDerailable( pResource->GetLua(), pElement->GetLuaUserdata(), bDerailed ) )
{
return bDerailed;
}
@ -771,7 +771,7 @@ bool CMonoFunctions::Vehicle::GetTrainDirection( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetTrainDirection( pResource->GetLua(), pElement->ToLuaUserData(), bDirection ) )
if( CLuaFunctionDefinitions::GetTrainDirection( pResource->GetLua(), pElement->GetLuaUserdata(), bDirection ) )
{
return bDirection;
}
@ -790,7 +790,7 @@ float CMonoFunctions::Vehicle::GetTrainSpeed( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetTrainSpeed( pResource->GetLua(), pElement->ToLuaUserData(), fSpeed ) )
if( CLuaFunctionDefinitions::GetTrainSpeed( pResource->GetLua(), pElement->GetLuaUserdata(), fSpeed ) )
{
return fSpeed;
}
@ -807,7 +807,7 @@ bool CMonoFunctions::Vehicle::IsBlown( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::IsVehicleBlown( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::IsVehicleBlown( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -823,7 +823,7 @@ MonoObject* CMonoFunctions::Vehicle::GetHeadLightColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleHeadLightColor( pResource->GetLua(), pElement->ToLuaUserData(), outColor ) )
if( CLuaFunctionDefinitions::GetVehicleHeadLightColor( pResource->GetLua(), pElement->GetLuaUserdata(), outColor ) )
{
return pResource->GetDomain()->GetMTALib()->Color->New( outColor );
}
@ -842,7 +842,7 @@ float CMonoFunctions::Vehicle::GetDoorOpenRatio( TElement pThis, unsigned char u
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleDoorOpenRatio( pResource->GetLua(), pElement->ToLuaUserData(), ucDoor, fRatio ) )
if( CLuaFunctionDefinitions::GetVehicleDoorOpenRatio( pResource->GetLua(), pElement->GetLuaUserdata(), ucDoor, fRatio ) )
{
return fRatio;
}
@ -861,7 +861,7 @@ bool CMonoFunctions::Vehicle::IsTaxiLightOn( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsVehicleTaxiLightOn( pResource->GetLua(), pElement->ToLuaUserData(), bLightOn ) )
if( CLuaFunctionDefinitions::IsVehicleTaxiLightOn( pResource->GetLua(), pElement->GetLuaUserdata(), bLightOn ) )
{
return bLightOn;
}
@ -880,7 +880,7 @@ bool CMonoFunctions::Vehicle::Fix( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::FixVehicle( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::FixVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -894,7 +894,7 @@ bool CMonoFunctions::Vehicle::Blow( TElement pThis, bool bExplode )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::BlowVehicle( pResource->GetLua(), pElement->ToLuaUserData(), bExplode );
return CLuaFunctionDefinitions::BlowVehicle( pResource->GetLua(), pElement->GetLuaUserdata(), bExplode );
}
return false;
@ -906,13 +906,13 @@ bool CMonoFunctions::Vehicle::SetTurnVelocity( TElement pThis, MonoObject* pVelo
if( pResource )
{
float fX = CMonoObject::GetPropertyValue< float >( pVelocity, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pVelocity, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pVelocity, "Z" );
float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pVelocity, "X" );
float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pVelocity, "Y" );
float fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pVelocity, "Z" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleTurnVelocity( pResource->GetLua(), pElement->ToLuaUserData(), fX, fY, fZ );
return CLuaFunctionDefinitions::SetVehicleTurnVelocity( pResource->GetLua(), pElement->GetLuaUserdata(), fX, fY, fZ );
}
return false;
@ -924,25 +924,25 @@ bool CMonoFunctions::Vehicle::SetColor( TElement pThis, MonoObject* pColor1, Mon
if( pResource )
{
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 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor1, "R" );
unsigned char ucG1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor1, "G" );
unsigned char ucB1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor1, "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" );
unsigned char ucR2 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor2, "R" );
unsigned char ucG2 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor2, "G" );
unsigned char ucB2 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor2, "B" );
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 ucR3 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor3, "R" );
unsigned char ucG3 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor3, "G" );
unsigned char ucB3 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor3, "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" );
unsigned char ucR4 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor4, "R" );
unsigned char ucG4 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor4, "G" );
unsigned char ucB4 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor4, "B" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleColor( pResource->GetLua(), pElement->ToLuaUserData(), ucR1, ucG1, ucB1, ucR2, ucG2, ucB2, ucR3, ucG3, ucB3, ucR4, ucG4, ucB4 );
return CLuaFunctionDefinitions::SetVehicleColor( pResource->GetLua(), pElement->GetLuaUserdata(), ucR1, ucG1, ucB1, ucR2, ucG2, ucB2, ucR3, ucG3, ucB3, ucR4, ucG4, ucB4 );
}
return false;
@ -956,7 +956,7 @@ bool CMonoFunctions::Vehicle::SetLandingGearDown( TElement pThis, bool bLandingG
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleLandingGearDown( pResource->GetLua(), pElement->ToLuaUserData(), bLandingGearDown );
return CLuaFunctionDefinitions::SetVehicleLandingGearDown( pResource->GetLua(), pElement->GetLuaUserdata(), bLandingGearDown );
}
return false;
@ -970,7 +970,7 @@ bool CMonoFunctions::Vehicle::SetLocked( TElement pThis, bool bLocked )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleLocked( pResource->GetLua(), pElement->ToLuaUserData(), bLocked );
return CLuaFunctionDefinitions::SetVehicleLocked( pResource->GetLua(), pElement->GetLuaUserdata(), bLocked );
}
return false;
@ -984,7 +984,7 @@ bool CMonoFunctions::Vehicle::SetDoorsUndamageable( TElement pThis, bool bDoorsU
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleDoorsUndamageable( pResource->GetLua(), pElement->ToLuaUserData(), bDoorsUndamageable );
return CLuaFunctionDefinitions::SetVehicleDoorsUndamageable( pResource->GetLua(), pElement->GetLuaUserdata(), bDoorsUndamageable );
}
return false;
@ -998,7 +998,7 @@ bool CMonoFunctions::Vehicle::SetSirensOn( TElement pThis, bool bSirensOn )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleSirensOn( pResource->GetLua(), pElement->ToLuaUserData(), bSirensOn );
return CLuaFunctionDefinitions::SetVehicleSirensOn( pResource->GetLua(), pElement->GetLuaUserdata(), bSirensOn );
}
return false;
@ -1012,7 +1012,7 @@ bool CMonoFunctions::Vehicle::SetTaxiLightOn( TElement pThis, bool bTaxiLightSta
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleTaxiLightOn( pResource->GetLua(), pElement->ToLuaUserData(), bTaxiLightState );
return CLuaFunctionDefinitions::SetVehicleTaxiLightOn( pResource->GetLua(), pElement->GetLuaUserdata(), bTaxiLightState );
}
return false;
@ -1026,7 +1026,7 @@ bool CMonoFunctions::Vehicle::AddUpgrade( TElement pThis, unsigned short usUpgra
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::AddVehicleUpgrade( pResource->GetLua(), pElement->ToLuaUserData(), usUpgrade );
return CLuaFunctionDefinitions::AddVehicleUpgrade( pResource->GetLua(), pElement->GetLuaUserdata(), usUpgrade );
}
return false;
@ -1040,7 +1040,7 @@ bool CMonoFunctions::Vehicle::RemoveUpgrade( TElement pThis, unsigned short usUp
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveVehicleUpgrade( pResource->GetLua(), pElement->ToLuaUserData(), usUpgrade );
return CLuaFunctionDefinitions::RemoveVehicleUpgrade( pResource->GetLua(), pElement->GetLuaUserdata(), usUpgrade );
}
return false;
@ -1054,7 +1054,7 @@ bool CMonoFunctions::Vehicle::SetDoorState( TElement pThis, unsigned char ucDoor
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleDoorState( pResource->GetLua(), pElement->ToLuaUserData(), ucDoor, ucState );
return CLuaFunctionDefinitions::SetVehicleDoorState( pResource->GetLua(), pElement->GetLuaUserdata(), ucDoor, ucState );
}
return false;
@ -1068,7 +1068,7 @@ bool CMonoFunctions::Vehicle::SetWheelStates( TElement pThis, int iFrontLeft, in
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleWheelStates( pResource->GetLua(), pElement->ToLuaUserData(), iFrontLeft, iRearLeft, iFrontRight, iRearRight );
return CLuaFunctionDefinitions::SetVehicleWheelStates( pResource->GetLua(), pElement->GetLuaUserdata(), iFrontLeft, iRearLeft, iFrontRight, iRearRight );
}
return false;
@ -1082,7 +1082,7 @@ bool CMonoFunctions::Vehicle::SetLightState( TElement pThis, unsigned char ucLig
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleLightState( pResource->GetLua(), pElement->ToLuaUserData(), ucLight, ucState );
return CLuaFunctionDefinitions::SetVehicleLightState( pResource->GetLua(), pElement->GetLuaUserdata(), ucLight, ucState );
}
return false;
@ -1096,7 +1096,7 @@ bool CMonoFunctions::Vehicle::SetPanelState( TElement pThis, unsigned char ucPan
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehiclePanelState( pResource->GetLua(), pElement->ToLuaUserData(), ucPanel, ucState );
return CLuaFunctionDefinitions::SetVehiclePanelState( pResource->GetLua(), pElement->GetLuaUserdata(), ucPanel, ucState );
}
return false;
@ -1110,7 +1110,7 @@ bool CMonoFunctions::Vehicle::SetIdleRespawnDelay( TElement pThis, unsigned long
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleIdleRespawnDelay( pResource->GetLua(), pElement->ToLuaUserData(), ulTime );
return CLuaFunctionDefinitions::SetVehicleIdleRespawnDelay( pResource->GetLua(), pElement->GetLuaUserdata(), ulTime );
}
return false;
@ -1124,7 +1124,7 @@ bool CMonoFunctions::Vehicle::SetRespawnDelay( TElement pThis, unsigned long ulT
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleRespawnDelay( pResource->GetLua(), pElement->ToLuaUserData(), ulTime );
return CLuaFunctionDefinitions::SetVehicleRespawnDelay( pResource->GetLua(), pElement->GetLuaUserdata(), ulTime );
}
return false;
@ -1136,17 +1136,17 @@ bool CMonoFunctions::Vehicle::SetRespawnPosition( TElement pThis, MonoObject* pP
if( pResource )
{
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fRX = CMonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( pRotation, "Z" );
float fRX = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "Z" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleRespawnPosition( pResource->GetLua(), pElement->ToLuaUserData(), fX, fY, fZ, fRX, fRY, fRZ );
return CLuaFunctionDefinitions::SetVehicleRespawnPosition( pResource->GetLua(), pElement->GetLuaUserdata(), fX, fY, fZ, fRX, fRY, fRZ );
}
return false;
@ -1160,7 +1160,7 @@ bool CMonoFunctions::Vehicle::ToggleRespawn( TElement pThis, bool bRespawn )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ToggleVehicleRespawn( pResource->GetLua(), pElement->ToLuaUserData(), bRespawn );
return CLuaFunctionDefinitions::ToggleVehicleRespawn( pResource->GetLua(), pElement->GetLuaUserdata(), bRespawn );
}
return false;
@ -1174,7 +1174,7 @@ bool CMonoFunctions::Vehicle::ResetExplosionTime( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ResetVehicleExplosionTime( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::ResetVehicleExplosionTime( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -1188,7 +1188,7 @@ bool CMonoFunctions::Vehicle::ResetIdleTime( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ResetVehicleIdleTime( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::ResetVehicleIdleTime( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -1200,17 +1200,17 @@ bool CMonoFunctions::Vehicle::Spawn( TElement pThis, MonoObject* pPosition, Mono
if( pResource )
{
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fRX = CMonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( pRotation, "Z" );
float fRX = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "Z" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SpawnVehicle( pResource->GetLua(), pElement->ToLuaUserData(), fX, fY, fZ, fRX, fRY, fRZ );
return CLuaFunctionDefinitions::SpawnVehicle( pResource->GetLua(), pElement->GetLuaUserdata(), fX, fY, fZ, fRX, fRY, fRZ );
}
return false;
@ -1224,7 +1224,7 @@ bool CMonoFunctions::Vehicle::Respawn( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RespawnVehicle( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::RespawnVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -1238,7 +1238,7 @@ bool CMonoFunctions::Vehicle::SetOverrideLights( TElement pThis, unsigned char u
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleOverrideLights( pResource->GetLua(), pElement->ToLuaUserData(), ucLights );
return CLuaFunctionDefinitions::SetVehicleOverrideLights( pResource->GetLua(), pElement->GetLuaUserdata(), ucLights );
}
return false;
@ -1253,7 +1253,7 @@ bool CMonoFunctions::Vehicle::AttachTrailer( TElement pThis, TElement pTrailer )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pTrailerElement = pResource->GetElementManager()->GetFromList( pTrailer );
return CLuaFunctionDefinitions::AttachTrailerToVehicle( pResource->GetLua(), pElement->ToLuaUserData(), pTrailerElement->ToLuaUserData() );
return CLuaFunctionDefinitions::AttachTrailerToVehicle( pResource->GetLua(), pElement->GetLuaUserdata(), pTrailerElement->GetLuaUserdata() );
}
return false;
@ -1268,7 +1268,7 @@ bool CMonoFunctions::Vehicle::DetachTrailer( TElement pThis, TElement pTrailer )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pTrailerElement = pResource->GetElementManager()->GetFromList( pTrailer );
return CLuaFunctionDefinitions::DetachTrailerFromVehicle( pResource->GetLua(), pElement->ToLuaUserData(), pTrailerElement->ToLuaUserData() );
return CLuaFunctionDefinitions::DetachTrailerFromVehicle( pResource->GetLua(), pElement->GetLuaUserdata(), pTrailerElement->GetLuaUserdata() );
}
return false;
@ -1282,7 +1282,7 @@ bool CMonoFunctions::Vehicle::SetEngineState( TElement pThis, bool bState )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleEngineState( pResource->GetLua(), pElement->ToLuaUserData(), bState );
return CLuaFunctionDefinitions::SetVehicleEngineState( pResource->GetLua(), pElement->GetLuaUserdata(), bState );
}
return false;
@ -1296,7 +1296,7 @@ bool CMonoFunctions::Vehicle::SetDirtLevel( TElement pThis, float fDirtLevel )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleDirtLevel( pResource->GetLua(), pElement->ToLuaUserData(), fDirtLevel );
return CLuaFunctionDefinitions::SetVehicleDirtLevel( pResource->GetLua(), pElement->GetLuaUserdata(), fDirtLevel );
}
return false;
@ -1310,7 +1310,7 @@ bool CMonoFunctions::Vehicle::SetDamageProof( TElement pThis, bool bDamageProof
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleDamageProof( pResource->GetLua(), pElement->ToLuaUserData(), bDamageProof );
return CLuaFunctionDefinitions::SetVehicleDamageProof( pResource->GetLua(), pElement->GetLuaUserdata(), bDamageProof );
}
return false;
@ -1324,7 +1324,7 @@ bool CMonoFunctions::Vehicle::SetPaintjob( TElement pThis, unsigned char ucPaint
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehiclePaintjob( pResource->GetLua(), pElement->ToLuaUserData(), ucPaintjob );
return CLuaFunctionDefinitions::SetVehiclePaintjob( pResource->GetLua(), pElement->GetLuaUserdata(), ucPaintjob );
}
return false;
@ -1338,7 +1338,7 @@ bool CMonoFunctions::Vehicle::SetFuelTankExplodable( TElement pThis, bool bExplo
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleFuelTankExplodable( pResource->GetLua(), pElement->ToLuaUserData(), bExplodable );
return CLuaFunctionDefinitions::SetVehicleFuelTankExplodable( pResource->GetLua(), pElement->GetLuaUserdata(), bExplodable );
}
return false;
@ -1352,7 +1352,7 @@ bool CMonoFunctions::Vehicle::SetTrainDerailed( TElement pThis, bool bDerailed )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTrainDerailed( pResource->GetLua(), pElement->ToLuaUserData(), bDerailed );
return CLuaFunctionDefinitions::SetTrainDerailed( pResource->GetLua(), pElement->GetLuaUserdata(), bDerailed );
}
return false;
@ -1366,7 +1366,7 @@ bool CMonoFunctions::Vehicle::SetTrainDerailable( TElement pThis, bool bDerailab
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTrainDerailable( pResource->GetLua(), pElement->ToLuaUserData(), bDerailable );
return CLuaFunctionDefinitions::SetTrainDerailable( pResource->GetLua(), pElement->GetLuaUserdata(), bDerailable );
}
return false;
@ -1380,7 +1380,7 @@ bool CMonoFunctions::Vehicle::SetTrainDirection( TElement pThis, bool bDireciton
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTrainDirection( pResource->GetLua(), pElement->ToLuaUserData(), bDireciton );
return CLuaFunctionDefinitions::SetTrainDirection( pResource->GetLua(), pElement->GetLuaUserdata(), bDireciton );
}
return false;
@ -1394,7 +1394,7 @@ bool CMonoFunctions::Vehicle::SetTrainSpeed( TElement pThis, float fSpeed )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTrainSpeed( pResource->GetLua(), pElement->ToLuaUserData(), fSpeed );
return CLuaFunctionDefinitions::SetTrainSpeed( pResource->GetLua(), pElement->GetLuaUserdata(), fSpeed );
}
return false;
@ -1406,13 +1406,13 @@ bool CMonoFunctions::Vehicle::SetHeadLightColor( TElement pThis, MonoObject* pCo
if( pResource )
{
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" );
unsigned char ucR1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "R" );
unsigned char ucG1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "G" );
unsigned char ucB1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "B" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleHeadLightColor( pResource->GetLua(), pElement->ToLuaUserData(), ucR1, ucG1, ucB1 );
return CLuaFunctionDefinitions::SetVehicleHeadLightColor( pResource->GetLua(), pElement->GetLuaUserdata(), ucR1, ucG1, ucB1 );
}
return false;
@ -1424,12 +1424,12 @@ bool CMonoFunctions::Vehicle::SetTurretPosition( TElement pThis, MonoObject* pPo
if( pResource )
{
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleTurretPosition( pResource->GetLua(), pElement->ToLuaUserData(), fX, fY );
return CLuaFunctionDefinitions::SetVehicleTurretPosition( pResource->GetLua(), pElement->GetLuaUserdata(), fX, fY );
}
return false;
@ -1443,7 +1443,7 @@ bool CMonoFunctions::Vehicle::SetDoorOpenRatio( TElement pThis, unsigned char uc
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleDoorOpenRatio( pResource->GetLua(), pElement->ToLuaUserData(), ucDoor, fRatio, ulTime );
return CLuaFunctionDefinitions::SetVehicleDoorOpenRatio( pResource->GetLua(), pElement->GetLuaUserdata(), ucDoor, fRatio, ulTime );
}
return false;
@ -1457,7 +1457,7 @@ bool CMonoFunctions::Vehicle::SetVariant( TElement pThis, unsigned char ucVarian
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleVariant( pResource->GetLua(), pElement->ToLuaUserData(), ucVariant, ucVariant2 );
return CLuaFunctionDefinitions::SetVehicleVariant( pResource->GetLua(), pElement->GetLuaUserdata(), ucVariant, ucVariant2 );
}
return false;
@ -1471,7 +1471,7 @@ bool CMonoFunctions::Vehicle::GiveSirens( TElement pThis, unsigned char ucSirenT
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GiveVehicleSirens( pResource->GetLua(), pElement->ToLuaUserData(), ucSirenType, ucSirenCount, bFlag360, bCheckLosFlag, bUseRandomiserFlag, bSilentFlag );
return CLuaFunctionDefinitions::GiveVehicleSirens( pResource->GetLua(), pElement->GetLuaUserdata(), ucSirenType, ucSirenCount, bFlag360, bCheckLosFlag, bUseRandomiserFlag, bSilentFlag );
}
return false;
@ -1485,7 +1485,7 @@ bool CMonoFunctions::Vehicle::RemoveSirens( TElement pThis )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveVehicleSirens( pResource->GetLua(), pElement->ToLuaUserData() );
return CLuaFunctionDefinitions::RemoveVehicleSirens( pResource->GetLua(), pElement->GetLuaUserdata() );
}
return false;
@ -1497,18 +1497,18 @@ bool CMonoFunctions::Vehicle::SetSirens( TElement pThis, unsigned char ucSirenID
if( pResource )
{
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Z" );
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" );
float fRed = SharedUtil::MonoObject::GetPropertyValue< float >( pColor, "R" );
float fGreen = SharedUtil::MonoObject::GetPropertyValue< float >( pColor, "G" );
float fBlue = SharedUtil::MonoObject::GetPropertyValue< float >( pColor, "B" );
float fAlpha = SharedUtil::MonoObject::GetPropertyValue< float >( pColor, "A" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleSirens( pResource->GetLua(), pElement->ToLuaUserData(), ucSirenID, fX, fY, fZ, fRed, fGreen, fBlue, fAlpha, fMinAlpha );
return CLuaFunctionDefinitions::SetVehicleSirens( pResource->GetLua(), pElement->GetLuaUserdata(), ucSirenID, fX, fY, fZ, fRed, fGreen, fBlue, fAlpha, fMinAlpha );
}
return false;
@ -1534,7 +1534,7 @@ bool CMonoFunctions::Vehicle::SetPlateText( TElement pThis, MonoString* msName )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehiclePlateText( pResource->GetLua(), pElement->ToLuaUserData(), szText );
return CLuaFunctionDefinitions::SetVehiclePlateText( pResource->GetLua(), pElement->GetLuaUserdata(), szText );
}
return false;

View File

@ -41,7 +41,7 @@ bool CMonoFunctions::Water::SetLevel( TElement pThis, float fLevel )
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementWaterLevel( pResource->GetLua(), pElement->ToLuaUserData(), fLevel );
return CLuaFunctionDefinitions::SetElementWaterLevel( pResource->GetLua(), pElement->GetLuaUserdata(), fLevel );
}
return false;
@ -93,7 +93,7 @@ MonoObject* CMonoFunctions::Water::GetVertexPosition( TElement pThis, int iVerte
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetWaterVertexPosition( pResource->GetLua(), pElement->ToLuaUserData(), iVertexIndex, vecPosition ) )
if( CLuaFunctionDefinitions::GetWaterVertexPosition( pResource->GetLua(), pElement->GetLuaUserdata(), iVertexIndex, vecPosition ) )
{
return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
}
@ -112,7 +112,7 @@ bool CMonoFunctions::Water::SetVertexPosition( TElement pThis, int iVertexIndex,
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetWaterVertexPosition( pResource->GetLua(), pElement->ToLuaUserData(), iVertexIndex, vecPosition );
return CLuaFunctionDefinitions::SetWaterVertexPosition( pResource->GetLua(), pElement->GetLuaUserdata(), iVertexIndex, vecPosition );
}
return false;
@ -141,7 +141,7 @@ bool CMonoFunctions::Water::SetColor( MonoObject* mColor )
if( pResource )
{
SColor pColor = CMonoObject::GetColor( mColor );
SColor pColor = SharedUtil::MonoObject::GetColor( mColor );
return CLuaFunctionDefinitions::SetWaterColor( pResource->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A );
}

View File

@ -24,7 +24,7 @@ MonoArray* CMonoFunctions::World::GetTime( void )
if( CLuaFunctionDefinitions::GetTime( pResource->GetLua(), ucHour, ucMinute ) )
{
MonoArray* pArray = mono_array_new( pResource->GetDomain()->GetMonoPtr(), mono_get_char_class(), 2 );
MonoArray* pArray = mono_array_new( **pResource->GetDomain(), mono_get_char_class(), 2 );
mono_array_set( pArray, unsigned char, 0, ucHour );
mono_array_set( pArray, unsigned char, 1, ucMinute );
@ -46,7 +46,7 @@ MonoArray* CMonoFunctions::World::GetWeather( void )
if( CLuaFunctionDefinitions::GetWeather( pResource->GetLua(), ucWeather, ucWeatherBlending ) )
{
MonoArray* pArray = mono_array_new( pResource->GetDomain()->GetMonoPtr(), mono_get_char_class(), 2 );
MonoArray* pArray = mono_array_new( **pResource->GetDomain(), mono_get_char_class(), 2 );
mono_array_set( pArray, unsigned char, 0, ucWeather );
mono_array_set( pArray, unsigned char, 1, ucWeatherBlending );
@ -315,7 +315,7 @@ MonoArray* CMonoFunctions::World::GetSunColor( void )
if( pCoreObject && pCoronaObject )
{
MonoArray* pMonoArray = mono_array_new( pResource->GetDomain()->GetMonoPtr(), CMonoObject::GetClass( pCoreObject ), 2 );
MonoArray* pMonoArray = mono_array_new( **pResource->GetDomain(), SharedUtil::MonoObject::GetClass( pCoreObject ), 2 );
mono_array_set( pMonoArray, MonoObject*, 0, pCoreObject );
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject );
@ -442,12 +442,14 @@ MonoArray* CMonoFunctions::World::GetSkyGradient( void )
{
pCore.A = pCorona.A = 255;
MonoObject* pCoreObject = pResource->GetDomain()->GetMTALib()->Color->New( pCore );
MonoObject* pCoronaObject = pResource->GetDomain()->GetMTALib()->Color->New( pCorona );
CMonoClass* pColorClass = pResource->GetDomain()->GetMTALib()->Color;
MonoObject* pCoreObject = pColorClass->New( pCore );
MonoObject* pCoronaObject = pColorClass->New( pCorona );
if( pCoreObject && pCoronaObject )
{
MonoArray* pMonoArray = mono_array_new( pResource->GetDomain()->GetMonoPtr(), CMonoObject::GetClass( pCoreObject ), 2 );
MonoArray* pMonoArray = mono_array_new( **pResource->GetDomain(), **pColorClass, 2 );
mono_array_set( pMonoArray, MonoObject*, 0, pCoreObject );
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject );
@ -586,8 +588,8 @@ bool CMonoFunctions::World::SetSkyGradient( MonoObject* pTopColor, MonoObject* p
if( pResource )
{
SColor pTop = CMonoObject::GetColor( pTopColor );
SColor pBottom = CMonoObject::GetColor( pBottomColor );
SColor pTop = SharedUtil::MonoObject::GetColor( pTopColor );
SColor pBottom = SharedUtil::MonoObject::GetColor( pBottomColor );
return CLuaFunctionDefinitions::SetSkyGradient( pResource->GetLua(), pTop.R, pTop.G, pTop.B, pBottom.R, pBottom.G, pBottom.B );
}
@ -615,15 +617,15 @@ bool CMonoFunctions::World::SetHeatHaze( MonoObject* heatHazeSettings )
{
SHeatHazeSettings pHeatHazeSettings;
pHeatHazeSettings.ucIntensity = CMonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucIntensity" );
pHeatHazeSettings.ucRandomShift = CMonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucRandomShift" );
pHeatHazeSettings.usSpeedMin = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMin" );
pHeatHazeSettings.usSpeedMax = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMax" );
pHeatHazeSettings.sScanSizeX = CMonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeX" );
pHeatHazeSettings.sScanSizeY = CMonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeY" );
pHeatHazeSettings.usRenderSizeX = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeX" );
pHeatHazeSettings.usRenderSizeY = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeY" );
pHeatHazeSettings.bInsideBuilding = CMonoObject::GetPropertyValue< bool >( heatHazeSettings, "bInsideBuilding" );
pHeatHazeSettings.ucIntensity = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucIntensity" );
pHeatHazeSettings.ucRandomShift = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucRandomShift" );
pHeatHazeSettings.usSpeedMin = SharedUtil::MonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMin" );
pHeatHazeSettings.usSpeedMax = SharedUtil::MonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMax" );
pHeatHazeSettings.sScanSizeX = SharedUtil::MonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeX" );
pHeatHazeSettings.sScanSizeY = SharedUtil::MonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeY" );
pHeatHazeSettings.usRenderSizeX = SharedUtil::MonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeX" );
pHeatHazeSettings.usRenderSizeY = SharedUtil::MonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeY" );
pHeatHazeSettings.bInsideBuilding = SharedUtil::MonoObject::GetPropertyValue< bool >( heatHazeSettings, "bInsideBuilding" );
return CLuaFunctionDefinitions::SetHeatHaze( pResource->GetLua(), pHeatHazeSettings );
}
@ -809,8 +811,8 @@ bool CMonoFunctions::World::SetSunColor( MonoObject* pCoreColor, MonoObject* pCo
if( pResource )
{
SColor pTop = CMonoObject::GetColor( pCoreColor );
SColor pBottom = CMonoObject::GetColor( pCoronaColor );
SColor pTop = SharedUtil::MonoObject::GetColor( pCoreColor );
SColor pBottom = SharedUtil::MonoObject::GetColor( pCoronaColor );
return CLuaFunctionDefinitions::SetSunColor( pResource->GetLua(), pTop.R, pTop.G, pTop.B, pBottom.R, pBottom.G, pBottom.B );
}

View File

@ -17,46 +17,46 @@ CMonoGC::CMonoGC( void )
{
}
void CMonoGC::Collect( int generation )
void CMonoGC::Collect( int iGeneration )
{
mono_gc_collect( generation );
mono_gc_collect( iGeneration );
}
unsigned int CMonoGC::Hold( MonoObject* obj )
unsigned int CMonoGC::Hold( MonoObject* pObject )
{
if( obj )
if( pObject )
{
mono_gchandle_new_weakref( reinterpret_cast< MonoObject* >( obj ), false );
return mono_gchandle_new_weakref( pObject, false );
}
return -1;
}
unsigned int CMonoGC::HoldWithHope( MonoObject* obj )
unsigned int CMonoGC::HoldWithHope( MonoObject* pObject )
{
if( obj )
if( pObject )
{
return mono_gchandle_new_weakref( reinterpret_cast< MonoObject* >( obj ), true );
return mono_gchandle_new_weakref( pObject, true );
}
return -1;
}
unsigned int CMonoGC::Keep( MonoObject* obj )
unsigned int CMonoGC::Keep( MonoObject* pObject )
{
if( obj )
if( pObject )
{
return mono_gchandle_new( reinterpret_cast< MonoObject* >( obj ), false );
return mono_gchandle_new( pObject, false );
}
return -1;
}
unsigned int CMonoGC::Pin( MonoObject* obj )
unsigned int CMonoGC::Pin( MonoObject* pObject )
{
if( obj )
if( pObject )
{
return mono_gchandle_new( reinterpret_cast< MonoObject* >( obj ), true );
return mono_gchandle_new( pObject, true );
}
return -1;
@ -72,12 +72,12 @@ int64 CMonoGC::GetHeapSize()
return mono_gc_get_heap_size();
}
void CMonoGC::ReleaseGCHandle( unsigned int handle )
void CMonoGC::ReleaseGCHandle( unsigned int uiHandle )
{
mono_gchandle_free( handle );
mono_gchandle_free( uiHandle );
}
MonoObject* CMonoGC::GetGCHandleTarget( unsigned int handle )
MonoObject* CMonoGC::GetGCHandleTarget( unsigned int uiHandle )
{
return mono_gchandle_get_target( handle );
return mono_gchandle_get_target( uiHandle );
}

View File

@ -20,17 +20,17 @@ class CMonoGC
public:
CMonoGC ( void );
void Collect ( int generation = -1 );
void Collect ( int iGeneration = -1 );
unsigned int Hold ( MonoObject* obj );
unsigned int HoldWithHope ( MonoObject* obj );
unsigned int Keep ( MonoObject* obj );
unsigned int Pin ( MonoObject* obj );
unsigned int Hold ( MonoObject* pObject );
unsigned int HoldWithHope ( MonoObject* pObject );
unsigned int Keep ( MonoObject* pObject );
unsigned int Pin ( MonoObject* pObject );
int GetMaxGeneration ( void );
int64 GetHeapSize ( void );
void ReleaseGCHandle ( unsigned int handle );
MonoObject* GetGCHandleTarget ( unsigned int handle );
void ReleaseGCHandle ( unsigned int uiHandle );
MonoObject* GetGCHandleTarget ( unsigned int uiHandle );
};
#endif

View File

@ -24,6 +24,17 @@ CMonoInterface::CMonoInterface( CModule* pModule )
mono_set_signal_chaining( false );
char* szOptions[] =
{
// "--llvm",
"--soft-breakpoints",
"--stats",
// "--breakonex",
// "--debugger-agent=transport=dt_socket,address=127.0.0.1:10000,server=y,embedding=1",
};
mono_jit_parse_options( sizeof( szOptions ) / sizeof( char* ), szOptions );
mono_debug_init( MONO_DEBUG_FORMAT_MONO );
#if _DEBUG
@ -32,12 +43,12 @@ CMonoInterface::CMonoInterface( CModule* pModule )
mono_trace_set_level_string( "critical" );
#endif
mono_trace_set_print_handler( CMonoInterface::MonoPrintCallbackHandler );
mono_trace_set_printerr_handler( CMonoInterface::MonoPrintErrorCallbackHandler );
mono_trace_set_print_handler( MonoPrintCallbackHandler );
mono_trace_set_printerr_handler( MonoPrintErrorCallbackHandler );
this->m_pMonoDomain = mono_jit_init_version( "mono_root_domain", "v4.0.30319" );
CMonoInterface::m_pMTALib = mono_assembly_open_full( "mods/deathmatch/mono/lib/MultiTheftAuto.dll", nullptr, false );
m_pMTALib = mono_assembly_open_full( "mods/deathmatch/mono/lib/MultiTheftAuto.dll", nullptr, false );
CMonoFunctions::AddInternals();
@ -215,7 +226,7 @@ CLuaArguments CMonoInterface::MonoArrayToLuaArguments( MonoArray* pArray, CResou
{
CElement* pElement = pResource->GetElementManager()->GetFromList( pObj );
PVOID pValue = pElement->ToLuaUserData();
PVOID pValue = pElement->GetLuaUserdata();
if( pValue )
{
@ -247,7 +258,7 @@ CLuaArguments CMonoInterface::MonoArrayToLuaArguments( MonoArray* pArray, CResou
MonoAssembly* CMonoInterface::GetMTALib( void )
{
return CMonoInterface::m_pMTALib;
return m_pMTALib;
}
void CMonoInterface::MonoPrintCallbackHandler( const char *string, mono_bool is_stdout )

View File

@ -38,12 +38,12 @@ CMonoMTALib::~CMonoMTALib( void )
this->m_pImage = nullptr;
}
CMonoClass* CMonoMTALib::GetClass( const char* szName )
CMonoClass* CMonoMTALib::GetClass( const char* szName ) const
{
return this->GetDomain()->FindOrAdd( mono_class_from_name( this->m_pImage, "MultiTheftAuto", szName ) );
}
CMonoClass* CMonoMTALib::GetClass( const char* szNameSpace, const char* szName )
CMonoClass* CMonoMTALib::GetClass( const char* szNameSpace, const char* szName ) const
{
char szBuffer[ 128 ];

View File

@ -33,10 +33,10 @@ public:
CMonoMTALib ( CMonoDomain* pDomain );
~CMonoMTALib ( void );
CMonoClass* GetClass ( const char* szName );
CMonoClass* GetClass ( const char* szNameSpace, const char* szName );
CMonoClass* GetClass ( const char* szName ) const;
CMonoClass* GetClass ( const char* szNameSpace, const char* szName ) const;
CMonoDomain* GetDomain ( void ) { return this->m_pDomain; }
inline CMonoDomain* GetDomain ( void ) const { return this->m_pDomain; }
};
#endif

View File

@ -62,7 +62,9 @@ void CMonoMethod::ParseSignature( void )
}
}
MonoObject* CMonoMethod::Invoke( PVOID pObject, PVOID* params, MonoObject** pException )
MonoObject* CMonoMethod::Invoke( PVOID pObject, PVOID* params, MonoObject** pException ) const
{
this->m_pClass->GetDomain()->Set( false );
return mono_runtime_invoke( this->m_pMethod, pObject, params, pException );
}

View File

@ -44,15 +44,16 @@ public:
CMonoMethod ( CMonoClass* pClass, MonoMethod* pMethod );
~CMonoMethod ( void );
MonoObject* Invoke ( PVOID pObject, PVOID* params, MonoObject** pException );
MonoObject* Invoke ( PVOID pObject, PVOID* params, MonoObject** pException ) const;
string GetSignature ( void ) { return this->m_strSignature; }
vector< SMonoType > GetArguments ( void ) { return this->m_ArgList; }
inline string GetSignature ( void ) const { return this->m_strSignature; }
inline vector< SMonoType > GetArguments ( void ) const { return this->m_ArgList; }
MonoMethod* GetMonoPtr ( void ) { return this->m_pMethod; }
CMonoClass* GetMonoClass ( void ) { return this->m_pClass; }
inline CMonoClass* GetMonoClass ( void ) const { return this->m_pClass; }
string GetName ( void ) { return this->m_strName; }
inline string GetName ( void ) const { return this->m_strName; }
inline MonoMethod* operator * ( void ) const { return this->m_pMethod; }
};
#endif

View File

@ -1,66 +0,0 @@
/*********************************************************
*
* 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 "StdInc.h"
#include "CMonoObject.h"
MonoClass* CMonoObject::GetClass( MonoObject* pObject )
{
return mono_object_get_class( pObject );
}
MonoObject* CMonoObject::GetPropertyValue( MonoObject* pObject, const char* szPropertyName )
{
MonoClass* pMonoClass = mono_object_get_class( pObject );
MonoProperty* pMonoProperty = mono_class_get_property_from_name( pMonoClass, szPropertyName );
if( !pMonoProperty )
{
return nullptr;
}
return mono_property_get_value( pMonoProperty, pObject, NULL, NULL );
}
bool CMonoObject::SetPropertyValue( MonoObject* pObject, const char* szPropertyName, int iValue )
{
return CMonoObject::SetPropertyValue( pObject, szPropertyName, (void*)&iValue );
}
bool CMonoObject::SetPropertyValue( MonoObject* pObject, const char* szPropertyName, float fValue )
{
return CMonoObject::SetPropertyValue( pObject, szPropertyName, (void*)&fValue );
}
bool CMonoObject::SetPropertyValue( MonoObject* pObject, const char* szPropertyName, char* szValue )
{
return CMonoObject::SetPropertyValue( pObject, szPropertyName, mono_string_new( mono_domain_get(), szValue ) );
}
bool CMonoObject::SetPropertyValue( MonoObject* pObject, const char* szPropertyName, PVOID gValue )
{
MonoClass* pMonoClass = mono_object_get_class( pObject );
MonoProperty* pMonoProperty = mono_class_get_property_from_name( pMonoClass, szPropertyName );
if( !pMonoProperty )
{
return false;
}
PVOID args[ 1 ] = { gValue };
mono_property_set_value( pMonoProperty, pObject, args, NULL );
return true;
}

View File

@ -1,77 +0,0 @@
/*********************************************************
*
* 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 CMonoObject;
#ifndef _C_MONO_OBJECT
#define _C_MONO_OBJECT
#include "Common.h"
class CMonoObject
{
public:
static MonoClass* GetClass( MonoObject* pMonoObject );
static bool SetPropertyValue( MonoObject* pMonoObject, const char* szPropertyName, int iValue );
static bool SetPropertyValue( MonoObject* pMonoObject, const char* szPropertyName, float fValue );
static bool SetPropertyValue( MonoObject* pMonoObject, const char* szPropertyName, char* szValue );
static bool SetPropertyValue( MonoObject* pMonoObject, const char* szPropertyName, PVOID gValue );
static MonoObject* GetPropertyValue( MonoObject* pMonoObject, const char* szPropertyName );
static SColor GetColor( MonoObject* pMonoObject )
{
SColor pColor;
pColor.R = GetPropertyValue< unsigned char >( pMonoObject, "R" );
pColor.G = GetPropertyValue< unsigned char >( pMonoObject, "G" );
pColor.B = GetPropertyValue< unsigned char >( pMonoObject, "B" );
pColor.A = GetPropertyValue< unsigned char >( pMonoObject, "A" );
return pColor;
}
template< class T >
static T GetPropertyValue( MonoObject* pMonoObject, const char* szPropertyName )
{
return *( reinterpret_cast<T*>( mono_object_unbox( GetPropertyValue( pMonoObject, szPropertyName ) ) ) );
}
static PVOID GetValue( MonoObject* pMonoObject )
{
return mono_object_unbox( pMonoObject );
}
template< class T >
static T GetValue( MonoObject* pMonoObject )
{
return *( reinterpret_cast< T* >( mono_object_unbox( pMonoObject ) ) );
}
inline static char* ToString( MonoObject* pMonoObject )
{
MonoClass* pClass = mono_object_get_class( pMonoObject );
ASSERT( pClass );
MonoMethod* pMethod = mono_class_get_method_from_name( pClass, "ToString", 0 );
ASSERT( pMethod );
MonoString* pString = (MonoString*)mono_runtime_invoke( pMethod, pMonoObject, nullptr, nullptr );
return mono_string_to_utf8( pString );
}
};
#endif

View File

@ -160,7 +160,7 @@ void CRegisteredCommands::Invoke( CElement* pPlayer, MonoObject* pDelegate, cons
assert( pCorlib );
MonoString* pCommandName = this->m_pResource->GetDomain()->NewString( strCommandName );
MonoArray* pArguments = mono_array_new( this->m_pResource->GetDomain()->GetMonoPtr(), pCorlib->Class[ "string" ]->GetMonoPtr(), argv.size() );
MonoArray* pArguments = mono_array_new( **this->m_pResource->GetDomain(), **pCorlib->Class[ "string" ], argv.size() );
uint index = 0;
@ -171,10 +171,12 @@ void CRegisteredCommands::Invoke( CElement* pPlayer, MonoObject* pDelegate, cons
PVOID* params = new PVOID[ 3 ];
params[ 0 ] = pPlayer->ToMonoObject();
params[ 0 ] = pPlayer->GetMonoObject();
params[ 1 ] = pCommandName;
params[ 2 ] = pArguments;
this->m_pResource->GetDomain()->Set( false );
MonoObject* pException = nullptr;
mono_runtime_delegate_invoke( pDelegate, params, &pException );

View File

@ -32,8 +32,6 @@ CResource::~CResource( void )
{
this->RemoveEvents();
this->GetMono()->GetGC()->Collect( this->GetMono()->GetGC()->GetMaxGeneration() );
SAFE_DELETE( this->m_pRegisteredCommands );
SAFE_DELETE( this->m_pEventManager );
SAFE_DELETE( this->m_pElementManager );
@ -63,9 +61,9 @@ bool CResource::CallEvent( const string& strEventName, PVOID pThis, list< CLuaAr
{
CElement* pSource = nullptr;
auto *iter = *argv.begin();
const auto& iter = *argv.begin();
if( iter->GetType() == LUA_TLIGHTUSERDATA )
if( iter->GetType() == eLuaType::LightUserdata )
{
pSource = this->m_pElementManager->GetFromList( iter->GetLightUserData() );
}
@ -156,7 +154,7 @@ void CResource::RemoveEvents( void )
if( pClass )
{
for( auto iter : pClass->GetAllEvents() )
for( const auto& iter : pClass->GetAllEvents() )
{
string strEventName = iter.second->GetName();

View File

@ -96,7 +96,7 @@ CResource* CResourceManager::GetFromList( MonoDomain* pDomain )
{
for( const auto& iter : this->m_List )
{
if( iter->GetDomain()->GetMonoPtr() == pDomain )
if( **iter->GetDomain() == pDomain )
{
return iter;
}

View File

@ -1,362 +0,0 @@
/*********************************************************
*
* Multi Theft Auto: San Andreas - Deathmatch
*
* ml_base, External lua add-on module
*
* Copyright © 2003-2008 MTA. All Rights Reserved.
*
* Grand Theft Auto is © 2002-2003 Rockstar North
*
* THE FOLLOWING SOURCES ARE PART OF THE MULTI THEFT
* AUTO SOFTWARE DEVELOPMENT KIT AND ARE RELEASED AS
* OPEN SOURCE FILES. THESE FILES MAY BE USED AS LONG
* AS THE DEVELOPER AGREES TO THE LICENSE THAT IS
* PROVIDED WITH THIS PACKAGE.
*
*********************************************************/
using namespace std;
#ifndef __COMMON_H
#define __COMMON_H
typedef unsigned long ulong; // 32 32 64
typedef unsigned int uint; // 32
typedef unsigned short ushort; // 16
typedef unsigned char uchar; // 8
typedef unsigned long long uint64; // 64
typedef unsigned int uint32; // 32
typedef unsigned short uint16; // 16
typedef unsigned char uint8; // 8
// signed types
typedef signed long long int64; // 64
typedef signed int int32; // 32
typedef signed short int16; // 16
typedef signed char int8; // 8
// Windowsesq types
typedef unsigned char BYTE; // 8
typedef unsigned short WORD; // 16
typedef unsigned long DWORD; // 32 32 64
typedef float FLOAT; // 32
typedef void* PVOID;
#ifndef NUMELMS // from DShow.h
#define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
#endif
// used in the function argument vector
#define MAX_ARGUMENTS 10
struct FunctionArguments
{
lua_State* luaVM;
unsigned char nArguments;
unsigned char Type[10];
void* Arguments[10];
};
namespace FunctionArgumentType
{
enum
{
TYPE_NUMBER = 1,
TYPE_STRING = 2,
TYPE_LIGHTUSERDATA = 3,
TYPE_BOOLEAN = 4,
TYPE_NIL = 5,
TYPE_TABLE = 6
};
}
//
// Some templates
//
template < class T >T Min ( const T& a, const T& b )
{
return a < b ? a : b;
}
template < class T >T Max ( const T& a, const T& b )
{
return a > b ? a : b;
}
// Clamps a value between two other values ( min < a < max )
template< class T >T Clamp ( const T& min, const T& a, const T& max )
{
return a < min ? min : a > max ? max : a;
}
// Lerps between two values depending on the weight
template< class T >T Lerp ( const T& from, float fAlpha, const T& to )
{
return (T)( ( to - from ) * fAlpha + from );
}
// Find the relative position of Pos between From and To
inline const float Unlerp( const double dFrom, const double dPos, const double dTo )
{
// Avoid dividing by 0 (results in INF values)
if ( dFrom == dTo ) return 1.0f;
return static_cast< float >( ( dPos - dFrom ) / ( dTo - dFrom ) );
}
// Unlerp avoiding extrapolation
inline const float UnlerpClamped( const double dFrom, const double dPos, const double dTo )
{
return Clamp( 0.0f, Unlerp( dFrom, dPos, dTo ), 1.0f );
}
template < class T > int Round ( T value )
{
return static_cast< int >( floor( value + 0.5f ) );
}
template < class T > T WrapAround ( T fLow, T fValue, T fHigh )
{
const T fSize = fHigh - fLow;
return fValue - ( fSize * floor( ( fValue - fLow ) / fSize ) );
}
//
// SColor
//
// Encapsulates the most common usage of 4 byte color storage.
// Casts to and from a DWORD as 0xAARRGGBB
//
class SColor
{
// No shifting allowed to access the color channel information
void operator >> ( int ) const;
void operator << ( int ) const;
void operator >>= ( int );
void operator <<= ( int );
public:
union
{
struct
{
unsigned char B, G, R, A;
};
unsigned long ulARGB;
};
SColor() {}
SColor( unsigned long ulValue )
{
ulARGB = ulValue;
}
operator unsigned long() const
{
return ulARGB;
}
};
//
// SColorARGB
//
// Make an SColor from A,R,G,B
//
class SColorARGB : public SColor
{
public:
SColorARGB( unsigned char ucA, unsigned char ucR, unsigned char ucG, unsigned char ucB )
{
A = ucA;
R = ucR;
G = ucG;
B = ucB;
}
template < class T, class U, class V, class W >
SColorARGB ( T a, U r, V g, W b )
{
A = Clamp < unsigned char >( 0, static_cast <unsigned char> ( a ), 255 );
R = Clamp < unsigned char >( 0, static_cast <unsigned char> ( r ), 255 );
G = Clamp < unsigned char >( 0, static_cast <unsigned char> ( g ), 255 );
B = Clamp < unsigned char >( 0, static_cast <unsigned char> ( b ), 255 );
}
};
//
// SColorRGBA
//
// Make an SColor from R,G,B,A
//
class SColorRGBA : public SColor
{
public:
SColorRGBA ( unsigned char ucR, unsigned char ucG, unsigned char ucB, unsigned char ucA )
{
A = ucA; R = ucR; G = ucG; B = ucB;
}
template < class T, class U, class V, class W >
SColorRGBA ( T r, U g, V b, W a )
{
A = Clamp < unsigned char > ( 0, static_cast < unsigned char > ( a ), 255 );
R = Clamp < unsigned char > ( 0, static_cast < unsigned char > ( r ), 255 );
G = Clamp < unsigned char > ( 0, static_cast < unsigned char > ( g ), 255 );
B = Clamp < unsigned char > ( 0, static_cast < unsigned char > ( b ), 255 );
}
};
//
// Things to make it simpler to use SColor with the source code as it stands
//
typedef SColor RGBA;
inline unsigned char COLOR_RGBA_R ( SColor color ) { return color.R; }
inline unsigned char COLOR_RGBA_G ( SColor color ) { return color.G; }
inline unsigned char COLOR_RGBA_B ( SColor color ) { return color.B; }
inline unsigned char COLOR_RGBA_A ( SColor color ) { return color.A; }
inline unsigned char COLOR_ARGB_A ( SColor color ) { return color.A; }
inline SColor COLOR_RGBA ( unsigned char R, unsigned char G, unsigned char B, unsigned char A ) { return SColorRGBA ( R, G, B, A ); }
inline SColor COLOR_ARGB ( unsigned char A, unsigned char R, unsigned char G, unsigned char B ) { return SColorRGBA ( R, G, B, A ); }
inline SColor COLOR_ABGR ( unsigned char A, unsigned char B, unsigned char G, unsigned char R ) { return SColorRGBA ( R, G, B, A ); }
class CVehicleColor
{
public:
CVehicleColor ( void );
void SetRGBColors ( SColor color1, SColor color2, SColor color3, SColor color4 );
void SetPaletteColors ( uchar ucColor1, uchar ucColor2, uchar ucColor3, uchar ucColor4 );
void SetRGBColor ( uint uiSlot, SColor color );
void SetPaletteColor ( uint uiSlot, uchar ucColor );
SColor GetRGBColor ( uint uiSlot );
uchar GetPaletteColor ( uint uiSlot );
int GetNumColorsUsed ( void );
static uchar GetPaletteIndexFromRGB ( SColor color );
static SColor GetRGBFromPaletteIndex ( uchar ucColor );
protected:
void InvalidatePaletteColors ( void );
void ValidatePaletteColors ( void );
void InvalidateRGBColors ( void );
void ValidateRGBColors ( void );
SColor m_RGBColors[4];
uchar m_ucPaletteColors[4];
bool m_bPaletteColorsWrong;
bool m_bRGBColorsWrong;
};
struct SHeatHazeSettings
{
SHeatHazeSettings( void )
: ucIntensity( 0 )
, ucRandomShift( 0 )
, usSpeedMin( 1 )
, usSpeedMax( 1 )
, sScanSizeX( 1 )
, sScanSizeY( 1 )
, usRenderSizeX( 1 )
, usRenderSizeY( 1 )
, bInsideBuilding( false )
{}
unsigned char ucIntensity; // 0 to 255
unsigned char ucRandomShift; // 0 to 255
unsigned short usSpeedMin; // 0 to 1000
unsigned short usSpeedMax; // 0 to 1000
short sScanSizeX; // -1000 to 1000
short sScanSizeY; // -1000 to 1000
unsigned short usRenderSizeX; // 0 to 1000
unsigned short usRenderSizeY; // 0 to 1000
bool bInsideBuilding;
};
enum eWeaponType
{
WEAPONTYPE_UNARMED=0,
WEAPONTYPE_BRASSKNUCKLE,
WEAPONTYPE_GOLFCLUB,
WEAPONTYPE_NIGHTSTICK,
WEAPONTYPE_KNIFE,
WEAPONTYPE_BASEBALLBAT,
WEAPONTYPE_SHOVEL,
WEAPONTYPE_POOL_CUE,
WEAPONTYPE_KATANA,
WEAPONTYPE_CHAINSAW,
// gifts
WEAPONTYPE_DILDO1, // 10
WEAPONTYPE_DILDO2,
WEAPONTYPE_VIBE1,
WEAPONTYPE_VIBE2,
WEAPONTYPE_FLOWERS,
WEAPONTYPE_CANE,
WEAPONTYPE_GRENADE,
WEAPONTYPE_TEARGAS,
WEAPONTYPE_MOLOTOV,
WEAPONTYPE_ROCKET,
WEAPONTYPE_ROCKET_HS, // 20
WEAPONTYPE_FREEFALL_BOMB,
// FIRST SKILL WEAPON
WEAPONTYPE_PISTOL, // handguns
WEAPONTYPE_PISTOL_SILENCED,
WEAPONTYPE_DESERT_EAGLE,
WEAPONTYPE_SHOTGUN, // shotguns
WEAPONTYPE_SAWNOFF_SHOTGUN, // one handed
WEAPONTYPE_SPAS12_SHOTGUN,
WEAPONTYPE_MICRO_UZI, // submachine guns
WEAPONTYPE_MP5,
WEAPONTYPE_AK47, // 30 // machine guns
WEAPONTYPE_M4,
WEAPONTYPE_TEC9, // this uses stat from the micro_uzi
// END SKILL WEAPONS
WEAPONTYPE_COUNTRYRIFLE, // rifles
WEAPONTYPE_SNIPERRIFLE,
WEAPONTYPE_ROCKETLAUNCHER, // specials
WEAPONTYPE_ROCKETLAUNCHER_HS,
WEAPONTYPE_FLAMETHROWER,
WEAPONTYPE_MINIGUN,
WEAPONTYPE_REMOTE_SATCHEL_CHARGE,
WEAPONTYPE_DETONATOR, // 40 // plastic explosive
WEAPONTYPE_SPRAYCAN,
WEAPONTYPE_EXTINGUISHER,
WEAPONTYPE_CAMERA,
WEAPONTYPE_NIGHTVISION,
WEAPONTYPE_INFRARED,
WEAPONTYPE_PARACHUTE,
WEAPONTYPE_LAST_WEAPONTYPE,
WEAPONTYPE_ARMOUR,
// these are possible ways to die
WEAPONTYPE_RAMMEDBYCAR,
WEAPONTYPE_RUNOVERBYCAR, // 50
WEAPONTYPE_EXPLOSION,
WEAPONTYPE_UZI_DRIVEBY,
WEAPONTYPE_DROWNING,
WEAPONTYPE_FALL,
WEAPONTYPE_UNIDENTIFIED, // Used for damage being done
WEAPONTYPE_ANYMELEE,
WEAPONTYPE_ANYWEAPON,
WEAPONTYPE_FLARE,
// Added by us
WEAPONTYPE_TANK_GRENADE,
};
#endif

View File

@ -1,6 +1,6 @@
AM_CPPFLAGS=-I. -I./include -I../vendor/lua51/src -I../vendor/eglib/src -I/usr/include/mono-2.0
AM_CPPFLAGS=-I. -I./include -I../vendor/lua51/src -I/usr/include/mono-2.0
SUBDIRS = extra lua
SUBDIRS = extra lua SharedUtil
lib_LTLIBRARIES=libmta_mono.la
@ -8,6 +8,7 @@ libmta_mono_la_SOURCES = \
CEvent.cpp \
CEventManager.cpp \
CFunctions.cpp \
CMonoArguments \
CMonoClass.cpp \
CMonoCorlib.cpp \
CMonoDomain.cpp \
@ -37,7 +38,6 @@ libmta_mono_la_SOURCES = \
CMonoMethod.cpp \
CMonoMTALib.cpp \
CMonoObject.cpp \
Common.cpp \
CRegisteredCommands.cpp \
CResource.cpp \
CResourceManager.cpp \

View File

@ -0,0 +1,6 @@
AM_CPPFLAGS=-I. -I.. -I../include -I../../vendor/lua51/src -I/usr/include/mono-2.0
noinst_LIBRARIES=libmta_mono_sharedutil.a
libmta_mono_sharedutil_a_SOURCES = \
SharedUtil.MonoObject.cpp

View File

@ -0,0 +1,37 @@
#ifndef __SHAREDUTIL_MONOOBJECT_H
#define __SHAREDUTIL_MONOOBJECT_H
namespace SharedUtil
{
namespace MonoObject
{
_MonoClass* GetClass( _MonoObject* pMonoObject );
SColor GetColor( _MonoObject* pMonoObject );
bool SetPropertyValue( _MonoObject* pMonoObject, const char* szPropertyName, int iValue );
bool SetPropertyValue( _MonoObject* pMonoObject, const char* szPropertyName, float fValue );
bool SetPropertyValue( _MonoObject* pMonoObject, const char* szPropertyName, char* szValue );
bool SetPropertyValue( _MonoObject* pMonoObject, const char* szPropertyName, PVOID pValue );
_MonoObject* GetPropertyValue( _MonoObject* pMonoObject, const char* szPropertyName );
template< typename T >
static T GetPropertyValue( _MonoObject* pMonoObject, const char* szPropertyName )
{
return *( reinterpret_cast< T* >( mono_object_unbox( GetPropertyValue( pMonoObject, szPropertyName ) ) ) );
}
template< typename T >
static T Unbox( _MonoObject* pMonoObject )
{
return *( reinterpret_cast< T* >( mono_object_unbox( pMonoObject ) ) );
}
PVOID Unbox( _MonoObject* pMonoObject );
char* ToString( _MonoObject* pMonoObject );
}
}
#endif

View File

@ -0,0 +1,160 @@
#include "SharedUtil.MonoObject.h"
#ifndef __SHAREDUTIL_H
#define __SHAREDUTIL_H
template< typename T >
T Min( const T& a, const T& b )
{
return a < b ? a : b;
}
template< typename T >
T Max( const T& a, const T& b )
{
return a > b ? a : b;
}
template< typename T >
T Clamp( const T& min, const T& a, const T& max )
{
return a < min ? min : a > max ? max : a;
}
template< typename T >
T Lerp( const T& from, float fAlpha, const T& to )
{
return (T)( ( to - from ) * fAlpha + from );
}
inline const float Unlerp( const double dFrom, const double dPos, const double dTo )
{
if( dFrom == dTo )
{
return 1.0f;
}
return static_cast< float >( ( dPos - dFrom ) / ( dTo - dFrom ) );
}
inline const float UnlerpClamped( const double dFrom, const double dPos, const double dTo )
{
return Clamp( 0.0f, Unlerp( dFrom, dPos, dTo ), 1.0f );
}
template < typename T >
int Round( T value )
{
return static_cast< int >( floor( value + 0.5f ) );
}
template < typename T > T
WrapAround( T fLow, T fValue, T fHigh )
{
const T fSize = fHigh - fLow;
return fValue - ( fSize * floor( ( fValue - fLow ) / fSize ) );
}
struct SHeatHazeSettings
{
SHeatHazeSettings( void )
: ucIntensity( 0 ),
ucRandomShift( 0 ),
usSpeedMin( 1 ),
usSpeedMax( 1 ),
sScanSizeX( 1 ),
sScanSizeY( 1 ),
usRenderSizeX( 1 ),
usRenderSizeY( 1 ),
bInsideBuilding( false )
{
}
unsigned char ucIntensity; // 0 to 255
unsigned char ucRandomShift; // 0 to 255
unsigned short usSpeedMin; // 0 to 1000
unsigned short usSpeedMax; // 0 to 1000
short sScanSizeX; // -1000 to 1000
short sScanSizeY; // -1000 to 1000
unsigned short usRenderSizeX; // 0 to 1000
unsigned short usRenderSizeY; // 0 to 1000
bool bInsideBuilding;
};
enum eWeaponType
{
WEAPONTYPE_UNARMED=0,
WEAPONTYPE_BRASSKNUCKLE,
WEAPONTYPE_GOLFCLUB,
WEAPONTYPE_NIGHTSTICK,
WEAPONTYPE_KNIFE,
WEAPONTYPE_BASEBALLBAT,
WEAPONTYPE_SHOVEL,
WEAPONTYPE_POOL_CUE,
WEAPONTYPE_KATANA,
WEAPONTYPE_CHAINSAW,
// gifts
WEAPONTYPE_DILDO1, // 10
WEAPONTYPE_DILDO2,
WEAPONTYPE_VIBE1,
WEAPONTYPE_VIBE2,
WEAPONTYPE_FLOWERS,
WEAPONTYPE_CANE,
WEAPONTYPE_GRENADE,
WEAPONTYPE_TEARGAS,
WEAPONTYPE_MOLOTOV,
WEAPONTYPE_ROCKET,
WEAPONTYPE_ROCKET_HS, // 20
WEAPONTYPE_FREEFALL_BOMB,
// FIRST SKILL WEAPON
WEAPONTYPE_PISTOL, // handguns
WEAPONTYPE_PISTOL_SILENCED,
WEAPONTYPE_DESERT_EAGLE,
WEAPONTYPE_SHOTGUN, // shotguns
WEAPONTYPE_SAWNOFF_SHOTGUN, // one handed
WEAPONTYPE_SPAS12_SHOTGUN,
WEAPONTYPE_MICRO_UZI, // submachine guns
WEAPONTYPE_MP5,
WEAPONTYPE_AK47, // 30 // machine guns
WEAPONTYPE_M4,
WEAPONTYPE_TEC9, // this uses stat from the micro_uzi
// END SKILL WEAPONS
WEAPONTYPE_COUNTRYRIFLE, // rifles
WEAPONTYPE_SNIPERRIFLE,
WEAPONTYPE_ROCKETLAUNCHER, // specials
WEAPONTYPE_ROCKETLAUNCHER_HS,
WEAPONTYPE_FLAMETHROWER,
WEAPONTYPE_MINIGUN,
WEAPONTYPE_REMOTE_SATCHEL_CHARGE,
WEAPONTYPE_DETONATOR, // 40 // plastic explosive
WEAPONTYPE_SPRAYCAN,
WEAPONTYPE_EXTINGUISHER,
WEAPONTYPE_CAMERA,
WEAPONTYPE_NIGHTVISION,
WEAPONTYPE_INFRARED,
WEAPONTYPE_PARACHUTE,
WEAPONTYPE_LAST_WEAPONTYPE,
WEAPONTYPE_ARMOUR,
// these are possible ways to die
WEAPONTYPE_RAMMEDBYCAR,
WEAPONTYPE_RUNOVERBYCAR, // 50
WEAPONTYPE_EXPLOSION,
WEAPONTYPE_UZI_DRIVEBY,
WEAPONTYPE_DROWNING,
WEAPONTYPE_FALL,
WEAPONTYPE_UNIDENTIFIED, // Used for damage being done
WEAPONTYPE_ANYMELEE,
WEAPONTYPE_ANYWEAPON,
WEAPONTYPE_FLARE,
// Added by us
WEAPONTYPE_TANK_GRENADE,
};
#endif

View File

@ -18,11 +18,13 @@ extern "C"
}
#ifdef WIN32
#define MTAEXPORT extern "C" __declspec(dllexport)
#define DLL_EXPORT extern "C" __declspec(dllexport)
#else
#define MTAEXPORT extern "C"
#define DLL_EXPORT extern "C"
#endif
using namespace std;
#include <list>
#include <vector>
#include <map>
@ -39,8 +41,6 @@ extern "C"
#include <mono/metadata/mono-gc.h>
#include <mono/utils/mono-logger.h>
#include "Common.h"
#ifndef stricmp
#ifdef _MSC_VER
#define stricmp _stricmp
@ -60,5 +60,41 @@ extern "C"
#define ASSERT_MSG(_Expression, _Message) ((void)0)
#endif
#ifndef NUMELMS
#define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
#endif
#define MAX_ARGUMENTS 10
// VS GCC
// Actual sizes: 32bit 64bit 64bit
typedef unsigned long ulong; // 32 32 64
typedef unsigned int uint; // 32
typedef unsigned short ushort; // 16
typedef unsigned char uchar; // 8
typedef unsigned long long uint64; // 64
typedef unsigned int uint32; // 32
typedef unsigned short uint16; // 16
typedef unsigned char uint8; // 8
// signed types
typedef signed long long int64; // 64
typedef signed int int32; // 32
typedef signed short int16; // 16
typedef signed char int8; // 8
// Windowsesq types
typedef unsigned char BYTE; // 8
typedef unsigned short WORD; // 16
typedef unsigned long DWORD; // 32 32 64
typedef float FLOAT; // 32
typedef void* PVOID;
#include "extra/Vector2.h"
#include "extra/Vector3.h"
#include "extra/SColor.h"
#include "extra/CVehicleColor.h"
#include "SharedUtil/SharedUtil.h"

View File

@ -1,90 +1,96 @@
#include "StdInc.h"
#include "Common.h"
#include "../StdInc.h"
#include "CVehicleColor.h"
CVehicleColor::CVehicleColor( void )
{
// Init
m_ucPaletteColors[ 0 ] = 0; // Palette color 0 is black
m_ucPaletteColors[ 1 ] = 0;
m_ucPaletteColors[ 2 ] = 0;
m_ucPaletteColors[ 3 ] = 0;
m_RGBColors[ 0 ] = 0;
m_RGBColors[ 1 ] = 0;
m_RGBColors[ 2 ] = 0;
m_RGBColors[ 3 ] = 0;
m_bPaletteColorsWrong = false;
m_bRGBColorsWrong = false;
this->m_ucPaletteColors[ 0 ] = 0; // Palette color 0 is black
this->m_ucPaletteColors[ 1 ] = 0;
this->m_ucPaletteColors[ 2 ] = 0;
this->m_ucPaletteColors[ 3 ] = 0;
this->m_RGBColors[ 0 ] = 0;
this->m_RGBColors[ 1 ] = 0;
this->m_RGBColors[ 2 ] = 0;
this->m_RGBColors[ 3 ] = 0;
this->m_bPaletteColorsWrong = false;
this->m_bRGBColorsWrong = false;
}
// Use black for colours that are not used (bandwidth saving)
void CVehicleColor::SetRGBColors( SColor color1, SColor color2, SColor color3, SColor color4 )
{
if(
m_RGBColors[ 0 ] != color1 ||
m_RGBColors[ 1 ] != color2 ||
m_RGBColors[ 2 ] != color3 ||
m_RGBColors[ 3 ] != color4
)
if( this->m_RGBColors[ 0 ] != color1 || this->m_RGBColors[ 1 ] != color2 || this->m_RGBColors[ 2 ] != color3 || this->m_RGBColors[ 3 ] != color4 )
{
m_RGBColors[ 0 ] = color1;
m_RGBColors[ 1 ] = color2;
m_RGBColors[ 2 ] = color3;
m_RGBColors[ 3 ] = color4;
InvalidatePaletteColors();
this->m_RGBColors[ 0 ] = color1;
this->m_RGBColors[ 1 ] = color2;
this->m_RGBColors[ 2 ] = color3;
this->m_RGBColors[ 3 ] = color4;
this->InvalidatePaletteColors();
}
}
void CVehicleColor::SetPaletteColors( unsigned char ucColor1, unsigned char ucColor2, unsigned char ucColor3, unsigned char ucColor4 )
{
if( m_ucPaletteColors[ 0 ] != ucColor1 ||
m_ucPaletteColors[ 1 ] != ucColor2 ||
m_ucPaletteColors[ 2 ] != ucColor3 ||
m_ucPaletteColors[ 3 ] != ucColor4 )
if( this->m_ucPaletteColors[ 0 ] != ucColor1 || this->m_ucPaletteColors[ 1 ] != ucColor2 || this->m_ucPaletteColors[ 2 ] != ucColor3 || this->m_ucPaletteColors[ 3 ] != ucColor4 )
{
m_ucPaletteColors[ 0 ] = ucColor1;
m_ucPaletteColors[ 1 ] = ucColor2;
m_ucPaletteColors[ 2 ] = ucColor3;
m_ucPaletteColors[ 3 ] = ucColor4;
InvalidateRGBColors();
this->m_ucPaletteColors[ 0 ] = ucColor1;
this->m_ucPaletteColors[ 1 ] = ucColor2;
this->m_ucPaletteColors[ 2 ] = ucColor3;
this->m_ucPaletteColors[ 3 ] = ucColor4;
this->InvalidateRGBColors();
}
}
void CVehicleColor::SetRGBColor( uint uiSlot, SColor color )
{
ValidateRGBColors();
uiSlot = Min( uiSlot, static_cast <uint> ( NUMELMS( m_RGBColors ) ) );
if( m_RGBColors[ uiSlot ] != color )
this->ValidateRGBColors();
uiSlot = Min( uiSlot, static_cast< uint >( NUMELMS( this->m_RGBColors ) ) );
if( this->m_RGBColors[ uiSlot ] != color )
{
m_RGBColors[ uiSlot ] = color;
InvalidatePaletteColors();
this->m_RGBColors[ uiSlot ] = color;
this->InvalidatePaletteColors();
}
}
void CVehicleColor::SetPaletteColor( uint uiSlot, uchar ucColor )
{
ValidatePaletteColors();
uiSlot = Min( uiSlot, static_cast <uint> ( NUMELMS( m_ucPaletteColors ) ) );
if( m_ucPaletteColors[ uiSlot ] != ucColor )
this->ValidatePaletteColors();
uiSlot = Min( uiSlot, static_cast< uint >( NUMELMS( this->m_ucPaletteColors ) ) );
if( this->m_ucPaletteColors[ uiSlot ] != ucColor )
{
m_ucPaletteColors[ uiSlot ] = ucColor;
InvalidateRGBColors();
this->m_ucPaletteColors[ uiSlot ] = ucColor;
this->InvalidateRGBColors();
}
}
// Get a slot colour as a palette index
uchar CVehicleColor::GetPaletteColor( uint uiSlot )
{
ValidatePaletteColors();
uiSlot = Min( uiSlot, static_cast <uint> ( NUMELMS( m_ucPaletteColors ) ) );
return m_ucPaletteColors[ uiSlot ];
this->ValidatePaletteColors();
uiSlot = Min( uiSlot, static_cast< uint >( NUMELMS( this->m_ucPaletteColors ) ) );
return this->m_ucPaletteColors[ uiSlot ];
}
// Get a slot colour as an RGB colour
SColor CVehicleColor::GetRGBColor( uint uiSlot )
{
ValidateRGBColors();
uiSlot = Min( uiSlot, static_cast <uint> ( NUMELMS( m_RGBColors ) ) );
return m_RGBColors[ uiSlot ];
this->ValidateRGBColors();
uiSlot = Min( uiSlot, static_cast< uint >( NUMELMS( this->m_RGBColors ) ) );
return this->m_RGBColors[ uiSlot ];
}
// Can return: 1,2,3, or 4
@ -92,12 +98,17 @@ int CVehicleColor::GetNumColorsUsed( void )
{
// Find last unblack
int i;
for( i = NUMELMS( m_RGBColors ); i > 1; i-- )
for( i = NUMELMS( this->m_RGBColors ); i > 1; i-- )
{
if( this->GetRGBColor( i - 1 ) )
{
if( GetRGBColor( i - 1 ) )
break;
}
assert( i >= 1 && i <= 4 );
}
ASSERT( i >= 1 && i <= 4 );
return i;
}
@ -105,40 +116,47 @@ int CVehicleColor::GetNumColorsUsed( void )
// Switching to RGB mode
void CVehicleColor::InvalidatePaletteColors( void )
{
m_bRGBColorsWrong = false;
m_bPaletteColorsWrong = true;
this->m_bRGBColorsWrong = false;
this->m_bPaletteColorsWrong = true;
}
// Switching to palette mode
void CVehicleColor::InvalidateRGBColors( void )
{
m_bPaletteColorsWrong = false;
m_bRGBColorsWrong = true;
this->m_bPaletteColorsWrong = false;
this->m_bRGBColorsWrong = true;
}
// Ensure switched
void CVehicleColor::ValidateRGBColors( void )
{
if( m_bRGBColorsWrong )
if( this->m_bRGBColorsWrong )
{
m_bRGBColorsWrong = false;
for( uint i = 0; i < NUMELMS( m_RGBColors ); i++ )
m_RGBColors[ i ] = GetRGBFromPaletteIndex( m_ucPaletteColors[ i ] );
this->m_bRGBColorsWrong = false;
for( uint i = 0; i < NUMELMS( this->m_RGBColors ); i++ )
{
this->m_RGBColors[ i ] = GetRGBFromPaletteIndex( this->m_ucPaletteColors[ i ] );
}
}
}
// Ensure switched
void CVehicleColor::ValidatePaletteColors( void )
{
if( m_bPaletteColorsWrong )
if( this->m_bPaletteColorsWrong )
{
m_bPaletteColorsWrong = false;
for( uint i = 0; i < NUMELMS( m_ucPaletteColors ); i++ )
m_ucPaletteColors[ i ] = GetPaletteIndexFromRGB( m_RGBColors[ i ] );
this->m_bPaletteColorsWrong = false;
for( uint i = 0; i < NUMELMS( this->m_ucPaletteColors ); i++ )
{
this->m_ucPaletteColors[ i ] = GetPaletteIndexFromRGB( this->m_RGBColors[ i ] );
}
}
}
static const uchar paletteColorTable8[] = {
static const uchar paletteColorTable8[] =
{
0x00, 0x00, 0x00, 0xff, 0xf5, 0xf5, 0xf5, 0xff, 0x2a, 0x77, 0xa1, 0xff, 0x84, 0x04, 0x10, 0xff,
0x26, 0x37, 0x39, 0xff, 0x86, 0x44, 0x6e, 0xff, 0xd7, 0x8e, 0x10, 0xff, 0x4c, 0x75, 0xb7, 0xff,
0xbd, 0xbe, 0xc6, 0xff, 0x5e, 0x70, 0x72, 0xff, 0x46, 0x59, 0x7a, 0xff, 0x65, 0x6a, 0x79, 0xff,
@ -178,26 +196,32 @@ uchar CVehicleColor::GetPaletteIndexFromRGB( SColor color )
{
ulong ulBestDist = 0xFFFFFFFF;
uchar ucBestMatch = 0;
for( uint i = 0; i < NUMELMS( paletteColorTable8 ) / 4; i++ )
{
int r = paletteColorTable8[ i * 4 + 0 ] - color.R;
int g = paletteColorTable8[ i * 4 + 1 ] - color.G;
int b = paletteColorTable8[ i * 4 + 2 ] - color.B;
ulong ulDist = r * r + g * g + b * b;
if( ulDist < ulBestDist )
{
ulBestDist = ulDist;
ucBestMatch = i;
}
}
return ucBestMatch;
}
SColor CVehicleColor::GetRGBFromPaletteIndex( uchar ucColor )
{
ucColor = Min < uchar >( ucColor, static_cast <uint> ( NUMELMS( paletteColorTable8 ) / 4 ) );
ucColor = Min< uchar >( ucColor, static_cast< uint >( NUMELMS( paletteColorTable8 ) / 4 ) );
uchar r = paletteColorTable8[ ucColor * 4 ];
uchar g = paletteColorTable8[ ucColor * 4 + 1 ];
uchar b = paletteColorTable8[ ucColor * 4 + 2 ];
return SColorRGBA( r, g, b, 0 );
}

View File

@ -0,0 +1,39 @@
class CVehicleColor;
#ifndef __CVEHICLECOLOR_H
#define __CVEHICLECOLOR_H
#include "SColor.h"
class CVehicleColor
{
public:
CVehicleColor ( void );
void SetRGBColors ( SColor color1, SColor color2, SColor color3, SColor color4 );
void SetPaletteColors ( uchar ucColor1, uchar ucColor2, uchar ucColor3, uchar ucColor4 );
void SetRGBColor ( uint uiSlot, SColor color );
void SetPaletteColor ( uint uiSlot, uchar ucColor );
SColor GetRGBColor ( uint uiSlot );
uchar GetPaletteColor ( uint uiSlot );
int GetNumColorsUsed ( void );
static uchar GetPaletteIndexFromRGB ( SColor color );
static SColor GetRGBFromPaletteIndex ( uchar ucColor );
protected:
void InvalidatePaletteColors ( void );
void ValidatePaletteColors ( void );
void InvalidateRGBColors ( void );
void ValidateRGBColors ( void );
SColor m_RGBColors[ 4 ];
uchar m_ucPaletteColors[ 4 ];
bool m_bPaletteColorsWrong;
bool m_bRGBColorsWrong;
};
#endif

View File

@ -1,9 +1,11 @@
AM_CPPFLAGS=-I. -I.. -I../include -I../../vendor/eglib/src -I../../vendor/lua51/src -I/usr/include/mono-2.0
AM_CPPFLAGS=-I. -I.. -I../include -I../../vendor/lua51/src -I/usr/include/mono-2.0
noinst_LIBRARIES=libmta_mono_extra.a
libmta_mono_extra_a_SOURCES = \
CLuaArgument.cpp \
CLuaArguments.cpp \
CVehicleColor.cpp \
SColor.cpp \
Vector2.cpp \
Vector3.cpp

View File

@ -0,0 +1,34 @@
#include "../StdInc.h"
#include "SColor.h"
SColor::SColor( void )
{
}
SColor::SColor( unsigned long ulValue )
{
this->ulARGB = ulValue;
}
SColor::operator unsigned long( void ) const
{
return this->ulARGB;
}
SColorARGB::SColorARGB( unsigned char ucA, unsigned char ucR, unsigned char ucG, unsigned char ucB )
{
this->A = ucA;
this->R = ucR;
this->G = ucG;
this->B = ucB;
}
SColorRGBA::SColorRGBA( unsigned char ucR, unsigned char ucG, unsigned char ucB, unsigned char ucA )
{
this->R = ucR;
this->G = ucG;
this->B = ucB;
this->A = ucA;
}

View File

@ -0,0 +1,80 @@
class SColor;
#ifndef __SCOLOR_H
#define __SCOLOR_H
//
// SColor
//
// Encapsulates the most common usage of 4 byte color storage.
// Casts to and from a DWORD as 0xAARRGGBB
//
class SColor
{
// No shifting allowed to access the color channel information
void operator >> ( int ) const;
void operator << ( int ) const;
void operator >>= ( int );
void operator <<= ( int );
public:
union
{
struct
{
unsigned char B, G, R, A;
};
unsigned long ulARGB;
};
SColor( void );
SColor( unsigned long ulValue );
operator unsigned long( void ) const;
};
//
// SColorARGB
//
// Make an SColor from A,R,G,B
//
class SColorARGB : public SColor
{
public:
SColorARGB( unsigned char ucA, unsigned char ucR, unsigned char ucG, unsigned char ucB );
template< class T, class U, class V, class W >
SColorARGB( T a, U r, V g, W b )
{
this->A = Clamp< unsigned char >( 0, static_cast< unsigned char >( a ), 255 );
this->R = Clamp< unsigned char >( 0, static_cast< unsigned char >( r ), 255 );
this->G = Clamp< unsigned char >( 0, static_cast< unsigned char >( g ), 255 );
this->B = Clamp< unsigned char >( 0, static_cast< unsigned char >( b ), 255 );
}
};
//
// SColorRGBA
//
// Make an SColor from R,G,B,A
//
class SColorRGBA : public SColor
{
public:
SColorRGBA( unsigned char ucR, unsigned char ucG, unsigned char ucB, unsigned char ucA );
template< class T, class U, class V, class W >
SColorRGBA( T r, U g, V b, W a )
{
this->R = Clamp< unsigned char >( 0, static_cast< unsigned char >( r ), 255 );
this->G = Clamp< unsigned char >( 0, static_cast< unsigned char >( g ), 255 );
this->B = Clamp< unsigned char >( 0, static_cast< unsigned char >( b ), 255 );
this->A = Clamp< unsigned char >( 0, static_cast< unsigned char >( a ), 255 );
}
};
#endif

View File

@ -15,13 +15,13 @@ Vector2::Vector2( float _fX, float _fY )
Vector2::Vector2( MonoObject* pObject )
{
this->fX = CMonoObject::GetPropertyValue< float >( pObject, "X" );
this->fY = CMonoObject::GetPropertyValue< float >( pObject, "Y" );
this->fX = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "X" );
this->fY = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "Y" );
}
float Vector2::DotProduct( Vector2& other ) const
{
return fX*other.fX + fY*other.fY;
return fX * other.fX + fY * other.fY;
}
float Vector2::Length() const
@ -37,6 +37,7 @@ float Vector2::LengthSquared( void ) const
void Vector2::Normalize( void )
{
float fLength = Length();
if( fLength > 0.0f )
{
fX /= fLength;

View File

@ -14,7 +14,6 @@
#include <cmath>
#include "Vector3.h"
#include "../CMonoObject.h"
/**
* CVector2D Structure used to store a 2D vertex.

View File

@ -17,9 +17,9 @@ Vector3::Vector3( float fX, float fY, float fZ )
Vector3::Vector3( MonoObject *pObject )
{
this->fX = CMonoObject::GetPropertyValue< float >( pObject, "X" );
this->fY = CMonoObject::GetPropertyValue< float >( pObject, "Y" );
this->fZ = CMonoObject::GetPropertyValue< float >( pObject, "Z" );
this->fX = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "X" );
this->fY = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "Y" );
this->fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "Z" );
}
float Vector3::Normalize( void )

View File

@ -17,7 +17,6 @@
#endif
#include <math.h>
#include "../CMonoObject.h"
#define FLOAT_EPSILON 0.0001f
#define PI 3.14159265358979323846f

View File

@ -1887,23 +1887,19 @@ string CLuaFunctionDefinitions::GetPlayerVersion( lua_State* pLuaVM, PVOID pUser
return string();
}
CLuaArgumentsMap* CLuaFunctionDefinitions::GetPlayerACInfo( lua_State* pLuaVM, PVOID pUserData )
CLuaArgumentsMap CLuaFunctionDefinitions::GetPlayerACInfo( lua_State* pLuaVM, PVOID pUserData )
{
CLuaArgument pLuaArgument;
CLuaArguments pLuaArguments;
pLuaArguments.PushUserData( pUserData );
if( pLuaArguments.Call( pLuaVM, "getPlayerACInfo", 1 ) )
{
CLuaArgument pLuaArgument( pLuaVM, -1 );
if( pLuaArgument.GetType() == eLuaType::Table )
{
return &pLuaArgument.GetTable();
}
pLuaArgument.Read( pLuaVM, -1 );
}
return nullptr;
return pLuaArgument.GetTable();
}
// Player set functions

View File

@ -15,7 +15,6 @@ class CLuaFunctionDefinitions;
#ifndef __CLUAFUNCTIONDEFINITIONS_H
#define __CLUAFUNCTIONDEFINITIONS_H
#include "../Common.h"
#include "../extra/CLuaArguments.h"
class CLuaFunctionDefinitions
@ -145,7 +144,7 @@ public:
static bool GetPlayerIP ( lua_State* pLuaVM, PVOID pUserData, string& strOutIP );
static PVOID GetPlayerAccount ( lua_State* pLuaVM, PVOID pUserData );
static string GetPlayerVersion ( lua_State* pLuaVM, PVOID pUserData );
static CLuaArgumentsMap* GetPlayerACInfo ( lua_State* pLuaVM, PVOID pUserData );
static CLuaArgumentsMap GetPlayerACInfo ( lua_State* pLuaVM, PVOID pUserData );
// Player set functions
static bool SetPlayerMoney ( lua_State* pLuaVM, PVOID pUserData, int iAmount, bool bInstant = false );

View File

@ -1,4 +1,4 @@
AM_CPPFLAGS=-I. -I.. -I../include -I../../vendor/eglib/src -I../../vendor/lua51/src -I/usr/include/mono-2.0
AM_CPPFLAGS=-I. -I.. -I../include -I../../vendor/lua51/src -I/usr/include/mono-2.0
noinst_LIBRARIES = liblua_f_defs.a

View File

@ -12,7 +12,7 @@
#include "StdInc.h"
#define MODULE_NAME "Mono 4.2.1"
#define MODULE_NAME "Mono 4.2.2"
#define MODULE_AUTHOR "Dmitry Korolev <kernell@mtaroleplay.ru>"
#define MODULE_VERSION 0.27f
@ -21,9 +21,9 @@
CModule* g_pModule = nullptr;
MTAEXPORT bool InitModule( ILuaModuleManager10* pManager, char* szModuleName, char* szAuthor, float* fVersion )
DLL_EXPORT bool InitModule( ILuaModuleManager10* pManager, char* szModuleName, char* szAuthor, float* fVersion )
{
g_pModule = new CModule( pManager );
new CModule( pManager );
strncpy( szModuleName, MODULE_NAME, MAX_INFO_LENGTH );
strncpy( szAuthor, MODULE_AUTHOR, MAX_INFO_LENGTH );
@ -33,7 +33,7 @@ MTAEXPORT bool InitModule( ILuaModuleManager10* pManager, char* szModuleName, ch
return true;
}
MTAEXPORT void RegisterFunctions( lua_State *pLuaVM )
DLL_EXPORT void RegisterFunctions( lua_State *pLuaVM )
{
if( g_pModule && pLuaVM )
{
@ -44,7 +44,7 @@ MTAEXPORT void RegisterFunctions( lua_State *pLuaVM )
}
}
MTAEXPORT bool DoPulse( void )
DLL_EXPORT bool DoPulse( void )
{
if( g_pModule )
{
@ -54,7 +54,7 @@ MTAEXPORT bool DoPulse( void )
return true;
}
MTAEXPORT bool ShutdownModule( void )
DLL_EXPORT bool ShutdownModule( void )
{
if( g_pModule )
{
@ -64,7 +64,7 @@ MTAEXPORT bool ShutdownModule( void )
return true;
}
MTAEXPORT bool ResourceStopping( lua_State* luaVM )
DLL_EXPORT bool ResourceStopping( lua_State* luaVM )
{
if( g_pModule )
{
@ -74,7 +74,7 @@ MTAEXPORT bool ResourceStopping( lua_State* luaVM )
return true;
}
MTAEXPORT bool ResourceStopped( lua_State* luaVM )
DLL_EXPORT bool ResourceStopped( lua_State* luaVM )
{
if( g_pModule )
{

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@ -22,19 +22,19 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Nightly|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />