osrs-tools
Version:
A comprehensive TypeScript library for Old School RuneScape (OSRS) data and utilities, including quest data, skill requirements, and game item information
157 lines • 5.21 kB
TypeScript
import { NpcDrop } from "./NpcDrop";
import { NpcProduct } from "./NpcProduct";
/**
* Represents the base stats of an NPC.
* Wiki reference: https://oldschool.runescape.wiki/w/Abyssal_demon (Combat stats section)
*/
export interface NpcCombatStats {
hitpoints: number;
attack: number;
strength: number;
defence: number;
magic: number;
ranged: number;
}
/**
* Represents the offensive bonuses (Aggressive stats section from wiki).
* Wiki reference: https://oldschool.runescape.wiki/w/Abyssal_demon (Aggressive stats section)
*
* These are the modifiers that affect the NPC's offensive capabilities.
*/
export interface NpcAggressiveStats {
attackBonus: number;
strengthBonus: number;
magicStrengthBonus: number;
rangedStrengthBonus: number;
}
/**
* Represents melee defence bonuses against different damage types.
* Wiki reference: https://oldschool.runescape.wiki/w/Abyssal_demon (Melee defence section)
*/
export interface NpcMeleeDefence {
stab: number;
slash: number;
crush: number;
}
/**
* Represents magic defence.
* Wiki reference: https://oldschool.runescape.wiki/w/Abyssal_demon (Magic defence section)
*/
export interface NpcMagicDefence {
bonus: number;
elementalWeakness?: string;
}
/**
* Represents ranged defence bonuses against different projectile types.
* Wiki reference: https://oldschool.runescape.wiki/w/Abyssal_demon (Ranged defence section)
*/
export interface NpcRangedDefence {
light: number;
standard: number;
heavy: number;
}
/**
* Represents all defensive bonuses for an NPC.
* Organized by damage type as shown in the wiki.
* Wiki reference: https://oldschool.runescape.wiki/w/Abyssal_demon (Defence sections)
*/
export interface NpcDefences {
melee: NpcMeleeDefence;
magic: NpcMagicDefence;
ranged: NpcRangedDefence;
}
/**
* Represents status effects and environmental resistances.
* Wiki reference: https://oldschool.runescape.wiki/w/Abyssal_demon (Immunities section)
*/
export interface NpcImmunities {
canBePoison: boolean;
isPoisonous: boolean;
canBeVenom: boolean;
canBeCannoned: boolean;
canBeThralled: boolean;
}
/**
* Represents combat interactions and mechanics.
* Wiki reference: https://oldschool.runescape.wiki/w/Non-player_character
*/
export interface NpcCombatMechanics {
maxHit: number;
attackSpeed: number;
respawnTime: number;
isAggressive: boolean;
isAttackable: boolean;
attackStyles: string[];
isPoisonous: boolean;
hasWeaponVenom: boolean;
weaknesses: string[];
}
/**
* Represents an NPC in the game with comprehensive combat and attribute data.
* All data is verified against the OSRS wiki.
*
* Wiki references:
* - https://oldschool.runescape.wiki/w/Abyssal_demon (Example NPC with full stats)
* - https://oldschool.runescape.wiki/w/Non-player_character (General NPC info)
* - https://oldschool.runescape.wiki/w/Character (Character mechanics)
*/
export declare class Npc {
readonly id: number;
readonly name: string;
readonly examine: string;
readonly members: boolean;
readonly officialWikiUrl: string;
readonly combatLevel: number;
readonly slayerLevel?: number;
readonly slayerXp?: number;
readonly stats: NpcCombatStats;
readonly aggressiveStats: NpcAggressiveStats;
readonly defences: NpcDefences;
readonly combat: NpcCombatMechanics;
readonly immunities: NpcImmunities;
readonly locations: string[];
readonly drops: NpcDrop[];
readonly products?: NpcProduct[];
readonly dialogue?: string[];
readonly changes?: string[];
readonly trivia?: string[];
constructor(data: {
id: number;
name: string;
examine: string;
members: boolean;
officialWikiUrl: string;
combatLevel: number;
slayerLevel?: number;
slayerXp?: number;
stats: NpcCombatStats;
aggressiveStats: NpcAggressiveStats;
defences: NpcDefences;
combat: NpcCombatMechanics;
immunities: NpcImmunities;
locations: string[];
drops: NpcDrop[];
products?: NpcProduct[];
dialogue?: string[];
changes?: string[];
trivia?: string[];
});
/**
* Get the NPC's defense roll against a specific attack type.
* Used in hit chance calculations.
* Wiki reference: https://oldschool.runescape.wiki/w/Abyssal_demon (Defence sections)
* @param attackType - Type of attack ("stab", "slash", "crush", "magic", "ranged-light", "ranged-standard", "ranged-heavy")
*/
getDefenseAgainst(attackType: "stab" | "slash" | "crush" | "magic" | "ranged-light" | "ranged-standard" | "ranged-heavy"): number;
/**
* Check if this NPC can be harmed by a specific type of damage or effect.
* @param damageType - Type of damage/effect to check
*/
canBeDamagedBy(damageType: "poison" | "venom" | "cannon" | "thrall"): boolean;
/**
* Create a minimal NPC with default values for quick testing.
* Not intended for actual game use - always verify with wiki.
*/
static createBasicNpc(id: number, name: string): Npc;
}
//# sourceMappingURL=Npc.d.ts.map