osrs-tools 0.1.1 → 0.2.1
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.
- package/README.md +106 -30
- package/dist/index.d.ts +8 -0
- package/dist/index.js +12 -0
- package/dist/jest.config.dev.js +7 -0
- package/dist/model/Requirement.d.ts +65 -0
- package/dist/model/Requirement.js +130 -0
- package/dist/model/account/OsrsAccount.d.ts +31 -0
- package/dist/model/account/OsrsAccount.js +64 -0
- package/dist/model/quest/Quest.d.ts +41 -0
- package/dist/model/quest/Quest.js +2 -0
- package/dist/model/quest/QuestTool.d.ts +51 -0
- package/dist/model/quest/QuestTool.js +78 -0
- package/dist/model/slayer/Assignment.d.ts +17 -0
- package/dist/model/slayer/Assignment.js +28 -0
- package/dist/model/slayer/SlayerMaster.d.ts +67 -0
- package/dist/model/slayer/SlayerMaster.js +112 -0
- package/dist/model/slayer/SlayerReward.d.ts +33 -0
- package/dist/model/slayer/SlayerReward.js +30 -0
- package/dist/model/slayer/Task.d.ts +85 -0
- package/dist/model/slayer/Task.js +117 -0
- package/dist/resources/slayer/Masters.d.ts +10 -0
- package/dist/resources/slayer/Masters.js +100 -0
- package/dist/resources/slayer/SlayerData.d.ts +13 -0
- package/dist/resources/slayer/SlayerData.js +42 -0
- package/dist/resources/slayer/SlayerExtends.d.ts +23 -0
- package/dist/resources/slayer/SlayerExtends.js +184 -0
- package/dist/resources/slayer/SlayerUnlock.d.ts +7 -0
- package/dist/resources/slayer/SlayerUnlock.js +67 -0
- package/dist/resources/slayer/slayerBuys.d.ts +3 -0
- package/dist/resources/slayer/slayerBuys.js +34 -0
- package/dist/resources/slayer/tasks/ChaelderTasks.d.ts +3 -0
- package/dist/resources/slayer/tasks/ChaelderTasks.js +78 -0
- package/dist/resources/slayer/tasks/DuradelTasks.d.ts +2 -0
- package/dist/resources/slayer/tasks/DuradelTasks.js +18 -0
- package/dist/resources/slayer/tasks/KonarTasks.d.ts +3 -0
- package/dist/resources/slayer/tasks/KonarTasks.js +5 -0
- package/dist/resources/slayer/tasks/MazchnaTasks.d.ts +3 -0
- package/dist/resources/slayer/tasks/MazchnaTasks.js +4 -0
- package/dist/resources/slayer/tasks/NieveTasks.d.ts +3 -0
- package/dist/resources/slayer/tasks/NieveTasks.js +78 -0
- package/dist/resources/slayer/tasks/ReadTasks.d.ts +1 -0
- package/dist/resources/slayer/tasks/ReadTasks.js +63 -0
- package/dist/resources/slayer/tasks/SpriaTasks.d.ts +2 -0
- package/dist/resources/slayer/tasks/SpriaTasks.js +117 -0
- package/dist/resources/slayer/tasks/Tureal.d.ts +3 -0
- package/dist/resources/slayer/tasks/Tureal.js +125 -0
- package/dist/resources/slayer/tasks/VannakaTasks.d.ts +3 -0
- package/dist/resources/slayer/tasks/VannakaTasks.js +78 -0
- package/package.json +93 -75
- package/src/cli.js +0 -9
- package/src/data/Diaries/diaries.json +0 -1171
- package/src/data/Diaries/diariesArray.json +0 -0
- package/src/data/exp.json +0 -1333
- package/src/data/farming/fruitTrees.json +0 -165
- package/src/data/farming/locations.json +0 -78
- package/src/data/farming/patches.json +0 -102
- package/src/data/farming/seeds.json +0 -170
- package/src/data/farming/teleports.json +0 -301
- package/src/data/farming/treePatches.json +0 -3
- package/src/data/farming/trees.json +0 -103
- package/src/data/quest/miniquestQuestArray.json +0 -58
- package/src/data/quest/miniquestQuestArray.ts +0 -8
- package/src/data/quest/questData.json +0 -5490
- package/src/data/quest/questData.ts +0 -5682
- package/src/data/quest/questDataArray.json +0 -6673
- package/src/data/quest/questDataArray.ts +0 -4134
- package/src/data/quest/subQuestArray.json +0 -58
- package/src/data/quest/subQuestArray.ts +0 -60
- package/src/data/quest/testObj.json +0 -5682
- package/src/data/quest/testarray.json +0 -5589
- package/src/index.ts +0 -438
- package/src/tests/QuestTest.js +0 -71
- package/src/tests/getAllQuestSeries.ts +0 -6
- package/src/tests/test Quest Array.ts +0 -9
- package/src/tests/test Requirements.ts +0 -56
- package/src/tests/test.ts +0 -402
- package/src/tests/test3.js +0 -370
- package/src/tests/testQuestCompletion.js +0 -367
- package/src/tests/testSeed.js +0 -8
- package/src/utils/AchievementDiary.ts +0 -18
- package/src/utils/Farming/FarmingTool.ts +0 -110
- package/src/utils/Farming/Seed.js +0 -42
- package/src/utils/Farming/TreeSeed.js +0 -21
- package/src/utils/OsrsAccount.ts +0 -280
- package/src/utils/Quest.ts +0 -99
- package/src/utils/QuestTool.ts +0 -437
- package/src/utils/Requirement.ts +0 -63
- package/src/utils/Skill.ts +0 -11
package/README.md
CHANGED
|
@@ -1,42 +1,118 @@
|
|
|
1
|
-
|
|
1
|
+
# Old School RuneScape Quest Tool
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[![NPM Version][npm-image]][npm-url] [![Downloads][downloads-image]][downloads-url] [![GitHub Issues][issues-img]][new-issue]
|
|
4
|
+
[](https://github.com/jamescer/osrs-tools/blob/master/src/types.ts)
|
|
5
|
+
|
|
6
|
+
The **Old School RuneScape Quest Tool** is a Node.js package designed to provide comprehensive data for all current Old School RuneScape (OSRS) quests, slayer tasks, and related game mechanics. This tool is ideal for developers looking to integrate OSRS data into their projects, whether for personal use, game guides, or community tools.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Access detailed quest data, including requirements, rewards, and steps.
|
|
11
|
+
- Retrieve slayer task information, including task weights, requirements, and locations.
|
|
12
|
+
- Explore slayer master data, including assigned tasks, combat level requirements, and rewards.
|
|
13
|
+
- Built-in support for tracking quest and slayer progress.
|
|
14
|
+
- Easy-to-use API for developers of all skill levels.
|
|
4
15
|
|
|
5
16
|
## Installation
|
|
6
17
|
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
Install the package via npm:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install osrs-tools --save
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Here’s how to use the tool in your project:
|
|
27
|
+
|
|
28
|
+
### Importing the Module
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import { QuestTool, questArray, questObject } from 'osrs-tools';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Working with Quests
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
// Instantiate the QuestTool class
|
|
38
|
+
const tool = new QuestTool();
|
|
39
|
+
|
|
40
|
+
// Get quest data as an array
|
|
41
|
+
const questArrayData = questArray();
|
|
42
|
+
|
|
43
|
+
// Get quest data as an object
|
|
44
|
+
const questObjectData = questObject();
|
|
45
|
+
|
|
46
|
+
// Output the quest data
|
|
47
|
+
console.log(questArrayData);
|
|
48
|
+
console.log(questObjectData);
|
|
9
49
|
```
|
|
10
50
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
### Working with Slayer Masters and Tasks
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
import { Turael, Duradel } from 'osrs-tools';
|
|
55
|
+
|
|
56
|
+
// Access Turael's tasks
|
|
57
|
+
console.log(Turael.getTasks());
|
|
58
|
+
|
|
59
|
+
// Get a random task from Duradel
|
|
60
|
+
const randomTask = Duradel.getRandomTask();
|
|
61
|
+
console.log(randomTask);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Slayer Rewards and Unlocks
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
import { SlayerUnlocks, SlayerBuys } from 'osrs-tools';
|
|
68
|
+
|
|
69
|
+
// List all available Slayer unlocks
|
|
70
|
+
console.log(SlayerUnlocks);
|
|
71
|
+
|
|
72
|
+
// List all items available for purchase with Slayer points
|
|
73
|
+
console.log(SlayerBuys);
|
|
30
74
|
```
|
|
31
75
|
|
|
32
|
-
|
|
76
|
+
## API Reference
|
|
77
|
+
|
|
78
|
+
### Quest API
|
|
79
|
+
|
|
80
|
+
| Method | Description | Type |
|
|
81
|
+
| ----------------- | ----------------------------------------------------------------------- | ----------------- |
|
|
82
|
+
| `new QuestTool()` | Constructor for the `QuestTool` class. | Class Constructor |
|
|
83
|
+
| `questObject()` | Function that returns an object with quest data (keys are quest names). | Function |
|
|
84
|
+
| `questArray()` | Function that returns an array of quests, ordered alphabetically. | Function |
|
|
85
|
+
|
|
86
|
+
### Slayer API
|
|
87
|
+
|
|
88
|
+
| Class/Method | Description |
|
|
89
|
+
| -------------------- | ------------------------------------------------------------------------- |
|
|
90
|
+
| `SlayerMaster` | Represents a Slayer Master, including tasks, location, and requirements. |
|
|
91
|
+
| `getTasks()` | Returns a list of tasks assigned by the Slayer Master. |
|
|
92
|
+
| `getRandomTask()` | Returns a random task based on task weights. |
|
|
93
|
+
| `SlayerUnlocks` | Predefined list of Slayer unlocks with costs and descriptions. |
|
|
94
|
+
| `SlayerBuys` | Predefined list of items available for purchase with Slayer points. |
|
|
95
|
+
|
|
96
|
+
## To-Do
|
|
97
|
+
|
|
98
|
+
- Implement a recursive function for determining quest completion.
|
|
99
|
+
- Develop a quest completion tracking array.
|
|
100
|
+
- Refactor `questArray()` and `questObject()` to return objects instead of functions.
|
|
101
|
+
- Continue work on the **Recipe for Disaster** quest.
|
|
102
|
+
- Fix and validate all Slayer data.
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
33
105
|
|
|
34
|
-
|
|
106
|
+
Contributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/jamescer/osrs-tools).
|
|
35
107
|
|
|
36
|
-
|
|
108
|
+
## Credits
|
|
37
109
|
|
|
38
|
-
|
|
110
|
+
- **Author**: [James Cerniglia](mailto:jamesmcerniglia@gmail.com)
|
|
111
|
+
- **Repository**: [GitHub - osrs-tools](https://github.com/jamescer/osrs-tools)
|
|
39
112
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
113
|
+
[npm-image]: https://img.shields.io/npm/v/osrs-tools.svg
|
|
114
|
+
[npm-url]: https://www.npmjs.com/package/osrs-tools
|
|
115
|
+
[downloads-image]: https://img.shields.io/npm/dm/osrs-tools.svg
|
|
116
|
+
[downloads-url]: https://npmcharts.com/compare/osrs-tools?minimal=true
|
|
117
|
+
[issues-img]: https://img.shields.io/github/issues/jamescer/osrs-tools.svg
|
|
118
|
+
[new-issue]: https://github.com/jamescer/osrs-tools/issues/new/choose
|
package/dist/index.d.ts
ADDED
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,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,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 };
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
}
|