Added ability to flag a profile as flea banned via config

Updated tournament profiles to use new system
Added `getTimeStampFromNowDays()` helper to `TimeUtil`
Improved accuracy of `Bans` property in profile
This commit is contained in:
Dev 2024-05-25 15:09:52 +01:00
parent eba65cdd83
commit ca737d2f62
5 changed files with 32 additions and 13 deletions

View File

@ -36321,11 +36321,7 @@
"AccountType": 0, "AccountType": 0,
"BannedState": false, "BannedState": false,
"BannedUntil": 0, "BannedUntil": 0,
"Bans": [{ "Bans": [],
"banType": "RagFair",
"dateTime": 1746651600
}
],
"Experience": 0, "Experience": 0,
"GameVersion": "tournament_live", "GameVersion": "tournament_live",
"IsStreamerModeAvailable": false, "IsStreamerModeAvailable": false,
@ -36760,7 +36756,8 @@
}, },
"initialSalesSum": 0, "initialSalesSum": 0,
"initialStanding": 0.2, "initialStanding": 0.2,
"jaegerUnlocked": false "jaegerUnlocked": false,
"fleaBlockedDays": 365
}, },
"weaponbuilds": {} "weaponbuilds": {}
}, },
@ -37263,11 +37260,7 @@
"AccountType": 0, "AccountType": 0,
"BannedState": false, "BannedState": false,
"BannedUntil": 0, "BannedUntil": 0,
"Bans": [{ "Bans": [],
"banType": "RagFair",
"dateTime": 1746651600
}
],
"Experience": 0, "Experience": 0,
"GameVersion": "tournament_live", "GameVersion": "tournament_live",
"IsStreamerModeAvailable": false, "IsStreamerModeAvailable": false,
@ -37700,7 +37693,8 @@
}, },
"initialSalesSum": 0, "initialSalesSum": 0,
"initialStanding": 0.2, "initialStanding": 0.2,
"jaegerUnlocked": false "jaegerUnlocked": false,
"fleaBlockedDays": 365
}, },
"weaponbuilds": {} "weaponbuilds": {}
} }

View File

@ -3,6 +3,7 @@ import { HandbookHelper } from "@spt/helpers/HandbookHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper"; import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData"; import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { BanType } from "@spt/models/eft/common/tables/IBotBase";
import { Item } from "@spt/models/eft/common/tables/IItem"; import { Item } from "@spt/models/eft/common/tables/IItem";
import { ProfileTraderTemplate } from "@spt/models/eft/common/tables/IProfileTemplate"; import { ProfileTraderTemplate } from "@spt/models/eft/common/tables/IProfileTemplate";
import { ITraderAssort, ITraderBase, LoyaltyLevel } from "@spt/models/eft/common/tables/ITrader"; import { ITraderAssort, ITraderBase, LoyaltyLevel } from "@spt/models/eft/common/tables/ITrader";
@ -142,6 +143,15 @@ export class TraderHelper
unlocked: this.databaseServer.getTables().traders[traderID].base.unlockedByDefault, unlocked: this.databaseServer.getTables().traders[traderID].base.unlockedByDefault,
}; };
if (rawProfileTemplate.fleaBlockedDays > 0)
{
pmcData.Info.Bans.push(
{
banType: BanType.RAGFAIR,
dateTime: this.timeUtil.getTimeStampFromNowDays(rawProfileTemplate.fleaBlockedDays),
});
}
if (traderID === Traders.JAEGER) if (traderID === Traders.JAEGER)
{ {
pmcData.TradersInfo[traderID].unlocked = rawProfileTemplate.jaegerUnlocked; pmcData.TradersInfo[traderID].unlocked = rawProfileTemplate.jaegerUnlocked;

View File

@ -95,7 +95,7 @@ export interface Settings
export interface IBan export interface IBan
{ {
type: BanType banType: BanType
dateTime: number dateTime: number
} }

View File

@ -8,6 +8,8 @@ export interface IProfileTemplates
"Left Behind": IProfileSides "Left Behind": IProfileSides
"Prepare To Escape": IProfileSides "Prepare To Escape": IProfileSides
"Edge Of Darkness": IProfileSides "Edge Of Darkness": IProfileSides
"Unheard": IProfileSides
"Tournament": IProfileSides
"SPT Developer": IProfileSides "SPT Developer": IProfileSides
"SPT Easy start": IProfileSides "SPT Easy start": IProfileSides
"SPT Zero to hero": IProfileSides "SPT Zero to hero": IProfileSides
@ -38,4 +40,5 @@ export interface ProfileTraderTemplate
initialStanding: number initialStanding: number
initialSalesSum: number initialSalesSum: number
jaegerUnlocked: boolean jaegerUnlocked: boolean
fleaBlockedDays?: number
} }

View File

@ -78,6 +78,18 @@ export class TimeUtil
return Math.floor(new Date().getTime() / 1000); return Math.floor(new Date().getTime() / 1000);
} }
/**
* Get timestamp of today + passed in day count
* @param daysFromNow Days from now
*/
public getTimeStampFromNowDays(daysFromNow: number): number
{
const currentTimeStamp = this.getTimestamp();
const desiredDaysAsSeconds = this.getHoursAsSeconds(daysFromNow * 24);
return currentTimeStamp + desiredDaysAsSeconds;
}
/** /**
* Gets the current time in UTC in a format suitable for mail in EFT. * Gets the current time in UTC in a format suitable for mail in EFT.
* *