remove stray files.

This commit is contained in:
CamBurr 2024-04-19 21:26:40 -06:00
parent e3ec12ea8d
commit 6c62d7d8a5
10 changed files with 0 additions and 526 deletions

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 Cameron Burr
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,2 +0,0 @@
## Description ##
Simple server mod that makes experience earned as a player scav count towards your PMC.

View File

@ -1,12 +0,0 @@
{
"EnableMod": true,
"_EnableMod": "Enables the mod",
"EnableSkillXp": true,
"_EnableSkillXp": "Enables the addition of scav skill xp to pmc xp",
"EnableGeneralXp": true,
"_EnableGeneralXp": "Enables the addition of scav general xp to pmc xp",
"EnableSkillSync": true,
"_EnableSkillSync": "Enables the syncing of scav skill xp to pmc skill xp (both are set to the higher of the two)",
"EnableGeneralSync": true,
"_EnableGeneralSync": "Enables the syncing of scav general xp to pmc general xp (both are set to the higher of the two)"
}

View File

@ -1,23 +0,0 @@
{
"name": "ScavXpCounts",
"version": "1.1.0",
"main": "src/mod.js",
"license": "MIT",
"author": "gasmo",
"akiVersion": "3.7.6",
"scripts": {
"setup": "npm i",
"build": "node ./packageBuild.ts"
},
"devDependencies": {
"@types/node": "20.4.5",
"@typescript-eslint/eslint-plugin": "6.2.0",
"@typescript-eslint/parser": "6.2.0",
"bestzip": "2.2.1",
"eslint": "8.46.0",
"fs-extra": "11.1.1",
"glob": "10.3.3",
"tsyringe": "4.8.0",
"typescript": "5.1.6"
}
}

View File

@ -1,205 +0,0 @@
import { DependencyContainer } from "tsyringe";
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
import { InRaidHelper } from "@spt-aki/helpers/InRaidHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import config from "../config.json";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
class Mod implements IPreAkiLoadMod, IPostAkiLoadMod
{
private static container: DependencyContainer;
private logger: ILogger;
private profileHelper: ProfileHelper;
/**
* This function will be called before Aki is loaded.
* @param container the dependency container
*/
public preAkiLoad(container: DependencyContainer): void
{
if (!config.EnableMod) return;
Mod.container = container;
this.logger = Mod.container.resolve<ILogger>("WinstonLogger");
if (config.EnableSkillXp || config.EnableGeneralXp) this.patchInRaidHelper();
}
/**
* This function will be called after Aki is loaded.
* @param container the dependency container
*/
public postAkiLoad(container: DependencyContainer): void
{
if (!config.EnableMod) return;
Mod.container = container;
this.profileHelper = Mod.container.resolve<ProfileHelper>("ProfileHelper");
if (config.EnableSkillSync) this.syncSkillsForAllProfiles();
if (config.EnableGeneralSync) this.syncGeneralXpForAllProfiles();
}
/**
* This function will sync the skill progress between PMC and Scav characters on a profile.
* @param profile the profile to sync
*/
private syncSkillsForProfile(profile: IAkiProfile): void
{
this.logger.debug(`[ScavXpCounts] Syncing skill progress between PMC and Scav characters for ${profile.info.username}`);
let totalSkillXP = 0; // The total skill experience added
const pmcData: IPmcData = profile.characters.pmc; // Get the PMC and Scav data
const scavData: IPmcData = profile.characters.scav;
pmcData.Skills.Common.forEach((skill) => // Loop through all skills
{
const scavSkill = scavData.Skills.Common.find(p => p.Id === skill.Id); // Find the scav skill
const maxProgress = Math.max(skill.Progress, scavSkill.Progress); // Get the max progress
if (maxProgress != skill.Progress)
{
totalSkillXP += maxProgress - skill.Progress;
this.logger.debug(`[ScavXpCounts] Setting PMC ${skill.Id} to ${maxProgress}`);
skill.Progress = maxProgress; // Ensure the PMC skill is set to the max progress
}
if (maxProgress != scavSkill.Progress)
{
totalSkillXP += maxProgress - scavSkill.Progress;
this.logger.debug(`[ScavXpCounts] Setting Scav ${skill.Id} to ${maxProgress}`);
scavSkill.Progress = maxProgress; // Ensure the Scav skill is set to the max progress
}
});
if (totalSkillXP > 0) this.logger.info(`[ScavXpCounts] Synced ${totalSkillXP.toFixed(2)} total points of skill experience`);
}
/**
* This function will sync the skill progress between PMC and Scav characters on all profiles.
* @param profiles the profiles to sync
*/
private syncSkillsForAllProfiles(): void
{
this.logger.debug("[ScavXpCounts] Syncing skill progress between PMC and Scav characters on all profiles");
const profiles = this.profileHelper.getProfiles();
Object.keys(profiles).forEach((key) => // Loop through all profiles
{
this.syncSkillsForProfile(profiles[key]);
});
this.logger.info("[ScavXpCounts] Synced skill progress for all profiles.");
}
/**
* This function will sync the general progress between PMC and Scav characters on a profile.
* @param profile the profile to sync
*/
private syncGeneralXpForProfile(profile: IAkiProfile): void
{
this.logger.debug(`[ScavXpCounts] Syncing general progress between PMC and Scav characters for ${profile.info.username}`)
const pmcData: IPmcData = profile.characters.pmc;
const scavData: IPmcData = profile.characters.scav;
const maxExperience = Math.max(pmcData.Info.Experience, scavData.Info.Experience); // Get the max experience
const maxLevel = Math.max(pmcData.Info.Level, scavData.Info.Level); // Get the max level
if (maxExperience != pmcData.Info.Experience)
{
this.logger.info(`[ScavXpCounts] Adding ${(maxExperience - pmcData.Info.Experience).toFixed()} general XP to PMC character`);
pmcData.Info.Experience = maxExperience; // Ensure the PMC experience is set to the max experience
pmcData.Info.Level = maxLevel; // Ensure the PMC level is set to the max level
}
if (maxExperience != scavData.Info.Experience)
{
this.logger.info(`[ScavXpCounts] Adding ${(maxExperience - scavData.Info.Experience).toFixed()} general XP to Scav character`);
scavData.Info.Experience = maxExperience; // Ensure the Scav experience is set to the max experience
scavData.Info.Level = maxLevel; // Ensure the Scav level is set to the max level
}
}
/**
* This function will sync the general progress between PMC and Scav characters on all profiles.
* @param profiles the profiles to sync
*/
private syncGeneralXpForAllProfiles(): void
{
this.logger.debug("[ScavXpCounts] Syncing general progress between PMC and Scav characters on all profiles");
const profiles = this.profileHelper.getProfiles();
Object.keys(profiles).forEach((key) => this.syncGeneralXpForProfile(profiles[key]));
this.logger.info("[ScavXpCounts] Synced general progress for all profiles");
}
/**
* This function will patch the InRaidHelper to sync the experience between PMC and Scav characters, and add the post raid experience to the PMC character.
*/
private patchInRaidHelper(): void
{
const oldClass = Mod.container.resolve<InRaidHelper>("InRaidHelper"); // Get the original class
Mod.container.afterResolution("InRaidHelper", (_t, result: InRaidHelper) => // Patch the original class after it has been resolved
{
result.updateProfileBaseStats = (profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): void => // Patch the original function
{
if (saveProgressRequest.isPlayerScav) // If the player is a scav
{
const pmcData = Mod.container.resolve<ProfileHelper>("ProfileHelper").getPmcProfile(sessionID);
if (config.EnableGeneralXp) this.addGeneralXP(pmcData, saveProgressRequest); // Add the post raid experience to the PMC character
if (config.EnableSkillXp) this.addSkillXP(pmcData, saveProgressRequest); // Add the post raid skill experience to the PMC character
}
oldClass.updateProfileBaseStats(profileData, saveProgressRequest, sessionID); // Call the original function
const profile = Mod.container.resolve<ProfileHelper>("ProfileHelper").getFullProfile(sessionID);
if (config.EnableGeneralSync) this.syncGeneralXpForProfile(profile); // Sync the general experience for the profile
if (config.EnableSkillSync) this.syncSkillsForProfile(profile); // Sync the skill progress for the profile
}
}, {frequency: "Always"});
}
/**
* This function will add the post raid skill experience to the PMC character on the given profile.
* @param pmcData the PMC profile
* @param saveProgressRequest the save progress request
*/
private addSkillXP(pmcData: IPmcData, saveProgressRequest: ISaveProgressRequestData): void
{
let totalSkillXP = 0;
saveProgressRequest.profile.Skills.Common.forEach((skill) => // Loop through all skills
{
if (skill.PointsEarnedDuringSession > 0)
{
totalSkillXP += skill.PointsEarnedDuringSession;
pmcData.Skills.Common.find(p => p.Id === skill.Id).Progress += skill.PointsEarnedDuringSession; // Add the skill experience to the PMC profile
this.logger.debug(`[ScavXpCounts] Added ${skill.PointsEarnedDuringSession.toFixed(2)} experience to ${skill.Id}`);
}
})
if (totalSkillXP > 0) this.logger.info(`[ScavXpCounts] Added ${totalSkillXP.toFixed(2)} total points of skill experience to PMC`);
}
/**
* This function will add the post raid experience to the PMC character on the given profile.
* @param pmcData the PMC profile
* @param saveProgressRequest the save progress request
*/
private addGeneralXP(pmcData: IPmcData, saveProgressRequest: ISaveProgressRequestData): void
{
pmcData.Info.Experience += saveProgressRequest.profile.Stats.Eft.TotalSessionExperience; // Add the post raid experience to the PMC profile
this.logger.info(`[ScavXpCounts] Added ${saveProgressRequest.profile.Stats.Eft.TotalSessionExperience.toFixed(0)} experience to PMC.`);
}
}
module.exports = { mod: new Mod() }

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 Cameron Burr
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,2 +0,0 @@
## Description ##
Simple server mod that makes experience earned as a player scav count towards your PMC.

View File

@ -1,12 +0,0 @@
{
"EnableMod": true,
"_EnableMod": "Enables the mod",
"EnableSkillXp": true,
"_EnableSkillXp": "Enables the addition of scav skill xp to pmc xp",
"EnableGeneralXp": true,
"_EnableGeneralXp": "Enables the addition of scav general xp to pmc xp",
"EnableSkillSync": true,
"_EnableSkillSync": "Enables the syncing of scav skill xp to pmc skill xp (both are set to the higher of the two)",
"EnableGeneralSync": true,
"_EnableGeneralSync": "Enables the syncing of scav general xp to pmc general xp (both are set to the higher of the two)"
}

View File

@ -1,23 +0,0 @@
{
"name": "ScavXpCounts",
"version": "1.1.0",
"main": "src/mod.js",
"license": "MIT",
"author": "gasmo",
"akiVersion": "3.7.6",
"scripts": {
"setup": "npm i",
"build": "node ./packageBuild.ts"
},
"devDependencies": {
"@types/node": "20.4.5",
"@typescript-eslint/eslint-plugin": "6.2.0",
"@typescript-eslint/parser": "6.2.0",
"bestzip": "2.2.1",
"eslint": "8.46.0",
"fs-extra": "11.1.1",
"glob": "10.3.3",
"tsyringe": "4.8.0",
"typescript": "5.1.6"
}
}

View File

@ -1,205 +0,0 @@
import { DependencyContainer } from "tsyringe";
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
import { InRaidHelper } from "@spt-aki/helpers/InRaidHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import config from "../config.json";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
class Mod implements IPreAkiLoadMod, IPostAkiLoadMod
{
private static container: DependencyContainer;
private logger: ILogger;
private profileHelper: ProfileHelper;
/**
* This function will be called before Aki is loaded.
* @param container the dependency container
*/
public preAkiLoad(container: DependencyContainer): void
{
if (!config.EnableMod) return;
Mod.container = container;
this.logger = Mod.container.resolve<ILogger>("WinstonLogger");
if (config.EnableSkillXp || config.EnableGeneralXp) this.patchInRaidHelper();
}
/**
* This function will be called after Aki is loaded.
* @param container the dependency container
*/
public postAkiLoad(container: DependencyContainer): void
{
if (!config.EnableMod) return;
Mod.container = container;
this.profileHelper = Mod.container.resolve<ProfileHelper>("ProfileHelper");
if (config.EnableSkillSync) this.syncSkillsForAllProfiles();
if (config.EnableGeneralSync) this.syncGeneralXpForAllProfiles();
}
/**
* This function will sync the skill progress between PMC and Scav characters on a profile.
* @param profile the profile to sync
*/
private syncSkillsForProfile(profile: IAkiProfile): void
{
this.logger.debug(`[ScavXpCounts] Syncing skill progress between PMC and Scav characters for ${profile.info.username}`);
let totalSkillXP = 0; // The total skill experience added
const pmcData: IPmcData = profile.characters.pmc; // Get the PMC and Scav data
const scavData: IPmcData = profile.characters.scav;
pmcData.Skills.Common.forEach((skill) => // Loop through all skills
{
const scavSkill = scavData.Skills.Common.find(p => p.Id === skill.Id); // Find the scav skill
const maxProgress = Math.max(skill.Progress, scavSkill.Progress); // Get the max progress
if (maxProgress != skill.Progress)
{
totalSkillXP += maxProgress - skill.Progress;
this.logger.debug(`[ScavXpCounts] Setting PMC ${skill.Id} to ${maxProgress}`);
skill.Progress = maxProgress; // Ensure the PMC skill is set to the max progress
}
if (maxProgress != scavSkill.Progress)
{
totalSkillXP += maxProgress - scavSkill.Progress;
this.logger.debug(`[ScavXpCounts] Setting Scav ${skill.Id} to ${maxProgress}`);
scavSkill.Progress = maxProgress; // Ensure the Scav skill is set to the max progress
}
});
if (totalSkillXP > 0) this.logger.info(`[ScavXpCounts] Synced ${totalSkillXP.toFixed(2)} total points of skill experience`);
}
/**
* This function will sync the skill progress between PMC and Scav characters on all profiles.
* @param profiles the profiles to sync
*/
private syncSkillsForAllProfiles(): void
{
this.logger.debug("[ScavXpCounts] Syncing skill progress between PMC and Scav characters on all profiles");
const profiles = this.profileHelper.getProfiles();
Object.keys(profiles).forEach((key) => // Loop through all profiles
{
this.syncSkillsForProfile(profiles[key]);
});
this.logger.info("[ScavXpCounts] Synced skill progress for all profiles.");
}
/**
* This function will sync the general progress between PMC and Scav characters on a profile.
* @param profile the profile to sync
*/
private syncGeneralXpForProfile(profile: IAkiProfile): void
{
this.logger.debug(`[ScavXpCounts] Syncing general progress between PMC and Scav characters for ${profile.info.username}`)
const pmcData: IPmcData = profile.characters.pmc;
const scavData: IPmcData = profile.characters.scav;
const maxExperience = Math.max(pmcData.Info.Experience, scavData.Info.Experience); // Get the max experience
const maxLevel = Math.max(pmcData.Info.Level, scavData.Info.Level); // Get the max level
if (maxExperience != pmcData.Info.Experience)
{
this.logger.info(`[ScavXpCounts] Adding ${(maxExperience - pmcData.Info.Experience).toFixed()} general XP to PMC character`);
pmcData.Info.Experience = maxExperience; // Ensure the PMC experience is set to the max experience
pmcData.Info.Level = maxLevel; // Ensure the PMC level is set to the max level
}
if (maxExperience != scavData.Info.Experience)
{
this.logger.info(`[ScavXpCounts] Adding ${(maxExperience - scavData.Info.Experience).toFixed()} general XP to Scav character`);
scavData.Info.Experience = maxExperience; // Ensure the Scav experience is set to the max experience
scavData.Info.Level = maxLevel; // Ensure the Scav level is set to the max level
}
}
/**
* This function will sync the general progress between PMC and Scav characters on all profiles.
* @param profiles the profiles to sync
*/
private syncGeneralXpForAllProfiles(): void
{
this.logger.debug("[ScavXpCounts] Syncing general progress between PMC and Scav characters on all profiles");
const profiles = this.profileHelper.getProfiles();
Object.keys(profiles).forEach((key) => this.syncGeneralXpForProfile(profiles[key]));
this.logger.info("[ScavXpCounts] Synced general progress for all profiles");
}
/**
* This function will patch the InRaidHelper to sync the experience between PMC and Scav characters, and add the post raid experience to the PMC character.
*/
private patchInRaidHelper(): void
{
const oldClass = Mod.container.resolve<InRaidHelper>("InRaidHelper"); // Get the original class
Mod.container.afterResolution("InRaidHelper", (_t, result: InRaidHelper) => // Patch the original class after it has been resolved
{
result.updateProfileBaseStats = (profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): void => // Patch the original function
{
if (saveProgressRequest.isPlayerScav) // If the player is a scav
{
const pmcData = Mod.container.resolve<ProfileHelper>("ProfileHelper").getPmcProfile(sessionID);
if (config.EnableGeneralXp) this.addGeneralXP(pmcData, saveProgressRequest); // Add the post raid experience to the PMC character
if (config.EnableSkillXp) this.addSkillXP(pmcData, saveProgressRequest); // Add the post raid skill experience to the PMC character
}
oldClass.updateProfileBaseStats(profileData, saveProgressRequest, sessionID); // Call the original function
const profile = Mod.container.resolve<ProfileHelper>("ProfileHelper").getFullProfile(sessionID);
if (config.EnableGeneralSync) this.syncGeneralXpForProfile(profile); // Sync the general experience for the profile
if (config.EnableSkillSync) this.syncSkillsForProfile(profile); // Sync the skill progress for the profile
}
}, {frequency: "Always"});
}
/**
* This function will add the post raid skill experience to the PMC character on the given profile.
* @param pmcData the PMC profile
* @param saveProgressRequest the save progress request
*/
private addSkillXP(pmcData: IPmcData, saveProgressRequest: ISaveProgressRequestData): void
{
let totalSkillXP = 0;
saveProgressRequest.profile.Skills.Common.forEach((skill) => // Loop through all skills
{
if (skill.PointsEarnedDuringSession > 0)
{
totalSkillXP += skill.PointsEarnedDuringSession;
pmcData.Skills.Common.find(p => p.Id === skill.Id).Progress += skill.PointsEarnedDuringSession; // Add the skill experience to the PMC profile
this.logger.debug(`[ScavXpCounts] Added ${skill.PointsEarnedDuringSession.toFixed(2)} experience to ${skill.Id}`);
}
})
if (totalSkillXP > 0) this.logger.info(`[ScavXpCounts] Added ${totalSkillXP.toFixed(2)} total points of skill experience to PMC`);
}
/**
* This function will add the post raid experience to the PMC character on the given profile.
* @param pmcData the PMC profile
* @param saveProgressRequest the save progress request
*/
private addGeneralXP(pmcData: IPmcData, saveProgressRequest: ISaveProgressRequestData): void
{
pmcData.Info.Experience += saveProgressRequest.profile.Stats.Eft.TotalSessionExperience; // Add the post raid experience to the PMC profile
this.logger.info(`[ScavXpCounts] Added ${saveProgressRequest.profile.Stats.Eft.TotalSessionExperience.toFixed(0)} experience to PMC.`);
}
}
module.exports = { mod: new Mod() }