osrs-tools
Version:
A comprehensive TypeScript library for Old School RuneScape (OSRS) data and utilities, including quest data, skill requirements, and game item information
44 lines (43 loc) • 1.95 kB
JavaScript
import { RumourLocation } from './RumourLocation';
/**
* Represents a Hunter Rumour that can be assigned by a Hunter Guild Master. Contains all the necessary information about the rumour, including the creature, method, locations, required hunter level, tier, and any quest requirements. Provides methods to check if the rumour can be assigned to a specific master and if a player is eligible for the rumour based on their hunter level and completed quests.
*
*/
export class HunterRumour {
/// Unique identifier for the rumour, typically derived from the creature name and method.
id;
// The name of the creature that the rumour is about.
creature;
// A brief description of the method to catch the creature.
method;
locations;
requiredHunterLevel;
tier;
masterNames;
questRequirements;
notes;
leagueRegions;
constructor(definition) {
this.id = definition.id;
this.creature = definition.creature;
this.method = definition.method;
this.locations = definition.locations.map((location) => new RumourLocation(location.name, location.wikiUrl));
this.requiredHunterLevel = definition.requiredHunterLevel;
this.tier = definition.tier;
this.masterNames = [...definition.masterNames];
this.questRequirements = [...(definition.questRequirements ?? [])];
this.notes = definition.notes;
this.leagueRegions = [...(definition.leagueRegions ?? [])];
}
get wikiUrls() {
return this.locations.map((location) => location.wikiUrl);
}
canBeAssignedByMaster(masterName) {
return this.masterNames.includes(masterName);
}
isEligible(hunterLevel, completedQuests = []) {
const meetsLevel = hunterLevel >= this.requiredHunterLevel;
const meetsQuests = this.questRequirements.every((quest) => completedQuests.includes(quest));
return meetsLevel && meetsQuests;
}
}