@shipload/sdk 1.0.0-next.32 → 1.0.0-next.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/testing.js CHANGED
@@ -3174,7 +3174,7 @@ var items = [
3174
3174
  },
3175
3175
  {
3176
3176
  id: 10002,
3177
- mass: 6000,
3177
+ mass: 4000,
3178
3178
  type: "component",
3179
3179
  tier: 1
3180
3180
  },
@@ -3186,13 +3186,13 @@ var items = [
3186
3186
  },
3187
3187
  {
3188
3188
  id: 10004,
3189
- mass: 6000,
3189
+ mass: 4000,
3190
3190
  type: "component",
3191
3191
  tier: 1
3192
3192
  },
3193
3193
  {
3194
3194
  id: 10005,
3195
- mass: 6000,
3195
+ mass: 4000,
3196
3196
  type: "component",
3197
3197
  tier: 1
3198
3198
  },
@@ -3216,106 +3216,106 @@ var items = [
3216
3216
  },
3217
3217
  {
3218
3218
  id: 10009,
3219
- mass: 6000,
3219
+ mass: 4000,
3220
3220
  type: "component",
3221
3221
  tier: 1
3222
3222
  },
3223
3223
  {
3224
3224
  id: 10010,
3225
- mass: 6000,
3225
+ mass: 4000,
3226
3226
  type: "component",
3227
3227
  tier: 1
3228
3228
  },
3229
3229
  {
3230
3230
  id: 10100,
3231
- mass: 900000,
3231
+ mass: 960000,
3232
3232
  type: "module",
3233
3233
  tier: 1,
3234
3234
  subtype: "engine"
3235
3235
  },
3236
3236
  {
3237
3237
  id: 10101,
3238
- mass: 1400000,
3238
+ mass: 960000,
3239
3239
  type: "module",
3240
3240
  tier: 1,
3241
3241
  subtype: "generator"
3242
3242
  },
3243
3243
  {
3244
3244
  id: 10102,
3245
- mass: 1200000,
3245
+ mass: 960000,
3246
3246
  type: "module",
3247
3247
  tier: 1,
3248
3248
  subtype: "gatherer"
3249
3249
  },
3250
3250
  {
3251
3251
  id: 10103,
3252
- mass: 1000000,
3252
+ mass: 960000,
3253
3253
  type: "module",
3254
3254
  tier: 1,
3255
3255
  subtype: "loader"
3256
3256
  },
3257
3257
  {
3258
3258
  id: 10104,
3259
- mass: 1200000,
3259
+ mass: 960000,
3260
3260
  type: "module",
3261
3261
  tier: 1,
3262
3262
  subtype: "crafter"
3263
3263
  },
3264
3264
  {
3265
3265
  id: 10105,
3266
- mass: 1200000,
3266
+ mass: 960000,
3267
3267
  type: "module",
3268
3268
  tier: 1,
3269
3269
  subtype: "storage"
3270
3270
  },
3271
3271
  {
3272
3272
  id: 10106,
3273
- mass: 1400000,
3273
+ mass: 960000,
3274
3274
  type: "module",
3275
3275
  tier: 1,
3276
3276
  subtype: "hauler"
3277
3277
  },
3278
3278
  {
3279
3279
  id: 10107,
3280
- mass: 1400000,
3280
+ mass: 960000,
3281
3281
  type: "module",
3282
3282
  tier: 1,
3283
3283
  subtype: "warp"
3284
3284
  },
3285
3285
  {
3286
3286
  id: 10108,
3287
- mass: 1000000,
3287
+ mass: 960000,
3288
3288
  type: "module",
3289
3289
  tier: 1,
3290
3290
  subtype: "battery"
3291
3291
  },
3292
3292
  {
3293
3293
  id: 10200,
3294
- mass: 1500000,
3294
+ mass: 1300000,
3295
3295
  type: "entity",
3296
3296
  tier: 1
3297
3297
  },
3298
3298
  {
3299
3299
  id: 10201,
3300
- mass: 2300000,
3300
+ mass: 1900000,
3301
3301
  type: "entity",
3302
3302
  tier: 1
3303
3303
  },
3304
3304
  {
3305
3305
  id: 10202,
3306
- mass: 5800000,
3306
+ mass: 4800000,
3307
3307
  type: "entity",
3308
3308
  tier: 1
3309
3309
  },
3310
3310
  {
3311
3311
  id: 10203,
3312
- mass: 4400000,
3312
+ mass: 3700000,
3313
3313
  type: "entity",
3314
3314
  tier: 1
3315
3315
  },
3316
3316
  {
3317
3317
  id: 10204,
3318
- mass: 5500000,
3318
+ mass: 4600000,
3319
3319
  type: "entity",
3320
3320
  tier: 1
3321
3321
  },
package/lib/testing.m.js CHANGED
@@ -3170,7 +3170,7 @@ var items = [
3170
3170
  },
3171
3171
  {
3172
3172
  id: 10002,
3173
- mass: 6000,
3173
+ mass: 4000,
3174
3174
  type: "component",
3175
3175
  tier: 1
3176
3176
  },
@@ -3182,13 +3182,13 @@ var items = [
3182
3182
  },
3183
3183
  {
3184
3184
  id: 10004,
3185
- mass: 6000,
3185
+ mass: 4000,
3186
3186
  type: "component",
3187
3187
  tier: 1
3188
3188
  },
3189
3189
  {
3190
3190
  id: 10005,
3191
- mass: 6000,
3191
+ mass: 4000,
3192
3192
  type: "component",
3193
3193
  tier: 1
3194
3194
  },
@@ -3212,106 +3212,106 @@ var items = [
3212
3212
  },
3213
3213
  {
3214
3214
  id: 10009,
3215
- mass: 6000,
3215
+ mass: 4000,
3216
3216
  type: "component",
3217
3217
  tier: 1
3218
3218
  },
3219
3219
  {
3220
3220
  id: 10010,
3221
- mass: 6000,
3221
+ mass: 4000,
3222
3222
  type: "component",
3223
3223
  tier: 1
3224
3224
  },
3225
3225
  {
3226
3226
  id: 10100,
3227
- mass: 900000,
3227
+ mass: 960000,
3228
3228
  type: "module",
3229
3229
  tier: 1,
3230
3230
  subtype: "engine"
3231
3231
  },
3232
3232
  {
3233
3233
  id: 10101,
3234
- mass: 1400000,
3234
+ mass: 960000,
3235
3235
  type: "module",
3236
3236
  tier: 1,
3237
3237
  subtype: "generator"
3238
3238
  },
3239
3239
  {
3240
3240
  id: 10102,
3241
- mass: 1200000,
3241
+ mass: 960000,
3242
3242
  type: "module",
3243
3243
  tier: 1,
3244
3244
  subtype: "gatherer"
3245
3245
  },
3246
3246
  {
3247
3247
  id: 10103,
3248
- mass: 1000000,
3248
+ mass: 960000,
3249
3249
  type: "module",
3250
3250
  tier: 1,
3251
3251
  subtype: "loader"
3252
3252
  },
3253
3253
  {
3254
3254
  id: 10104,
3255
- mass: 1200000,
3255
+ mass: 960000,
3256
3256
  type: "module",
3257
3257
  tier: 1,
3258
3258
  subtype: "crafter"
3259
3259
  },
3260
3260
  {
3261
3261
  id: 10105,
3262
- mass: 1200000,
3262
+ mass: 960000,
3263
3263
  type: "module",
3264
3264
  tier: 1,
3265
3265
  subtype: "storage"
3266
3266
  },
3267
3267
  {
3268
3268
  id: 10106,
3269
- mass: 1400000,
3269
+ mass: 960000,
3270
3270
  type: "module",
3271
3271
  tier: 1,
3272
3272
  subtype: "hauler"
3273
3273
  },
3274
3274
  {
3275
3275
  id: 10107,
3276
- mass: 1400000,
3276
+ mass: 960000,
3277
3277
  type: "module",
3278
3278
  tier: 1,
3279
3279
  subtype: "warp"
3280
3280
  },
3281
3281
  {
3282
3282
  id: 10108,
3283
- mass: 1000000,
3283
+ mass: 960000,
3284
3284
  type: "module",
3285
3285
  tier: 1,
3286
3286
  subtype: "battery"
3287
3287
  },
3288
3288
  {
3289
3289
  id: 10200,
3290
- mass: 1500000,
3290
+ mass: 1300000,
3291
3291
  type: "entity",
3292
3292
  tier: 1
3293
3293
  },
3294
3294
  {
3295
3295
  id: 10201,
3296
- mass: 2300000,
3296
+ mass: 1900000,
3297
3297
  type: "entity",
3298
3298
  tier: 1
3299
3299
  },
3300
3300
  {
3301
3301
  id: 10202,
3302
- mass: 5800000,
3302
+ mass: 4800000,
3303
3303
  type: "entity",
3304
3304
  tier: 1
3305
3305
  },
3306
3306
  {
3307
3307
  id: 10203,
3308
- mass: 4400000,
3308
+ mass: 3700000,
3309
3309
  type: "entity",
3310
3310
  tier: 1
3311
3311
  },
3312
3312
  {
3313
3313
  id: 10204,
3314
- mass: 5500000,
3314
+ mass: 4600000,
3315
3315
  type: "entity",
3316
3316
  tier: 1
3317
3317
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipload/sdk",
3
3
  "description": "SDKs for Shipload",
4
- "version": "1.0.0-next.32",
4
+ "version": "1.0.0-next.33",
5
5
  "homepage": "https://github.com/shipload/toolkit/tree/master/packages/sdk",
6
6
  "repository": {
7
7
  "type": "git",
@@ -6,23 +6,33 @@ const GATHER_TIME_SCALE = 100
6
6
  const GATHER_MASS_DIVISOR = 228
7
7
  const DEPTH_PENALTY_DIVISOR = 5000
8
8
 
9
- export function calc_gather_duration(
9
+ function gather_duration_raw(
10
10
  gatherer: ServerContract.Types.gatherer_stats,
11
11
  itemMass: number,
12
12
  quantity: number,
13
13
  stratum: number,
14
14
  richness: number
15
- ): UInt32 {
15
+ ): number {
16
16
  const yieldValue = gatherer.yield.toNumber()
17
17
 
18
- if (yieldValue === 0 || richness === 0) return UInt32.from(0)
18
+ if (yieldValue === 0 || richness === 0) return 0
19
19
 
20
20
  const massFactor = itemMass / GATHER_MASS_DIVISOR
21
21
  const depthPenalty = 1 + stratum / DEPTH_PENALTY_DIVISOR
22
22
  const richnessMul = richness / 1000
23
- const duration =
24
- (quantity * massFactor * GATHER_TIME_SCALE * depthPenalty) / (yieldValue * richnessMul)
25
- return UInt32.from(Math.floor(duration))
23
+ return (quantity * massFactor * GATHER_TIME_SCALE * depthPenalty) / (yieldValue * richnessMul)
24
+ }
25
+
26
+ export function calc_gather_duration(
27
+ gatherer: ServerContract.Types.gatherer_stats,
28
+ itemMass: number,
29
+ quantity: number,
30
+ stratum: number,
31
+ richness: number
32
+ ): UInt32 {
33
+ return UInt32.from(
34
+ Math.floor(gather_duration_raw(gatherer, itemMass, quantity, stratum, richness))
35
+ )
26
36
  }
27
37
 
28
38
  export function calc_gather_rate(
@@ -31,10 +41,10 @@ export function calc_gather_rate(
31
41
  stratum: number,
32
42
  richness: number
33
43
  ): {unitsPerSec: number; unitsPerMin: number; secPerUnit: number} {
34
- const seconds = calc_gather_duration(gatherer, itemMass, 1, stratum, richness).toNumber()
35
- if (seconds <= 0) return {unitsPerSec: 0, unitsPerMin: 0, secPerUnit: 0}
36
- const unitsPerSec = 1 / seconds
37
- return {unitsPerSec, unitsPerMin: unitsPerSec * 60, secPerUnit: seconds}
44
+ const secPerUnit = gather_duration_raw(gatherer, itemMass, 1, stratum, richness)
45
+ if (secPerUnit <= 0) return {unitsPerSec: 0, unitsPerMin: 0, secPerUnit: 0}
46
+ const unitsPerSec = 1 / secPerUnit
47
+ return {unitsPerSec, unitsPerMin: unitsPerSec * 60, secPerUnit}
38
48
  }
39
49
 
40
50
  export function calc_gather_energy(
@@ -357,7 +357,7 @@
357
357
  },
358
358
  {
359
359
  "id": 10002,
360
- "mass": 6000,
360
+ "mass": 4000,
361
361
  "type": "component",
362
362
  "tier": 1
363
363
  },
@@ -369,13 +369,13 @@
369
369
  },
370
370
  {
371
371
  "id": 10004,
372
- "mass": 6000,
372
+ "mass": 4000,
373
373
  "type": "component",
374
374
  "tier": 1
375
375
  },
376
376
  {
377
377
  "id": 10005,
378
- "mass": 6000,
378
+ "mass": 4000,
379
379
  "type": "component",
380
380
  "tier": 1
381
381
  },
@@ -399,106 +399,106 @@
399
399
  },
400
400
  {
401
401
  "id": 10009,
402
- "mass": 6000,
402
+ "mass": 4000,
403
403
  "type": "component",
404
404
  "tier": 1
405
405
  },
406
406
  {
407
407
  "id": 10010,
408
- "mass": 6000,
408
+ "mass": 4000,
409
409
  "type": "component",
410
410
  "tier": 1
411
411
  },
412
412
  {
413
413
  "id": 10100,
414
- "mass": 900000,
414
+ "mass": 960000,
415
415
  "type": "module",
416
416
  "tier": 1,
417
417
  "subtype": "engine"
418
418
  },
419
419
  {
420
420
  "id": 10101,
421
- "mass": 1400000,
421
+ "mass": 960000,
422
422
  "type": "module",
423
423
  "tier": 1,
424
424
  "subtype": "generator"
425
425
  },
426
426
  {
427
427
  "id": 10102,
428
- "mass": 1200000,
428
+ "mass": 960000,
429
429
  "type": "module",
430
430
  "tier": 1,
431
431
  "subtype": "gatherer"
432
432
  },
433
433
  {
434
434
  "id": 10103,
435
- "mass": 1000000,
435
+ "mass": 960000,
436
436
  "type": "module",
437
437
  "tier": 1,
438
438
  "subtype": "loader"
439
439
  },
440
440
  {
441
441
  "id": 10104,
442
- "mass": 1200000,
442
+ "mass": 960000,
443
443
  "type": "module",
444
444
  "tier": 1,
445
445
  "subtype": "crafter"
446
446
  },
447
447
  {
448
448
  "id": 10105,
449
- "mass": 1200000,
449
+ "mass": 960000,
450
450
  "type": "module",
451
451
  "tier": 1,
452
452
  "subtype": "storage"
453
453
  },
454
454
  {
455
455
  "id": 10106,
456
- "mass": 1400000,
456
+ "mass": 960000,
457
457
  "type": "module",
458
458
  "tier": 1,
459
459
  "subtype": "hauler"
460
460
  },
461
461
  {
462
462
  "id": 10107,
463
- "mass": 1400000,
463
+ "mass": 960000,
464
464
  "type": "module",
465
465
  "tier": 1,
466
466
  "subtype": "warp"
467
467
  },
468
468
  {
469
469
  "id": 10108,
470
- "mass": 1000000,
470
+ "mass": 960000,
471
471
  "type": "module",
472
472
  "tier": 1,
473
473
  "subtype": "battery"
474
474
  },
475
475
  {
476
476
  "id": 10200,
477
- "mass": 1500000,
477
+ "mass": 1300000,
478
478
  "type": "entity",
479
479
  "tier": 1
480
480
  },
481
481
  {
482
482
  "id": 10201,
483
- "mass": 2300000,
483
+ "mass": 1900000,
484
484
  "type": "entity",
485
485
  "tier": 1
486
486
  },
487
487
  {
488
488
  "id": 10202,
489
- "mass": 5800000,
489
+ "mass": 4800000,
490
490
  "type": "entity",
491
491
  "tier": 1
492
492
  },
493
493
  {
494
494
  "id": 10203,
495
- "mass": 4400000,
495
+ "mass": 3700000,
496
496
  "type": "entity",
497
497
  "tier": 1
498
498
  },
499
499
  {
500
500
  "id": 10204,
501
- "mass": 5500000,
501
+ "mass": 4600000,
502
502
  "type": "entity",
503
503
  "tier": 1
504
504
  },