osrs-tools
Version:
A comprehensive TypeScript library for Old School RuneScape (OSRS) data and utilities, including quest data, skill requirements, and game item information
140 lines • 5.45 kB
TypeScript
import { Requirement } from '../../Requirement';
import { SlayerLocation, SlayerBoss } from './types';
export interface TaskJson {
name: string;
amountMin: number;
amountMax: number;
extendedAmountMin?: number | null;
extendedAmountMax?: number | null;
requirements: Requirement[];
alternatives?: string[];
weight: number;
combatLevels: number[];
slayerExp: number;
locations: string[];
wildernessLevels: number[];
bosses: string[];
}
/**
* Builder options for creating tasks
* Provides a more readable alternative to positional parameters
*/
export interface TaskOptions {
name: string;
quantity: {
min: number;
max: number;
};
requirements: Requirement[];
extended?: {
min: number;
max: number;
} | null;
weight?: number;
alternatives?: string[];
slayerExp?: number;
combatLevels?: number[];
locations?: (SlayerLocation | string)[];
bosses?: (SlayerBoss | string)[];
wildernessLevels?: number[];
}
/**
* Represents a Slayer task in the game. This class encapsulates all the properties and methods related to a Slayer task.
* A Slayer task defines the monsters that players can be assigned to kill, the amount of those monsters, and various other attributes.
* A Task is not an assignment, but rather a template for an assignment.
* The assignment is the actual task given to a player, which is based on the Task.
*/
declare class Task {
name: string;
weight: number;
amountMin: number;
amountMax: number;
requirements: Requirement[];
extendedAmountMin?: number | null;
extendedAmountMax?: number | null;
alternatives?: string[];
combatLevels: number[];
slayerExp: number;
locations: string[];
wildernessLevels: number[];
bosses: string[];
/**
* Constructor for the Task class.
* @param name - Name of the task
* @param amountMin - Minimum amount of monsters to kill for this task
* @param amountMax - Maximum amount of monsters to kill for this task
* @param requirements - Array of requirements for this task
* @param extendedAmountMin - Minimum amount for extended tasks (optional)
* @param extendedAmountMax - Maximum amount for extended tasks (optional)
* @param weight - Weight of the task (default is 1)
* @param alternatives - Array of alternatives for this task (optional)
* @param combatLevels - Array of combat levels for this task
* @param SlayerExp - Slayer experience gained from this task
* @param locations - Array of locations where this task can be found
* @param wildernessLevels - Array of wilderness levels for this task
* @param bosses - Array of bosses for this task
*/
constructor(name: string, amountMin: number, amountMax: number, requirements: Requirement[], extendedAmountMin?: number | null, extendedAmountMax?: number | null, alternatives?: string[], weight?: number, combatLevels?: number[], SlayerExp?: number, locations?: string[], wildernessLevels?: number[], bosses?: string[]);
static fromJSON(json: TaskJson): Task;
/**
* Create a Task using a builder pattern with named parameters
* More readable than the positional parameter constructor
* @example
* const task = Task.create({
* name: 'Aberrant spectres',
* quantity: { min: 60, max: 200 },
* extended: { min: 80, max: 250 },
* requirements: [new SlayerLevelRequirement(60)],
* locations: [SlayerLocation.SLAYER_TOWER_CKS],
* weight: 8,
* alternatives: ['Deviant spectres'],
* });
*/
static create(options: TaskOptions): Task;
/**
* Get the name of the task.
* @example
* const task = new Task("Goblin", 10, 20, [], 0, null, [], 1);
* console.log(task.getName()); // "Goblin"
* @returns
*/
getName(): string;
/**
* Get the weight of the task. The weight is used to determine the likelihood of being assigned this task compared to others.
* @returns {number} The weight of the task, which can be used to determine the likelihood of being assigned this task compared to others.
*/
getWeight(): number;
/**
* Get the minimum and maximum amount of monsters to kill for this task.
* The amountMin and amountMax properties define the range of monsters that can be assigned for this task.
* @returns {number} The minimum amount of monsters to kill for this task.
*/
getAmountMin(): number;
/**
* Get the maximum amount of monsters to kill for this task.
* @returns {number} The maximum amount of monsters to kill for this task.
*/
getAmountMax(): number;
/**
*
*/
getRequirements(): Requirement[];
/**
*
* @returns {string[]} An array of alternatives for this task. If alternatives are defined as an object, it flattens the values into a single array.
*/
getAlternatives(): string[];
/**
*
* @returns
*/
toJSON(): TaskJson;
/**
* Returns a string representation of the Task object.
* This method is useful for debugging and logging purposes, providing a quick overview of the task's name and other properties.
* @returns {string} A string representation of the Task object, useful for debugging and logging purposes.
*/
toString(): string;
}
export { Task };
//# sourceMappingURL=Task.d.ts.map