osrs-tools 0.2.0 → 0.2.2

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 (92) hide show
  1. package/dist/index.d.ts +8 -0
  2. package/dist/index.js +12 -0
  3. package/dist/jest.config.dev.js +7 -0
  4. package/dist/model/Requirement.d.ts +65 -0
  5. package/dist/model/Requirement.js +130 -0
  6. package/dist/model/account/OsrsAccount.d.ts +31 -0
  7. package/dist/model/account/OsrsAccount.js +64 -0
  8. package/dist/model/quest/Quest.d.ts +41 -0
  9. package/dist/model/quest/Quest.js +2 -0
  10. package/dist/model/quest/QuestTool.d.ts +51 -0
  11. package/{src/model/quest/QuestTool.ts → dist/model/quest/QuestTool.js} +78 -96
  12. package/dist/model/slayer/Assignment.d.ts +17 -0
  13. package/dist/model/slayer/Assignment.js +28 -0
  14. package/dist/model/slayer/SlayerMaster.d.ts +67 -0
  15. package/dist/model/slayer/SlayerMaster.js +112 -0
  16. package/dist/model/slayer/SlayerReward.d.ts +33 -0
  17. package/dist/model/slayer/SlayerReward.js +30 -0
  18. package/dist/model/slayer/Task.d.ts +85 -0
  19. package/dist/model/slayer/Task.js +117 -0
  20. package/dist/resources/slayer/Masters.d.ts +10 -0
  21. package/dist/resources/slayer/Masters.js +100 -0
  22. package/dist/resources/slayer/SlayerData.d.ts +13 -0
  23. package/dist/resources/slayer/SlayerData.js +42 -0
  24. package/dist/resources/slayer/SlayerExtends.d.ts +23 -0
  25. package/dist/resources/slayer/SlayerExtends.js +184 -0
  26. package/dist/resources/slayer/SlayerUnlock.d.ts +7 -0
  27. package/dist/resources/slayer/SlayerUnlock.js +67 -0
  28. package/dist/resources/slayer/slayerBuys.d.ts +3 -0
  29. package/dist/resources/slayer/slayerBuys.js +34 -0
  30. package/dist/resources/slayer/tasks/ChaelderTasks.d.ts +3 -0
  31. package/dist/resources/slayer/tasks/ChaelderTasks.js +78 -0
  32. package/dist/resources/slayer/tasks/DuradelTasks.d.ts +2 -0
  33. package/dist/resources/slayer/tasks/DuradelTasks.js +18 -0
  34. package/{src/resources/slayer/tasks/KonarTasks.ts → dist/resources/slayer/tasks/KonarTasks.d.ts} +3 -6
  35. package/dist/resources/slayer/tasks/KonarTasks.js +5 -0
  36. package/dist/resources/slayer/tasks/MazchnaTasks.d.ts +3 -0
  37. package/dist/resources/slayer/tasks/MazchnaTasks.js +4 -0
  38. package/dist/resources/slayer/tasks/NieveTasks.d.ts +3 -0
  39. package/dist/resources/slayer/tasks/NieveTasks.js +78 -0
  40. package/dist/resources/slayer/tasks/ReadTasks.d.ts +1 -0
  41. package/dist/resources/slayer/tasks/ReadTasks.js +63 -0
  42. package/dist/resources/slayer/tasks/SpriaTasks.d.ts +2 -0
  43. package/dist/resources/slayer/tasks/SpriaTasks.js +117 -0
  44. package/dist/resources/slayer/tasks/Tureal.d.ts +3 -0
  45. package/dist/resources/slayer/tasks/Tureal.js +125 -0
  46. package/dist/resources/slayer/tasks/VannakaTasks.d.ts +3 -0
  47. package/dist/resources/slayer/tasks/VannakaTasks.js +78 -0
  48. package/package.json +22 -25
  49. package/src/index.ts +0 -11
  50. package/src/model/Requirement.ts +0 -173
  51. package/src/model/account/OsrsAccount.ts +0 -82
  52. package/src/model/quest/Quest.ts +0 -44
  53. package/src/model/slayer/Assignment.ts +0 -40
  54. package/src/model/slayer/SlayerMaster.ts +0 -137
  55. package/src/model/slayer/SlayerReward.ts +0 -39
  56. package/src/model/slayer/Task.ts +0 -168
  57. package/src/resources/QuestData.json +0 -754
  58. package/src/resources/quest/diaries.json +0 -1171
  59. package/src/resources/quest/diariesArray.json +0 -0
  60. package/src/resources/quest/exp.json +0 -1333
  61. package/src/resources/quest/questData.js +0 -5628
  62. package/src/resources/quest/questData.json +0 -5790
  63. package/src/resources/quest/questDataArray.js +0 -5489
  64. package/src/resources/quest/questDataArray.json +0 -5489
  65. package/src/resources/quest/subquestArray.js +0 -58
  66. package/src/resources/quest/subquestArray.json +0 -58
  67. package/src/resources/quest/testObj.json +0 -5682
  68. package/src/resources/quest/testarray.json +0 -5589
  69. package/src/resources/quests/CooksAssistant.json +0 -34
  70. package/src/resources/slayer/Masters.ts +0 -180
  71. package/src/resources/slayer/SlayerData.ts +0 -45
  72. package/src/resources/slayer/SlayerExtends.ts +0 -218
  73. package/src/resources/slayer/SlayerUnlock.ts +0 -194
  74. package/src/resources/slayer/slayer.json +0 -3581
  75. package/src/resources/slayer/slayerBuys.ts +0 -38
  76. package/src/resources/slayer/slayerData.json +0 -4431
  77. package/src/resources/slayer/tasks/ChaelderTasks.ts +0 -235
  78. package/src/resources/slayer/tasks/DuradelTasks.ts +0 -75
  79. package/src/resources/slayer/tasks/MazchnaTasks.ts +0 -5
  80. package/src/resources/slayer/tasks/NieveTasks.ts +0 -235
  81. package/src/resources/slayer/tasks/ReadTasks.ts +0 -55
  82. package/src/resources/slayer/tasks/SpriaTasks.ts +0 -344
  83. package/src/resources/slayer/tasks/Tureal.ts +0 -436
  84. package/src/resources/slayer/tasks/VannakaTasks.ts +0 -236
  85. package/src/resources/slayer/tasks/json/Chaeldar.json +0 -348
  86. package/src/resources/slayer/tasks/json/Duradel.json +0 -541
  87. package/src/resources/slayer/tasks/json/Krystilia.json +0 -2
  88. package/src/resources/slayer/tasks/json/Mazchna.json +0 -379
  89. package/src/resources/slayer/tasks/json/Neive.json +0 -320
  90. package/src/resources/slayer/tasks/json/Spria.json +0 -345
  91. package/src/resources/slayer/tasks/json/Tureal.json +0 -341
  92. package/src/resources/slayer/tasks/json/Vannaka.json +0 -547
@@ -0,0 +1,8 @@
1
+ import { QuestTool } from './model/quest/QuestTool';
2
+ import { OsrsAccount } from './model/account/OsrsAccount';
3
+ declare const _default: {
4
+ QuestTool: typeof QuestTool;
5
+ OsrsAccount: typeof OsrsAccount;
6
+ SlayerTool: any;
7
+ };
8
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // import { QuestTool } from './questTool.js';
4
+ const QuestTool_1 = require("./model/quest/QuestTool");
5
+ const SlayerTool_1 = require("./model/slayer/SlayerTool");
6
+ const OsrsAccount_1 = require("./model/account/OsrsAccount");
7
+ exports.default = {
8
+ QuestTool: QuestTool_1.QuestTool,
9
+ OsrsAccount: OsrsAccount_1.OsrsAccount,
10
+ SlayerTool: SlayerTool_1.SlayerTool
11
+ };
12
+ // export default
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ /** @type {import('jest').Config} */
4
+ var config = {
5
+ verbose: true
6
+ };
7
+ module.exports = config;
@@ -0,0 +1,65 @@
1
+ interface Requirement {
2
+ description: string;
3
+ isMet(): boolean;
4
+ }
5
+ declare class LevelRequirement implements Requirement {
6
+ type: RequirementType;
7
+ skillName: string;
8
+ level: number;
9
+ boostable: boolean;
10
+ constructor(skillName: string, level: number, boostable?: boolean);
11
+ get description(): string;
12
+ isMet(): boolean;
13
+ }
14
+ declare enum RequirementType {
15
+ SlayerLevel = "SlayerLevel",
16
+ Level = "Level",
17
+ CombatLevel = "CombatLevel",
18
+ Quest = "Quest",
19
+ Item = "Item",
20
+ Location = "Location",
21
+ SlayerUnlock = "SlayerUnlock"
22
+ }
23
+ declare class SlayerUnlockRequirement implements Requirement {
24
+ type: RequirementType;
25
+ name: string;
26
+ constructor(name: string);
27
+ get description(): string;
28
+ isMet(): boolean;
29
+ }
30
+ declare class SlayerLevelRequirement implements Requirement {
31
+ type: RequirementType;
32
+ level: number;
33
+ constructor(level: number);
34
+ get description(): string;
35
+ isMet(): boolean;
36
+ }
37
+ declare class CombatLevelRequirement implements Requirement {
38
+ type: RequirementType;
39
+ level: number;
40
+ constructor(level: number);
41
+ get description(): string;
42
+ isMet(): boolean;
43
+ }
44
+ declare class QuestRequirement implements Requirement {
45
+ type: RequirementType;
46
+ questName: string;
47
+ constructor(questName: string);
48
+ get description(): string;
49
+ isMet(): boolean;
50
+ }
51
+ declare class ItemRequirement implements Requirement {
52
+ type: RequirementType;
53
+ itemName: string;
54
+ constructor(itemName: string);
55
+ get description(): string;
56
+ isMet(): boolean;
57
+ }
58
+ declare class LocationRequirement implements Requirement {
59
+ type: RequirementType;
60
+ locationName: string;
61
+ constructor(locationName: string);
62
+ get description(): string;
63
+ isMet(): boolean;
64
+ }
65
+ export { CombatLevelRequirement, ItemRequirement, LevelRequirement, LocationRequirement, QuestRequirement, Requirement, RequirementType, SlayerLevelRequirement, SlayerUnlockRequirement, };
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlayerUnlockRequirement = exports.SlayerLevelRequirement = exports.RequirementType = exports.QuestRequirement = exports.LocationRequirement = exports.LevelRequirement = exports.ItemRequirement = exports.CombatLevelRequirement = void 0;
4
+ // TODO: Add a requirement type for all "levels" (combat, slayer, farming, crafting etc.)
5
+ class LevelRequirement {
6
+ constructor(skillName, level, boostable = false) {
7
+ this.type = RequirementType.Level;
8
+ this.boostable = false; // Indicates if the level can be boosted
9
+ this.boostable = boostable;
10
+ this.skillName = skillName;
11
+ this.level = level;
12
+ }
13
+ get description() {
14
+ return `Level ${this.level}`;
15
+ }
16
+ isMet() {
17
+ // Replace with actual logic to check the player's level
18
+ return false; // TODO
19
+ }
20
+ }
21
+ exports.LevelRequirement = LevelRequirement;
22
+ // Enum for requirement types
23
+ var RequirementType;
24
+ (function (RequirementType) {
25
+ RequirementType["SlayerLevel"] = "SlayerLevel";
26
+ RequirementType["Level"] = "Level";
27
+ RequirementType["CombatLevel"] = "CombatLevel";
28
+ RequirementType["Quest"] = "Quest";
29
+ RequirementType["Item"] = "Item";
30
+ RequirementType["Location"] = "Location";
31
+ RequirementType["SlayerUnlock"] = "SlayerUnlock";
32
+ })(RequirementType || (exports.RequirementType = RequirementType = {}));
33
+ // Slayer Unlock requirement
34
+ class SlayerUnlockRequirement {
35
+ constructor(name) {
36
+ this.type = RequirementType.SlayerUnlock;
37
+ this.name = name;
38
+ }
39
+ get description() {
40
+ return `Slayer unlock: ${this.name}`;
41
+ }
42
+ isMet() {
43
+ // Replace with actual logic to check the player's Slayer level
44
+ return false; // TODO
45
+ }
46
+ }
47
+ exports.SlayerUnlockRequirement = SlayerUnlockRequirement;
48
+ // Slayer level requirement
49
+ class SlayerLevelRequirement {
50
+ constructor(level) {
51
+ this.type = RequirementType.SlayerLevel;
52
+ this.level = level;
53
+ }
54
+ get description() {
55
+ return `Slayer level ${this.level}`;
56
+ }
57
+ isMet() {
58
+ // Replace with actual logic to check the player's Slayer level
59
+ return false; // TODO
60
+ }
61
+ }
62
+ exports.SlayerLevelRequirement = SlayerLevelRequirement;
63
+ // Combat level requirement
64
+ class CombatLevelRequirement {
65
+ constructor(level) {
66
+ this.type = RequirementType.CombatLevel;
67
+ this.level = level;
68
+ }
69
+ get description() {
70
+ return `Combat level ${this.level}`;
71
+ }
72
+ isMet() {
73
+ // Replace with actual logic to check the player's Combat level
74
+ return false; // TODO
75
+ }
76
+ }
77
+ exports.CombatLevelRequirement = CombatLevelRequirement;
78
+ // Quest requirement
79
+ class QuestRequirement {
80
+ constructor(questName) {
81
+ this.type = RequirementType.Quest;
82
+ this.questName = questName;
83
+ }
84
+ get description() {
85
+ return `Completed quest: ${this.questName}`;
86
+ }
87
+ isMet() {
88
+ // Replace with actual logic to check if the quest is completed
89
+ return false; // TODO
90
+ }
91
+ }
92
+ exports.QuestRequirement = QuestRequirement;
93
+ // Item requirement
94
+ class ItemRequirement {
95
+ constructor(itemName) {
96
+ this.type = RequirementType.Item;
97
+ this.itemName = itemName;
98
+ }
99
+ get description() {
100
+ return `Has item: ${this.itemName}`;
101
+ }
102
+ isMet() {
103
+ // Replace with actual logic to check if the player has the item
104
+ return false; // TODO
105
+ }
106
+ }
107
+ exports.ItemRequirement = ItemRequirement;
108
+ // Location requirement
109
+ class LocationRequirement {
110
+ constructor(locationName) {
111
+ this.type = RequirementType.Location;
112
+ this.locationName = locationName;
113
+ }
114
+ get description() {
115
+ return `Access to location: ${this.locationName}`;
116
+ }
117
+ isMet() {
118
+ // Replace with actual logic to check if the player is in the location
119
+ return false; // TODO
120
+ }
121
+ }
122
+ exports.LocationRequirement = LocationRequirement;
123
+ // Example usage: Array of requirements for a monster
124
+ const monsterRequirements = [
125
+ new SlayerLevelRequirement(44),
126
+ new CombatLevelRequirement(5),
127
+ new QuestRequirement("Dragon Slayer"),
128
+ new ItemRequirement("Anti-dragon shield"),
129
+ new LocationRequirement("Taverley Dungeon"),
130
+ ];
@@ -0,0 +1,31 @@
1
+ interface OsrsAccountObject {
2
+ name: string;
3
+ main: {
4
+ combatLevel: number;
5
+ questPoints: number;
6
+ skills: {
7
+ [skillName: string]: {
8
+ level: number;
9
+ };
10
+ };
11
+ };
12
+ }
13
+ declare class OsrsAccount {
14
+ private osrsAccount;
15
+ constructor(accountObject: OsrsAccountObject | null);
16
+ getName(): string | undefined;
17
+ toString(): string;
18
+ getSkills(): {
19
+ [skillName: string]: {
20
+ level: number;
21
+ };
22
+ } | undefined;
23
+ getSkill(skillName: string): {
24
+ level: number;
25
+ } | undefined;
26
+ getQuestPoints(): number | undefined;
27
+ setQuestPoints(x: number): void;
28
+ getCombatLevel(): number | undefined;
29
+ setCombatLevel(): void;
30
+ }
31
+ export { OsrsAccount };
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OsrsAccount = void 0;
4
+ class OsrsAccount {
5
+ constructor(accountObject) {
6
+ this.osrsAccount = accountObject ? accountObject : null;
7
+ this.setQuestPoints(0);
8
+ this.setCombatLevel();
9
+ }
10
+ getName() {
11
+ var _a;
12
+ return (_a = this.osrsAccount) === null || _a === void 0 ? void 0 : _a.name;
13
+ }
14
+ toString() {
15
+ var _a, _b, _c, _d;
16
+ return (((_b = (_a = this.osrsAccount) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "") +
17
+ ": \nCombat Level: " +
18
+ ((_d = (_c = this.osrsAccount) === null || _c === void 0 ? void 0 : _c.main.combatLevel) !== null && _d !== void 0 ? _d : "") +
19
+ "\nQuestPoints: " +
20
+ this.getQuestPoints());
21
+ }
22
+ getSkills() {
23
+ var _a;
24
+ return (_a = this.osrsAccount) === null || _a === void 0 ? void 0 : _a.main.skills;
25
+ }
26
+ getSkill(skillName) {
27
+ var _a;
28
+ return (_a = this.osrsAccount) === null || _a === void 0 ? void 0 : _a.main.skills[skillName.toLowerCase()];
29
+ }
30
+ getQuestPoints() {
31
+ var _a;
32
+ return (_a = this.osrsAccount) === null || _a === void 0 ? void 0 : _a.main.questPoints;
33
+ }
34
+ setQuestPoints(x) {
35
+ if (x >= 0 && this.osrsAccount) {
36
+ this.osrsAccount.main.questPoints = x;
37
+ }
38
+ }
39
+ getCombatLevel() {
40
+ var _a;
41
+ return (_a = this.osrsAccount) === null || _a === void 0 ? void 0 : _a.main.combatLevel;
42
+ }
43
+ setCombatLevel() {
44
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
45
+ if (this.osrsAccount) {
46
+ const attklvl = (_b = (_a = this.osrsAccount.main.skills.attack) === null || _a === void 0 ? void 0 : _a.level) !== null && _b !== void 0 ? _b : 1;
47
+ const strlvl = (_d = (_c = this.osrsAccount.main.skills.strength) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 1;
48
+ const deflvl = (_f = (_e = this.osrsAccount.main.skills.defence) === null || _e === void 0 ? void 0 : _e.level) !== null && _f !== void 0 ? _f : 1;
49
+ const rangedlvl = (_h = (_g = this.osrsAccount.main.skills.ranged) === null || _g === void 0 ? void 0 : _g.level) !== null && _h !== void 0 ? _h : 1;
50
+ const magiclvl = (_k = (_j = this.osrsAccount.main.skills.magic) === null || _j === void 0 ? void 0 : _j.level) !== null && _k !== void 0 ? _k : 1;
51
+ const praylvl = (_m = (_l = this.osrsAccount.main.skills.prayer) === null || _l === void 0 ? void 0 : _l.level) !== null && _m !== void 0 ? _m : 1;
52
+ const hplvl = (_p = (_o = this.osrsAccount.main.skills.hitpoints) === null || _o === void 0 ? void 0 : _o.level) !== null && _p !== void 0 ? _p : 10;
53
+ const x = [
54
+ 0.325 * (attklvl + strlvl),
55
+ 0.325 * ((3 * rangedlvl) / 2),
56
+ 0.325 * ((3 * magiclvl) / 2),
57
+ ];
58
+ const cbMax = Math.max(...x);
59
+ this.osrsAccount.main.combatLevel =
60
+ 0.25 * (deflvl + hplvl + praylvl / 2) + cbMax;
61
+ }
62
+ }
63
+ }
64
+ exports.OsrsAccount = OsrsAccount;
@@ -0,0 +1,41 @@
1
+ interface SkillRequirement {
2
+ level: number;
3
+ isBoostable: boolean;
4
+ }
5
+ interface Quest {
6
+ id: number;
7
+ name: string;
8
+ difficulty: string;
9
+ skillRequirements: {
10
+ [skill: string]: SkillRequirement;
11
+ };
12
+ status: "Not Started" | "In Progress" | "Completed";
13
+ miniquest: boolean;
14
+ shortName: string;
15
+ url: string;
16
+ series: string;
17
+ members: boolean;
18
+ questPoints: number;
19
+ length: string;
20
+ age: string;
21
+ startLocation: string;
22
+ difficultyLevel: string;
23
+ officialDifficulty: string;
24
+ officialLength: string;
25
+ officialAge: string;
26
+ itemRequirements: string[];
27
+ recommendedItems: string[];
28
+ recommendedSkills: {
29
+ [skill: string]: number;
30
+ };
31
+ recommendedPrayers: string[];
32
+ questRequirements: string[];
33
+ rewards: {
34
+ experience?: {
35
+ [skill: string]: number;
36
+ };
37
+ items?: string[];
38
+ areas?: string[];
39
+ };
40
+ }
41
+ export { Quest };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,51 @@
1
+ import { OsrsAccount } from "../account/OsrsAccount";
2
+ import { Quest } from "./Quest";
3
+ declare class QuestTool {
4
+ private questObject;
5
+ private questArray;
6
+ private subQuestArray;
7
+ private osrsAccount;
8
+ constructor();
9
+ /**
10
+ * to string func
11
+ * @todo Implement this function
12
+ * @return {String} The string representation of the class object.
13
+ */
14
+ toString(): string;
15
+ /**
16
+ * Get the data for a quest
17
+ * @param {String} questName The name of the quest
18
+ * @return {Object} The data for the input quest in a JSON object.
19
+ * */
20
+ getQuest(questName: string): Quest | undefined;
21
+ /**
22
+ * Get the data for a quest
23
+ * @param {String} questName The name of the quest
24
+ * @return {Object} The data for the input quest in a JSON object.
25
+ * */
26
+ getQuestByName(questName: string): Quest | undefined;
27
+ /**
28
+ * Get the data for a quest
29
+ * @param {String} subQuestName The name of the subquest
30
+ * @return {Object} The data for the input subquest in a JSON object.
31
+ * */
32
+ getSubQuest(subQuestName: string): any | undefined;
33
+ /**
34
+ * Add two numbers together
35
+ * @todo Need to implement Recipe for disaster functionality
36
+ * @param {String} quest The either string or quest object of the quest to be determined completeable or not.
37
+ * @return {Boolean} If the account currently tied to the tool can complete the quest.
38
+ * */
39
+ canCompleteQuest(quest: string | Quest | undefined): boolean;
40
+ /**
41
+ * Set the account to be used in this quest tool
42
+ * @param {OsrsAccount} acc1 The osrs Account to be associated with this class object.
43
+ * */
44
+ setOsrsAccount(acc1: OsrsAccount): boolean;
45
+ /**
46
+ * Get the osrs account associated with this quest tool
47
+ * @return {OsrsAccount | undefined} The osrs Account associated with this class object.
48
+ * */
49
+ getOsrsAccount(): OsrsAccount | undefined;
50
+ }
51
+ export { QuestTool };
@@ -1,96 +1,78 @@
1
- import { OsrsAccount } from '../account/OsrsAccount';
2
- import { Quest } from './Quest';
3
-
4
- class QuestTool {
5
- private questObject: any;
6
- private questArray: any;
7
- private subQuestArray: any;
8
- private osrsAccount: OsrsAccount | undefined;
9
-
10
- constructor() {
11
- // todo need to import these data from a typescript file where its defined/stored
12
- this.questObject = [];
13
- this.questArray = [];
14
- this.subQuestArray = [];
15
- }
16
-
17
- /**
18
- * to string func
19
- * @todo Implement this function
20
- * @return {String} The string representation of the class object.
21
- */
22
- toString(): string {
23
- return 'QuestTool :) WIP';
24
- }
25
-
26
- /**
27
- * Get the data for a quest
28
- * @param {String} questName The name of the quest
29
- * @return {Object} The data for the input quest in a JSON object.
30
- * */
31
- getQuest(questName: string): Quest | undefined {
32
- if (typeof questName === 'string' && this.questObject[questName]) {
33
- // return new Quest(this.questObject[questName]); TODO
34
- }
35
- return undefined;
36
- }
37
-
38
- /**
39
- * Get the data for a quest
40
- * @param {String} questName The name of the quest
41
- * @return {Object} The data for the input quest in a JSON object.
42
- * */
43
- getQuestByName(questName: string): Quest | undefined {
44
- return this.getQuest(questName);
45
- }
46
-
47
- /**
48
- * Get the data for a quest
49
- * @param {String} subQuestName The name of the subquest
50
- * @return {Object} The data for the input subquest in a JSON object.
51
- * */
52
- getSubQuest(subQuestName: string): any | undefined {
53
- return this.subQuestArray.find((x: any) => x.name === subQuestName);
54
- }
55
-
56
- // Define highestBoost method, switch case omitted for brevity
57
-
58
- /**
59
- * Add two numbers together
60
- * @todo Need to implement Recipe for disaster functionality
61
- * @param {String} quest The either string or quest object of the quest to be determined completeable or not.
62
- * @return {Boolean} If the account currently tied to the tool can complete the quest.
63
- * */
64
- canCompleteQuest(quest: string | Quest | undefined): boolean {
65
- // Implementation omitted for brevity
66
- return true; // Placeholder return value
67
- }
68
-
69
- // Define completableQuests method, implementation omitted for brevity
70
-
71
- /**
72
- * Set the account to be used in this quest tool
73
- * @param {OsrsAccount} acc1 The osrs Account to be associated with this class object.
74
- * */
75
- setOsrsAccount(acc1: OsrsAccount): boolean {
76
- if (acc1) {
77
- // this.osrsAccount = new OsrsAccount(acc1); TODO
78
- return true;
79
- }
80
- return false;
81
- }
82
-
83
- // Define other methods, implementation omitted for brevity
84
-
85
- /**
86
- * Get the osrs account associated with this quest tool
87
- * @return {OsrsAccount | undefined} The osrs Account associated with this class object.
88
- * */
89
- getOsrsAccount(): OsrsAccount | undefined {
90
- return this.osrsAccount;
91
- }
92
-
93
- // Define other getters, implementation omitted for brevity
94
- }
95
-
96
- export { QuestTool };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuestTool = void 0;
4
+ class QuestTool {
5
+ constructor() {
6
+ // todo need to import these data from a typescript file where its defined/stored
7
+ this.questObject = [];
8
+ this.questArray = [];
9
+ this.subQuestArray = [];
10
+ }
11
+ /**
12
+ * to string func
13
+ * @todo Implement this function
14
+ * @return {String} The string representation of the class object.
15
+ */
16
+ toString() {
17
+ return "QuestTool :) WIP";
18
+ }
19
+ /**
20
+ * Get the data for a quest
21
+ * @param {String} questName The name of the quest
22
+ * @return {Object} The data for the input quest in a JSON object.
23
+ * */
24
+ getQuest(questName) {
25
+ if (typeof questName === "string" && this.questObject[questName]) {
26
+ // return new Quest(this.questObject[questName]); TODO
27
+ }
28
+ return undefined;
29
+ }
30
+ /**
31
+ * Get the data for a quest
32
+ * @param {String} questName The name of the quest
33
+ * @return {Object} The data for the input quest in a JSON object.
34
+ * */
35
+ getQuestByName(questName) {
36
+ return this.getQuest(questName);
37
+ }
38
+ /**
39
+ * Get the data for a quest
40
+ * @param {String} subQuestName The name of the subquest
41
+ * @return {Object} The data for the input subquest in a JSON object.
42
+ * */
43
+ getSubQuest(subQuestName) {
44
+ return this.subQuestArray.find((x) => x.name === subQuestName);
45
+ }
46
+ // Define highestBoost method, switch case omitted for brevity
47
+ /**
48
+ * Add two numbers together
49
+ * @todo Need to implement Recipe for disaster functionality
50
+ * @param {String} quest The either string or quest object of the quest to be determined completeable or not.
51
+ * @return {Boolean} If the account currently tied to the tool can complete the quest.
52
+ * */
53
+ canCompleteQuest(quest) {
54
+ // Implementation omitted for brevity
55
+ return true; // Placeholder return value
56
+ }
57
+ // Define completableQuests method, implementation omitted for brevity
58
+ /**
59
+ * Set the account to be used in this quest tool
60
+ * @param {OsrsAccount} acc1 The osrs Account to be associated with this class object.
61
+ * */
62
+ setOsrsAccount(acc1) {
63
+ if (acc1) {
64
+ // this.osrsAccount = new OsrsAccount(acc1); TODO
65
+ return true;
66
+ }
67
+ return false;
68
+ }
69
+ // Define other methods, implementation omitted for brevity
70
+ /**
71
+ * Get the osrs account associated with this quest tool
72
+ * @return {OsrsAccount | undefined} The osrs Account associated with this class object.
73
+ * */
74
+ getOsrsAccount() {
75
+ return this.osrsAccount;
76
+ }
77
+ }
78
+ exports.QuestTool = QuestTool;
@@ -0,0 +1,17 @@
1
+ import { Requirement } from "../Requirement";
2
+ export declare class Assignment {
3
+ name: string;
4
+ quantity: number;
5
+ requirements: Requirement[];
6
+ extendedAmountMin?: number | null;
7
+ extendedAmountMax?: number | null;
8
+ constructor(name: string, quantity: number, requirements: Requirement[], extendedAmountMin?: number | null, extendedAmountMax?: number | null);
9
+ /**
10
+ * Get the task name
11
+ */
12
+ getName(): string;
13
+ /**
14
+ * Get the quantity of the task
15
+ */
16
+ getQuantity(): number;
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Assignment = void 0;
4
+ // A Class that represents an assignment of a task to a player.
5
+ // An assignment is a specific instance of a task, with a specific quantity and requirements.
6
+ // The assignment is the actual task given to a player, which is based on the Task.
7
+ class Assignment {
8
+ constructor(name, quantity, requirements, extendedAmountMin, extendedAmountMax) {
9
+ this.name = name;
10
+ this.quantity = quantity;
11
+ this.requirements = requirements;
12
+ this.extendedAmountMin = extendedAmountMin !== null && extendedAmountMin !== void 0 ? extendedAmountMin : null;
13
+ this.extendedAmountMax = extendedAmountMax !== null && extendedAmountMax !== void 0 ? extendedAmountMax : null;
14
+ }
15
+ /**
16
+ * Get the task name
17
+ */
18
+ getName() {
19
+ return this.name;
20
+ }
21
+ /**
22
+ * Get the quantity of the task
23
+ */
24
+ getQuantity() {
25
+ return this.quantity;
26
+ }
27
+ }
28
+ exports.Assignment = Assignment;