mirror of
https://github.com/ChronosX88/mta-mono.git
synced 2024-12-23 01:11:48 +00:00
Забиндены функции в Mono
This commit is contained in:
parent
3e5313e3d8
commit
47b0769647
@ -13,6 +13,24 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\CMonoClass.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Account.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Audio.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Ban.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Blip.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Element.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Explosion.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Marker.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Object.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Ped.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Pickup.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Player.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_RadarArea.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Resource.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Shape.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Team.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Vehicle.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_Water.cpp" />
|
||||
<ClCompile Include="src\CMonoFunctions_World.cpp" />
|
||||
<ClCompile Include="src\CMonoObject.cpp" />
|
||||
<ClCompile Include="src\Common.cpp" />
|
||||
<ClCompile Include="src\CResource.cpp" />
|
||||
|
@ -26,11 +26,26 @@ CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain )
|
||||
return new CMonoObject( pObject );
|
||||
}
|
||||
|
||||
CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain, SColor& pColor )
|
||||
{
|
||||
void *args[] = { &pColor.R, &pColor.G, &pColor.B, &pColor.A };
|
||||
|
||||
return this->New( pMonoDomain, args, 4 );
|
||||
}
|
||||
|
||||
|
||||
CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain, Vector2& vecVector )
|
||||
{
|
||||
void *args[] = { &vecVector.fX, &vecVector.fY };
|
||||
|
||||
return this->New( pMonoDomain, args, 2 );
|
||||
}
|
||||
|
||||
CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain, Vector3& vecVector )
|
||||
{
|
||||
void *args[] = { &vecVector.fX, &vecVector.fY, &vecVector.fZ };
|
||||
|
||||
return this->New( mono_domain_get(), args, 3 );
|
||||
return this->New( pMonoDomain, args, 3 );
|
||||
}
|
||||
|
||||
CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain, void** args, int argc )
|
||||
@ -44,7 +59,7 @@ CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain, void** args, int argc )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoMethod* pMonoMethod = mono_class_get_method_from_name( this->m_pMonoClass, ".ctor", argc );
|
||||
MonoMethod* pMonoMethod = this->GetMethod( ".ctor", argc );
|
||||
|
||||
if( !pMonoMethod )
|
||||
{
|
||||
|
@ -18,6 +18,8 @@ public:
|
||||
~CMonoClass();
|
||||
|
||||
CMonoObject* New( MonoDomain* pMonoDomain );
|
||||
CMonoObject* New( MonoDomain* pMonoDomain, SColor& pColor );
|
||||
CMonoObject* New( MonoDomain* pMonoDomain, Vector2& vecVector );
|
||||
CMonoObject* New( MonoDomain* pMonoDomain, Vector3& vecVector );
|
||||
CMonoObject* New( MonoDomain* pMonoDomain, void** args, int argc );
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,9 @@
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CResource.h"
|
||||
#include "CResourceManager.h"
|
||||
|
||||
class CMonoFunctions;
|
||||
|
||||
#ifndef __CMONOFUNCTIONS_H
|
||||
@ -18,6 +21,15 @@ class CMonoFunctions;
|
||||
#include "Common.h"
|
||||
#include "lua/CLuaFunctionDefinitions.h"
|
||||
|
||||
#include "CMonoObject.h"
|
||||
|
||||
extern ILuaModuleManager10 *g_pModuleManager;
|
||||
extern CResourceManager *g_pResourceManager;
|
||||
|
||||
#define RESOURCE g_pResourceManager->GetFromList( mono_domain_get() )
|
||||
|
||||
#define MONO_DECLARE(a,b) mono_add_internal_call("MultiTheftAuto.Native."#a"::"#b,CMonoFunctions::a::b)
|
||||
|
||||
class CMonoFunctions
|
||||
{
|
||||
public:
|
||||
@ -38,6 +50,17 @@ public:
|
||||
static bool Set ( MonoString *msKey, MonoString *msValue );
|
||||
};
|
||||
|
||||
class Server
|
||||
{
|
||||
public:
|
||||
static unsigned int GetMaxPlayers ( void );
|
||||
static bool SetMaxPlayers ( unsigned int uiMax );
|
||||
static bool OutputChatBox ( MonoString* szText, DWORD pElement, MonoObject* pColor, bool bColorCoded );
|
||||
static bool OutputConsole ( MonoString* szText, DWORD pElement );
|
||||
static bool SetPassword ( MonoString* msPassword, bool bSave );
|
||||
static MonoObject* GetVersion ( void );
|
||||
};
|
||||
|
||||
class Element
|
||||
{
|
||||
public:
|
||||
@ -47,6 +70,8 @@ public:
|
||||
static DWORD Clone ( DWORD pUserData, MonoObject* vecPosition, bool bCloneElement );
|
||||
|
||||
// Element get funcs
|
||||
static MonoArray* GetByType ( MonoString* msType, DWORD pStartElement );
|
||||
|
||||
static bool IsElement ( DWORD pUserData );
|
||||
static MonoString* GetType ( DWORD pUserData );
|
||||
static DWORD GetByID ( MonoString* msID, unsigned int uiIndex );
|
||||
@ -54,8 +79,8 @@ public:
|
||||
static DWORD GetChild ( DWORD pUserData, int iIndex );
|
||||
static int GetChildrenCount ( DWORD pUserData );
|
||||
static MonoString* GetID ( DWORD pUserData );
|
||||
// static MonoObject* GetData ( DWORD pUserData, MonoString* sKey, bool bInherit = true );
|
||||
// static ?* GetAllData ( DWORD pUserData );
|
||||
static MonoObject* GetData ( DWORD pUserData, MonoString* sKey, bool bInherit = true );
|
||||
static MonoArray* GetAllData ( DWORD pUserData );
|
||||
static unsigned int GetParent ( DWORD pUserData );
|
||||
static MonoObject* GetPosition ( DWORD pUserData );
|
||||
static MonoObject* GetRotation ( DWORD pUserData );
|
||||
@ -106,10 +131,575 @@ public:
|
||||
static bool SetLowLod ( DWORD pUserData, bool bEnabled );
|
||||
};
|
||||
|
||||
class Player
|
||||
{
|
||||
public:
|
||||
// Player get functions
|
||||
static unsigned int GetCount ( void );
|
||||
static DWORD GetFromName ( MonoString* msNick );
|
||||
static unsigned int GetPing ( DWORD pUserData );
|
||||
static long GetMoney ( DWORD pUserData );
|
||||
static DWORD GetRandom ( void );
|
||||
static bool IsMuted ( DWORD pUserData );
|
||||
static DWORD GetTeam ( DWORD pUserData );
|
||||
static unsigned int GetWantedLevel ( DWORD pUserData );
|
||||
static MonoArray* GetAlivePlayers ( void );
|
||||
static MonoArray* GetDeadPlayers ( void );
|
||||
static unsigned int GetIdleTime ( DWORD pUserData );
|
||||
static bool IsMapForced ( DWORD pUserData );
|
||||
static MonoString* GetNametagText ( DWORD pUserData );
|
||||
static MonoObject* GetNametagColor ( DWORD pUserData );
|
||||
static bool IsNametagShowing ( DWORD pUserData );
|
||||
static MonoString* GetSerial ( DWORD pUserData );
|
||||
static MonoString* GetUserName ( DWORD pUserData );
|
||||
static unsigned char GetBlurLevel ( DWORD pUserData );
|
||||
static MonoString* GetName ( DWORD pUserData );
|
||||
static MonoString* GetIP ( DWORD pUserData );
|
||||
static DWORD GetAccount ( DWORD pUserData );
|
||||
static MonoString* GetVersion ( DWORD pUserData );
|
||||
static MonoObject* GetACInfo ( DWORD pUserData );
|
||||
|
||||
// Player set functions
|
||||
static bool SetMoney ( DWORD pUserData, int iAmount, bool bInstant );
|
||||
static bool GiveMoney ( DWORD pUserData, int iAmount );
|
||||
static bool TakeMoney ( DWORD pUserData, int iAmount );
|
||||
static bool Spawn ( DWORD pUserData, MonoObject* vecPosition, int iRotation, int iSkinID, int iInterior, int iDimension, DWORD pTeam );
|
||||
static bool ShowHudComponent ( DWORD pUserData, MonoString* sComponent, bool bShow );
|
||||
static bool SetWantedLevel ( DWORD pUserData, int iLevel );
|
||||
static bool ForceMap ( DWORD pUserData, bool bForceOn );
|
||||
static bool SetNametagText ( DWORD pUserData, MonoString* sText );
|
||||
static bool SetNametagColor ( DWORD pUserData, int iRed, int iGreen, int iBlue );
|
||||
static bool SetNametagShowing ( DWORD pUserData, bool bShowing );
|
||||
static bool SetMuted ( DWORD pUserData, bool bMuted );
|
||||
static bool SetBlurLevel ( DWORD pUserData, int iLevel );
|
||||
static bool Redirect ( DWORD pUserData, MonoString* sServerIP, int iServerPort, MonoString* sServerPassword );
|
||||
static bool SetName ( DWORD pUserData, MonoString* sName );
|
||||
static bool DetonateSatchels ( DWORD pUserData );
|
||||
static bool TakeScreenShot ( DWORD pUserData, int iWidth, int iHeight, MonoString* sTag, int iQuality, int iMaxBandwith );
|
||||
static bool SetTeam ( DWORD pUserData, DWORD pTeam );
|
||||
|
||||
// Input funcs
|
||||
static bool BindKey ( DWORD pUserData, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName, MonoString* msArguments );
|
||||
static bool UnbindKey ( DWORD pUserData, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName );
|
||||
static bool GetControlState ( DWORD pUserData, MonoString* msControl );
|
||||
static bool IsControlEnabled ( DWORD pUserData, MonoString* msControl );
|
||||
|
||||
static bool SetControlState ( DWORD pUserData, MonoString* msControl, bool bState );
|
||||
static bool ToggleControl ( DWORD pUserData, MonoString* msControl, bool bEnabled );
|
||||
static bool ToggleAllControls ( DWORD pUserData, bool bGTAControls, bool bMTAControls, bool bEnabled );
|
||||
|
||||
// Log in/out funcs
|
||||
static bool LogIn ( DWORD pPlayer, DWORD pAccount, MonoString* msPassword );
|
||||
static bool LogOut ( DWORD pPlayer );
|
||||
|
||||
// Admin funcs
|
||||
static bool Kick ( DWORD pPlayer, MonoString* msResponsible, MonoString* msReason );
|
||||
static DWORD Ban ( DWORD pPlayer, bool bIP, bool bUsername, bool bSerial, DWORD pResponsible, MonoString* msResponsible, MonoString* msReason, int iUnban );
|
||||
|
||||
// Cursor get funcs
|
||||
static bool IsCursorShowing ( DWORD pPlayer );
|
||||
|
||||
// Cursor set funcs
|
||||
static bool ShowCursor ( DWORD pPlayer, bool bShow, bool bToggleControls );
|
||||
|
||||
// Chat funcs
|
||||
static bool ShowChat ( DWORD pPlayer, bool bShow );
|
||||
|
||||
// Camera get functions
|
||||
static MonoObject* GetCameraMatrix ( DWORD pPlayer );
|
||||
static DWORD GetCameraTarget ( DWORD pPlayer );
|
||||
static unsigned char GetCameraInterior ( DWORD pPlayer );
|
||||
|
||||
// Camera set functions
|
||||
static bool SetCameraMatrix ( DWORD pPlayer, MonoObject* pCameraMatrix );
|
||||
static bool SetCameraTarget ( DWORD pPlayer, DWORD pTarget );
|
||||
static bool SetCameraInterior ( DWORD pPlayer, unsigned char ucInterior );
|
||||
static bool FadeCamera ( DWORD pPlayer, bool bFadeIn, float fFadeTime, MonoObject* pColor );
|
||||
};
|
||||
|
||||
class Ped
|
||||
{
|
||||
public:
|
||||
// Ped get functions
|
||||
static DWORD Create ( int iModelid, MonoObject* pMonoPosition, float fRot, bool bSynced );
|
||||
static float GetArmor ( DWORD pUserData );
|
||||
static bool IsChoking ( DWORD pUserData );
|
||||
static bool IsDead ( DWORD pUserData );
|
||||
static bool IsDucked ( DWORD pUserData );
|
||||
static float GetStat ( DWORD pUserData, unsigned short usStat );
|
||||
static DWORD GetTarget ( DWORD pUserData );
|
||||
static int GetWeapon ( DWORD pUserData, int iWeaponSlot );
|
||||
static MonoString* GetClothesTexture ( DWORD pUserData, unsigned char ucType );
|
||||
static MonoString* GetClothesModel ( DWORD pUserData, unsigned char ucType );
|
||||
static bool DoesHaveJetPack ( DWORD pUserData );
|
||||
static bool IsOnGround ( DWORD pUserData );
|
||||
static unsigned char GetFightingStyle ( DWORD pUserData );
|
||||
static unsigned int GetMoveAnim ( DWORD pUserData );
|
||||
static float GetGravity ( DWORD pUserData );
|
||||
static DWORD GetContactElement ( DWORD pUserData );
|
||||
static unsigned char GetWeaponSlot ( DWORD pUserData );
|
||||
static bool IsDoingGangDriveby ( DWORD pUserData );
|
||||
static bool IsOnFire ( DWORD pUserData );
|
||||
static bool IsHeadless ( DWORD pUserData );
|
||||
static bool IsFrozen ( DWORD pUserData );
|
||||
static DWORD GetOccupiedVehicle ( DWORD pUserData );
|
||||
static unsigned int GetOccupiedVehicleSeat ( DWORD pUserData );
|
||||
static bool IsInVehicle ( DWORD pUserData );
|
||||
static short GetWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty );
|
||||
static short GetOriginalWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty );
|
||||
|
||||
// Ped set functions
|
||||
static bool SetArmor ( DWORD pUserData, float fArmor );
|
||||
static bool Kill ( DWORD pUserData, DWORD pKiller, unsigned char ucKillerWeapon, unsigned char ucBodyPart, bool bStealth );
|
||||
static bool SetStat ( DWORD pUserData, unsigned short usStat, float fValue );
|
||||
static bool AddClothes ( DWORD pUserData, MonoString* msTexture, MonoString* msModel, unsigned char ucType );
|
||||
static bool RemoveClothes ( DWORD pUserData, unsigned char ucType, MonoString* msTexture, MonoString* msModel );
|
||||
static bool GiveJetPack ( DWORD pUserData );
|
||||
static bool RemoveJetPack ( DWORD pUserData );
|
||||
static bool SetFightingStyle ( DWORD pUserData, unsigned char ucStyle );
|
||||
static bool SetMoveAnim ( DWORD pUserData, unsigned int iMoveAnim );
|
||||
static bool SetGravity ( DWORD pUserData, float fGravity );
|
||||
static bool SetChoking ( DWORD pUserData, bool bChoking );
|
||||
static bool SetWeaponSlot ( DWORD pUserData, unsigned char ucWeaponSlot );
|
||||
static bool WarpIntoVehicle ( DWORD pUserData, DWORD pVehicle, unsigned int uiSeat );
|
||||
static bool RemoveFromVehicle ( DWORD pUserData );
|
||||
static bool SetDoingGangDriveby ( DWORD pUserData, bool bGangDriveby );
|
||||
static bool SetAnimation ( DWORD pUserData, MonoString* msBlockName, MonoString* msAnimName, int iTime, bool bLoop, bool bUpdatePosition, bool bInterruptable, bool bFreezeLastFrame );
|
||||
static bool SetAnimationProgress ( DWORD pUserData, MonoString* msAnimName, float fProgress );
|
||||
static bool SetOnFire ( DWORD pUserData, bool bIsOnFire );
|
||||
static bool SetHeadless ( DWORD pUserData, bool bIsHeadless );
|
||||
static bool SetFrozen ( DWORD pUserData, bool bIsFrozen );
|
||||
static bool ReloadWeapon ( DWORD pUserData );
|
||||
static bool SetWeaponProperty ( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty, short uData );
|
||||
|
||||
// Ped body?
|
||||
static MonoString* GetBodyPartName ( unsigned char ucID );
|
||||
static MonoArray* GetClothesByTypeIndex ( unsigned char ucType, unsigned char ucIndex );
|
||||
static MonoArray* GetTypeIndexFromClothes ( MonoString* msTexture, MonoString* msModel );
|
||||
static MonoString* GetClothesTypeName ( unsigned char ucType );
|
||||
|
||||
// Weapon give/take functions
|
||||
static bool GiveWeapon ( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo, bool bSetAsCurrent = false );
|
||||
static bool TakeWeapon ( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo = 9999 );
|
||||
static bool TakeAllWeapons ( DWORD pPed );
|
||||
static bool SetWeaponAmmo ( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo, unsigned short usAmmoInClip );
|
||||
};
|
||||
|
||||
class Vehicle
|
||||
{
|
||||
public:
|
||||
static DWORD Create ( int model, MonoObject* position, MonoObject* rotation, MonoString* numberplate, bool direction = false, int variant1 = 255, int variant2 = 255 );
|
||||
// Vehicle create/destroy functions
|
||||
static DWORD Create ( int model, MonoObject* position, MonoObject* rotation, MonoString* numberplate, bool direction = false, int variant1 = 255, int variant2 = 255 );
|
||||
|
||||
// Vehicle get functions
|
||||
static MonoString* GetType ( DWORD pUserData );
|
||||
static MonoArray* GetVariant ( DWORD pUserData );
|
||||
static MonoObject* GetColor ( DWORD pUserData );
|
||||
static unsigned short GetModelFromName ( MonoString* msName );
|
||||
static bool GetLandingGearDown ( DWORD pUserData );
|
||||
static unsigned char GetMaxPassengers ( DWORD pUserData );
|
||||
static MonoString* GetName ( DWORD pUserData );
|
||||
static MonoString* GetNameFromModel ( unsigned short usModel );
|
||||
static DWORD GetOccupant ( DWORD pUserData, unsigned int uiSeat );
|
||||
static MonoArray* GetOccupants ( DWORD pUserData );
|
||||
static DWORD GetController ( DWORD pUserData );
|
||||
static bool GetSirensOn ( DWORD pUserData );
|
||||
static MonoObject* GetTurnVelocity ( DWORD pUserData );
|
||||
static MonoObject* GetTurretPosition ( DWORD pUserData );
|
||||
static bool IsLocked ( DWORD pUserData );
|
||||
static MonoArray* GetOfType ( unsigned int uiModel );
|
||||
static unsigned short GetUpgradeOnSlot ( DWORD pUserData, unsigned char ucSlot );
|
||||
static MonoArray* GetUpgrades ( DWORD pUserData );
|
||||
// static MonoString* GetUpgradeSlotName ( unsigned char ucSlot );
|
||||
static MonoString* GetUpgradeSlotName ( unsigned short usUpgrade );
|
||||
static MonoArray* GetCompatibleUpgrades ( DWORD pUserData );
|
||||
static unsigned char GetDoorState ( DWORD pUserData, unsigned char ucDoor );
|
||||
static MonoObject* GetWheelStates ( DWORD pUserData );
|
||||
static unsigned char GetLightState ( DWORD pUserData, unsigned char ucLight );
|
||||
static unsigned char GetPanelState ( DWORD pUserData, unsigned char ucPanel );
|
||||
static unsigned char GetOverrideLights ( DWORD pUserData );
|
||||
static DWORD GetTowedByVehicle ( DWORD pUserData );
|
||||
static DWORD GetTowingVehicle ( DWORD pUserData );
|
||||
static unsigned char GetPaintjob ( DWORD pUserData );
|
||||
static MonoString* GetPlateText ( DWORD pUserData );
|
||||
static bool IsDamageProof ( DWORD pUserData );
|
||||
static bool IsFuelTankExplodable ( DWORD pUserData );
|
||||
static bool IsFrozen ( DWORD pUserData );
|
||||
static bool IsOnGround ( DWORD pUserData );
|
||||
static bool GetEngineState ( DWORD pUserData );
|
||||
static bool IsTrainDerailed ( DWORD pUserData );
|
||||
static bool IsTrainDerailable ( DWORD pUserData );
|
||||
static bool GetTrainDirection ( DWORD pUserData );
|
||||
static float GetTrainSpeed ( DWORD pUserData );
|
||||
static bool IsBlown ( DWORD pUserData );
|
||||
static MonoObject* GetHeadLightColor ( DWORD pUserData );
|
||||
static float GetDoorOpenRatio ( DWORD pUserData, unsigned char ucDoor );
|
||||
static bool IsTaxiLightOn ( DWORD pUserData );
|
||||
|
||||
// Vehicle set functions
|
||||
static bool Fix ( DWORD pUserData );
|
||||
static bool Blow ( DWORD pUserData, bool bExplode );
|
||||
static bool SetTurnVelocity ( DWORD pUserData, MonoObject* pVelocity );
|
||||
static bool SetColor ( DWORD pUserData, MonoObject* pColor1, MonoObject* pColor2, MonoObject* pColor3, MonoObject* pColor4 );
|
||||
static bool SetLandingGearDown ( DWORD pUserData, bool bLandingGearDown );
|
||||
static bool SetLocked ( DWORD pUserData, bool bLocked );
|
||||
static bool SetDoorsUndamageable ( DWORD pUserData, bool bDoorsUndamageable );
|
||||
static bool SetSirensOn ( DWORD pUserData, bool bSirensOn );
|
||||
static bool SetTaxiLightOn ( DWORD pUserData, bool bTaxiLightState );
|
||||
static bool AddUpgrade ( DWORD pUserData, unsigned short usUpgrade );
|
||||
static bool RemoveUpgrade ( DWORD pUserData, unsigned short usUpgrade );
|
||||
static bool SetDoorState ( DWORD pUserData, unsigned char ucDoor, unsigned char ucState );
|
||||
static bool SetWheelStates ( DWORD pUserData, int iFrontLeft, int iRearLeft, int iFrontRight, int iRearRight );
|
||||
static bool SetLightState ( DWORD pUserData, unsigned char ucLight, unsigned char ucState );
|
||||
static bool SetPanelState ( DWORD pUserData, unsigned char ucPanel, unsigned char ucState );
|
||||
static bool SetIdleRespawnDelay ( DWORD pUserData, unsigned long ulTime );
|
||||
static bool SetRespawnDelay ( DWORD pUserData, unsigned long ulTime );
|
||||
static bool SetRespawnPosition ( DWORD pUserData, MonoObject* pPosition, MonoObject* pRotation );
|
||||
static bool ToggleRespawn ( DWORD pUserData, bool bRespawn );
|
||||
static bool ResetExplosionTime ( DWORD pUserData );
|
||||
static bool ResetIdleTime ( DWORD pUserData );
|
||||
static bool Spawn ( DWORD pUserData, MonoObject* pPosition, MonoObject* pRotation );
|
||||
static bool Respawn ( DWORD pUserData );
|
||||
static bool SetOverrideLights ( DWORD pUserData, unsigned char ucLights );
|
||||
static bool AttachTrailer ( DWORD pUserData, DWORD pTrailer );
|
||||
static bool DetachTrailer ( DWORD pUserData, DWORD pTrailer );
|
||||
static bool SetEngineState ( DWORD pUserData, bool bState );
|
||||
static bool SetDirtLevel ( DWORD pUserData, float fDirtLevel );
|
||||
static bool SetDamageProof ( DWORD pUserData, bool bDamageProof );
|
||||
static bool SetPaintjob ( DWORD pUserData, unsigned char ucPaintjob );
|
||||
static bool SetFuelTankExplodable ( DWORD pUserData, bool bExplodable );
|
||||
static bool SetTrainDerailed ( DWORD pUserData, bool bDerailed );
|
||||
static bool SetTrainDerailable ( DWORD pUserData, bool bDerailable );
|
||||
static bool SetTrainDirection ( DWORD pUserData, bool bDireciton );
|
||||
static bool SetTrainSpeed ( DWORD pUserData, float fSpeed );
|
||||
static bool SetHeadLightColor ( DWORD pUserData, MonoObject* pColor );
|
||||
static bool SetTurretPosition ( DWORD pUserData, MonoObject* pPosition );
|
||||
static bool SetDoorOpenRatio ( DWORD pUserData, unsigned char ucDoor, float fRatio, unsigned long ulTime );
|
||||
static bool SetVariant ( DWORD pUserData, unsigned char ucVariant, unsigned char ucVariant2 );
|
||||
static bool GiveSirens ( DWORD pUserData, unsigned char ucSirenType, unsigned char ucSirenCount, bool bFlag360 = false, bool bCheckLosFlag = true, bool bUseRandomiserFlag = true, bool bSilentFlag = false );
|
||||
static bool RemoveSirens ( DWORD pUserData );
|
||||
static bool SetSirens ( DWORD pUserData, unsigned char ucSirenID, MonoObject* pPosition, MonoObject* pColor, float fMinAlpha );
|
||||
static MonoArray* GetSirens ( DWORD pUserData );
|
||||
static MonoObject* GetSirenParams ( DWORD pUserData );
|
||||
static bool SetPlateText ( DWORD pUserData, MonoString* msName );
|
||||
};
|
||||
|
||||
class Marker
|
||||
{
|
||||
public:
|
||||
// Marker create/destroy functions
|
||||
static DWORD Create ( MonoObject* pPosition, MonoString* szType, float fSize, MonoObject* color, DWORD pVisibleTo );
|
||||
|
||||
// Marker get functions
|
||||
static unsigned int GetCount ();
|
||||
static MonoString* GetType ( DWORD pUserData );
|
||||
static float GetSize ( DWORD pUserData );
|
||||
static MonoObject* GetColor ( DWORD pUserData );
|
||||
static MonoObject* GetTarget ( DWORD pUserData );
|
||||
static MonoString* GetIcon ( DWORD pUserData );
|
||||
|
||||
// Marker set functions
|
||||
static bool SetType ( DWORD pUserData, MonoString* szType );
|
||||
static bool SetSize ( DWORD pUserData, float fSize );
|
||||
static bool SetColor ( DWORD pUserData, MonoObject* color );
|
||||
static bool SetTarget ( DWORD pUserData, MonoObject* pTarget );
|
||||
static bool SetIcon ( DWORD pUserData, MonoString* szIcon );
|
||||
};
|
||||
|
||||
class Blip
|
||||
{
|
||||
public:
|
||||
// Blip create/destroy functions
|
||||
static DWORD Create ( MonoObject* vecPosition, unsigned char ucIcon, unsigned char ucSize, MonoObject* color, short sOrdering, unsigned short usVisibleDistance, DWORD pVisibleTo );
|
||||
static DWORD CreateAttachedTo ( DWORD pTarget, unsigned char ucIcon, unsigned char ucSize, MonoObject* color, short sOrdering, unsigned short usVisibleDistance, DWORD pVisibleTo );
|
||||
|
||||
// Blip get functions
|
||||
static unsigned char GetIcon ( DWORD pUserData );
|
||||
static unsigned char GetSize ( DWORD pUserData );
|
||||
static MonoObject* GetColor ( DWORD pUserData );
|
||||
static short GetOrdering ( DWORD pUserData );
|
||||
static unsigned short GetVisibleDistance ( DWORD pUserData );
|
||||
|
||||
// Blip set functions
|
||||
static bool SetIcon ( DWORD pUserData, unsigned char ucIcon );
|
||||
static bool SetSize ( DWORD pUserData, unsigned char ucSize );
|
||||
static bool SetColor ( DWORD pUserData, MonoObject* color );
|
||||
static bool SetOrdering ( DWORD pUserData, short sOrdering );
|
||||
static bool SetVisibleDistance ( DWORD pUserData, unsigned short usVisibleDistance );
|
||||
};
|
||||
|
||||
class Object
|
||||
{
|
||||
public:
|
||||
// Object create/destroy functions
|
||||
static DWORD Create ( unsigned short usModelID, MonoObject* pPosition, MonoObject* pRotation, bool bIsLowLod );
|
||||
|
||||
// Object get functions
|
||||
static MonoObject* GetScale ( DWORD pUserData );
|
||||
|
||||
// Object set functions
|
||||
static bool SetScale ( DWORD pUserData, MonoObject* pScale );
|
||||
static bool Move ( DWORD pUserData, unsigned long ulTime, MonoObject* pPosition, MonoObject* pRotation, MonoString* msEasingType, float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot );
|
||||
static bool Stop ( DWORD pUserData );
|
||||
};
|
||||
|
||||
class RadarArea
|
||||
{
|
||||
public:
|
||||
// Radar area create/destroy funcs
|
||||
static DWORD Create ( MonoObject* pPosition, MonoObject* pSize, MonoObject* pColor, DWORD pVisibleTo );
|
||||
|
||||
// Radar area get funcs
|
||||
static MonoObject* GetSize ( DWORD pUserData );
|
||||
static MonoObject* GetColor ( DWORD pUserData );
|
||||
static bool IsFlashing ( DWORD pUserData );
|
||||
static bool IsInside ( DWORD pUserData, MonoObject* pPosition );
|
||||
|
||||
// Radar area set funcs
|
||||
static bool SetSize ( DWORD pUserData, MonoObject* pSize );
|
||||
static bool SetColor ( DWORD pUserData, MonoObject* pColor );
|
||||
static bool SetFlashing ( DWORD pUserData, bool bFlashing );
|
||||
};
|
||||
|
||||
class Pickup
|
||||
{
|
||||
public:
|
||||
// Pickup create/destroy funcs
|
||||
static DWORD Create ( MonoObject* pPosition, unsigned char ucType, double dFive, unsigned long ulRespawnInterval, double dSix );
|
||||
|
||||
// Pickup get funcs
|
||||
static unsigned char GetType ( DWORD pUserData );
|
||||
static unsigned char GetWeapon ( DWORD pUserData );
|
||||
static float GetAmount ( DWORD pUserData );
|
||||
static unsigned short GetAmmo ( DWORD pUserData );
|
||||
static unsigned long GetRespawnInterval ( DWORD pUserData );
|
||||
static bool IsSpawned ( DWORD pUserData );
|
||||
|
||||
// Pickup set funcs
|
||||
static bool SetType ( DWORD pUserData, unsigned char ucType, double dThree, double dFour );
|
||||
static bool SetRespawnInterval ( DWORD pUserData, unsigned long ulInterval );
|
||||
static bool Use ( DWORD pUserData, DWORD pPlayer );
|
||||
};
|
||||
|
||||
class Shape
|
||||
{
|
||||
public:
|
||||
// Shape create funcs
|
||||
static DWORD CreateCircle ( MonoObject* pPosition, float fRadius );
|
||||
static DWORD CreateCuboid ( MonoObject* pPosition, MonoObject* vecSize );
|
||||
static DWORD CreateSphere ( MonoObject* pPosition, float fRadius );
|
||||
static DWORD CreateRectangle ( MonoObject* pPosition, MonoObject* vecSize );
|
||||
static DWORD CreatePolygon ( MonoArray* vecPointList );
|
||||
static DWORD CreateTube ( MonoObject* pPosition, float fRadius, float fHeight );
|
||||
};
|
||||
|
||||
class Explosion
|
||||
{
|
||||
public:
|
||||
// Explosion funcs
|
||||
static bool Create ( MonoObject* pPosition, unsigned char ucType, DWORD pCreator );
|
||||
};
|
||||
|
||||
class Audio
|
||||
{
|
||||
public:
|
||||
// Audio funcs
|
||||
static bool PlayFrontEnd ( DWORD pUserData, unsigned char ucSound );
|
||||
static bool PlayMission ( DWORD pUserData, MonoObject* vecPosition, unsigned short usSlot );
|
||||
};
|
||||
|
||||
class Team
|
||||
{
|
||||
public:
|
||||
// Team get funcs
|
||||
static DWORD Create ( MonoString* msTeamName, MonoObject* pColor );
|
||||
static DWORD GetFromName ( MonoString* msTeamName );
|
||||
static MonoString* GetName ( DWORD pUserData );
|
||||
static MonoObject* GetColor ( DWORD pUserData );
|
||||
static unsigned int CountPlayers ( DWORD pUserData );
|
||||
static bool GetFriendlyFire ( DWORD pUserData );
|
||||
|
||||
// Team set funcs
|
||||
static bool SetName ( DWORD pUserData, MonoString* msTeamName );
|
||||
static bool SetColor ( DWORD pUserData, MonoObject* pColor );
|
||||
static bool SetFriendlyFire ( DWORD pUserData, bool bFriendlyFire );
|
||||
};
|
||||
|
||||
class Water
|
||||
{
|
||||
public:
|
||||
// Water funcs
|
||||
static DWORD Create ( MonoObject* pV1, MonoObject* pV2, MonoObject* pV3, MonoObject* pV4, bool bShallow );
|
||||
static bool SetLevel ( DWORD pUserData, float fLevel );
|
||||
static bool SetLevelAll ( float fLevel );
|
||||
static bool SetLevelWorld ( float fLevel, bool bIncludeWorldNonSeaLevel );
|
||||
static bool ResetLevelWorld ( void );
|
||||
static MonoObject* GetVertexPosition ( DWORD pUserData, int iVertexIndex );
|
||||
static bool SetVertexPosition ( DWORD pUserData, int iVertexIndex, MonoObject* vecPosition );
|
||||
static MonoObject* GetColor ( void );
|
||||
static bool SetColor ( MonoObject* pColor );
|
||||
static bool ResetColor ( void );
|
||||
};
|
||||
|
||||
class World
|
||||
{
|
||||
public:
|
||||
// General world get funcs
|
||||
static MonoArray* GetTime ( void );
|
||||
static MonoArray* GetWeather ( void );
|
||||
static MonoString* GetZoneName ( MonoObject* vecPosition, bool bCitiesOnly );
|
||||
static float GetGravity ( void );
|
||||
static float GetGameSpeed ( void );
|
||||
static float GetWaveHeight ( void );
|
||||
static unsigned short GetFPSLimit ( void );
|
||||
static unsigned long GetMinuteDuration ( void );
|
||||
static bool IsGarageOpen ( unsigned char ucGarageID );
|
||||
static unsigned char GetTrafficLightState ( void );
|
||||
static bool GetTrafficLightsLocked ( void );
|
||||
static float GetJetpackMaxHeight ( void );
|
||||
static float GetAircraftMaxVelocity ( void );
|
||||
static bool GetInteriorSoundsEnabled ( void );
|
||||
static float GetRainLevel ( void );
|
||||
static float GetSunSize ( void );
|
||||
static MonoArray* GetSunColor ( void );
|
||||
static MonoObject* GetWindVelocity ( void );
|
||||
static float GetFarClipDistance ( void );
|
||||
static float GetFogDistance ( void );
|
||||
static float GetAircraftMaxHeight ( void );
|
||||
static bool GetOcclusionsEnabled ( void );
|
||||
static int GetMoonSize ( void );
|
||||
static MonoArray* GetSkyGradient ( void );
|
||||
static MonoObject* GetHeatHaze ( void );
|
||||
static bool GetJetpackWeaponEnabled ( unsigned int uiWeaponType );
|
||||
static bool GetCloudsEnabled ( void );
|
||||
|
||||
// General world set funcs
|
||||
static bool SetTime ( unsigned char ucHour, unsigned char ucMinute );
|
||||
static bool SetWeather ( unsigned char ucWeather );
|
||||
static bool SetWeatherBlended ( unsigned char ucWeather );
|
||||
static bool SetGravity ( float fGravity );
|
||||
static bool SetGameSpeed ( float fSpeed );
|
||||
static bool SetWaveHeight ( float fHeight );
|
||||
static bool SetSkyGradient ( MonoObject* pTopColor, MonoObject* pBottomColor );
|
||||
static bool ResetSkyGradient ( void );
|
||||
static bool SetHeatHaze ( MonoObject* heatHazeSettings );
|
||||
static bool ResetHeatHaze ( void );
|
||||
static bool SetFPSLimit ( unsigned short usLimit, bool bSave );
|
||||
static bool SetMinuteDuration ( unsigned long ulDuration );
|
||||
static bool SetGarageOpen ( unsigned char ucGarageID, bool bIsOpen );
|
||||
static bool SetGlitchEnabled ( MonoString* msGlitchName, bool bEnabled );
|
||||
static bool IsGlitchEnabled ( MonoString* msGlitchName );
|
||||
static bool SetJetpackWeaponEnabled ( unsigned int uiWeaponType, bool bEnabled );
|
||||
static bool SetCloudsEnabled ( bool bEnabled );
|
||||
static bool SetTrafficLightState ( unsigned char ucState, bool bForced = false );
|
||||
static bool SetTrafficLightsLocked ( bool bLocked );
|
||||
static bool SetJetpackMaxHeight ( float fMaxHeight );
|
||||
static bool SetInteriorSoundsEnabled ( bool bEnable );
|
||||
static bool SetRainLevel ( float fRainLevel );
|
||||
static bool SetSunSize ( float fSunSize );
|
||||
static bool SetSunColor ( MonoObject* pCoreColor, MonoObject* pCoronaColor );
|
||||
static bool SetWindVelocity ( MonoObject* pVelocity );
|
||||
static bool SetFarClipDistance ( float fFarClip );
|
||||
static bool SetFogDistance ( float fFogDist );
|
||||
static bool SetAircraftMaxHeight ( float fMaxHeight );
|
||||
static bool SetAircraftMaxVelocity ( float fVelocity );
|
||||
static bool SetOcclusionsEnabled ( bool bEnabled );
|
||||
static bool ResetRainLevel ( void );
|
||||
static bool ResetSunSize ( void );
|
||||
static bool ResetSunColor ( void );
|
||||
static bool ResetWindVelocity ( void );
|
||||
static bool ResetFarClipDistance ( void );
|
||||
static bool ResetFogDistance ( void );
|
||||
static bool RemoveWorldModel ( unsigned short usModel, float fRadius, MonoObject* vecPosition, char cInterior );
|
||||
static bool RestoreWorldModel ( unsigned short usModel, float fRadius, MonoObject* vecPosition, char cInterior );
|
||||
static bool RestoreAllWorldModels ( void );
|
||||
static bool SetMoonSize ( int iMoonSize );
|
||||
static bool ResetMoonSize ( void );
|
||||
};
|
||||
|
||||
class Account
|
||||
{
|
||||
public:
|
||||
// Account get funcs
|
||||
static DWORD Get ( MonoString* msName, MonoString* msPassword );
|
||||
static MonoArray* GetAll ( void );
|
||||
static DWORD GetPlayer ( DWORD pAccount );
|
||||
static bool IsGuest ( DWORD pAccount );
|
||||
// static CLuaArgument* GetData ( DWORD pAccount, MonoString* szKey );
|
||||
// static MonoArray* GetAllData ( DWORD pAccount );
|
||||
static MonoString* GetSerial ( DWORD pAccount );
|
||||
// static MonoArray* GetBySerial ( MonoString* msSerial );
|
||||
|
||||
// Account set funcs
|
||||
static DWORD Add ( MonoString* msName, MonoString* msPassword );
|
||||
static bool Remove ( DWORD pAccount );
|
||||
static bool SetPassword ( DWORD pAccount, MonoString* msPassword );
|
||||
// static bool SetData ( DWORD pAccount, MonoString* msKey, CLuaArgument* pArgument );
|
||||
static bool CopyData ( DWORD pAccount, DWORD pFromAccount );
|
||||
};
|
||||
|
||||
class Ban
|
||||
{
|
||||
public:
|
||||
static DWORD Add ( MonoString* msIP, MonoString* msUsername, MonoString* msSerial, DWORD pResponsible, MonoString* msResponsible, MonoString* msReason, int iUnban );
|
||||
static bool Remove ( DWORD pBan, DWORD pResponsible );
|
||||
|
||||
// static MonoArray* GetBans ( void );
|
||||
static bool Reload ( void );
|
||||
|
||||
static MonoString* GetIP ( DWORD pBan );
|
||||
static MonoString* GetSerial ( DWORD pBan );
|
||||
static MonoString* GetUsername ( DWORD pBan );
|
||||
static MonoString* GetNick ( DWORD pBan );
|
||||
static MonoString* GetReason ( DWORD pBan );
|
||||
static MonoString* GetAdmin ( DWORD pBan );
|
||||
|
||||
static int GetBanTime ( DWORD pBan );
|
||||
static int GetUnbanTime ( DWORD pBan );
|
||||
|
||||
static bool SetUnbanTime ( DWORD pBan, int time );
|
||||
static bool SetReason ( DWORD pBan, MonoString* msReason );
|
||||
static bool SetAdmin ( DWORD pBan, MonoString* msAdminName );
|
||||
};
|
||||
|
||||
class Resource
|
||||
{
|
||||
public:
|
||||
// Resource funcs
|
||||
static DWORD Create ( MonoString* msResourceName, MonoString* msOrganizationalDir );
|
||||
static DWORD Copy ( DWORD pResource, MonoString* msNewResourceName, MonoString* msOrganizationalDir );
|
||||
static DWORD GetRootElement ( DWORD pResource = NULL );
|
||||
static DWORD GetMapRootElement ( MonoString* msMap );
|
||||
static DWORD GetDynamicElementRoot ( DWORD pResource );
|
||||
// static CXMLNode* AddMap ( MonoString* msFilePath, MonoString* msMapName, int iDimension );
|
||||
// static CXMLNode* AddConfig ( MonoString* msFilePath, MonoString* msConfigName, int iType );
|
||||
static bool RemoveFile ( MonoString* msFilename );
|
||||
// static CXMLNode AddConfig ( MonoString* msFilePath, MonoString* msFileType );
|
||||
// static CXMLNode AddMap ( MonoString* msFilePath, unsigned int uiDimension = 0 );
|
||||
// static CXMLNode GetConfig ( MonoString* msFilePath );
|
||||
// static CLuaArguments* GetExportedFunctions ( DWORD pResource );
|
||||
static DWORD GetFromName ( MonoString* msResourceName );
|
||||
static MonoString* GetInfo ( DWORD pResource, MonoString* msAttribute );
|
||||
static unsigned int GetLastStartTime ( DWORD pResource );
|
||||
static MonoString* GetLoadFailureReason ( DWORD pResource );
|
||||
static unsigned int GetLoadTime ( DWORD pResource );
|
||||
static MonoString* GetName ( DWORD pResource );
|
||||
static MonoArray* GetResources ( void );
|
||||
static MonoString* GetState ( DWORD pResource );
|
||||
static DWORD GetCurrent ( void );
|
||||
static bool Refresh ( bool refreshAll = false );
|
||||
static bool RemoveDefaultSetting ( DWORD pResource, MonoString* msSettingName );
|
||||
static bool Start ( DWORD 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 ( DWORD pResource );
|
||||
static bool Stop ( DWORD pResource );
|
||||
static bool SetDefaultSetting ( DWORD pResource, MonoString* msSettingName, MonoString* msSettingValue );
|
||||
// static bool SetDefaultSetting ( DWORD pResource, MonoString* msSettingName, int iSettingValue );
|
||||
// static bool SetDefaultSetting ( DWORD pResource, MonoString* msSettingName, float fSettingValue );
|
||||
static bool SetInfo ( DWORD pResource, MonoString* msAttribute, MonoString* msValue );
|
||||
static bool Rename ( MonoString* msResourceName, MonoString* msNewResourceName, MonoString* msOrganizationalPath );
|
||||
static bool Delete ( MonoString* msResourceName );
|
||||
// static CLuaArguments* GetACLRequests ( DWORD pResource );
|
||||
static bool UpdateACLRequest ( DWORD pResource, MonoString* msRightName, bool bAccess, MonoString* msByWho );
|
||||
};
|
||||
};
|
||||
|
||||
|
125
mta-mono/src/CMonoFunctions_Account.cpp
Normal file
125
mta-mono/src/CMonoFunctions_Account.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Account get funcs
|
||||
DWORD CMonoFunctions::Account::Get( MonoString* msName, MonoString* msPassword )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szName = mono_string_to_utf8( msName );
|
||||
const char* szPassword = mono_string_to_utf8( msPassword );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::GetAccount( RESOURCE->GetLua(), szName, szPassword );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::Account::GetAll( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CLuaArguments* pLuaTable = CLuaFunctionDefinitions::GetAccounts( RESOURCE->GetLua() );
|
||||
|
||||
return RESOURCE->NewArray<DWORD, LUA_TLIGHTUSERDATA>( mono_get_uint32_class(), pLuaTable );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Account::GetPlayer( DWORD pAccount )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetAccountPlayer( RESOURCE->GetLua(), (void*)pAccount );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Account::IsGuest( DWORD pAccount )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bIsGuest;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsGuestAccount( RESOURCE->GetLua(), (void*)pAccount, bIsGuest ) )
|
||||
{
|
||||
return bIsGuest;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Account::GetSerial( DWORD pAccount )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strSerial;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetAccountSerial( RESOURCE->GetLua(), (void*)pAccount, strSerial ) )
|
||||
{
|
||||
return RESOURCE->NewString( strSerial );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Account set funcs
|
||||
DWORD CMonoFunctions::Account::Add( MonoString* msName, MonoString* msPassword )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szName = mono_string_to_utf8( msName );
|
||||
const char* szPassword = mono_string_to_utf8( msPassword );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::AddAccount( RESOURCE->GetLua(), szName, szPassword );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Account::Remove( DWORD pAccount )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::RemoveAccount( RESOURCE->GetLua(), (void*)pAccount );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Account::SetPassword( DWORD pAccount, MonoString* msPassword )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szPassword = mono_string_to_utf8( msPassword );
|
||||
|
||||
return CLuaFunctionDefinitions::SetAccountPassword( RESOURCE->GetLua(), (void*)pAccount, szPassword );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Account::CopyData( DWORD pAccount, DWORD pFromAccount )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::CopyAccountData( RESOURCE->GetLua(), (void*)pAccount, (void*)pFromAccount );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
36
mta-mono/src/CMonoFunctions_Audio.cpp
Normal file
36
mta-mono/src/CMonoFunctions_Audio.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Audio funcs
|
||||
bool CMonoFunctions::Audio::PlayFrontEnd( DWORD pUserData, unsigned char ucSound )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::PlaySoundFrontEnd( RESOURCE->GetLua(), (void*)pUserData, ucSound );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Audio::PlayMission( DWORD pUserData, MonoObject* pPosition, unsigned short usSlot )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
|
||||
|
||||
return CLuaFunctionDefinitions::PlayMissionAudio( RESOURCE->GetLua(), (void*)pUserData, vecPosition, usSlot );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
208
mta-mono/src/CMonoFunctions_Ban.cpp
Normal file
208
mta-mono/src/CMonoFunctions_Ban.cpp
Normal file
@ -0,0 +1,208 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
DWORD CMonoFunctions::Ban::Add( MonoString* msIP, MonoString* msUsername, MonoString* msSerial, DWORD pResponsible, MonoString* msResponsible, MonoString* msReason, int iUnban )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string
|
||||
strIP( mono_string_to_utf8( msIP ) ),
|
||||
strUsername( mono_string_to_utf8( msUsername ) ),
|
||||
strSerial( mono_string_to_utf8( msSerial ) ),
|
||||
strResponsible( mono_string_to_utf8( msResponsible ) ),
|
||||
strReason( mono_string_to_utf8( msReason ) );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::AddBan( RESOURCE->GetLua(), strIP, strUsername, strSerial, (void*)pResponsible, strResponsible, strReason, iUnban );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ban::Remove( DWORD pBan, DWORD pResponsible )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::RemoveBan( RESOURCE->GetLua(), (void*)pBan, (void*)pResponsible );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CMonoFunctions::Ban::Reload( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::ReloadBanList( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
MonoString* CMonoFunctions::Ban::GetIP( DWORD pBan )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strIP;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBanIP( RESOURCE->GetLua(), (void*)pBan, strIP ) )
|
||||
{
|
||||
return RESOURCE->NewString( strIP );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Ban::GetSerial( DWORD pBan )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strSerial;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBanSerial( RESOURCE->GetLua(), (void*)pBan, strSerial ) )
|
||||
{
|
||||
return RESOURCE->NewString( strSerial );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Ban::GetUsername( DWORD pBan )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strUsername;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBanUsername( RESOURCE->GetLua(), (void*)pBan, strUsername ) )
|
||||
{
|
||||
return RESOURCE->NewString( strUsername );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Ban::GetNick( DWORD pBan )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strNick;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBanNick( RESOURCE->GetLua(), (void*)pBan, strNick ) )
|
||||
{
|
||||
return RESOURCE->NewString( strNick );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Ban::GetReason( DWORD pBan )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strReason;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBanReason( RESOURCE->GetLua(), (void*)pBan, strReason ) )
|
||||
{
|
||||
return RESOURCE->NewString( strReason );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Ban::GetAdmin( DWORD pBan )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strAdmin;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBanAdmin( RESOURCE->GetLua(), (void*)pBan, strAdmin ) )
|
||||
{
|
||||
return RESOURCE->NewString( strAdmin );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int CMonoFunctions::Ban::GetBanTime( DWORD pBan )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
time_t tTime;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBanTime( RESOURCE->GetLua(), (void*)pBan, tTime ) )
|
||||
{
|
||||
return (int)tTime;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CMonoFunctions::Ban::GetUnbanTime( DWORD pBan )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
time_t tTime;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetUnbanTime( RESOURCE->GetLua(), (void*)pBan, tTime ) )
|
||||
{
|
||||
return (int)tTime;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool CMonoFunctions::Ban::SetUnbanTime( DWORD pBan, int time )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetUnbanTime( RESOURCE->GetLua(), (void*)pBan, time );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ban::SetReason( DWORD pBan, MonoString* msReason )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strReason( mono_string_to_utf8( msReason ) );
|
||||
|
||||
return CLuaFunctionDefinitions::SetBanReason( RESOURCE->GetLua(), (void*)pBan, strReason );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ban::SetAdmin( DWORD pBan, MonoString* msAdminName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strAdmin( mono_string_to_utf8( msAdminName ) );
|
||||
|
||||
return CLuaFunctionDefinitions::SetBanAdmin( RESOURCE->GetLua(), (void*)pBan, strAdmin );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
176
mta-mono/src/CMonoFunctions_Blip.cpp
Normal file
176
mta-mono/src/CMonoFunctions_Blip.cpp
Normal file
@ -0,0 +1,176 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Blip create/destroy functions
|
||||
DWORD CMonoFunctions::Blip::Create( MonoObject* pPosition, unsigned char ucIcon, unsigned char ucSize, MonoObject* color, short sOrdering, unsigned short usVisibleDistance, DWORD pVisibleTo )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
|
||||
|
||||
SColor pColor = CMonoObject( color ).GetColor();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateBlip( RESOURCE->GetLua(), vecPosition, ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, (void*)pVisibleTo );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Blip::CreateAttachedTo( DWORD pTarget, unsigned char ucIcon, unsigned char ucSize, MonoObject* color, short sOrdering, unsigned short usVisibleDistance, DWORD pVisibleTo )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pColor = CMonoObject( color ).GetColor();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateBlipAttachedTo( RESOURCE->GetLua(), (void*)pTarget, ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, (void*)pVisibleTo );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Blip get functions
|
||||
unsigned char CMonoFunctions::Blip::GetIcon( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucIcon;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBlipIcon( RESOURCE->GetLua(), (void*)pUserData, ucIcon ) )
|
||||
{
|
||||
return ucIcon;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::Blip::GetSize( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucSize;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBlipSize( RESOURCE->GetLua(), (void*)pUserData, ucSize ) )
|
||||
{
|
||||
return ucSize;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Blip::GetColor( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor outColor;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBlipColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( outColor );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
short CMonoFunctions::Blip::GetOrdering( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
short sOrdering;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBlipOrdering( RESOURCE->GetLua(), (void*)pUserData, sOrdering ) )
|
||||
{
|
||||
return sOrdering;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned short CMonoFunctions::Blip::GetVisibleDistance( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned short usVisibleDistance;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBlipVisibleDistance( RESOURCE->GetLua(), (void*)pUserData, usVisibleDistance ) )
|
||||
{
|
||||
return usVisibleDistance;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Blip set functions
|
||||
bool CMonoFunctions::Blip::SetIcon( DWORD pUserData, unsigned char ucIcon )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetBlipIcon( RESOURCE->GetLua(), (void*)pUserData, ucIcon );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Blip::SetSize( DWORD pUserData, unsigned char ucSize )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetBlipSize( RESOURCE->GetLua(), (void*)pUserData, ucSize );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Blip::SetColor( DWORD pUserData, MonoObject* color )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pColor = CMonoObject( color ).GetColor();
|
||||
|
||||
return CLuaFunctionDefinitions::SetBlipColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Blip::SetOrdering( DWORD pUserData, short sOrdering )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetBlipOrdering( RESOURCE->GetLua(), (void*)pUserData, sOrdering );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Blip::SetVisibleDistance( DWORD pUserData, unsigned short usVisibleDistance )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetBlipVisibleDistance( RESOURCE->GetLua(), (void*)pUserData, usVisibleDistance );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
775
mta-mono/src/CMonoFunctions_Element.cpp
Normal file
775
mta-mono/src/CMonoFunctions_Element.cpp
Normal file
@ -0,0 +1,775 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Element create/destroy
|
||||
|
||||
DWORD CMonoFunctions::Element::Create( MonoString* msTypeName, MonoString* msID )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szTypeName = mono_string_to_utf8( msTypeName );
|
||||
const char* szID = mono_string_to_utf8( msID );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateElement( RESOURCE->GetLua(), szTypeName, szID );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::Destroy( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::DestroyElement( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Element::Clone( DWORD pUserData, MonoObject* vecPosition, bool bCloneElement )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( vecPosition );
|
||||
|
||||
float fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
float fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue< float >( "Z" );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CloneElement( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ), bCloneElement );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Element get funcs
|
||||
|
||||
MonoArray* CMonoFunctions::Element::GetByType( MonoString* msType, DWORD pStartElement )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szType = mono_string_to_utf8( msType );
|
||||
|
||||
CLuaArguments* pLuaArguments = CLuaFunctionDefinitions::GetElementsByType( RESOURCE->GetLua(), szType, (void*)pStartElement );
|
||||
|
||||
return RESOURCE->NewArray<DWORD, LUA_TLIGHTUSERDATA>( mono_get_uint32_class(), pLuaArguments );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::IsElement( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (unsigned int)CLuaFunctionDefinitions::IsElement( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Element::GetType( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const string strType = CLuaFunctionDefinitions::GetElementType( RESOURCE->GetLua(), (void*)pUserData );
|
||||
|
||||
return mono_string_new( mono_domain_get(), strType.c_str() );
|
||||
}
|
||||
|
||||
return mono_string_new( mono_domain_get(), "" );
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Element::GetByID( MonoString* msID, unsigned int uiIndex )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szID = mono_string_to_utf8( msID );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::GetElementByID( RESOURCE->GetLua(), szID, uiIndex );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Element::GetByIndex( int iIndex )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetElementByIndex( RESOURCE->GetLua(), iIndex );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Element::GetChild( DWORD pUserData, int iIndex )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetElementChild( RESOURCE->GetLua(), (void*)pUserData, iIndex );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CMonoFunctions::Element::GetChildrenCount( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GetElementChildrenCount( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Element::GetID( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const string strID = CLuaFunctionDefinitions::GetElementID( RESOURCE->GetLua(), (void*)pUserData );
|
||||
|
||||
return mono_string_new( mono_domain_get(), strID.c_str() );
|
||||
}
|
||||
|
||||
return mono_string_new( mono_domain_get(), "" );
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Element::GetParent( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (unsigned int)CLuaFunctionDefinitions::GetElementParent( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Element::GetPosition( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementPosition( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Element::GetRotation( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementRotation( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Element::GetVelocity( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementVelocity( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::Element::GetInterior( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucInterior;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementInterior( RESOURCE->GetLua(), (void*)pUserData, ucInterior ) )
|
||||
{
|
||||
return ucInterior;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::IsWithinColShape( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bWithin;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsElementWithinColShape( RESOURCE->GetLua(), (void*)pUserData, bWithin ) )
|
||||
{
|
||||
return bWithin;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::IsWithinMarker( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bWithin;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsElementWithinMarker( RESOURCE->GetLua(), (void*)pUserData, bWithin ) )
|
||||
{
|
||||
return bWithin;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned short CMonoFunctions::Element::GetDimension( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned short usDimension;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementDimension( RESOURCE->GetLua(), (void*)pUserData, usDimension ) )
|
||||
{
|
||||
return usDimension;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Element::GetZoneName( DWORD pUserData, bool bCitiesOnly )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOutName;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementZoneName( RESOURCE->GetLua(), (void*)pUserData, strOutName, bCitiesOnly ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutName );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::IsAttached( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::IsElementAttached( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Element::GetAttachedTo( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetElementAttachedTo( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Element::GetColShape( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetElementColShape( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::Element::GetAlpha( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucAlpha;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementAlpha( RESOURCE->GetLua(), (void*)pUserData, ucAlpha ) )
|
||||
{
|
||||
return ucAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::IsDoubleSided( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bDoubleSided;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsElementDoubleSided( RESOURCE->GetLua(), (void*)pUserData, bDoubleSided ) )
|
||||
{
|
||||
return bDoubleSided;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
float CMonoFunctions::Element::GetHealth( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fHealth;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementHealth( RESOURCE->GetLua(), (void*)pUserData, fHealth ) )
|
||||
{
|
||||
return fHealth;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned short CMonoFunctions::Element::GetModel( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned short usModel;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementModel( RESOURCE->GetLua(), (void*)pUserData, usModel ) )
|
||||
{
|
||||
return usModel;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::IsInWater( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bInWater;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsElementInWater( RESOURCE->GetLua(), (void*)pUserData, bInWater ) )
|
||||
{
|
||||
return bInWater;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Element::GetAttachedOffsetPosition( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition, vecRotation;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementAttachedOffsets( RESOURCE->GetLua(), (void*)pUserData, vecPosition, vecRotation ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Element::GetAttachedOffsetRotation( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition, vecRotation;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetElementAttachedOffsets( RESOURCE->GetLua(), (void*)pUserData, vecPosition, vecRotation ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecRotation );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Element::GetSyncer( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetElementSyncer( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::GetCollisionsEnabled( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GetElementCollisionsEnabled( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::IsFrozen( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bFrozen;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsElementFrozen( RESOURCE->GetLua(), (void*)pUserData, bFrozen ) )
|
||||
{
|
||||
return bFrozen;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Element::GetLowLod( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
void* pUserData;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetLowLodElement( RESOURCE->GetLua(), (void*)pUserData, pUserData ) )
|
||||
{
|
||||
return (DWORD)pUserData;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::IsLowLod( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bIsLowLod;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsElementLowLod( RESOURCE->GetLua(), (void*)pUserData, bIsLowLod ) )
|
||||
{
|
||||
return bIsLowLod;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Element set funcs
|
||||
|
||||
bool CMonoFunctions::Element::ClearVisibleTo( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ClearElementVisibleTo( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetID( DWORD pUserData, MonoString* msID )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementID( RESOURCE->GetLua(), (void*)pUserData, string( mono_string_to_utf8( msID ) ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetData( DWORD pUserData, MonoString* msKey, CLuaArgument& Variable )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strKey( mono_string_to_utf8( msKey ) );
|
||||
|
||||
return CLuaFunctionDefinitions::SetElementData( RESOURCE->GetLua(), (void*)pUserData, strKey, Variable );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::RemoveData( DWORD pUserData, MonoString* msKey )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strKey( mono_string_to_utf8( msKey ) );
|
||||
|
||||
return CLuaFunctionDefinitions::RemoveElementData( RESOURCE->GetLua(), (void*)pUserData, strKey );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetParent( DWORD pUserData, DWORD pTarget )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementParent( RESOURCE->GetLua(), (void*)pUserData, (void*)pTarget );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetPosition( DWORD pUserData, MonoObject* pPosition, bool bWarp )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( pPosition );
|
||||
|
||||
float fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
float fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue< float >( "Z" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetElementPosition( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ), bWarp );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetRotation( DWORD pUserData, MonoObject* pRotation, MonoString* msRotationOrder, bool bNewWay )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( pRotation );
|
||||
|
||||
float fX = pPosition.GetPropertyValue<float>( "X" );
|
||||
float fY = pPosition.GetPropertyValue<float>( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue<float>( "Z" );
|
||||
|
||||
const char* szRotationOrder = mono_string_to_utf8( msRotationOrder );
|
||||
|
||||
return CLuaFunctionDefinitions::SetElementRotation( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ), szRotationOrder, bNewWay );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetVelocity( DWORD pUserData, MonoObject* pVelocity )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( pVelocity );
|
||||
|
||||
float fX = pPosition.GetPropertyValue<float>( "X" );
|
||||
float fY = pPosition.GetPropertyValue<float>( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue<float>( "Z" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetElementVelocity( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetVisibleTo( DWORD pUserData, DWORD pTarget, bool bVisible )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementVisibleTo( RESOURCE->GetLua(), (void*)pUserData, (void*)pTarget, bVisible );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetInterior( DWORD pUserData, int iInterior )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementInterior( RESOURCE->GetLua(), (void*)pUserData, iInterior );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetDimension( DWORD pUserData, int iDimension )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementDimension( RESOURCE->GetLua(), (void*)pUserData, iDimension );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::Attach( DWORD pUserData, DWORD pTarget, MonoObject* pMonoPosition, MonoObject* pMonoRotation )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3
|
||||
vecPosition, vecRotation;
|
||||
|
||||
CMonoObject
|
||||
pPosition( pMonoPosition ), pRotation( pMonoRotation );
|
||||
|
||||
vecPosition.fX = pPosition.GetPropertyValue<float>( "X" );
|
||||
vecPosition.fY = pPosition.GetPropertyValue<float>( "Y" );
|
||||
vecPosition.fZ = pPosition.GetPropertyValue<float>( "Z" );
|
||||
|
||||
vecRotation.fX = pRotation.GetPropertyValue<float>( "X" );
|
||||
vecRotation.fY = pRotation.GetPropertyValue<float>( "Y" );
|
||||
vecRotation.fZ = pRotation.GetPropertyValue<float>( "Z" );
|
||||
|
||||
return CLuaFunctionDefinitions::AttachElements( RESOURCE->GetLua(), (void*)pUserData, (void*)pTarget, vecPosition, vecRotation );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::Detach( DWORD pUserData, DWORD pTarget )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::DetachElements( RESOURCE->GetLua(), (void*)pUserData, (void*)pTarget );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetAlpha( DWORD pUserData, int iAlpha )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementAlpha( RESOURCE->GetLua(), (void*)pUserData, iAlpha );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetDoubleSided( DWORD pUserData, bool bDoubleSided )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementDoubleSided( RESOURCE->GetLua(), (void*)pUserData, bDoubleSided );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetHealth( DWORD pUserData, float fHealth )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementHealth( RESOURCE->GetLua(), (void*)pUserData, fHealth );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetModel( DWORD pUserData, int iModel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementModel( RESOURCE->GetLua(), (void*)pUserData, iModel );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetAttachedOffsets( DWORD pUserData, MonoObject* pMonoPosition, MonoObject* pMonoRotation )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3
|
||||
vecPosition, vecRotation;
|
||||
|
||||
CMonoObject
|
||||
pPosition( pMonoPosition ), pRotation( pMonoRotation );
|
||||
|
||||
vecPosition.fX = pPosition.GetPropertyValue<float>( "X" );
|
||||
vecPosition.fY = pPosition.GetPropertyValue<float>( "Y" );
|
||||
vecPosition.fZ = pPosition.GetPropertyValue<float>( "Z" );
|
||||
|
||||
vecRotation.fX = pRotation.GetPropertyValue<float>( "X" );
|
||||
vecRotation.fY = pRotation.GetPropertyValue<float>( "Y" );
|
||||
vecRotation.fZ = pRotation.GetPropertyValue<float>( "Z" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetElementAttachedOffsets( RESOURCE->GetLua(), (void*)pUserData, vecPosition, vecRotation );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetSyncer( DWORD pUserData, DWORD pPlayer )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementSyncer( RESOURCE->GetLua(), (void*)pUserData, (void*)pPlayer );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetCollisionsEnabled( DWORD pUserData, bool bEnabled )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementCollisionsEnabled( RESOURCE->GetLua(), (void*)pUserData, bEnabled );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetFrozen( DWORD pUserData, bool bFrozen )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementFrozen( RESOURCE->GetLua(), (void*)pUserData, bFrozen );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Element::SetLowLod( DWORD pUserData, bool bEnabled )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetLowLodElement( RESOURCE->GetLua(), (void*)pUserData, bEnabled );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
26
mta-mono/src/CMonoFunctions_Explosion.cpp
Normal file
26
mta-mono/src/CMonoFunctions_Explosion.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Explosion funcs
|
||||
bool CMonoFunctions::Explosion::Create( MonoObject* pPosition, unsigned char ucType, DWORD pCreator )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateExplosion( RESOURCE->GetLua(), vecPosition, ucType, (void*)pCreator );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
218
mta-mono/src/CMonoFunctions_Marker.cpp
Normal file
218
mta-mono/src/CMonoFunctions_Marker.cpp
Normal file
@ -0,0 +1,218 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Marker create/destroy functions
|
||||
DWORD CMonoFunctions::Marker::Create( MonoObject* pPosition, MonoString* msType, float fSize, MonoObject* pColor, DWORD pVisibleTo )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( pPosition );
|
||||
|
||||
float fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
float fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue< float >( "Z" );
|
||||
|
||||
Vector3 vecPosition( fX, fY, fZ );
|
||||
|
||||
const char* szType = mono_string_to_utf8( msType );
|
||||
|
||||
CMonoObject pMonoColor( pColor );
|
||||
|
||||
SColor pColor;
|
||||
|
||||
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
|
||||
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
|
||||
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
|
||||
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateMarker( RESOURCE->GetLua(), vecPosition, szType, fSize, pColor, (void*)pVisibleTo );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Marker get functions
|
||||
unsigned int CMonoFunctions::Marker::GetCount()
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiCount;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetMarkerCount( RESOURCE->GetLua(), uiCount ) )
|
||||
{
|
||||
return uiCount;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Marker::GetType( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
char* szType = NULL;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szType ) )
|
||||
{
|
||||
return RESOURCE->NewString( szType );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float CMonoFunctions::Marker::GetSize( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fSize;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetMarkerSize( RESOURCE->GetLua(), (void*)pUserData, fSize ) )
|
||||
{
|
||||
return fSize;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Marker::GetColor( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor outColor;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( outColor );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Marker::GetTarget( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Marker::GetIcon( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
char* szIcon = NULL;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetMarkerIcon( RESOURCE->GetLua(), (void*)pUserData, szIcon ) )
|
||||
{
|
||||
return RESOURCE->NewString( szIcon );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Marker set functions
|
||||
bool CMonoFunctions::Marker::SetType( DWORD pUserData, MonoString* msType )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szType = mono_string_to_utf8( msType );
|
||||
|
||||
return CLuaFunctionDefinitions::SetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szType );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Marker::SetSize( DWORD pUserData, float fSize )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetMarkerSize( RESOURCE->GetLua(), (void*)pUserData, fSize );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Marker::SetColor( DWORD pUserData, MonoObject* color )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pColor;
|
||||
|
||||
CMonoObject pMonoColor( color );
|
||||
|
||||
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
|
||||
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
|
||||
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
|
||||
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Marker::SetTarget( DWORD pUserData, MonoObject* pTarget )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3* vecPosition = new Vector3;
|
||||
|
||||
CMonoObject pTarget( pTarget );
|
||||
|
||||
vecPosition->fX = pTarget.GetPropertyValue< float >( "X" );
|
||||
vecPosition->fY = pTarget.GetPropertyValue< float >( "Y" );
|
||||
vecPosition->fZ = pTarget.GetPropertyValue< float >( "Z" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, vecPosition );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Marker::SetIcon( DWORD pUserData, MonoString* msIcon )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szIcon = mono_string_to_utf8( msIcon );
|
||||
|
||||
return CLuaFunctionDefinitions::SetMarkerType( RESOURCE->GetLua(), (void*)pUserData, szIcon );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
118
mta-mono/src/CMonoFunctions_Object.cpp
Normal file
118
mta-mono/src/CMonoFunctions_Object.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Object create/destroy functions
|
||||
DWORD CMonoFunctions::Object::Create( unsigned short usModelID, MonoObject* pPosition, MonoObject* pRotation, bool bIsLowLod )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( pPosition );
|
||||
|
||||
float fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
float fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue< float >( "Z" );
|
||||
|
||||
Vector3 vecPosition( fX, fY, fZ );
|
||||
|
||||
CMonoObject pRotation( pRotation );
|
||||
|
||||
float fRX = pRotation.GetPropertyValue< float >( "X" );
|
||||
float fRY = pRotation.GetPropertyValue< float >( "Y" );
|
||||
float fRZ = pRotation.GetPropertyValue< float >( "Z" );
|
||||
|
||||
Vector3 vecRotation( fRX, fRY, fRZ );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateObject( RESOURCE->GetLua(), usModelID, vecPosition, vecRotation, bIsLowLod );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Object get functions
|
||||
MonoObject* CMonoFunctions::Object::GetScale( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecScale;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetObjectScale( RESOURCE->GetLua(), (void*)pUserData, vecScale ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecScale );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Object set functions
|
||||
bool CMonoFunctions::Object::SetScale( DWORD pUserData, MonoObject* pScale )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecScale;
|
||||
|
||||
CMonoObject pScale( pScale );
|
||||
|
||||
vecScale.fX = pScale.GetPropertyValue< float >( "X" );
|
||||
vecScale.fY = pScale.GetPropertyValue< float >( "Y" );
|
||||
vecScale.fZ = pScale.GetPropertyValue< float >( "Z" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetObjectScale( RESOURCE->GetLua(), (void*)pUserData, vecScale );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Object::Move( DWORD pUserData, unsigned long ulTime, MonoObject* pPosition, MonoObject* pRotation, MonoString* msEasingType, float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition, vecRotation;
|
||||
|
||||
CMonoObject pPosition( pPosition );
|
||||
|
||||
vecPosition.fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
vecPosition.fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
vecPosition.fZ = pPosition.GetPropertyValue< float >( "Z" );
|
||||
|
||||
CMonoObject pRotation( pRotation );
|
||||
|
||||
vecRotation.fX = pRotation.GetPropertyValue< float >( "X" );
|
||||
vecRotation.fY = pRotation.GetPropertyValue< float >( "Y" );
|
||||
vecRotation.fZ = pRotation.GetPropertyValue< float >( "Z" );
|
||||
|
||||
const char* szEasingType = mono_string_to_utf8( msEasingType );
|
||||
|
||||
return CLuaFunctionDefinitions::MoveObject( RESOURCE->GetLua(), (void*)pUserData, ulTime, vecPosition, vecRotation, szEasingType, fEasingPeriod, fEasingAmplitude, fEasingOvershoot );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Object::Stop( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::StopObject( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
758
mta-mono/src/CMonoFunctions_Ped.cpp
Normal file
758
mta-mono/src/CMonoFunctions_Ped.cpp
Normal file
@ -0,0 +1,758 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#ifndef _CMONO_FUNCS_PED
|
||||
#define _CMONO_FUNCS_PED
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Ped get functions
|
||||
DWORD CMonoFunctions::Ped::Create( int iModelid, MonoObject* pMonoPosition, float fRot, bool bSynced )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( pMonoPosition );
|
||||
|
||||
float fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
float fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue< float >( "Z" );
|
||||
|
||||
Vector3 vecPosition( fX, fY, fZ );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreatePed( RESOURCE->GetLua(), iModelid, vecPosition, fRot, bSynced );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float CMonoFunctions::Ped::GetArmor( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fArmor;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedArmor( RESOURCE->GetLua(), (void*)pUserData, fArmor ) )
|
||||
{
|
||||
return fArmor;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsChoking( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bChoking;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedChoking( RESOURCE->GetLua(), (void*)pUserData, bChoking ) )
|
||||
{
|
||||
return bChoking;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsDead( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bDead;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedDead( RESOURCE->GetLua(), (void*)pUserData, bDead ) )
|
||||
{
|
||||
return bDead;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsDucked( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bDucked;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedDucked( RESOURCE->GetLua(), (void*)pUserData, bDucked ) )
|
||||
{
|
||||
return bDucked;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
float CMonoFunctions::Ped::GetStat( DWORD pUserData, unsigned short usStat )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fStat;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedStat( RESOURCE->GetLua(), (void*)pUserData, usStat, fStat ) )
|
||||
{
|
||||
return fStat;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Ped::GetTarget( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetPedTarget( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CMonoFunctions::Ped::GetWeapon( DWORD pUserData, int iWeaponSlot )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GetPedWeapon( RESOURCE->GetLua(), (void*)pUserData, iWeaponSlot );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Ped::GetClothesTexture( DWORD pUserData, unsigned char ucType )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOutTexture, strOutModel;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedClothes( RESOURCE->GetLua(), (void*)pUserData, ucType, strOutTexture, strOutModel ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutTexture );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Ped::GetClothesModel( DWORD pUserData, unsigned char ucType )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOutTexture, strOutModel;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedClothes( RESOURCE->GetLua(), (void*)pUserData, ucType, strOutTexture, strOutModel ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutModel );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::DoesHaveJetPack( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bHasJetPack;
|
||||
|
||||
if( CLuaFunctionDefinitions::DoesPedHaveJetPack( RESOURCE->GetLua(), (void*)pUserData, bHasJetPack ) )
|
||||
{
|
||||
return bHasJetPack;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsOnGround( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bOnGround;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedOnGround( RESOURCE->GetLua(), (void*)pUserData, bOnGround ) )
|
||||
{
|
||||
return bOnGround;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::Ped::GetFightingStyle( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucStyle;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedFightingStyle( RESOURCE->GetLua(), (void*)pUserData, ucStyle ) )
|
||||
{
|
||||
return ucStyle;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Ped::GetMoveAnim( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiMoveAnim;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedMoveAnim( RESOURCE->GetLua(), (void*)pUserData, uiMoveAnim ) )
|
||||
{
|
||||
return uiMoveAnim;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
float CMonoFunctions::Ped::GetGravity( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fGravity;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedGravity( RESOURCE->GetLua(), (void*)pUserData, fGravity ) )
|
||||
{
|
||||
return fGravity;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Ped::GetContactElement( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetPedContactElement( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::Ped::GetWeaponSlot( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucWeaponSlot;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedWeaponSlot( RESOURCE->GetLua(), (void*)pUserData, ucWeaponSlot ) )
|
||||
{
|
||||
return ucWeaponSlot;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsDoingGangDriveby( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bDoingGangDriveby;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedDoingGangDriveby( RESOURCE->GetLua(), (void*)pUserData, bDoingGangDriveby ) )
|
||||
{
|
||||
return bDoingGangDriveby;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsOnFire( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bOnFire;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedOnFire( RESOURCE->GetLua(), (void*)pUserData, bOnFire ) )
|
||||
{
|
||||
return bOnFire;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsHeadless( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bHeadless;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedHeadless( RESOURCE->GetLua(), (void*)pUserData, bHeadless ) )
|
||||
{
|
||||
return bHeadless;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsFrozen( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bFrozen;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedFrozen( RESOURCE->GetLua(), (void*)pUserData, bFrozen ) )
|
||||
{
|
||||
return bFrozen;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Ped::GetOccupiedVehicle( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetPedOccupiedVehicle( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Ped::GetOccupiedVehicleSeat( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiSeat;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPedOccupiedVehicleSeat( RESOURCE->GetLua(), (void*)pUserData, uiSeat ) )
|
||||
{
|
||||
return uiSeat;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::IsInVehicle( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bInVehicle;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPedInVehicle( RESOURCE->GetLua(), (void*)pUserData, bInVehicle ) )
|
||||
{
|
||||
return bInVehicle;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
short CMonoFunctions::Ped::GetWeaponProperty( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
short uData;
|
||||
|
||||
const char* szWeaponSkill = mono_string_to_utf8( msWeaponSkill );
|
||||
const char* szProperty = mono_string_to_utf8( msProperty );
|
||||
|
||||
if( CLuaFunctionDefinitions::GetWeaponProperty( RESOURCE->GetLua(), ucWeaponID, szWeaponSkill, szProperty, uData ) )
|
||||
{
|
||||
return uData;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
short CMonoFunctions::Ped::GetOriginalWeaponProperty( unsigned char ucWeaponID, MonoString *msWeaponSkill, MonoString* msProperty )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
short uData;
|
||||
|
||||
const char* szWeaponSkill = mono_string_to_utf8( msWeaponSkill );
|
||||
const char* szProperty = mono_string_to_utf8( msProperty );
|
||||
|
||||
if( CLuaFunctionDefinitions::GetOriginalWeaponProperty( RESOURCE->GetLua(), ucWeaponID, szWeaponSkill, szProperty, uData ) )
|
||||
{
|
||||
return uData;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Ped set functions
|
||||
bool CMonoFunctions::Ped::SetArmor( DWORD pUserData, float fArmor )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedArmor( RESOURCE->GetLua(), (void*)pUserData, fArmor );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::Kill( DWORD pUserData, DWORD pKiller, unsigned char ucKillerWeapon, unsigned char ucBodyPart, bool bStealth )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::KillPed( RESOURCE->GetLua(), (void*)pUserData, (void*)pKiller, ucKillerWeapon, ucBodyPart, bStealth );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetStat( DWORD pUserData, unsigned short usStat, float fValue )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedStat( RESOURCE->GetLua(), (void*)pUserData, usStat, fValue );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::AddClothes( DWORD pUserData, MonoString* msTexture, MonoString* msModel, unsigned char ucType )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szTexture = mono_string_to_utf8( msTexture );
|
||||
const char* szModel = mono_string_to_utf8( msModel );
|
||||
|
||||
return CLuaFunctionDefinitions::AddPedClothes( RESOURCE->GetLua(), (void*)pUserData, szTexture, szModel, ucType );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::RemoveClothes( DWORD pUserData, unsigned char ucType, MonoString* msTexture, MonoString* msModel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szTexture = mono_string_to_utf8( msTexture );
|
||||
const char* szModel = mono_string_to_utf8( msModel );
|
||||
|
||||
return CLuaFunctionDefinitions::RemovePedClothes( RESOURCE->GetLua(), (void*)pUserData, ucType, szTexture, szModel );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::GiveJetPack( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GivePedJetPack( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::RemoveJetPack( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::RemovePedJetPack( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetFightingStyle( DWORD pUserData, unsigned char ucStyle )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedFightingStyle( RESOURCE->GetLua(), (void*)pUserData, ucStyle );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetMoveAnim( DWORD pUserData, unsigned int iMoveAnim )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedMoveAnim( RESOURCE->GetLua(), (void*)pUserData, iMoveAnim );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetGravity( DWORD pUserData, float fGravity )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedGravity( RESOURCE->GetLua(), (void*)pUserData, fGravity );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetChoking( DWORD pUserData, bool bChoking )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedChoking( RESOURCE->GetLua(), (void*)pUserData, bChoking );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetWeaponSlot( DWORD pUserData, unsigned char ucWeaponSlot )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedWeaponSlot( RESOURCE->GetLua(), (void*)pUserData, ucWeaponSlot );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::WarpIntoVehicle( DWORD pUserData, DWORD pVehicle, unsigned int uiSeat )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::WarpPedIntoVehicle( RESOURCE->GetLua(), (void*)pUserData, (void*)pVehicle, uiSeat );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::RemoveFromVehicle( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::RemovePedFromVehicle( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetDoingGangDriveby( DWORD pUserData, bool bGangDriveby )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedDoingGangDriveby( RESOURCE->GetLua(), (void*)pUserData, bGangDriveby );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetAnimation( DWORD pUserData, MonoString* msBlockName, MonoString* msAnimName, int iTime, bool bLoop, bool bUpdatePosition, bool bInterruptable, bool bFreezeLastFrame )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szBlockName = mono_string_to_utf8( msBlockName );
|
||||
const char* szAnimName = mono_string_to_utf8( msAnimName );
|
||||
|
||||
return CLuaFunctionDefinitions::SetPedAnimation( RESOURCE->GetLua(), (void*)pUserData, szBlockName, szAnimName, iTime, bLoop, bUpdatePosition, bInterruptable, bFreezeLastFrame );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetAnimationProgress( DWORD pUserData, MonoString* msAnimName, float fProgress )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szAnimName = mono_string_to_utf8( msAnimName );
|
||||
|
||||
return CLuaFunctionDefinitions::SetPedAnimationProgress( RESOURCE->GetLua(), (void*)pUserData, szAnimName, fProgress );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetOnFire( DWORD pUserData, bool bIsOnFire )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedOnFire( RESOURCE->GetLua(), (void*)pUserData, bIsOnFire );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetHeadless( DWORD pUserData, bool bIsHeadless )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedHeadless( RESOURCE->GetLua(), (void*)pUserData, bIsHeadless );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetFrozen( DWORD pUserData, bool bIsFrozen )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPedFrozen( RESOURCE->GetLua(), (void*)pUserData, bIsFrozen );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::ReloadWeapon( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ReloadPedWeapon( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetWeaponProperty( unsigned char ucWeaponID, MonoString* msWeaponSkill, MonoString* msProperty, short uData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szWeaponSkill = mono_string_to_utf8( msWeaponSkill );
|
||||
const char* szProperty = mono_string_to_utf8( msProperty );
|
||||
|
||||
return CLuaFunctionDefinitions::SetWeaponProperty( RESOURCE->GetLua(), ucWeaponID, szWeaponSkill, szProperty, uData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Ped body?
|
||||
MonoString* CMonoFunctions::Ped::GetBodyPartName( unsigned char ucID )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
char* szName = NULL;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetBodyPartName( RESOURCE->GetLua(), ucID, szName ) )
|
||||
{
|
||||
return RESOURCE->NewString( szName );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::Ped::GetClothesByTypeIndex( unsigned char ucType, unsigned char ucIndex )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
char* szTexture = NULL;
|
||||
char* szModel = NULL;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetClothesByTypeIndex( RESOURCE->GetLua(), ucType, ucIndex, szTexture, szModel ) )
|
||||
{
|
||||
MonoArray* pArray = mono_array_new( RESOURCE->m_pMonoDomain, mono_get_string_class(), 2 );
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
mono_array_set( pArray, MonoString*, 0, RESOURCE->NewString( szTexture ) );
|
||||
mono_array_set( pArray, MonoString*, 1, RESOURCE->NewString( szModel ) );
|
||||
|
||||
return pArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::Ped::GetTypeIndexFromClothes( MonoString* msTexture, MonoString* msModel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szTexture = mono_string_to_utf8( msTexture );
|
||||
const char* szModel = mono_string_to_utf8( msModel );
|
||||
|
||||
unsigned char ucType, ucIndex;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetTypeIndexFromClothes( RESOURCE->GetLua(), szTexture, szModel, ucType, ucIndex ) )
|
||||
{
|
||||
MonoArray* pArray = mono_array_new( RESOURCE->m_pMonoDomain, mono_get_char_class(), 2 );
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
mono_array_set( pArray, unsigned char, 0, ucType );
|
||||
mono_array_set( pArray, unsigned char, 1, ucIndex );
|
||||
|
||||
return pArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Ped::GetClothesTypeName( unsigned char ucType )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
char* szName = NULL;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetClothesTypeName( RESOURCE->GetLua(), ucType, szName ) )
|
||||
{
|
||||
return RESOURCE->NewString( szName );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Weapon give/take functions
|
||||
bool CMonoFunctions::Ped::GiveWeapon( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo, bool bSetAsCurrent )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GiveWeapon( RESOURCE->GetLua(), (void*)pPed, ucWeaponID, usAmmo, bSetAsCurrent );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::TakeWeapon( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::TakeWeapon( RESOURCE->GetLua(), (void*)pPed, ucWeaponID, usAmmo );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::TakeAllWeapons( DWORD pPed )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::TakeAllWeapons( RESOURCE->GetLua(), (void*)pPed );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Ped::SetWeaponAmmo( DWORD pPed, unsigned char ucWeaponID, unsigned short usAmmo, unsigned short usAmmoInClip )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetWeaponAmmo( RESOURCE->GetLua(), (void*)pPed, ucWeaponID, usAmmo, usAmmoInClip );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
156
mta-mono/src/CMonoFunctions_Pickup.cpp
Normal file
156
mta-mono/src/CMonoFunctions_Pickup.cpp
Normal file
@ -0,0 +1,156 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Pickup create/destroy funcs
|
||||
DWORD CMonoFunctions::Pickup::Create( MonoObject* pPosition, unsigned char ucType, double dFive, unsigned long ulRespawnInterval, double dSix )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( pPosition );
|
||||
|
||||
float fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
float fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue< float >( "Z" );
|
||||
|
||||
Vector3 vecPosition( fX, fY, fZ );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreatePickup( RESOURCE->GetLua(), vecPosition, ucType, dFive, ulRespawnInterval, dSix );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Pickup get funcs
|
||||
unsigned char CMonoFunctions::Pickup::GetType( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucType;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPickupType( RESOURCE->GetLua(), (void*)pUserData, ucType ) )
|
||||
{
|
||||
return ucType;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::Pickup::GetWeapon( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucWeapon;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPickupWeapon( RESOURCE->GetLua(), (void*)pUserData, ucWeapon ) )
|
||||
{
|
||||
return ucWeapon;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
float CMonoFunctions::Pickup::GetAmount( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fAmount;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPickupAmount( RESOURCE->GetLua(), (void*)pUserData, fAmount ) )
|
||||
{
|
||||
return fAmount;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned short CMonoFunctions::Pickup::GetAmmo( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned short usAmmo;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPickupAmmo( RESOURCE->GetLua(), (void*)pUserData, usAmmo ) )
|
||||
{
|
||||
return usAmmo;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long CMonoFunctions::Pickup::GetRespawnInterval( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned long ulInterval;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPickupRespawnInterval( RESOURCE->GetLua(), (void*)pUserData, ulInterval ) )
|
||||
{
|
||||
return ulInterval;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Pickup::IsSpawned( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bSpawned;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPickupSpawned( RESOURCE->GetLua(), (void*)pUserData, bSpawned ) )
|
||||
{
|
||||
return bSpawned;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Pickup set funcs
|
||||
bool CMonoFunctions::Pickup::SetType( DWORD pUserData, unsigned char ucType, double dThree, double dFour )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPickupType( RESOURCE->GetLua(), (void*)pUserData, ucType, dThree, dFour );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Pickup::SetRespawnInterval( DWORD pUserData, unsigned long ulInterval )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPickupRespawnInterval( RESOURCE->GetLua(), (void*)pUserData, ulInterval );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Pickup::Use( DWORD pUserData, DWORD pPlayer )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::UsePickup( RESOURCE->GetLua(), (void*)pUserData, (void*)pPlayer );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
880
mta-mono/src/CMonoFunctions_Player.cpp
Normal file
880
mta-mono/src/CMonoFunctions_Player.cpp
Normal file
@ -0,0 +1,880 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#ifndef _CMONO_FUNCS_PLAYER
|
||||
#define _CMONO_FUNCS_PLAYER
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Player get functions
|
||||
unsigned int CMonoFunctions::Player::GetCount( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GetPlayerCount( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Player::GetFromName( MonoString* msNick )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szNick = mono_string_to_utf8( msNick );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::GetPlayerFromName( RESOURCE->GetLua(), szNick );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Player::GetPing( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiPing;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerPing( RESOURCE->GetLua(), (void*)pUserData, uiPing ) )
|
||||
{
|
||||
return uiPing;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long CMonoFunctions::Player::GetMoney( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
long lMoney;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerMoney( RESOURCE->GetLua(), (void*)pUserData, lMoney ) )
|
||||
{
|
||||
return lMoney;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Player::GetRandom( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetRandomPlayer( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::IsMuted( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bMuted;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPlayerMuted( RESOURCE->GetLua(), (void*)pUserData, bMuted ) )
|
||||
{
|
||||
return bMuted;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Player::GetTeam( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetPlayerTeam( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Player::GetWantedLevel( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiWantedLevel;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerWantedLevel( RESOURCE->GetLua(), (void*)pUserData, uiWantedLevel ) )
|
||||
{
|
||||
return uiWantedLevel;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::Player::GetAlivePlayers( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CLuaArguments* pLuaArguments = CLuaFunctionDefinitions::GetAlivePlayers( RESOURCE->GetLua() );
|
||||
|
||||
if( pLuaArguments )
|
||||
{
|
||||
MonoArray* pArray = mono_array_new( RESOURCE->m_pMonoDomain, mono_get_uint32_class(), pLuaArguments->Count() );
|
||||
|
||||
vector< CLuaArgument* >::const_iterator iter = pLuaArguments->IterBegin();
|
||||
|
||||
for( unsigned int i = 0; iter != pLuaArguments->IterEnd(); iter++, i++ )
|
||||
{
|
||||
mono_array_set( pArray, DWORD, i, (DWORD)( *iter )->GetLightUserData() );
|
||||
}
|
||||
|
||||
return pArray;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::Player::GetDeadPlayers( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CLuaArguments* pLuaArguments = CLuaFunctionDefinitions::GetDeadPlayers( RESOURCE->GetLua() );
|
||||
|
||||
if( pLuaArguments )
|
||||
{
|
||||
MonoArray* pArray = mono_array_new( RESOURCE->m_pMonoDomain, mono_get_uint32_class(), pLuaArguments->Count() );
|
||||
|
||||
vector< CLuaArgument* >::const_iterator iter = pLuaArguments->IterBegin();
|
||||
|
||||
for( unsigned int i = 0; iter != pLuaArguments->IterEnd(); iter++, i++ )
|
||||
{
|
||||
mono_array_set( pArray, DWORD, i, (DWORD)( *iter )->GetLightUserData() );
|
||||
}
|
||||
|
||||
return pArray;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Player::GetIdleTime( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiIdleTime;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerIdleTime( RESOURCE->GetLua(), (void*)pUserData, uiIdleTime ) )
|
||||
{
|
||||
return uiIdleTime;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::IsMapForced( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bForced;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPlayerMapForced( RESOURCE->GetLua(), (void*)pUserData, bForced ) )
|
||||
{
|
||||
return bForced;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Player::GetNametagText( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOutText;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerNametagText( RESOURCE->GetLua(), (void*)pUserData, strOutText ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutText );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Player::GetNametagColor( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucR, ucG, ucB;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerNametagColor( RESOURCE->GetLua(), (void*)pUserData, ucR, ucG, ucB ) )
|
||||
{
|
||||
void *args[] =
|
||||
{
|
||||
&ucR, &ucG, &ucB
|
||||
};
|
||||
|
||||
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "Color", args, 3 );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::IsNametagShowing( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bShowing;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsPlayerNametagShowing( RESOURCE->GetLua(), (void*)pUserData, bShowing ) )
|
||||
{
|
||||
return bShowing;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Player::GetSerial( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return RESOURCE->NewString( CLuaFunctionDefinitions::GetPlayerSerial( RESOURCE->GetLua(), (void*)pUserData ) );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Player::GetUserName( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return RESOURCE->NewString( CLuaFunctionDefinitions::GetPlayerUserName( RESOURCE->GetLua(), (void*)pUserData ) );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::Player::GetBlurLevel( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucBlurLevel;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerBlurLevel( RESOURCE->GetLua(), (void*)pUserData, ucBlurLevel ) )
|
||||
{
|
||||
return ucBlurLevel;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Player::GetName( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOutName;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerName( RESOURCE->GetLua(), (void*)pUserData, strOutName ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutName );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Player::GetIP( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strIP;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetPlayerIP( RESOURCE->GetLua(), (void*)pUserData, strIP ) )
|
||||
{
|
||||
return RESOURCE->NewString( strIP );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Player::GetAccount( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetPlayerAccount( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Player::GetVersion( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return RESOURCE->NewString( CLuaFunctionDefinitions::GetPlayerVersion( RESOURCE->GetLua(), (void*)pUserData ) );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Player::GetACInfo( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
LuaTable pLuaTable = CLuaFunctionDefinitions::GetPlayerACInfo( RESOURCE->GetLua(), (void*)pUserData );
|
||||
|
||||
if( !pLuaTable.empty() )
|
||||
{
|
||||
MonoString* msDetectedAC = RESOURCE->NewString( pLuaTable[ "DetectedAC" ]->GetString() );
|
||||
MonoString* msD3D9MD5 = RESOURCE->NewString( pLuaTable[ "d3d9MD5" ]->GetString() );
|
||||
MonoString* msD3D9SHA256 = RESOURCE->NewString( pLuaTable[ "d3d9SHA256" ]->GetString() );
|
||||
|
||||
unsigned int iD3D9Size = pLuaTable[ "d3d9Size" ]->GetNumber< unsigned int >();
|
||||
|
||||
void *args[] =
|
||||
{
|
||||
&msDetectedAC,
|
||||
&iD3D9Size,
|
||||
&msD3D9MD5,
|
||||
&msD3D9SHA256
|
||||
};
|
||||
|
||||
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "ServerVersion", args, 8 );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Player set functions
|
||||
bool CMonoFunctions::Player::SetMoney( DWORD pUserData, int iAmount, bool bInstant )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPlayerMoney( RESOURCE->GetLua(), (void*)pUserData, iAmount, bInstant );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::GiveMoney( DWORD pUserData, int iAmount )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GivePlayerMoney( RESOURCE->GetLua(), (void*)pUserData, iAmount );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::TakeMoney( DWORD pUserData, int iAmount )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::TakePlayerMoney( RESOURCE->GetLua(), (void*)pUserData, iAmount );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::Spawn( DWORD pUserData, MonoObject* pPosition, int iRotation, int iSkinID, int iInterior, int iDimension, DWORD pTeam )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pPosition( pPosition );
|
||||
|
||||
float fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
float fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
float fZ = pPosition.GetPropertyValue< float >( "Z" );
|
||||
|
||||
Vector3 vecPosition( fX, fY, fZ );
|
||||
|
||||
return CLuaFunctionDefinitions::SpawnPlayer( RESOURCE->GetLua(), (void*)pUserData, vecPosition, iRotation, iSkinID, iInterior, iDimension, (void*)pTeam );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::ShowHudComponent( DWORD pUserData, MonoString* msComponent, bool bShow )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strComponent( mono_string_to_utf8( msComponent ) );
|
||||
|
||||
return CLuaFunctionDefinitions::ShowPlayerHudComponent( RESOURCE->GetLua(), (void*)pUserData, strComponent, bShow );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetWantedLevel( DWORD pUserData, int iLevel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPlayerWantedLevel( RESOURCE->GetLua(), (void*)pUserData, iLevel );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::ForceMap( DWORD pUserData, bool bForceOn )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ForcePlayerMap( RESOURCE->GetLua(), (void*)pUserData, bForceOn );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetNametagText( DWORD pUserData, MonoString* sText )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPlayerNametagText( RESOURCE->GetLua(), (void*)pUserData, string( mono_string_to_utf8( sText ) ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetNametagColor( DWORD pUserData, int iRed, int iGreen, int iBlue )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPlayerNametagColor( RESOURCE->GetLua(), (void*)pUserData, iRed, iGreen, iBlue );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetNametagShowing( DWORD pUserData, bool bShowing )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPlayerNametagShowing( RESOURCE->GetLua(), (void*)pUserData, bShowing );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetMuted( DWORD pUserData, bool bMuted )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPlayerMuted( RESOURCE->GetLua(), (void*)pUserData, bMuted );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetBlurLevel( DWORD pUserData, int iLevel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPlayerBlurLevel( RESOURCE->GetLua(), (void*)pUserData, iLevel );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::Redirect( DWORD pUserData, MonoString* sServerIP, int iServerPort, MonoString* sServerPassword )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szServerIP = mono_string_to_utf8( sServerIP );
|
||||
const char* szServerPassword = mono_string_to_utf8( sServerPassword );
|
||||
|
||||
return CLuaFunctionDefinitions::RedirectPlayer( RESOURCE->GetLua(), (void*)pUserData, szServerIP, iServerPort, szServerPassword );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetName( DWORD pUserData, MonoString* sName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szName = mono_string_to_utf8( sName );
|
||||
|
||||
return CLuaFunctionDefinitions::SetPlayerName( RESOURCE->GetLua(), (void*)pUserData, szName );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::DetonateSatchels( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::DetonateSatchels( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::TakeScreenShot( DWORD pUserData, int iWidth, int iHeight, MonoString* sTag, int iQuality, int iMaxBandwith )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strTag( mono_string_to_utf8( sTag ) );
|
||||
|
||||
return CLuaFunctionDefinitions::TakePlayerScreenShot( RESOURCE->GetLua(), (void*)pUserData, iWidth, iHeight, strTag, iQuality, iMaxBandwith );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetTeam( DWORD pUserData, DWORD pTeam )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetPlayerTeam( RESOURCE->GetLua(), (void*)pUserData, (void*)pTeam );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Input funcs
|
||||
|
||||
bool CMonoFunctions::Player::BindKey( DWORD pUserData, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName, MonoString* msArguments )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szKey = mono_string_to_utf8( msKey );
|
||||
const char* szHitState = mono_string_to_utf8( msHitState );
|
||||
const char* szCommandName = mono_string_to_utf8( msCommandName );
|
||||
const char* szArguments = mono_string_to_utf8( msArguments );
|
||||
|
||||
return CLuaFunctionDefinitions::BindKey( RESOURCE->GetLua(), (void*)pUserData, szKey, szHitState, szCommandName, szArguments );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::UnbindKey( DWORD pUserData, MonoString* msKey, MonoString* msHitState, MonoString* msCommandName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szKey = mono_string_to_utf8( msKey );
|
||||
const char* szHitState = mono_string_to_utf8( msHitState );
|
||||
const char* szCommandName = mono_string_to_utf8( msCommandName );
|
||||
|
||||
return CLuaFunctionDefinitions::UnbindKey( RESOURCE->GetLua(), (void*)pUserData, szKey, szHitState, szCommandName );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::GetControlState( DWORD pUserData, MonoString* msControl )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szControl = mono_string_to_utf8( msControl );
|
||||
|
||||
bool bState;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetControlState( RESOURCE->GetLua(), (void*)pUserData, szControl, bState ) )
|
||||
{
|
||||
return bState;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::IsControlEnabled( DWORD pUserData, MonoString* msControl )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szControl = mono_string_to_utf8( msControl );
|
||||
|
||||
bool bEnabled;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsControlEnabled( RESOURCE->GetLua(), (void*)pUserData, szControl, bEnabled ) )
|
||||
{
|
||||
return bEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CMonoFunctions::Player::SetControlState( DWORD pUserData, MonoString* msControl, bool bState )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szControl = mono_string_to_utf8( msControl );
|
||||
|
||||
return CLuaFunctionDefinitions::SetControlState( RESOURCE->GetLua(), (void*)pUserData, szControl, bState );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::ToggleControl( DWORD pUserData, MonoString* msControl, bool bEnabled )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szControl = mono_string_to_utf8( msControl );
|
||||
|
||||
return CLuaFunctionDefinitions::ToggleControl( RESOURCE->GetLua(), (void*)pUserData, szControl, bEnabled );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::ToggleAllControls( DWORD pUserData, bool bGTAControls, bool bMTAControls, bool bEnabled )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ToggleAllControls( RESOURCE->GetLua(), (void*)pUserData, bGTAControls, bMTAControls, bEnabled );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Log in/out funcs
|
||||
bool CMonoFunctions::Player::LogIn( DWORD pPlayer, DWORD pAccount, MonoString* msPassword )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::LogIn( RESOURCE->GetLua(), (void*)pPlayer, (void*)pAccount, mono_string_to_utf8( msPassword ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::LogOut( DWORD pPlayer )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::LogOut( RESOURCE->GetLua(), (void*)pPlayer );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Admin funcs
|
||||
bool CMonoFunctions::Player::Kick( DWORD pPlayer, MonoString* msResponsible, MonoString* msReason )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string
|
||||
strResponsible( mono_string_to_utf8( msResponsible ) ),
|
||||
strReason( mono_string_to_utf8( msReason ) );
|
||||
|
||||
return CLuaFunctionDefinitions::KickPlayer( RESOURCE->GetLua(), (void*)pPlayer, strResponsible, strReason );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Player::Ban( DWORD pPlayer, bool bIP, bool bUsername, bool bSerial, DWORD pResponsible, MonoString* msResponsible, MonoString* msReason, int iUnban )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string
|
||||
strResponsible( mono_string_to_utf8( msResponsible ) ),
|
||||
strReason( mono_string_to_utf8( msReason ) );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::BanPlayer( RESOURCE->GetLua(), (void*)pPlayer, bIP, bUsername, bSerial, (void*)pResponsible, strResponsible, strReason, iUnban );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Cursor get funcs
|
||||
bool CMonoFunctions::Player::IsCursorShowing( DWORD pPlayer )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bShowing;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsCursorShowing( RESOURCE->GetLua(), (void*)pPlayer, bShowing ) )
|
||||
{
|
||||
return bShowing;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Cursor set funcs
|
||||
bool CMonoFunctions::Player::ShowCursor( DWORD pPlayer, bool bShow, bool bToggleControls )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ShowCursor( RESOURCE->GetLua(), (void*)pPlayer, bShow, bToggleControls );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Chat funcs
|
||||
bool CMonoFunctions::Player::ShowChat( DWORD pPlayer, bool bShow )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ShowChat( RESOURCE->GetLua(), (void*)pPlayer, bShow );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Camera get functions
|
||||
MonoObject* CMonoFunctions::Player::GetCameraMatrix( DWORD pPlayer )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition, vecLookAt;
|
||||
|
||||
float fRoll, fFOV;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetCameraMatrix( RESOURCE->GetLua(), (void*)pPlayer, vecPosition, vecLookAt, fRoll, fFOV ) )
|
||||
{
|
||||
void *args[] =
|
||||
{
|
||||
&vecPosition.fX,
|
||||
&vecPosition.fY,
|
||||
&vecPosition.fZ,
|
||||
&vecLookAt.fX,
|
||||
&vecLookAt.fY,
|
||||
&vecLookAt.fZ,
|
||||
&fRoll,
|
||||
&fFOV
|
||||
};
|
||||
|
||||
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "CameraMatrix", args, 8 );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Player::GetCameraTarget( DWORD pPlayer )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetCameraTarget( RESOURCE->GetLua(), (void*)pPlayer );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::Player::GetCameraInterior( DWORD pPlayer )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucInterior;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetCameraInterior( RESOURCE->GetLua(), (void*)pPlayer, ucInterior ) )
|
||||
{
|
||||
return ucInterior;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Camera set functions
|
||||
bool CMonoFunctions::Player::SetCameraMatrix( DWORD pPlayer, MonoObject* pCameraMatrix )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pCameraMatrix( pCameraMatrix );
|
||||
|
||||
float fX = pCameraMatrix.GetPropertyValue< float >( "X" );
|
||||
float fY = pCameraMatrix.GetPropertyValue< float >( "Y" );
|
||||
float fZ = pCameraMatrix.GetPropertyValue< float >( "Z" );
|
||||
|
||||
Vector3 vecPosition( fX, fY, fZ );
|
||||
|
||||
float fLookAtX = pCameraMatrix.GetPropertyValue< float >( "LookAtX" );
|
||||
float fLookAtY = pCameraMatrix.GetPropertyValue< float >( "LookAtY" );
|
||||
float fLookAtZ = pCameraMatrix.GetPropertyValue< float >( "LookAtZ" );
|
||||
|
||||
Vector3* vecLookAt = new Vector3( fLookAtX, fLookAtY, fLookAtZ );
|
||||
|
||||
float fRoll = pCameraMatrix.GetPropertyValue< float >( "Roll" );
|
||||
float fFOV = pCameraMatrix.GetPropertyValue< float >( "FOV" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetCameraMatrix( RESOURCE->GetLua(), (void*)pPlayer, vecPosition, vecLookAt, fRoll, fFOV );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetCameraTarget( DWORD pPlayer, DWORD pTarget )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetCameraTarget( RESOURCE->GetLua(), (void*)pPlayer, (void*)pTarget );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::SetCameraInterior( DWORD pPlayer, unsigned char ucInterior )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetCameraInterior( RESOURCE->GetLua(), (void*)pPlayer, ucInterior );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Player::FadeCamera( DWORD pPlayer, bool bFadeIn, float fFadeTime, MonoObject* pColor )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pColor( pColor );
|
||||
|
||||
unsigned char ucReed = pColor.GetPropertyValue< unsigned char >( "R" );
|
||||
unsigned char ucGreen = pColor.GetPropertyValue< unsigned char >( "G" );
|
||||
unsigned char ucBlue = pColor.GetPropertyValue< unsigned char >( "B" );
|
||||
|
||||
return CLuaFunctionDefinitions::FadeCamera( RESOURCE->GetLua(), (void*)pPlayer, bFadeIn, fFadeTime, ucReed, ucGreen, ucBlue );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
167
mta-mono/src/CMonoFunctions_RadarArea.cpp
Normal file
167
mta-mono/src/CMonoFunctions_RadarArea.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Radar area create/destroy funcs
|
||||
DWORD CMonoFunctions::RadarArea::Create( MonoObject* pPosition, MonoObject* pSize, MonoObject* color, DWORD pVisibleTo )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector2 vecPosition, vecSize;
|
||||
|
||||
CMonoObject pPosition( pPosition );
|
||||
|
||||
vecPosition.fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
vecPosition.fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
|
||||
CMonoObject pSize( pSize );
|
||||
|
||||
vecSize.fX = pSize.GetPropertyValue< float >( "X" );
|
||||
vecSize.fY = pSize.GetPropertyValue< float >( "Y" );
|
||||
|
||||
CMonoObject pMonoColor( color );
|
||||
|
||||
SColor pColor;
|
||||
|
||||
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
|
||||
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
|
||||
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
|
||||
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateRadarArea( RESOURCE->GetLua(), vecPosition, vecSize, pColor, (void*)pVisibleTo );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Radar area get funcs
|
||||
MonoObject* CMonoFunctions::RadarArea::GetSize( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector2 vecSize;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetRadarAreaSize( RESOURCE->GetLua(), (void*)pUserData, vecSize ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecSize );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::RadarArea::GetColor( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor outColor;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetRadarAreaColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( outColor );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::RadarArea::IsFlashing( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::IsRadarAreaFlashing( RESOURCE->GetLua(), (void*)pUserData );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::RadarArea::IsInside( DWORD pUserData, MonoObject* pPosition )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bInside;
|
||||
|
||||
CMonoObject pPosition( pPosition );
|
||||
|
||||
float fX = pPosition.GetPropertyValue< float >( "X" );
|
||||
float fY = pPosition.GetPropertyValue< float >( "Y" );
|
||||
|
||||
Vector2 vecPosition( fX, fY );
|
||||
|
||||
if( CLuaFunctionDefinitions::IsInsideRadarArea( RESOURCE->GetLua(), (void*)pUserData, vecPosition, bInside ) )
|
||||
{
|
||||
return bInside;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Radar area set funcs
|
||||
bool CMonoFunctions::RadarArea::SetSize( DWORD pUserData, MonoObject* pSize )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject pSize( pSize );
|
||||
|
||||
float fX = pSize.GetPropertyValue< float >( "X" );
|
||||
float fY = pSize.GetPropertyValue< float >( "Y" );
|
||||
|
||||
Vector2 vecPosition( fX, fY );
|
||||
|
||||
return CLuaFunctionDefinitions::SetRadarAreaSize( RESOURCE->GetLua(), (void*)pUserData, vecPosition );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::RadarArea::SetColor( DWORD pUserData, MonoObject* color )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pColor;
|
||||
|
||||
CMonoObject pObject( color );
|
||||
|
||||
pColor.R = pObject.GetPropertyValue< unsigned char >( "R" );
|
||||
pColor.G = pObject.GetPropertyValue< unsigned char >( "G" );
|
||||
pColor.B = pObject.GetPropertyValue< unsigned char >( "B" );
|
||||
pColor.A = pObject.GetPropertyValue< unsigned char >( "A" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetRadarAreaColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::RadarArea::SetFlashing( DWORD pUserData, bool bFlashing )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetRadarAreaFlashing( RESOURCE->GetLua(), (void*)pUserData, bFlashing );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
327
mta-mono/src/CMonoFunctions_Resource.cpp
Normal file
327
mta-mono/src/CMonoFunctions_Resource.cpp
Normal file
@ -0,0 +1,327 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Resource funcs
|
||||
DWORD CMonoFunctions::Resource::Create( MonoString* msResourceName, MonoString* msOrganizationalDir )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szResourceName = mono_string_to_utf8( msResourceName );
|
||||
const char* szOrganizationalDir = mono_string_to_utf8( msOrganizationalDir );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateResource( RESOURCE->GetLua(), szResourceName, szOrganizationalDir );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Resource::Copy( DWORD pResource, MonoString* msNewResourceName, MonoString* msOrganizationalDir )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szResourceName = mono_string_to_utf8( msNewResourceName );
|
||||
const char* szOrganizationalDir = mono_string_to_utf8( msOrganizationalDir );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CopyResource( RESOURCE->GetLua(), (void*)pResource, szResourceName, szOrganizationalDir );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Resource::GetRootElement( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetResourceRootElement( RESOURCE->GetLua(), (void*)pResource );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Resource::GetMapRootElement( MonoString* msMap )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szMap = mono_string_to_utf8( msMap );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::GetResourceMapRootElement( RESOURCE->GetLua(), szMap );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Resource::GetDynamicElementRoot( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetResourceDynamicElementRoot( RESOURCE->GetLua(), (void*)pResource );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::RemoveFile( MonoString* msFilename )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szFileName = mono_string_to_utf8( msFilename );
|
||||
|
||||
return CLuaFunctionDefinitions::RemoveResourceFile( RESOURCE->GetLua(), szFileName );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Resource::GetFromName( MonoString* msResourceName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szResourceName = mono_string_to_utf8( msResourceName );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::RemoveResourceFile( RESOURCE->GetLua(), szResourceName );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Resource::GetInfo( DWORD pResource, MonoString* msAttribute )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szAttribute = mono_string_to_utf8( msAttribute );
|
||||
|
||||
string strOutInfo;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetResourceInfo( RESOURCE->GetLua(), (void*)pResource, szAttribute, strOutInfo ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutInfo );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Resource::GetLastStartTime( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiTime;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetResourceLastStartTime( RESOURCE->GetLua(), (void*)pResource, uiTime ) )
|
||||
{
|
||||
return uiTime;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Resource::GetLoadFailureReason( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOutReason;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetResourceLoadFailureReason( RESOURCE->GetLua(), (void*)pResource, strOutReason ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutReason );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Resource::GetLoadTime( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiTime;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetResourceLoadTime( RESOURCE->GetLua(), (void*)pResource, uiTime ) )
|
||||
{
|
||||
return uiTime;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Resource::GetName( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOut;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetResourceName( RESOURCE->GetLua(), (void*)pResource, strOut ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOut );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::Resource::GetResources( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CLuaArguments* pLuaTable = CLuaFunctionDefinitions::GetResources( RESOURCE->GetLua() );
|
||||
|
||||
return RESOURCE->NewArray<DWORD, LUA_TLIGHTUSERDATA>( mono_get_uint32_class(), pLuaTable );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Resource::GetState( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOut;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetResourceState( RESOURCE->GetLua(), (void*)pResource, strOut ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOut );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Resource::GetCurrent( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return (DWORD)CLuaFunctionDefinitions::GetThisResource( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::Refresh( bool refreshAll )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::RefreshResources( RESOURCE->GetLua(), refreshAll );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::RemoveDefaultSetting( DWORD pResource, MonoString* msSettingName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szSettingName = mono_string_to_utf8( msSettingName );
|
||||
|
||||
return CLuaFunctionDefinitions::RemoveResourceDefaultSetting( RESOURCE->GetLua(), (void*)pResource, szSettingName );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::Start( DWORD pResource, bool persistent, bool startIncludedResources, bool loadServerConfigs, bool loadMaps, bool loadServerScripts, bool loadHTML, bool loadClientConfigs, bool loadClientScripts, bool loadFiles )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::StartResource( RESOURCE->GetLua(), (void*)pResource, persistent, startIncludedResources, loadServerConfigs, loadMaps, loadServerScripts, loadHTML, loadClientConfigs, loadClientScripts, loadFiles );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::Restart( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::RestartResource( RESOURCE->GetLua(), (void*)pResource );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::Stop( DWORD pResource )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::StopResource( RESOURCE->GetLua(), (void*)pResource );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::SetDefaultSetting( DWORD pResource, MonoString* msSettingName, MonoString* msSettingValue )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szSettingName = mono_string_to_utf8( msSettingName );
|
||||
const char* szSettingValue = mono_string_to_utf8( msSettingValue );
|
||||
|
||||
return CLuaFunctionDefinitions::SetResourceDefaultSetting( RESOURCE->GetLua(), (void*)pResource, szSettingName, szSettingValue );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::SetInfo( DWORD pResource, MonoString* msAttribute, MonoString* msValue )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szAttribute = mono_string_to_utf8( msAttribute );
|
||||
const char* szValue = mono_string_to_utf8( msValue );
|
||||
|
||||
return CLuaFunctionDefinitions::SetResourceInfo( RESOURCE->GetLua(), (void*)pResource, szAttribute, szValue );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::Rename( MonoString* msResourceName, MonoString* msNewResourceName, MonoString* msOrganizationalPath )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szResourceName = mono_string_to_utf8( msResourceName );
|
||||
const char* szNewResourceName = mono_string_to_utf8( msNewResourceName );
|
||||
const char* szOrganizationalPath = mono_string_to_utf8( msOrganizationalPath );
|
||||
|
||||
return CLuaFunctionDefinitions::RenameResource( RESOURCE->GetLua(), szResourceName, szNewResourceName, szOrganizationalPath );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::Delete( MonoString* msResourceName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szResourceName = mono_string_to_utf8( msResourceName );
|
||||
|
||||
return CLuaFunctionDefinitions::DeleteResource( RESOURCE->GetLua(), szResourceName );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Resource::UpdateACLRequest( DWORD pResource, MonoString* msRightName, bool bAccess, MonoString* msByWho )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szRightName = mono_string_to_utf8( msRightName );
|
||||
const char* szByWho = mono_string_to_utf8( msByWho );
|
||||
|
||||
return CLuaFunctionDefinitions::UpdateResourceACLRequest( RESOURCE->GetLua(), (void*)pResource, szRightName, bAccess, szByWho );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
100
mta-mono/src/CMonoFunctions_Shape.cpp
Normal file
100
mta-mono/src/CMonoFunctions_Shape.cpp
Normal file
@ -0,0 +1,100 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Shape create funcs
|
||||
DWORD CMonoFunctions::Shape::CreateCircle( MonoObject* pPosition, float fRadius )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector2 vecPosition = CMonoObject( pPosition ).GetVector2();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateColCircle( RESOURCE->GetLua(), vecPosition, fRadius );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Shape::CreateCuboid( MonoObject* pPosition, MonoObject* pSize )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
|
||||
Vector3 vecSize = CMonoObject( pSize ).GetVector3();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateColCuboid( RESOURCE->GetLua(), vecPosition, vecSize );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Shape::CreateSphere( MonoObject* pPosition, float fRadius )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateColSphere( RESOURCE->GetLua(), vecPosition, fRadius );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Shape::CreateRectangle( MonoObject* pPosition, MonoObject* pSize )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector2 vecPosition = CMonoObject( pPosition ).GetVector2();
|
||||
Vector2 vecSize = CMonoObject( pSize ).GetVector2();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateColRectangle( RESOURCE->GetLua(), vecPosition, vecSize );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Shape::CreatePolygon( MonoArray* pPointList )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
vector< Vector2 > vecPointList;
|
||||
|
||||
for( unsigned int i = 0; i < mono_array_length( pPointList ); i++ )
|
||||
{
|
||||
MonoObject* pObject = mono_array_get( pPointList, MonoObject*, i );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
Vector2 vecPosition = CMonoObject( pObject ).GetVector2();
|
||||
|
||||
vecPointList.push_back( vecPosition );
|
||||
}
|
||||
}
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateColPolygon( RESOURCE->GetLua(), vecPointList );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Shape::CreateTube( MonoObject* pPosition, float fRadius, float fHeight )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateColTube( RESOURCE->GetLua(), vecPosition, fRadius, fHeight );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
140
mta-mono/src/CMonoFunctions_Team.cpp
Normal file
140
mta-mono/src/CMonoFunctions_Team.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Team get funcs
|
||||
DWORD CMonoFunctions::Team::Create( MonoString* msTeamName, MonoObject* mColor )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szTeamName = mono_string_to_utf8( msTeamName );
|
||||
SColor pColor = CMonoObject( mColor ).GetColor();
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateTeam( RESOURCE->GetLua(), szTeamName, pColor.R, pColor.G, pColor.B );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DWORD CMonoFunctions::Team::GetFromName( MonoString* msTeamName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szTeamName = mono_string_to_utf8( msTeamName );
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::GetTeamFromName( RESOURCE->GetLua(), szTeamName );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::Team::GetName( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOutName;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetTeamName( RESOURCE->GetLua(), (void*)pUserData, strOutName ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutName );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Team::GetColor( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pColor;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetTeamColor( RESOURCE->GetLua(), (void*)pUserData, pColor.R, pColor.G, pColor.B ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( pColor );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int CMonoFunctions::Team::CountPlayers( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned int uiCount;
|
||||
|
||||
if( CLuaFunctionDefinitions::CountPlayersInTeam( RESOURCE->GetLua(), (void*)pUserData, uiCount ) )
|
||||
{
|
||||
return uiCount;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Team::GetFriendlyFire( DWORD pUserData )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bFriendlyFire;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetTeamFriendlyFire( RESOURCE->GetLua(), (void*)pUserData, bFriendlyFire ) )
|
||||
{
|
||||
return bFriendlyFire;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Team set funcs
|
||||
bool CMonoFunctions::Team::SetName( DWORD pUserData, MonoString* msTeamName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
const char* szTeamName = mono_string_to_utf8( msTeamName );
|
||||
|
||||
return CLuaFunctionDefinitions::SetTeamName( RESOURCE->GetLua(), (void*)pUserData, szTeamName );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Team::SetColor( DWORD pUserData, MonoObject* mColor )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pColor = CMonoObject( mColor ).GetColor();
|
||||
|
||||
return CLuaFunctionDefinitions::SetTeamColor( RESOURCE->GetLua(), (void*)pUserData, pColor.R, pColor.G, pColor.B );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Team::SetFriendlyFire( DWORD pUserData, bool bFriendlyFire )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetTeamFriendlyFire( RESOURCE->GetLua(), (void*)pUserData, bFriendlyFire );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
1213
mta-mono/src/CMonoFunctions_Vehicle.cpp
Normal file
1213
mta-mono/src/CMonoFunctions_Vehicle.cpp
Normal file
File diff suppressed because it is too large
Load Diff
137
mta-mono/src/CMonoFunctions_Water.cpp
Normal file
137
mta-mono/src/CMonoFunctions_Water.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// Water funcs
|
||||
DWORD CMonoFunctions::Water::Create( MonoObject* pV1, MonoObject* pV2, MonoObject* pV3, MonoObject* pV4, bool bShallow )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3* vec1 = &CMonoObject( pV1 ).GetVector3();
|
||||
Vector3* vec2 = &CMonoObject( pV2 ).GetVector3();
|
||||
Vector3* vec3 = &CMonoObject( pV3 ).GetVector3();
|
||||
Vector3* vec4 = pV4 ? &CMonoObject( pV4 ).GetVector3() : NULL;
|
||||
|
||||
return (DWORD)CLuaFunctionDefinitions::CreateWater( RESOURCE->GetLua(), vec1, vec2, vec3, vec4, bShallow );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Water::SetLevel( DWORD pUserData, float fLevel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetElementWaterLevel( RESOURCE->GetLua(), (void*)pUserData, fLevel );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Water::SetLevelAll( float fLevel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetAllElementWaterLevel( RESOURCE->GetLua(), fLevel );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Water::SetLevelWorld( float fLevel, bool bIncludeWorldNonSeaLevel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetWorldWaterLevel( RESOURCE->GetLua(), fLevel, bIncludeWorldNonSeaLevel );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Water::ResetLevelWorld( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetWorldWaterLevel( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Water::GetVertexPosition( DWORD pUserData, int iVertexIndex )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetWaterVertexPosition( RESOURCE->GetLua(), (void*)pUserData, iVertexIndex, vecPosition ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
|
||||
|
||||
return pObject ? pObject->GetObject() : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Water::SetVertexPosition( DWORD pUserData, int iVertexIndex, MonoObject* mPosition )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( mPosition ).GetVector3();
|
||||
|
||||
return CLuaFunctionDefinitions::SetWaterVertexPosition( RESOURCE->GetLua(), (void*)pUserData, iVertexIndex, vecPosition );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::Water::GetColor( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pColor;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetWaterColor( RESOURCE->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( pColor );
|
||||
|
||||
return pObject ? pObject->GetObject() : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Water::SetColor( MonoObject* mColor )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pColor = CMonoObject( mColor ).GetColor();
|
||||
|
||||
return CLuaFunctionDefinitions::SetWaterColor( RESOURCE->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::Water::ResetColor( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetWaterColor( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
904
mta-mono/src/CMonoFunctions_World.cpp
Normal file
904
mta-mono/src/CMonoFunctions_World.cpp
Normal file
@ -0,0 +1,904 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* Copyright © 2013, Innovation Roleplay Engine.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification,
|
||||
* is permitted only for authors.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
#include "CMonoFunctions.h"
|
||||
|
||||
// General world get funcs
|
||||
MonoArray* CMonoFunctions::World::GetTime( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucHour, ucMinute;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetTime( RESOURCE->GetLua(), ucHour, ucMinute ) )
|
||||
{
|
||||
MonoArray* pArray = mono_array_new( RESOURCE->m_pMonoDomain, mono_get_char_class(), 2 );
|
||||
|
||||
mono_array_set( pArray, unsigned char, 0, ucHour );
|
||||
mono_array_set( pArray, unsigned char, 1, ucMinute );
|
||||
|
||||
return pArray;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::World::GetWeather( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucWeather, ucWeatherBlending;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetWeather( RESOURCE->GetLua(), ucWeather, ucWeatherBlending ) )
|
||||
{
|
||||
MonoArray* pArray = mono_array_new( RESOURCE->m_pMonoDomain, mono_get_char_class(), 2 );
|
||||
|
||||
mono_array_set( pArray, unsigned char, 0, ucWeather );
|
||||
mono_array_set( pArray, unsigned char, 1, ucWeatherBlending );
|
||||
|
||||
return pArray;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoString* CMonoFunctions::World::GetZoneName( MonoObject* mPosition, bool bCitiesOnly )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strOutName;
|
||||
|
||||
Vector3 vecPosition = CMonoObject( mPosition ).GetVector3();
|
||||
|
||||
if( CLuaFunctionDefinitions::GetZoneName( RESOURCE->GetLua(), vecPosition, strOutName, bCitiesOnly ) )
|
||||
{
|
||||
return RESOURCE->NewString( strOutName );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetGravity( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fGravity;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetGravity( RESOURCE->GetLua(), fGravity ) )
|
||||
{
|
||||
return fGravity;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetGameSpeed( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fGameSpeed;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetGameSpeed( RESOURCE->GetLua(), fGameSpeed ) )
|
||||
{
|
||||
return fGameSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetWaveHeight( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fHeight;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetWaveHeight( RESOURCE->GetLua(), fHeight ) )
|
||||
{
|
||||
return fHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
unsigned short CMonoFunctions::World::GetFPSLimit( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned short usLimit;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetFPSLimit( RESOURCE->GetLua(), usLimit ) )
|
||||
{
|
||||
return usLimit;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long CMonoFunctions::World::GetMinuteDuration( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned long usDuration;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetMinuteDuration( RESOURCE->GetLua(), usDuration ) )
|
||||
{
|
||||
return usDuration;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::IsGarageOpen( unsigned char ucGarageID )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bIsOpen;
|
||||
|
||||
if( CLuaFunctionDefinitions::IsGarageOpen( RESOURCE->GetLua(), ucGarageID, bIsOpen ) )
|
||||
{
|
||||
return bIsOpen;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned char CMonoFunctions::World::GetTrafficLightState( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
unsigned char ucState;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetTrafficLightState( RESOURCE->GetLua(), ucState ) )
|
||||
{
|
||||
return ucState;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::GetTrafficLightsLocked( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bIsLocked;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetTrafficLightsLocked( RESOURCE->GetLua(), bIsLocked ) )
|
||||
{
|
||||
return bIsLocked;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetJetpackMaxHeight( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fHeight;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetJetpackMaxHeight( RESOURCE->GetLua(), fHeight ) )
|
||||
{
|
||||
return fHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetAircraftMaxVelocity( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fVelocity;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetAircraftMaxVelocity( RESOURCE->GetLua(), fVelocity ) )
|
||||
{
|
||||
return fVelocity;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::GetInteriorSoundsEnabled( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bEnabled;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetInteriorSoundsEnabled( RESOURCE->GetLua(), bEnabled ) )
|
||||
{
|
||||
return bEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetRainLevel( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fRainLevel;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetRainLevel( RESOURCE->GetLua(), fRainLevel ) )
|
||||
{
|
||||
return fRainLevel;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetSunSize( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fSunSize;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetSunSize( RESOURCE->GetLua(), fSunSize ) )
|
||||
{
|
||||
return fSunSize;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::World::GetSunColor( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pCore, pCorona;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetSunColor( RESOURCE->GetLua(), pCore.R, pCore.G, pCore.B, pCorona.R, pCorona.G, pCorona.B ) )
|
||||
{
|
||||
pCore.A = pCorona.A = 255;
|
||||
|
||||
CMonoObject* pCoreObject = RESOURCE->NewObject( pCore );
|
||||
CMonoObject* pCoronaObject = RESOURCE->NewObject( pCorona );
|
||||
|
||||
if( pCoreObject && pCoronaObject )
|
||||
{
|
||||
MonoArray* pMonoArray = mono_array_new( RESOURCE->m_pMonoDomain, pCoreObject->GetClass()->GetClass(), 2 );
|
||||
|
||||
mono_array_set( pMonoArray, MonoObject*, 0, pCoreObject->GetObject() );
|
||||
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject->GetObject() );
|
||||
|
||||
return pMonoArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::World::GetWindVelocity( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecVelocity;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetWindVelocity( RESOURCE->GetLua(), vecVelocity.fX, vecVelocity.fY, vecVelocity.fZ ) )
|
||||
{
|
||||
CMonoObject* pObject = RESOURCE->NewObject( vecVelocity );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetFarClipDistance( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fFarClip;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetFarClipDistance( RESOURCE->GetLua(), fFarClip ) )
|
||||
{
|
||||
return fFarClip;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetFogDistance( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fFogDist;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetFogDistance( RESOURCE->GetLua(), fFogDist ) )
|
||||
{
|
||||
return fFogDist;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float CMonoFunctions::World::GetAircraftMaxHeight( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
float fMaxHeight;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetAircraftMaxHeight( RESOURCE->GetLua(), fMaxHeight ) )
|
||||
{
|
||||
return fMaxHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::GetOcclusionsEnabled( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
bool bEnabled;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetOcclusionsEnabled( RESOURCE->GetLua(), bEnabled ) )
|
||||
{
|
||||
return bEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int CMonoFunctions::World::GetMoonSize( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
int iSize;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetMoonSize( RESOURCE->GetLua(), iSize ) )
|
||||
{
|
||||
return iSize;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MonoArray* CMonoFunctions::World::GetSkyGradient( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pCore, pCorona;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetSkyGradient( RESOURCE->GetLua(), pCore.R, pCore.G, pCore.B, pCorona.R, pCorona.G, pCorona.B ) )
|
||||
{
|
||||
pCore.A = pCorona.A = 255;
|
||||
|
||||
CMonoObject* pCoreObject = RESOURCE->NewObject( pCore );
|
||||
CMonoObject* pCoronaObject = RESOURCE->NewObject( pCorona );
|
||||
|
||||
if( pCoreObject && pCoronaObject )
|
||||
{
|
||||
MonoArray* pMonoArray = mono_array_new( RESOURCE->m_pMonoDomain, pCoreObject->GetClass()->GetClass(), 2 );
|
||||
|
||||
mono_array_set( pMonoArray, MonoObject*, 0, pCoreObject->GetObject() );
|
||||
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject->GetObject() );
|
||||
|
||||
return pMonoArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MonoObject* CMonoFunctions::World::GetHeatHaze( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SHeatHazeSettings heatHazeSettings;
|
||||
|
||||
if( CLuaFunctionDefinitions::GetHeatHaze( RESOURCE->GetLua(), heatHazeSettings ) )
|
||||
{
|
||||
void* args[] =
|
||||
{
|
||||
&heatHazeSettings
|
||||
};
|
||||
|
||||
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "HeatHazeSettings", args, 1 );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject->GetObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::GetJetpackWeaponEnabled( unsigned int uiWeaponType )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GetJetpackWeaponEnabled( RESOURCE->GetLua(), (eWeaponType)uiWeaponType );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::GetCloudsEnabled( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::GetCloudsEnabled( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// General world set funcs
|
||||
bool CMonoFunctions::World::SetTime( unsigned char ucHour, unsigned char ucMinute )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetTime( RESOURCE->GetLua(), ucHour, ucMinute );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetWeather( unsigned char ucWeather )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetWeather( RESOURCE->GetLua(), ucWeather );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetWeatherBlended( unsigned char ucWeather )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetWeatherBlended( RESOURCE->GetLua(), ucWeather );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetGravity( float fGravity )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetGravity( RESOURCE->GetLua(), fGravity );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetGameSpeed( float fSpeed )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetGameSpeed( RESOURCE->GetLua(), fSpeed );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetWaveHeight( float fHeight )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetWaveHeight( RESOURCE->GetLua(), fHeight );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetSkyGradient( MonoObject* pTopColor, MonoObject* pBottomColor )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pTop = CMonoObject( pTopColor ).GetColor();
|
||||
SColor pBottom = CMonoObject( pBottomColor ).GetColor();
|
||||
|
||||
return CLuaFunctionDefinitions::SetSkyGradient( RESOURCE->GetLua(), pTop.R, pTop.G, pTop.B, pBottom.R, pBottom.G, pBottom.B );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetSkyGradient( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetSkyGradient( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetHeatHaze( MonoObject* heatHazeSettings )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
CMonoObject* pObject = new CMonoObject( heatHazeSettings );
|
||||
|
||||
SHeatHazeSettings pHeatHazeSettings;
|
||||
|
||||
pHeatHazeSettings.ucIntensity = pObject->GetPropertyValue< unsigned char >( "ucIntensity" );
|
||||
pHeatHazeSettings.ucRandomShift = pObject->GetPropertyValue< unsigned char >( "ucRandomShift" );
|
||||
pHeatHazeSettings.usSpeedMin = pObject->GetPropertyValue< unsigned short >( "usSpeedMin" );
|
||||
pHeatHazeSettings.usSpeedMax = pObject->GetPropertyValue< unsigned short >( "usSpeedMax" );
|
||||
pHeatHazeSettings.sScanSizeX = pObject->GetPropertyValue< short >( "sScanSizeX" );
|
||||
pHeatHazeSettings.sScanSizeY = pObject->GetPropertyValue< short >( "sScanSizeY" );
|
||||
pHeatHazeSettings.usRenderSizeX = pObject->GetPropertyValue< unsigned short >( "usRenderSizeX" );
|
||||
pHeatHazeSettings.usRenderSizeY = pObject->GetPropertyValue< unsigned short >( "usRenderSizeY" );
|
||||
pHeatHazeSettings.bInsideBuilding = pObject->GetPropertyValue< bool >( "bInsideBuilding" );
|
||||
|
||||
return CLuaFunctionDefinitions::SetHeatHaze( RESOURCE->GetLua(), pHeatHazeSettings );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetHeatHaze( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetHeatHaze( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetFPSLimit( unsigned short usLimit, bool bSave )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetFPSLimit( RESOURCE->GetLua(), usLimit, bSave );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetMinuteDuration( unsigned long ulDuration )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetMinuteDuration( RESOURCE->GetLua(), ulDuration );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetGarageOpen( unsigned char ucGarageID, bool bIsOpen )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetGarageOpen( RESOURCE->GetLua(), ucGarageID, bIsOpen );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetGlitchEnabled( MonoString* msGlitchName, bool bEnabled )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strGlitchName( mono_string_to_utf8( msGlitchName ) );
|
||||
|
||||
return CLuaFunctionDefinitions::SetGlitchEnabled( RESOURCE->GetLua(), strGlitchName, bEnabled );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::IsGlitchEnabled( MonoString* msGlitchName )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
string strGlitchName( mono_string_to_utf8( msGlitchName ) );
|
||||
|
||||
return CLuaFunctionDefinitions::IsGlitchEnabled( RESOURCE->GetLua(), strGlitchName );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetJetpackWeaponEnabled( unsigned int uiWeaponType, bool bEnabled )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetJetpackWeaponEnabled( RESOURCE->GetLua(), (eWeaponType)uiWeaponType, bEnabled );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetCloudsEnabled( bool bEnabled )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetCloudsEnabled( RESOURCE->GetLua(), bEnabled );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetTrafficLightState( unsigned char ucState, bool bForced )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetTrafficLightState( RESOURCE->GetLua(), ucState, bForced );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetTrafficLightsLocked( bool bLocked )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetTrafficLightsLocked( RESOURCE->GetLua(), bLocked );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetJetpackMaxHeight( float fMaxHeight )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetJetpackMaxHeight( RESOURCE->GetLua(), fMaxHeight );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetInteriorSoundsEnabled( bool bEnable )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetInteriorSoundsEnabled( RESOURCE->GetLua(), bEnable );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetRainLevel( float fRainLevel )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetRainLevel( RESOURCE->GetLua(), fRainLevel );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetSunSize( float fSunSize )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetSunSize( RESOURCE->GetLua(), fSunSize );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetSunColor( MonoObject* pCoreColor, MonoObject* pCoronaColor )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
SColor pTop = CMonoObject( pCoreColor ).GetColor();
|
||||
SColor pBottom = CMonoObject( pCoronaColor ).GetColor();
|
||||
|
||||
return CLuaFunctionDefinitions::SetSunColor( RESOURCE->GetLua(), pTop.R, pTop.G, pTop.B, pBottom.R, pBottom.G, pBottom.B );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetWindVelocity( MonoObject* pVelocity )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecVelocity = CMonoObject( pVelocity ).GetVector3();
|
||||
|
||||
return CLuaFunctionDefinitions::SetWindVelocity( RESOURCE->GetLua(), vecVelocity.fX, vecVelocity.fY, vecVelocity.fZ );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetFarClipDistance( float fFarClip )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetFarClipDistance( RESOURCE->GetLua(), fFarClip );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetFogDistance( float fFogDist )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetFogDistance( RESOURCE->GetLua(), fFogDist );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetAircraftMaxHeight( float fMaxHeight )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetAircraftMaxHeight( RESOURCE->GetLua(), fMaxHeight );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetAircraftMaxVelocity( float fVelocity )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetAircraftMaxVelocity( RESOURCE->GetLua(), fVelocity );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetOcclusionsEnabled( bool bEnabled )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetOcclusionsEnabled( RESOURCE->GetLua(), bEnabled );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetRainLevel( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetRainLevel( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetSunSize( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetSunSize( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetSunColor( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetSunColor( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetWindVelocity( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetWindVelocity( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetFarClipDistance( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetFarClipDistance( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetFogDistance( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetFogDistance( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::RemoveWorldModel( unsigned short usModel, float fRadius, MonoObject* pPosition, char cInterior )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
|
||||
|
||||
return CLuaFunctionDefinitions::RemoveWorldModel( RESOURCE->GetLua(), usModel, fRadius, vecPosition, cInterior );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::RestoreWorldModel( unsigned short usModel, float fRadius, MonoObject* pPosition, char cInterior )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
|
||||
|
||||
return CLuaFunctionDefinitions::RestoreWorldModel( RESOURCE->GetLua(), usModel, fRadius, vecPosition, cInterior );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::RestoreAllWorldModels( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::RestoreAllWorldModels( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::SetMoonSize( int iMoonSize )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::SetMoonSize( RESOURCE->GetLua(), iMoonSize );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMonoFunctions::World::ResetMoonSize( void )
|
||||
{
|
||||
if( RESOURCE )
|
||||
{
|
||||
return CLuaFunctionDefinitions::ResetMoonSize( RESOURCE->GetLua() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
@ -1,3 +1,15 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* 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 "CMonoObject.h"
|
||||
|
||||
CMonoObject::CMonoObject( MonoObject* pMonoObject )
|
||||
|
@ -1,3 +1,15 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* 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
|
||||
@ -24,6 +36,35 @@ public:
|
||||
|
||||
MonoObject* GetPropertyValue( const char* szPropertyName );
|
||||
|
||||
Vector2 GetVector2()
|
||||
{
|
||||
float fX = this->GetPropertyValue< float >( "X" );
|
||||
float fY = this->GetPropertyValue< float >( "Y" );
|
||||
|
||||
return Vector2( fX, fY );
|
||||
}
|
||||
|
||||
Vector3 GetVector3()
|
||||
{
|
||||
float fX = this->GetPropertyValue< float >( "X" );
|
||||
float fY = this->GetPropertyValue< float >( "Y" );
|
||||
float fZ = this->GetPropertyValue< float >( "Z" );
|
||||
|
||||
return Vector3( fX, fY, fZ );
|
||||
}
|
||||
|
||||
SColor GetColor()
|
||||
{
|
||||
SColor pColor;
|
||||
|
||||
pColor.R = this->GetPropertyValue< unsigned char >( "R" );
|
||||
pColor.G = this->GetPropertyValue< unsigned char >( "G" );
|
||||
pColor.B = this->GetPropertyValue< unsigned char >( "B" );
|
||||
pColor.A = this->GetPropertyValue< unsigned char >( "A" );
|
||||
|
||||
return pColor;
|
||||
}
|
||||
|
||||
template <class T> T GetPropertyValue( char* szPropertyName )
|
||||
{
|
||||
return *( reinterpret_cast<T*>( mono_object_unbox( this->GetPropertyValue( szPropertyName ) ) ) );
|
||||
|
@ -160,9 +160,34 @@ CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName, Vector3& vecVector )
|
||||
CMonoObject* CResource::NewObject( SColor& pColor )
|
||||
{
|
||||
CMonoClass* pClass = this->GetClassFromName( szNamespace, szName );
|
||||
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Color" );
|
||||
|
||||
if( pClass )
|
||||
{
|
||||
CMonoObject* pObject = pClass->New( mono_domain_get(), pColor );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector2'\n", __FILE__, __LINE__ );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector2' not found\n", __FILE__, __LINE__ );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CMonoObject* CResource::NewObject( Vector2& vecVector )
|
||||
{
|
||||
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector2" );
|
||||
|
||||
if( pClass )
|
||||
{
|
||||
@ -174,12 +199,37 @@ CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of '%s::%s'\n", __FILE__, __LINE__, szNamespace, szName );
|
||||
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector2'\n", __FILE__, __LINE__ );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pModuleManager->ErrorPrintf( "%s:%d: class '%s::%s' not found\n", __FILE__, __LINE__, szNamespace, szName );
|
||||
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector2' not found\n", __FILE__, __LINE__ );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CMonoObject* CResource::NewObject( Vector3& vecVector )
|
||||
{
|
||||
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector3" );
|
||||
|
||||
if( pClass )
|
||||
{
|
||||
CMonoObject* pObject = pClass->New( mono_domain_get(), vecVector );
|
||||
|
||||
if( pObject )
|
||||
{
|
||||
return pObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector3'\n", __FILE__, __LINE__ );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector3' not found\n", __FILE__, __LINE__ );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -17,6 +17,7 @@ class CResource;
|
||||
|
||||
#include "Common.h"
|
||||
#include "CMonoClass.h"
|
||||
#include "extra/CLuaArguments.h"
|
||||
|
||||
class CResource
|
||||
{
|
||||
@ -45,7 +46,9 @@ public:
|
||||
CMonoClass* GetClassFromName( const char* szNamespace, const char* szName );
|
||||
|
||||
CMonoObject* NewObject( const char* szNamespace, const char* szName );
|
||||
CMonoObject* NewObject( const char* szNamespace, const char* szName, Vector3& vecVector );
|
||||
CMonoObject* NewObject( SColor& pColor );
|
||||
CMonoObject* NewObject( Vector2& vecVector );
|
||||
CMonoObject* NewObject( Vector3& vecVector );
|
||||
CMonoObject* NewObject( const char* szNamespace, const char* szName, void** args, int argc );
|
||||
|
||||
MonoString* NewString( const char* szText )
|
||||
@ -58,6 +61,42 @@ public:
|
||||
return mono_string_new( this->m_pMonoDomain, strText.c_str() );
|
||||
}
|
||||
|
||||
template <class T, int LuaType> MonoArray* NewArray( MonoClass* pMonoClass, CLuaArguments* pLuaArguments = NULL )
|
||||
{
|
||||
MonoArray* pArray = mono_array_new( this->m_pMonoDomain, pMonoClass, pLuaArguments ? pLuaArguments->Count() : 0 );
|
||||
|
||||
if( pLuaArguments )
|
||||
{
|
||||
vector< CLuaArgument* >::const_iterator iter = pLuaArguments->IterBegin();
|
||||
|
||||
for( unsigned int i = 0; iter != pLuaArguments->IterEnd(); iter++, i++ )
|
||||
{
|
||||
if( LuaType == LUA_TBOOLEAN )
|
||||
{
|
||||
mono_array_set( pArray, T, i, (T)( ( *iter )->GetBoolean() ) );
|
||||
}
|
||||
else if( LuaType == LUA_TLIGHTUSERDATA )
|
||||
{
|
||||
mono_array_set( pArray, T, i, (T)( ( *iter )->GetLightUserData() ) );
|
||||
}
|
||||
else if( LuaType == LUA_TNUMBER )
|
||||
{
|
||||
mono_array_set( pArray, T, i, ( *iter )->GetNumber< T >() );
|
||||
}
|
||||
else if( LuaType == LUA_TSTRING )
|
||||
{
|
||||
mono_array_set( pArray, T, i, (T)( ( *iter )->GetString() ) );
|
||||
}
|
||||
else if( LuaType == LUA_TUSERDATA )
|
||||
{
|
||||
mono_array_set( pArray, T, i, (T)( ( *iter )->GetLightUserData() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pArray;
|
||||
}
|
||||
|
||||
string GetName ( void ) { return this->m_sName; }
|
||||
lua_State *GetLua ( void ) { return this->m_pLuaVM; }
|
||||
};
|
||||
|
@ -31,6 +31,7 @@ extern "C"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <assert.h>
|
||||
|
@ -62,6 +62,7 @@ CLuaArgument::CLuaArgument ( void* pUserData )
|
||||
m_pLightUserData = pUserData;
|
||||
}
|
||||
|
||||
|
||||
CLuaArgument::CLuaArgument( lua_CFunction Function )
|
||||
{
|
||||
m_szString = NULL;
|
||||
@ -208,7 +209,7 @@ bool CLuaArgument::operator != ( const CLuaArgument& Argument )
|
||||
}
|
||||
|
||||
|
||||
void CLuaArgument::Read ( lua_State* luaVM, unsigned int uiArgument )
|
||||
void CLuaArgument::Read ( lua_State* luaVM, signed int uiArgument )
|
||||
{
|
||||
// Eventually delete our previous string
|
||||
if ( m_szString )
|
||||
@ -219,6 +220,7 @@ void CLuaArgument::Read ( lua_State* luaVM, unsigned int uiArgument )
|
||||
|
||||
// Grab the argument type
|
||||
m_iType = lua_type ( luaVM, uiArgument );
|
||||
|
||||
if ( m_iType != LUA_TNONE )
|
||||
{
|
||||
// Read out the content depending on the type
|
||||
@ -264,6 +266,34 @@ void CLuaArgument::Read ( lua_State* luaVM, unsigned int uiArgument )
|
||||
break;
|
||||
}
|
||||
|
||||
case LUA_TTABLE:
|
||||
{
|
||||
m_pTable.clear();
|
||||
|
||||
m_pArray = new CLuaArguments();
|
||||
|
||||
lua_pushnil( luaVM );
|
||||
|
||||
uiArgument--;
|
||||
|
||||
while( lua_next( luaVM, uiArgument ) != 0 )
|
||||
{
|
||||
CLuaArgument pKey( luaVM, -2 );
|
||||
CLuaArgument pValue( luaVM, -1 );
|
||||
|
||||
if( pKey.GetType() == LUA_TSTRING )
|
||||
{
|
||||
m_pTable[ string( pKey.GetString() ) ] = &pValue;
|
||||
}
|
||||
|
||||
m_pArray->PushArgument( pValue );
|
||||
|
||||
lua_pop( luaVM, 1 );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
m_iType = LUA_TNONE;
|
||||
|
@ -16,6 +16,8 @@
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
class CLuaArgument;
|
||||
|
||||
#ifndef __CLUAARGUMENT_H
|
||||
#define __CLUAARGUMENT_H
|
||||
|
||||
@ -24,6 +26,12 @@ extern "C"
|
||||
#include <lua.h>
|
||||
}
|
||||
|
||||
#include "CLuaArguments.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
typedef std::map<std::string, CLuaArgument*> LuaTable;
|
||||
|
||||
class CLuaArgument
|
||||
{
|
||||
public:
|
||||
@ -41,15 +49,17 @@ public:
|
||||
bool operator == ( const CLuaArgument& Argument );
|
||||
bool operator != ( const CLuaArgument& Argument );
|
||||
|
||||
void Read ( lua_State* luaVM, unsigned int uiArgument );
|
||||
void Read ( lua_State* luaVM, signed int uiArgument );
|
||||
void Push ( lua_State* luaVM ) const;
|
||||
|
||||
inline int GetType ( void ) const { return m_iType; };
|
||||
|
||||
inline bool GetBoolean ( void ) const { return m_bBoolean; };
|
||||
inline lua_Number GetNumber ( void ) const { return m_Number; };
|
||||
inline const char* GetString ( void ) const { return m_szString; };
|
||||
inline void* GetLightUserData ( void ) const { return m_pLightUserData; };
|
||||
inline bool GetBoolean ( void ) const { return m_bBoolean; };
|
||||
inline lua_Number GetNumber ( void ) const { return m_Number; };
|
||||
inline const char* GetString ( void ) const { return m_szString; };
|
||||
inline void* GetLightUserData ( void ) const { return m_pLightUserData; };
|
||||
inline CLuaArguments* GetArray ( void ) const { return m_pArray; };
|
||||
inline LuaTable GetTable ( void ) const { return m_pTable; };
|
||||
|
||||
template <class T> T GetNumber()
|
||||
{
|
||||
@ -57,12 +67,14 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
int m_iType;
|
||||
bool m_bBoolean;
|
||||
lua_Number m_Number;
|
||||
char* m_szString;
|
||||
void* m_pLightUserData;
|
||||
lua_CFunction m_Function;
|
||||
int m_iType;
|
||||
bool m_bBoolean;
|
||||
lua_Number m_Number;
|
||||
char* m_szString;
|
||||
void* m_pLightUserData;
|
||||
lua_CFunction m_Function;
|
||||
CLuaArguments* m_pArray;
|
||||
LuaTable m_pTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,6 +16,8 @@
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
class CLuaArguments;
|
||||
|
||||
#ifndef __CLUAARGUMENTS_H
|
||||
#define __CLUAARGUMENTS_H
|
||||
|
||||
@ -24,8 +26,8 @@ extern "C"
|
||||
#include <lua.h>
|
||||
}
|
||||
|
||||
#include "CLuaArgument.h"
|
||||
#include <vector>
|
||||
#include "CLuaArgument.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -225,6 +225,27 @@ void* CLuaFunctionDefinitions::CloneElement( lua_State* pLuaVM, void* pUserData,
|
||||
|
||||
// Element get funcs
|
||||
|
||||
CLuaArguments* CLuaFunctionDefinitions::GetElementsByType( lua_State* pLuaVM, const char* szTypeName, void* pUserData )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushString( szTypeName );
|
||||
|
||||
if( pUserData )
|
||||
{
|
||||
pLuaArguments.PushUserData( pUserData );
|
||||
}
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getElementsByType", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetArray();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::IsElement( lua_State* pLuaVM, void* pUserData )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
@ -251,7 +272,10 @@ string CLuaFunctionDefinitions::GetElementType( lua_State* pLuaVM, void* pUserDa
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return string( pLuaArgument.GetString() );
|
||||
if( pLuaArgument.GetString() )
|
||||
{
|
||||
return string( pLuaArgument.GetString() );
|
||||
}
|
||||
}
|
||||
|
||||
return string();
|
||||
@ -1307,28 +1331,28 @@ bool CLuaFunctionDefinitions::GetPlayerWantedLevel( lua_State* pLuaVM, void* pUs
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetAlivePlayers( lua_State* pLuaVM )
|
||||
CLuaArguments* CLuaFunctionDefinitions::GetAlivePlayers( lua_State* pLuaVM )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getAlivePlayers", 1 ) )
|
||||
{
|
||||
// CLuaArgument( pLuaVM, -1 ).GetNumber();
|
||||
return CLuaArgument( pLuaVM, -1 ).GetArray();
|
||||
}
|
||||
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetDeadPlayers( lua_State* pLuaVM )
|
||||
CLuaArguments* CLuaFunctionDefinitions::GetDeadPlayers( lua_State* pLuaVM )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getDeadPlayers", 1 ) )
|
||||
{
|
||||
// CLuaArgument( pLuaVM, -1 ).GetNumber();
|
||||
return CLuaArgument( pLuaVM, -1 ).GetArray();
|
||||
}
|
||||
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetPlayerIdleTime( lua_State* pLuaVM, void* pUserData, unsigned int& uiIdleTime )
|
||||
@ -1523,20 +1547,20 @@ string CLuaFunctionDefinitions::GetPlayerVersion( lua_State* pLuaVM, void* pUser
|
||||
return string();
|
||||
}
|
||||
|
||||
int CLuaFunctionDefinitions::GetPlayerACInfo( lua_State* pLuaVM, void* pUserData )
|
||||
LuaTable CLuaFunctionDefinitions::GetPlayerACInfo( lua_State* pLuaVM, void* pUserData )
|
||||
{
|
||||
map<string, CLuaArgument*> pLuaTable;
|
||||
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pUserData );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getPlayerACInfo", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
// TODO
|
||||
pLuaTable = CLuaArgument( pLuaVM, -1 ).GetTable();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return pLuaTable;
|
||||
}
|
||||
|
||||
// Player set functions
|
||||
@ -1760,14 +1784,14 @@ bool CLuaFunctionDefinitions::SetPlayerBlurLevel( lua_State* pLuaVM, void* pUser
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::RedirectPlayer( lua_State* pLuaVM, void* pUserData, string sServerIP, int iServerPort, string sServerPassword )
|
||||
bool CLuaFunctionDefinitions::RedirectPlayer( lua_State* pLuaVM, void* pUserData, const char* szServerIP, int iServerPort, const char* szServerPassword )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pUserData );
|
||||
pLuaArguments.PushString( sServerIP.c_str() );
|
||||
pLuaArguments.PushString( szServerIP );
|
||||
pLuaArguments.PushNumber( iServerPort );
|
||||
pLuaArguments.PushString( sServerPassword.c_str() );
|
||||
pLuaArguments.PushString( szServerPassword );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "redirectPlayer", 1 ) )
|
||||
{
|
||||
@ -2210,6 +2234,42 @@ bool CLuaFunctionDefinitions::IsPedInVehicle( lua_State* pLuaVM, void* pUserData
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetWeaponProperty( lua_State* pLuaVM, unsigned char ucWeaponID, const char* szWeaponSkill, const char* szProperty, short& uData )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushNumber( ucWeaponID );
|
||||
pLuaArguments.PushString( szWeaponSkill );
|
||||
pLuaArguments.PushString( szProperty );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getWeaponProperty", 1 ) )
|
||||
{
|
||||
uData = CLuaArgument( pLuaVM, -1 ).GetNumber< short >();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetOriginalWeaponProperty( lua_State* pLuaVM, unsigned char ucWeaponID, const char* szWeaponSkill, const char* szProperty, short& uData )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushNumber( ucWeaponID );
|
||||
pLuaArguments.PushString( szWeaponSkill );
|
||||
pLuaArguments.PushString( szProperty );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getOriginalWeaponProperty", 1 ) )
|
||||
{
|
||||
uData = CLuaArgument( pLuaVM, -1 ).GetNumber< short >();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ped set functions
|
||||
|
||||
bool CLuaFunctionDefinitions::SetPedArmor( lua_State* pLuaVM, void* pUserData, float fArmor )
|
||||
@ -2581,6 +2641,23 @@ bool CLuaFunctionDefinitions::ReloadPedWeapon( lua_State* pLuaVM, void* pUserDat
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::SetWeaponProperty( lua_State* pLuaVM, unsigned char ucWeaponID, const char* szWeaponSkill, const char* szProperty, short uData )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushNumber( ucWeaponID );
|
||||
pLuaArguments.PushString( szWeaponSkill );
|
||||
pLuaArguments.PushString( szProperty );
|
||||
pLuaArguments.PushNumber( uData );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "setWeaponProperty", 1 ) )
|
||||
{
|
||||
return CLuaArgument( pLuaVM, -1 ).GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Vehicle create/destroy functions
|
||||
|
||||
void* CLuaFunctionDefinitions::CreateVehicle( lua_State* pLuaVM, int model, float fX, float fY, float fZ, float fRX, float fRY, float fRZ, string numberplate, bool direction, int variant1, int variant2 )
|
||||
@ -2748,11 +2825,10 @@ bool CLuaFunctionDefinitions::GetVehicleName( lua_State* pLuaVM, void* pUserData
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetVehicleNameFromModel( lua_State* pLuaVM, void* pUserData, unsigned short usModel, string& strOutName )
|
||||
bool CLuaFunctionDefinitions::GetVehicleNameFromModel( lua_State* pLuaVM, unsigned short usModel, string& strOutName )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pUserData );
|
||||
pLuaArguments.PushNumber( usModel );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getVehicleNameFromModel", 1 ) )
|
||||
@ -2790,9 +2866,7 @@ CLuaArguments* CLuaFunctionDefinitions::GetVehicleOccupants( lua_State* pLuaVM,
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getVehicleOccupants", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
//return pLuaArgument.GetLightUserData();
|
||||
return CLuaArgument( pLuaVM, -1 ).GetArray();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -2881,20 +2955,18 @@ bool CLuaFunctionDefinitions::IsVehicleLocked( lua_State* pLuaVM, void* pUserDat
|
||||
return false;
|
||||
}
|
||||
|
||||
CLuaArguments* CLuaFunctionDefinitions::GetVehiclesOfType( lua_State* pLuaVM, void* pUserData )
|
||||
CLuaArguments* CLuaFunctionDefinitions::GetVehiclesOfType( lua_State* pLuaVM, unsigned int uiModel )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
CLuaArguments* pLuaArguments = new CLuaArguments();
|
||||
|
||||
pLuaArguments.PushUserData( pUserData );
|
||||
pLuaArguments->PushNumber( uiModel );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getVehiclesOfType", 1 ) )
|
||||
if( pLuaArguments->Call( pLuaVM, "getVehiclesOfType", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
//return pLuaArgument.GetBoolean();
|
||||
return CLuaArgument( pLuaVM, -1 ).GetArray();
|
||||
}
|
||||
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetVehicleUpgradeOnSlot( lua_State* pLuaVM, void* pUserData, unsigned char ucSlot, unsigned short& usUpgrade )
|
||||
@ -2922,9 +2994,7 @@ CLuaArguments* CLuaFunctionDefinitions::GetVehicleUpgrades( lua_State* pLuaVM, v
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getVehicleUpgrades", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
//return pLuaArgument.GetNumber();
|
||||
return CLuaArgument( pLuaVM, -1 ).GetArray();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -2970,9 +3040,7 @@ CLuaArguments* CLuaFunctionDefinitions::GetVehicleCompatibleUpgrades( lua_State*
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getVehicleCompatibleUpgrades", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
//return pLuaArgument.GetString();
|
||||
return CLuaArgument( pLuaVM, -1 ).GetArray();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -5692,7 +5760,7 @@ bool CLuaFunctionDefinitions::SetTeamFriendlyFire( lua_State* pLuaVM, void* pTea
|
||||
|
||||
// Water funcs
|
||||
|
||||
void* CLuaFunctionDefinitions::CreateWater( lua_State* pLuaVM, Vector3* pV1, Vector3* pV2, Vector3* pV3, Vector3* pV4 )
|
||||
void* CLuaFunctionDefinitions::CreateWater( lua_State* pLuaVM, Vector3* pV1, Vector3* pV2, Vector3* pV3, Vector3* pV4, bool bShallow )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
@ -5715,6 +5783,8 @@ void* CLuaFunctionDefinitions::CreateWater( lua_State* pLuaVM, Vector3* pV1, Vec
|
||||
pLuaArguments.PushNumber( pV4->fZ );
|
||||
}
|
||||
|
||||
pLuaArguments.PushBoolean( bShallow );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "createWater", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
@ -7184,7 +7254,7 @@ void* CLuaFunctionDefinitions::GetAccount( lua_State* pLuaVM, const char* szName
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetAccounts( lua_State* pLuaVM ) // TODO
|
||||
CLuaArguments* CLuaFunctionDefinitions::GetAccounts( lua_State* pLuaVM )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
@ -7192,7 +7262,7 @@ bool CLuaFunctionDefinitions::GetAccounts( lua_State* pLuaVM ) // TODO
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return true;
|
||||
return pLuaArgument.GetArray();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -7270,7 +7340,7 @@ bool CLuaFunctionDefinitions::GetAccountSerial( lua_State* pLuaVM, void* pAccoun
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetAccountsBySerial( lua_State* pLuaVM, const string& strSerial, std::vector<void*>& outAccounts )
|
||||
bool CLuaFunctionDefinitions::GetAccountsBySerial( lua_State* pLuaVM, const string& strSerial, vector<void*>& outAccounts )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -7783,6 +7853,60 @@ bool CLuaFunctionDefinitions::ResetMapInfo( lua_State* pLuaVM, void* pElement )
|
||||
|
||||
// Resource funcs
|
||||
|
||||
void* CLuaFunctionDefinitions::CreateResource( lua_State* pLuaVM, const char* szResourceName, const char* szOrganizationalDir )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushString( szResourceName );
|
||||
pLuaArguments.PushString( szOrganizationalDir );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "createResource", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetLightUserData();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* CLuaFunctionDefinitions::CopyResource( lua_State* pLuaVM, void* pResource, const char* szNewResourceName, const char* szOrganizationalDir )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushString( szNewResourceName );
|
||||
pLuaArguments.PushString( szOrganizationalDir );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "copyResource", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetLightUserData();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* CLuaFunctionDefinitions::GetResourceRootElement( lua_State* pLuaVM, void* pResource )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
if( pResource )
|
||||
{
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
}
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceRootElement", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetLightUserData();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* CLuaFunctionDefinitions::GetResourceMapRootElement( lua_State* pLuaVM, const char* szMap )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
@ -7799,8 +7923,22 @@ void* CLuaFunctionDefinitions::GetResourceMapRootElement( lua_State* pLuaVM, con
|
||||
return false;
|
||||
}
|
||||
|
||||
//CXMLNode* CLuaFunctionDefinitions::AddResourceMap( lua_State* pLuaVM, const string& strFilePath, const std::string& strMapName, int iDimension )
|
||||
//CXMLNode* CLuaFunctionDefinitions::AddResourceConfig( lua_State* pLuaVM, const string& strFilePath, const std::string& strConfigName, int iType )
|
||||
void* CLuaFunctionDefinitions::GetResourceDynamicElementRoot( lua_State* pLuaVM, void* pResource )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceDynamicElementRoot", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetLightUserData();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::RemoveResourceFile( lua_State* pLuaVM, const char* szFilename )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
@ -7817,8 +7955,404 @@ bool CLuaFunctionDefinitions::RemoveResourceFile( lua_State* pLuaVM, const char*
|
||||
return false;
|
||||
}
|
||||
|
||||
CLuaArguments* CLuaFunctionDefinitions::GetResourceExportedFunctions( lua_State* pLuaVM, void* pResource )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceExportedFunctions", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetArray();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* CLuaFunctionDefinitions::GetResourceFromName( lua_State* pLuaVM, const char* szResourceName )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushString( szResourceName );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceFromName", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetLightUserData();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetResourceInfo( lua_State* pLuaVM, void* pResource, const char* szAttribute, string& strInfo )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushString( szAttribute );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceInfo", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
strInfo = string( pLuaArgument.GetString() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetResourceLastStartTime( lua_State* pLuaVM, void* pResource, unsigned int& uiTime )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceLastStartTime", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
uiTime = pLuaArgument.GetNumber< unsigned int >();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetResourceLoadFailureReason( lua_State* pLuaVM, void* pResource, string& strReason )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceLoadFailureReason", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
strReason = string( pLuaArgument.GetString() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetResourceLoadTime( lua_State* pLuaVM, void* pResource, unsigned int& uiTime )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceLoadTime", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
uiTime = pLuaArgument.GetNumber< unsigned int >();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetResourceName( lua_State* pLuaVM, void* pResource, string& strName )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceName", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
strName = string( pLuaArgument.GetString() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CLuaArguments* CLuaFunctionDefinitions::GetResources( lua_State* pLuaVM )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResources", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetArray();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::GetResourceState( lua_State* pLuaVM, void* pResource, string& strState )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getResourceState", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
strState = string( pLuaArgument.GetString() );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void* CLuaFunctionDefinitions::GetThisResource( lua_State* pLuaVM )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "getThisResource", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetLightUserData();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::RefreshResources( lua_State* pLuaVM, bool refreshAll )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushBoolean( refreshAll );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "refreshResources", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::RemoveResourceDefaultSetting( lua_State* pLuaVM, void* pResource, const char* szSettingName )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushString( szSettingName );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "removeResourceDefaultSetting", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::StartResource( lua_State* pLuaVM, void* pResource, bool persistent, bool startIncludedResources, bool loadServerConfigs, bool loadMaps, bool loadServerScripts, bool loadHTML, bool loadClientConfigs, bool loadClientScripts, bool loadFiles )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushBoolean( persistent );
|
||||
pLuaArguments.PushBoolean( startIncludedResources );
|
||||
pLuaArguments.PushBoolean( loadServerConfigs );
|
||||
pLuaArguments.PushBoolean( loadMaps );
|
||||
pLuaArguments.PushBoolean( loadServerScripts );
|
||||
pLuaArguments.PushBoolean( loadHTML );
|
||||
pLuaArguments.PushBoolean( loadClientConfigs );
|
||||
pLuaArguments.PushBoolean( loadClientScripts );
|
||||
pLuaArguments.PushBoolean( loadFiles );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "startResource", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::RestartResource( lua_State* pLuaVM, void* pResource )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "restartResource", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::StopResource( lua_State* pLuaVM, void* pResource )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "stopResource", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::SetResourceDefaultSetting( lua_State* pLuaVM, void* pResource, const char* szSettingName, const char* szSettingValue )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushString( szSettingName );
|
||||
pLuaArguments.PushString( szSettingValue );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "setResourceDefaultSetting", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::SetResourceDefaultSetting( lua_State* pLuaVM, void* pResource, const char* szSettingName, int iSettingValue )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushString( szSettingName );
|
||||
pLuaArguments.PushNumber( iSettingValue );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "setResourceDefaultSetting", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::SetResourceDefaultSetting( lua_State* pLuaVM, void* pResource, const char* szSettingName, float fSettingValue )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushString( szSettingName );
|
||||
pLuaArguments.PushNumber( fSettingValue );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "setResourceDefaultSetting", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::SetResourceInfo( lua_State* pLuaVM, void* pResource, const char* szAttribute, const char* szValue )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushString( szAttribute );
|
||||
pLuaArguments.PushString( szValue );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "setResourceInfo", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::RenameResource( lua_State* pLuaVM, const char* szResourceName, const char* szNewResourceName, const char* szOrganizationalPath )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushString( szResourceName );
|
||||
pLuaArguments.PushString( szNewResourceName );
|
||||
pLuaArguments.PushString( szOrganizationalPath );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "renameResource", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::DeleteResource( lua_State* pLuaVM, const char* szResourceName )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushString( szResourceName );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "deleteResource", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLuaFunctionDefinitions::UpdateResourceACLRequest( lua_State* pLuaVM, void* pResource, const char* szRightName, bool bAccess, const char* szByWho )
|
||||
{
|
||||
CLuaArguments pLuaArguments;
|
||||
|
||||
pLuaArguments.PushUserData( pResource );
|
||||
pLuaArguments.PushString( szRightName );
|
||||
pLuaArguments.PushBoolean( bAccess );
|
||||
pLuaArguments.PushString( szByWho );
|
||||
|
||||
if( pLuaArguments.Call( pLuaVM, "updateResourceACLRequest", 1 ) )
|
||||
{
|
||||
CLuaArgument pLuaArgument( pLuaVM, -1 );
|
||||
|
||||
return pLuaArgument.GetBoolean();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Version funcs
|
||||
|
||||
LuaTable CLuaFunctionDefinitions::GetVersion( lua_State* pLuaVM )
|
||||
{
|
||||
LuaTable pLuaTable;
|
||||
|
||||
if( CLuaArguments().Call( pLuaVM, "getVersion", 1 ) )
|
||||
{
|
||||
pLuaTable = CLuaArgument( pLuaVM, -1 ).GetTable();
|
||||
}
|
||||
|
||||
return pLuaTable;
|
||||
}
|
||||
|
||||
// Camera get functions
|
||||
bool CLuaFunctionDefinitions::GetCameraMatrix( lua_State* pLuaVM, void* pPlayer, Vector3& vecPosition, Vector3& vecLookAt, float& fRoll, float& fFOV )
|
||||
{
|
||||
|
@ -18,6 +18,8 @@ class CLuaFunctionDefinitions;
|
||||
#include "../Common.h"
|
||||
#include "../extra/CLuaArguments.h"
|
||||
|
||||
extern ILuaModuleManager10 *g_pModuleManager;
|
||||
|
||||
class CLuaFunctionDefinitions
|
||||
{
|
||||
public:
|
||||
@ -59,6 +61,7 @@ public:
|
||||
static void* CloneElement ( lua_State* pLuaVM, void* pUserData, const Vector3& vecPosition, bool bCloneElement );
|
||||
|
||||
// Element get funcs
|
||||
static CLuaArguments* GetElementsByType ( lua_State* pLuaVM, const char* szTypeName, void* pUserData = NULL );
|
||||
static bool IsElement ( lua_State* pLuaVM, void* pUserData );
|
||||
static string GetElementType ( lua_State* pLuaVM, void* pUserData );
|
||||
static void* GetElementByID ( lua_State* pLuaVM, const char* szID, unsigned int uiIndex );
|
||||
@ -125,8 +128,8 @@ public:
|
||||
static bool IsPlayerMuted ( lua_State* pLuaVM, void* pUserData, bool& bMuted );
|
||||
static void* GetPlayerTeam ( lua_State* pLuaVM, void* pUserData );
|
||||
static bool GetPlayerWantedLevel ( lua_State* pLuaVM, void* pUserData, unsigned int& uiWantedLevel );
|
||||
static bool GetAlivePlayers ( lua_State* pLuaVM );
|
||||
static bool GetDeadPlayers ( lua_State* pLuaVM );
|
||||
static CLuaArguments* GetAlivePlayers ( lua_State* pLuaVM );
|
||||
static CLuaArguments* GetDeadPlayers ( lua_State* pLuaVM );
|
||||
static bool GetPlayerIdleTime ( lua_State* pLuaVM, void* pUserData, unsigned int& uiIdleTime );
|
||||
static bool IsPlayerMapForced ( lua_State* pLuaVM, void* pUserData, bool& bForced );
|
||||
static bool GetPlayerNametagText ( lua_State* pLuaVM, void* pUserData, string& strOutText );
|
||||
@ -139,7 +142,7 @@ public:
|
||||
static bool GetPlayerIP ( lua_State* pLuaVM, void* pUserData, string& strOutIP );
|
||||
static void* GetPlayerAccount ( lua_State* pLuaVM, void* pUserData );
|
||||
static string GetPlayerVersion ( lua_State* pLuaVM, void* pUserData );
|
||||
static int GetPlayerACInfo ( lua_State* pLuaVM, void* pUserData );
|
||||
static LuaTable GetPlayerACInfo ( lua_State* pLuaVM, void* pUserData );
|
||||
|
||||
// Player set functions
|
||||
static bool SetPlayerMoney ( lua_State* pLuaVM, void* pUserData, int iAmount, bool bInstant = false );
|
||||
@ -154,7 +157,7 @@ public:
|
||||
static bool SetPlayerNametagShowing ( lua_State* pLuaVM, void* pUserData, bool bShowing );
|
||||
static bool SetPlayerMuted ( lua_State* pLuaVM, void* pUserData, bool bMuted );
|
||||
static bool SetPlayerBlurLevel ( lua_State* pLuaVM, void* pUserData, int iLevel );
|
||||
static bool RedirectPlayer ( lua_State* pLuaVM, void* pUserData, string sServerIP, int iServerPort, string sServerPassword );
|
||||
static bool RedirectPlayer ( lua_State* pLuaVM, void* pUserData, const char* szServerIP, int iServerPort, const char* szServerPassword );
|
||||
static bool SetPlayerName ( lua_State* pLuaVM, void* pUserData, string sName );
|
||||
static bool DetonateSatchels ( lua_State* pLuaVM, void* pUserData );
|
||||
static bool TakePlayerScreenShot ( lua_State* pLuaVM, void* pUserData, int iWidth, int iHeight, string sTag = "", int iQuality = 30, int iMaxBandwith = 5000 );
|
||||
@ -183,8 +186,8 @@ public:
|
||||
static void* GetPedOccupiedVehicle ( lua_State* pLuaVM, void* pUserData );
|
||||
static bool GetPedOccupiedVehicleSeat ( lua_State* pLuaVM, void* pUserData, unsigned int& uiSeat );
|
||||
static bool IsPedInVehicle ( lua_State* pLuaVM, void* pUserData, bool & bIsInVehicle );
|
||||
// static bool GetWeaponProperty ( lua_State* pLuaVM, void* pUserData );
|
||||
// static bool GetOriginalWeaponProperty ( lua_State* pLuaVM, void* pUserData );
|
||||
static bool GetWeaponProperty ( lua_State* pLuaVM, unsigned char ucWeaponID, const char* szWeaponSkill, const char* szProperty, short& uData );
|
||||
static bool GetOriginalWeaponProperty ( lua_State* pLuaVM, unsigned char ucWeaponID, const char *szWeaponSkill, const char* szProperty, short& uData );
|
||||
|
||||
// Ped set functions
|
||||
static bool SetPedArmor ( lua_State* pLuaVM, void* pUserData, float fArmor );
|
||||
@ -208,7 +211,7 @@ public:
|
||||
static bool SetPedHeadless ( lua_State* pLuaVM, void* pUserData, bool bIsHeadless );
|
||||
static bool SetPedFrozen ( lua_State* pLuaVM, void* pUserData, bool bIsFrozen );
|
||||
static bool ReloadPedWeapon ( lua_State* pLuaVM, void* pUserData );
|
||||
// static bool SetWeaponProperty ( lua_State* pLuaVM, void* pUserData );
|
||||
static bool SetWeaponProperty ( lua_State* pLuaVM, unsigned char ucWeaponID, const char *szWeaponSkill, const char* szProperty, short uData );
|
||||
|
||||
// Weapon give/take functions
|
||||
// static int GiveWeapon ( lua_State* pLuaVM );
|
||||
@ -228,7 +231,7 @@ public:
|
||||
static bool GetVehicleLandingGearDown ( lua_State* pLuaVM, void* pUserData, bool& bGearDown );
|
||||
static bool GetVehicleMaxPassengers ( lua_State* pLuaVM, void* pUserData, unsigned char& ucMaxPassengers );
|
||||
static bool GetVehicleName ( lua_State* pLuaVM, void* pUserData, string& strOutName );
|
||||
static bool GetVehicleNameFromModel ( lua_State* pLuaVM, void* pUserData, unsigned short usModel, string& strOutName );
|
||||
static bool GetVehicleNameFromModel ( lua_State* pLuaVM, unsigned short usModel, string& strOutName );
|
||||
static void* GetVehicleOccupant ( lua_State* pLuaVM, void* pUserData, unsigned int uiSeat );
|
||||
static CLuaArguments* GetVehicleOccupants ( lua_State* pLuaVM, void* pUserData );
|
||||
static void* GetVehicleController ( lua_State* pLuaVM, void* pUserData );
|
||||
@ -236,7 +239,7 @@ public:
|
||||
static bool GetVehicleTurnVelocity ( lua_State* pLuaVM, void* pUserData, Vector3& vecTurnVelocity );
|
||||
static bool GetVehicleTurretPosition ( lua_State* pLuaVM, void* pUserData, Vector2& vecPosition );
|
||||
static bool IsVehicleLocked ( lua_State* pLuaVM, void* pUserData, bool& bLocked );
|
||||
static CLuaArguments* GetVehiclesOfType ( lua_State* pLuaVM, void* pUserData );
|
||||
static CLuaArguments* GetVehiclesOfType ( lua_State* pLuaVM, unsigned int uiModel );
|
||||
static bool GetVehicleUpgradeOnSlot ( lua_State* pLuaVM, void* pUserData, unsigned char ucSlot, unsigned short& usUpgrade );
|
||||
static CLuaArguments* GetVehicleUpgrades ( lua_State* pLuaVM, void* pUserData );
|
||||
static bool GetVehicleUpgradeSlotName ( lua_State* pLuaVM, unsigned char ucSlot, string& strOutName );
|
||||
@ -398,7 +401,7 @@ public:
|
||||
static void* CreateColPolygon ( lua_State* pLuaVM, const vector< Vector2 >& vecPointList );
|
||||
static void* CreateColTube ( lua_State* pLuaVM, const Vector3& vecPosition, float fRadius, float fHeight );
|
||||
|
||||
// Explosion funcs
|
||||
// Explosion funcs
|
||||
static bool CreateExplosion ( lua_State* pLuaVM, const Vector3& vecPosition, unsigned char ucType, void* pCreator = NULL );
|
||||
|
||||
// Fire funcs
|
||||
@ -442,7 +445,7 @@ public:
|
||||
static bool SetTeamFriendlyFire ( lua_State* pLuaVM, void* pTeam, bool bFriendlyFire );
|
||||
|
||||
// Water funcs
|
||||
static void* CreateWater ( lua_State* pLuaVM, Vector3* pV1, Vector3* pV2, Vector3* pV3, Vector3* pV4 );
|
||||
static void* CreateWater ( lua_State* pLuaVM, Vector3* pV1, Vector3* pV2, Vector3* pV3, Vector3* pV4, bool bShallow );
|
||||
static bool SetElementWaterLevel ( lua_State* pLuaVM, void* pWater, float fLevel );
|
||||
static bool SetAllElementWaterLevel ( lua_State* pLuaVM, float fLevel );
|
||||
static bool SetWorldWaterLevel ( lua_State* pLuaVM, float fLevel, bool bIncludeWorldNonSeaLevel );
|
||||
@ -542,7 +545,7 @@ public:
|
||||
|
||||
// Account get funcs
|
||||
static void* GetAccount ( lua_State* pLuaVM, const char* szName, const char* szPassword );
|
||||
static bool GetAccounts ( lua_State* pLuaVM );
|
||||
static CLuaArguments* GetAccounts ( lua_State* pLuaVM );
|
||||
static void* GetAccountPlayer ( lua_State* pLuaVM, void* pAccount );
|
||||
static bool IsGuestAccount ( lua_State* pLuaVM, void* pAccount, bool& bGuest );
|
||||
static CLuaArgument* GetAccountData ( lua_State* pLuaVM, void* pAccount, const char* szKey );
|
||||
@ -598,20 +601,43 @@ public:
|
||||
static bool ResetMapInfo ( lua_State* pLuaVM, void* pElement );
|
||||
|
||||
// Resource funcs
|
||||
static void* CreateResource ( lua_State* pLuaVM, const char* szResourceName, const char* szOrganizationalDir );
|
||||
static void* CopyResource ( lua_State* pLuaVM, void* pResource, const char* szNewResourceName, const char* szOrganizationalDir );
|
||||
static void* GetResourceRootElement ( lua_State* pLuaVM, void* pResource = NULL );
|
||||
static void* GetResourceMapRootElement ( lua_State* pLuaVM, const char* szMap );
|
||||
static void* GetResourceDynamicElementRoot ( lua_State* pLuaVM, void* pResource );
|
||||
// static CXMLNode* AddResourceMap ( lua_State* pLuaVM, const string& strFilePath, const std::string& strMapName, int iDimension );
|
||||
// static CXMLNode* AddResourceConfig ( lua_State* pLuaVM, const string& strFilePath, const std::string& strConfigName, int iType );
|
||||
static bool RemoveResourceFile ( lua_State* pLuaVM, const char* szFilename );
|
||||
// static CXMLNode AddResourceConfig ( lua_State* pLuaVM, const char* szFilePath, const char* szFileType = "server" );
|
||||
// static CXMLNode AddResourceMap ( lua_State* pLuaVM, const char* szFilePath, unsigned int uiDimension = 0 );
|
||||
// static CXMLNode GetResourceConfig ( lua_State* pLuaVM, const char* szFilePath );
|
||||
static CLuaArguments* GetResourceExportedFunctions ( lua_State* pLuaVM, void* pResource );
|
||||
static void* GetResourceFromName ( lua_State* pLuaVM, const char* szResourceName );
|
||||
static bool GetResourceInfo ( lua_State* pLuaVM, void* pResource, const char* szAttribute, string& strInfo );
|
||||
static bool GetResourceLastStartTime ( lua_State* pLuaVM, void* pResource, unsigned int& uiTime );
|
||||
static bool GetResourceLoadFailureReason ( lua_State* pLuaVM, void* pResource, string& strReason );
|
||||
static bool GetResourceLoadTime ( lua_State* pLuaVM, void* pResource, unsigned int& uiTime );
|
||||
static bool GetResourceName ( lua_State* pLuaVM, void* pResource, string& strName );
|
||||
static CLuaArguments* GetResources ( lua_State* pLuaVM );
|
||||
static bool GetResourceState ( lua_State* pLuaVM, void* pResource, string& strState );
|
||||
static void* GetThisResource ( lua_State* pLuaVM );
|
||||
static bool RefreshResources ( lua_State* pLuaVM, bool refreshAll = false );
|
||||
static bool RemoveResourceDefaultSetting ( lua_State* pLuaVM, void* pResource, const char* szSettingName );
|
||||
static bool StartResource ( lua_State* pLuaVM, void* 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 RestartResource ( lua_State* pLuaVM, void* pResource );
|
||||
static bool StopResource ( lua_State* pLuaVM, void* pResource );
|
||||
static bool SetResourceDefaultSetting ( lua_State* pLuaVM, void* pResource, const char* szSettingName, const char* szSettingValue );
|
||||
static bool SetResourceDefaultSetting ( lua_State* pLuaVM, void* pResource, const char* szSettingName, int iSettingValue );
|
||||
static bool SetResourceDefaultSetting ( lua_State* pLuaVM, void* pResource, const char* szSettingName, float fSettingValue );
|
||||
static bool SetResourceInfo ( lua_State* pLuaVM, void* pResource, const char* szAttribute, const char* szValue );
|
||||
static bool RenameResource ( lua_State* pLuaVM, const char* szResourceName, const char* szNewResourceName, const char* szOrganizationalPath );
|
||||
static bool DeleteResource ( lua_State* pLuaVM, const char* szResourceName );
|
||||
// static CLuaArguments* GetResourceACLRequests ( lua_State* pLuaVM, void* pResource );
|
||||
static bool UpdateResourceACLRequest ( lua_State* pLuaVM, void* pResource, const char* szRightName, bool bAccess, const char* szByWho = NULL );
|
||||
|
||||
// Version funcs
|
||||
// static unsigned long GetVersion ( lua_State* pLuaVM );
|
||||
// static const char* GetVersionString ( lua_State* pLuaVM );
|
||||
// static const char* GetVersionName ( lua_State* pLuaVM );
|
||||
// static string GetVersionBuildType ( lua_State* pLuaVM );
|
||||
// static unsigned long GetNetcodeVersion ( lua_State* pLuaVM );
|
||||
// static const char* GetOperatingSystemName ( lua_State* pLuaVM );
|
||||
// static const char* GetVersionBuildTag ( lua_State* pLuaVM );
|
||||
// static string GetVersionSortable ( lua_State* pLuaVM );
|
||||
static LuaTable GetVersion ( lua_State* pLuaVM );
|
||||
|
||||
// Camera get functions
|
||||
static bool GetCameraMatrix ( lua_State* pLuaVM, void* pPlayer, Vector3& vecPosition, Vector3& vecLookAt, float& fRoll, float& fFOV );
|
||||
@ -619,16 +645,16 @@ public:
|
||||
static bool GetCameraInterior ( lua_State* pLuaVM, void* pPlayer, unsigned char & ucInterior );
|
||||
|
||||
// Camera set functions
|
||||
static bool SetCameraMatrix ( lua_State* pLuaVM, void* pElement, const Vector3& vecPosition, Vector3* pvecLookAt, float fRoll, float fFOV );
|
||||
static bool SetCameraTarget ( lua_State* pLuaVM, void* pElement, void* pTarget );
|
||||
static bool SetCameraInterior ( lua_State* pLuaVM, void* pElement, unsigned char ucInterior );
|
||||
static bool FadeCamera ( lua_State* pLuaVM, void* pElement, bool bFadeIn, float fFadeTime, unsigned char ucRed, unsigned char ucGreen, unsigned char ucBlue );
|
||||
static bool SetCameraMatrix ( lua_State* pLuaVM, void* pPlayer, const Vector3& vecPosition, Vector3* pvecLookAt, float fRoll, float fFOV );
|
||||
static bool SetCameraTarget ( lua_State* pLuaVM, void* pPlayer, void* pTarget );
|
||||
static bool SetCameraInterior ( lua_State* pLuaVM, void* pPlayer, unsigned char ucInterior );
|
||||
static bool FadeCamera ( lua_State* pLuaVM, void* pPlayer, bool bFadeIn, float fFadeTime, unsigned char ucRed, unsigned char ucGreen, unsigned char ucBlue );
|
||||
|
||||
// Weapon give/take functions
|
||||
static bool GiveWeapon ( lua_State* pLuaVM, void* pElement, unsigned char ucWeaponID, unsigned short usAmmo, bool bSetAsCurrent = false );
|
||||
static bool TakeWeapon ( lua_State* pLuaVM, void* pElement, unsigned char ucWeaponID, unsigned short usAmmo = 9999 );
|
||||
static bool TakeAllWeapons ( lua_State* pLuaVM, void* pElement );
|
||||
static bool SetWeaponAmmo ( lua_State* pLuaVM, void* pElement, unsigned char ucWeaponID, unsigned short usAmmo, unsigned short usAmmoInClip );
|
||||
static bool GiveWeapon ( lua_State* pLuaVM, void* pPed, unsigned char ucWeaponID, unsigned short usAmmo, bool bSetAsCurrent = false );
|
||||
static bool TakeWeapon ( lua_State* pLuaVM, void* pPed, unsigned char ucWeaponID, unsigned short usAmmo = 9999 );
|
||||
static bool TakeAllWeapons ( lua_State* pLuaVM, void* pPed );
|
||||
static bool SetWeaponAmmo ( lua_State* pLuaVM, void* pPed, unsigned char ucWeaponID, unsigned short usAmmo, unsigned short usAmmoInClip );
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user