osrs-tools
Version:
A comprehensive TypeScript library for Old School RuneScape (OSRS) data and utilities, including quest data, skill requirements, and game item information
223 lines • 6.93 kB
TypeScript
/**
* NPC Drop Implementation Utilities
* Helpers for efficiently implementing drops across all NPCs
*
* Usage:
* - Use templates for quick NPC generation
* - Leverage shared drop definitions
* - Validate drops before committing
* - Batch update similar NPCs
*/
import { NpcDrop } from "../NpcDrop";
import { CompleteDropTable, WeightedDropTable } from "../ComplexDropSystems";
/**
* ============================================================================
* SECTION 1: Common Drop Definitions (DRY Principle)
* ============================================================================
*/
/**
* Standard drops used by many NPCs
* Avoids duplication and keeps data consistent
*/
export declare const STANDARD_DROPS: {
readonly bones: NpcDrop;
readonly bigBones: NpcDrop;
readonly babyBones: NpcDrop;
readonly coinsSmall: () => NpcDrop;
readonly coinsMedium: () => NpcDrop;
readonly coinsLarge: () => NpcDrop;
readonly bones_tertiary: NpcDrop;
readonly ashesGrimy: NpcDrop;
readonly clueScrollEasy: NpcDrop;
readonly clueScrollMedium: NpcDrop;
};
/**
* ============================================================================
* SECTION 2: Drop Probability Helpers
* ============================================================================
*/
/**
* Common drop rate constants for easy reference
* Makes probabilities more readable in code
*/
export declare const DROP_RATES: {
readonly ALWAYS: "Always";
readonly COMMON_1_2: "1/2";
readonly COMMON_1_4: "1/4";
readonly COMMON_1_8: "1/8";
readonly FREQUENT_1_16: "1/16";
readonly FREQUENT_1_32: "1/32";
readonly FREQUENT_1_64: "1/64";
readonly UNCOMMON_1_128: "1/128";
readonly UNCOMMON_1_256: "1/256";
readonly RARE_1_512: "1/512";
readonly RARE_1_1024: "1/1024";
readonly VERY_RARE_1_5000: "1/5000";
};
/**
* ============================================================================
* SECTION 3: NPC Category Templates
* ============================================================================
*/
/**
* Template for simple combat NPCs (80% of NPCs)
* Usage: Copy and fill in the item names
*/
export interface SimpleNPCDropTemplate {
guaranteed: NpcDrop[];
tertiary?: NpcDrop[];
questOnly?: NpcDrop[];
}
/**
* Create a simple NPC drop list from template
*/
export declare function createSimpleNPCDrops(template: SimpleNPCDropTemplate): NpcDrop[];
/**
* Template for boss NPCs with multi-roll systems
*/
export interface BossNPCDropTemplate {
primaryDrops: NpcDrop[];
secondaryDrops?: NpcDrop[];
tertiaryDrops?: NpcDrop[];
rareDrops?: {
item: NpcDrop;
weight: number;
}[];
uniqueRate?: string;
}
/**
* Create a boss drop table from template
*/
export declare function createBossNPCDrops(template: BossNPCDropTemplate): CompleteDropTable;
/**
* ============================================================================
* SECTION 4: NPC Category Builders
* ============================================================================
*/
/**
* Build drops for dragon types
* Dragons share similar drop patterns with variations
*/
export declare function createDragonDrops(options: {
tier: "baby" | "chromatic" | "metallic" | "elder";
hasUniqueDrops?: boolean;
}): NpcDrop[];
/**
* Build drops for demon types
* Most demons have similar drops with rarity variations
*/
export declare function createDemonDrops(options: {
tier: "lesser" | "greater" | "black" | "abyssal";
}): NpcDrop[];
/**
* Build drops for various rats
* Rats have consistent patterns but vary in drop value
*/
export declare function createRatDrops(options: {
size: "small" | "giant" | "behemoth";
area?: "dungeon" | "crypt" | "cave";
}): NpcDrop[];
/**
* ============================================================================
* SECTION 5: Shared Drop Table Registry
* ============================================================================
*/
/**
* Centralized location for shared drop tables
* Prevents duplication across similar NPCs
*/
export declare const SharedDropTables: {
gwd: {
rareTable: WeightedDropTable | null;
initialize: () => WeightedDropTable;
};
bossUniqueSmallTable: WeightedDropTable | null;
initializeAll: () => void;
};
/**
* ============================================================================
* SECTION 6: Validation & Quality Checks
* ============================================================================
*/
export interface DropValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
}
/**
* Validate a complete drop table
*/
export declare function validateNPCDrops(npcName: string, drops: NpcDrop[], options?: {
allowDuplicates?: boolean;
checkWikiUrl?: string;
}): DropValidationResult;
/**
* ============================================================================
* SECTION 7: Implementation Helpers
* ============================================================================
*/
/**
* Get all NPCs that should have drops by category
*/
export declare function getNPCsByCategory(category: "boss" | "combat" | "slayer" | "animal" | "other"): string[];
/**
* Create implementation checklist for a batch of NPCs
*/
export declare function createImplementationChecklist(npcs: string[]): string;
/**
* ============================================================================
* SECTION 8: Quick Start Examples
* ============================================================================
*/
/**
* Example 1: Quick implementation of a simple combat NPC
*/
export declare const EXAMPLE_SimpleCombat: {
name: string;
drops: NpcDrop[];
};
/**
* Example 2: Quick implementation of a dragon type
*/
export declare const EXAMPLE_Dragon: {
name: string;
drops: NpcDrop[];
};
/**
* Example 3: Quick implementation of a boss
*/
export declare function EXAMPLE_CreateBoss(): CompleteDropTable;
/**
* ============================================================================
* USAGE GUIDE
* ============================================================================
*
* For Simple NPCs:
* ================
* const drops = createSimpleNPCDrops({
* guaranteed: [STANDARD_DROPS.bones, coinDrop],
* tertiary: [clueScroll],
* });
*
* For Dragons:
* ============
* const drops = createDragonDrops({ tier: 'baby', hasUniqueDrops: false });
*
* For Demons:
* ===========
* const drops = createDemonDrops({ tier: 'lesser' });
*
* For Bosses:
* ===========
* const table = createBossNPCDrops({
* primaryDrops: [...],
* rareDrops: [...],
* uniqueRate: DROP_RATES.RARE_1_512,
* });
*
* For Validation:
* ================
* const result = validateNPCDrops('Boss Name', drops);
* if (!result.valid) console.error(result.errors);
*/
//# sourceMappingURL=DropImplementationUtils.d.ts.map