MISC: Use FactionName enum in relevant APIs (#2101)

This commit is contained in:
catloversg
2025-05-11 12:13:22 +07:00
committed by GitHub
parent 178da0fb5a
commit 4044b4a223
20 changed files with 62 additions and 54 deletions

View File

@@ -1114,7 +1114,7 @@ type SleeveCrimeTask = {
type SleeveFactionTask = {
type: "FACTION";
factionWorkType: FactionWorkType;
factionName: string;
factionName: FactionName;
};
/** @public */
@@ -1761,7 +1761,7 @@ export interface CrimeTask extends BaseTask {
export interface FactionWorkTask extends BaseTask {
type: "FACTION";
factionWorkType: FactionWorkType;
factionName: string;
factionName: FactionName;
}
/**
@@ -2252,7 +2252,7 @@ export interface Singularity {
* ]
* ```
*/
getFactionInviteRequirements(faction: string): PlayerRequirement[];
getFactionInviteRequirements(faction: FactionName): PlayerRequirement[];
/**
* Get a list of enemies of a faction.
@@ -2266,7 +2266,7 @@ export interface Singularity {
* @param faction - Name of faction.
* @returns Array containing the names of all enemies of the faction.
*/
getFactionEnemies(faction: string): string[];
getFactionEnemies(faction: FactionName): string[];
/**
* List all current faction invitations.
@@ -2279,7 +2279,7 @@ export interface Singularity {
*
* @returns Array with the name of all Factions you currently have outstanding invitations from.
*/
checkFactionInvitations(): string[];
checkFactionInvitations(): FactionName[];
/**
* Join a faction.
@@ -2292,7 +2292,7 @@ export interface Singularity {
* @param faction - Name of faction to join.
* @returns True if player joined the faction, and false otherwise.
*/
joinFaction(faction: string): boolean;
joinFaction(faction: FactionName): boolean;
/**
* Work for a faction.
@@ -2320,7 +2320,7 @@ export interface Singularity {
* @param focus - Acquire player focus on this work operation. Optional. Defaults to true.
* @returns True if the player starts working, and false otherwise.
*/
workForFaction(faction: string, workType: FactionWorkType, focus?: boolean): boolean;
workForFaction(faction: FactionName, workType: FactionWorkType, focus?: boolean): boolean;
/**
* Get the work types of a faction.
@@ -2332,7 +2332,7 @@ export interface Singularity {
* @param faction - Name of the faction.
* @returns The work types of the faction.
*/
getFactionWorkTypes(faction: string): FactionWorkType[];
getFactionWorkTypes(faction: FactionName): FactionWorkType[];
/**
* Get faction reputation.
@@ -2345,7 +2345,7 @@ export interface Singularity {
* @param faction - Name of faction to work for.
* @returns Amount of reputation you have for the specified faction.
*/
getFactionRep(faction: string): number;
getFactionRep(faction: FactionName): number;
/**
* Get faction favor.
@@ -2358,7 +2358,7 @@ export interface Singularity {
* @param faction - Name of faction.
* @returns Amount of favor you have for the specified faction.
*/
getFactionFavor(faction: string): number;
getFactionFavor(faction: FactionName): number;
/**
* Get faction favor gain.
@@ -2372,7 +2372,7 @@ export interface Singularity {
* @param faction - Name of faction.
* @returns Amount of favor you will gain for the specified faction when you reset by installing Augmentations.
*/
getFactionFavorGain(faction: string): number;
getFactionFavorGain(faction: FactionName): number;
/**
* Donate to a faction.
@@ -2391,7 +2391,7 @@ export interface Singularity {
* @param amount - Amount of money to donate.
* @returns True if the money was donated, and false otherwise.
*/
donateToFaction(faction: string, amount: number): boolean;
donateToFaction(faction: FactionName, amount: number): boolean;
/**
* Create a program.
@@ -2524,7 +2524,7 @@ export interface Singularity {
* @param augName - Name of Augmentation.
* @returns Array containing the names of all factions.
*/
getAugmentationFactions(augName: string): string[];
getAugmentationFactions(augName: string): FactionName[];
/**
* Get a list of augmentation available from a faction.
@@ -2538,7 +2538,7 @@ export interface Singularity {
* @param faction - Name of faction.
* @returns Array containing the names of all Augmentations.
*/
getAugmentationsFromFaction(faction: string): string[];
getAugmentationsFromFaction(faction: FactionName): string[];
/**
* Get the pre-requisite of an augmentation.
@@ -2601,7 +2601,7 @@ export interface Singularity {
* @param augmentation - Name of Augmentation to purchase.
* @returns True if the Augmentation is successfully purchased, and false otherwise.
*/
purchaseAugmentation(faction: string, augmentation: string): boolean;
purchaseAugmentation(faction: FactionName, augmentation: string): boolean;
/**
* Get the stats of an augmentation.
@@ -4032,7 +4032,7 @@ export interface Gang {
* @param faction - Name of the faction that you want to create a gang with. This faction must allow this action, and you must be its member.
* @returns True if the gang was created, false otherwise.
*/
createGang(faction: string): boolean;
createGang(faction: FactionName): boolean;
/**
* Check if you're in a gang.
@@ -4977,7 +4977,11 @@ export interface Sleeve {
* @param factionWorkType - Name of the action to perform for this faction.
* @returns True if the sleeve started working for this faction, false otherwise. Can also throw on errors.
*/
setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: FactionWorkType): boolean | undefined;
setToFactionWork(
sleeveNumber: number,
factionName: FactionName,
factionWorkType: FactionWorkType,
): boolean | undefined;
/**
* Set a sleeve to work for a company.
@@ -9523,7 +9527,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI {
* @param amountCash - Amount of money to bribe
* @returns true if successful, false if not
*/
bribe(factionName: string, amountCash: number): boolean;
bribe(factionName: FactionName, amountCash: number): boolean;
/**
* Get corporation data.