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,18 +0,0 @@
1
-
2
- import { Requirement QuestRequirement,
3
- SkillRequirement, } from './Requirement';
4
-
5
- /**
6
- * AchievementDiary class
7
- * Author: James Cerniglia
8
- */
9
-
10
- export class AchievementDiary {
11
-
12
- rewards:Object;
13
-
14
- constructor() {
15
-
16
- }
17
- }
18
-
@@ -1,110 +0,0 @@
1
- import { OsrsAccount } from '../OsrsAccount';
2
- import { subQuestArray } from '../../data/quest/subQuestArray';
3
- const questData = require('../../data/quest/questData.js');
4
- const questDataArray = require('../data/questDataArray.js');
5
- const trees = require('../data/farming/tree.json');
6
- const fruitTrees = require('../../data/farming/fruitTrees.json');
7
- const { Seed } = require('./Seed.js');
8
-
9
- class FarmingTool {
10
- osrsAccount: OsrsAccount;
11
- trees: any;
12
- fruitTrees: any;
13
- constructor(osrsAccount) {
14
- this.osrsAccount = acc1 != null ? new OsrsAccount(acc1) : null;
15
- this.trees = questDataArray;
16
- this.fruitTrees = subQuestArray;
17
- }
18
- /**
19
- * to string func
20
- * @todo Possibly return all methods etc with descriptions
21
- * */
22
- toString() {
23
- return 'FarmingTool :) WIP';
24
- }
25
-
26
- /**
27
- * Set the account to be used in this quest tool
28
- * @param {} skillName The osrs Account to be associated with this class object.
29
- * */
30
- getTreeRun() {
31
- if (this.hasOsrsAccount()) {
32
- return false;
33
- } else {
34
- //Lets get levels for tree run
35
- var level = this.osrsAccount.getFarmingLevel();
36
- }
37
- }
38
- /**
39
- * Set the account to be used in this quest tool
40
- * @param {} skillName The osrs Account to be associated with this class object.
41
- * */
42
- getItemsForSeed(seed: Seed) {}
43
-
44
- /**
45
- * getFruitTreeRun
46
- */
47
- getFruitTreeRun() {
48
- if (this.hasOsrsAccount()) {
49
- return false;
50
- } else {
51
- var level = this.osrsAccount.getFarmingLevel();
52
- }
53
- }
54
-
55
- /**
56
- * getCombinedTreeRun
57
- * */
58
- getCombinedTreeRun() {
59
- if (this.hasOsrsAccount()) {
60
- return false;
61
- } else {
62
- var level = this.osrsAccount.getFarmingLevel();
63
- }
64
- }
65
-
66
- /**
67
- * Set the account to be used in this quest tool
68
- * @param {Object} skillName The osrs Account to be associated with this class object.
69
- * */
70
- setOsrsAccount(acc1) {
71
- if (acc1) {
72
- this.osrsAccount = new OsrsAccount(acc1);
73
- return true;
74
- } else {
75
- return false;
76
- }
77
- }
78
-
79
- /**
80
- * Set the account to be used in this quest tool
81
- * @param {Object} skillName The osrs Account to be associated with this class object.
82
- * */
83
- setAccount(acc1) {
84
- if (acc1) {
85
- this.osrsAccount = new OsrsAccount(acc1);
86
- }
87
- }
88
- /**
89
- * if the tool has an osrsaccount associated with
90
- * @return {Boolean}
91
- * */
92
- hasOsrsAccount() {
93
- if (this.osrsAccount != null && this.osrsAccount) {
94
- return true;
95
- } else {
96
- return false;
97
- }
98
- }
99
-
100
- /**
101
- * Set the account to be used in this quest tool
102
- * @return {OsrsAccount} osrsAccount The osrs Account to be associated with this class object.
103
- * */
104
- getOsrsAccount() {
105
- return this.osrsAccount;
106
- }
107
- }
108
-
109
- module.exports = { FarmingTool };
110
- // exports.QuestTool = QuestTool;
@@ -1,42 +0,0 @@
1
- const seeds = require('../../data/farming/seeds.json'); //list of all seeds
2
-
3
- class Seed {
4
- seed;
5
- constructor({ name, level, xp, type }) {
6
- this.name = name;
7
- this.level = level;
8
- this.xp = xp;
9
- this.type = type;
10
- }
11
-
12
- getSeedAmount() {
13
- let seedAmount = 1;
14
- switch (this.type.toLowerCase()) {
15
- case 'flower':
16
- case 'tree':
17
- case 'herb':
18
- seedAmount = 1;
19
- break;
20
- case 'allotment':
21
- seedAmount = 3;
22
- break;
23
- default:
24
- seedAmount = 1;
25
- break;
26
- }
27
- return seedAmount;
28
- }
29
- getLevel() {
30
- return this.level > 1 ? this.level : 1;
31
- }
32
-
33
- getRequiredLevel() {
34
- return this.level > 1 ? this.level : 1;
35
- }
36
- }
37
-
38
- module.exports = {
39
- seedlist: seeds,
40
- seeds: seeds,
41
- Seed: Seed,
42
- };
@@ -1,21 +0,0 @@
1
- const treeSeeds = require('../../data/farming/trees.json');
2
- const fruitTreeSeeds = require('../../data/farming/fruitTrees.json');
3
-
4
- class TreeSeed extends Seed {
5
- constructor(seed) {
6
- this.seed = seed;
7
- }
8
-
9
- getProtection() {
10
- this.seed.protection;
11
- }
12
- getProtection() {
13
- this.seed.uses;
14
- }
15
- }
16
-
17
- module.exports = {
18
- TreeSeed: TreeSeed,
19
- treeSeeds: treeSeeds,
20
- fruitTreeSeeds: fruitTreeSeeds,
21
- };
@@ -1,280 +0,0 @@
1
- import { Skill } from './Skill';
2
-
3
- export interface OsrsAccountObject {
4
- osrsAccount: object;
5
-
6
- main: {
7
- questPoints: number;
8
- combatLevel: number;
9
- skills: {
10
- overall: SkillObject;
11
- attack: SkillObject;
12
- defence: SkillObject;
13
- strength: SkillObject;
14
- hitpoints: SkillObject;
15
- ranged: SkillObject;
16
- prayer: SkillObject;
17
- magic: SkillObject;
18
- cooking: SkillObject;
19
- woodcutting: SkillObject;
20
- fletching: SkillObject;
21
- fishing: SkillObject;
22
- firemaking: SkillObject;
23
- crafting: SkillObject;
24
- smithing: SkillObject;
25
- mining: SkillObject;
26
- herblore: SkillObject;
27
- agility: SkillObject;
28
- thieving: SkillObject;
29
- slayer: SkillObject;
30
- farming: SkillObject;
31
- runecraft: SkillObject;
32
- hunter: SkillObject;
33
- construction: SkillObject;
34
- };
35
- };
36
- name: string;
37
- combatLevel: number;
38
- }
39
-
40
- export interface SkillObject {
41
- rank: number;
42
- level: number;
43
- xp: number;
44
- }
45
-
46
- /**
47
- * OsrsAccount
48
- * Author: James Cerniglia
49
- */
50
- export class OsrsAccount {
51
- osrsAccount: OsrsAccountObject;
52
-
53
- main: {
54
- questPoints: number;
55
- combatLevel: number;
56
- skills: {
57
- overall: SkillObject;
58
- attack: SkillObject;
59
- defence: SkillObject;
60
- strength: SkillObject;
61
- hitpoints: SkillObject;
62
- ranged: SkillObject;
63
- prayer: SkillObject;
64
- magic: SkillObject;
65
- cooking: SkillObject;
66
- woodcutting: SkillObject;
67
- fletching: SkillObject;
68
- fishing: SkillObject;
69
- firemaking: SkillObject;
70
- crafting: SkillObject;
71
- smithing: SkillObject;
72
- mining: SkillObject;
73
- herblore: SkillObject;
74
- agility: SkillObject;
75
- thieving: SkillObject;
76
- slayer: SkillObject;
77
- farming: SkillObject;
78
- runecraft: SkillObject;
79
- hunter: SkillObject;
80
- construction: SkillObject;
81
- };
82
- };
83
- name: string;
84
- combatLevel: number;
85
-
86
- constructor(accountObject: OsrsAccountObject) {
87
- // uses an account under the schema returned from const osrshiscores = require('osrs-json-hiscores');
88
- this.osrsAccount = accountObject ?? null;
89
- this.setQuestPoints(0);
90
- this.setCombatLevel();
91
- }
92
-
93
- toString() {
94
- return (
95
- this.osrsAccount.name +
96
- ': \nCombat Level: ' +
97
- this.osrsAccount.main.combatLevel +
98
- '\nQuestPoints: ' +
99
- this.getQuestPoints()
100
- );
101
- }
102
-
103
- /**
104
- * Get Skills for account
105
- * @return {Array} The array of skills associated with this account
106
- */
107
- getSkills() {
108
- return this.osrsAccount.main.skills;
109
- }
110
-
111
- /**
112
- * Get Quest Points for account
113
- * @return {Number} The amount of quest points for this account
114
- */
115
- getQuestPoints() {
116
- return this.osrsAccount.main.questPoints;
117
- }
118
-
119
- /**
120
- * Set Quest Points for account
121
- * @param {Number} x integer that is greater than or equal to 0, cannot put < 0
122
- */
123
- setQuestPoints(x) {
124
- if (x >= 0) {
125
- this.osrsAccount.main.questPoints = x;
126
- } else {
127
- this.osrsAccount.main.questPoints = 0;
128
- }
129
- }
130
- /**
131
- * Get Combat Level for account
132
- * @return {Number} The combat level for this account
133
- */
134
- getCombatLevel() {
135
- return this.osrsAccount.main.combatLevel;
136
- }
137
-
138
- /**
139
- * Set Combat Level for account
140
- */
141
- setCombatLevel() {
142
- var attklvl = this.osrsAccount.main.skills.attack.level ?? 1;
143
- var strlvl = this.osrsAccount.main.skills.strength.level ?? 1;
144
- var deflvl = this.osrsAccount.main.skills.defence.level ?? 1;
145
- var rangedlvl = this.osrsAccount.main.skills.ranged.level ?? 1;
146
- var magiclvl = this.osrsAccount.main.skills.magic.level ?? 1;
147
- var praylvl = this.osrsAccount.main.skills.prayer.level ?? 1;
148
- var hplvl = this.osrsAccount.main.skills.hitpoints.level ?? 10;
149
- var x = [
150
- Number(0.325 * (attklvl + strlvl)),
151
- Number(0.325 * ((3 * rangedlvl) / 2)),
152
- Number(0.325 * ((3 * magiclvl) / 2)),
153
- ];
154
- var cbMax = Math.max.apply(Math, x);
155
- var cb = parseInt(0.25 * (deflvl + hplvl + praylvl / 2) + cbMax);
156
- this.osrsAccount.main.combatLevel = cb;
157
- return true;
158
- }
159
-
160
- /**
161
- * Get Skill level for key input
162
- * @return {Number} The combat level for this account\
163
- * Example: "getSkillLevel('farming'"
164
- */
165
- getSkillLevel(skillName) {
166
- if (skillName) {
167
- var skillLowercase = skillName.toLowerCase();
168
- if (this.osrsAccount.main.skills[skillLowercase].level) {
169
- return this.osrsAccount.main.skills[skillLowercase].level;
170
- } else {
171
- console.log('No SkillName found for ' + skillName);
172
- return false;
173
- }
174
- }
175
- console.log('No SkillName found for ' + skillName);
176
- return false;
177
- }
178
-
179
- /**
180
- * Get Skill level for key input
181
- * Example: "getFarmingLevel()
182
- */
183
- getAttackLevel() {
184
- if (this.osrsAccount.main.skills.attack.level) {
185
- return this.osrsAccount.main.skills.attack.level;
186
- }
187
- console.log('No attack found for ' + this.osrsAccount.name);
188
- return false;
189
- }
190
- /**
191
- * Get Skill level for key input
192
- * Example: "getFarmingLevel()
193
- */
194
- getStrengthLevel() {
195
- if (this.osrsAccount.main.skills.strength.level) {
196
- return this.osrsAccount.main.skills.strength.level;
197
- }
198
- console.log('No strength found for ' + this.osrsAccount.name);
199
- return false;
200
- }
201
- /**
202
- * Get Skill level for key input
203
- * Example: "getFarmingLevel()
204
- */
205
- getDefenceLevel() {
206
- if (this.osrsAccount.main.skills.defence.level) {
207
- return this.osrsAccount.main.skills.defence.level;
208
- }
209
- console.log('No defence found for ' + this.osrsAccount.name);
210
- return false;
211
- }
212
- /**
213
- * Get Skill level for key input
214
- * Example: "getFarmingLevel()
215
- */
216
- getRangedLevel() {
217
- if (this.osrsAccount.main.skills.ranged.level) {
218
- return this.osrsAccount.main.skills.ranged.level;
219
- }
220
- console.log('No ranged found for ' + this.osrsAccount.name);
221
- return false;
222
- }
223
- /**
224
- * Get Skill level for key input
225
- * Example: "getFarmingLevel()
226
- */
227
- getPrayerLevel() {
228
- if (this.osrsAccount.main.skills.prayer.level) {
229
- return this.osrsAccount.main.skills.prayer.level;
230
- }
231
- console.log('No prayer found for ' + this.osrsAccount.name);
232
- return false;
233
- }
234
- /**
235
- * Get Skill level for key input
236
- * Example: "getFarmingLevel()
237
- */
238
- getMagicLevel() {
239
- if (this.osrsAccount.main.skills.prayer.level) {
240
- return this.osrsAccount.main.skills.prayer.level;
241
- }
242
- console.log('No prayer found for ' + this.osrsAccount.name);
243
- return false;
244
- }
245
-
246
- /**
247
- * Get Skill level for key input
248
- * Example: "getFarmingLevel()
249
- */
250
- getRunecraftingLevel() {
251
- if (this.osrsAccount.main.skills.runecraft.level) {
252
- return this.osrsAccount.main.skills.runecraft.level;
253
- }
254
- console.log('No runecraft found for ' + this.osrsAccount.name);
255
- return false;
256
- }
257
- /**
258
- * Get Skill level for key input
259
- * Example: "getFarmingLevel()
260
- */
261
- getConstructionLevel() {
262
- if (this.osrsAccount.main.skills.construction.level) {
263
- return this.osrsAccount.main.skills.construction.level;
264
- }
265
- console.log('No construction found for ' + this.osrsAccount.name);
266
- return false;
267
- }
268
-
269
- /**
270
- * Get Skill level for key input
271
- * Example: "getFarmingLevel()
272
- */
273
- getHitpointsLevel() {
274
- if (this.osrsAccount.main.skills.hitpoints.level) {
275
- return this.osrsAccount.main.skills.hitpoints.level;
276
- }
277
- console.log('No hitpoints found for ' + this.osrsAccount.name);
278
- return false;
279
- }
280
- }
@@ -1,99 +0,0 @@
1
- import { Requirement, QuestRequirement, SkillRequirement } from './Requirement';
2
-
3
- /**
4
- * Quest class
5
- * Author: James Cerniglia
6
- */
7
- export enum QuestSeries {
8
- Up = 'UP',
9
- Down = 'DOWN',
10
- Left = 'LEFT',
11
- Right = 'RIGHT',
12
- }
13
-
14
- export interface QuestObject {
15
- isMembers: Boolean;
16
- isSubquest: Boolean;
17
- isMiniquest: Boolean;
18
- name: String;
19
- shortName: String;
20
- url: String;
21
- itemsRecommended: Array<String>;
22
- enemiesToDefeat: Array<String>;
23
- itemsRequired: Array<String>;
24
- startPoint: String;
25
- description: String;
26
- difficulty: String;
27
- questLength: String;
28
- series: String;
29
- subquests: Array<QuestObject>;
30
- requirements: any;
31
- rewards: object;
32
- }
33
-
34
- export class Quest {
35
- questObject: object;
36
- isMembers: Boolean;
37
- isSubquest: Boolean;
38
- isMiniquest: Boolean;
39
- name: String;
40
- shortName: String;
41
- url: String;
42
- itemsRecommended: Array<String>;
43
- enemiesToDefeat: Array<String>;
44
- itemsRequired: Array<String>;
45
- startPoint: String;
46
- description: String;
47
- difficulty: String;
48
- questLength: String;
49
- series: String;
50
- subquests: Array<QuestObject>;
51
- requirements: any;
52
- rewards: object;
53
- constructor(questObject: QuestObject) {
54
- this.questObject = questObject;
55
- this.name = questObject.name;
56
- this.isMiniquest = questObject.isMiniquest;
57
- this.isSubquest = questObject.isSubquest;
58
- this.isMembers = questObject.isMembers;
59
- this.shortName = questObject.shortName;
60
- this.url = questObject.url;
61
- this.difficulty = questObject.difficulty;
62
- this.questLength = questObject.questLength;
63
- this.series = questObject.series;
64
- this.subquests = questObject.subquests;
65
- this.requirements = questObject.requirements;
66
- this.rewards = questObject.rewards;
67
- this.startPoint = questObject.startPoint;
68
- this.description = questObject.description;
69
- this.itemsRequired = questObject.itemsRequired;
70
- this.enemiesToDefeat = questObject.enemiesToDefeat;
71
- this.itemsRecommended = questObject.itemsRecommended;
72
- // Initialize quest requirements
73
-
74
- if (this.requirements?.quests) {
75
- for (var req in this.requirements.quests) {
76
- this.requirements.quests.push(
77
- new QuestRequirement(this.requirements.quests[req])
78
- );
79
- }
80
- }
81
-
82
- if (this.requirements?.skills) {
83
- for (var req in this.requirements.quests) {
84
- this.requirements.push(
85
- new SkillRequirement(this.requirements.quests[req])
86
- );
87
- }
88
- }
89
- }
90
-
91
- /**
92
- *
93
- * @returns {String} string description of class
94
- */
95
- toString() {
96
- return this.name;
97
- }
98
- }
99
- export class SubQuest extends Quest {}