-
Notifications
You must be signed in to change notification settings - Fork 14
/
EVE.cs
830 lines (733 loc) · 25.8 KB
/
EVE.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
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
using EVE.ISXEVE.Enums;
using EVE.ISXEVE.Extensions;
using EVE.ISXEVE.Interfaces;
using LavishScriptAPI;
using System;
using System.Collections.Generic;
using System.Globalization;
namespace EVE.ISXEVE
{
/// <summary>
/// Wrapper for the eve data type.
/// </summary>
public class EVE : LavishScriptObject, IEve
{
#region Constants
public const string OnChannelMessageEvent = "EVE_OnChannelMessage";
#endregion
#region Constructors
/// <summary>
/// Copy constructor for the EVE object.
/// </summary>
/// <param name="Obj"></param>
public EVE(LavishScriptObject Obj)
: base(Obj)
{
}
/// <summary>
/// Constructor for the EVE object. Returns the LS object.
/// </summary>
public EVE()
: base(LavishScript.Objects.GetObject("EVE"))
{
}
#endregion
/// <summary>
/// Optimisation Route
/// </summary>
/// <returns></returns>
public bool OptimizeAutopilotRoute()
{
Tracing.SendCallback("EVE.OptimizeAutopilotRoute");
return ExecuteMethod("OptimizeAutopilotRoute");
}
/// <summary>
/// Wrapper for the StationID member of the eve type.
/// </summary>
/// <param name="stationID"></param>
/// <returns></returns>
public Station Station(long stationID)
{
Tracing.SendCallback("EVE.Station", stationID);
return GetMember<Station>("Station", stationID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// Number of entities currently in range of your overhead
/// </summary>
public int EntitiesCount
{
get { return this.GetInt("EntitiesCount"); }
}
/// <summary>
/// # of seconds until a session change can be performed. This includes docking, undocking, exiting a ship, entering a new ship, etc.
/// </summary>
public int NextSessionChange
{
get { return this.GetInt("NextSessionChange"); }
}
/// <summary>
/// Returns a list of the "SystemIDs" of the systems along your current destination (autopilot) route.
/// Returns a single -1 if you currently have no destinations.
/// </summary>
public List<int> GetToDestinationPath()
{
Tracing.SendCallback("EVE.GetToDestinationPath");
return Util.GetListFromMethod<int>(this, "GetToDestinationPath", "int");
}
/// <summary>
/// Returns a list of the "SystemIDs" of the waypoints in your current route.
/// </summary>
public List<int> GetWaypoints()
{
Tracing.SendCallback("EVE.GetWaypoints");
return Util.GetListFromMethod<int>(this, "GetWaypoints", "int");
}
/// <summary>
/// Wrapper for the GetAgentMissions member of the eve type.
/// </summary>
/// <returns></returns>
public List<AgentMission> GetAgentMissions()
{
Tracing.SendCallback("EVE.GetAgentMissions");
return Util.GetListFromMethod<AgentMission>(this, "GetAgentMissions", "agentmission");
}
/// <summary>
/// Returns a bookmark based on its label.
/// </summary>
public BookMark Bookmark(string label)
{
Tracing.SendCallback("EVE.Bookmark", label);
return new BookMark(GetMember("Bookmark", label));
}
/// <summary>
/// Returns a list of your bookmarks.
/// </summary>
public List<BookMark> GetBookmarks()
{
Tracing.SendCallback("EVE.GetBookmarks", string.Empty);
return Util.GetListFromMethod<BookMark>(this, "GetBookmarks", "bookmark");
}
/// <summary>
/// Returns number of jumps to the given solarsystem or station.
/// </summary>
public int GetJumpsTo(int solarSystemOrStationId)
{
Tracing.SendCallback("EVE.GetJumpsTo", solarSystemOrStationId.ToString(CultureInfo.CurrentCulture));
return this.GetInt("JumpsTo", solarSystemOrStationId.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// Get the # of jumps between the given two solar systems.
/// </summary>
/// <param name="firstSolarSystem"></param>
/// <param name="secondSolarSystemId"></param>
/// <returns></returns>
public int GetJumpsBetween(int firstSolarSystem, int secondSolarSystemId)
{
return this.GetInt("JumpsBetween", firstSolarSystem.ToString(CultureInfo.CurrentCulture), secondSolarSystemId.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// Returns the distance between two entities.
/// </summary>
public double DistanceBetween(Int64 firstEntityID, Int64 secondEntityID)
{
Tracing.SendCallback("EVE.DistanceBetween", firstEntityID, secondEntityID);
return this.GetDouble("DistanceBetween", firstEntityID.ToString(CultureInfo.CurrentCulture), secondEntityID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// example: "18:23:55"
/// </summary>
public string Time
{
get { return this.GetString("Time"); }
}
/// <summary>
/// example: "18:23"
/// </summary>
public string TimeShort
{
get { return this.GetString("Time", "short"); }
}
/// <summary>
/// example: "2007.08.25"
/// </summary>
public string Date
{
get { return this.GetString("Date"); }
}
/// <summary>
/// Wrapper for the Is3DDisplayOn member of the eve type.
/// </summary>
public bool Is3DDisplayOn
{
get { return this.GetBool("Is3DDisplayOn"); }
}
/// <summary>
/// Wrapper for the IsUIDisplayOn member of the eve type.
/// </summary>
public bool IsUIDisplayOn
{
get { return this.GetBool("IsUIDisplayOn"); }
}
public bool IsTextureLoadingOn
{
get { return this.GetBool("IsTextureLoadingOn"); }
}
public bool AbandonedDronesExist
{
get { return this.GetBool("AbandonedDronesExist"); }
}
public bool IsProgressWindowOpen
{
get { return this.GetBool("IsProgressWindowOpen"); }
}
public string ProgressWindowTitle
{
get { return this.GetString("ProgressWindowTitle"); }
}
/// <summary>
/// Wrapper for the GetLocalPilots member of the eve type.
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public List<Pilot> GetLocalPilots(params string[] args)
{
Tracing.SendCallback("EVE.GetLocalPilots", args);
return Util.GetListFromMethod<Pilot>(this, "GetLocalPilots", "pilot", args);
}
/// <summary>
/// Wrapper for the GetOnlineCorpMembers method of the eve type.
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public List<Pilot> GetOnlineCorpMembersAsPilots(params string[] args)
{
Tracing.SendCallback("EVE.GetOnlineCorpMembers", args);
return Util.GetListFromMethod<Pilot>(this, "GetOnlineCorpMembers", "pilot", args);
}
/// <summary>
/// Wrapper for the GetOnlineCorpMembers method of the eve type.
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public List<Being> GetOnlineCorpMembersAsBeings(params string[] args)
{
Tracing.SendCallback("EVE.GetOnlineCorpMembers", args);
return Util.GetListFromMethod<Being>(this, "GetOnlineCorpMembers", "being", args);
}
/// <summary>
/// Your "buddies"
/// </summary>
[Obsolete("Use GetContacts().", false)]
public List<Being> GetBuddies()
{
Tracing.SendCallback("EVE.GetBuddies");
return Util.GetListFromMethod<Being>(this, "GetBuddies", "being");
}
/// <summary>
/// ISXEVE-20141001.0009 on October 4, 2014:
/// This does EXACTLY the same thing as "GetBuddies" does currently. "GetBuddies" is now deprecated and should be removed.
/// </summary>
/// <returns></returns>
public IList<Being> GetContacts()
{
Tracing.SendCallback("EVE.GetContacts");
return this.GetListFromMethod<Being>("GetContacts", "being");
}
/// <summary>
/// the agents in your *addressbook*
/// </summary>
public List<Being> GetAgents()
{
Tracing.SendCallback("EVE.GetAgents");
return Util.GetListFromMethod<Being>(this, "GetAgents", "being");
}
/// <summary>
/// Returns the number of chat channels currently open in your UI
/// </summary>
/// <returns></returns>
public Int32 ChatChannelCount
{
get { return this.GetInt("ChatChannelCount"); }
}
/// <summary>
/// 1. NumAssetsAtStation[#] (int type) [Returns the number of items currently housed at the StationID# given.]
/// </summary>
public int NumAssetsAtStation(long stationID)
{
Tracing.SendCallback("EVE.NumAssetsAtStation", stationID);
return this.GetInt("NumAssetsAtStation", stationID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// 2. GetLocationNameByID[#] (string type) [Useful for changing a StationID# to an actual name.]
/// </summary>
public string GetLocationNameByID(int stationID)
{
Tracing.SendCallback("EVE.GetLocationNameByID", stationID);
return this.GetString("GetLocationNameByID", stationID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// Download market order information from EVE servers.
/// </summary>
public bool FetchMarketOrders()
{
Tracing.SendCallback("EVE.FetchMarketOrders");
return this.GetBool("FetchMarketOrders");
}
/// <summary>
/// Get entities matching query specified by queryID.
/// Note: ID from Lavishscript query system -- query will not be freed
/// </summary>
/// <param name="queryID"></param>
/// <returns></returns>
public List<Entity> QueryEntities(int queryID)
{
Tracing.SendCallback("EVE.QueryEntities", queryID.ToString(CultureInfo.CurrentCulture));
return Util.GetListFromMethod<Entity>(this, "QueryEntities", "entity", queryID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// Get entities matching the passed query.
/// Note: Uses Lavishscript query syntax, query will be created and destroyed after use
/// </summary>
/// <param name="queryString"></param>
/// <returns></returns>
public List<Entity> QueryEntities(string queryString)
{
Tracing.SendCallback("EVE.QueryEntities", queryString);
return Util.GetListFromMethod<Entity>(this, "QueryEntities", "entity", queryString);
}
/// <summary>
/// Get all entities
/// </summary>
/// <returns></returns>
public List<Entity> QueryEntities()
{
Tracing.SendCallback("EVE.QueryEntities");
return Util.GetListFromMethod<Entity>(this, "QueryEntities", "entity");
}
/// <summary>
/// if bool is true, forces repopulation of entities. This should be called ONCE after isxeve is loaded... any more will have no effect.
/// </summary>
/// <param name="forceRepopulate"></param>
/// <returns></returns>
public bool PopulateEntities(bool forceRepopulate)
{
Tracing.SendCallback("EVE.PopulateEntities", forceRepopulate.ToString(CultureInfo.CurrentCulture));
return ExecuteMethod("PopulateEntities", forceRepopulate.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// This method creates a simple EVE popup window with the 'text' given.
/// </summary>
public bool InfoWindow(string text)
{
Tracing.SendCallback("EVE.InfoWindow", text);
return ExecuteMethod("InfoWindow", text);
}
/// <summary>
/// This method sets the status text that appears in space over your ship controls.
/// </summary>
public bool SetInSpaceStatus(string title, string text)
{
Tracing.SendCallback("EVE.SetInSpaceStatus");
return ExecuteMethod("SetInSpaceStatus", title, text);
}
/// <summary>
/// Order drones to engage active target.
/// </summary>
/// <param name="drones">drones to order</param>
/// <returns>true if successful, else false</returns>
public bool DronesEngageMyTarget(List<Int64> drones)
{
Tracing.SendCallback("EVE.DronesEngageMyTarget");
var lsIndex = LavishScript.Objects.NewObject("index:int64");
foreach (var droneID in drones)
{
lsIndex.ExecuteMethod("Insert", droneID.ToString(CultureInfo.CurrentCulture));
}
return ExecuteMethod("DronesEngageMyTarget", lsIndex.GetLSReference());
}
/// <summary>
/// Order drones to mine repeatedly.
/// </summary>
/// <param name="drones">ActiveDrone IDs</param>
/// <returns></returns>
public bool DronesMineRepeatedly(List<Int64> drones)
{
Tracing.SendCallback("EVE.DronesMineRepeatedly", string.Empty);
var lsIndex = LavishScript.Objects.NewObject("index:int64");
foreach (var droneID in drones)
{
lsIndex.ExecuteMethod("Insert", droneID.ToString(CultureInfo.CurrentCulture));
}
return ExecuteMethod("DronesMineRepeatedly", lsIndex.GetLSReference());
}
/// <summary>
/// Execute an eve command.
/// </summary>
public bool Execute(ExecuteCommand command)
{
Tracing.SendCallback("EVE.Execute", command);
return ExecuteMethod("Execute", command.ToString());
}
/// <summary>
/// Execute an eve command.
/// </summary>
public bool Execute(string command)
{
Tracing.SendCallback("EVE.Execute", command);
return ExecuteMethod("Execute", command);
}
/// <summary>
/// Creates a bookmark.
/// </summary>
public bool CreateBookmark()
{
return CreateBookmark(null, null, null);
}
/// <summary>
/// Creates a bookmark.
/// </summary>
public bool CreateBookmark(string label)
{
return CreateBookmark(label, null, null);
}
/// <summary>
/// Creates a bookmark.
/// </summary>
public bool CreateBookmark(string label, string notes, string location)
{
return CreateBookmark(label, notes, location, BookmarkExpiry.Forever);
}
/// <summary>
/// Creates a bookmark.
/// </summary>
public bool CreateBookmark(string label, string notes, string location, BookmarkExpiry bookmarkExpiry)
{
Tracing.SendCallback("EVE.CreateBookmark", label, notes, location, bookmarkExpiry.ToString("D"));
return ExecuteMethod("CreateBookmark", label, notes, location, bookmarkExpiry.ToString("D"));
}
public enum BookmarkExpiry
{
Forever,
ThreeHours,
TwoDays
}
/// <summary>
/// Wrapper for the AddWaypoint method of the eve type.
/// </summary>
/// <param name="solarSystemID"></param>
/// <returns></returns>
public bool AddWaypoint(int solarSystemID)
{
Tracing.SendCallback("EVE.AddWaypoint", solarSystemID);
return ExecuteMethod("AddWaypoint", solarSystemID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// Closes any of the simple 'information message boxes', etc that might be up.
/// </summary>
public bool CloseAllMessageBoxes()
{
Tracing.SendCallback("EVE.CloseAllMessageBoxes", string.Empty);
return ExecuteMethod("CloseAllMessageBoxes");
}
/// <summary>
/// Wrapper for the CloseAllChatInvites method of the eve type.
/// </summary>
/// <returns></returns>
public bool CloseAllChatInvites()
{
Tracing.SendCallback("EVE.CloseAllChatInvites", string.Empty);
return ExecuteMethod("CloseAllChatInvites");
}
/// <summary>
/// Wrapper for the LaunchDrones method of the eve type.
/// </summary>
/// <param name="DroneIDs"></param>
/// <returns></returns>
public bool LaunchDrones(List<Int64> DroneIDs)
{
Tracing.SendCallback("EVE.LaunchDrones", DroneIDs);
if (DroneIDs.Count == 0)
{
return false;
}
var lsIndex = LavishScript.Objects.NewObject("index:int64");
for (var index = 0; index < DroneIDs.Count; index++)
{
lsIndex.ExecuteMethod("Insert", DroneIDs[index].ToString(CultureInfo.CurrentCulture));
}
//InnerSpace.Echo("*** " + LSIndex.GetMember<int>("Used"));
// TODO - Test this to make sure passing a populated index into ExecuteMethod works
// - CyberTech
return ExecuteMethod("LaunchDrones", lsIndex.GetLSReference());
}
/// <summary>
/// Wrapper for the DronesReturnToDroneBay method of the eve type.
/// </summary>
/// <param name="DroneIDs"></param>
/// <returns></returns>
public bool DronesReturnToDroneBay(List<Int64> DroneIDs)
{
Tracing.SendCallback("EVE.DronesReturnToDroneBay", DroneIDs);
if (DroneIDs.Count == 0)
{
return false;
}
var lsIndex = LavishScript.Objects.NewObject("index:int64");
for (var index = 0; index < DroneIDs.Count; index++)
{
lsIndex.ExecuteMethod("Insert", DroneIDs[index].ToString(CultureInfo.CurrentCulture));
}
//InnerSpace.Echo("*** " + LSIndex.GetMember<int>("Used"));
// TODO - Test this to make sure passing a populated index into ExecuteMethod works
// - CyberTech
return ExecuteMethod("DronesReturnToDroneBay", lsIndex.GetLSReference());
}
/// <summary>
/// Wrapper for the ItemInfo member of the EVE datatype.
/// </summary>
/// <param name="typeId"></param>
/// <returns></returns>
public IItemInfo ItemInfo(int typeId)
{
Tracing.SendCallback("EVE.ItemInfo", typeId);
return new ItemInfo(GetMember("ItemInfo", typeId.ToString(CultureInfo.CurrentCulture)));
}
public List<EVEWindow> GetEveWindows()
{
return this.GetListFromMethod<EVEWindow>("GetEVEWindows", "evewindow");
}
/// <summary>
/// Wrapper for the MoveItemsTo method fo the eve type.
/// </summary>
/// <param name="items"></param>
/// <param name="ToLocationID"></param>
/// <param name="destinationName"></param>
/// <returns></returns>
public bool MoveItemsTo(List<Int64> items, Int64 ToLocationID, string destinationName)
{
Tracing.SendCallback("EVE.MoveItemsTo", ToLocationID, destinationName);
if (items.Count == 0)
{
return false;
}
var lsIndex = LavishScript.Objects.NewObject("index:int64");
for (var index = 0; index < items.Count; index++)
{
lsIndex.ExecuteMethod("Insert", items[index].ToString(CultureInfo.CurrentCulture));
}
//InnerSpace.Echo("*** " + LSIndex.GetMember<int>("Used"));
// TODO - Test this to make sure passing a populated index into ExecuteMethod works
// - CyberTech
return ExecuteMethod("MoveItemsTo", lsIndex.GetLSReference(), ToLocationID.ToString(CultureInfo.CurrentCulture), destinationName);
}
/// <summary>
/// Wrapper for the MoveItemsTo method of the eve type.
/// </summary>
/// <param name="items"></param>
/// <param name="ToLocationID"></param>
/// <param name="destinationName"></param>
/// <param name="corporationHangarFolder"></param>
/// <returns></returns>
public bool MoveItemsTo(List<Int64> items, Int64 ToLocationID, string destinationName, int corporationHangarFolder)
{
Tracing.SendCallback("EVE.MoveItemsTo", ToLocationID, destinationName, corporationHangarFolder);
if (items.Count == 0)
{
return false;
}
var lsIndex = LavishScript.Objects.NewObject("index:int64");
for (var index = 0; index < items.Count; index++)
{
lsIndex.ExecuteMethod("Insert", items[index].ToString(CultureInfo.CurrentCulture));
}
return ExecuteMethod("MoveItemsTo", lsIndex.GetLSReference(), ToLocationID.ToString(CultureInfo.CurrentCulture), destinationName,
String.Format(CultureInfo.CurrentCulture, "Corporation Folder {0}", corporationHangarFolder));
}
/// <summary>
/// Wrapper for the MoveItemsTo method fo the eve type.
/// </summary>
/// <param name="items"></param>
/// <param name="ToLocationName">'MyShip','MyStationHangar', or 'MyStationCorporateHangar'</param>
/// <param name="destinationName"></param>
/// <returns></returns>
public bool MoveItemsTo(List<Int64> items, string ToLocationName, string destinationName)
{
Tracing.SendCallback("EVE.MoveItemsTo", ToLocationName, destinationName);
if (items.Count == 0)
{
return false;
}
var lsIndex = LavishScript.Objects.NewObject("index:int64");
for (var index = 0; index < items.Count; index++)
{
lsIndex.ExecuteMethod("Insert", items[index].ToString(CultureInfo.CurrentCulture));
}
//InnerSpace.Echo("*** " + LSIndex.GetMember<int>("Used"));
// TODO - Test this to make sure passing a populated index into ExecuteMethod works
// - CyberTech
return ExecuteMethod("MoveItemsTo", lsIndex.GetLSReference(), ToLocationName, destinationName);
}
/// <summary>
/// Wrapper for the MoveItemsTo method of the eve type.
/// </summary>
/// <param name="items"></param>
/// <param name="ToLocationName">'MyShip','MyStationHangar', or 'MyStationCorporateHangar'</param>
/// <param name="destinationName"></param>
/// <param name="corporationHangarFolder"></param>
/// <returns></returns>
public bool MoveItemsTo(List<Int64> items, string ToLocationName, string destinationName, int corporationHangarFolder)
{
Tracing.SendCallback("EVE.MoveItemsTo", ToLocationName, destinationName, corporationHangarFolder);
if (items.Count == 0)
{
return false;
}
var lsIndex = LavishScript.Objects.NewObject("index:int64");
for (var index = 0; index < items.Count; index++)
{
lsIndex.ExecuteMethod("Insert", items[index].ToString(CultureInfo.CurrentCulture));
}
return ExecuteMethod("MoveItemsTo", lsIndex.GetLSReference(), ToLocationName, destinationName,
String.Format(CultureInfo.CurrentCulture, "Corporation Folder {0}", corporationHangarFolder));
}
/// <summary>
/// 2. CreateMarketBuyOrder[TypeID#]
/// </summary>
public bool CreateMarketBuyOrder(int typeID)
{
Tracing.SendCallback("EVE.CreateMarketBuyOrder", typeID);
return ExecuteMethod("CreateMarketBuyOrder",
typeID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// 2. ClearMarketOrderCache {This clears your market order cache. It is useful if you're doing a lot of market transactions and want
/// to keep things tidy.}
/// </summary>
/// <returns></returns>
public bool ClearMarketOrderCache()
{
Tracing.SendCallback("EVE.ClearMarketOrderCache");
return ExecuteMethod("ClearMarketOrderCache");
}
/// <summary>
/// Fetch the market orders matching the given typeID.
/// </summary>
/// <param name="typeID"></param>
/// <returns></returns>
public bool FetchMarketOrders(int typeID)
{
Tracing.SendCallback("EVE.FetchMarketOrders", typeID);
return ExecuteMethod("FetchMarketOrders", typeID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// Retrieve all market orders for the given typeID. Returns null if loading.
/// </summary>
/// <param name="typeID"></param>
/// <returns></returns>
public List<MarketOrder> GetMarketOrders(int typeID)
{
Tracing.SendCallback("GetMarketOrders", typeID);
return Util.GetListFromMethod<MarketOrder>(this, "GetMarketOrders", "marketorder", typeID.ToString(CultureInfo.CurrentCulture));
}
/// <summary>
/// Retrieve all market orders for the given typeID and given order type. Returns null if loading.
/// </summary>
/// <param name="typeID"></param>
/// <param name="orderType"></param>
/// <returns></returns>
public List<MarketOrder> GetMarketOrders(int typeID, OrderType orderType)
{
Tracing.SendCallback("GetMarketOrders", typeID, orderType);
return Util.GetListFromMethod<MarketOrder>(this, "GetMarketOrders", "marketorder", typeID.ToString(CultureInfo.CurrentCulture), orderType.ToString());
}
/// <summary>
/// Wrapper for the Toggle3DDisplay method of the eve type.
/// </summary>
/// <returns></returns>
public bool Toggle3DDisplay()
{
Tracing.SendCallback("EVE.Toggle3DDisplay");
return ExecuteMethod("Toggle3DDisplay");
}
/// <summary>
/// Wrapper for the ToggleUIDisplay method of the eve type.
/// </summary>
/// <returns></returns>
public bool ToggleUIDisplay()
{
Tracing.SendCallback("EVE.ToggleUIDisplay");
return ExecuteMethod("ToggleUIDisplay");
}
public bool ToggleTextureLoading()
{
Tracing.SendCallback("EVE.ToggleTextureLoading");
return ExecuteMethod("ToggleTextureLoading");
}
/// <summary>
/// Wrapper for the RefreshStandings method of the eve type.
/// </summary>
/// <returns></returns>
public bool RefreshStandings()
{
Tracing.SendCallback("EVE.RefreshStandings");
return ExecuteMethod("RefreshStandings");
}
public bool ReclaimDrones()
{
Tracing.SendCallback("EVE.ReclaimDrones");
return ExecuteMethod("ReclaimDrones");
}
public List<long> GetViewedWrecks()
{
Tracing.SendCallback("EVE.GetViewedWrecks");
return Util.GetListFromMethod<long>(this, "GetViewedWrecks", "int64");
}
public bool RefreshBookmarks()
{
Tracing.SendCallback("EVE.RefreshBookmarks");
return ExecuteMethod("RefreshBookmarks");
}
}
/// <summary>
/// Represents the arguments passed as part of an EVE_OnChannelMessage event, parsing
/// the text values in the LSEventArgs and producing something easily usible.
/// </summary>
public class EVE_OnChannelMessageEventArgs : EventArgs
{
public Int64 ChannelID = -1, CharID = -1, CorpID = -1, AllianceID = -1;
public string CharName = string.Empty, MessageText = string.Empty;
public EVE_OnChannelMessageEventArgs(LSEventArgs lsEventArgs)
{
ProcessLsEventArgs(lsEventArgs);
}
/// <summary>
/// Process all of the string args in the LSEventArgs and set the values of this EventArgs object
/// </summary>
/// <param name="lsEventArgs"></param>
private void ProcessLsEventArgs(LSEventArgs lsEventArgs)
{
ChannelID = StringToInt64(lsEventArgs.Args[0]);
CharID = StringToInt64(lsEventArgs.Args[1]);
CorpID = StringToInt64(lsEventArgs.Args[2]);
AllianceID = StringToInt64(lsEventArgs.Args[3]);
CharName = lsEventArgs.Args[4];
MessageText = lsEventArgs.Args[5];
}
/// <summary>
/// Convert string to 64-bit signed integer
/// </summary>
/// <param name="Int64Str">String value to convert to int64</param>
/// <param name="DefaultValue">Value to return if conversion fails</param>
private static Int64 StringToInt64(string Int64Str, Int64 DefaultValue = 0)
{
#pragma warning disable IDE0018 // Inline variable declaration
Int64 retVal;
#pragma warning restore IDE0018 // Inline variable declaration
if (!Int64.TryParse(Int64Str, out retVal))
{
retVal = DefaultValue;
}
return retVal;
}
}
}