-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtension.cs
531 lines (467 loc) · 17.3 KB
/
Extension.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using LavishScriptAPI;
using LavishVMAPI;
using Vanguard.ISXVG.Delegates;
namespace Vanguard.ISXVG
{
namespace Delegates
{
public delegate bool IsFullScreen();
}
/// <summary>
/// This is a basic .NET wrapper around things available in ISXVG.
/// You can use this wrapper to access most (if not all) objects available.
/// </summary>
public class Extension
{
public static IsFullScreen IsFullScreen = Stubs.IsFullScreen;
/// <summary>
/// Gets the number of cards in the ParlayCard deck.
/// </summary>
/// <value>The parlay card count.</value>
public int ParlayCardCount { get { return LavishScript.Objects.GetObject<int>("ParlayCard"); } }
/// <summary>
/// Gets the actor count of this <see cref="Extension"/>.
/// </summary>
/// <value>The actor count.</value>
public int ActorCount { get { return LavishScript.Objects.GetObject("Actor").GetValue<int>(); } }
/// <summary>
/// Returns the "Me" object.
/// </summary>
/// <returns></returns>
public Character Me()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Me");
return new Character(Obj);
}
/// <summary>
/// Gets a pawn using the specified arguments.
/// </summary>
/// <param name="Args">The args.</param>
/// <returns></returns>
public Pawn Pawn(params string[] Args)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Pawn", Args);
return new Pawn(Obj);
}
/// <summary>
/// Gets a pawn using the specified argument.
/// </summary>
/// <param name="Arg">The arg.</param>
/// <returns></returns>
public Pawn Pawn(string Arg)
{
// The line below was causing the crash.
// return Pawn(Arg);
// Ok, so using the params string[] Args method causes shit to crash.
// No idea why.
LavishScriptObject Obj = LavishScript.Objects.GetObject("Pawn", Arg);
return new Pawn(Obj);
}
/// <summary>
/// Gets a pawn using the specified arguments.
/// </summary>
/// <param name="Arg">The arg.</param>
/// <returns></returns>
public Pawn Pawn(int Arg)
{
return Pawn(Arg.ToString());
}
/// <summary>
/// Returns the number of actors in the array.
/// </summary>
/// <returns>number of actors in the array</returns>
[Obsolete("Use ActorCount instead.")]
public int Actor()
{
return LavishScript.Objects.GetObject("Actor").GetValue<int>();
}
/// <summary>
/// Gets an <see cref="Actor"/> at the specified index.
/// </summary>
/// <param name="Arg">between 1 and the <see cref="ActorCount"/></param>
/// <returns></returns>
public Actor Actor(int Arg)
{
// This has the same effect. With being easier to maintain.
return Actor(Arg.ToString());
}
/// <summary>
/// Gets an actor by it's search params.
/// See http://vg.isxgames.com/wiki/index.php?title=Actor_Search_Parameters for possible parameters.
/// </summary>
/// <param name="Args">The search parameters to use.</param>
/// <returns></returns>
public Actor Actor(params string[] Args)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Actor", Args);
return new Actor(Obj);
}
/// <summary>
/// Gets a radar object at the specified index.
/// </summary>
/// <param name="Index">The index to get the radar from. (1-${ISXVG.NumRadars})</param>
/// <returns></returns>
public Radar Radar(int Index)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Radar", Index.ToString());
return new Radar(Obj);
}
/// <summary>
/// Gets a radar object by its name.
/// </summary>
/// <param name="Name">The name of the radar to get.</param>
/// <returns></returns>
public Radar Radar(string Name)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Radar", Name);
return new Radar(Obj);
}
/// <summary>
/// Returns the first/only radar in the array.
/// </summary>
/// <returns></returns>
public Radar Radar()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Radar");
return new Radar(Obj);
}
/// <summary>
/// This TLO only works when the "Your Remains" window is open and populated.
/// </summary>
/// <param name="Argument">At this point (4.18.2007) the only parameter accepted is "Corpse"</param>
/// <returns>Number of corpses available for summoning</returns>
public int Altar(string Argument)
{
if (Argument.Contains("Corpse") || Argument.Contains("corpse"))
{
return LavishScript.Objects.GetObject("Altar").GetValue<int>();
}
return 0;
}
/// <summary>
/// This TLO only works when the "Your Remains" window is open and populated.
/// </summary>
/// <param name="Argument">At this point (4.18.2007) the only parameter accepted is "Corpse"</param>
/// <param name="Index">between 1 and the number of corpses available for summoning</param>
public SCorpse Altar(string Argument, int Index)
{
if (Argument.Contains("Corpse") || Argument.Contains("corpse"))
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Altar", "Corpse", Index.ToString());
return new SCorpse(Obj);
}
return null;
}
/// <summary>
/// Returns the <see cref="ISXVG"/> TLO.
/// </summary>
/// <returns></returns>
public ISXVG ISXVG()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("ISXVG");
return new ISXVG(Obj);
}
/// <summary>
/// Returns the <see cref="Loot"/> TLO.
/// </summary>
/// <returns></returns>
public Loot Loot()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Loot");
return new Loot(Obj);
}
/// <summary>
/// Returns the <see cref="VG"/> TLO.
/// </summary>
/// <returns></returns>
public VG VG()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("VG");
return new VG(Obj);
}
/// <summary>
/// Returns the <see cref="Mail"/> TLO.
/// </summary>
/// <returns></returns>
public Mail Mail()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Mail");
return new Mail(Obj);
}
/// <summary>
/// Returns the <see cref="Map"/> TLO.
/// </summary>
/// <returns></returns>
public Map Map()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Map");
return new Map(Obj);
}
/// <summary>
/// Gets a <see cref="VGLocation"/> based on the passed arguments.
/// </summary>
/// <param name="Args">The arguments to use.</param>
/// <returns></returns>
public VGLocation VGLoc(params string[] Args)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("VGLoc", Args);
return new VGLocation(Obj);
}
/// <summary>
/// Gets a <see cref="VGLocation"/> based on the passed argument.
/// </summary>
/// <param name="Arg">The argument.</param>
/// <returns></returns>
public VGLocation VGLoc(string Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("VGLoc", Arg);
return new VGLocation(Obj);
}
/// <summary>
/// Gets a <see cref="VGLocation"/> based on its index. (1-<see cref="Vanguard.ISXVG.ISXVG.VGLocsCount"/>)
/// </summary>
/// <param name="Arg"></param>
/// <returns></returns>
public VGLocation VGLoc(int Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("VGLoc", Arg.ToString());
return new VGLocation(Obj);
}
/// <summary>
/// Gets a <see cref="VGUIElement"/> by the specified search key.
/// </summary>
/// <param name="SearchKey">'searchkeys' are found within the windows xml files in /vanguard/VGUIAssets/Shells/Default/Windows.</param>
/// <returns></returns>
public VGUIElement VGUI(string SearchKey)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("VGUI", SearchKey);
return new VGUIElement(Obj);
}
/// <summary>
/// Gets the <see cref="Vanguard.ISXVG.Market"/> TLO.
/// </summary>
/// <returns></returns>
public Market Market()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Market");
return new Market(Obj);
}
/// <summary>
/// number of cards in strategy deck
/// </summary>
/// <returns>number of cards in strategy deck</returns>
public int Strategy()
{
return LavishScript.Objects.GetObject<int>("Strategy");
}
/// <summary>
/// Strategies the specified arg.
/// </summary>
/// <param name="Arg">The arg.</param>
/// <returns></returns>
public ParlayCard Strategy(int Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Strategy", Arg.ToString());
return new ParlayCard(Obj);
}
/// <summary>
/// Strategies the specified name.
/// </summary>
/// <param name="Name">The name.</param>
/// <returns></returns>
public ParlayCard Strategy(string Name)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Strategy", Name);
return new ParlayCard(Obj);
}
/// <summary>
/// number of cards in ParlayCard deck
/// </summary>
/// <returns>number of cards in ParlayCard deck</returns>
[Obsolete("Use ParlayCardCount property instead.")]
public int ParlayCard()
{
return LavishScript.Objects.GetObject<int>("ParlayCard");
}
/// <summary>
/// Parlays the card.
/// </summary>
/// <param name="Arg">The arg.</param>
/// <returns></returns>
public ParlayCard ParlayCard(int Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("ParlayCard", Arg.ToString());
return new ParlayCard(Obj);
}
/// <summary>
/// Parlays the card.
/// </summary>
/// <param name="Name">The name.</param>
/// <returns></returns>
public ParlayCard ParlayCard(string Name)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("ParlayCard", Name);
return new ParlayCard(Obj);
}
/// <summary>
/// Parlays this <see cref="Extension"/>.
/// </summary>
/// <returns></returns>
public Parlay Parlay()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Parlay");
return new Parlay(Obj);
}
/// <summary>
/// Groups the specified arg.
/// </summary>
/// <param name="Arg">The arg.</param>
/// <returns></returns>
public GroupMember Group(int Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Group", Arg.ToString());
return new GroupMember(Obj);
}
/// <summary>
/// Groups the specified name.
/// </summary>
/// <param name="Name">The name.</param>
/// <returns></returns>
public GroupMember Group(string Name)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Group", Name);
return new GroupMember(Obj);
}
public Group Group()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Group");
return new Group(Obj);
}
public Dialog Dialog(string Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Dialog", Arg);
return new Dialog(Obj);
}
public DialogResponse Dialog(params string[] Args)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Dialog", Args);
return new DialogResponse(Obj);
}
public QuestJournal QuestJournal()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Journal", "Quest");
return new QuestJournal(Obj);
}
public QuestJournal QuestJournal(string Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Journal", "Quest", Arg);
return new QuestJournal(Obj);
}
public QuestJournal QuestJournal(int Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Journal", "Quest", Arg.ToString());
return new QuestJournal(Obj);
}
public TravelJournal TravelJournal()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Journal", "Travel");
return new TravelJournal(Obj);
}
public TravelJournal TravelJournal(string Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Journal", "Travel", Arg);
return new TravelJournal(Obj);
}
public TravelJournal TravelJournal(int Arg)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Journal", "Travel", Arg.ToString());
return new TravelJournal(Obj);
}
public Merchant Merchant()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Merchant");
return new Merchant(Obj);
}
public CraftingTaskMaster CraftingTaskMaster()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("TaskMaster", "Crafting");
return new CraftingTaskMaster(Obj);
}
public GV GV(params string[] Args)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("GV", Args);
return new GV(Obj);
}
public Trade Trade()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Trade");
return new Trade(Obj);
}
public Songbook Songs()
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Songbook");
return new Songbook(Obj);
}
public Song Songs(string Name)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Songs", Name);
return new Song(Obj);
}
public Song Songs(int Index)
{
LavishScriptObject Obj = LavishScript.Objects.GetObject("Song", Index.ToString());
return new Song(Obj);
}
public void VGExecute(string Args)
{
LavishScript.ExecuteCommand("VGExecute " + Args);
}
public void VGEcho(string Args)
{
LavishScript.ExecuteCommand("VGEcho " + Args);
}
public void Target()
{
LavishScript.ExecuteCommand("Target");
}
public void Target(string Args)
{
LavishScript.ExecuteCommand("Target " + Args);
}
public void Face()
{
LavishScript.ExecuteCommand("Face");
}
public void Face(string Args)
{
LavishScript.ExecuteCommand("Face " + Args);
}
public void Where()
{
LavishScript.ExecuteCommand("Where");
}
public void Where(string Args)
{
LavishScript.ExecuteCommand("Where" + Args);
}
#region Nested type: Stubs
internal class Stubs
{
public static bool IsFullScreen()
{
IntPtr Address = LavishVM.GetAPI("VGWindowsAPI", "IsFullScreen", 1);
if (Address.ToInt32() == 0)
{
return false;
}
Extension.IsFullScreen =
(IsFullScreen) Marshal.GetDelegateForFunctionPointer(Address, typeof(IsFullScreen));
return Extension.IsFullScreen();
}
}
#endregion
}
}