h1z1-server 0.45.0 → 0.45.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h1z1-server",
3
- "version": "0.45.0",
3
+ "version": "0.45.1",
4
4
  "description": "Library for emulating h1z1 servers",
5
5
  "author": "Quentin Gruber <quentingruber@gmail.com> (http://github.com/quentingruber)",
6
6
  "license": "GPL-3.0-only",
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@types/js-yaml": "4.0.9",
17
- "@types/node": "22.13.13",
18
- "@types/ws": "8.18.0",
17
+ "@types/node": "22.14.1",
18
+ "@types/ws": "8.18.1",
19
19
  "debug": "4.4.0",
20
20
  "h1emu-ai": "0.0.8",
21
21
  "h1emu-core": "1.3.2",
@@ -24,19 +24,19 @@
24
24
  "mongodb": "6.15.0",
25
25
  "recast-navigation": "0.34.0",
26
26
  "threads": "1.7.0",
27
- "typescript": "5.8.2",
27
+ "typescript": "5.8.3",
28
28
  "ws": "8.18.1"
29
29
  },
30
30
  "directories": {
31
31
  "src": "./src"
32
32
  },
33
33
  "devDependencies": {
34
- "oxlint": "^0.16.3",
35
34
  "cross-env": "^7.0.3",
36
35
  "globals": "^16.0.0",
36
+ "oxlint": "^0.16.6",
37
37
  "prettier": "^3.5.3",
38
38
  "tsx": "^4.19.3",
39
- "typedoc": "^0.28.1"
39
+ "typedoc": "^0.28.2"
40
40
  },
41
41
  "scripts": {
42
42
  "gen-packets-types": "tsx ./scripts/genPacketsNames.ts",
@@ -32,7 +32,9 @@ export enum ChallengeType {
32
32
  GLOBAL_DISARMAMENT,
33
33
  ROCKY,
34
34
  ROCKSTAR,
35
- IED
35
+ IED,
36
+ RANCHITO,
37
+ SWIZZLE
36
38
  }
37
39
  export enum ChallengeStatus {
38
40
  CURRENT = 1,
@@ -102,6 +104,14 @@ export class ChallengeManager {
102
104
  neededPoints: 1,
103
105
  pvpOnly: false
104
106
  },
107
+ {
108
+ type: ChallengeType.RANCHITO,
109
+ difficulty: ChallengeDifficulty.EASY,
110
+ name: "Wait... Why am i here again?",
111
+ description: "Visit Ranchito",
112
+ neededPoints: 1,
113
+ pvpOnly: false
114
+ },
105
115
  {
106
116
  type: ChallengeType.BRAIN_DEAD,
107
117
  difficulty: ChallengeDifficulty.MEDIUM,
@@ -151,6 +161,14 @@ export class ChallengeManager {
151
161
  neededPoints: 1,
152
162
  pvpOnly: false
153
163
  },
164
+ {
165
+ type: ChallengeType.SWIZZLE,
166
+ difficulty: ChallengeDifficulty.MEDIUM,
167
+ name: "Shady buisness",
168
+ description: "Consume some swizzle",
169
+ neededPoints: 1,
170
+ pvpOnly: false
171
+ },
154
172
  {
155
173
  type: ChallengeType.PV_PD_SURVIVAL,
156
174
  difficulty: ChallengeDifficulty.HARD,
@@ -333,14 +351,12 @@ export class ChallengeManager {
333
351
  }
334
352
 
335
353
  async affectChallenge(client: ZoneClient2016) {
336
- const today = new Date();
337
- const timeZoneOffset = today.getTimezoneOffset() * 60000; // Convert minutes to milliseconds
338
354
  const now = Date.now();
339
355
 
340
- const startOfDay = new Date(now - timeZoneOffset);
356
+ const startOfDay = new Date(now);
341
357
  startOfDay.setHours(0, 0, 0, 0);
342
358
 
343
- const endOfDay = new Date(now - timeZoneOffset);
359
+ const endOfDay = new Date(now);
344
360
  endOfDay.setHours(23, 59, 59, 999);
345
361
 
346
362
  const challengesToday = await this.challengesCollection
@@ -371,8 +387,8 @@ export class ChallengeManager {
371
387
  }
372
388
  const challengesAvailable = this.challenges.filter((v) => {
373
389
  return (
374
- ((!challengesTypesDoneToday.includes(v.type) && !v.pvpOnly) ||
375
- !this.server.isPvE) &&
390
+ !challengesTypesDoneToday.includes(v.type) &&
391
+ (!v.pvpOnly || !this.server.isPvE) &&
376
392
  v.difficulty === nextDifficultyChallenge
377
393
  );
378
394
  });
@@ -517,27 +517,32 @@ export class CraftManager {
517
517
  client.character.lootItem(server, server.generateItem(id, 1));
518
518
  });
519
519
  }
520
- if (recipeId === Items.IED) {
521
- server.challengeManager.registerChallengeProgression(
522
- client,
523
- ChallengeType.IED,
524
- 1
525
- );
526
- }
527
- if (recipeId === Items.FOUNDATION) {
528
- server.challengeManager.registerChallengeProgression(
529
- client,
530
- ChallengeType.MY_LAND,
531
- 1
532
- );
533
- }
534
- if (recipeId === Items.SHACK) {
535
- server.challengeManager.registerChallengeProgression(
536
- client,
537
- ChallengeType.MY_HOME,
538
- 1
539
- );
520
+ switch (recipeId) {
521
+ case Items.IED:
522
+ server.challengeManager.registerChallengeProgression(
523
+ client,
524
+ ChallengeType.IED,
525
+ 1
526
+ );
527
+ break;
528
+
529
+ case Items.FOUNDATION:
530
+ server.challengeManager.registerChallengeProgression(
531
+ client,
532
+ ChallengeType.MY_LAND,
533
+ 1
534
+ );
535
+ break;
536
+
537
+ case Items.SHACK:
538
+ server.challengeManager.registerChallengeProgression(
539
+ client,
540
+ ChallengeType.MY_HOME,
541
+ 1
542
+ );
543
+ break;
540
544
  }
545
+
541
546
  return true;
542
547
  //#endregion
543
548
  }
@@ -23,7 +23,6 @@ interface WeightedItem {
23
23
  export class RandomEventsManager {
24
24
  interval?: NodeJS.Timeout;
25
25
  // managed by config
26
- // TODO:
27
26
  enabled: boolean = true;
28
27
  constructor(public server: ZoneServer2016) {}
29
28
  start() {
@@ -61,7 +60,6 @@ export class RandomEventsManager {
61
60
  { value: "Supplier", weight: 20 }
62
61
  ];
63
62
  const airdropType = this.weightedRandom(airdropTypes);
64
- console.log(airdropType);
65
63
  this.server.spawnAirdrop(pos, airdropType);
66
64
  const cellName = getCellName(cellIndex, 10);
67
65
  this.server.sendAlertToAll(`Random airdrop on ${cellName}`);
@@ -523,6 +523,16 @@ export class WorldObjectManager {
523
523
  effectTime: 60
524
524
  }
525
525
  );
526
+
527
+ if (
528
+ isPosInRadius(
529
+ 3,
530
+ c.character.state.position,
531
+ server._airdrop.destinationPos
532
+ )
533
+ ) {
534
+ server.killCharacter(c, { damage: 99999, entity: "aidrop" });
535
+ }
526
536
  }
527
537
  }
528
538
  server._lootbags[characterId] = lootbag;
@@ -1948,7 +1948,10 @@ export class ZoneServer2016 extends EventEmitter {
1948
1948
  const start = performance.now();
1949
1949
  this.aiManager.run();
1950
1950
  const end = performance.now();
1951
- console.log(`H1emu-ai took ${end - start}ms`);
1951
+ const duration = end - start;
1952
+ if (duration >= 1) {
1953
+ console.log(`H1emu-ai took ${duration}ms`);
1954
+ }
1952
1955
  } else {
1953
1956
  this.aiManager.run();
1954
1957
  }
@@ -4212,6 +4215,13 @@ export class ZoneServer2016 extends EventEmitter {
4212
4215
  id: point.POIid
4213
4216
  });
4214
4217
  client.currentPOI = point.stringId;
4218
+ if (point.POIid === 13) {
4219
+ this.challengeManager.registerChallengeProgression(
4220
+ client,
4221
+ ChallengeType.RANCHITO,
4222
+ 1
4223
+ );
4224
+ }
4215
4225
  }
4216
4226
  }
4217
4227
  });
@@ -7379,6 +7389,11 @@ export class ZoneServer2016 extends EventEmitter {
7379
7389
  sniffPass(client: Client, character: BaseFullCharacter, item: BaseItem) {
7380
7390
  if (!this.removeInventoryItem(character, item)) return;
7381
7391
  if (item.itemDefinitionId === Items.SWIZZLE) {
7392
+ this.challengeManager.registerChallengeProgression(
7393
+ client,
7394
+ ChallengeType.SWIZZLE,
7395
+ 1
7396
+ );
7382
7397
  this.applyMovementModifier(client, MovementModifiers.SWIZZLE);
7383
7398
  } else {
7384
7399
  this.applyMovementModifier(client, MovementModifiers.ADRENALINE);