libram 0.6.10 → 0.6.11
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/dist/ascend.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export declare enum Lifestyle {
|
|
|
7
7
|
normal = 2,
|
|
8
8
|
hardcore = 3
|
|
9
9
|
}
|
|
10
|
+
export declare class AscendError extends Error {
|
|
11
|
+
cause?: Skill | Item | Class | Path;
|
|
12
|
+
constructor(cause?: Skill | Item | Class | Path);
|
|
13
|
+
}
|
|
10
14
|
declare type MoonSign = number | "mongoose" | "wallaby" | "vole" | "platypus" | "opossum" | "marmot" | "wombat" | "blender" | "packrat" | "degrassi" | "degrassi knoll" | "friendly degrassi knoll" | "knoll" | "canada" | "canadia" | "little canadia" | "gnomads" | "gnomish" | "gnomish gnomads camp";
|
|
11
15
|
/**
|
|
12
16
|
* Hops the gash, perming no skills
|
package/dist/ascend.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { containsText, eudoraItem, getCampground, getWorkshed, Item, toInt, use, visitUrl, xpath, haveSkill, } from "kolmafia";
|
|
1
|
+
import { Skill, Class, containsText, eudoraItem, getCampground, getWorkshed, Item, toInt, use, visitUrl, xpath, haveSkill, } from "kolmafia";
|
|
2
2
|
import { ChateauMantegna } from "./resources";
|
|
3
3
|
import { $item, $items, $stat } from "./template-string";
|
|
4
4
|
export var Lifestyle;
|
|
@@ -8,6 +8,32 @@ export var Lifestyle;
|
|
|
8
8
|
Lifestyle[Lifestyle["normal"] = 2] = "normal";
|
|
9
9
|
Lifestyle[Lifestyle["hardcore"] = 3] = "hardcore";
|
|
10
10
|
})(Lifestyle || (Lifestyle = {}));
|
|
11
|
+
export class AscendError extends Error {
|
|
12
|
+
cause;
|
|
13
|
+
constructor(cause) {
|
|
14
|
+
if (!cause) {
|
|
15
|
+
super("Failed to ascend--do you have a pending trade offer?");
|
|
16
|
+
}
|
|
17
|
+
else if (cause instanceof Skill) {
|
|
18
|
+
const reason = cause.permable
|
|
19
|
+
? haveSkill(cause)
|
|
20
|
+
? "invalid for mysterious reasons"
|
|
21
|
+
: "not a skill you currently know"
|
|
22
|
+
: "unpermable";
|
|
23
|
+
super(`Skill ${cause} is ${reason}!`);
|
|
24
|
+
}
|
|
25
|
+
else if (cause instanceof Item) {
|
|
26
|
+
super(`Invalid astral item: ${cause}!`);
|
|
27
|
+
}
|
|
28
|
+
else if (cause instanceof Class) {
|
|
29
|
+
super(`Invalid class ${cause} for this path!`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
super(`Invalid path ${cause}!`);
|
|
33
|
+
}
|
|
34
|
+
this.cause = cause;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
11
37
|
function toMoonId(moon, playerClass) {
|
|
12
38
|
if (typeof moon === "number")
|
|
13
39
|
return moon;
|
|
@@ -70,32 +96,32 @@ function toMoonId(moon, playerClass) {
|
|
|
70
96
|
*/
|
|
71
97
|
export function ascend(path, playerClass, lifestyle, moon, consumable = $item `astral six-pack`, pet = undefined, permSkills = undefined) {
|
|
72
98
|
if (!path.classes.includes(playerClass)) {
|
|
73
|
-
throw new
|
|
99
|
+
throw new AscendError(playerClass);
|
|
74
100
|
}
|
|
75
101
|
if (path.id < 0)
|
|
76
|
-
throw new
|
|
102
|
+
throw new AscendError(path);
|
|
77
103
|
const moonId = toMoonId(moon, playerClass);
|
|
78
104
|
if (moonId < 1 || moonId > 9)
|
|
79
105
|
throw new Error(`Invalid moon ${moon}`);
|
|
80
106
|
if (consumable &&
|
|
81
107
|
!$items `astral six-pack, astral hot dog dinner, [10882]carton of astral energy drinks`.includes(consumable)) {
|
|
82
|
-
throw new
|
|
108
|
+
throw new AscendError(consumable);
|
|
83
109
|
}
|
|
84
110
|
if (pet &&
|
|
85
111
|
!$items `astral bludgeon, astral shield, astral chapeau, astral bracer, astral longbow, astral shorts, astral mace, astral ring, astral statuette, astral pistol, astral mask, astral pet sweater, astral shirt, astral belt`.includes(pet)) {
|
|
86
|
-
throw new
|
|
112
|
+
throw new AscendError(pet);
|
|
87
113
|
}
|
|
88
114
|
const illegalSkill = permSkills
|
|
89
115
|
? Array.from(permSkills.keys()).find((skill) => !skill.permable || !haveSkill(skill))
|
|
90
116
|
: undefined;
|
|
91
117
|
if (illegalSkill) {
|
|
92
|
-
throw new
|
|
118
|
+
throw new AscendError(illegalSkill);
|
|
93
119
|
}
|
|
94
120
|
if (!containsText(visitUrl("charpane.php"), "Astral Spirit")) {
|
|
95
121
|
visitUrl("ascend.php?action=ascend&confirm=on&confirm2=on");
|
|
96
122
|
}
|
|
97
123
|
if (!containsText(visitUrl("charpane.php"), "Astral Spirit")) {
|
|
98
|
-
throw new
|
|
124
|
+
throw new AscendError();
|
|
99
125
|
}
|
|
100
126
|
visitUrl("afterlife.php?action=pearlygates");
|
|
101
127
|
if (consumable) {
|
|
@@ -223,7 +223,8 @@ export default class CommunityService {
|
|
|
223
223
|
}, new Requirement(["Spell Damage", "Spell Damage Percent"], {}));
|
|
224
224
|
static Noncombat = new CommunityService(8, "Non-Combat", "Be a Living Statue", () => {
|
|
225
225
|
const noncombatRate = -1 * getModifier("Combat Rate");
|
|
226
|
-
|
|
226
|
+
const unsoftcappedRate = noncombatRate > 25 ? 25 + (noncombatRate - 25) * 5 : noncombatRate;
|
|
227
|
+
return 60 - 3 * Math.floor(unsoftcappedRate / 5);
|
|
227
228
|
}, new Requirement(["-combat"], {}));
|
|
228
229
|
static BoozeDrop = new CommunityService(9, "Item Drop", "Make Margaritas", () => {
|
|
229
230
|
const mummingCostume = MummingTrunk.currentCostumes().get(myFamiliar());
|
|
@@ -9,8 +9,8 @@ declare class Flower {
|
|
|
9
9
|
modifier: Modifiers | SpecialFlowerAbility;
|
|
10
10
|
territorial: boolean;
|
|
11
11
|
constructor(name: string, id: number, environment: EnvironmentType, modifier: Modifiers | SpecialFlowerAbility, territorial?: boolean);
|
|
12
|
-
static plantNamesInZone(location?: Location): string[]
|
|
13
|
-
static plantsInZone(location?: Location): Flower[]
|
|
12
|
+
static plantNamesInZone(location?: Location): string[];
|
|
13
|
+
static plantsInZone(location?: Location): Flower[];
|
|
14
14
|
static modifiersInZone(location?: Location): Modifiers;
|
|
15
15
|
isPlantedHere(location?: Location): boolean;
|
|
16
16
|
available(location?: Location): boolean;
|
|
@@ -15,12 +15,12 @@ class Flower {
|
|
|
15
15
|
this.territorial = territorial;
|
|
16
16
|
}
|
|
17
17
|
static plantNamesInZone(location = myLocation()) {
|
|
18
|
-
return getFloristPlants()[location.toString()] ??
|
|
18
|
+
return getFloristPlants()[location.toString()] ?? [];
|
|
19
19
|
}
|
|
20
20
|
static plantsInZone(location = myLocation()) {
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
.filter((flower) => flower !== undefined)
|
|
21
|
+
return this.plantNamesInZone(location)
|
|
22
|
+
.map((flowerName) => toFlower(flowerName))
|
|
23
|
+
.filter((flower) => flower !== undefined);
|
|
24
24
|
}
|
|
25
25
|
static modifiersInZone(location = myLocation()) {
|
|
26
26
|
const plants = this.plantsInZone(location);
|