forked from CWX/CWX-mods
added ability to config key in masterkey, added blacklist removal for dev mask to debugtool
This commit is contained in:
parent
4ffd4ce6d7
commit
84e91c46ae
14
Live/CWX_DebugTool/dist/src/logging.ts
vendored
14
Live/CWX_DebugTool/dist/src/logging.ts
vendored
@ -37,6 +37,7 @@ export class CWX_Logging
|
||||
// items
|
||||
this.changeShrapProps();
|
||||
this.changeMaxAmmoForKS23();
|
||||
this.removeDevFromBlacklist();
|
||||
|
||||
}
|
||||
|
||||
@ -104,7 +105,7 @@ export class CWX_Logging
|
||||
}
|
||||
}
|
||||
|
||||
private changeShrapProps():void
|
||||
private changeShrapProps(): void
|
||||
{
|
||||
if (this.config.itemsConfig.changeShrapProps)
|
||||
{
|
||||
@ -112,11 +113,20 @@ export class CWX_Logging
|
||||
}
|
||||
}
|
||||
|
||||
private changeMaxAmmoForKS23():void
|
||||
private changeMaxAmmoForKS23(): void
|
||||
{
|
||||
if (this.config.itemsConfig.changeMaxAmmoForKS23)
|
||||
{
|
||||
this.logger.info("Change Max Ammo For KS23 Activated");
|
||||
}
|
||||
}
|
||||
|
||||
private removeDevFromBlacklist(): void
|
||||
{
|
||||
if (this.config.itemsConfig.removeDevFromBlacklist)
|
||||
{
|
||||
this.logger.info("Remove Dev From Blacklist Activated");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -37,6 +37,7 @@ export class CWX_Logging
|
||||
// items
|
||||
this.changeShrapProps();
|
||||
this.changeMaxAmmoForKS23();
|
||||
this.removeDevFromBlacklist();
|
||||
|
||||
}
|
||||
|
||||
@ -104,7 +105,7 @@ export class CWX_Logging
|
||||
}
|
||||
}
|
||||
|
||||
private changeShrapProps():void
|
||||
private changeShrapProps(): void
|
||||
{
|
||||
if (this.config.itemsConfig.changeShrapProps)
|
||||
{
|
||||
@ -112,11 +113,20 @@ export class CWX_Logging
|
||||
}
|
||||
}
|
||||
|
||||
private changeMaxAmmoForKS23():void
|
||||
private changeMaxAmmoForKS23(): void
|
||||
{
|
||||
if (this.config.itemsConfig.changeMaxAmmoForKS23)
|
||||
{
|
||||
this.logger.info("Change Max Ammo For KS23 Activated");
|
||||
}
|
||||
}
|
||||
|
||||
private removeDevFromBlacklist(): void
|
||||
{
|
||||
if (this.config.itemsConfig.removeDevFromBlacklist)
|
||||
{
|
||||
this.logger.info("Remove Dev From Blacklist Activated");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
@ -1,11 +0,0 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||
|
||||
class CWX_MasterKey implements IPreAkiLoadMod
|
||||
{
|
||||
public preAkiLoad(container: DependencyContainer): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { mod: new CWX_MasterKey() }
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "MasterKey",
|
||||
"author": "CWX",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.6",
|
||||
"license": "NCSA",
|
||||
"main": "src/mod.js",
|
||||
"akiVersion": "3.2.3",
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"keyId": "5c1d0d6d86f7744bb2683e1f"
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||
import { DynamicRouterModService } from "@spt-aki/services/mod/dynamicRouter/DynamicRouterModService";
|
||||
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||
|
||||
class CWX_MasterKey implements IPreAkiLoadMod
|
||||
{
|
||||
|
||||
private router: DynamicRouterModService;
|
||||
private cfg;
|
||||
private http: HttpResponseUtil;
|
||||
|
||||
public preAkiLoad(container: DependencyContainer): void
|
||||
{
|
||||
this.router = container.resolve<DynamicRouterModService>("DynamicRouterModService");
|
||||
this.http = container.resolve<HttpResponseUtil>("HttpResponseUtil");
|
||||
this.cfg = require("./config.json");
|
||||
|
||||
this.addRoute();
|
||||
}
|
||||
|
||||
private addRoute() : void
|
||||
{
|
||||
this.router.registerDynamicRouter(
|
||||
"MasterKey",
|
||||
[
|
||||
{
|
||||
url: "/cwx/masterkey",
|
||||
action: (url, info, sessionId, output) =>
|
||||
{
|
||||
return this.onRequestConfig();
|
||||
}
|
||||
}
|
||||
],
|
||||
"MasterKey"
|
||||
)
|
||||
}
|
||||
|
||||
private onRequestConfig(): any
|
||||
{
|
||||
if (typeof this.cfg.keyId !== "string")
|
||||
{
|
||||
return this.http.noBody({ keyId: "5c1d0d6d86f7744bb2683e1f" });
|
||||
}
|
||||
|
||||
return this.http.noBody({ keyId: this.cfg.keyId});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { mod: new CWX_MasterKey() }
|
7
Live/CWX_MasterKey/ConfigClass.cs
Normal file
7
Live/CWX_MasterKey/ConfigClass.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace CWX_MasterKey
|
||||
{
|
||||
public class ConfigClass
|
||||
{
|
||||
public string keyId { get; set; }
|
||||
}
|
||||
}
|
@ -2,49 +2,95 @@
|
||||
using EFT.Interactive;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using Aki.Common.Http;
|
||||
using Aki.Common.Utils;
|
||||
|
||||
namespace CWX_MasterKey
|
||||
{
|
||||
public static class MasterKey
|
||||
{
|
||||
static object lockObject = new object();
|
||||
|
||||
// Black, Blue, Green, Red, Yellow, Violet
|
||||
static string[] keys = new string[] { "5c1d0f4986f7744bb01837fa", "5c1d0c5f86f7744bb2683cf0", "5c1d0dc586f7744baf2e7b79", "5c1d0efb86f7744baf2e7b7b", "5c1d0d6d86f7744bb2683e1f", "5c1e495a86f7743109743dfb" };
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
var allDoors = GameObject.FindObjectsOfType<Door>().ToList(); // mechanical doors
|
||||
var allKeyCardDoors = GameObject.FindObjectsOfType<KeycardDoor>().ToList(); // keycard doors
|
||||
var allKeyContainers = GameObject.FindObjectsOfType<LootableContainer>().ToList(); // locked loot containers
|
||||
var allTrunks = GameObject.FindObjectsOfType<Trunk>().ToList(); // locked car trunks
|
||||
ConfigClass config = new ConfigClass();
|
||||
bool lockWasTaken = false;
|
||||
|
||||
foreach (var door in allDoors) // mechanical doors
|
||||
string keyToUse = "5c1d0d6d86f7744bb2683e1f";
|
||||
|
||||
try
|
||||
{
|
||||
if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty())
|
||||
Monitor.Enter(lockObject, ref lockWasTaken);
|
||||
|
||||
config = GetConfig();
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
door.KeyId = "5c1d0d6d86f7744bb2683e1f";
|
||||
Debug.LogError("[CWX_Masterkey] Issue happened whilst getting config from server");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (lockWasTaken)
|
||||
{
|
||||
Monitor.Exit(lockObject);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var door in allKeyCardDoors) // keycard doors
|
||||
if (keys.Any(x => x == config.keyId))
|
||||
{
|
||||
keyToUse = config.keyId;
|
||||
}
|
||||
|
||||
List<Door> allDoors = GameObject.FindObjectsOfType<Door>().ToList(); // mechanical doors
|
||||
List<KeycardDoor> allKeyCardDoors = GameObject.FindObjectsOfType<KeycardDoor>().ToList(); // keycard doors
|
||||
List<LootableContainer> allKeyContainers = GameObject.FindObjectsOfType<LootableContainer>().ToList(); // locked loot containers
|
||||
List<Trunk> allTrunks = GameObject.FindObjectsOfType<Trunk>().ToList(); // locked car trunks
|
||||
|
||||
foreach (Door door in allDoors) // mechanical doors
|
||||
{
|
||||
if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty())
|
||||
{
|
||||
door.KeyId = "5c1d0d6d86f7744bb2683e1f";
|
||||
door.KeyId = keyToUse;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var door in allKeyContainers) // locked loot containers
|
||||
foreach (KeycardDoor door in allKeyCardDoors) // keycard doors
|
||||
{
|
||||
if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty())
|
||||
{
|
||||
door.KeyId = "5c1d0d6d86f7744bb2683e1f";
|
||||
door.KeyId = keyToUse;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var door in allTrunks) // locked car trunks
|
||||
foreach (LootableContainer door in allKeyContainers) // locked loot containers
|
||||
{
|
||||
if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty())
|
||||
{
|
||||
door.KeyId = "5c1d0d6d86f7744bb2683e1f";
|
||||
door.KeyId = keyToUse;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Trunk door in allTrunks) // locked car trunks
|
||||
{
|
||||
if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty())
|
||||
{
|
||||
door.KeyId = keyToUse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ConfigClass GetConfig()
|
||||
{
|
||||
var json = RequestHandler.GetJson($"/cwx/masterkey");
|
||||
var jsonClass = Json.Deserialize<ConfigClass>(json);
|
||||
|
||||
return jsonClass;
|
||||
}
|
||||
}
|
||||
}
|
2
Live/CWX_MasterKey/server/dist/package.json
vendored
2
Live/CWX_MasterKey/server/dist/package.json
vendored
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "MasterKey",
|
||||
"author": "CWX",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.6",
|
||||
"license": "NCSA",
|
||||
"main": "src/mod.js",
|
||||
"akiVersion": "3.2.3",
|
||||
|
3
Live/CWX_MasterKey/server/dist/src/config.json
vendored
Normal file
3
Live/CWX_MasterKey/server/dist/src/config.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"keyId": "5c1d0d6d86f7744bb2683e1f"
|
||||
}
|
39
Live/CWX_MasterKey/server/dist/src/mod.ts
vendored
39
Live/CWX_MasterKey/server/dist/src/mod.ts
vendored
@ -1,10 +1,49 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||
import { DynamicRouterModService } from "@spt-aki/services/mod/dynamicRouter/DynamicRouterModService";
|
||||
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||
|
||||
class CWX_MasterKey implements IPreAkiLoadMod
|
||||
{
|
||||
|
||||
private router: DynamicRouterModService;
|
||||
private cfg;
|
||||
private http: HttpResponseUtil;
|
||||
|
||||
public preAkiLoad(container: DependencyContainer): void
|
||||
{
|
||||
this.router = container.resolve<DynamicRouterModService>("DynamicRouterModService");
|
||||
this.http = container.resolve<HttpResponseUtil>("HttpResponseUtil");
|
||||
this.cfg = require("./config.json");
|
||||
|
||||
this.addRoute();
|
||||
}
|
||||
|
||||
private addRoute() : void
|
||||
{
|
||||
this.router.registerDynamicRouter(
|
||||
"MasterKey",
|
||||
[
|
||||
{
|
||||
url: "/cwx/masterkey",
|
||||
action: (url, info, sessionId, output) =>
|
||||
{
|
||||
return this.onRequestConfig();
|
||||
}
|
||||
}
|
||||
],
|
||||
"MasterKey"
|
||||
)
|
||||
}
|
||||
|
||||
private onRequestConfig(): any
|
||||
{
|
||||
if (typeof this.cfg.keyId !== "string")
|
||||
{
|
||||
return this.http.noBody({ keyId: "5c1d0d6d86f7744bb2683e1f" });
|
||||
}
|
||||
|
||||
return this.http.noBody({ keyId: this.cfg.keyId});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "MasterKey",
|
||||
"author": "CWX",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.6",
|
||||
"license": "NCSA",
|
||||
"main": "src/mod.js",
|
||||
"akiVersion": "3.2.3",
|
||||
|
3
Live/CWX_MasterKey/server/src/config.json
Normal file
3
Live/CWX_MasterKey/server/src/config.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"keyId": "5c1d0d6d86f7744bb2683e1f"
|
||||
}
|
@ -1,10 +1,49 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||
import { DynamicRouterModService } from "@spt-aki/services/mod/dynamicRouter/DynamicRouterModService";
|
||||
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||
|
||||
class CWX_MasterKey implements IPreAkiLoadMod
|
||||
{
|
||||
|
||||
private router: DynamicRouterModService;
|
||||
private cfg;
|
||||
private http: HttpResponseUtil;
|
||||
|
||||
public preAkiLoad(container: DependencyContainer): void
|
||||
{
|
||||
this.router = container.resolve<DynamicRouterModService>("DynamicRouterModService");
|
||||
this.http = container.resolve<HttpResponseUtil>("HttpResponseUtil");
|
||||
this.cfg = require("./config.json");
|
||||
|
||||
this.addRoute();
|
||||
}
|
||||
|
||||
private addRoute() : void
|
||||
{
|
||||
this.router.registerDynamicRouter(
|
||||
"MasterKey",
|
||||
[
|
||||
{
|
||||
url: "/cwx/masterkey",
|
||||
action: (url, info, sessionId, output) =>
|
||||
{
|
||||
return this.onRequestConfig();
|
||||
}
|
||||
}
|
||||
],
|
||||
"MasterKey"
|
||||
)
|
||||
}
|
||||
|
||||
private onRequestConfig(): any
|
||||
{
|
||||
if (typeof this.cfg.keyId !== "string")
|
||||
{
|
||||
return this.http.noBody({ keyId: "5c1d0d6d86f7744bb2683e1f" });
|
||||
}
|
||||
|
||||
return this.http.noBody({ keyId: this.cfg.keyId});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user