-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEveModule.cs
More file actions
250 lines (231 loc) · 7.03 KB
/
EveModule.cs
File metadata and controls
250 lines (231 loc) · 7.03 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EveModel
{
public class EveModule : EveItem
{
public EveModule(EveObject parent, long itemId) : base(parent)
{
this.PointerToObject = parent.PointerToObject;
this.TypeId = this["sr"]["moduleInfo"]["typeID"].GetValueAs<int>();
ItemId = itemId;
}
void FindMaxRange()
{
var info = this["sr"]["moduleInfo"];
var vals = Frame.Client.Tactical.CallMethod("FindMaxRange", new object[] { info, Charge }).GetListFromTuple<double>();
_optimalRange = vals[0];
_fallOff = vals[1];
_bombRadius = vals[2];
}
#region OptimalRange
double? _optimalRange;
public double OptimalRange
{
get
{
if (!_optimalRange.HasValue)
{
FindMaxRange();
}
return _optimalRange.Value;
}
}
#endregion
#region FallOff
double? _fallOff;
public double FallOff
{
get
{
if (!_fallOff.HasValue)
{
FindMaxRange();
}
return _fallOff.Value;
}
}
#endregion
#region BombRadius
double? _bombRadius;
public double BombRadius
{
get
{
if (!_bombRadius.HasValue)
{
FindMaxRange();
}
return _bombRadius.Value;
}
}
#endregion
#region CapacitorNeed
double? _capacitorNeed;
/// <summary>
/// Capacitor amount to activate/reactivate
/// </summary>
public double CapacitorNeed
{
get
{
if (!_capacitorNeed.HasValue)
{
EveObject attrib;
_capacitorNeed = this.Attributes.TryGetValue("capacitorNeed", out attrib) ? attrib.GetValueAs<double>() : 0;
}
return _capacitorNeed.Value;
}
}
#endregion
#region Duration
double? _duration;
/// <summary>
/// Activation duration often called cycle time
/// </summary>
public double Duration
{
get
{
if (!_duration.HasValue)
{
EveObject attrib;
_duration = this.Attributes.TryGetValue("duration", out attrib) ? attrib.GetValueAs<double>() / 1000.0 : 0;
}
return _duration.Value;
}
}
#endregion
#region MiningAmount
double? _miningAmount;
/// <summary>
/// Amount of ore mined per cycle
/// </summary>
public double MiningAmount
{
get
{
if (!_miningAmount.HasValue)
{
EveObject attrib;
_miningAmount = this.Attributes.TryGetValue("miningAmount", out attrib) ? attrib.GetValueAs<double>() / 1000.0 : 0;
}
return _miningAmount.Value;
}
}
#endregion
#region IsOnline
bool? _isOnline;
/// <summary>
/// Is the module online
/// </summary>
public bool IsOnline
{
get
{
if (!_isOnline.HasValue)
_isOnline = this["online"].GetValueAs<bool>();
return _isOnline.Value;
}
}
#endregion
#region IsGoingOnline
bool? _isGoingOnline;
/// <summary>
/// Is the module onlining
/// </summary>
public bool IsGoingOnline
{
get
{
if (!_isGoingOnline.HasValue)
_isGoingOnline = this["goingOnline"].GetValueAs<bool>();
return _isGoingOnline.Value;
}
}
#endregion
#region ReloadingAmmo
bool? _isReloadingAmmo;
/// <summary>
/// Is the module reloading the exisiting type of ammo. If loading a new type of ammo use IsChangingAmmo
/// </summary>
public bool IsReloadingAmmo
{
get
{
if (!_isReloadingAmmo.HasValue)
_isReloadingAmmo = this["reloadingAmmo"].GetValueAs<bool>();
return _isReloadingAmmo.Value;
}
}
#endregion
public void ChangeAmmo(EveItem charge)
{
//if (charge._itemId <= 0L)
// return;
//this.CallMethod("ChangeAmmoType", new object[] { charge.TypeId, charge.Stacksize }, true);
}
#region IsChangingAmmo
bool? _isChangingAmmo;
/// <summary>
/// Is the module changing ammo
/// </summary>
public bool IsChangingAmmo
{
get
{
if (!_isChangingAmmo.HasValue)
_isChangingAmmo = this["changingAmmo"].GetValueAs<bool>();
return _isChangingAmmo.Value;
}
}
#endregion
#region IsActive
bool? _isActive;
/// <summary>
/// Is the module active
/// </summary>
public bool IsActive
{
get
{
if (!_isActive.HasValue)
_isActive = this["def_effect"]["isActive"].GetValueAs<bool>();
return _isActive.Value;
}
}
#endregion
#region IsDeactivating
bool? _isDeactivating;
/// <summary>
/// Is the module deactivating
/// </summary>
public bool IsDeactivating
{
get
{
if (!_isDeactivating.HasValue)
_isDeactivating = this["def_effect"]["isDeactivating"].GetValueAs<bool>();
return _isDeactivating.Value;
}
}
#endregion
public void Activate()
{
if (!this.IsActive && !this.IsDeactivating && !this.IsChangingAmmo && !this.IsReloadingAmmo && !this.IsGoingOnline && this.IsOnline)
this.CallMethod("ActivateEffect", new object[] { this["def_effect"] }, true);
}
public void Activate(long targetId)
{
if (!this.IsActive && !this.IsDeactivating && !this.IsChangingAmmo && !this.IsReloadingAmmo && !this.IsGoingOnline && this.IsOnline)
this.CallMethod("ActivateEffect", new object[] { this["def_effect"], targetId }, true);
}
public void DeActivate()
{
if (this.IsActive && !this.IsDeactivating && !this.IsChangingAmmo && !this.IsReloadingAmmo && !this.IsGoingOnline && this.IsOnline)
this.CallMethod("DeactivateEffect", new object[] { this["def_effect"] }, true);
}
}
}