-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathAlt.cs
216 lines (162 loc) · 10.2 KB
/
Alt.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using AltV.Net.Data;
using AltV.Net.Elements.Entities;
using AltV.Net.Elements.Pools;
using AltV.Net.Shared;
using AltV.Net.Shared.Elements.Data;
[assembly: InternalsVisibleTo("AltV.Net")]
[assembly: InternalsVisibleTo("AltV.Net.Mock")]
[assembly: InternalsVisibleTo("AltV.Net.Mock2")]
[assembly: InternalsVisibleTo("AltV.Net.Async")]
namespace AltV.Net
{
public static partial class Alt
{
public static ICore Core => CoreImpl;
internal static Core CoreImpl;
public static bool CacheEntities { get => AltShared.CacheEntities; set => AltShared.CacheEntities = value; }
public static bool ThrowIfEntityDoesNotExist = false;
public static bool IsDebug => Core.IsDebug;
public static void Emit(string eventName, params object[] args) => Core.TriggerLocalEvent(eventName, args);
public static void EmitAllClients(string eventName, params object[] args) =>
Core.TriggerClientEventForAll(eventName, args);
public static void EmitClients(IPlayer[] clients, string eventName, params object[] args) =>
Core.TriggerClientEventForSome(clients, eventName, args);
public static void EmitEventUnreliableAllClients(string eventName, params object[] args) =>
Core.TriggerClientEventUnreliableForAll(eventName, args);
public static void EmitUnreliableClients(IPlayer[] clients, string eventName, params object[] args) =>
Core.TriggerClientEventUnreliableForSome(clients, eventName, args);
public static IEnumerable<string> GetRegisteredClientEvents() => Core.GetRegisteredClientEvents();
public static IEnumerable<string> GetRegisteredServerEvents() => Core.GetRegisteredServerEvents();
public static void Log(string message) => Core.LogInfo(message);
public static IReadOnlyCollection<IPlayer> GetAllPlayers() => Core.PoolManager.Player.GetAllEntities();
public static IReadOnlyCollection<IVehicle> GetAllVehicles() =>Core.PoolManager.Vehicle.GetAllEntities();
public static IReadOnlyCollection<IPed> GetAllPeds() =>Core.PoolManager.Ped.GetAllEntities();
public static IReadOnlyCollection<IBlip> GetAllBlips() =>Core.PoolManager.Blip.GetAllObjects();
public static IReadOnlyCollection<IObject> GetAllNetworkObjects() =>Core.PoolManager.Object.GetAllEntities();
public static IReadOnlyCollection<ICheckpoint> GetAllCheckpoints() =>Core.PoolManager.Checkpoint.GetAllObjects();
public static IReadOnlyCollection<IVoiceChannel> GetAllVoiceChannels() =>Core.PoolManager.VoiceChannel.GetAllObjects();
public static IReadOnlyCollection<IColShape> GetAllColShapes() =>Core.PoolManager.ColShape.GetAllObjects();
public static IReadOnlyCollection<IMarker> GetAllMarkers() =>Core.PoolManager.Marker.GetAllObjects();
public static IReadOnlyCollection<IConnectionInfo> GetAllConnectionInfos() => Core.PoolManager.ConnectionInfo.GetAllObjects();
public static IReadOnlyCollection<IVirtualEntity> GetAllVirtualEntities() => Core.PoolManager.VirtualEntity.GetAllObjects();
public static IReadOnlyCollection<IVirtualEntityGroup> GetAllVirtualEntityGroups() => Core.PoolManager.VirtualEntityGroup.GetAllObjects();
public static KeyValuePair<IntPtr, IPlayer>[] GetPlayersArray() => Core.PoolManager.Player.GetEntitiesArray();
public static KeyValuePair<IntPtr, IVehicle>[] GetVehiclesArray() => Core.PoolManager.Vehicle.GetEntitiesArray();
public static KeyValuePair<IntPtr, IPed>[] GetPedsArray() => Core.PoolManager.Ped.GetEntitiesArray();
public static KeyValuePair<IntPtr, IBlip>[] GetBlipsArray() => Core.PoolManager.Blip.GetObjectsArray();
public static KeyValuePair<IntPtr, ICheckpoint>[] GetCheckpointsArray() => Core.PoolManager.Checkpoint.GetObjectsArray();
public static KeyValuePair<IntPtr, IVoiceChannel>[] GetVoiceChannelsArray() => Core.PoolManager.VoiceChannel.GetObjectsArray();
public static KeyValuePair<IntPtr, IColShape>[] GetColShapesArray() => Core.PoolManager.ColShape.GetObjectsArray();
public static KeyValuePair<IntPtr, IConnectionInfo>[] GetConnectionInfoArray() => Core.PoolManager.ConnectionInfo.GetObjectsArray();
public static void ForEachPlayers(IBaseObjectCallback<IPlayer> baseObjectCallback) =>
Core.PoolManager.Player.ForEach(baseObjectCallback);
public static Task ForEachPlayers(IAsyncBaseObjectCallback<IPlayer> baseObjectCallback) =>
Core.PoolManager.Player.ForEach(baseObjectCallback);
public static void ForEachVehicles(IBaseObjectCallback<IVehicle> baseObjectCallback) =>
Core.PoolManager.Vehicle.ForEach(baseObjectCallback);
public static Task ForEachVehicles(IAsyncBaseObjectCallback<IVehicle> baseObjectCallback) =>
Core.PoolManager.Vehicle.ForEach(baseObjectCallback);
public static void ForEachPeds(IBaseObjectCallback<IPed> baseObjectCallback) =>
Core.PoolManager.Ped.ForEach(baseObjectCallback);
public static Task ForEachPeds(IAsyncBaseObjectCallback<IPed> baseObjectCallback) =>
Core.PoolManager.Ped.ForEach(baseObjectCallback);
public static void ForEachBlips(IBaseObjectCallback<IBlip> baseObjectCallback) =>
Core.PoolManager.Blip.ForEach(baseObjectCallback);
public static Task ForEachBlips(IAsyncBaseObjectCallback<IBlip> baseObjectCallback) =>
Core.PoolManager.Blip.ForEach(baseObjectCallback);
public static void ForEachCheckpoints(IBaseObjectCallback<ICheckpoint> baseObjectCallback) =>
Core.PoolManager.Checkpoint.ForEach(baseObjectCallback);
public static Task ForEachCheckpoints(IAsyncBaseObjectCallback<ICheckpoint> baseObjectCallback) =>
Core.PoolManager.Checkpoint.ForEach(baseObjectCallback);
public static void ForEachVoiceChannels(IBaseObjectCallback<IVoiceChannel> baseObjectCallback) =>
Core.PoolManager.VoiceChannel.ForEach(baseObjectCallback);
public static Task ForEachVoiceChannels(IAsyncBaseObjectCallback<IVoiceChannel> baseObjectCallback) =>
Core.PoolManager.VoiceChannel.ForEach(baseObjectCallback);
public static void ForEachColShapes(IBaseObjectCallback<IColShape> baseObjectCallback) =>
Core.PoolManager.ColShape.ForEach(baseObjectCallback);
public static Task ForEachColShapes(IAsyncBaseObjectCallback<IColShape> baseObjectCallback) =>
Core.PoolManager.ColShape.ForEach(baseObjectCallback);
public static VehicleModelInfo GetVehicleModelInfo(uint hash) => Core.GetVehicleModelInfo(hash);
public static VehicleModelInfo GetVehicleModelInfo(string name) => Core.GetVehicleModelInfo(Hash(name));
public static PedModelInfo? GetPedModelInfo(uint hash) => Core.GetPedModelInfo(hash);
public static PedModelInfo? GetPedModelInfo(string name) => Core.GetPedModelInfo(Hash(name));
public static uint Hash(string stringToHash) => Core.Hash(stringToHash);
public static ulong HashPassword(string password) => Core.HashPassword(password);
public static bool FileExists(string path) => Core.FileExists(path);
public static string ReadFile(string path) => Core.FileRead(path);
public static byte[] ReadFileBinary(string path) => Core.FileReadBinary(path);
public static IConfig GetServerConfig() => Core.GetServerConfig();
public static IBaseObject GetBaseObjectById(BaseObjectType type, uint id) => Core.GetBaseObjectById(type, id);
public static IMetric RegisterMetric(string name, MetricType type = MetricType.MetricTypeGauge, Dictionary<string, string> dataDict = default) => Core.RegisterMetric(name, type, dataDict);
public static void UnregisterMetric(IMetric metric) => Core.UnregisterMetric(metric);
public static IReadOnlyCollection<IMetric> GetAllMetrics() => Core.GetAllMetrics();
public static VoiceConnectionState GetVoiceConnectionState() => Core.GetVoiceConnectionState();
public static int NetTime => Core.NetTime;
public static void AddClientConfigKey(string key) => Core.AddClientConfigKey(key);
public static ushort MaxStreamingPeds
{
get => Core.MaxStreamingPeds;
set => Core.MaxStreamingPeds = value;
}
public static ushort MaxStreamingObjects
{
get => Core.MaxStreamingObjects;
set => Core.MaxStreamingObjects = value;
}
public static ushort MaxStreamingVehicles
{
get => Core.MaxStreamingVehicles;
set => Core.MaxStreamingVehicles = value;
}
public static byte StreamerThreadCount
{
get => Core.StreamerThreadCount;
set => Core.StreamerThreadCount = value;
}
public static uint StreamingTickRate
{
get => Core.StreamingTickRate;
set => Core.StreamingTickRate = value;
}
public static uint StreamingDistance
{
get => Core.StreamingDistance;
set => Core.StreamingDistance = value;
}
public static uint ColShapeTickRate
{
get => Core.ColShapeTickRate;
set => Core.ColShapeTickRate = value;
}
public static uint MigrationDistance
{
get => Core.MigrationDistance;
set => Core.MigrationDistance = value;
}
public static byte MigrationThreadCount
{
get => Core.MigrationThreadCount;
set => Core.MigrationThreadCount = value;
}
public static uint MigrationTickRate
{
get => Core.MigrationTickRate;
set => Core.MigrationTickRate = value;
}
public static byte SyncReceiveThreadCount
{
get => Core.SyncReceiveThreadCount;
set => Core.SyncReceiveThreadCount = value;
}
public static byte SyncSendThreadCount
{
get => Core.SyncSendThreadCount;
set => Core.SyncSendThreadCount = value;
}
public static bool HasBenefit(Benefit benefit) => Core.HasBenefit(benefit);
}
}