osrs-tools 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +106 -30
  2. package/package.json +90 -75
  3. package/src/index.ts +6 -433
  4. package/src/model/Requirement.ts +173 -0
  5. package/src/model/account/OsrsAccount.ts +82 -0
  6. package/src/model/quest/Quest.ts +44 -0
  7. package/src/model/quest/QuestTool.ts +96 -0
  8. package/src/model/slayer/Assignment.ts +40 -0
  9. package/src/model/slayer/SlayerMaster.ts +137 -0
  10. package/src/model/slayer/SlayerReward.ts +39 -0
  11. package/src/model/slayer/Task.ts +168 -0
  12. package/src/resources/QuestData.json +754 -0
  13. package/src/{data/Diaries → resources/quest}/diaries.json +3 -3
  14. package/src/{data/quest/questData.ts → resources/quest/questData.js} +169 -223
  15. package/src/{data/quest/questDataArray.json → resources/quest/questData.json} +950 -1833
  16. package/src/resources/quest/questDataArray.js +5489 -0
  17. package/src/{data/quest/questData.json → resources/quest/questDataArray.json} +642 -643
  18. package/src/{data/quest/miniquestQuestArray.json → resources/quest/subquestArray.js} +2 -2
  19. package/src/{data/quest/subQuestArray.json → resources/quest/subquestArray.json} +1 -1
  20. package/src/{data → resources}/quest/testObj.json +148 -148
  21. package/src/{data → resources}/quest/testarray.json +149 -149
  22. package/src/resources/quests/CooksAssistant.json +34 -0
  23. package/src/resources/slayer/Masters.ts +180 -0
  24. package/src/resources/slayer/SlayerData.ts +45 -0
  25. package/src/resources/slayer/SlayerExtends.ts +218 -0
  26. package/src/resources/slayer/SlayerUnlock.ts +194 -0
  27. package/src/resources/slayer/slayer.json +3581 -0
  28. package/src/resources/slayer/slayerBuys.ts +38 -0
  29. package/src/resources/slayer/slayerData.json +4431 -0
  30. package/src/resources/slayer/tasks/ChaelderTasks.ts +235 -0
  31. package/src/resources/slayer/tasks/DuradelTasks.ts +75 -0
  32. package/src/resources/slayer/tasks/KonarTasks.ts +6 -0
  33. package/src/resources/slayer/tasks/MazchnaTasks.ts +5 -0
  34. package/src/resources/slayer/tasks/NieveTasks.ts +235 -0
  35. package/src/resources/slayer/tasks/ReadTasks.ts +55 -0
  36. package/src/resources/slayer/tasks/SpriaTasks.ts +344 -0
  37. package/src/resources/slayer/tasks/Tureal.ts +436 -0
  38. package/src/resources/slayer/tasks/VannakaTasks.ts +236 -0
  39. package/src/resources/slayer/tasks/json/Chaeldar.json +348 -0
  40. package/src/resources/slayer/tasks/json/Duradel.json +541 -0
  41. package/src/resources/slayer/tasks/json/Krystilia.json +2 -0
  42. package/src/resources/slayer/tasks/json/Mazchna.json +379 -0
  43. package/src/resources/slayer/tasks/json/Neive.json +320 -0
  44. package/src/resources/slayer/tasks/json/Spria.json +345 -0
  45. package/src/resources/slayer/tasks/json/Tureal.json +341 -0
  46. package/src/resources/slayer/tasks/json/Vannaka.json +547 -0
  47. package/src/cli.js +0 -9
  48. package/src/data/farming/fruitTrees.json +0 -165
  49. package/src/data/farming/locations.json +0 -78
  50. package/src/data/farming/patches.json +0 -102
  51. package/src/data/farming/seeds.json +0 -170
  52. package/src/data/farming/teleports.json +0 -301
  53. package/src/data/farming/treePatches.json +0 -3
  54. package/src/data/farming/trees.json +0 -103
  55. package/src/data/quest/miniquestQuestArray.ts +0 -8
  56. package/src/data/quest/questDataArray.ts +0 -4134
  57. package/src/data/quest/subQuestArray.ts +0 -60
  58. package/src/tests/QuestTest.js +0 -71
  59. package/src/tests/getAllQuestSeries.ts +0 -6
  60. package/src/tests/test Quest Array.ts +0 -9
  61. package/src/tests/test Requirements.ts +0 -56
  62. package/src/tests/test.ts +0 -402
  63. package/src/tests/test3.js +0 -370
  64. package/src/tests/testQuestCompletion.js +0 -367
  65. package/src/tests/testSeed.js +0 -8
  66. package/src/utils/AchievementDiary.ts +0 -18
  67. package/src/utils/Farming/FarmingTool.ts +0 -110
  68. package/src/utils/Farming/Seed.js +0 -42
  69. package/src/utils/Farming/TreeSeed.js +0 -21
  70. package/src/utils/OsrsAccount.ts +0 -280
  71. package/src/utils/Quest.ts +0 -99
  72. package/src/utils/QuestTool.ts +0 -437
  73. package/src/utils/Requirement.ts +0 -63
  74. package/src/utils/Skill.ts +0 -11
  75. /package/src/{data/Diaries → resources/quest}/diariesArray.json +0 -0
  76. /package/src/{data → resources/quest}/exp.json +0 -0
@@ -1,437 +0,0 @@
1
- // import * as questData from './data/questData.js';
2
- // import * as questDataArray from './data/questDataArray.js';
3
- // import * as subQuestArray from './data/subQuestArray.js';
4
- // import { OsrsAccount } from './osrsAcc.js';
5
-
6
- import { Quest, QuestObject, SubQuest } from './Quest';
7
-
8
- // import * as subQuestArray from 'osrs-quest-tool/src/data/subQuestArray';
9
- import { QuestData } from '../data/quest/questData';
10
- import { QuestArray } from '../data/quest/questDataArray';
11
- import { SubQuestArray } from '../data/quest/subQuestArray';
12
- import { OsrsAccount, OsrsAccountObject } from './OsrsAccount';
13
-
14
- export class QuestTool {
15
- osrsAccount: OsrsAccount;
16
- constructor() {
17
- this.osrsAccount = null;
18
- }
19
-
20
- /**
21
- * to string func
22
- * @todo
23
- * */
24
- toString() {
25
- return 'QuestTool :) WIP';
26
- }
27
-
28
- /**
29
- * Get the data for a quest
30
- * @param {String} questName The name of the quest
31
- * @return {object} The data for the input quest in a JSON object.
32
- * */
33
- getQuestByName(questName: string): Quest {
34
- if (questName == '' || questName == null || questName == undefined) {
35
- throw new Error('No Quest found');
36
- }
37
-
38
- if (questName) {
39
- if (QuestData[questName]) {
40
- return new Quest(QuestData[questName]);
41
- } else {
42
- /**
43
- * @TODO Implement AI to predict mispelling of quests
44
- */
45
- return new Quest(QuestData[questName]);
46
- }
47
- }
48
- }
49
-
50
- /**
51
- * Get the data for a quest
52
- * @param {String} questName The name of the quest
53
- * @return {Quest} The data for the input quest in a JSON object.
54
- * */
55
- getSubQuestByName(subQuestName): Quest {
56
- if (
57
- subQuestName &&
58
- subQuestName != null &&
59
- subQuestName != undefined &&
60
- typeof subQuestName === 'string'
61
- ) {
62
- var q = new Quest(SubQuestArray.filter((x) => x.name == subQuestName)[0]);
63
- if (q) {
64
- return q;
65
- } else {
66
- /**
67
- * @todo Implement AI to predict mispelling of quests
68
- */
69
- return null;
70
- }
71
- }
72
- }
73
-
74
- /**
75
- * List of highest boostable levels with skills including spicy stew etc
76
- * @param {String} skillName The first number
77
- * @return {Number} The highest boost possible for that skill.
78
- * */
79
- highestBoost(skillName: string): number {
80
- switch (skillName) {
81
- case 'construction':
82
- // spicy stew + crystal saw
83
- return 8;
84
- case 'strength':
85
- //spicy stew 5
86
- // Drunk dragon 1-7
87
- // Premade dr'dragon 1-7
88
- return 7;
89
- case 'thieving':
90
- case 'woodcutting':
91
- case 'hunter': // spicy stew
92
- case 'magic': // Imbued heart 10
93
- //spicy stew 5
94
- case 'hitpoints':
95
- // Guthix rest 5
96
- // Anglerfish
97
- //Abidor Crank 15
98
- // Amulet of the damned 10
99
- case 'mining': // spicy stew
100
- case 'prayer': // spicy stew
101
- case 'ranged': // spicy stew
102
- case 'runecraft': //spicy stew 5
103
- case 'slayer': //spicy stew 5
104
- case 'smithing': //spicy stew 5
105
- case 'cooking': // spicy stew
106
- case 'crafting': // spicy stew
107
- case 'defence': //spicy stew 5
108
- case 'farming': // spicy stew
109
- case 'firemaking': // spicy stew
110
- case 'fishing': // spicy stew
111
- case 'fletching': // spicy stew
112
- case 'herblore': // spicy stew
113
- case 'agility':
114
- // spicy stew
115
- case 'attack':
116
- //spicy stew
117
- return 5;
118
- default:
119
- break;
120
- }
121
- }
122
-
123
- /**
124
- * Add two numbers together
125
- * @todo Need to implement Recipe for disaster functionality
126
- * @param {Quest} quest The either string or quest object of the quest to be determined completeable or not.
127
- * @return {Boolean} If the account currently tied to the tool can complete the quest.
128
- * */
129
- canCompleteQuest(quest: Quest) {
130
- if (quest == undefined || quest == null) {
131
- throw new Error(
132
- 'Cannot pass undefined or null value into canCOmpleteQuest method.'
133
- );
134
- return true;
135
- }
136
-
137
- if (quest.name === 'Recipe for Disaster') {
138
- // @todo
139
- // Pirate Pete Subquest of Recipe for Disaster
140
- return true;
141
- } else if (quest.name === 'Pirate Pete subquest of Recipe for Disaster') {
142
- /**
143
- * @Todo Implement RFD recursion
144
- * */
145
- // Pirate Pete Subquest of Recipe for Disaster
146
- return true;
147
- }
148
- //check to see if the account can fulfill all skill requirements
149
- if (quest.requirements.levels) {
150
- for (var x in quest.requirements.levels) {
151
- var cur = quest.requirements.levels[x];
152
- /**
153
- * cur.level
154
- * cur.skill
155
- * cur.boostable
156
- * cur.ironman
157
- * types: "quest", "combat", "agility"...
158
- **/
159
-
160
- // If the requirement is mandatory for ironmen
161
- if (cur.ironman && cur.ironman == true) {
162
- if (cur.boostable) {
163
- // Can boost with highest boost
164
- if (
165
- this.osrsAccount.main.skills[cur.skill] +
166
- this.highestBoost(cur.skill) <
167
- cur.level
168
- ) {
169
- return false;
170
- }
171
- } else {
172
- if (this.osrsAccount.main.skills[cur.skill] < cur.level) {
173
- return false;
174
- }
175
- }
176
- }
177
- // If the requirement is quest points, check to see if the account has the quest points to complete it
178
- if (cur.skill === 'quest') {
179
- if (this.osrsAccount.main.questPoints < cur.level) {
180
- return false;
181
- }
182
-
183
- // if the requirement is combat level to start the quest, check to see if the account's combat level is higher than or equal to the requirement
184
- } else if (cur.skill === 'combat') {
185
- if (this.osrsAccount.main.combatLevel < cur.level) {
186
- return false;
187
- }
188
-
189
- // If this is ANY skill agility, runecraft, woodcutting, slayer, attack, defence, hitpoints, mining smithing, herblore, fletching, ranged, magic
190
- } else {
191
- // if the requirement is boostable
192
- if (cur.boostable) {
193
- // check if max stew can reach
194
- if (
195
- this.osrsAccount.main.skills[cur.skill] +
196
- this.highestBoost(cur.skill) <
197
- cur.level
198
- ) {
199
- return false;
200
- }
201
-
202
- // if not boostable, check to see if the skill is higher than or equal to
203
- } else {
204
- if (this.osrsAccount.main.skills[cur.skill] < cur.level) {
205
- return false;
206
- }
207
- }
208
- }
209
- }
210
- }
211
-
212
- // Check for all quest requirements
213
- // recursive method called
214
- if (quest.requirements.quests && quest.requirements.quests >= 1) {
215
- for (var y in quest.requirements.quests) {
216
- // If any of the quests required are not completeable: return false
217
- if (
218
- this.canCompleteQuest(QuestData[quest.requirements.quests[y]]) != true
219
- ) {
220
- return false;
221
- }
222
- }
223
- }
224
-
225
- //iterate through any subquests and see if we can complete
226
- //this is for future work with Recipe for Disaster
227
- if (quest.subquests && quest.subquests.length >= 1) {
228
- for (var y in quest.subquests) {
229
- // If any of the quests required are not completeable: return false
230
- if (
231
- this.canCompleteQuest(QuestData[quest.requirements.subquests[y]]) !=
232
- true
233
- ) {
234
- return false;
235
- }
236
- }
237
- }
238
-
239
- // If the account can complete all quests and skills are higher than or boostable
240
- return true;
241
- }
242
- /**
243
- * Add two numbers together
244
- * @todo Need to implement Recipe for disaster functionality
245
- * @param {Quest} quest The either string or quest object of the quest to be determined completeable or not.
246
- * @return {Boolean} If the account currently tied to the tool can complete the quest.
247
- * */
248
- canCompleteQuestWithMap(quest: Quest, callBackMap: Map<String, Boolean>) {
249
- if (quest == undefined || quest == null) {
250
- throw new Error(
251
- 'Cannot pass undefined or null value into canCOmpleteQuest method.'
252
- );
253
- return true;
254
- }
255
-
256
- if (quest.name === 'Recipe for Disaster') {
257
- // @todo
258
- // Pirate Pete Subquest of Recipe for Disaster
259
- return true;
260
- } else if (quest.name === 'Pirate Pete subquest of Recipe for Disaster') {
261
- /**
262
- * @Todo Implement RFD recursion
263
- * */
264
- // Pirate Pete Subquest of Recipe for Disaster
265
- return true;
266
- }
267
- //check to see if the account can fulfill all skill requirements
268
- if (quest.requirements.levels) {
269
- for (var x in quest.requirements.levels) {
270
- var cur = quest.requirements.levels[x];
271
- /**
272
- * cur.level
273
- * cur.skill
274
- * cur.boostable
275
- * cur.ironman
276
- * types: "quest", "combat", "agility"...
277
- **/
278
- // If the requirement is mandatory for ironmen
279
- if (cur.ironman && cur.ironman == true) {
280
- if (cur.boostable) {
281
- // Can boost with highest boost
282
- if (
283
- this.osrsAccount.main.skills[cur.skill] +
284
- this.highestBoost(cur.skill) <
285
- cur.level
286
- ) {
287
- return false;
288
- }
289
- } else {
290
- if (this.osrsAccount.main.skills[cur.skill] < cur.level) {
291
- return false;
292
- }
293
- }
294
- }
295
- // If the requirement is quest points, check to see if the account has the quest points to complete it
296
- if (cur.skill === 'quest') {
297
- if (this.osrsAccount.main.questPoints < cur.level) {
298
- return false;
299
- }
300
-
301
- // if the requirement is combat level to start the quest, check to see if the account's combat level is higher than or equal to the requirement
302
- } else if (cur.skill === 'combat') {
303
- if (this.osrsAccount.main.combatLevel < cur.level) {
304
- return false;
305
- }
306
-
307
- // If this is ANY skill agility, runecraft, woodcutting, slayer, attack, defence, hitpoints, mining smithing, herblore, fletching, ranged, magic
308
- } else {
309
- // if the requirement is boostable
310
- if (cur.boostable) {
311
- // check if max stew can reach
312
- if (
313
- this.osrsAccount.main.skills[cur.skill] +
314
- this.highestBoost(cur.skill) <
315
- cur.level
316
- ) {
317
- return false;
318
- }
319
-
320
- // if not boostable, check to see if the skill is higher than or equal to
321
- } else {
322
- if (this.osrsAccount.main.skills[cur.skill] < cur.level) {
323
- return false;
324
- }
325
- }
326
- }
327
- }
328
- }
329
-
330
- // Check for all quest requirements
331
- // recursive method called
332
- if (quest.requirements.quests && quest.requirements.quests >= 1) {
333
- for (var y in quest.requirements.quests) {
334
- var curQuestReq = quest.requirements.quests[y];
335
- // If any of the quests required are not completeable: return false
336
- if (
337
- this.canCompleteQuestWithMap(QuestData[curQuestReq], callBackMap) !=
338
- true
339
- ) {
340
- return false;
341
- } else {
342
- callBackMap.set(quest.name, true);
343
- }
344
- }
345
- }
346
-
347
- //iterate through any subquests and see if we can complete
348
- //this is for future work with Recipe for Disaster
349
- if (quest.subquests && quest.subquests.length >= 1) {
350
- for (var y in quest.subquests) {
351
- // If any of the quests required are not completeable: return false
352
- if (
353
- this.canCompleteQuest(QuestData[quest.requirements.subquests[y]]) !=
354
- true
355
- ) {
356
- return false;
357
- }
358
- }
359
- }
360
-
361
- // If the account can complete all quests and skills are higher than or boostable
362
- return true;
363
- }
364
- /**
365
- * Return an array of quests that can be completed with the associated account
366
- * This needs to be recursive or call a recursive function to check for all quests
367
- * @return {Array}<Quest> The total of the two numbers
368
- */
369
- getAllCompletableQuests(): Array<any> {
370
- var completed = [];
371
- let checked = new Map();
372
- for (var index = 0; index < QuestArray.length; index++) {
373
- var currentQuest = QuestArray[index];
374
- this.getQuestCompletionRecursion(currentQuest, checked);
375
- if (checked.get(currentQuest.name) == true) {
376
- completed.push(QuestArray[index].name);
377
- }
378
- }
379
-
380
- return completed;
381
- }
382
-
383
- getQuestCompletionRecursion(
384
- checkThisQuest: Quest,
385
- mapOfChecked: Map<string, boolean>
386
- ) {
387
- checkThisQuest;
388
- throw new Error('Method not implemented.');
389
- }
390
-
391
- /**
392
- * Set the account to be used in this quest tool
393
- * @param {OsrsAccountObject} osrsAccountObject object returned from The osrs Account to be associated with this class object.
394
- * */
395
- setOsrsAccount(acc1: OsrsAccountObject) {
396
- this.osrsAccount = new OsrsAccount(acc1);
397
- return this.osrsAccount;
398
- }
399
-
400
- /**
401
- * Set the account to be used in this quest tool
402
- * @param {OsrsAccountObject} Object osrs Account to be associated with this class object.
403
- * */
404
- setAccount(acc1: OsrsAccountObject) {
405
- this.osrsAccount = new OsrsAccount(acc1);
406
- return this.osrsAccount;
407
- }
408
-
409
- /**
410
- * Add two numbers together
411
- * @param {Number} num1 The first number
412
- * @param {Number} num2 The second number
413
- * @return {Number} The total of the two numbers
414
- */
415
- getOsrsAccount() {
416
- return this.osrsAccount;
417
- }
418
-
419
- getQuestObject() {
420
- return QuestData;
421
- }
422
- /**
423
- * Get the sub quest array
424
- * @return {Array<Quest>} The data for the input quest in a JSON object.
425
- * */
426
- getSubQuestArray() {
427
- return SubQuestArray;
428
- }
429
-
430
- /**
431
- * Get thequest array
432
- * @return {Array} The data for the input quest in a JSON object.
433
- * */
434
- getQuestArray(): Array<Quest> {
435
- return QuestArray;
436
- }
437
- }
@@ -1,63 +0,0 @@
1
- /**
2
- * Requiremant class
3
- * Author: James Cerniglia
4
- */
5
-
6
- import { Quest } from './Quest';
7
- import { QuestTool } from './QuestTool';
8
- // const questData = require('../data/quest/questData.js');
9
- export interface RequirementObject {
10
- /**
11
- * requirements: {
12
- * quests: [ 'Death to the Dorgeshuun',],
13
- * skills: [{ skill: 'quest', level: 16, boostable: false }],},
14
- * */
15
- quests: Array<String>;
16
- skills: Array<SkillRequirementObject>;
17
- }
18
-
19
- export interface SkillRequirementObject {
20
- /**{ skill: 'quest', level: 16, boostable: false } */
21
- skill: String;
22
- level: Number;
23
- boostable: Boolean;
24
- }
25
- export class Requirement {
26
- requirementObject: object;
27
- constructor(requirementObject: RequirementObject) {
28
- this.requirementObject = requirementObject ?? null;
29
- }
30
-
31
- /**
32
- *
33
- * @returns {String} string description of class
34
- */
35
- toString() {
36
- return this.requirementObject;
37
- }
38
- }
39
-
40
- export class SkillRequirement {
41
- skillObject: object;
42
- boostable: Boolean;
43
- constructor(skillObject: SkillRequirementObject) {
44
- this.skillObject = skillObject ?? null;
45
- this.boostable = skillObject?.boostable ?? null;
46
- }
47
- }
48
- export class QuestRequirement {
49
- quest: Quest;
50
- constructor(questName: string) {
51
- this.quest = new QuestTool().getQuestByName(questName);
52
- }
53
-
54
- /**
55
- * Gets Quest Object
56
- * @returns {Quest} Quest boject tied to this requirement
57
- */
58
- getQuest() {
59
- return this.quest;
60
- }
61
- }
62
-
63
- // test();
@@ -1,11 +0,0 @@
1
- /**
2
- * Skill class
3
- * Author: James Cerniglia
4
- */
5
-
6
- export class Skill {
7
- level: Number;
8
- name: String;
9
- experience: Number;
10
- constructor() {}
11
- }
File without changes