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 )] [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 )] [MethodImpl( MethodImplOptions.InternalCall )]
extern public bool Remove( Ban ban, Element responsible ); extern public bool Remove( Ban ban, Element responsible );

View File

@ -14,7 +14,7 @@ namespace MultiTheftAuto
} }
[MethodImpl( MethodImplOptions.InternalCall )] [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() public static int Read()
{ {

View File

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

View File

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

View File

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

View File

@ -247,11 +247,6 @@ namespace MultiTheftAuto
} }
~Vehicle()
{
Debug.Info( "~Vehicle() [" + this.GetName() + "]" );
}
#endregion #endregion
#region Static Methods #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;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using MultiTheftAuto; using MultiTheftAuto;
using MultiTheftAuto.EventArgs; using MultiTheftAuto.EventArgs;
using Console = MultiTheftAuto.Console;
namespace Test namespace Test
{ {
public class Program 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 ) 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( "------------------------------------" );
//{
// Debug.Info( "lambda " + sender.GetType() + " " + e.This.GetType() );
//};
Element vehicle = new Vehicle( VehicleModel.ADMIRAL, Vector3.Zero, Vector3.Zero ); foreach( Vehicle vehicle in Element.GetByType( "vehicle" ) )
{
Debug.Info( string.Format( "{0} {1}", vehicle.GetVehicleType(), vehicle.GetName() ) );
Debug.Info( vehicle.GetType().ToString() ); vehicle.Destroy();
}
vehicle.OnElementDestroy += Root_ElementDestroy; Debug.Info( "------------------------------------" );
//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 );
vehicle.Destroy();
Debug.Info( Color.Aquamarine.ToString() );
} }
static void Root_OnPlayerJoin( Element sender, ElementEventArgs e ) static void Vehicle_OnElementDestroy( Vehicle sender )
{ {
Player player = sender as Player; Console.WriteLine( "onElementDestroy: " + sender.GetName() );
Debug.Info( "Player '" + player.GetName() + "' joined" );
player.FadeCamera( true, 1.0f, Color.Black );
}
static void Root_OnPlayerConnect( Element sender, PlayerConnectEventArgs e )
{
//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() );
} }
} }
} }

View File

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

Binary file not shown.

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@ enum class eElementType
class CElement class CElement
{ {
public: public:
static const map<eElementType, pair<string, string>> _eElementType; static const map< eElementType, pair< string, string > > _eElementType;
inline static const string GetTypeName( eElementType iType ) inline static const string GetTypeName( eElementType iType )
{ {
@ -114,18 +114,21 @@ private:
uint32_t m_uiGCHandle; uint32_t m_uiGCHandle;
public: 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 ); virtual ~CElement ( void );
inline eElementType GetType ( void ) const { return this->m_iType; } inline eElementType GetType ( void ) const { return this->m_iType; }
inline void SetType ( eElementType iType ) { this->m_iType = iType; } inline void SetType ( eElementType iType ) { this->m_iType = iType; }
void SetTypeName ( const string& strTypeName ); void SetTypeName ( const string& strTypeName );
const string GetTypeName ( void ); const string GetTypeName ( void );
const char* GetTypeClassName ( void );
CElement* GetParent ( void ) const; CElement* GetParent ( void ) const;
inline MonoObject* ToMonoObject ( void ) const { return this->m_pMonoObject; } inline PVOID GetLuaUserdata ( void ) const { return this->m_pLuaUserdata; }
inline PVOID ToLuaUserData ( void ) const { return this->m_pLuaUserdata; } inline MonoObject* GetMonoObject ( void ) const { return this->m_pMonoObject; }
}; };
#endif #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 ) if( pObject == nullptr )
{ {
string _tmp; 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"; strTypeName = "resource";
} }
@ -69,21 +70,25 @@ CElement* CElementManager::Create( MonoObject* pObject, PVOID pUserData )
if( pObject ) 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; return nullptr;
} }
CElement* CElementManager::FindOrCreate( PVOID pUserData ) CElement* CElementManager::FindOrCreate( PVOID pUserdata )
{ {
CElement* pElement; CElement* pElement;
pElement = this->GetFromList( pUserData ); pElement = this->GetFromList( pUserdata );
if( !pElement ) if( !pElement )
{ {
pElement = this->Create( nullptr, pUserData ); pElement = this->Create( nullptr, pUserdata );
} }
return pElement; return pElement;
@ -103,7 +108,7 @@ CElement* CElementManager::GetFromList( PVOID pUserdata )
{ {
for( const auto& pElement : this->m_List ) for( const auto& pElement : this->m_List )
{ {
if( pElement->ToLuaUserData() == pUserdata ) if( pElement->GetLuaUserdata() == pUserdata )
{ {
return pElement; return pElement;
} }
@ -116,7 +121,7 @@ CElement* CElementManager::GetFromList( MonoObject* pMonoObject )
{ {
for( const auto& pElement : this->m_List ) for( const auto& pElement : this->m_List )
{ {
if( pElement->ToMonoObject() == pMonoObject ) if( pElement->GetMonoObject() == pMonoObject )
{ {
return pElement; return pElement;
} }

View File

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

View File

@ -105,22 +105,25 @@ bool CEventManager::Call( const string& strName, CElement* pThis, list< CLuaArgu
} }
} }
CMonoClass* pClass = pMTALib->GetClass( "Element" ); CMonoClass* pClass = pMTALib->GetClass( pThis->GetTypeClassName() );
ASSERT( pClass ); ASSERT( pClass );
string strEventName = strName; if( pClass )
strEventName[ 0 ] = toupper( strEventName[ 0 ] );
CMonoEvent* pEvent = pClass->GetEvent( strEventName );
if( pEvent )
{ {
return pEvent->Call( pThis->ToMonoObject(), Arguments ); string strEventName = strName;
strEventName[ 0 ] = toupper( strEventName[ 0 ] );
CMonoEvent* pEvent = pClass->GetEvent( strEventName );
if( pEvent )
{
return pEvent->Call( pThis, Arguments );
}
} }
return true; return false;
} }
void CEventManager::ReadArgumens( list< CLuaArgument* > Arguments, CMonoArguments& pArguments ) 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() ); CElement* pElement = pElementManager->FindOrCreate( iter->GetLightUserData() );
MonoObject* pValue = pElement->ToMonoObject(); ASSERT( pElement );
pArguments.Push( pValue ); pArguments.Push( pElement->GetMonoObject() );
break; break;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -98,7 +98,7 @@ CMonoClass::~CMonoClass( void )
this->m_Methods.clear(); this->m_Methods.clear();
} }
MonoObject* CMonoClass::New( void ) MonoObject* CMonoClass::New( void ) const
{ {
MonoObject* pObject = this->m_pDomain->CreateObject( this->m_pClass ); MonoObject* pObject = this->m_pDomain->CreateObject( this->m_pClass );
@ -112,28 +112,28 @@ MonoObject* CMonoClass::New( void )
return pObject; 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 ); 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 ); 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 ); 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 ); MonoObject* pObject = this->m_pDomain->CreateObject( this->m_pClass );
@ -161,27 +161,27 @@ MonoObject* CMonoClass::New( void** args, int argc )
return pObject; 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 ); 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 ); 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 ); 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 ); MonoMethodDesc* pMonoMethodDesc = mono_method_desc_new( strMethodName.c_str(), false );
@ -197,13 +197,13 @@ MonoMethod* CMonoClass::GetMethod( string strMethodName )
return nullptr; return nullptr;
} }
CMonoMethod* CMonoClass::GetMethod( string strMethodName, uint uiIndex ) CMonoMethod* CMonoClass::GetMethod( const string& strMethodName, uint uiIndex )
{ {
if( this->m_Methods[ strMethodName ].size() > 0 ) if( this->m_Methods[ strMethodName ].size() > 0 )
{ {
uint i = 0; uint i = 0;
for( auto ptr : this->m_Methods[ strMethodName ] ) for( const auto& ptr : this->m_Methods[ strMethodName ] )
{ {
if( i++ == uiIndex ) if( i++ == uiIndex )
{ {
@ -215,17 +215,17 @@ CMonoMethod* CMonoClass::GetMethod( string strMethodName, uint uiIndex )
return nullptr; return nullptr;
} }
list< CMonoMethod* > CMonoClass::GetMethods( string strMethodName ) list< CMonoMethod* > CMonoClass::GetMethods( const string& strMethodName )
{ {
return this->m_Methods[ 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; 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; return this->m_Fields.count( strFieldName ) ? this->m_Fields[ strFieldName ] : nullptr;
} }

View File

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

View File

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

View File

@ -34,7 +34,7 @@ public:
CMonoClass* GetClass ( const char *szNameSpace, const char *szClassName ); 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 #endif

View File

@ -46,7 +46,7 @@ CMonoDomain::~CMonoDomain( void )
{ {
mono_domain_finalize( this->m_pDomain, 2000 ); mono_domain_finalize( this->m_pDomain, 2000 );
MonoObject *pException = nullptr; MonoObject* pException = nullptr;
mono_domain_try_unload( this->m_pDomain, &pException ); mono_domain_try_unload( this->m_pDomain, &pException );
@ -80,7 +80,7 @@ CMonoClass* CMonoDomain::FindOrAdd( MonoClass* klass )
{ {
for( const auto& iter : this->m_ClassPool ) for( const auto& iter : this->m_ClassPool )
{ {
if( iter->GetMonoPtr() == klass ) if( **iter == klass )
{ {
return iter; return iter;
} }
@ -147,15 +147,17 @@ bool CMonoDomain::Start( void )
return false; 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 ); PVOID params[] =
{
void* params[ 1 ]; pArray,
};
params[ 0 ] = pArray;
MonoObject* pException = nullptr; MonoObject* pException = nullptr;
@ -176,7 +178,7 @@ void CMonoDomain::Unload( void )
bool CMonoDomain::Set( bool bForce ) 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 ) 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() ); 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() ); 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 ); 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; 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

@ -43,28 +43,29 @@ private:
string m_strName; string m_strName;
public: public:
CMonoDomain ( CMonoInterface* pMono, MonoDomain* pDomain, CResource* pResource, const char* szName ); CMonoDomain ( CMonoInterface* pMono, MonoDomain* pDomain, CResource* pResource, const char* szName );
~CMonoDomain ( void ); ~CMonoDomain ( void );
void HandleException ( MonoObject* pException ); void HandleException ( MonoObject* pException );
CMonoClass* FindOrAdd ( MonoClass* klass ); CMonoClass* FindOrAdd ( MonoClass* klass );
bool Init ( void ); bool Init ( void );
bool Start ( void ); bool Start ( void );
void Unload ( void ); void Unload ( void );
bool Set ( bool bForce ); bool Set ( bool bForce );
MonoAssembly* OpenAssembly ( const char *szName ); MonoAssembly* OpenAssembly ( const char *szName );
MonoObject* CreateObject ( MonoClass* klass ); MonoObject* CreateObject ( MonoClass* klass );
void SetConfig ( const char* szBaseDir, const char* szConfigFileName ); void SetConfig ( const char* szBaseDir, const char* szConfigFileName );
MonoString* NewString ( const char* szText ) const; MonoString* NewString ( const char* szText ) const;
MonoString* NewString ( const string& strText ) 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 > template< class T, int iLuaType >
MonoArray* NewArray ( MonoClass* pMonoClass, CLuaArgumentsVector pLuaArguments ) MonoArray* NewArray ( MonoClass* pMonoClass, CLuaArgumentsVector pLuaArguments )
{ {
MonoArray* pArray = mono_array_new( this->m_pDomain, pMonoClass, pLuaArguments.size() ); MonoArray* pArray = mono_array_new( this->m_pDomain, pMonoClass, pLuaArguments.size() );
@ -110,8 +111,6 @@ public:
return pArray; return pArray;
} }
inline MonoDomain* GetMonoPtr ( void ) const { return this->m_pDomain; }
inline CMonoInterface* GetMono ( void ) const { return this->m_pMono; } inline CMonoInterface* GetMono ( void ) const { return this->m_pMono; }
inline CResource* GetResource ( void ) const { return this->m_pResource; } inline CResource* GetResource ( void ) const { return this->m_pResource; }
@ -119,6 +118,8 @@ public:
inline CMonoMTALib* GetMTALib ( void ) const { return this->m_pMTALib; } inline CMonoMTALib* GetMTALib ( void ) const { return this->m_pMTALib; }
inline string GetName ( void ) const { return this->m_strName; } inline string GetName ( void ) const { return this->m_strName; }
inline MonoDomain* operator * ( void ) const { return this->m_pDomain; }
}; };
#endif #endif

View File

@ -35,9 +35,9 @@ CMonoEvent::~CMonoEvent( void )
this->m_pRaiseMethod = nullptr; 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 ) if( !pMethod )
{ {
@ -46,18 +46,18 @@ bool CMonoEvent::Call( MonoObject* pThis, list< CLuaArgument* > argv )
CMonoArguments pArguments; 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; return false;
} }
pMethod->Invoke( pThis, *pArguments, nullptr ); pMethod->Invoke( pThis->GetMonoObject(), *pArguments, nullptr );
const auto& iter = *argv.begin(); 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 ); pMethod->Invoke( pArguments[ 0 ], *pArguments, nullptr );
} }
@ -65,231 +65,229 @@ bool CMonoEvent::Call( MonoObject* pThis, list< CLuaArgument* > argv )
return true; 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(); vector< SMonoType > pArgList = pMethod->GetArguments();
CMonoCorlib* pCorlib = this->m_pClass->GetDomain()->GetCorlib();
const auto& pMethods = this->m_pClass->GetMethods( "raise_" + this->GetName() ); if( pArgList.size() != argv.size() )
for( const auto& pMethod : pMethods )
{ {
vector< SMonoType > pArgList = pMethod->GetArguments(); return false;
}
if( pArgList.size() != argv.size() ) auto iter = argv.begin();
auto pType = pArgList.begin();
for( ; ; iter++, pType++ )
{
if( iter == argv.end() || pType == pArgList.end() )
{ {
continue; return true;
} }
auto iter = argv.begin(); eLuaType iLuaType = (*iter)->GetType();
auto pType = pArgList.begin();
for( ; ; iter++, pType++ ) switch( pType->iType )
{ {
if( iter == argv.end() || pType == pArgList.end() ) case MONO_TYPE_BOOLEAN: // System.Boolean
{ {
return true; bool bValue = false;
}
eLuaType iLuaType = (*iter)->GetType(); if( iLuaType == eLuaType::Boolean )
switch( pType->iType )
{
case MONO_TYPE_BOOLEAN: // System.Boolean
{ {
bool bValue = false; bValue = (*iter)->GetBoolean();
}
if( iLuaType == eLuaType::Boolean )
{
bValue = (*iter)->GetBoolean();
}
pArguments.Push( bValue ); pArguments.Push( bValue );
break; break;
} }
case MONO_TYPE_CHAR: // System.Char case MONO_TYPE_CHAR: // System.Char
{
wchar_t iValue = 0;
if( iLuaType == eLuaType::Number )
{ {
wchar_t iValue = 0; iValue = (*iter)->GetNumber< wchar_t >();
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< wchar_t >();
}
pArguments.Push( iValue );
break;
} }
case MONO_TYPE_I1: // System.SByte
pArguments.Push( iValue );
break;
}
case MONO_TYPE_I1: // System.SByte
{
int8_t iValue = 0;
if( iLuaType == eLuaType::Number )
{ {
int8_t iValue = 0; iValue = (*iter)->GetNumber< int8_t >();
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< int8_t >();
}
pArguments.Push( iValue );
break;
} }
case MONO_TYPE_U1: // System.Byte
pArguments.Push( iValue );
break;
}
case MONO_TYPE_U1: // System.Byte
{
uint8_t iValue = 0;
if( iLuaType == eLuaType::Number )
{ {
uint8_t iValue = 0; iValue = (*iter)->GetNumber< uint8_t >();
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< uint8_t >();
}
pArguments.Push( iValue );
break;
} }
case MONO_TYPE_I2: // System.Int16
pArguments.Push( iValue );
break;
}
case MONO_TYPE_I2: // System.Int16
{
int16_t iValue = 0;
if( iLuaType == eLuaType::Number )
{ {
int16_t iValue = 0; iValue = (*iter)->GetNumber< int16_t >();
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< int16_t >();
}
pArguments.Push( iValue );
break;
} }
case MONO_TYPE_U2: // System.UInt16
pArguments.Push( iValue );
break;
}
case MONO_TYPE_U2: // System.UInt16
{
uint16_t iValue = 0;
if( iLuaType == eLuaType::Number )
{ {
uint16_t iValue = 0; iValue = (*iter)->GetNumber< uint16_t >();
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< uint16_t >();
}
pArguments.Push( iValue );
break;
} }
case MONO_TYPE_I4: // System.Int32
pArguments.Push( iValue );
break;
}
case MONO_TYPE_I4: // System.Int32
{
int32_t iValue = 0;
if( iLuaType == eLuaType::Number )
{ {
int32_t iValue = 0; iValue = (*iter)->GetNumber< int32_t >();
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< int32_t >();
}
pArguments.Push( iValue );
break;
} }
case MONO_TYPE_U4: // System.UInt32
{
uint32_t iValue = 0;
if( iLuaType == eLuaType::Number ) pArguments.Push( iValue );
{
iValue = (*iter)->GetNumber< uint32_t >(); break;
} }
case MONO_TYPE_U4: // System.UInt32
{
uint32_t iValue = 0;
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< uint32_t >();
}
pArguments.Push( iValue ); pArguments.Push( iValue );
break; break;
} }
case MONO_TYPE_I8: // System.Int64 case MONO_TYPE_I8: // System.Int64
{
int64_t iValue = 0;
if( iLuaType == eLuaType::Number )
{ {
int64_t iValue = 0; iValue = (*iter)->GetNumber< int64_t >();
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< int64_t >();
}
pArguments.Push( iValue );
break;
} }
case MONO_TYPE_U8: // System.UInt64
pArguments.Push( iValue );
break;
}
case MONO_TYPE_U8: // System.UInt64
{
uint64_t iValue = 0;
if( iLuaType == eLuaType::Number )
{ {
uint64_t iValue = 0; iValue = (*iter)->GetNumber< uint64_t >();
if( iLuaType == eLuaType::Number )
{
iValue = (*iter)->GetNumber< uint64_t >();
}
pArguments.Push( iValue );
break;
} }
case MONO_TYPE_R4: // System.Single
pArguments.Push( iValue );
break;
}
case MONO_TYPE_R4: // System.Single
{
float fValue = 0;
if( iLuaType == eLuaType::Number )
{ {
float fValue = 0; fValue = (*iter)->GetNumber< float >();
if( iLuaType == eLuaType::Number )
{
fValue = (*iter)->GetNumber< float >();
}
pArguments.Push( fValue );
break;
} }
case MONO_TYPE_R8: // System.Double
pArguments.Push( fValue );
break;
}
case MONO_TYPE_R8: // System.Double
{
double dValue = 0;
if( iLuaType == eLuaType::Number )
{ {
double dValue = 0; dValue = (*iter)->GetNumber< double >();
if( iLuaType == eLuaType::Number )
{
dValue = (*iter)->GetNumber< double >();
}
pArguments.Push( dValue );
break;
} }
case MONO_TYPE_STRING: // System.String
pArguments.Push( dValue );
break;
}
case MONO_TYPE_STRING: // System.String
{
string strValue = "";
if( iLuaType == eLuaType::String )
{ {
string strValue = ""; strValue = (*iter)->GetString();
}
if( iLuaType == eLuaType::String ) MonoString* pString = this->m_pResource->GetDomain()->NewString( strValue );
{
strValue = (*iter)->GetString();
}
MonoString* pString = this->m_pResource->GetDomain()->NewString( strValue );
pArguments.Push( pString ); pArguments.Push( pString );
break; break;
} }
case MONO_TYPE_OBJECT: // System.Object case MONO_TYPE_OBJECT: // System.Object
case MONO_TYPE_CLASS: case MONO_TYPE_CLASS:
{
MonoObject* pValue = nullptr;
if( iLuaType == eLuaType::LightUserdata )
{ {
MonoObject* pValue = nullptr; CElement* pElement = this->m_pResource->GetElementManager()->FindOrCreate( (*iter)->GetLightUserData() );
if( iLuaType == eLuaType::LightUserdata ) ASSERT( pElement );
{
CElement* pElement = this->m_pResource->GetElementManager()->FindOrCreate( (*iter)->GetLightUserData() );
pValue = pElement->ToMonoObject(); auto typeName = pElement->GetTypeName();
}
pArguments.Push( pValue ); auto className = pElement->GetTypeClassName();
break; pValue = pElement->GetMonoObject();
} }
case MONO_TYPE_I:
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() );
break; pArguments.Push( pValue );
}
break;
}
case MONO_TYPE_I:
case MONO_TYPE_U:
default:
{
this->m_pResource->ErrorPrintf( "Unsupported type '%s (0x%X)' for '%s'\n", pType->strName.c_str(), pType->iType, this->m_strName.c_str() );
break;
} }
} }
} }
@ -297,17 +295,17 @@ bool CMonoEvent::ParseArguments( CMonoArguments& pArguments, list< CLuaArgument*
return false; 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 "CMonoClass.h"
#include "CMonoMethod.h" #include "CMonoMethod.h"
#include "CMonoArguments.h" #include "CMonoArguments.h"
#include "CElement.h"
#include "extra/CLuaArgument.h" #include "extra/CLuaArgument.h"
@ -39,17 +40,17 @@ public:
CMonoEvent ( CMonoClass* pClass, MonoEvent* pEvent ); CMonoEvent ( CMonoClass* pClass, MonoEvent* pEvent );
~CMonoEvent ( void ); ~CMonoEvent ( void );
bool Call ( MonoObject* pThis, list< CLuaArgument* > argv ); bool Call ( CElement* pThis, list< CLuaArgument* > argv );
bool ParseArguments ( CMonoArguments& pArguments, list< CLuaArgument* > argv ); bool ParseArguments ( const CMonoMethod* pMethod, CMonoArguments& pArguments, list< CLuaArgument* > argv );
CMonoMethod* GetAddMethod ( void ); CMonoMethod* GetAddMethod ( void ) const;
CMonoMethod* GetRemoveMethod ( void ); CMonoMethod* GetRemoveMethod ( void ) const;
CMonoMethod* GetRaiseMethod ( void ); CMonoMethod* GetRaiseMethod ( void ) const;
CMonoClass* GetClass ( void ) { return this->m_pClass; } inline CMonoClass* GetClass ( void ) const { return this->m_pClass; }
MonoEvent* GetMonoPtr ( void ) { return this->m_pEvent; } 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 #endif

View File

@ -21,6 +21,7 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Console, Write ); MONO_DECLARE( Console, Write );
MONO_DECLARE( Console, WriteLine ); MONO_DECLARE( Console, WriteLine );
MONO_DECLARE( Console, Output );
MONO_DECLARE( Config, Get ); MONO_DECLARE( Config, Get );
MONO_DECLARE( Config, Set ); MONO_DECLARE( Config, Set );
@ -28,7 +29,7 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Server, GetMaxPlayers ); MONO_DECLARE( Server, GetMaxPlayers );
MONO_DECLARE( Server, SetMaxPlayers ); MONO_DECLARE( Server, SetMaxPlayers );
MONO_DECLARE( Server, OutputChatBox ); MONO_DECLARE( Server, OutputChatBox );
MONO_DECLARE( Server, OutputConsole ); // MONO_DECLARE( Server, OutputLog );
MONO_DECLARE( Server, SetPassword ); MONO_DECLARE( Server, SetPassword );
MONO_DECLARE( Server, GetVersion ); MONO_DECLARE( Server, GetVersion );
@ -556,22 +557,22 @@ void CMonoFunctions::AddInternals( void )
MONO_DECLARE( Account, GetAll ); MONO_DECLARE( Account, GetAll );
MONO_DECLARE( Account, GetPlayer ); MONO_DECLARE( Account, GetPlayer );
MONO_DECLARE( Account, IsGuest ); MONO_DECLARE( Account, IsGuest );
// MONO_DECLARE( Account, GetData ); MONO_DECLARE( Account, GetData );
// MONO_DECLARE( Account, GetAllData ); // MONO_DECLARE( Account, GetAllData );
MONO_DECLARE( Account, GetSerial ); MONO_DECLARE( Account, GetSerial );
// MONO_DECLARE( Account, GetBySerial ); MONO_DECLARE( Account, GetBySerial );
// Account set funcs // Account set funcs
MONO_DECLARE( Account, Add ); MONO_DECLARE( Account, Add );
MONO_DECLARE( Account, Remove ); MONO_DECLARE( Account, Remove );
MONO_DECLARE( Account, SetPassword ); MONO_DECLARE( Account, SetPassword );
// MONO_DECLARE( Account, SetData ); MONO_DECLARE( Account, SetData );
MONO_DECLARE( Account, CopyData ); MONO_DECLARE( Account, CopyData );
MONO_DECLARE( Ban, Add ); MONO_DECLARE( Ban, Add );
MONO_DECLARE( Ban, Remove ); MONO_DECLARE( Ban, Remove );
// MONO_DECLARE( Ban, GetBans ); MONO_DECLARE( Ban, GetAll );
MONO_DECLARE( Ban, Reload ); MONO_DECLARE( Ban, Reload );
MONO_DECLARE( Ban, GetIP ); 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() ); CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource ) 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; return nullptr;
@ -756,34 +780,11 @@ bool CMonoFunctions::Server::OutputChatBox( MonoString* msText, MonoObject* pEle
return false; return false;
} }
unsigned char ucRed = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "R" ); unsigned char ucRed = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( mpColor, "R" );
unsigned char ucGreen = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "G" ); unsigned char ucGreen = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( mpColor, "G" );
unsigned char ucBlue = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "B" ); unsigned char ucBlue = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( mpColor, "B" );
return CLuaFunctionDefinitions::OutputChatBox( pResource->GetLua(), szText, pElement->ToLuaUserData(), ucRed, ucGreen, ucBlue, bColorCoded ); return CLuaFunctionDefinitions::OutputChatBox( pResource->GetLua(), szText, pElement->GetLuaUserdata(), 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 false; return false;
@ -869,7 +870,7 @@ bool CMonoFunctions::Server::ExecuteCommandHandler( MonoString* msCommand, MonoO
string strArguments = mono_string_to_utf8( msArgs ); 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; return false;

View File

@ -24,9 +24,9 @@ class CMonoFunctions;
#include "CMonoDomain.h" #include "CMonoDomain.h"
#include "CMonoClass.h" #include "CMonoClass.h"
#include "CMonoObject.h"
#include "CMonoCorlib.h" #include "CMonoCorlib.h"
#include "CMonoMTALib.h" #include "CMonoMTALib.h"
#include "CElementManager.h"
extern CModule* g_pModule; extern CModule* g_pModule;
@ -39,298 +39,298 @@ typedef MonoObject* TElement;
class CMonoFunctions class CMonoFunctions
{ {
public: public:
static void AddInternals( void ); static void AddInternals ( void );
class Debug class Debug
{ {
public: public:
static void Log ( MonoString* pString ); static void Log ( MonoString* pString );
static void Info ( MonoString* pString ); static void Info ( MonoString* pString );
static void Error ( MonoString* pString ); static void Error ( MonoString* pString );
}; };
class Console class Console
{ {
public: public:
static void Write ( MonoString* pString ); static void Write ( MonoString* pString );
static void WriteLine ( MonoString* pString ); static void WriteLine ( MonoString* pString );
static bool Output ( MonoString* szText, MonoObject* pThis );
}; };
class Config class Config
{ {
public: public:
static MonoString* Get ( MonoString* msKey ); static MonoString* Get ( MonoString* msKey );
static bool Set ( MonoString* msKey, MonoString* msValue ); static bool Set ( MonoString* msKey, MonoString* msValue );
}; };
class Server class Server
{ {
public: public:
static unsigned int GetMaxPlayers ( void ); static unsigned int GetMaxPlayers ( void );
static bool SetMaxPlayers ( unsigned int uiMax ); static bool SetMaxPlayers ( unsigned int uiMax );
static bool OutputChatBox ( MonoString* szText, MonoObject* pThis, MonoObject* pColor, bool bColorCoded ); static bool OutputChatBox ( MonoString* szText, MonoObject* pElement, MonoObject* pColor, bool bColorCoded );
static bool OutputConsole ( MonoString* szText, MonoObject* pThis ); static bool SetPassword ( MonoString* msPassword, bool bSave );
static bool SetPassword ( MonoString* msPassword, bool bSave ); static MonoObject* GetVersion ( void );
static MonoObject* GetVersion ( void );
static bool AddCommandHandler ( MonoString* msCommand, MonoObject* pDelegate, bool bRestricted = false, bool bCaseSensitive = true ); static bool AddCommandHandler ( MonoString* msCommand, MonoObject* pDelegate, bool bRestricted = false, bool bCaseSensitive = true );
static bool ExecuteCommandHandler ( MonoString* msCommand, MonoObject* pPlayerObj, MonoString* msArgs ); static bool ExecuteCommandHandler ( MonoString* msCommand, MonoObject* pPlayerObj, MonoString* msArgs );
static bool RemoveCommandHandler ( MonoString* msCommand, MonoObject* pDelegate = nullptr ); static bool RemoveCommandHandler ( MonoString* msCommand, MonoObject* pDelegate = nullptr );
}; };
class Game class Game
{ {
public: public:
static MonoString* GetType ( void ); static MonoString* GetType ( void );
static MonoString* GetMapName ( void ); static MonoString* GetMapName ( void );
static bool SetType ( MonoString* msGameType ); static bool SetType ( MonoString* msGameType );
static bool SetMapName ( MonoString* msMapName ); static bool SetMapName ( MonoString* msMapName );
static MonoString* GetRuleValue ( MonoString* msKey ); static MonoString* GetRuleValue ( MonoString* msKey );
static bool SetRuleValue ( MonoString* msKey, MonoString* msValue ); static bool SetRuleValue ( MonoString* msKey, MonoString* msValue );
static bool RemoveRuleValue ( MonoString* msKey ); static bool RemoveRuleValue ( MonoString* msKey );
}; };
class Event class Event
{ {
public: public:
static bool Add ( MonoString* msName, bool bAllowRemoteTrigger ); static bool Add ( MonoString* msName, bool bAllowRemoteTrigger );
static bool AddHandler ( MonoString* msName, MonoObject* pThis, MonoObject* pDelegate, bool bPropagated, MonoString* msEventPriority ); static bool AddHandler ( MonoString* msName, MonoObject* pThis, MonoObject* pDelegate, bool bPropagated, MonoString* msEventPriority );
static bool RemoveHandler ( MonoString* msName, MonoObject* pThis, MonoObject* pDelegate ); static bool RemoveHandler ( MonoString* msName, MonoObject* pThis, MonoObject* pDelegate );
static bool Trigger ( MonoString* msName, MonoObject* pThis, MonoArray* mpArguments ); static bool Trigger ( MonoString* msName, MonoObject* pThis, MonoArray* mpArguments );
static bool Cancel ( bool bCancel, MonoString* msReason ); static bool Cancel ( bool bCancel, MonoString* msReason );
static bool WasCancelled ( void ); static bool WasCancelled ( void );
static string GetCancelReason ( void ); static string GetCancelReason ( void );
static bool TriggerClient ( MonoObject* pSendTo, MonoString* msName, MonoObject* pSource, MonoArray* mpArguments ); static bool TriggerClient ( MonoObject* pSendTo, MonoString* msName, MonoObject* pSource, MonoArray* mpArguments );
}; };
class Element class Element
{ {
public: public:
// Element create/destroy // Element create/destroy
static void Ctor ( TElement pThis, MonoString* msTypeName, MonoString* msID ); static void Ctor ( TElement pThis, MonoString* msTypeName, MonoString* msID );
static bool Destroy ( TElement pThis ); static bool Destroy ( TElement pThis );
static TElement Clone ( TElement pThis, MonoObject* vecPosition, bool bCloneElement ); static TElement Clone ( TElement pThis, MonoObject* vecPosition, bool bCloneElement );
// Element get funcs // Element get funcs
static TElement GetRootElement ( void ); static TElement GetRootElement ( void );
static MonoArray* GetByType ( MonoString* msType, TElement pStartElement ); static MonoArray* GetByType ( MonoString* msType, TElement pStartElement );
static bool IsElement ( TElement pThis ); static bool IsElement ( TElement pThis );
static uint32_t GetUserData ( TElement pThis ); static uint32_t GetUserData ( TElement pThis );
static MonoString* GetElementType ( TElement pThis ); static MonoString* GetElementType ( TElement pThis );
static TElement GetByID ( MonoString* msID, unsigned int uiIndex ); static TElement GetByID ( MonoString* msID, unsigned int uiIndex );
static TElement GetByIndex ( int iIndex ); static TElement GetByIndex ( int iIndex );
static TElement GetChild ( TElement pThis, int iIndex ); static TElement GetChild ( TElement pThis, int iIndex );
static int GetChildrenCount ( TElement pThis ); static int GetChildrenCount ( TElement pThis );
static MonoString* GetID ( TElement pThis ); static MonoString* GetID ( TElement pThis );
static MonoObject* GetData ( TElement pThis, MonoString* sKey, bool bInherit = true ); static MonoObject* GetData ( TElement pThis, MonoString* sKey, bool bInherit = true );
static MonoArray* GetAllData ( TElement pThis ); static MonoArray* GetAllData ( TElement pThis );
static TElement GetParent ( TElement pThis ); static TElement GetParent ( TElement pThis );
static MonoObject* GetPosition ( TElement pThis ); static MonoObject* GetPosition ( TElement pThis );
static MonoObject* GetRotation ( TElement pThis ); static MonoObject* GetRotation ( TElement pThis );
static MonoObject* GetVelocity ( TElement pThis ); static MonoObject* GetVelocity ( TElement pThis );
static unsigned char GetInterior ( TElement pThis ); static unsigned char GetInterior ( TElement pThis );
static bool IsWithinColShape ( TElement pThis ); static bool IsWithinColShape ( TElement pThis );
static bool IsWithinMarker ( TElement pThis ); static bool IsWithinMarker ( TElement pThis );
static unsigned short GetDimension ( TElement pThis ); static unsigned short GetDimension ( TElement pThis );
static MonoString* GetZoneName ( TElement pThis, bool bCitiesOnly = false ); static MonoString* GetZoneName ( TElement pThis, bool bCitiesOnly = false );
static bool IsAttached ( TElement pThis ); static bool IsAttached ( TElement pThis );
static TElement GetAttachedTo ( TElement pThis ); static TElement GetAttachedTo ( TElement pThis );
static TElement GetColShape ( TElement pThis ); static TElement GetColShape ( TElement pThis );
static unsigned char GetAlpha ( TElement pThis ); static unsigned char GetAlpha ( TElement pThis );
static bool IsDoubleSided ( TElement pThis ); static bool IsDoubleSided ( TElement pThis );
static float GetHealth ( TElement pThis ); static float GetHealth ( TElement pThis );
static unsigned short GetModel ( TElement pThis ); static unsigned short GetModel ( TElement pThis );
static bool IsInWater ( TElement pThis ); static bool IsInWater ( TElement pThis );
static MonoObject* GetAttachedOffsetPosition ( TElement pThis ); static MonoObject* GetAttachedOffsetPosition ( TElement pThis );
static MonoObject* GetAttachedOffsetRotation ( TElement pThis ); static MonoObject* GetAttachedOffsetRotation ( TElement pThis );
static TElement GetSyncer ( TElement pThis ); static TElement GetSyncer ( TElement pThis );
static bool GetCollisionsEnabled ( TElement pThis ); static bool GetCollisionsEnabled ( TElement pThis );
static bool IsFrozen ( TElement pThis ); static bool IsFrozen ( TElement pThis );
static TElement GetLowLod ( TElement pThis ); static TElement GetLowLod ( TElement pThis );
static bool IsLowLod ( TElement pThis ); static bool IsLowLod ( TElement pThis );
// Element set funcs // Element set funcs
static bool ClearVisibleTo ( TElement pThis ); static bool ClearVisibleTo ( TElement pThis );
static bool SetID ( TElement pThis, MonoString* msID ); static bool SetID ( TElement pThis, MonoString* msID );
static bool SetData ( TElement pThis, MonoString* msKey, CLuaArgument& Variable ); static bool SetData ( TElement pThis, MonoString* msKey, CLuaArgument& Variable );
static bool RemoveData ( TElement pThis, MonoString* msKey ); static bool RemoveData ( TElement pThis, MonoString* msKey );
static bool SetParent ( TElement pThis, TElement pTarget ); static bool SetParent ( TElement pThis, TElement pTarget );
static bool SetPosition ( TElement pThis, MonoObject* pPosition, bool bWarp ); static bool SetPosition ( TElement pThis, MonoObject* pPosition, bool bWarp );
static bool SetRotation ( TElement pThis, MonoObject* pRotation, MonoString* msRotationOrder, bool bNewWay ); static bool SetRotation ( TElement pThis, MonoObject* pRotation, MonoString* msRotationOrder, bool bNewWay );
static bool SetVelocity ( TElement pThis, MonoObject* pVelocity ); static bool SetVelocity ( TElement pThis, MonoObject* pVelocity );
static bool SetVisibleTo ( TElement pThis, TElement pTarget, bool bVisible ); static bool SetVisibleTo ( TElement pThis, TElement pTarget, bool bVisible );
static bool SetInterior ( TElement pThis, int iInterior ); static bool SetInterior ( TElement pThis, int iInterior );
static bool SetDimension ( TElement pThis, int iDimension ); static bool SetDimension ( TElement pThis, int iDimension );
static bool Attach ( TElement pThis, TElement pTarget, MonoObject* pPosition, MonoObject* pRotation ); static bool Attach ( TElement pThis, TElement pTarget, MonoObject* pPosition, MonoObject* pRotation );
static bool Detach ( TElement pThis, TElement pTarget ); static bool Detach ( TElement pThis, TElement pTarget );
static bool SetAlpha ( TElement pThis, int iAlpha ); static bool SetAlpha ( TElement pThis, int iAlpha );
static bool SetDoubleSided ( TElement pThis, bool bDoubleSided ); static bool SetDoubleSided ( TElement pThis, bool bDoubleSided );
static bool SetHealth ( TElement pThis, float fHealth ); static bool SetHealth ( TElement pThis, float fHealth );
static bool SetModel ( TElement pThis, int iModel ); static bool SetModel ( TElement pThis, int iModel );
static bool SetAttachedOffsets ( TElement pThis, MonoObject* pPosition, MonoObject* pRotation ); static bool SetAttachedOffsets ( TElement pThis, MonoObject* pPosition, MonoObject* pRotation );
static bool SetSyncer ( TElement pThis, TElement pPlayer ); static bool SetSyncer ( TElement pThis, TElement pPlayer );
static bool SetCollisionsEnabled ( TElement pThis, bool bEnabled ); static bool SetCollisionsEnabled ( TElement pThis, bool bEnabled );
static bool SetFrozen ( TElement pThis, bool bFrozen ); static bool SetFrozen ( TElement pThis, bool bFrozen );
static bool SetLowLod ( TElement pThis, bool bEnabled ); static bool SetLowLod ( TElement pThis, bool bEnabled );
}; };
class Player class Player
{ {
public: public:
// Player get functions // Player get functions
static unsigned int GetCount ( void ); static unsigned int GetCount ( void );
static TElement GetFromName ( MonoString* msNick ); static TElement GetFromName ( MonoString* msNick );
static unsigned int GetPing ( TElement pThis ); static unsigned int GetPing ( TElement pThis );
static long GetMoney ( TElement pThis ); static long GetMoney ( TElement pThis );
static TElement GetRandom ( void ); static TElement GetRandom ( void );
static bool IsMuted ( TElement pThis ); static bool IsMuted ( TElement pThis );
static TElement GetTeam ( TElement pThis ); static TElement GetTeam ( TElement pThis );
static unsigned int GetWantedLevel ( TElement pThis ); static unsigned int GetWantedLevel ( TElement pThis );
static MonoArray* GetAlivePlayers ( void ); static MonoArray* GetAlivePlayers ( void );
static MonoArray* GetDeadPlayers ( void ); static MonoArray* GetDeadPlayers ( void );
static unsigned int GetIdleTime ( TElement pThis ); static unsigned int GetIdleTime ( TElement pThis );
static bool IsMapForced ( TElement pThis ); static bool IsMapForced ( TElement pThis );
static MonoString* GetNametagText ( TElement pThis ); static MonoString* GetNametagText ( TElement pThis );
static MonoObject* GetNametagColor ( TElement pThis ); static MonoObject* GetNametagColor ( TElement pThis );
static bool IsNametagShowing ( TElement pThis ); static bool IsNametagShowing ( TElement pThis );
static MonoString* GetSerial ( TElement pThis ); static MonoString* GetSerial ( TElement pThis );
static MonoString* GetUserName ( TElement pThis ); static MonoString* GetUserName ( TElement pThis );
static unsigned char GetBlurLevel ( TElement pThis ); static unsigned char GetBlurLevel ( TElement pThis );
static MonoString* GetName ( TElement pThis ); static MonoString* GetName ( TElement pThis );
static MonoString* GetIP ( TElement pThis ); static MonoString* GetIP ( TElement pThis );
static TElement GetAccount ( TElement pThis ); static TElement GetAccount ( TElement pThis );
static MonoString* GetVersion ( TElement pThis ); static MonoString* GetVersion ( TElement pThis );
static MonoObject* GetACInfo ( TElement pThis ); static MonoObject* GetACInfo ( TElement pThis );
static MonoString* GetPlayerAnnounceValue ( TElement pThis, MonoString* msKey ); static MonoString* GetPlayerAnnounceValue ( TElement pThis, MonoString* msKey );
// Player set functions // Player set functions
static bool SetMoney ( TElement pThis, int iAmount, bool bInstant ); static bool SetMoney ( TElement pThis, int iAmount, bool bInstant );
static bool GiveMoney ( TElement pThis, int iAmount ); static bool GiveMoney ( TElement pThis, int iAmount );
static bool TakeMoney ( TElement pThis, int iAmount ); static bool TakeMoney ( TElement pThis, int iAmount );
static bool Spawn ( TElement pThis, MonoObject* vecPosition, int iRotation, int iSkinID, int iInterior, int iDimension, TElement pTeam ); static bool Spawn ( TElement pThis, MonoObject* vecPosition, int iRotation, int iSkinID, int iInterior, int iDimension, TElement pTeam );
static bool ShowHudComponent ( TElement pThis, MonoString* sComponent, bool bShow ); static bool ShowHudComponent ( TElement pThis, MonoString* sComponent, bool bShow );
static bool SetWantedLevel ( TElement pThis, int iLevel ); static bool SetWantedLevel ( TElement pThis, int iLevel );
static bool ForceMap ( TElement pThis, bool bForceOn ); static bool ForceMap ( TElement pThis, bool bForceOn );
static bool SetNametagText ( TElement pThis, MonoString* sText ); static bool SetNametagText ( TElement pThis, MonoString* sText );
static bool SetNametagColor ( TElement pThis, int iRed, int iGreen, int iBlue ); static bool SetNametagColor ( TElement pThis, int iRed, int iGreen, int iBlue );
static bool SetNametagShowing ( TElement pThis, bool bShowing ); static bool SetNametagShowing ( TElement pThis, bool bShowing );
static bool SetMuted ( TElement pThis, bool bMuted ); static bool SetMuted ( TElement pThis, bool bMuted );
static bool SetBlurLevel ( TElement pThis, int iLevel ); static bool SetBlurLevel ( TElement pThis, int iLevel );
static bool Redirect ( TElement pThis, MonoString* sServerIP, int iServerPort, MonoString* sServerPassword ); static bool Redirect ( TElement pThis, MonoString* sServerIP, int iServerPort, MonoString* sServerPassword );
static bool SetName ( TElement pThis, MonoString* sName ); static bool SetName ( TElement pThis, MonoString* sName );
static bool DetonateSatchels ( TElement pThis ); static bool DetonateSatchels ( TElement pThis );
static bool TakeScreenShot ( TElement pThis, int iWidth, int iHeight, MonoString* sTag, int iQuality, int iMaxBandwith ); static bool TakeScreenShot ( TElement pThis, int iWidth, int iHeight, MonoString* sTag, int iQuality, int iMaxBandwith );
static bool SetTeam ( TElement pThis, TElement pTeam ); static bool SetTeam ( TElement pThis, TElement pTeam );
static bool SetPlayerAnnounceValue ( TElement pThis, MonoString* msKey, MonoString* msValue ); static bool SetPlayerAnnounceValue ( TElement pThis, MonoString* msKey, MonoString* msValue );
// Input funcs // Input funcs
static bool BindKey ( TElement pThis, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName, MonoString* msArguments ); static bool BindKey ( TElement pThis, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName, MonoString* msArguments );
static bool UnbindKey ( TElement pThis, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName ); static bool UnbindKey ( TElement pThis, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName );
static bool GetControlState ( TElement pThis, MonoString* msControl ); static bool GetControlState ( TElement pThis, MonoString* msControl );
static bool IsControlEnabled ( TElement pThis, MonoString* msControl ); static bool IsControlEnabled ( TElement pThis, MonoString* msControl );
static bool SetControlState ( TElement pThis, MonoString* msControl, bool bState ); static bool SetControlState ( TElement pThis, MonoString* msControl, bool bState );
static bool ToggleControl ( TElement pThis, MonoString* msControl, bool bEnabled ); static bool ToggleControl ( TElement pThis, MonoString* msControl, bool bEnabled );
static bool ToggleAllControls ( TElement pThis, bool bGTAControls, bool bMTAControls, bool bEnabled ); static bool ToggleAllControls ( TElement pThis, bool bGTAControls, bool bMTAControls, bool bEnabled );
// Log in/out funcs // Log in/out funcs
static bool LogIn ( TElement pPlayer, TElement pAccount, MonoString* msPassword ); static bool LogIn ( TElement pPlayer, TElement pAccount, MonoString* msPassword );
static bool LogOut ( TElement pPlayer ); static bool LogOut ( TElement pPlayer );
// Admin funcs // Admin funcs
static bool Kick ( TElement pPlayer, MonoString* msResponsible, MonoString* msReason ); static bool Kick ( TElement pPlayer, MonoString* msResponsible, MonoString* msReason );
static TElement Ban ( TElement pPlayer, bool bIP, bool bUsername, bool bSerial, TElement pResponsible, MonoString* msResponsible, MonoString* msReason, int iUnban ); static TElement Ban ( TElement pPlayer, bool bIP, bool bUsername, bool bSerial, TElement pResponsible, MonoString* msResponsible, MonoString* msReason, int iUnban );
// Cursor get funcs // Cursor get funcs
static bool IsCursorShowing ( TElement pPlayer ); static bool IsCursorShowing ( TElement pPlayer );
// Cursor set funcs // Cursor set funcs
static bool ShowCursor ( TElement pPlayer, bool bShow, bool bToggleControls ); static bool ShowCursor ( TElement pPlayer, bool bShow, bool bToggleControls );
// Chat funcs // Chat funcs
static bool ShowChat ( TElement pPlayer, bool bShow ); static bool ShowChat ( TElement pPlayer, bool bShow );
// Camera get functions // Camera get functions
static MonoObject* GetCameraMatrix ( TElement pPlayer ); static MonoObject* GetCameraMatrix ( TElement pPlayer );
static TElement GetCameraTarget ( TElement pPlayer ); static TElement GetCameraTarget ( TElement pPlayer );
static unsigned char GetCameraInterior ( TElement pPlayer ); static unsigned char GetCameraInterior ( TElement pPlayer );
// Camera set functions // Camera set functions
static bool SetCameraMatrix ( TElement pPlayer, MonoObject* pCameraMatrix ); static bool SetCameraMatrix ( TElement pPlayer, MonoObject* pCameraMatrix );
static bool SetCameraTarget ( TElement pPlayer, TElement pTarget ); static bool SetCameraTarget ( TElement pPlayer, TElement pTarget );
static bool SetCameraInterior ( TElement pPlayer, unsigned char ucInterior ); static bool SetCameraInterior ( TElement pPlayer, unsigned char ucInterior );
static bool FadeCamera ( TElement pPlayer, bool bFadeIn, float fFadeTime, MonoObject* pColor ); static bool FadeCamera ( TElement pPlayer, bool bFadeIn, float fFadeTime, MonoObject* pColor );
}; };
class Ped class Ped
{ {
public: public:
// Ped get functions // Ped get functions
static void Ctor ( TElement pThis, int iModelid, MonoObject* pMonoPosition, float fRot, bool bSynced ); static void Ctor ( TElement pThis, int iModelid, MonoObject* pMonoPosition, float fRot, bool bSynced );
static float GetArmor ( TElement pThis ); static float GetArmor ( TElement pThis );
static bool IsChoking ( TElement pThis ); static bool IsChoking ( TElement pThis );
static bool IsDead ( TElement pThis ); static bool IsDead ( TElement pThis );
static bool IsDucked ( TElement pThis ); static bool IsDucked ( TElement pThis );
static float GetStat ( TElement pThis, unsigned short usStat ); static float GetStat ( TElement pThis, unsigned short usStat );
static TElement GetTarget ( TElement pThis ); static TElement GetTarget ( TElement pThis );
static int GetWeapon ( TElement pThis, int iWeaponSlot ); static int GetWeapon ( TElement pThis, int iWeaponSlot );
static MonoString* GetClothesTexture ( TElement pThis, unsigned char ucType ); static MonoString* GetClothesTexture ( TElement pThis, unsigned char ucType );
static MonoString* GetClothesModel ( TElement pThis, unsigned char ucType ); static MonoString* GetClothesModel ( TElement pThis, unsigned char ucType );
static bool DoesHaveJetPack ( TElement pThis ); static bool DoesHaveJetPack ( TElement pThis );
static bool IsOnGround ( TElement pThis ); static bool IsOnGround ( TElement pThis );
static unsigned char GetFightingStyle ( TElement pThis ); static unsigned char GetFightingStyle ( TElement pThis );
static unsigned int GetMoveAnim ( TElement pThis ); static unsigned int GetMoveAnim ( TElement pThis );
static float GetGravity ( TElement pThis ); static float GetGravity ( TElement pThis );
static TElement GetContactElement ( TElement pThis ); static TElement GetContactElement ( TElement pThis );
static unsigned char GetWeaponSlot ( TElement pThis ); static unsigned char GetWeaponSlot ( TElement pThis );
static bool IsDoingGangDriveby ( TElement pThis ); static bool IsDoingGangDriveby ( TElement pThis );
static bool IsOnFire ( TElement pThis ); static bool IsOnFire ( TElement pThis );
static bool IsHeadless ( TElement pThis ); static bool IsHeadless ( TElement pThis );
static bool IsFrozen ( TElement pThis ); static bool IsFrozen ( TElement pThis );
static TElement GetOccupiedVehicle ( TElement pThis ); static TElement GetOccupiedVehicle ( TElement pThis );
static unsigned int GetOccupiedVehicleSeat ( TElement pThis ); static unsigned int GetOccupiedVehicleSeat ( TElement pThis );
static bool IsInVehicle ( TElement pThis ); static bool IsInVehicle ( TElement pThis );
static short GetWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty ); static short GetWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty );
static short GetOriginalWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty ); static short GetOriginalWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty );
// Ped set functions // Ped set functions
static bool SetArmor ( TElement pThis, float fArmor ); static bool SetArmor ( TElement pThis, float fArmor );
static bool Kill ( TElement pThis, TElement pKiller, unsigned char ucKillerWeapon, unsigned char ucBodyPart, bool bStealth ); static bool Kill ( TElement pThis, TElement pKiller, unsigned char ucKillerWeapon, unsigned char ucBodyPart, bool bStealth );
static bool SetStat ( TElement pThis, unsigned short usStat, float fValue ); static bool SetStat ( TElement pThis, unsigned short usStat, float fValue );
static bool AddClothes ( TElement pThis, MonoString* msTexture, MonoString* msModel, unsigned char ucType ); static bool AddClothes ( TElement pThis, MonoString* msTexture, MonoString* msModel, unsigned char ucType );
static bool RemoveClothes ( TElement pThis, unsigned char ucType, MonoString* msTexture, MonoString* msModel ); static bool RemoveClothes ( TElement pThis, unsigned char ucType, MonoString* msTexture, MonoString* msModel );
static bool GiveJetPack ( TElement pThis ); static bool GiveJetPack ( TElement pThis );
static bool RemoveJetPack ( TElement pThis ); static bool RemoveJetPack ( TElement pThis );
static bool SetFightingStyle ( TElement pThis, unsigned char ucStyle ); static bool SetFightingStyle ( TElement pThis, unsigned char ucStyle );
static bool SetMoveAnim ( TElement pThis, unsigned int iMoveAnim ); static bool SetMoveAnim ( TElement pThis, unsigned int iMoveAnim );
static bool SetGravity ( TElement pThis, float fGravity ); static bool SetGravity ( TElement pThis, float fGravity );
static bool SetChoking ( TElement pThis, bool bChoking ); static bool SetChoking ( TElement pThis, bool bChoking );
static bool SetWeaponSlot ( TElement pThis, unsigned char ucWeaponSlot ); static bool SetWeaponSlot ( TElement pThis, unsigned char ucWeaponSlot );
static bool WarpIntoVehicle ( TElement pThis, TElement pVehicle, unsigned int uiSeat ); static bool WarpIntoVehicle ( TElement pThis, TElement pVehicle, unsigned int uiSeat );
static bool RemoveFromVehicle ( TElement pThis ); static bool RemoveFromVehicle ( TElement pThis );
static bool SetDoingGangDriveby ( TElement pThis, bool bGangDriveby ); static bool SetDoingGangDriveby ( TElement pThis, bool bGangDriveby );
static bool SetAnimation ( TElement pThis, MonoString* msBlockName, MonoString* msAnimName, int iTime, bool bLoop, bool bUpdatePosition, bool bInterruptable, bool bFreezeLastFrame ); static bool SetAnimation ( TElement pThis, MonoString* msBlockName, MonoString* msAnimName, int iTime, bool bLoop, bool bUpdatePosition, bool bInterruptable, bool bFreezeLastFrame );
static bool SetAnimationProgress ( TElement pThis, MonoString* msAnimName, float fProgress ); static bool SetAnimationProgress ( TElement pThis, MonoString* msAnimName, float fProgress );
static bool SetOnFire ( TElement pThis, bool bIsOnFire ); static bool SetOnFire ( TElement pThis, bool bIsOnFire );
static bool SetHeadless ( TElement pThis, bool bIsHeadless ); static bool SetHeadless ( TElement pThis, bool bIsHeadless );
static bool SetFrozen ( TElement pThis, bool bIsFrozen ); static bool SetFrozen ( TElement pThis, bool bIsFrozen );
static bool ReloadWeapon ( TElement pThis ); static bool ReloadWeapon ( TElement pThis );
static bool SetWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty, short uData ); static bool SetWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty, short uData );
// Ped body? // Ped body?
static MonoString* GetBodyPartName ( unsigned char ucID ); static MonoString* GetBodyPartName ( unsigned char ucID );
static MonoArray* GetClothesByTypeIndex ( unsigned char ucType, unsigned char ucIndex ); static MonoArray* GetClothesByTypeIndex ( unsigned char ucType, unsigned char ucIndex );
static MonoArray* GetTypeIndexFromClothes ( MonoString* msTexture, MonoString* msModel ); static MonoArray* GetTypeIndexFromClothes ( MonoString* msTexture, MonoString* msModel );
static MonoString* GetClothesTypeName ( unsigned char ucType ); static MonoString* GetClothesTypeName ( unsigned char ucType );
// Weapon give/take functions // Weapon give/take functions
static bool GiveWeapon ( TElement pPed, unsigned char ucWeaponID, unsigned short usAmmo, bool bSetAsCurrent = false ); static bool GiveWeapon ( TElement pPed, unsigned char ucWeaponID, unsigned short usAmmo, bool bSetAsCurrent = false );
static bool TakeWeapon ( TElement pPed, unsigned char ucWeaponID, unsigned short usAmmo = 9999 ); static bool TakeWeapon ( TElement pPed, unsigned char ucWeaponID, unsigned short usAmmo = 9999 );
static bool TakeAllWeapons ( TElement pPed ); static bool TakeAllWeapons ( TElement pPed );
static bool SetWeaponAmmo ( TElement pPed, unsigned char ucWeaponID, unsigned short usAmmo, unsigned short usAmmoInClip ); static bool SetWeaponAmmo ( TElement pPed, unsigned char ucWeaponID, unsigned short usAmmo, unsigned short usAmmoInClip );
}; };
class Vehicle class Vehicle
@ -696,26 +696,26 @@ public:
static MonoArray* GetAll ( void ); static MonoArray* GetAll ( void );
static TElement GetPlayer ( TElement pAccount ); static TElement GetPlayer ( TElement pAccount );
static bool IsGuest ( 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 MonoArray* GetAllData ( TElement pAccount );
static MonoString* GetSerial ( TElement pAccount ); static MonoString* GetSerial ( TElement pAccount );
// static MonoArray* GetBySerial ( MonoString* msSerial ); static MonoArray* GetBySerial ( MonoString* msSerial );
// Account set funcs // Account set funcs
static TElement Add ( MonoString* msName, MonoString* msPassword ); static TElement Add ( MonoString* msName, MonoString* msPassword );
static bool Remove ( TElement pAccount ); static bool Remove ( TElement pAccount );
static bool SetPassword ( TElement pAccount, MonoString* msPassword ); 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 ); static bool CopyData ( TElement pAccount, TElement pFromAccount );
}; };
class Ban class Ban
{ {
public: 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 bool Remove ( TElement pBan, TElement pResponsible );
// static MonoArray* GetBans ( void ); static MonoArray* GetAll ( void );
static bool Reload ( void ); static bool Reload ( void );
static MonoString* GetIP ( TElement pBan ); static MonoString* GetIP ( TElement pBan );
@ -737,40 +737,40 @@ public:
{ {
public: public:
// Resource funcs // Resource funcs
static void Ctor ( TElement pThis, MonoString* msResourceName, MonoString* msOrganizationalDir ); static void Ctor ( TElement pThis, MonoString* msResourceName, MonoString* msOrganizationalDir );
static TElement Copy ( TElement pResource, MonoString* msNewResourceName, MonoString* msOrganizationalDir ); static TElement Copy ( TElement pResource, MonoString* msNewResourceName, MonoString* msOrganizationalDir );
static TElement GetRootElement ( TElement pResource = nullptr ); static TElement GetRootElement ( TElement pResource = nullptr );
static TElement GetMapRootElement ( TElement pResource, MonoString* msMap ); static TElement GetMapRootElement ( TElement pResource, MonoString* msMap );
static TElement GetDynamicElementRoot ( TElement pResource ); static TElement GetDynamicElementRoot ( TElement pResource );
// static CXMLNode* AddMap ( MonoString* msFilePath, MonoString* msMapName, int iDimension ); // static CXMLNode* AddMap ( MonoString* msFilePath, MonoString* msMapName, int iDimension );
// static CXMLNode* AddConfig ( MonoString* msFilePath, MonoString* msConfigName, int iType ); // static CXMLNode* AddConfig ( MonoString* msFilePath, MonoString* msConfigName, int iType );
static bool RemoveFile ( TElement pResource, MonoString* msFilename ); static bool RemoveFile ( TElement pResource, MonoString* msFilename );
// static CXMLNode AddConfig ( MonoString* msFilePath, MonoString* msFileType ); // static CXMLNode AddConfig ( MonoString* msFilePath, MonoString* msFileType );
// static CXMLNode AddMap ( MonoString* msFilePath, unsigned int uiDimension = 0 ); // static CXMLNode AddMap ( MonoString* msFilePath, unsigned int uiDimension = 0 );
// static CXMLNode GetConfig ( MonoString* msFilePath ); // static CXMLNode GetConfig ( MonoString* msFilePath );
// static CLuaArguments* GetExportedFunctions ( TElement pResource ); // static CLuaArguments* GetExportedFunctions ( TElement pResource );
static TElement GetFromName ( MonoString* msResourceName ); static TElement GetFromName ( MonoString* msResourceName );
static MonoString* GetInfo ( TElement pResource, MonoString* msAttribute ); static MonoString* GetInfo ( TElement pResource, MonoString* msAttribute );
static unsigned int GetLastStartTime ( TElement pResource ); static unsigned int GetLastStartTime ( TElement pResource );
static MonoString* GetLoadFailureReason ( TElement pResource ); static MonoString* GetLoadFailureReason ( TElement pResource );
static unsigned int GetLoadTime ( TElement pResource ); static unsigned int GetLoadTime ( TElement pResource );
static MonoString* GetName ( TElement pResource ); static MonoString* GetName ( TElement pResource );
static MonoArray* GetResources ( void ); static MonoArray* GetResources ( void );
static MonoString* GetState ( TElement pResource ); static MonoString* GetState ( TElement pResource );
static TElement GetCurrent ( void ); static TElement GetCurrent ( void );
static bool Refresh ( bool refreshAll = false ); static bool Refresh ( bool refreshAll = false );
static bool RemoveDefaultSetting ( TElement pResource, MonoString* msSettingName ); static bool RemoveDefaultSetting ( TElement pResource, MonoString* msSettingName );
static bool Start ( TElement pResource, bool persistent = false, bool startIncludedResources = true, bool loadServerConfigs = true, bool loadMaps = true, bool loadServerScripts = true, bool loadHTML = true, bool loadClientConfigs = true, bool loadClientScripts = true, bool loadFiles = true ); static bool Start ( TElement pResource, bool persistent = false, bool startIncludedResources = true, bool loadServerConfigs = true, bool loadMaps = true, bool loadServerScripts = true, bool loadHTML = true, bool loadClientConfigs = true, bool loadClientScripts = true, bool loadFiles = true );
static bool Restart ( TElement pResource ); static bool Restart ( TElement pResource );
static bool Stop ( TElement pResource ); static bool Stop ( TElement pResource );
static bool SetDefaultSetting ( TElement pResource, MonoString* msSettingName, MonoString* msSettingValue ); static bool SetDefaultSetting ( TElement pResource, MonoString* msSettingName, MonoString* msSettingValue );
// static bool SetDefaultSetting ( TElement pResource, MonoString* msSettingName, int iSettingValue ); // static bool SetDefaultSetting ( TElement pResource, MonoString* msSettingName, int iSettingValue );
// static bool SetDefaultSetting ( TElement pResource, MonoString* msSettingName, float fSettingValue ); // static bool SetDefaultSetting ( TElement pResource, MonoString* msSettingName, float fSettingValue );
static bool SetInfo ( TElement pResource, MonoString* msAttribute, MonoString* msValue ); static bool SetInfo ( TElement pResource, MonoString* msAttribute, MonoString* msValue );
static bool Rename ( MonoString* msResourceName, MonoString* msNewResourceName, MonoString* msOrganizationalPath ); static bool Rename ( MonoString* msResourceName, MonoString* msNewResourceName, MonoString* msOrganizationalPath );
static bool Delete ( MonoString* msResourceName ); static bool Delete ( MonoString* msResourceName );
// static CLuaArguments* GetACLRequests ( TElement pResource ); // static CLuaArguments* GetACLRequests ( TElement pResource );
static bool UpdateACLRequest ( TElement pResource, MonoString* msRightName, bool bAccess, MonoString* msByWho ); static bool UpdateACLRequest ( TElement pResource, MonoString* msRightName, bool bAccess, MonoString* msByWho );
}; };
}; };

View File

@ -27,7 +27,7 @@ TElement CMonoFunctions::Account::Get( MonoString* msName, MonoString* msPasswor
if( pUserData ) 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
PVOID pUserData = CLuaFunctionDefinitions::GetAccountPlayer( pResource->GetLua(), pElement->ToLuaUserData() ); PVOID pUserData = CLuaFunctionDefinitions::GetAccountPlayer( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
if( CLuaFunctionDefinitions::IsGuestAccount( pResource->GetLua(), pElement->ToLuaUserData(), bIsGuest ) ) if( CLuaFunctionDefinitions::IsGuestAccount( pResource->GetLua(), pElement->GetLuaUserdata(), bIsGuest ) )
{ {
return bIsGuest; return bIsGuest;
} }
@ -89,6 +89,55 @@ bool CMonoFunctions::Account::IsGuest( TElement pAccount )
return false; 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 ) MonoString* CMonoFunctions::Account::GetSerial( TElement pAccount )
{ {
CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() ); 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 ); 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 ); return pResource->GetDomain()->NewString( strSerial );
} }
@ -108,6 +157,25 @@ MonoString* CMonoFunctions::Account::GetSerial( TElement pAccount )
return nullptr; 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 // Account set funcs
TElement CMonoFunctions::Account::Add( MonoString* msName, MonoString* msPassword ) TElement CMonoFunctions::Account::Add( MonoString* msName, MonoString* msPassword )
{ {
@ -122,7 +190,7 @@ TElement CMonoFunctions::Account::Add( MonoString* msName, MonoString* msPasswor
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
return CLuaFunctionDefinitions::RemoveAccount( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::RemoveAccount( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -153,7 +221,37 @@ bool CMonoFunctions::Account::SetPassword( TElement pAccount, MonoString* msPass
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount ); 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; return false;
@ -168,7 +266,7 @@ bool CMonoFunctions::Account::CopyData( TElement pAccount, TElement pFromAccount
CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount ); CElement* pElement = pResource->GetElementManager()->GetFromList( pAccount );
CElement* pFromElement = pResource->GetElementManager()->GetFromList( pFromAccount ); 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; return false;

View File

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

View File

@ -13,7 +13,7 @@
#include "StdInc.h" #include "StdInc.h"
#include "CMonoFunctions.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() ); 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 ) ), strIP ( mono_string_to_utf8( msIP ) ),
strUsername ( mono_string_to_utf8( msUsername ) ), strUsername ( mono_string_to_utf8( msUsername ) ),
strSerial ( mono_string_to_utf8( msSerial ) ), strSerial ( mono_string_to_utf8( msSerial ) ),
strResponsible ( mono_string_to_utf8( msResponsible ) ),
strReason ( mono_string_to_utf8( msReason ) ); strReason ( mono_string_to_utf8( msReason ) );
CElement* pElement = pResource->GetElementManager()->GetFromList( pResponsible ); 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 ) 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* pElement = pResource->GetElementManager()->GetFromList( pBan );
CElement* pResponsibleElement = pResource->GetElementManager()->GetFromList( pResponsible ); 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; 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 ) bool CMonoFunctions::Ban::Reload( void )
{ {
@ -78,7 +93,7 @@ MonoString* CMonoFunctions::Ban::GetIP( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strIP );
} }
@ -97,7 +112,7 @@ MonoString* CMonoFunctions::Ban::GetSerial( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strSerial );
} }
@ -116,7 +131,7 @@ MonoString* CMonoFunctions::Ban::GetUsername( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strUsername );
} }
@ -135,7 +150,7 @@ MonoString* CMonoFunctions::Ban::GetNick( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strNick );
} }
@ -154,7 +169,7 @@ MonoString* CMonoFunctions::Ban::GetReason( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strReason );
} }
@ -173,7 +188,7 @@ MonoString* CMonoFunctions::Ban::GetAdmin( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strAdmin );
} }
@ -193,7 +208,7 @@ int CMonoFunctions::Ban::GetBanTime( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return (int)tTime;
} }
@ -212,7 +227,7 @@ int CMonoFunctions::Ban::GetUnbanTime( TElement pBan )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return (int)tTime;
} }
@ -230,7 +245,7 @@ bool CMonoFunctions::Ban::SetUnbanTime( TElement pBan, int time )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan ); CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
return CLuaFunctionDefinitions::SetUnbanTime( pResource->GetLua(), pElement->ToLuaUserData(), time ); return CLuaFunctionDefinitions::SetUnbanTime( pResource->GetLua(), pElement->GetLuaUserdata(), time );
} }
return false; return false;
@ -246,7 +261,7 @@ bool CMonoFunctions::Ban::SetReason( TElement pBan, MonoString* msReason )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan ); CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
return CLuaFunctionDefinitions::SetBanReason( pResource->GetLua(), pElement->ToLuaUserData(), strReason ); return CLuaFunctionDefinitions::SetBanReason( pResource->GetLua(), pElement->GetLuaUserdata(), strReason );
} }
return false; return false;
@ -262,7 +277,7 @@ bool CMonoFunctions::Ban::SetAdmin( TElement pBan, MonoString* msAdminName )
CElement* pElement = pResource->GetElementManager()->GetFromList( pBan ); CElement* pElement = pResource->GetElementManager()->GetFromList( pBan );
return CLuaFunctionDefinitions::SetBanAdmin( pResource->GetLua(), pElement->ToLuaUserData(), strAdmin ); return CLuaFunctionDefinitions::SetBanAdmin( pResource->GetLua(), pElement->GetLuaUserdata(), strAdmin );
} }
return false; return false;

View File

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

View File

@ -41,7 +41,7 @@ bool CMonoFunctions::Element::Destroy( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::DestroyElement( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::DestroyElement( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -55,11 +55,11 @@ TElement CMonoFunctions::Element::Clone( TElement pThis, MonoObject* vecPosition
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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 ) 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 ) 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 ) if( pArgStartElement )
{ {
pStartElement = pResource->GetElementManager()->GetFromList( pArgStartElement )->ToLuaUserData(); pStartElement = pResource->GetElementManager()->GetFromList( pArgStartElement )->GetLuaUserdata();
} }
CLuaArgumentsVector pLuaArguments = CLuaFunctionDefinitions::GetElementsByType( pResource->GetLua(), szType, pStartElement ); 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" ); 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 ); ASSERT( pElement );
return CLuaFunctionDefinitions::IsElement( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::IsElement( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -151,7 +151,7 @@ uint32_t CMonoFunctions::Element::GetUserData( TElement pThis )
if( pElement ) 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 ); 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 ); return pResource->GetDomain()->NewString( strType );
} }
@ -186,7 +186,7 @@ TElement CMonoFunctions::Element::GetByID( MonoString* msID, unsigned int uiInde
if( pUserData ) 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 ) 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 ); 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GetElementChildrenCount( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::GetElementChildrenCount( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return 0; return 0;
@ -251,7 +251,7 @@ MonoString* CMonoFunctions::Element::GetID( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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() ); 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetElementParent( pResource->GetLua(), pElement->ToLuaUserData() ); PVOID pUserData = CLuaFunctionDefinitions::GetElementParent( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData ) 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 ); 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 ); return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
} }
@ -307,7 +307,7 @@ MonoObject* CMonoFunctions::Element::GetRotation( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
} }
@ -326,7 +326,7 @@ MonoObject* CMonoFunctions::Element::GetVelocity( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
} }
@ -345,7 +345,7 @@ unsigned char CMonoFunctions::Element::GetInterior( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return ucInterior;
} }
@ -364,7 +364,7 @@ bool CMonoFunctions::Element::IsWithinColShape( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bWithin;
} }
@ -383,7 +383,7 @@ bool CMonoFunctions::Element::IsWithinMarker( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bWithin;
} }
@ -402,7 +402,7 @@ unsigned short CMonoFunctions::Element::GetDimension( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return usDimension;
} }
@ -421,7 +421,7 @@ MonoString* CMonoFunctions::Element::GetZoneName( TElement pThis, bool bCitiesOn
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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 ); return pResource->GetDomain()->NewString( strOutName );
} }
@ -438,7 +438,7 @@ bool CMonoFunctions::Element::IsAttached( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::IsElementAttached( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::IsElementAttached( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -452,11 +452,11 @@ TElement CMonoFunctions::Element::GetAttachedTo( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetElementColShape( pResource->GetLua(), pElement->ToLuaUserData() ); PVOID pUserData = CLuaFunctionDefinitions::GetElementColShape( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetElementAlpha( pResource->GetLua(), pElement->ToLuaUserData(), ucAlpha ) ) if( CLuaFunctionDefinitions::GetElementAlpha( pResource->GetLua(), pElement->GetLuaUserdata(), ucAlpha ) )
{ {
return ucAlpha; return ucAlpha;
} }
@ -511,7 +511,7 @@ bool CMonoFunctions::Element::IsDoubleSided( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bDoubleSided;
} }
@ -530,7 +530,7 @@ float CMonoFunctions::Element::GetHealth( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return fHealth;
} }
@ -549,7 +549,7 @@ unsigned short CMonoFunctions::Element::GetModel( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return usModel;
} }
@ -568,7 +568,7 @@ bool CMonoFunctions::Element::IsInWater( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bInWater;
} }
@ -587,7 +587,7 @@ MonoObject* CMonoFunctions::Element::GetAttachedOffsetPosition( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
} }
@ -606,7 +606,7 @@ MonoObject* CMonoFunctions::Element::GetAttachedOffsetRotation( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->GetMTALib()->Vector3->New( vecRotation );
} }
@ -623,11 +623,11 @@ TElement CMonoFunctions::Element::GetSyncer( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GetElementCollisionsEnabled( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::GetElementCollisionsEnabled( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -658,7 +658,7 @@ bool CMonoFunctions::Element::IsFrozen( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bFrozen;
} }
@ -677,11 +677,11 @@ TElement CMonoFunctions::Element::GetLowLod( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsElementLowLod( pResource->GetLua(), pElement->ToLuaUserData(), bIsLowLod ) ) if( CLuaFunctionDefinitions::IsElementLowLod( pResource->GetLua(), pElement->GetLuaUserdata(), bIsLowLod ) )
{ {
return bIsLowLod; return bIsLowLod;
} }
@ -718,7 +718,7 @@ bool CMonoFunctions::Element::ClearVisibleTo( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ClearElementVisibleTo( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::ClearElementVisibleTo( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -732,7 +732,7 @@ bool CMonoFunctions::Element::SetID( TElement pThis, MonoString* msID )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -748,7 +748,7 @@ bool CMonoFunctions::Element::SetData( TElement pThis, MonoString* msKey, CLuaAr
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -764,7 +764,7 @@ bool CMonoFunctions::Element::RemoveData( TElement pThis, MonoString* msKey )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveElementData( pResource->GetLua(), pElement->ToLuaUserData(), strKey ); return CLuaFunctionDefinitions::RemoveElementData( pResource->GetLua(), pElement->GetLuaUserdata(), strKey );
} }
return false; return false;
@ -779,7 +779,7 @@ bool CMonoFunctions::Element::SetParent( TElement pThis, TElement pTarget )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementTarget = pResource->GetElementManager()->GetFromList( pTarget ); 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; return false;
@ -793,7 +793,7 @@ bool CMonoFunctions::Element::SetPosition( TElement pThis, MonoObject* pPosition
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -809,7 +809,7 @@ bool CMonoFunctions::Element::SetRotation( TElement pThis, MonoObject* pRotation
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -823,7 +823,7 @@ bool CMonoFunctions::Element::SetVelocity( TElement pThis, MonoObject* pVelocity
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -838,7 +838,7 @@ bool CMonoFunctions::Element::SetVisibleTo( TElement pThis, TElement pTarget, bo
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementTarget = pResource->GetElementManager()->GetFromList( pTarget ); 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; return false;
@ -852,7 +852,7 @@ bool CMonoFunctions::Element::SetInterior( TElement pThis, int iInterior )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementInterior( pResource->GetLua(), pElement->ToLuaUserData(), iInterior ); return CLuaFunctionDefinitions::SetElementInterior( pResource->GetLua(), pElement->GetLuaUserdata(), iInterior );
} }
return false; return false;
@ -866,7 +866,7 @@ bool CMonoFunctions::Element::SetDimension( TElement pThis, int iDimension )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementDimension( pResource->GetLua(), pElement->ToLuaUserData(), iDimension ); return CLuaFunctionDefinitions::SetElementDimension( pResource->GetLua(), pElement->GetLuaUserdata(), iDimension );
} }
return false; return false;
@ -885,7 +885,7 @@ bool CMonoFunctions::Element::Attach( TElement pThis, TElement pTarget, MonoObje
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementTarget = pResource->GetElementManager()->GetFromList( pTarget ); 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; return false;
@ -900,7 +900,7 @@ bool CMonoFunctions::Element::Detach( TElement pThis, TElement pTarget )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementTarget = pResource->GetElementManager()->GetFromList( pTarget ); 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; return false;
@ -914,7 +914,7 @@ bool CMonoFunctions::Element::SetAlpha( TElement pThis, int iAlpha )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementAlpha( pResource->GetLua(), pElement->ToLuaUserData(), iAlpha ); return CLuaFunctionDefinitions::SetElementAlpha( pResource->GetLua(), pElement->GetLuaUserdata(), iAlpha );
} }
return false; return false;
@ -928,7 +928,7 @@ bool CMonoFunctions::Element::SetDoubleSided( TElement pThis, bool bDoubleSided
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementDoubleSided( pResource->GetLua(), pElement->ToLuaUserData(), bDoubleSided ); return CLuaFunctionDefinitions::SetElementDoubleSided( pResource->GetLua(), pElement->GetLuaUserdata(), bDoubleSided );
} }
return false; return false;
@ -942,7 +942,7 @@ bool CMonoFunctions::Element::SetHealth( TElement pThis, float fHealth )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementHealth( pResource->GetLua(), pElement->ToLuaUserData(), fHealth ); return CLuaFunctionDefinitions::SetElementHealth( pResource->GetLua(), pElement->GetLuaUserdata(), fHealth );
} }
return false; return false;
@ -956,7 +956,7 @@ bool CMonoFunctions::Element::SetModel( TElement pThis, int iModel )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementModel( pResource->GetLua(), pElement->ToLuaUserData(), iModel ); return CLuaFunctionDefinitions::SetElementModel( pResource->GetLua(), pElement->GetLuaUserdata(), iModel );
} }
return false; return false;
@ -974,7 +974,7 @@ bool CMonoFunctions::Element::SetAttachedOffsets( TElement pThis, MonoObject* pM
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -989,7 +989,7 @@ bool CMonoFunctions::Element::SetSyncer( TElement pThis, TElement pPlayer )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pElementPlayer = pResource->GetElementManager()->GetFromList( pPlayer ); 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; return false;
@ -1003,7 +1003,7 @@ bool CMonoFunctions::Element::SetCollisionsEnabled( TElement pThis, bool bEnable
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementCollisionsEnabled( pResource->GetLua(), pElement->ToLuaUserData(), bEnabled ); return CLuaFunctionDefinitions::SetElementCollisionsEnabled( pResource->GetLua(), pElement->GetLuaUserdata(), bEnabled );
} }
return false; return false;
@ -1017,7 +1017,7 @@ bool CMonoFunctions::Element::SetFrozen( TElement pThis, bool bFrozen )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementFrozen( pResource->GetLua(), pElement->ToLuaUserData(), bFrozen ); return CLuaFunctionDefinitions::SetElementFrozen( pResource->GetLua(), pElement->GetLuaUserdata(), bFrozen );
} }
return false; return false;
@ -1031,7 +1031,7 @@ bool CMonoFunctions::Element::SetLowLod( TElement pThis, bool bEnabled )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetLowLodElement( pResource->GetLua(), pElement->ToLuaUserData(), bEnabled ); return CLuaFunctionDefinitions::SetLowLodElement( pResource->GetLua(), pElement->GetLuaUserdata(), bEnabled );
} }
return false; return false;

View File

@ -118,7 +118,7 @@ bool CMonoFunctions::Event::Trigger( MonoString* msName, TElement pArgElement, M
CElement* pElement = pResource->GetElementManager()->GetFromList( pArgElement ); 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; return false;
@ -175,7 +175,7 @@ bool CMonoFunctions::Event::TriggerClient( TElement pSendTo, MonoString* msName,
CLuaArguments Arguments = CMonoInterface::MonoArrayToLuaArguments( mpArguments, pResource ); 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; return false;

View File

@ -14,15 +14,20 @@
#include "CMonoFunctions.h" #include "CMonoFunctions.h"
// Explosion funcs // 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() ); CResource* pResource = g_pModule->GetResourceManager()->GetFromList( mono_domain_get() );
if( pResource ) 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; return false;

View File

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

View File

@ -43,7 +43,7 @@ MonoObject* CMonoFunctions::Object::GetScale( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); 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 ); 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; return false;
@ -82,7 +82,7 @@ bool CMonoFunctions::Object::Move( TElement pThis, unsigned long ulTime, MonoObj
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -96,7 +96,7 @@ bool CMonoFunctions::Object::Stop( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::StopObject( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::StopObject( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;

View File

@ -40,7 +40,7 @@ float CMonoFunctions::Ped::GetArmor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return fArmor;
} }
@ -59,7 +59,7 @@ bool CMonoFunctions::Ped::IsChoking( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bChoking;
} }
@ -78,7 +78,7 @@ bool CMonoFunctions::Ped::IsDead( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bDead;
} }
@ -97,7 +97,7 @@ bool CMonoFunctions::Ped::IsDucked( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bDucked;
} }
@ -116,7 +116,7 @@ float CMonoFunctions::Ped::GetStat( TElement pThis, unsigned short usStat )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return fStat;
} }
@ -133,11 +133,11 @@ TElement CMonoFunctions::Ped::GetTarget( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GetPedWeapon( pResource->GetLua(), pElement->ToLuaUserData(), iWeaponSlot ); return CLuaFunctionDefinitions::GetPedWeapon( pResource->GetLua(), pElement->GetLuaUserdata(), iWeaponSlot );
} }
return 0; return 0;
@ -168,7 +168,7 @@ MonoString* CMonoFunctions::Ped::GetClothesTexture( TElement pThis, unsigned cha
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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 ); return pResource->GetDomain()->NewString( strOutTexture );
} }
@ -187,7 +187,7 @@ MonoString* CMonoFunctions::Ped::GetClothesModel( TElement pThis, unsigned char
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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 ); return pResource->GetDomain()->NewString( strOutModel );
} }
@ -206,7 +206,7 @@ bool CMonoFunctions::Ped::DoesHaveJetPack( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bHasJetPack;
} }
@ -225,7 +225,7 @@ bool CMonoFunctions::Ped::IsOnGround( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bOnGround;
} }
@ -244,7 +244,7 @@ unsigned char CMonoFunctions::Ped::GetFightingStyle( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return ucStyle;
} }
@ -263,7 +263,7 @@ unsigned int CMonoFunctions::Ped::GetMoveAnim( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return uiMoveAnim;
} }
@ -282,7 +282,7 @@ float CMonoFunctions::Ped::GetGravity( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return fGravity;
} }
@ -299,11 +299,11 @@ TElement CMonoFunctions::Ped::GetContactElement( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedWeaponSlot( pResource->GetLua(), pElement->ToLuaUserData(), ucWeaponSlot ) ) if( CLuaFunctionDefinitions::GetPedWeaponSlot( pResource->GetLua(), pElement->GetLuaUserdata(), ucWeaponSlot ) )
{ {
return ucWeaponSlot; return ucWeaponSlot;
} }
@ -339,7 +339,7 @@ bool CMonoFunctions::Ped::IsDoingGangDriveby( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bDoingGangDriveby;
} }
@ -358,7 +358,7 @@ bool CMonoFunctions::Ped::IsOnFire( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bOnFire;
} }
@ -377,7 +377,7 @@ bool CMonoFunctions::Ped::IsHeadless( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bHeadless;
} }
@ -396,7 +396,7 @@ bool CMonoFunctions::Ped::IsFrozen( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bFrozen;
} }
@ -413,11 +413,11 @@ TElement CMonoFunctions::Ped::GetOccupiedVehicle( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPedOccupiedVehicleSeat( pResource->GetLua(), pElement->ToLuaUserData(), uiSeat ) ) if( CLuaFunctionDefinitions::GetPedOccupiedVehicleSeat( pResource->GetLua(), pElement->GetLuaUserdata(), uiSeat ) )
{ {
return uiSeat; return uiSeat;
} }
@ -453,7 +453,7 @@ bool CMonoFunctions::Ped::IsInVehicle( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bInVehicle;
} }
@ -512,7 +512,7 @@ bool CMonoFunctions::Ped::SetArmor( TElement pThis, float fArmor )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedArmor( pResource->GetLua(), pElement->ToLuaUserData(), fArmor ); return CLuaFunctionDefinitions::SetPedArmor( pResource->GetLua(), pElement->GetLuaUserdata(), fArmor );
} }
return false; return false;
@ -527,7 +527,7 @@ bool CMonoFunctions::Ped::Kill( TElement pThis, TElement pKiller, unsigned char
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pKillerElement = pResource->GetElementManager()->GetFromList( pKiller ); 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; return false;
@ -541,7 +541,7 @@ bool CMonoFunctions::Ped::SetStat( TElement pThis, unsigned short usStat, float
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -558,7 +558,7 @@ bool CMonoFunctions::Ped::AddClothes( TElement pThis, MonoString* msTexture, Mon
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -575,7 +575,7 @@ bool CMonoFunctions::Ped::RemoveClothes( TElement pThis, unsigned char ucType, M
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -589,7 +589,7 @@ bool CMonoFunctions::Ped::GiveJetPack( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GivePedJetPack( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::GivePedJetPack( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -603,7 +603,7 @@ bool CMonoFunctions::Ped::RemoveJetPack( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemovePedJetPack( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::RemovePedJetPack( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -617,7 +617,7 @@ bool CMonoFunctions::Ped::SetFightingStyle( TElement pThis, unsigned char ucStyl
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedFightingStyle( pResource->GetLua(), pElement->ToLuaUserData(), ucStyle ); return CLuaFunctionDefinitions::SetPedFightingStyle( pResource->GetLua(), pElement->GetLuaUserdata(), ucStyle );
} }
return false; return false;
@ -631,7 +631,7 @@ bool CMonoFunctions::Ped::SetMoveAnim( TElement pThis, unsigned int iMoveAnim )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedMoveAnim( pResource->GetLua(), pElement->ToLuaUserData(), iMoveAnim ); return CLuaFunctionDefinitions::SetPedMoveAnim( pResource->GetLua(), pElement->GetLuaUserdata(), iMoveAnim );
} }
return false; return false;
@ -645,7 +645,7 @@ bool CMonoFunctions::Ped::SetGravity( TElement pThis, float fGravity )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedGravity( pResource->GetLua(), pElement->ToLuaUserData(), fGravity ); return CLuaFunctionDefinitions::SetPedGravity( pResource->GetLua(), pElement->GetLuaUserdata(), fGravity );
} }
return false; return false;
@ -659,7 +659,7 @@ bool CMonoFunctions::Ped::SetChoking( TElement pThis, bool bChoking )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedChoking( pResource->GetLua(), pElement->ToLuaUserData(), bChoking ); return CLuaFunctionDefinitions::SetPedChoking( pResource->GetLua(), pElement->GetLuaUserdata(), bChoking );
} }
return false; return false;
@ -673,7 +673,7 @@ bool CMonoFunctions::Ped::SetWeaponSlot( TElement pThis, unsigned char ucWeaponS
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedWeaponSlot( pResource->GetLua(), pElement->ToLuaUserData(), ucWeaponSlot ); return CLuaFunctionDefinitions::SetPedWeaponSlot( pResource->GetLua(), pElement->GetLuaUserdata(), ucWeaponSlot );
} }
return false; return false;
@ -688,7 +688,7 @@ bool CMonoFunctions::Ped::WarpIntoVehicle( TElement pThis, TElement pVehicle, un
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pVehicleElement = 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; return false;
@ -702,7 +702,7 @@ bool CMonoFunctions::Ped::RemoveFromVehicle( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemovePedFromVehicle( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::RemovePedFromVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -716,7 +716,7 @@ bool CMonoFunctions::Ped::SetDoingGangDriveby( TElement pThis, bool bGangDriveby
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedDoingGangDriveby( pResource->GetLua(), pElement->ToLuaUserData(), bGangDriveby ); return CLuaFunctionDefinitions::SetPedDoingGangDriveby( pResource->GetLua(), pElement->GetLuaUserdata(), bGangDriveby );
} }
return false; return false;
@ -733,7 +733,7 @@ bool CMonoFunctions::Ped::SetAnimation( TElement pThis, MonoString* msBlockName,
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -749,7 +749,7 @@ bool CMonoFunctions::Ped::SetAnimationProgress( TElement pThis, MonoString* msAn
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -763,7 +763,7 @@ bool CMonoFunctions::Ped::SetOnFire( TElement pThis, bool bIsOnFire )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedOnFire( pResource->GetLua(), pElement->ToLuaUserData(), bIsOnFire ); return CLuaFunctionDefinitions::SetPedOnFire( pResource->GetLua(), pElement->GetLuaUserdata(), bIsOnFire );
} }
return false; return false;
@ -777,7 +777,7 @@ bool CMonoFunctions::Ped::SetHeadless( TElement pThis, bool bIsHeadless )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedHeadless( pResource->GetLua(), pElement->ToLuaUserData(), bIsHeadless ); return CLuaFunctionDefinitions::SetPedHeadless( pResource->GetLua(), pElement->GetLuaUserdata(), bIsHeadless );
} }
return false; return false;
@ -791,7 +791,7 @@ bool CMonoFunctions::Ped::SetFrozen( TElement pThis, bool bIsFrozen )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPedFrozen( pResource->GetLua(), pElement->ToLuaUserData(), bIsFrozen ); return CLuaFunctionDefinitions::SetPedFrozen( pResource->GetLua(), pElement->GetLuaUserdata(), bIsFrozen );
} }
return false; return false;
@ -805,7 +805,7 @@ bool CMonoFunctions::Ped::ReloadWeapon( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ReloadPedWeapon( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::ReloadPedWeapon( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -856,7 +856,7 @@ MonoArray* CMonoFunctions::Ped::GetClothesByTypeIndex( unsigned char ucType, uns
if( CLuaFunctionDefinitions::GetClothesByTypeIndex( pResource->GetLua(), ucType, ucIndex, szTexture, szModel ) ) 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 ) if( pArray )
{ {
@ -884,7 +884,7 @@ MonoArray* CMonoFunctions::Ped::GetTypeIndexFromClothes( MonoString* msTexture,
if( CLuaFunctionDefinitions::GetTypeIndexFromClothes( pResource->GetLua(), szTexture, szModel, ucType, ucIndex ) ) 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 ) if( pArray )
{ {
@ -926,7 +926,7 @@ bool CMonoFunctions::Ped::GiveWeapon( TElement pThis, unsigned char ucWeaponID,
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -940,7 +940,7 @@ bool CMonoFunctions::Ped::TakeWeapon( TElement pThis, unsigned char ucWeaponID,
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -954,7 +954,7 @@ bool CMonoFunctions::Ped::TakeAllWeapons( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::TakeAllWeapons( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::TakeAllWeapons( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -968,7 +968,7 @@ bool CMonoFunctions::Ped::SetWeaponAmmo( TElement pThis, unsigned char ucWeaponI
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;

View File

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

View File

@ -38,7 +38,7 @@ TElement CMonoFunctions::Player::GetFromName( MonoString* msNick )
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerPing( pResource->GetLua(), pElement->ToLuaUserData(), uiPing ) ) if( CLuaFunctionDefinitions::GetPlayerPing( pResource->GetLua(), pElement->GetLuaUserdata(), uiPing ) )
{ {
return uiPing; return uiPing;
} }
@ -74,7 +74,7 @@ long CMonoFunctions::Player::GetMoney( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return lMoney;
} }
@ -93,7 +93,7 @@ TElement CMonoFunctions::Player::GetRandom( void )
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsPlayerMuted( pResource->GetLua(), pElement->ToLuaUserData(), bMuted ) ) if( CLuaFunctionDefinitions::IsPlayerMuted( pResource->GetLua(), pElement->GetLuaUserdata(), bMuted ) )
{ {
return bMuted; return bMuted;
} }
@ -127,11 +127,11 @@ TElement CMonoFunctions::Player::GetTeam( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerWantedLevel( pResource->GetLua(), pElement->ToLuaUserData(), uiWantedLevel ) ) if( CLuaFunctionDefinitions::GetPlayerWantedLevel( pResource->GetLua(), pElement->GetLuaUserdata(), uiWantedLevel ) )
{ {
return uiWantedLevel; return uiWantedLevel;
} }
@ -167,7 +167,7 @@ MonoArray* CMonoFunctions::Player::GetAlivePlayers( void )
if( pLuaArguments.size() > 0 ) 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetPlayerIdleTime( pResource->GetLua(), pElement->ToLuaUserData(), uiIdleTime ) ) if( CLuaFunctionDefinitions::GetPlayerIdleTime( pResource->GetLua(), pElement->GetLuaUserdata(), uiIdleTime ) )
{ {
return uiIdleTime; return uiIdleTime;
} }
@ -220,7 +220,7 @@ bool CMonoFunctions::Player::IsMapForced( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bForced;
} }
@ -239,7 +239,7 @@ MonoString* CMonoFunctions::Player::GetNametagText( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strOutText );
} }
@ -258,7 +258,7 @@ MonoObject* CMonoFunctions::Player::GetNametagColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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[] = PVOID args[] =
{ {
@ -282,7 +282,7 @@ bool CMonoFunctions::Player::IsNametagShowing( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bShowing;
} }
@ -299,7 +299,7 @@ MonoString* CMonoFunctions::Player::GetSerial( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return nullptr;
@ -313,7 +313,7 @@ MonoString* CMonoFunctions::Player::GetUserName( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return nullptr;
@ -329,7 +329,7 @@ unsigned char CMonoFunctions::Player::GetBlurLevel( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return ucBlurLevel;
} }
@ -348,7 +348,7 @@ MonoString* CMonoFunctions::Player::GetName( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strOutName );
} }
@ -367,7 +367,7 @@ MonoString* CMonoFunctions::Player::GetIP( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strIP );
} }
@ -384,11 +384,11 @@ TElement CMonoFunctions::Player::GetAccount( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); 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; return nullptr;
@ -417,17 +417,17 @@ MonoObject* CMonoFunctions::Player::GetACInfo( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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* msDetectedAC = pResource->GetDomain()->NewString( pLuaTable[ "DetectedAC" ].GetString() );
MonoString* msD3D9MD5 = pResource->GetDomain()->NewString( (*pLuaTable)[ "d3d9MD5" ].GetString() ); MonoString* msD3D9MD5 = pResource->GetDomain()->NewString( pLuaTable[ "d3d9MD5" ].GetString() );
MonoString* msD3D9SHA256 = pResource->GetDomain()->NewString( (*pLuaTable)[ "d3d9SHA256" ].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, &msDetectedAC,
&iD3D9Size, &iD3D9Size,
@ -467,7 +467,7 @@ bool CMonoFunctions::Player::SetMoney( TElement pThis, int iAmount, bool bInstan
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -481,7 +481,7 @@ bool CMonoFunctions::Player::GiveMoney( TElement pThis, int iAmount )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::GivePlayerMoney( pResource->GetLua(), pElement->ToLuaUserData(), iAmount ); return CLuaFunctionDefinitions::GivePlayerMoney( pResource->GetLua(), pElement->GetLuaUserdata(), iAmount );
} }
return false; return false;
@ -495,7 +495,7 @@ bool CMonoFunctions::Player::TakeMoney( TElement pThis, int iAmount )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::TakePlayerMoney( pResource->GetLua(), pElement->ToLuaUserData(), iAmount ); return CLuaFunctionDefinitions::TakePlayerMoney( pResource->GetLua(), pElement->GetLuaUserdata(), iAmount );
} }
return false; return false;
@ -511,7 +511,7 @@ bool CMonoFunctions::Player::Spawn( TElement pThis, MonoObject* pPosition, int i
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -527,7 +527,7 @@ bool CMonoFunctions::Player::ShowHudComponent( TElement pThis, MonoString* msCom
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -541,7 +541,7 @@ bool CMonoFunctions::Player::SetWantedLevel( TElement pThis, int iLevel )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerWantedLevel( pResource->GetLua(), pElement->ToLuaUserData(), iLevel ); return CLuaFunctionDefinitions::SetPlayerWantedLevel( pResource->GetLua(), pElement->GetLuaUserdata(), iLevel );
} }
return false; return false;
@ -555,7 +555,7 @@ bool CMonoFunctions::Player::ForceMap( TElement pThis, bool bForceOn )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ForcePlayerMap( pResource->GetLua(), pElement->ToLuaUserData(), bForceOn ); return CLuaFunctionDefinitions::ForcePlayerMap( pResource->GetLua(), pElement->GetLuaUserdata(), bForceOn );
} }
return false; return false;
@ -569,7 +569,7 @@ bool CMonoFunctions::Player::SetNametagText( TElement pThis, MonoString* sText )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -583,7 +583,7 @@ bool CMonoFunctions::Player::SetNametagColor( TElement pThis, int iRed, int iGre
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -597,7 +597,7 @@ bool CMonoFunctions::Player::SetNametagShowing( TElement pThis, bool bShowing )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerNametagShowing( pResource->GetLua(), pElement->ToLuaUserData(), bShowing ); return CLuaFunctionDefinitions::SetPlayerNametagShowing( pResource->GetLua(), pElement->GetLuaUserdata(), bShowing );
} }
return false; return false;
@ -611,7 +611,7 @@ bool CMonoFunctions::Player::SetMuted( TElement pThis, bool bMuted )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerMuted( pResource->GetLua(), pElement->ToLuaUserData(), bMuted ); return CLuaFunctionDefinitions::SetPlayerMuted( pResource->GetLua(), pElement->GetLuaUserdata(), bMuted );
} }
return false; return false;
@ -625,7 +625,7 @@ bool CMonoFunctions::Player::SetBlurLevel( TElement pThis, int iLevel )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerBlurLevel( pResource->GetLua(), pElement->ToLuaUserData(), iLevel ); return CLuaFunctionDefinitions::SetPlayerBlurLevel( pResource->GetLua(), pElement->GetLuaUserdata(), iLevel );
} }
return false; return false;
@ -642,7 +642,7 @@ bool CMonoFunctions::Player::Redirect( TElement pThis, MonoString* sServerIP, in
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -658,7 +658,7 @@ bool CMonoFunctions::Player::SetName( TElement pThis, MonoString* sName )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetPlayerName( pResource->GetLua(), pElement->ToLuaUserData(), szName ); return CLuaFunctionDefinitions::SetPlayerName( pResource->GetLua(), pElement->GetLuaUserdata(), szName );
} }
return false; return false;
@ -672,7 +672,7 @@ bool CMonoFunctions::Player::DetonateSatchels( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::DetonateSatchels( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::DetonateSatchels( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -688,7 +688,7 @@ bool CMonoFunctions::Player::TakeScreenShot( TElement pThis, int iWidth, int iHe
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -703,7 +703,7 @@ bool CMonoFunctions::Player::SetTeam( TElement pThis, TElement pTeam )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pTeaElement = pResource->GetElementManager()->GetFromList( pTeam ); 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; return false;
@ -741,7 +741,7 @@ bool CMonoFunctions::Player::BindKey( TElement pThis, MonoString* msKey, MonoStr
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -759,7 +759,7 @@ bool CMonoFunctions::Player::UnbindKey( TElement pThis, MonoString* msKey, MonoS
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -777,7 +777,7 @@ bool CMonoFunctions::Player::GetControlState( TElement pThis, MonoString* msCont
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return bState;
} }
@ -798,7 +798,7 @@ bool CMonoFunctions::Player::IsControlEnabled( TElement pThis, MonoString* msCon
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return bEnabled;
} }
@ -818,7 +818,7 @@ bool CMonoFunctions::Player::SetControlState( TElement pThis, MonoString* msCont
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -834,7 +834,7 @@ bool CMonoFunctions::Player::ToggleControl( TElement pThis, MonoString* msContro
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -848,7 +848,7 @@ bool CMonoFunctions::Player::ToggleAllControls( TElement pThis, bool bGTAControl
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -865,7 +865,7 @@ bool CMonoFunctions::Player::LogIn( TElement pThis, TElement pAccount, MonoStrin
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pAccountElement = pResource->GetElementManager()->GetFromList( pAccount ); 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; return false;
@ -879,7 +879,7 @@ bool CMonoFunctions::Player::LogOut( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::LogOut( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::LogOut( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -899,7 +899,7 @@ bool CMonoFunctions::Player::Kick( TElement pThis, MonoString* msResponsible, Mo
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -921,14 +921,14 @@ TElement CMonoFunctions::Player::Ban( TElement pThis, bool bIP, bool bUsername,
if( pArgResponsible ) 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::IsCursorShowing( pResource->GetLua(), pElement->ToLuaUserData(), bShowing ) ) if( CLuaFunctionDefinitions::IsCursorShowing( pResource->GetLua(), pElement->GetLuaUserdata(), bShowing ) )
{ {
return bShowing; return bShowing;
} }
@ -966,7 +966,7 @@ bool CMonoFunctions::Player::ShowCursor( TElement pThis, bool bShow, bool bToggl
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -982,7 +982,7 @@ bool CMonoFunctions::Player::ShowChat( TElement pThis, bool bShow )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ShowChat( pResource->GetLua(), pElement->ToLuaUserData(), bShow ); return CLuaFunctionDefinitions::ShowChat( pResource->GetLua(), pElement->GetLuaUserdata(), bShow );
} }
return false; return false;
@ -1002,7 +1002,7 @@ MonoObject* CMonoFunctions::Player::GetCameraMatrix( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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[] = PVOID args[] =
{ {
@ -1031,11 +1031,11 @@ TElement CMonoFunctions::Player::GetCameraTarget( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetCameraInterior( pResource->GetLua(), pElement->ToLuaUserData(), ucInterior ) ) if( CLuaFunctionDefinitions::GetCameraInterior( pResource->GetLua(), pElement->GetLuaUserdata(), ucInterior ) )
{ {
return ucInterior; return ucInterior;
} }
@ -1069,20 +1069,20 @@ bool CMonoFunctions::Player::SetCameraMatrix( TElement pThis, MonoObject* pCamer
if( pResource ) if( pResource )
{ {
MonoObject* msPosition = CMonoObject::GetPropertyValue< MonoObject* >( pCameraMatrix, "Position" ); MonoObject* msPosition = SharedUtil::MonoObject::GetPropertyValue< MonoObject* >( pCameraMatrix, "Position" );
Vector3 vecPosition( msPosition ); Vector3 vecPosition( msPosition );
MonoObject* msLookAt = CMonoObject::GetPropertyValue< MonoObject* >( pCameraMatrix, "LookAt" ); MonoObject* msLookAt = SharedUtil::MonoObject::GetPropertyValue< MonoObject* >( pCameraMatrix, "LookAt" );
Vector3 vecLookAt( msLookAt ); Vector3 vecLookAt( msLookAt );
float fRoll = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "Roll" ); float fRoll = SharedUtil::MonoObject::GetPropertyValue< float >( pCameraMatrix, "Roll" );
float fFOV = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "FOV" ); float fFOV = SharedUtil::MonoObject::GetPropertyValue< float >( pCameraMatrix, "FOV" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1096,7 +1096,7 @@ bool CMonoFunctions::Player::SetCameraTarget( TElement pThis, TElement pTarget )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1110,7 +1110,7 @@ bool CMonoFunctions::Player::SetCameraInterior( TElement pThis, unsigned char uc
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetCameraInterior( pResource->GetLua(), pElement->ToLuaUserData(), ucInterior ); return CLuaFunctionDefinitions::SetCameraInterior( pResource->GetLua(), pElement->GetLuaUserdata(), ucInterior );
} }
return false; return false;
@ -1122,13 +1122,13 @@ bool CMonoFunctions::Player::FadeCamera( TElement pThis, bool bFadeIn, float fFa
if( pResource ) if( pResource )
{ {
unsigned char ucReed = CMonoObject::GetPropertyValue< unsigned char >( pColor, "R" ); unsigned char ucReed = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "R" );
unsigned char ucGreen = CMonoObject::GetPropertyValue< unsigned char >( pColor, "G" ); unsigned char ucGreen = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "G" );
unsigned char ucBlue = CMonoObject::GetPropertyValue< unsigned char >( pColor, "B" ); unsigned char ucBlue = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "B" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;

View File

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

View File

@ -42,11 +42,11 @@ TElement CMonoFunctions::Resource::Copy( TElement pThis, MonoString* msNewResour
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetResourceRootElement( pResource->GetLua(), pElement->ToLuaUserData() ); PVOID pUserData = CLuaFunctionDefinitions::GetResourceRootElement( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData ) 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 ); 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetResourceDynamicElementRoot( pResource->GetLua(), pElement->ToLuaUserData() ); PVOID pUserData = CLuaFunctionDefinitions::GetResourceDynamicElementRoot( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveResourceFile( pResource->GetLua(), pElement->ToLuaUserData(), szFileName ); return CLuaFunctionDefinitions::RemoveResourceFile( pResource->GetLua(), pElement->GetLuaUserdata(), szFileName );
} }
return false; return false;
@ -140,7 +140,7 @@ TElement CMonoFunctions::Resource::GetFromName( MonoString* msResourceName )
if( pUserData ) 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 ); 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 ); return pResource->GetDomain()->NewString( strOutInfo );
} }
@ -178,7 +178,7 @@ unsigned int CMonoFunctions::Resource::GetLastStartTime( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return uiTime;
} }
@ -197,7 +197,7 @@ MonoString* CMonoFunctions::Resource::GetLoadFailureReason( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strOutReason );
} }
@ -216,7 +216,7 @@ unsigned int CMonoFunctions::Resource::GetLoadTime( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return uiTime;
} }
@ -235,7 +235,7 @@ MonoString* CMonoFunctions::Resource::GetName( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strOut );
} }
@ -254,7 +254,7 @@ MonoArray* CMonoFunctions::Resource::GetResources( void )
if( pLuaTable.size() > 0 ) 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 ); 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 ); return pResource->GetDomain()->NewString( strOut );
} }
@ -290,7 +290,7 @@ TElement CMonoFunctions::Resource::GetCurrent( void )
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveResourceDefaultSetting( pResource->GetLua(), pElement->ToLuaUserData(), szSettingName ); return CLuaFunctionDefinitions::RemoveResourceDefaultSetting( pResource->GetLua(), pElement->GetLuaUserdata(), szSettingName );
} }
return false; return false;
@ -333,7 +333,7 @@ bool CMonoFunctions::Resource::Start( TElement pThis, bool persistent, bool star
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -347,7 +347,7 @@ bool CMonoFunctions::Resource::Restart( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RestartResource( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::RestartResource( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -361,7 +361,7 @@ bool CMonoFunctions::Resource::Stop( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::StopResource( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::StopResource( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -378,7 +378,7 @@ bool CMonoFunctions::Resource::SetDefaultSetting( TElement pThis, MonoString* ms
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -395,7 +395,7 @@ bool CMonoFunctions::Resource::SetInfo( TElement pThis, MonoString* msAttribute,
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -442,7 +442,7 @@ bool CMonoFunctions::Resource::UpdateACLRequest( TElement pThis, MonoString* msR
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;

View File

@ -21,7 +21,7 @@ void CMonoFunctions::Team::Ctor( TElement pThis, MonoString* msTeamName, MonoObj
if( pResource ) if( pResource )
{ {
const char* szTeamName = mono_string_to_utf8( msTeamName ); 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 ); 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 ) 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 ); 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 ); return pResource->GetDomain()->NewString( strOutName );
} }
@ -79,7 +79,7 @@ MonoObject* CMonoFunctions::Team::GetColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->GetMTALib()->Color->New( pColor );
} }
@ -98,7 +98,7 @@ unsigned int CMonoFunctions::Team::CountPlayers( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return uiCount;
} }
@ -117,7 +117,7 @@ bool CMonoFunctions::Team::GetFriendlyFire( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bFriendlyFire;
} }
@ -138,7 +138,7 @@ bool CMonoFunctions::Team::SetName( TElement pThis, MonoString* msTeamName )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTeamName( pResource->GetLua(), pElement->ToLuaUserData(), szTeamName ); return CLuaFunctionDefinitions::SetTeamName( pResource->GetLua(), pElement->GetLuaUserdata(), szTeamName );
} }
return false; return false;
@ -150,11 +150,11 @@ bool CMonoFunctions::Team::SetColor( TElement pThis, MonoObject* mColor )
if( pResource ) if( pResource )
{ {
SColor pColor = CMonoObject::GetColor( mColor ); SColor pColor = SharedUtil::MonoObject::GetColor( mColor );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -168,7 +168,7 @@ bool CMonoFunctions::Team::SetFriendlyFire( TElement pThis, bool bFriendlyFire )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTeamFriendlyFire( pResource->GetLua(), pElement->ToLuaUserData(), bFriendlyFire ); return CLuaFunctionDefinitions::SetTeamFriendlyFire( pResource->GetLua(), pElement->GetLuaUserdata(), bFriendlyFire );
} }
return false; return false;

View File

@ -30,16 +30,16 @@ void CMonoFunctions::Vehicle::Ctor( TElement pThis, int model, MonoObject* posit
if( position ) if( position )
{ {
fX = CMonoObject::GetPropertyValue< float >( position, "X" ); fX = SharedUtil::MonoObject::GetPropertyValue< float >( position, "X" );
fY = CMonoObject::GetPropertyValue< float >( position, "Y" ); fY = SharedUtil::MonoObject::GetPropertyValue< float >( position, "Y" );
fZ = CMonoObject::GetPropertyValue< float >( position, "Z" ); fZ = SharedUtil::MonoObject::GetPropertyValue< float >( position, "Z" );
} }
if( rotation ) if( rotation )
{ {
fRX = CMonoObject::GetPropertyValue< float >( rotation, "X" ); fRX = SharedUtil::MonoObject::GetPropertyValue< float >( rotation, "X" );
fRY = CMonoObject::GetPropertyValue< float >( rotation, "Y" ); fRY = SharedUtil::MonoObject::GetPropertyValue< float >( rotation, "Y" );
fRZ = CMonoObject::GetPropertyValue< float >( rotation, "Z" ); fRZ = SharedUtil::MonoObject::GetPropertyValue< float >( rotation, "Z" );
} }
string sNumberplate = ""; string sNumberplate = "";
@ -68,7 +68,7 @@ MonoString* CMonoFunctions::Vehicle::GetVehicleType( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strType );
} }
@ -88,9 +88,9 @@ MonoArray* CMonoFunctions::Vehicle::GetVariant( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) if( pArray )
{ {
@ -115,7 +115,7 @@ MonoObject* CMonoFunctions::Vehicle::GetColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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(); CMonoMTALib* pMTALib = pResource->GetDomain()->GetMTALib();
@ -164,7 +164,7 @@ bool CMonoFunctions::Vehicle::GetLandingGearDown( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bGearDown;
} }
@ -183,7 +183,7 @@ unsigned char CMonoFunctions::Vehicle::GetMaxPassengers( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return ucPassengers;
} }
@ -202,7 +202,7 @@ MonoString* CMonoFunctions::Vehicle::GetName( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( strOutName );
} }
@ -236,11 +236,11 @@ TElement CMonoFunctions::Vehicle::GetOccupant( TElement pThis, unsigned int uiSe
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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 ) 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 ); 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleController( pResource->GetLua(), pElement->ToLuaUserData() ); PVOID pUserData = CLuaFunctionDefinitions::GetVehicleController( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehicleSirensOn( pResource->GetLua(), pElement->ToLuaUserData(), bSirensOn ) ) if( CLuaFunctionDefinitions::GetVehicleSirensOn( pResource->GetLua(), pElement->GetLuaUserdata(), bSirensOn ) )
{ {
return bSirensOn; return bSirensOn;
} }
@ -314,7 +314,7 @@ MonoObject* CMonoFunctions::Vehicle::GetTurnVelocity( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->GetMTALib()->Vector3->New( vecVelocity );
} }
@ -333,7 +333,7 @@ MonoObject* CMonoFunctions::Vehicle::GetTurretPosition( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->GetMTALib()->Vector3->New( vecPosition );
} }
@ -352,7 +352,7 @@ bool CMonoFunctions::Vehicle::IsLocked( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bLocked;
} }
@ -371,7 +371,7 @@ MonoArray* CMonoFunctions::Vehicle::GetOfType( unsigned int uiModel )
if( pLuaArguments.size() > 0 ) 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 ); 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; return ucUpgrade;
} }
@ -405,7 +405,7 @@ MonoArray* CMonoFunctions::Vehicle::GetUpgrades( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) if( pLuaArguments.size() > 0 )
{ {
@ -441,7 +441,7 @@ MonoArray* CMonoFunctions::Vehicle::GetCompatibleUpgrades( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) if( pLuaArguments.size() > 0 )
{ {
@ -462,7 +462,7 @@ unsigned char CMonoFunctions::Vehicle::GetDoorState( TElement pThis, unsigned ch
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return ucState;
} }
@ -481,7 +481,7 @@ MonoObject* CMonoFunctions::Vehicle::GetWheelStates( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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[] = void *args[] =
{ {
@ -505,7 +505,7 @@ unsigned char CMonoFunctions::Vehicle::GetLightState( TElement pThis, unsigned c
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return ucState;
} }
@ -524,7 +524,7 @@ unsigned char CMonoFunctions::Vehicle::GetPanelState( TElement pThis, unsigned c
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return ucState;
} }
@ -543,7 +543,7 @@ unsigned char CMonoFunctions::Vehicle::GetOverrideLights( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return ucLights;
} }
@ -560,11 +560,11 @@ TElement CMonoFunctions::Vehicle::GetTowedByVehicle( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
PVOID pUserData = CLuaFunctionDefinitions::GetVehicleTowingVehicle( pResource->GetLua(), pElement->ToLuaUserData() ); PVOID pUserData = CLuaFunctionDefinitions::GetVehicleTowingVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
if( pUserData ) 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 ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
if( CLuaFunctionDefinitions::GetVehiclePaintjob( pResource->GetLua(), pElement->ToLuaUserData(), ucPaintjob ) ) if( CLuaFunctionDefinitions::GetVehiclePaintjob( pResource->GetLua(), pElement->GetLuaUserdata(), ucPaintjob ) )
{ {
return ucPaintjob; return ucPaintjob;
} }
@ -619,7 +619,7 @@ MonoString* CMonoFunctions::Vehicle::GetPlateText( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); return pResource->GetDomain()->NewString( szPlateText );
} }
@ -638,7 +638,7 @@ bool CMonoFunctions::Vehicle::IsDamageProof( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bDamageProof;
} }
@ -657,7 +657,7 @@ bool CMonoFunctions::Vehicle::IsFuelTankExplodable( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bExplodable;
} }
@ -676,7 +676,7 @@ bool CMonoFunctions::Vehicle::IsFrozen( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bFrozen;
} }
@ -695,7 +695,7 @@ bool CMonoFunctions::Vehicle::IsOnGround( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bOnGround;
} }
@ -714,7 +714,7 @@ bool CMonoFunctions::Vehicle::GetEngineState( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bState;
} }
@ -733,7 +733,7 @@ bool CMonoFunctions::Vehicle::IsTrainDerailed( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bDerailed;
} }
@ -752,7 +752,7 @@ bool CMonoFunctions::Vehicle::IsTrainDerailable( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bDerailed;
} }
@ -771,7 +771,7 @@ bool CMonoFunctions::Vehicle::GetTrainDirection( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bDirection;
} }
@ -790,7 +790,7 @@ float CMonoFunctions::Vehicle::GetTrainSpeed( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return fSpeed;
} }
@ -807,7 +807,7 @@ bool CMonoFunctions::Vehicle::IsBlown( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::IsVehicleBlown( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::IsVehicleBlown( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -823,7 +823,7 @@ MonoObject* CMonoFunctions::Vehicle::GetHeadLightColor( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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 ); 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 ); 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; return fRatio;
} }
@ -861,7 +861,7 @@ bool CMonoFunctions::Vehicle::IsTaxiLightOn( TElement pThis )
CElement* pElement = pResource->GetElementManager()->GetFromList( 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; return bLightOn;
} }
@ -880,7 +880,7 @@ bool CMonoFunctions::Vehicle::Fix( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::FixVehicle( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::FixVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -894,7 +894,7 @@ bool CMonoFunctions::Vehicle::Blow( TElement pThis, bool bExplode )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::BlowVehicle( pResource->GetLua(), pElement->ToLuaUserData(), bExplode ); return CLuaFunctionDefinitions::BlowVehicle( pResource->GetLua(), pElement->GetLuaUserdata(), bExplode );
} }
return false; return false;
@ -906,13 +906,13 @@ bool CMonoFunctions::Vehicle::SetTurnVelocity( TElement pThis, MonoObject* pVelo
if( pResource ) if( pResource )
{ {
float fX = CMonoObject::GetPropertyValue< float >( pVelocity, "X" ); float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pVelocity, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pVelocity, "Y" ); float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pVelocity, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pVelocity, "Z" ); float fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pVelocity, "Z" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -924,25 +924,25 @@ bool CMonoFunctions::Vehicle::SetColor( TElement pThis, MonoObject* pColor1, Mon
if( pResource ) if( pResource )
{ {
unsigned char ucR1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "R" ); unsigned char ucR1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor1, "R" );
unsigned char ucG1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "G" ); unsigned char ucG1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor1, "G" );
unsigned char ucB1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "B" ); unsigned char ucB1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor1, "B" );
unsigned char ucR2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "R" ); unsigned char ucR2 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor2, "R" );
unsigned char ucG2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "G" ); unsigned char ucG2 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor2, "G" );
unsigned char ucB2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "B" ); unsigned char ucB2 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor2, "B" );
unsigned char ucR3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "R" ); unsigned char ucR3 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor3, "R" );
unsigned char ucG3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "G" ); unsigned char ucG3 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor3, "G" );
unsigned char ucB3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "B" ); unsigned char ucB3 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor3, "B" );
unsigned char ucR4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "R" ); unsigned char ucR4 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor4, "R" );
unsigned char ucG4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "G" ); unsigned char ucG4 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor4, "G" );
unsigned char ucB4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "B" ); unsigned char ucB4 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor4, "B" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -956,7 +956,7 @@ bool CMonoFunctions::Vehicle::SetLandingGearDown( TElement pThis, bool bLandingG
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleLandingGearDown( pResource->GetLua(), pElement->ToLuaUserData(), bLandingGearDown ); return CLuaFunctionDefinitions::SetVehicleLandingGearDown( pResource->GetLua(), pElement->GetLuaUserdata(), bLandingGearDown );
} }
return false; return false;
@ -970,7 +970,7 @@ bool CMonoFunctions::Vehicle::SetLocked( TElement pThis, bool bLocked )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleLocked( pResource->GetLua(), pElement->ToLuaUserData(), bLocked ); return CLuaFunctionDefinitions::SetVehicleLocked( pResource->GetLua(), pElement->GetLuaUserdata(), bLocked );
} }
return false; return false;
@ -984,7 +984,7 @@ bool CMonoFunctions::Vehicle::SetDoorsUndamageable( TElement pThis, bool bDoorsU
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleDoorsUndamageable( pResource->GetLua(), pElement->ToLuaUserData(), bDoorsUndamageable ); return CLuaFunctionDefinitions::SetVehicleDoorsUndamageable( pResource->GetLua(), pElement->GetLuaUserdata(), bDoorsUndamageable );
} }
return false; return false;
@ -998,7 +998,7 @@ bool CMonoFunctions::Vehicle::SetSirensOn( TElement pThis, bool bSirensOn )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleSirensOn( pResource->GetLua(), pElement->ToLuaUserData(), bSirensOn ); return CLuaFunctionDefinitions::SetVehicleSirensOn( pResource->GetLua(), pElement->GetLuaUserdata(), bSirensOn );
} }
return false; return false;
@ -1012,7 +1012,7 @@ bool CMonoFunctions::Vehicle::SetTaxiLightOn( TElement pThis, bool bTaxiLightSta
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleTaxiLightOn( pResource->GetLua(), pElement->ToLuaUserData(), bTaxiLightState ); return CLuaFunctionDefinitions::SetVehicleTaxiLightOn( pResource->GetLua(), pElement->GetLuaUserdata(), bTaxiLightState );
} }
return false; return false;
@ -1026,7 +1026,7 @@ bool CMonoFunctions::Vehicle::AddUpgrade( TElement pThis, unsigned short usUpgra
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::AddVehicleUpgrade( pResource->GetLua(), pElement->ToLuaUserData(), usUpgrade ); return CLuaFunctionDefinitions::AddVehicleUpgrade( pResource->GetLua(), pElement->GetLuaUserdata(), usUpgrade );
} }
return false; return false;
@ -1040,7 +1040,7 @@ bool CMonoFunctions::Vehicle::RemoveUpgrade( TElement pThis, unsigned short usUp
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveVehicleUpgrade( pResource->GetLua(), pElement->ToLuaUserData(), usUpgrade ); return CLuaFunctionDefinitions::RemoveVehicleUpgrade( pResource->GetLua(), pElement->GetLuaUserdata(), usUpgrade );
} }
return false; return false;
@ -1054,7 +1054,7 @@ bool CMonoFunctions::Vehicle::SetDoorState( TElement pThis, unsigned char ucDoor
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1068,7 +1068,7 @@ bool CMonoFunctions::Vehicle::SetWheelStates( TElement pThis, int iFrontLeft, in
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1082,7 +1082,7 @@ bool CMonoFunctions::Vehicle::SetLightState( TElement pThis, unsigned char ucLig
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1096,7 +1096,7 @@ bool CMonoFunctions::Vehicle::SetPanelState( TElement pThis, unsigned char ucPan
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1110,7 +1110,7 @@ bool CMonoFunctions::Vehicle::SetIdleRespawnDelay( TElement pThis, unsigned long
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleIdleRespawnDelay( pResource->GetLua(), pElement->ToLuaUserData(), ulTime ); return CLuaFunctionDefinitions::SetVehicleIdleRespawnDelay( pResource->GetLua(), pElement->GetLuaUserdata(), ulTime );
} }
return false; return false;
@ -1124,7 +1124,7 @@ bool CMonoFunctions::Vehicle::SetRespawnDelay( TElement pThis, unsigned long ulT
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleRespawnDelay( pResource->GetLua(), pElement->ToLuaUserData(), ulTime ); return CLuaFunctionDefinitions::SetVehicleRespawnDelay( pResource->GetLua(), pElement->GetLuaUserdata(), ulTime );
} }
return false; return false;
@ -1136,17 +1136,17 @@ bool CMonoFunctions::Vehicle::SetRespawnPosition( TElement pThis, MonoObject* pP
if( pResource ) if( pResource )
{ {
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" ); float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" ); float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" ); float fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fRX = CMonoObject::GetPropertyValue< float >( pRotation, "X" ); float fRX = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( pRotation, "Y" ); float fRY = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( pRotation, "Z" ); float fRZ = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "Z" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1160,7 +1160,7 @@ bool CMonoFunctions::Vehicle::ToggleRespawn( TElement pThis, bool bRespawn )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ToggleVehicleRespawn( pResource->GetLua(), pElement->ToLuaUserData(), bRespawn ); return CLuaFunctionDefinitions::ToggleVehicleRespawn( pResource->GetLua(), pElement->GetLuaUserdata(), bRespawn );
} }
return false; return false;
@ -1174,7 +1174,7 @@ bool CMonoFunctions::Vehicle::ResetExplosionTime( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ResetVehicleExplosionTime( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::ResetVehicleExplosionTime( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -1188,7 +1188,7 @@ bool CMonoFunctions::Vehicle::ResetIdleTime( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::ResetVehicleIdleTime( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::ResetVehicleIdleTime( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -1200,17 +1200,17 @@ bool CMonoFunctions::Vehicle::Spawn( TElement pThis, MonoObject* pPosition, Mono
if( pResource ) if( pResource )
{ {
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" ); float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" ); float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" ); float fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fRX = CMonoObject::GetPropertyValue< float >( pRotation, "X" ); float fRX = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( pRotation, "Y" ); float fRY = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( pRotation, "Z" ); float fRZ = SharedUtil::MonoObject::GetPropertyValue< float >( pRotation, "Z" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1224,7 +1224,7 @@ bool CMonoFunctions::Vehicle::Respawn( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RespawnVehicle( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::RespawnVehicle( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -1238,7 +1238,7 @@ bool CMonoFunctions::Vehicle::SetOverrideLights( TElement pThis, unsigned char u
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleOverrideLights( pResource->GetLua(), pElement->ToLuaUserData(), ucLights ); return CLuaFunctionDefinitions::SetVehicleOverrideLights( pResource->GetLua(), pElement->GetLuaUserdata(), ucLights );
} }
return false; return false;
@ -1253,7 +1253,7 @@ bool CMonoFunctions::Vehicle::AttachTrailer( TElement pThis, TElement pTrailer )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pTrailerElement = pResource->GetElementManager()->GetFromList( pTrailer ); 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; return false;
@ -1268,7 +1268,7 @@ bool CMonoFunctions::Vehicle::DetachTrailer( TElement pThis, TElement pTrailer )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
CElement* pTrailerElement = pResource->GetElementManager()->GetFromList( pTrailer ); 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; return false;
@ -1282,7 +1282,7 @@ bool CMonoFunctions::Vehicle::SetEngineState( TElement pThis, bool bState )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleEngineState( pResource->GetLua(), pElement->ToLuaUserData(), bState ); return CLuaFunctionDefinitions::SetVehicleEngineState( pResource->GetLua(), pElement->GetLuaUserdata(), bState );
} }
return false; return false;
@ -1296,7 +1296,7 @@ bool CMonoFunctions::Vehicle::SetDirtLevel( TElement pThis, float fDirtLevel )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleDirtLevel( pResource->GetLua(), pElement->ToLuaUserData(), fDirtLevel ); return CLuaFunctionDefinitions::SetVehicleDirtLevel( pResource->GetLua(), pElement->GetLuaUserdata(), fDirtLevel );
} }
return false; return false;
@ -1310,7 +1310,7 @@ bool CMonoFunctions::Vehicle::SetDamageProof( TElement pThis, bool bDamageProof
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleDamageProof( pResource->GetLua(), pElement->ToLuaUserData(), bDamageProof ); return CLuaFunctionDefinitions::SetVehicleDamageProof( pResource->GetLua(), pElement->GetLuaUserdata(), bDamageProof );
} }
return false; return false;
@ -1324,7 +1324,7 @@ bool CMonoFunctions::Vehicle::SetPaintjob( TElement pThis, unsigned char ucPaint
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehiclePaintjob( pResource->GetLua(), pElement->ToLuaUserData(), ucPaintjob ); return CLuaFunctionDefinitions::SetVehiclePaintjob( pResource->GetLua(), pElement->GetLuaUserdata(), ucPaintjob );
} }
return false; return false;
@ -1338,7 +1338,7 @@ bool CMonoFunctions::Vehicle::SetFuelTankExplodable( TElement pThis, bool bExplo
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehicleFuelTankExplodable( pResource->GetLua(), pElement->ToLuaUserData(), bExplodable ); return CLuaFunctionDefinitions::SetVehicleFuelTankExplodable( pResource->GetLua(), pElement->GetLuaUserdata(), bExplodable );
} }
return false; return false;
@ -1352,7 +1352,7 @@ bool CMonoFunctions::Vehicle::SetTrainDerailed( TElement pThis, bool bDerailed )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTrainDerailed( pResource->GetLua(), pElement->ToLuaUserData(), bDerailed ); return CLuaFunctionDefinitions::SetTrainDerailed( pResource->GetLua(), pElement->GetLuaUserdata(), bDerailed );
} }
return false; return false;
@ -1366,7 +1366,7 @@ bool CMonoFunctions::Vehicle::SetTrainDerailable( TElement pThis, bool bDerailab
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTrainDerailable( pResource->GetLua(), pElement->ToLuaUserData(), bDerailable ); return CLuaFunctionDefinitions::SetTrainDerailable( pResource->GetLua(), pElement->GetLuaUserdata(), bDerailable );
} }
return false; return false;
@ -1380,7 +1380,7 @@ bool CMonoFunctions::Vehicle::SetTrainDirection( TElement pThis, bool bDireciton
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTrainDirection( pResource->GetLua(), pElement->ToLuaUserData(), bDireciton ); return CLuaFunctionDefinitions::SetTrainDirection( pResource->GetLua(), pElement->GetLuaUserdata(), bDireciton );
} }
return false; return false;
@ -1394,7 +1394,7 @@ bool CMonoFunctions::Vehicle::SetTrainSpeed( TElement pThis, float fSpeed )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetTrainSpeed( pResource->GetLua(), pElement->ToLuaUserData(), fSpeed ); return CLuaFunctionDefinitions::SetTrainSpeed( pResource->GetLua(), pElement->GetLuaUserdata(), fSpeed );
} }
return false; return false;
@ -1406,13 +1406,13 @@ bool CMonoFunctions::Vehicle::SetHeadLightColor( TElement pThis, MonoObject* pCo
if( pResource ) if( pResource )
{ {
unsigned char ucR1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "R" ); unsigned char ucR1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "R" );
unsigned char ucG1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "G" ); unsigned char ucG1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "G" );
unsigned char ucB1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "B" ); unsigned char ucB1 = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( pColor, "B" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1424,12 +1424,12 @@ bool CMonoFunctions::Vehicle::SetTurretPosition( TElement pThis, MonoObject* pPo
if( pResource ) if( pResource )
{ {
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" ); float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" ); float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1443,7 +1443,7 @@ bool CMonoFunctions::Vehicle::SetDoorOpenRatio( TElement pThis, unsigned char uc
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1457,7 +1457,7 @@ bool CMonoFunctions::Vehicle::SetVariant( TElement pThis, unsigned char ucVarian
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1471,7 +1471,7 @@ bool CMonoFunctions::Vehicle::GiveSirens( TElement pThis, unsigned char ucSirenT
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1485,7 +1485,7 @@ bool CMonoFunctions::Vehicle::RemoveSirens( TElement pThis )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::RemoveVehicleSirens( pResource->GetLua(), pElement->ToLuaUserData() ); return CLuaFunctionDefinitions::RemoveVehicleSirens( pResource->GetLua(), pElement->GetLuaUserdata() );
} }
return false; return false;
@ -1497,18 +1497,18 @@ bool CMonoFunctions::Vehicle::SetSirens( TElement pThis, unsigned char ucSirenID
if( pResource ) if( pResource )
{ {
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" ); float fX = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" ); float fY = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" ); float fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fRed = CMonoObject::GetPropertyValue< float >( pColor, "R" ); float fRed = SharedUtil::MonoObject::GetPropertyValue< float >( pColor, "R" );
float fGreen = CMonoObject::GetPropertyValue< float >( pColor, "G" ); float fGreen = SharedUtil::MonoObject::GetPropertyValue< float >( pColor, "G" );
float fBlue = CMonoObject::GetPropertyValue< float >( pColor, "B" ); float fBlue = SharedUtil::MonoObject::GetPropertyValue< float >( pColor, "B" );
float fAlpha = CMonoObject::GetPropertyValue< float >( pColor, "A" ); float fAlpha = SharedUtil::MonoObject::GetPropertyValue< float >( pColor, "A" );
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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; return false;
@ -1534,7 +1534,7 @@ bool CMonoFunctions::Vehicle::SetPlateText( TElement pThis, MonoString* msName )
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetVehiclePlateText( pResource->GetLua(), pElement->ToLuaUserData(), szText ); return CLuaFunctionDefinitions::SetVehiclePlateText( pResource->GetLua(), pElement->GetLuaUserdata(), szText );
} }
return false; return false;

View File

@ -41,7 +41,7 @@ bool CMonoFunctions::Water::SetLevel( TElement pThis, float fLevel )
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); CElement* pElement = pResource->GetElementManager()->GetFromList( pThis );
return CLuaFunctionDefinitions::SetElementWaterLevel( pResource->GetLua(), pElement->ToLuaUserData(), fLevel ); return CLuaFunctionDefinitions::SetElementWaterLevel( pResource->GetLua(), pElement->GetLuaUserdata(), fLevel );
} }
return false; return false;
@ -93,7 +93,7 @@ MonoObject* CMonoFunctions::Water::GetVertexPosition( TElement pThis, int iVerte
CElement* pElement = pResource->GetElementManager()->GetFromList( pThis ); 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 ); 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 ); 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; return false;
@ -141,7 +141,7 @@ bool CMonoFunctions::Water::SetColor( MonoObject* mColor )
if( pResource ) 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 ); 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 ) ) 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, 0, ucHour );
mono_array_set( pArray, unsigned char, 1, ucMinute ); mono_array_set( pArray, unsigned char, 1, ucMinute );
@ -46,7 +46,7 @@ MonoArray* CMonoFunctions::World::GetWeather( void )
if( CLuaFunctionDefinitions::GetWeather( pResource->GetLua(), ucWeather, ucWeatherBlending ) ) 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, 0, ucWeather );
mono_array_set( pArray, unsigned char, 1, ucWeatherBlending ); mono_array_set( pArray, unsigned char, 1, ucWeatherBlending );
@ -315,7 +315,7 @@ MonoArray* CMonoFunctions::World::GetSunColor( void )
if( pCoreObject && pCoronaObject ) 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*, 0, pCoreObject );
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject ); mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject );
@ -442,12 +442,14 @@ MonoArray* CMonoFunctions::World::GetSkyGradient( void )
{ {
pCore.A = pCorona.A = 255; pCore.A = pCorona.A = 255;
MonoObject* pCoreObject = pResource->GetDomain()->GetMTALib()->Color->New( pCore ); CMonoClass* pColorClass = pResource->GetDomain()->GetMTALib()->Color;
MonoObject* pCoronaObject = pResource->GetDomain()->GetMTALib()->Color->New( pCorona );
MonoObject* pCoreObject = pColorClass->New( pCore );
MonoObject* pCoronaObject = pColorClass->New( pCorona );
if( pCoreObject && pCoronaObject ) 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*, 0, pCoreObject );
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject ); mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject );
@ -586,8 +588,8 @@ bool CMonoFunctions::World::SetSkyGradient( MonoObject* pTopColor, MonoObject* p
if( pResource ) if( pResource )
{ {
SColor pTop = CMonoObject::GetColor( pTopColor ); SColor pTop = SharedUtil::MonoObject::GetColor( pTopColor );
SColor pBottom = CMonoObject::GetColor( pBottomColor ); SColor pBottom = SharedUtil::MonoObject::GetColor( pBottomColor );
return CLuaFunctionDefinitions::SetSkyGradient( pResource->GetLua(), pTop.R, pTop.G, pTop.B, pBottom.R, pBottom.G, pBottom.B ); 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; SHeatHazeSettings pHeatHazeSettings;
pHeatHazeSettings.ucIntensity = CMonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucIntensity" ); pHeatHazeSettings.ucIntensity = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucIntensity" );
pHeatHazeSettings.ucRandomShift = CMonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucRandomShift" ); pHeatHazeSettings.ucRandomShift = SharedUtil::MonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucRandomShift" );
pHeatHazeSettings.usSpeedMin = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMin" ); pHeatHazeSettings.usSpeedMin = SharedUtil::MonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMin" );
pHeatHazeSettings.usSpeedMax = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMax" ); pHeatHazeSettings.usSpeedMax = SharedUtil::MonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMax" );
pHeatHazeSettings.sScanSizeX = CMonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeX" ); pHeatHazeSettings.sScanSizeX = SharedUtil::MonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeX" );
pHeatHazeSettings.sScanSizeY = CMonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeY" ); pHeatHazeSettings.sScanSizeY = SharedUtil::MonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeY" );
pHeatHazeSettings.usRenderSizeX = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeX" ); pHeatHazeSettings.usRenderSizeX = SharedUtil::MonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeX" );
pHeatHazeSettings.usRenderSizeY = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeY" ); pHeatHazeSettings.usRenderSizeY = SharedUtil::MonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeY" );
pHeatHazeSettings.bInsideBuilding = CMonoObject::GetPropertyValue< bool >( heatHazeSettings, "bInsideBuilding" ); pHeatHazeSettings.bInsideBuilding = SharedUtil::MonoObject::GetPropertyValue< bool >( heatHazeSettings, "bInsideBuilding" );
return CLuaFunctionDefinitions::SetHeatHaze( pResource->GetLua(), pHeatHazeSettings ); return CLuaFunctionDefinitions::SetHeatHaze( pResource->GetLua(), pHeatHazeSettings );
} }
@ -809,8 +811,8 @@ bool CMonoFunctions::World::SetSunColor( MonoObject* pCoreColor, MonoObject* pCo
if( pResource ) if( pResource )
{ {
SColor pTop = CMonoObject::GetColor( pCoreColor ); SColor pTop = SharedUtil::MonoObject::GetColor( pCoreColor );
SColor pBottom = CMonoObject::GetColor( pCoronaColor ); SColor pBottom = SharedUtil::MonoObject::GetColor( pCoronaColor );
return CLuaFunctionDefinitions::SetSunColor( pResource->GetLua(), pTop.R, pTop.G, pTop.B, pBottom.R, pBottom.G, pBottom.B ); 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; 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; 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; 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; return -1;
@ -72,12 +72,12 @@ int64 CMonoGC::GetHeapSize()
return mono_gc_get_heap_size(); 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: public:
CMonoGC ( void ); CMonoGC ( void );
void Collect ( int generation = -1 ); void Collect ( int iGeneration = -1 );
unsigned int Hold ( MonoObject* obj ); unsigned int Hold ( MonoObject* pObject );
unsigned int HoldWithHope ( MonoObject* obj ); unsigned int HoldWithHope ( MonoObject* pObject );
unsigned int Keep ( MonoObject* obj ); unsigned int Keep ( MonoObject* pObject );
unsigned int Pin ( MonoObject* obj ); unsigned int Pin ( MonoObject* pObject );
int GetMaxGeneration ( void ); int GetMaxGeneration ( void );
int64 GetHeapSize ( void ); int64 GetHeapSize ( void );
void ReleaseGCHandle ( unsigned int handle ); void ReleaseGCHandle ( unsigned int uiHandle );
MonoObject* GetGCHandleTarget ( unsigned int handle ); MonoObject* GetGCHandleTarget ( unsigned int uiHandle );
}; };
#endif #endif

View File

@ -24,6 +24,17 @@ CMonoInterface::CMonoInterface( CModule* pModule )
mono_set_signal_chaining( false ); 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 ); mono_debug_init( MONO_DEBUG_FORMAT_MONO );
#if _DEBUG #if _DEBUG
@ -32,12 +43,12 @@ CMonoInterface::CMonoInterface( CModule* pModule )
mono_trace_set_level_string( "critical" ); mono_trace_set_level_string( "critical" );
#endif #endif
mono_trace_set_print_handler( CMonoInterface::MonoPrintCallbackHandler ); mono_trace_set_print_handler( MonoPrintCallbackHandler );
mono_trace_set_printerr_handler( CMonoInterface::MonoPrintErrorCallbackHandler ); mono_trace_set_printerr_handler( MonoPrintErrorCallbackHandler );
this->m_pMonoDomain = mono_jit_init_version( "mono_root_domain", "v4.0.30319" ); 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(); CMonoFunctions::AddInternals();
@ -215,7 +226,7 @@ CLuaArguments CMonoInterface::MonoArrayToLuaArguments( MonoArray* pArray, CResou
{ {
CElement* pElement = pResource->GetElementManager()->GetFromList( pObj ); CElement* pElement = pResource->GetElementManager()->GetFromList( pObj );
PVOID pValue = pElement->ToLuaUserData(); PVOID pValue = pElement->GetLuaUserdata();
if( pValue ) if( pValue )
{ {
@ -247,7 +258,7 @@ CLuaArguments CMonoInterface::MonoArrayToLuaArguments( MonoArray* pArray, CResou
MonoAssembly* CMonoInterface::GetMTALib( void ) MonoAssembly* CMonoInterface::GetMTALib( void )
{ {
return CMonoInterface::m_pMTALib; return m_pMTALib;
} }
void CMonoInterface::MonoPrintCallbackHandler( const char *string, mono_bool is_stdout ) void CMonoInterface::MonoPrintCallbackHandler( const char *string, mono_bool is_stdout )

View File

@ -38,12 +38,12 @@ CMonoMTALib::~CMonoMTALib( void )
this->m_pImage = nullptr; 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 ) ); 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 ]; char szBuffer[ 128 ];

View File

@ -33,10 +33,10 @@ public:
CMonoMTALib ( CMonoDomain* pDomain ); CMonoMTALib ( CMonoDomain* pDomain );
~CMonoMTALib ( void ); ~CMonoMTALib ( void );
CMonoClass* GetClass ( const char* szName ); CMonoClass* GetClass ( const char* szName ) const;
CMonoClass* GetClass ( const char* szNameSpace, const char* szName ); 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 #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 ); return mono_runtime_invoke( this->m_pMethod, pObject, params, pException );
} }

View File

@ -28,31 +28,32 @@ struct SMonoType
class CMonoMethod class CMonoMethod
{ {
private: private:
MonoMethod* m_pMethod; MonoMethod* m_pMethod;
CMonoClass* m_pClass; CMonoClass* m_pClass;
vector< SMonoType > m_ArgList; vector< SMonoType > m_ArgList;
string m_strName; string m_strName;
string m_strSignature; string m_strSignature;
private: private:
void ParseSignature ( void ); void ParseSignature ( void );
public: public:
CMonoMethod ( CMonoClass* pClass, MonoMethod* pMethod ); CMonoMethod ( CMonoClass* pClass, MonoMethod* pMethod );
~CMonoMethod ( void ); ~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; } inline string GetSignature ( void ) const { return this->m_strSignature; }
vector< SMonoType > GetArguments ( void ) { return this->m_ArgList; } inline vector< SMonoType > GetArguments ( void ) const { return this->m_ArgList; }
MonoMethod* GetMonoPtr ( void ) { return this->m_pMethod; } inline CMonoClass* GetMonoClass ( void ) const { return this->m_pClass; }
CMonoClass* GetMonoClass ( void ) { 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 #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 ); assert( pCorlib );
MonoString* pCommandName = this->m_pResource->GetDomain()->NewString( strCommandName ); 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; uint index = 0;
@ -171,10 +171,12 @@ void CRegisteredCommands::Invoke( CElement* pPlayer, MonoObject* pDelegate, cons
PVOID* params = new PVOID[ 3 ]; PVOID* params = new PVOID[ 3 ];
params[ 0 ] = pPlayer->ToMonoObject(); params[ 0 ] = pPlayer->GetMonoObject();
params[ 1 ] = pCommandName; params[ 1 ] = pCommandName;
params[ 2 ] = pArguments; params[ 2 ] = pArguments;
this->m_pResource->GetDomain()->Set( false );
MonoObject* pException = nullptr; MonoObject* pException = nullptr;
mono_runtime_delegate_invoke( pDelegate, params, &pException ); mono_runtime_delegate_invoke( pDelegate, params, &pException );

View File

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

View File

@ -96,7 +96,7 @@ CResource* CResourceManager::GetFromList( MonoDomain* pDomain )
{ {
for( const auto& iter : this->m_List ) for( const auto& iter : this->m_List )
{ {
if( iter->GetDomain()->GetMonoPtr() == pDomain ) if( **iter->GetDomain() == pDomain )
{ {
return iter; 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 lib_LTLIBRARIES=libmta_mono.la
@ -8,6 +8,7 @@ libmta_mono_la_SOURCES = \
CEvent.cpp \ CEvent.cpp \
CEventManager.cpp \ CEventManager.cpp \
CFunctions.cpp \ CFunctions.cpp \
CMonoArguments \
CMonoClass.cpp \ CMonoClass.cpp \
CMonoCorlib.cpp \ CMonoCorlib.cpp \
CMonoDomain.cpp \ CMonoDomain.cpp \
@ -37,7 +38,6 @@ libmta_mono_la_SOURCES = \
CMonoMethod.cpp \ CMonoMethod.cpp \
CMonoMTALib.cpp \ CMonoMTALib.cpp \
CMonoObject.cpp \ CMonoObject.cpp \
Common.cpp \
CRegisteredCommands.cpp \ CRegisteredCommands.cpp \
CResource.cpp \ CResource.cpp \
CResourceManager.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 #ifdef WIN32
#define MTAEXPORT extern "C" __declspec(dllexport) #define DLL_EXPORT extern "C" __declspec(dllexport)
#else #else
#define MTAEXPORT extern "C" #define DLL_EXPORT extern "C"
#endif #endif
using namespace std;
#include <list> #include <list>
#include <vector> #include <vector>
#include <map> #include <map>
@ -39,8 +41,6 @@ extern "C"
#include <mono/metadata/mono-gc.h> #include <mono/metadata/mono-gc.h>
#include <mono/utils/mono-logger.h> #include <mono/utils/mono-logger.h>
#include "Common.h"
#ifndef stricmp #ifndef stricmp
#ifdef _MSC_VER #ifdef _MSC_VER
#define stricmp _stricmp #define stricmp _stricmp
@ -60,5 +60,41 @@ extern "C"
#define ASSERT_MSG(_Expression, _Message) ((void)0) #define ASSERT_MSG(_Expression, _Message) ((void)0)
#endif #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/Vector2.h"
#include "extra/Vector3.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 "../StdInc.h"
#include "Common.h" #include "CVehicleColor.h"
CVehicleColor::CVehicleColor( void ) CVehicleColor::CVehicleColor( void )
{ {
// Init // Init
m_ucPaletteColors[ 0 ] = 0; // Palette color 0 is black this->m_ucPaletteColors[ 0 ] = 0; // Palette color 0 is black
m_ucPaletteColors[ 1 ] = 0; this->m_ucPaletteColors[ 1 ] = 0;
m_ucPaletteColors[ 2 ] = 0; this->m_ucPaletteColors[ 2 ] = 0;
m_ucPaletteColors[ 3 ] = 0; this->m_ucPaletteColors[ 3 ] = 0;
m_RGBColors[ 0 ] = 0;
m_RGBColors[ 1 ] = 0; this->m_RGBColors[ 0 ] = 0;
m_RGBColors[ 2 ] = 0; this->m_RGBColors[ 1 ] = 0;
m_RGBColors[ 3 ] = 0; this->m_RGBColors[ 2 ] = 0;
m_bPaletteColorsWrong = false; this->m_RGBColors[ 3 ] = 0;
m_bRGBColorsWrong = false;
this->m_bPaletteColorsWrong = false;
this->m_bRGBColorsWrong = false;
} }
// Use black for colours that are not used (bandwidth saving) // Use black for colours that are not used (bandwidth saving)
void CVehicleColor::SetRGBColors( SColor color1, SColor color2, SColor color3, SColor color4 ) void CVehicleColor::SetRGBColors( SColor color1, SColor color2, SColor color3, SColor color4 )
{ {
if( 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
)
{ {
m_RGBColors[ 0 ] = color1; this->m_RGBColors[ 0 ] = color1;
m_RGBColors[ 1 ] = color2; this->m_RGBColors[ 1 ] = color2;
m_RGBColors[ 2 ] = color3; this->m_RGBColors[ 2 ] = color3;
m_RGBColors[ 3 ] = color4; this->m_RGBColors[ 3 ] = color4;
InvalidatePaletteColors();
this->InvalidatePaletteColors();
} }
} }
void CVehicleColor::SetPaletteColors( unsigned char ucColor1, unsigned char ucColor2, unsigned char ucColor3, unsigned char ucColor4 ) void CVehicleColor::SetPaletteColors( unsigned char ucColor1, unsigned char ucColor2, unsigned char ucColor3, unsigned char ucColor4 )
{ {
if( m_ucPaletteColors[ 0 ] != ucColor1 || if( this->m_ucPaletteColors[ 0 ] != ucColor1 || this->m_ucPaletteColors[ 1 ] != ucColor2 || this->m_ucPaletteColors[ 2 ] != ucColor3 || this->m_ucPaletteColors[ 3 ] != ucColor4 )
m_ucPaletteColors[ 1 ] != ucColor2 ||
m_ucPaletteColors[ 2 ] != ucColor3 ||
m_ucPaletteColors[ 3 ] != ucColor4 )
{ {
m_ucPaletteColors[ 0 ] = ucColor1; this->m_ucPaletteColors[ 0 ] = ucColor1;
m_ucPaletteColors[ 1 ] = ucColor2; this->m_ucPaletteColors[ 1 ] = ucColor2;
m_ucPaletteColors[ 2 ] = ucColor3; this->m_ucPaletteColors[ 2 ] = ucColor3;
m_ucPaletteColors[ 3 ] = ucColor4; this->m_ucPaletteColors[ 3 ] = ucColor4;
InvalidateRGBColors();
this->InvalidateRGBColors();
} }
} }
void CVehicleColor::SetRGBColor( uint uiSlot, SColor color ) void CVehicleColor::SetRGBColor( uint uiSlot, SColor color )
{ {
ValidateRGBColors(); this->ValidateRGBColors();
uiSlot = Min( uiSlot, static_cast <uint> ( NUMELMS( m_RGBColors ) ) );
if( m_RGBColors[ uiSlot ] != color ) uiSlot = Min( uiSlot, static_cast< uint >( NUMELMS( this->m_RGBColors ) ) );
if( this->m_RGBColors[ uiSlot ] != color )
{ {
m_RGBColors[ uiSlot ] = color; this->m_RGBColors[ uiSlot ] = color;
InvalidatePaletteColors();
this->InvalidatePaletteColors();
} }
} }
void CVehicleColor::SetPaletteColor( uint uiSlot, uchar ucColor ) void CVehicleColor::SetPaletteColor( uint uiSlot, uchar ucColor )
{ {
ValidatePaletteColors(); this->ValidatePaletteColors();
uiSlot = Min( uiSlot, static_cast <uint> ( NUMELMS( m_ucPaletteColors ) ) );
if( m_ucPaletteColors[ uiSlot ] != ucColor ) uiSlot = Min( uiSlot, static_cast< uint >( NUMELMS( this->m_ucPaletteColors ) ) );
if( this->m_ucPaletteColors[ uiSlot ] != ucColor )
{ {
m_ucPaletteColors[ uiSlot ] = ucColor; this->m_ucPaletteColors[ uiSlot ] = ucColor;
InvalidateRGBColors();
this->InvalidateRGBColors();
} }
} }
// Get a slot colour as a palette index // Get a slot colour as a palette index
uchar CVehicleColor::GetPaletteColor( uint uiSlot ) uchar CVehicleColor::GetPaletteColor( uint uiSlot )
{ {
ValidatePaletteColors(); this->ValidatePaletteColors();
uiSlot = Min( uiSlot, static_cast <uint> ( NUMELMS( m_ucPaletteColors ) ) );
return m_ucPaletteColors[ uiSlot ]; uiSlot = Min( uiSlot, static_cast< uint >( NUMELMS( this->m_ucPaletteColors ) ) );
return this->m_ucPaletteColors[ uiSlot ];
} }
// Get a slot colour as an RGB colour // Get a slot colour as an RGB colour
SColor CVehicleColor::GetRGBColor( uint uiSlot ) SColor CVehicleColor::GetRGBColor( uint uiSlot )
{ {
ValidateRGBColors(); this->ValidateRGBColors();
uiSlot = Min( uiSlot, static_cast <uint> ( NUMELMS( m_RGBColors ) ) );
return m_RGBColors[ uiSlot ]; uiSlot = Min( uiSlot, static_cast< uint >( NUMELMS( this->m_RGBColors ) ) );
return this->m_RGBColors[ uiSlot ];
} }
// Can return: 1,2,3, or 4 // Can return: 1,2,3, or 4
@ -92,12 +98,17 @@ int CVehicleColor::GetNumColorsUsed( void )
{ {
// Find last unblack // Find last unblack
int i; int i;
for( i = NUMELMS( m_RGBColors ); i > 1; i-- )
for( i = NUMELMS( this->m_RGBColors ); i > 1; i-- )
{ {
if( GetRGBColor( i - 1 ) ) if( this->GetRGBColor( i - 1 ) )
{
break; break;
}
} }
assert( i >= 1 && i <= 4 );
ASSERT( i >= 1 && i <= 4 );
return i; return i;
} }
@ -105,40 +116,47 @@ int CVehicleColor::GetNumColorsUsed( void )
// Switching to RGB mode // Switching to RGB mode
void CVehicleColor::InvalidatePaletteColors( void ) void CVehicleColor::InvalidatePaletteColors( void )
{ {
m_bRGBColorsWrong = false; this->m_bRGBColorsWrong = false;
m_bPaletteColorsWrong = true; this->m_bPaletteColorsWrong = true;
} }
// Switching to palette mode // Switching to palette mode
void CVehicleColor::InvalidateRGBColors( void ) void CVehicleColor::InvalidateRGBColors( void )
{ {
m_bPaletteColorsWrong = false; this->m_bPaletteColorsWrong = false;
m_bRGBColorsWrong = true; this->m_bRGBColorsWrong = true;
} }
// Ensure switched // Ensure switched
void CVehicleColor::ValidateRGBColors( void ) void CVehicleColor::ValidateRGBColors( void )
{ {
if( m_bRGBColorsWrong ) if( this->m_bRGBColorsWrong )
{ {
m_bRGBColorsWrong = false; this->m_bRGBColorsWrong = false;
for( uint i = 0; i < NUMELMS( m_RGBColors ); i++ )
m_RGBColors[ i ] = GetRGBFromPaletteIndex( m_ucPaletteColors[ i ] ); for( uint i = 0; i < NUMELMS( this->m_RGBColors ); i++ )
{
this->m_RGBColors[ i ] = GetRGBFromPaletteIndex( this->m_ucPaletteColors[ i ] );
}
} }
} }
// Ensure switched // Ensure switched
void CVehicleColor::ValidatePaletteColors( void ) void CVehicleColor::ValidatePaletteColors( void )
{ {
if( m_bPaletteColorsWrong ) if( this->m_bPaletteColorsWrong )
{ {
m_bPaletteColorsWrong = false; this->m_bPaletteColorsWrong = false;
for( uint i = 0; i < NUMELMS( m_ucPaletteColors ); i++ )
m_ucPaletteColors[ i ] = GetPaletteIndexFromRGB( m_RGBColors[ i ] ); 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, 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, 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, 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; ulong ulBestDist = 0xFFFFFFFF;
uchar ucBestMatch = 0; uchar ucBestMatch = 0;
for( uint i = 0; i < NUMELMS( paletteColorTable8 ) / 4; i++ ) for( uint i = 0; i < NUMELMS( paletteColorTable8 ) / 4; i++ )
{ {
int r = paletteColorTable8[ i * 4 + 0 ] - color.R; int r = paletteColorTable8[ i * 4 + 0 ] - color.R;
int g = paletteColorTable8[ i * 4 + 1 ] - color.G; int g = paletteColorTable8[ i * 4 + 1 ] - color.G;
int b = paletteColorTable8[ i * 4 + 2 ] - color.B; int b = paletteColorTable8[ i * 4 + 2 ] - color.B;
ulong ulDist = r * r + g * g + b * b; ulong ulDist = r * r + g * g + b * b;
if( ulDist < ulBestDist ) if( ulDist < ulBestDist )
{ {
ulBestDist = ulDist; ulBestDist = ulDist;
ucBestMatch = i; ucBestMatch = i;
} }
} }
return ucBestMatch; return ucBestMatch;
} }
SColor CVehicleColor::GetRGBFromPaletteIndex( uchar ucColor ) 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 r = paletteColorTable8[ ucColor * 4 ];
uchar g = paletteColorTable8[ ucColor * 4 + 1 ]; uchar g = paletteColorTable8[ ucColor * 4 + 1 ];
uchar b = paletteColorTable8[ ucColor * 4 + 2 ]; uchar b = paletteColorTable8[ ucColor * 4 + 2 ];
return SColorRGBA( r, g, b, 0 ); 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 noinst_LIBRARIES=libmta_mono_extra.a
libmta_mono_extra_a_SOURCES = \ libmta_mono_extra_a_SOURCES = \
CLuaArgument.cpp \ CLuaArgument.cpp \
CLuaArguments.cpp \ CLuaArguments.cpp \
CVehicleColor.cpp \
SColor.cpp \
Vector2.cpp \ Vector2.cpp \
Vector3.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 ) Vector2::Vector2( MonoObject* pObject )
{ {
this->fX = CMonoObject::GetPropertyValue< float >( pObject, "X" ); this->fX = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "X" );
this->fY = CMonoObject::GetPropertyValue< float >( pObject, "Y" ); this->fY = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "Y" );
} }
float Vector2::DotProduct( Vector2& other ) const float Vector2::DotProduct( Vector2& other ) const
{ {
return fX*other.fX + fY*other.fY; return fX * other.fX + fY * other.fY;
} }
float Vector2::Length() const float Vector2::Length() const
@ -37,6 +37,7 @@ float Vector2::LengthSquared( void ) const
void Vector2::Normalize( void ) void Vector2::Normalize( void )
{ {
float fLength = Length(); float fLength = Length();
if( fLength > 0.0f ) if( fLength > 0.0f )
{ {
fX /= fLength; fX /= fLength;

View File

@ -14,7 +14,6 @@
#include <cmath> #include <cmath>
#include "Vector3.h" #include "Vector3.h"
#include "../CMonoObject.h"
/** /**
* CVector2D Structure used to store a 2D vertex. * 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 ) Vector3::Vector3( MonoObject *pObject )
{ {
this->fX = CMonoObject::GetPropertyValue< float >( pObject, "X" ); this->fX = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "X" );
this->fY = CMonoObject::GetPropertyValue< float >( pObject, "Y" ); this->fY = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "Y" );
this->fZ = CMonoObject::GetPropertyValue< float >( pObject, "Z" ); this->fZ = SharedUtil::MonoObject::GetPropertyValue< float >( pObject, "Z" );
} }
float Vector3::Normalize( void ) float Vector3::Normalize( void )

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?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"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@ -22,19 +22,19 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Nightly|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Nightly|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />