-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEveSession.cs
189 lines (174 loc) · 3.67 KB
/
EveSession.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EveModel
{
public class EveSession : EveObject
{
public EveSession()
: base()
{
this.PointerToObject = Frame.Client.Builtin["eve"]["session"].PointerToObject;
}
#region InStation
/// <summary>
/// Returns whether pilot is docked in station
/// </summary>
public bool InStation
{
get
{
return Frame.Client.MenuService.CallMethod("GetCheckInStation", new object[0]).GetValueAs<bool>();
}
}
#endregion
#region InSpace
/// <summary>
/// Checks to see if the pilot is in space
/// </summary>
public bool InSpace
{
get
{
return Frame.Client.MenuService.CallMethod("GetCheckInSpace", new object[0]).GetValueAs<bool>();
}
}
#endregion
#region LocationId
private long? _locationId;
/// <summary>
/// returns -1 if no locationid was found
/// </summary>
public long LocationId
{
get
{
if (!_locationId.HasValue)
{
_locationId = this["locationid"].GetValueAs<long>();
}
return _locationId.Value;
}
}
#endregion
#region NextSessionChange
private DateTime? _nextSessionChange;
/// <summary>
/// returns when the next sessionchange ends,
/// can be in the past if it already ended
/// </summary>
public DateTime NextSessionChange
{
get
{
if (!_nextSessionChange.HasValue)
{
_nextSessionChange = this["nextSessionChange"].GetValueAs<DateTime>();
}
return _nextSessionChange.Value;
}
}
#endregion
#region IsItSafe
private bool? _isItSafe;
/// <summary>
/// returns whether the session is safe to use
/// </summary>
public bool IsItSafe
{
get
{
if (!_isItSafe.HasValue)
{
_isItSafe = this.CallMethod("IsItSafe", new object[0]).GetValueAs<bool>();
}
return _isItSafe.Value;
}
}
#endregion
#region CharId
private long? _charId;
/// <summary>
/// returns -1 if no charid was found
/// </summary>
public long CharId
{
get
{
if (!_charId.HasValue)
{
_charId = this["charid"].GetValueAs<long>();
}
return _charId.Value;
}
}
#endregion
#region ShipId
private long? _shipID;
/// <summary>
/// returns -1 if no charid was found
/// </summary>
public long ShipId
{
get
{
if (!_shipID.HasValue)
{
_shipID = this["shipid"].GetValueAs<long>();
}
return _shipID.Value;
}
}
#endregion
#region EveTime
DateTime? _eveTime;
public DateTime EveTime
{
get
{
if (!_eveTime.HasValue)
_eveTime = Frame.Client.Blue["os"].CallMethod("GetSimTime", new object[0]).GetValueAs<DateTime>();
return _eveTime.Value;
}
}
#endregion
int? _StationId;
public int? StationId
{
get
{
_StationId = this["stationid"].GetValueAs<int>();
if(_StationId == -1)
_solarSystemId = this["stationid2"].GetValueAs<int>();
return _StationId.Value;
}
}
public bool IsReady {
get { return (Frame.Client.Builtin["uicore"]["layer"]["loading"]["display"].GetValueAs<bool>()) ? false : true; }
}
int? _solarSystemId;
public int SolarSystemId
{
get {
if (!_solarSystemId.HasValue)
{
_solarSystemId = this["solarsystemid"].GetValueAs<int>();
if (_solarSystemId == -1)
_solarSystemId= this["solarsystemid2"].GetValueAs<int>();
}
return _solarSystemId.Value;
}
}
double? _systemSecurity;
public double SystemSecurity
{
get
{
if (!_systemSecurity.HasValue)
_systemSecurity = Frame.Client.MapService.CallMethod("GetSecurityStatus", new object[] { Frame.Client.Session.SolarSystemId }).GetValueAs<double>();
return _systemSecurity.Value;
}
}
}
}