-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathharvest-tool.ts
More file actions
111 lines (95 loc) · 2.82 KB
/
Copy pathharvest-tool.ts
File metadata and controls
111 lines (95 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { Player } from '@engine/world/actor/player/player';
import { Skill } from '@engine/world/actor/skills';
export interface HarvestTool {
itemId: number;
level: number;
animation: number;
}
export enum Pickaxe {
BRONZE,
IRON,
STEEL,
MITHRIL,
ADAMANT,
RUNE,
}
export enum Axe {
BRONZE,
IRON,
STEEL,
MITHRIL,
ADAMANT,
RUNE,
DRAGON
}
const Pickaxes: HarvestTool[] = [
{ itemId: 1265, level: 1, animation: 625 },
{ itemId: 1267, level: 1, animation: 626 },
{ itemId: 1269, level: 6, animation: 627 },
{ itemId: 1273, level: 21, animation: 629 },
{ itemId: 1271, level: 31, animation: 628 },
{ itemId: 1275, level: 41, animation: 624 }
];
const Axes: HarvestTool[] = [
{ itemId: 1351, level: 1, animation: 879 },
{ itemId: 1349, level: 1, animation: 877 },
{ itemId: 1353, level: 6, animation: 875 },
{ itemId: 1355, level: 21, animation: 871 },
{ itemId: 1357, level: 31, animation: 869 },
{ itemId: 1359, level: 41, animation: 867 },
{ itemId: 6739, level: 61, animation: 2846 }
];
const FishingRods: HarvestTool[] = [
{ itemId: 309, level: 1, animation: 1363 }
];
/**
* Checks the players inventory and equipment for fishing rod
* @param player
* @return the highest level pickage the player can use, or null if theres none found
*/
export function getFishingRod(player: Player): HarvestTool | null {
for (let i = FishingRods.length - 1; i >= 0; i--) {
if (player.skills.hasLevel(Skill.FISHING, FishingRods[i].level)) {
if (player.hasItemOnPerson(FishingRods[i].itemId)) {
return FishingRods[i];
}
}
}
return null;
}
/**
* Checks the players inventory and equipment for pickaxe
* @param player
* @return the highest level pickage the player can use, or null if theres none found
*/
export function getBestPickaxe(player: Player): HarvestTool | null {
for (let i = Pickaxes.length - 1; i >= 0; i--) {
if (player.skills.hasLevel(Skill.MINING, Pickaxes[i].level)) {
if (player.hasItemOnPerson(Pickaxes[i].itemId)) {
return Pickaxes[i];
}
}
}
return null;
}
/**
* Checks the players inventory and equipment for axe
* @param player
* @return the highest level axe the player can use, or null if theres none found
*/
export function getBestAxe(player: Player): HarvestTool | null {
for (let i = Axes.length - 1; i >= 0; i--) {
if (player.skills.hasLevel(Skill.WOODCUTTING, Axes[i].level)) {
if (player.hasItemOnPerson(Axes[i].itemId)) {
return Axes[i];
}
}
}
return null;
}
export function getPickaxe(pickaxe: Pickaxe): HarvestTool {
return Pickaxes[pickaxe];
}
export function getAxe(axe: Axe): HarvestTool {
return Axes[axe];
}