libram 0.7.11 → 0.7.13
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/Clan.d.ts +34 -6
- package/dist/Clan.js +33 -6
- package/dist/Copier.d.ts +5 -5
- package/dist/Dungeon.d.ts +45 -0
- package/dist/Dungeon.js +115 -0
- package/dist/Kmail.d.ts +8 -5
- package/dist/Kmail.js +8 -5
- package/dist/actions/ActionSource.d.ts +5 -0
- package/dist/actions/ActionSource.js +20 -1
- package/dist/actions/FreeKill.d.ts +2 -0
- package/dist/actions/FreeKill.js +2 -0
- package/dist/actions/FreeRun.d.ts +2 -0
- package/dist/actions/FreeRun.js +2 -0
- package/dist/ascend.d.ts +20 -4
- package/dist/ascend.js +32 -4
- package/dist/challengePaths/2015/CommunityService.d.ts +7 -0
- package/dist/challengePaths/2015/CommunityService.js +12 -1
- package/dist/combat.d.ts +55 -0
- package/dist/combat.js +85 -0
- package/dist/counter.d.ts +3 -0
- package/dist/counter.js +3 -0
- package/dist/diet/index.d.ts +2 -0
- package/dist/diet/index.js +27 -8
- package/dist/diet/knapsack.d.ts +1 -0
- package/dist/diet/knapsack.js +11 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -3
- package/dist/lib.d.ts +101 -34
- package/dist/lib.js +133 -42
- package/dist/logger.d.ts +24 -11
- package/dist/logger.js +38 -12
- package/dist/maximize.d.ts +20 -1
- package/dist/maximize.js +30 -3
- package/dist/modifier.d.ts +1 -1
- package/dist/modifier.js +9 -1
- package/dist/mood.d.ts +15 -1
- package/dist/mood.js +15 -1
- package/dist/property.d.ts +52 -17
- package/dist/property.js +64 -7
- package/dist/propertyTypes.d.ts +5 -5
- package/dist/propertyTypes.js +5 -5
- package/dist/propertyTyping.d.ts +54 -0
- package/dist/propertyTyping.js +54 -0
- package/dist/resources/2008/Stickers.d.ts +28 -0
- package/dist/resources/2008/Stickers.js +28 -0
- package/dist/resources/2009/Bandersnatch.d.ts +17 -7
- package/dist/resources/2009/Bandersnatch.js +17 -7
- package/dist/resources/2009/SpookyPutty.d.ts +25 -0
- package/dist/resources/2009/SpookyPutty.js +25 -0
- package/dist/resources/2010/CrownOfThrones.d.ts +23 -0
- package/dist/resources/2010/CrownOfThrones.js +31 -15
- package/dist/resources/2010/LookingGlass.d.ts +4 -0
- package/dist/resources/2010/LookingGlass.js +5 -0
- package/dist/resources/2011/ObtuseAngel.d.ts +8 -6
- package/dist/resources/2011/ObtuseAngel.js +8 -6
- package/dist/resources/2011/StompingBoots.d.ts +9 -15
- package/dist/resources/2011/StompingBoots.js +9 -15
- package/dist/resources/2012/RainDoh.d.ts +20 -0
- package/dist/resources/2012/RainDoh.js +20 -0
- package/dist/resources/2012/ReagnimatedGnome.d.ts +18 -0
- package/dist/resources/2012/ReagnimatedGnome.js +18 -0
- package/dist/resources/2012/Resolutions.d.ts +2 -2
- package/dist/resources/2012/Resolutions.js +2 -2
- package/dist/resources/2013/Florist.d.ts +15 -0
- package/dist/resources/2013/Florist.js +21 -0
- package/dist/resources/2014/CrimboShrub.d.ts +12 -0
- package/dist/resources/2014/CrimboShrub.js +22 -1
- package/dist/resources/2014/DNALab.d.ts +10 -2
- package/dist/resources/2014/DNALab.js +10 -2
- package/dist/resources/2014/WinterGarden.d.ts +15 -0
- package/dist/resources/2014/WinterGarden.js +15 -0
- package/dist/resources/2015/BarrelShrine.d.ts +6 -0
- package/dist/resources/2015/BarrelShrine.js +6 -0
- package/dist/resources/2015/ChateauMantegna.d.ts +35 -0
- package/dist/resources/2015/ChateauMantegna.js +35 -0
- package/dist/resources/2015/DeckOfEveryCard.d.ts +23 -1
- package/dist/resources/2015/DeckOfEveryCard.js +24 -0
- package/dist/resources/2015/Dinseylandfill.d.ts +1 -0
- package/dist/resources/2015/Dinseylandfill.js +2 -0
- package/dist/resources/2015/MayoClinic.d.ts +8 -1
- package/dist/resources/2015/MayoClinic.js +8 -1
- package/dist/resources/2016/SourceTerminal.d.ts +42 -21
- package/dist/resources/2016/SourceTerminal.js +42 -21
- package/dist/resources/2016/Witchess.d.ts +12 -0
- package/dist/resources/2016/Witchess.js +12 -0
- package/dist/resources/2017/AsdonMartin.d.ts +11 -3
- package/dist/resources/2017/AsdonMartin.js +44 -7
- package/dist/resources/2017/MummingTrunk.d.ts +1 -0
- package/dist/resources/2017/MummingTrunk.js +8 -1
- package/dist/resources/2017/Pantogram.d.ts +9 -0
- package/dist/resources/2017/Pantogram.js +33 -0
- package/dist/resources/2017/Robortender.d.ts +1 -0
- package/dist/resources/2017/Robortender.js +1 -0
- package/dist/resources/2017/Spacegate.js +1 -0
- package/dist/resources/2017/TunnelOfLove.d.ts +19 -0
- package/dist/resources/2017/TunnelOfLove.js +37 -0
- package/dist/resources/2018/LatteLoversMembersMug.d.ts +9 -0
- package/dist/resources/2018/LatteLoversMembersMug.js +9 -0
- package/dist/resources/2018/SongBoom.d.ts +9 -4
- package/dist/resources/2018/SongBoom.js +9 -4
- package/dist/resources/2019/BeachComb.d.ts +38 -1
- package/dist/resources/2019/BeachComb.js +39 -2
- package/dist/resources/2019/Snapper.d.ts +4 -0
- package/dist/resources/2019/Snapper.js +4 -0
- package/dist/resources/2020/Cartography.d.ts +13 -0
- package/dist/resources/2020/Cartography.js +13 -0
- package/dist/resources/2020/Guzzlr.d.ts +89 -23
- package/dist/resources/2020/Guzzlr.js +100 -29
- package/dist/resources/2020/RetroCape.d.ts +4 -0
- package/dist/resources/2020/RetroCape.js +4 -0
- package/dist/resources/2021/CrystalBall.d.ts +6 -0
- package/dist/resources/2021/CrystalBall.js +13 -1
- package/dist/resources/2021/DaylightShavings.d.ts +6 -0
- package/dist/resources/2021/DaylightShavings.js +6 -0
- package/dist/resources/2022/AutumnAton.d.ts +15 -0
- package/dist/resources/2022/AutumnAton.js +21 -0
- package/dist/resources/2022/CombatLoversLocket.d.ts +9 -0
- package/dist/resources/2022/CombatLoversLocket.js +10 -2
- package/dist/resources/2022/GreyGoose.d.ts +46 -0
- package/dist/resources/2022/GreyGoose.js +47 -1
- package/dist/resources/2022/JuneCleaver.d.ts +20 -0
- package/dist/resources/2022/JuneCleaver.js +20 -0
- package/dist/resources/2022/TrainSet.d.ts +48 -0
- package/dist/resources/2022/TrainSet.js +54 -0
- package/dist/resources/2023/ClosedCircuitPayphone.d.ts +75 -0
- package/dist/resources/2023/ClosedCircuitPayphone.js +117 -0
- package/dist/resources/LibramSummon.d.ts +5 -0
- package/dist/resources/LibramSummon.js +5 -0
- package/dist/resources/index.d.ts +2 -1
- package/dist/resources/index.js +2 -1
- package/dist/resources/putty-likes.d.ts +15 -0
- package/dist/resources/putty-likes.js +15 -0
- package/dist/session.d.ts +12 -0
- package/dist/session.js +20 -17
- package/dist/since.d.ts +3 -2
- package/dist/since.js +4 -2
- package/dist/utils.d.ts +82 -6
- package/dist/utils.js +88 -0
- package/package.json +6 -4
- package/dist/dungeons/Dreadsylvania.d.ts +0 -5
- package/dist/dungeons/Dreadsylvania.js +0 -14
- package/dist/dungeons/Dungeon.d.ts +0 -29
- package/dist/dungeons/Dungeon.js +0 -99
- package/dist/dungeons/Hobopolis.d.ts +0 -5
- package/dist/dungeons/Hobopolis.js +0 -14
- package/dist/dungeons/SlimeTube.d.ts +0 -5
- package/dist/dungeons/SlimeTube.js +0 -14
package/dist/Clan.d.ts
CHANGED
|
@@ -10,14 +10,18 @@ export declare class Clan {
|
|
|
10
10
|
private static _join;
|
|
11
11
|
private static _withStash;
|
|
12
12
|
/**
|
|
13
|
-
* Join a clan
|
|
13
|
+
* Join a clan
|
|
14
|
+
*
|
|
14
15
|
* @param clanIdOrName Clan id or name
|
|
16
|
+
* @returns Instance of joined clan
|
|
15
17
|
*/
|
|
16
18
|
static join(clanIdOrName: string | number): Clan;
|
|
17
19
|
/**
|
|
18
|
-
* Execute callback as a member of a clan
|
|
19
|
-
*
|
|
20
|
+
* Execute callback as a member of a clan and then restore prior membership
|
|
21
|
+
*
|
|
20
22
|
* @param clanIdOrName Clan id or name
|
|
23
|
+
* @param callback Actions to carry out while member of specified can
|
|
24
|
+
* @returns Return value from callback
|
|
21
25
|
*/
|
|
22
26
|
static with<T>(clanIdOrName: string | number, callback: (clan: Clan) => T): T;
|
|
23
27
|
/**
|
|
@@ -31,48 +35,71 @@ export declare class Clan {
|
|
|
31
35
|
static withStash<T>(clanIdOrName: string | number, items: Item[], callback: (borrowedItems: Item[]) => T): T;
|
|
32
36
|
static withStash<T>(clanIdOrName: string | number, items: Map<Item, number>, callback: (borrowedItems: Map<Item, number>) => T): T;
|
|
33
37
|
/**
|
|
34
|
-
*
|
|
38
|
+
* Get the player's current clan
|
|
39
|
+
*
|
|
40
|
+
* @returns Player's clan
|
|
35
41
|
*/
|
|
36
42
|
static get(): Clan;
|
|
37
43
|
/**
|
|
38
44
|
* Get list of clans to which the player is whitelisted
|
|
45
|
+
*
|
|
46
|
+
* @returns List of clans
|
|
39
47
|
*/
|
|
40
48
|
static getWhitelisted(): Clan[];
|
|
41
49
|
private constructor();
|
|
42
50
|
private _check;
|
|
43
51
|
/**
|
|
44
52
|
* Join clan
|
|
53
|
+
*
|
|
54
|
+
* @returns Joined clan
|
|
45
55
|
*/
|
|
46
56
|
join(): Clan;
|
|
57
|
+
/**
|
|
58
|
+
* Check that this clan is the player's current clan
|
|
59
|
+
*
|
|
60
|
+
* @returns Whether this is the current clan
|
|
61
|
+
*/
|
|
47
62
|
check(): boolean;
|
|
48
63
|
/**
|
|
49
|
-
*
|
|
64
|
+
* Determine the monster that is currently in the current clan's fax machine if any
|
|
65
|
+
*
|
|
66
|
+
* @returns The current fax monster
|
|
50
67
|
*/
|
|
51
68
|
getCurrentFax(): Monster | null;
|
|
52
69
|
/**
|
|
53
70
|
* List available ranks (name, degree and id) from the current clan
|
|
71
|
+
*
|
|
72
|
+
* @returns List of ranks
|
|
54
73
|
*/
|
|
55
74
|
getRanks(): Rank[];
|
|
56
75
|
/**
|
|
57
76
|
* Add a player to the current clan's whitelist.
|
|
58
77
|
* If the player is already in the whitelist this will change their rank or title.
|
|
78
|
+
*
|
|
59
79
|
* @param player Player id or name
|
|
60
80
|
* @param rankName Rank to give the player. If not provided they will be given the lowest rank
|
|
61
81
|
* @param title Title to give the player. If not provided, will be blank
|
|
82
|
+
* @returns Success
|
|
62
83
|
*/
|
|
63
84
|
addPlayerToWhitelist(player: string | number, rankName?: string, title?: string): boolean;
|
|
64
85
|
/**
|
|
65
86
|
* Remove a player from the current clan's whitelist
|
|
87
|
+
*
|
|
66
88
|
* @param player Player id or name
|
|
89
|
+
* @returns Success
|
|
67
90
|
*/
|
|
68
91
|
removePlayerFromWhitelist(player: string | number): boolean;
|
|
69
92
|
/**
|
|
70
|
-
* Return the amount of meat in the current clan's coffer
|
|
93
|
+
* Return the amount of meat in the current clan's coffer
|
|
94
|
+
*
|
|
95
|
+
* @returns Amount of meat
|
|
71
96
|
*/
|
|
72
97
|
getMeatInCoffer(): number;
|
|
73
98
|
/**
|
|
74
99
|
* Add the given amount of meat to the current clan's coffer.
|
|
100
|
+
*
|
|
75
101
|
* @param amount Amount of meat to put in coffer
|
|
102
|
+
* @returns Success
|
|
76
103
|
*/
|
|
77
104
|
putMeatInCoffer(amount: number): boolean;
|
|
78
105
|
/**
|
|
@@ -87,6 +114,7 @@ export declare class Clan {
|
|
|
87
114
|
take(items: Map<Item, number>): Map<Item, number>;
|
|
88
115
|
/**
|
|
89
116
|
* Put items in the stash
|
|
117
|
+
*
|
|
90
118
|
* @param items Items to put in the stash
|
|
91
119
|
* @returns Items successfully put in the stash
|
|
92
120
|
*/
|
package/dist/Clan.js
CHANGED
|
@@ -45,8 +45,10 @@ export class Clan {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Join a clan
|
|
48
|
+
* Join a clan
|
|
49
|
+
*
|
|
49
50
|
* @param clanIdOrName Clan id or name
|
|
51
|
+
* @returns Instance of joined clan
|
|
50
52
|
*/
|
|
51
53
|
static join(clanIdOrName) {
|
|
52
54
|
let clanId;
|
|
@@ -73,9 +75,11 @@ export class Clan {
|
|
|
73
75
|
return Clan._join(clanId);
|
|
74
76
|
}
|
|
75
77
|
/**
|
|
76
|
-
* Execute callback as a member of a clan
|
|
77
|
-
*
|
|
78
|
+
* Execute callback as a member of a clan and then restore prior membership
|
|
79
|
+
*
|
|
78
80
|
* @param clanIdOrName Clan id or name
|
|
81
|
+
* @param callback Actions to carry out while member of specified can
|
|
82
|
+
* @returns Return value from callback
|
|
79
83
|
*/
|
|
80
84
|
static with(clanIdOrName, callback) {
|
|
81
85
|
const startingClan = Clan.get();
|
|
@@ -93,13 +97,17 @@ export class Clan {
|
|
|
93
97
|
return Clan._withStash(() => Clan.with(clanIdOrName, (clan) => clan.take(items)), (borrowed) => Clan.with(clanIdOrName, (clan) => clan.put(borrowed)), callback);
|
|
94
98
|
}
|
|
95
99
|
/**
|
|
96
|
-
*
|
|
100
|
+
* Get the player's current clan
|
|
101
|
+
*
|
|
102
|
+
* @returns Player's clan
|
|
97
103
|
*/
|
|
98
104
|
static get() {
|
|
99
105
|
return new Clan(getClanId(), getClanName());
|
|
100
106
|
}
|
|
101
107
|
/**
|
|
102
108
|
* Get list of clans to which the player is whitelisted
|
|
109
|
+
*
|
|
110
|
+
* @returns List of clans
|
|
103
111
|
*/
|
|
104
112
|
static getWhitelisted() {
|
|
105
113
|
const page = visitUrl("clan_signup.php");
|
|
@@ -121,15 +129,24 @@ export class Clan {
|
|
|
121
129
|
}
|
|
122
130
|
/**
|
|
123
131
|
* Join clan
|
|
132
|
+
*
|
|
133
|
+
* @returns Joined clan
|
|
124
134
|
*/
|
|
125
135
|
join() {
|
|
126
136
|
return Clan.join(this.id);
|
|
127
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Check that this clan is the player's current clan
|
|
140
|
+
*
|
|
141
|
+
* @returns Whether this is the current clan
|
|
142
|
+
*/
|
|
128
143
|
check() {
|
|
129
144
|
return visitUrl("clan_hall.php").includes(`<b>${this.name}</b>`);
|
|
130
145
|
}
|
|
131
146
|
/**
|
|
132
|
-
*
|
|
147
|
+
* Determine the monster that is currently in the current clan's fax machine if any
|
|
148
|
+
*
|
|
149
|
+
* @returns The current fax monster
|
|
133
150
|
*/
|
|
134
151
|
getCurrentFax() {
|
|
135
152
|
this._check();
|
|
@@ -144,6 +161,8 @@ export class Clan {
|
|
|
144
161
|
}
|
|
145
162
|
/**
|
|
146
163
|
* List available ranks (name, degree and id) from the current clan
|
|
164
|
+
*
|
|
165
|
+
* @returns List of ranks
|
|
147
166
|
*/
|
|
148
167
|
getRanks() {
|
|
149
168
|
this._check();
|
|
@@ -167,9 +186,11 @@ export class Clan {
|
|
|
167
186
|
/**
|
|
168
187
|
* Add a player to the current clan's whitelist.
|
|
169
188
|
* If the player is already in the whitelist this will change their rank or title.
|
|
189
|
+
*
|
|
170
190
|
* @param player Player id or name
|
|
171
191
|
* @param rankName Rank to give the player. If not provided they will be given the lowest rank
|
|
172
192
|
* @param title Title to give the player. If not provided, will be blank
|
|
193
|
+
* @returns Success
|
|
173
194
|
*/
|
|
174
195
|
addPlayerToWhitelist(player, rankName, title = "") {
|
|
175
196
|
this._check();
|
|
@@ -186,7 +207,9 @@ export class Clan {
|
|
|
186
207
|
}
|
|
187
208
|
/**
|
|
188
209
|
* Remove a player from the current clan's whitelist
|
|
210
|
+
*
|
|
189
211
|
* @param player Player id or name
|
|
212
|
+
* @returns Success
|
|
190
213
|
*/
|
|
191
214
|
removePlayerFromWhitelist(player) {
|
|
192
215
|
this._check();
|
|
@@ -195,7 +218,9 @@ export class Clan {
|
|
|
195
218
|
return result.includes("Whitelist updated.");
|
|
196
219
|
}
|
|
197
220
|
/**
|
|
198
|
-
* Return the amount of meat in the current clan's coffer
|
|
221
|
+
* Return the amount of meat in the current clan's coffer
|
|
222
|
+
*
|
|
223
|
+
* @returns Amount of meat
|
|
199
224
|
*/
|
|
200
225
|
getMeatInCoffer() {
|
|
201
226
|
this._check();
|
|
@@ -205,7 +230,9 @@ export class Clan {
|
|
|
205
230
|
}
|
|
206
231
|
/**
|
|
207
232
|
* Add the given amount of meat to the current clan's coffer.
|
|
233
|
+
*
|
|
208
234
|
* @param amount Amount of meat to put in coffer
|
|
235
|
+
* @returns Success
|
|
209
236
|
*/
|
|
210
237
|
putMeatInCoffer(amount) {
|
|
211
238
|
this._check();
|
package/dist/Copier.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Monster } from "kolmafia";
|
|
2
2
|
export declare class Copier {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
readonly couldCopy: () => boolean;
|
|
4
|
+
readonly prepare: (() => boolean) | null;
|
|
5
|
+
readonly canCopy: () => boolean;
|
|
6
|
+
readonly copiedMonster: () => Monster | null;
|
|
7
|
+
readonly fightCopy: (() => boolean) | null;
|
|
8
8
|
constructor(couldCopy: () => boolean, prepare: (() => boolean) | null, canCopy: () => boolean, copiedMonster: () => Monster | null, fightCopy?: () => boolean);
|
|
9
9
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Item } from "kolmafia";
|
|
2
|
+
export declare class Dungeon {
|
|
3
|
+
private name_;
|
|
4
|
+
private loot;
|
|
5
|
+
private openAction;
|
|
6
|
+
private closeAction;
|
|
7
|
+
private openCost;
|
|
8
|
+
private openImage;
|
|
9
|
+
private closedImage;
|
|
10
|
+
get possibleLoot(): Item[];
|
|
11
|
+
get name(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Creates dungeon object for managing clan dungeons
|
|
14
|
+
*
|
|
15
|
+
* @param name_ name_ of the dungeon in question
|
|
16
|
+
* @param loot Distributable loot dropped by bosses in dungeon
|
|
17
|
+
* @param openAction String action used in form submission to open dungeon
|
|
18
|
+
* @param closeAction String action used in form submission to close dungeon
|
|
19
|
+
* @param openCost Meat cost of opening dungeon
|
|
20
|
+
* @param openImage Image text to search clan_basement.php for to check if dungeon is open
|
|
21
|
+
* @param closedImage Image text to search clan_basement.php for to check if dungeon is closed
|
|
22
|
+
*/
|
|
23
|
+
constructor(name_: string, loot: Item[], openAction: string, closeAction: string, openCost: number, openImage: string, closedImage: string);
|
|
24
|
+
distribute(idOrname_: number | string, loot?: Item | Item[] | Map<Item, number>, distributeAllOfAGivenItem?: boolean): void;
|
|
25
|
+
/**
|
|
26
|
+
* Close this dungeon
|
|
27
|
+
*
|
|
28
|
+
* @returns Whether the dungeon is now closed
|
|
29
|
+
*/
|
|
30
|
+
close(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Open an instance of this dungeon
|
|
33
|
+
*
|
|
34
|
+
* @param paymentPolicy How much meat should we put into the clan stash to open this dungeon?
|
|
35
|
+
* @returns Whether the dungeon is now open
|
|
36
|
+
*/
|
|
37
|
+
open(paymentPolicy?: "None" | "All" | "Difference"): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @returns A counted map of all loot from this dungeon eligible for distribution
|
|
40
|
+
*/
|
|
41
|
+
findLoot(): Map<Item, number>;
|
|
42
|
+
}
|
|
43
|
+
export declare const Dreadsylvania: Dungeon;
|
|
44
|
+
export declare const Hobopolis: Dungeon;
|
|
45
|
+
export declare const SlimeTube: Dungeon;
|
package/dist/Dungeon.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { getClanName, toItem, visitUrl, xpath } from "kolmafia";
|
|
2
|
+
import { Clan } from "./Clan";
|
|
3
|
+
import { getPlayerFromIdOrName } from "./lib";
|
|
4
|
+
import { $items } from "./template-string";
|
|
5
|
+
import { countedMapToArray } from "./utils";
|
|
6
|
+
export class Dungeon {
|
|
7
|
+
name_;
|
|
8
|
+
loot;
|
|
9
|
+
openAction;
|
|
10
|
+
closeAction;
|
|
11
|
+
openCost;
|
|
12
|
+
openImage;
|
|
13
|
+
closedImage;
|
|
14
|
+
get possibleLoot() {
|
|
15
|
+
return [...this.loot];
|
|
16
|
+
}
|
|
17
|
+
get name() {
|
|
18
|
+
return this.name_;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates dungeon object for managing clan dungeons
|
|
22
|
+
*
|
|
23
|
+
* @param name_ name_ of the dungeon in question
|
|
24
|
+
* @param loot Distributable loot dropped by bosses in dungeon
|
|
25
|
+
* @param openAction String action used in form submission to open dungeon
|
|
26
|
+
* @param closeAction String action used in form submission to close dungeon
|
|
27
|
+
* @param openCost Meat cost of opening dungeon
|
|
28
|
+
* @param openImage Image text to search clan_basement.php for to check if dungeon is open
|
|
29
|
+
* @param closedImage Image text to search clan_basement.php for to check if dungeon is closed
|
|
30
|
+
*/
|
|
31
|
+
constructor(name_, loot, openAction, closeAction, openCost, openImage, closedImage) {
|
|
32
|
+
this.name_ = name_;
|
|
33
|
+
this.loot = loot;
|
|
34
|
+
this.openAction = openAction;
|
|
35
|
+
this.closeAction = closeAction;
|
|
36
|
+
this.openCost = openCost;
|
|
37
|
+
this.openImage = openImage;
|
|
38
|
+
this.closedImage = closedImage;
|
|
39
|
+
}
|
|
40
|
+
distribute(idOrname_, loot = this.loot, distributeAllOfAGivenItem = !(loot instanceof Map)) {
|
|
41
|
+
const player = getPlayerFromIdOrName(idOrname_);
|
|
42
|
+
const lootList = loot instanceof Map
|
|
43
|
+
? countedMapToArray(loot)
|
|
44
|
+
: Array.isArray(loot)
|
|
45
|
+
? loot
|
|
46
|
+
: [loot];
|
|
47
|
+
const badLoot = lootList.find((lootItem) => !this.loot.includes(lootItem));
|
|
48
|
+
if (badLoot) {
|
|
49
|
+
throw new Error(`${badLoot} is not a valid piece of dungeon loot`);
|
|
50
|
+
}
|
|
51
|
+
const pageText = visitUrl("clan_basement.php");
|
|
52
|
+
if (!pageText.match(new RegExp(player.name, "i"))) {
|
|
53
|
+
throw new Error(`${player.name} cannot be distributed loot from ${getClanName()}`);
|
|
54
|
+
}
|
|
55
|
+
const itemname_s = xpath(pageText, "//tr/td[2]/b/text()");
|
|
56
|
+
const whichLoots = xpath(pageText, '//form[@action="clan_basement.php"]//input[@type="hidden"][@name_="whichloot"]/@value');
|
|
57
|
+
itemname_s.forEach((itemname_, index) => {
|
|
58
|
+
if (lootList.includes(toItem(itemname_))) {
|
|
59
|
+
visitUrl(`clan_basement.php?whichloot=${whichLoots[index]}&recipient=${player.id}`);
|
|
60
|
+
if (!distributeAllOfAGivenItem)
|
|
61
|
+
lootList.splice(lootList.indexOf(toItem(itemname_)));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Close this dungeon
|
|
67
|
+
*
|
|
68
|
+
* @returns Whether the dungeon is now closed
|
|
69
|
+
*/
|
|
70
|
+
close() {
|
|
71
|
+
visitUrl(`clan_basement.php?action=${this.closeAction}&confirm=true`, true);
|
|
72
|
+
const pageText = visitUrl("clan_basement.php");
|
|
73
|
+
return pageText.includes(this.closedImage);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Open an instance of this dungeon
|
|
77
|
+
*
|
|
78
|
+
* @param paymentPolicy How much meat should we put into the clan stash to open this dungeon?
|
|
79
|
+
* @returns Whether the dungeon is now open
|
|
80
|
+
*/
|
|
81
|
+
open(paymentPolicy = "Difference") {
|
|
82
|
+
const pageText = visitUrl("clan_basement.php");
|
|
83
|
+
if (pageText.includes(this.openImage))
|
|
84
|
+
return true;
|
|
85
|
+
const clan = Clan.get();
|
|
86
|
+
if (paymentPolicy === "All") {
|
|
87
|
+
clan.putMeatInCoffer(this.openCost);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const stashMeat = clan.getMeatInCoffer();
|
|
91
|
+
const payDifference = this.openCost - stashMeat;
|
|
92
|
+
if (payDifference > 0) {
|
|
93
|
+
if (paymentPolicy === "None")
|
|
94
|
+
return false;
|
|
95
|
+
clan.putMeatInCoffer(payDifference);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
visitUrl(`clan_basement.php?action=${this.openAction}`, true);
|
|
99
|
+
return visitUrl("clan_basement.php").includes(this.openImage);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @returns A counted map of all loot from this dungeon eligible for distribution
|
|
103
|
+
*/
|
|
104
|
+
findLoot() {
|
|
105
|
+
const result = new Map();
|
|
106
|
+
const pageText = visitUrl("clan_basement.php");
|
|
107
|
+
for (const lootItem of this.loot) {
|
|
108
|
+
result.set(lootItem, pageText.match(new RegExp(lootItem.name, "g"))?.length ?? 0);
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export const Dreadsylvania = new Dungeon("Dreadsylvania", $items `Great Wolf's headband, Great Wolf's right paw, Great Wolf's left paw, Great Wolf's lice, Great Wolf's rocket launcher, Great Wolf's beastly trousers, Drapes-You-Regally, Warms-Your-Tush, Covers-Your-Head, Protects-Your-Junk, Quiets-Your-Steps, Helps-You-Sleep, Mayor Ghost's khakis, Mayor Ghost's cloak, Mayor Ghost's toupee, Mayor Ghost's scissors, Mayor Ghost's sash, Mayor Ghost's gavel, zombie mariachi hat, zombie accordion, zombie mariachi pants, HOA regulation book, HOA zombie eyes, HOA citation pad, Unkillable Skeleton's skullcap, Unkillable Skeleton's shinguards, Unkillable Skeleton's breastplate, Unkillable Skeleton's shield, Unkillable Skeleton's sawsword, Unkillable Skeleton's restless leg, skull capacitor, Thunkula's drinking cap, Drunkula's silky pants, Drunkula's cape, Drunkula's ring of haze, Drunkula's wineglass, Drunkula's bell, bottle of Bloodweiser, bottle of Bloodweiser, bottle of Bloodweiser, bottle of Bloodweiser, electric Kool-Aid, electric Kool-Aid, electric Kool-Aid, electric Kool-Aid, ghost pepper, ghost pepper, ghost pepper, ghost pepper, Gets-You-Drunk, Gets-You-Drunk, Gets-You-Drunk, Gets-You-Drunk, wriggling severed nose, wriggling severed nose, wriggling severed nose, wriggling severed nose, Hunger™ Sauce, Hunger™ Sauce, Hunger™ Sauce, Hunger™ Sauce`, "translatemap", "foldmap", 1000000, "dvmap.gif", "foldmap.gif");
|
|
114
|
+
export const Hobopolis = new Dungeon("Hobopolis", $items `Ol' Scratch's ash can, Ol' Scratch's ol' britches, Ol' Scratch's stovepipe hat, Ol' Scratch's infernal pitchfork, Ol' Scratch's manacles, Ol' Scratch's stove door, Frosty's carrot, Frosty's nailbat, Frosty's old silk hat, Frosty's arm, Frosty's iceball, Frosty's snowball sack, Oscus's dumpster waders, Oscus's pelt, Wand of Oscus, Oscus's flypaper pants, Oscus's garbage can lid, Oscus's neverending soda, Zombo's grievous greaves, Zombo's shield, Zombo's skullcap, Zombo's empty eye, Zombo's shoulder blade, Zombo's skull ring, Chester's bag of candy, Chester's cutoffs, Chester's moustache, Chester's Aquarius medallion, Chester's muscle shirt, Chester's sunglasses, Hodgman's bow tie, Hodgman's porkpie hat, Hodgman's lobsterskin pants, Hodgman's almanac, Hodgman's lucky sock, Hodgman's metal detector, Hodgman's varcolac paw, Hodgman's harmonica, Hodgman's garbage sticker, Hodgman's cane, Hodgman's whackin' stick, Hodgman's disgusting technicolor overcoat, Hodgman's imaginary hamster`, "cleansewer", "floodsewer", 1000000, "opengrate.gif", "sewergrate.gif");
|
|
115
|
+
export const SlimeTube = new Dungeon("The Slime Tube", $items `slime-soaked brain, slime-soaked hypophysis, slime-soaked sweat gland, squirming Slime larva, caustic slime nodule, caustic slime nodule, hardened slime belt, hardened slime hat, hardened slime pants`, "cleanspot", "sealtube", 250000, "slimehole.gif", "greasespot.gif");
|
package/dist/Kmail.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "core-js/modules/es.object.entries";
|
|
2
1
|
import { Item } from "kolmafia";
|
|
3
2
|
declare type RawKmail = {
|
|
4
3
|
id: string;
|
|
@@ -59,10 +58,10 @@ export default class Kmail {
|
|
|
59
58
|
* Ignores any ungiftable items.
|
|
60
59
|
*
|
|
61
60
|
* @param to The player name or id to receive the gift
|
|
62
|
-
* @param
|
|
61
|
+
* @param message Message to send
|
|
63
62
|
* @param items The items to be attached
|
|
64
63
|
* @param meat The quantity of meat to be attached
|
|
65
|
-
* @param
|
|
64
|
+
* @param insideNote The note on the inside of the gift
|
|
66
65
|
* @returns True if the gift was successfully sent
|
|
67
66
|
*/
|
|
68
67
|
static gift(to: string | number, message?: string, items?: Map<Item, number> | Item[], meat?: number, insideNote?: string): boolean;
|
|
@@ -74,7 +73,9 @@ export default class Kmail {
|
|
|
74
73
|
*/
|
|
75
74
|
delete(): boolean;
|
|
76
75
|
/**
|
|
77
|
-
*
|
|
76
|
+
* Get message contents without any HTML from items or meat
|
|
77
|
+
*
|
|
78
|
+
* @returns Cleaned message contents
|
|
78
79
|
*/
|
|
79
80
|
get message(): string;
|
|
80
81
|
/**
|
|
@@ -92,8 +93,10 @@ export default class Kmail {
|
|
|
92
93
|
/**
|
|
93
94
|
* Reply to kmail
|
|
94
95
|
*
|
|
96
|
+
* @param message Message with which to reply
|
|
97
|
+
* @param items Items to send
|
|
98
|
+
* @param meat Meat to send
|
|
95
99
|
* @see Kmail.send
|
|
96
|
-
*
|
|
97
100
|
* @returns True if the kmail was successfully sent
|
|
98
101
|
*/
|
|
99
102
|
reply(message?: string, items?: Map<Item, number> | Item[], meat?: number): boolean;
|
package/dist/Kmail.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "core-js/modules/es.object.entries";
|
|
2
1
|
import { extractItems, extractMeat, isGiftable, Item, toInt, visitUrl, } from "kolmafia";
|
|
3
2
|
import { arrayToCountedMap, chunk } from "./utils";
|
|
4
3
|
export default class Kmail {
|
|
@@ -81,10 +80,10 @@ export default class Kmail {
|
|
|
81
80
|
* Ignores any ungiftable items.
|
|
82
81
|
*
|
|
83
82
|
* @param to The player name or id to receive the gift
|
|
84
|
-
* @param
|
|
83
|
+
* @param message Message to send
|
|
85
84
|
* @param items The items to be attached
|
|
86
85
|
* @param meat The quantity of meat to be attached
|
|
87
|
-
* @param
|
|
86
|
+
* @param insideNote The note on the inside of the gift
|
|
88
87
|
* @returns True if the gift was successfully sent
|
|
89
88
|
*/
|
|
90
89
|
static gift(to, message = "", items = [], meat = 0, insideNote = "") {
|
|
@@ -112,7 +111,9 @@ export default class Kmail {
|
|
|
112
111
|
return Kmail.delete([this]) === 1;
|
|
113
112
|
}
|
|
114
113
|
/**
|
|
115
|
-
*
|
|
114
|
+
* Get message contents without any HTML from items or meat
|
|
115
|
+
*
|
|
116
|
+
* @returns Cleaned message contents
|
|
116
117
|
*/
|
|
117
118
|
get message() {
|
|
118
119
|
const match = this.rawMessage.match(/^(.*?)</s);
|
|
@@ -137,8 +138,10 @@ export default class Kmail {
|
|
|
137
138
|
/**
|
|
138
139
|
* Reply to kmail
|
|
139
140
|
*
|
|
141
|
+
* @param message Message with which to reply
|
|
142
|
+
* @param items Items to send
|
|
143
|
+
* @param meat Meat to send
|
|
140
144
|
* @see Kmail.send
|
|
141
|
-
*
|
|
142
145
|
* @returns True if the kmail was successfully sent
|
|
143
146
|
*/
|
|
144
147
|
reply(message = "", items = [], meat = 0) {
|
|
@@ -92,12 +92,14 @@ export declare class ActionSource {
|
|
|
92
92
|
isUnlimited(): boolean;
|
|
93
93
|
/**
|
|
94
94
|
* Create a compound action source with merged constraints.
|
|
95
|
+
*
|
|
95
96
|
* @param others Other actions to have available.
|
|
96
97
|
* @returns Merged constraints, or null if they are inconsistent.
|
|
97
98
|
*/
|
|
98
99
|
merge(...others: ActionSource[]): ActionSource | null;
|
|
99
100
|
/**
|
|
100
101
|
* Perform all preparation necessary to make this action available.
|
|
102
|
+
*
|
|
101
103
|
* @param otherRequirements Any other equipment requirements.
|
|
102
104
|
* @returns Whether preparation succeeded.
|
|
103
105
|
*/
|
|
@@ -105,12 +107,14 @@ export declare class ActionSource {
|
|
|
105
107
|
/**
|
|
106
108
|
* Perform all preparation necessary to make this action available.
|
|
107
109
|
* Throws an error if preparation fails.
|
|
110
|
+
*
|
|
108
111
|
* @param otherRequirements Any other equipment requirements.
|
|
109
112
|
*/
|
|
110
113
|
ensure(otherRequirements?: Requirement): void;
|
|
111
114
|
}
|
|
112
115
|
/**
|
|
113
116
|
* Find an available action source subject to constraints.
|
|
117
|
+
*
|
|
114
118
|
* @param actions Action source list.
|
|
115
119
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
116
120
|
* @returns Available action source satisfying constraints, or null.
|
|
@@ -119,6 +123,7 @@ export declare function findActionSource(actions: ActionSource[], constraints?:
|
|
|
119
123
|
/**
|
|
120
124
|
* Count available action sources subject to constraints. Note that, if
|
|
121
125
|
* constraints.maximumCost is high enough, this will return Infinity.
|
|
126
|
+
*
|
|
122
127
|
* @param actions Action source list.
|
|
123
128
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
124
129
|
* @returns Count of available action sources.
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import flat from "array.prototype.flat";
|
|
1
2
|
import { mallPrice, useFamiliar } from "kolmafia";
|
|
2
3
|
import { Macro } from "../combat";
|
|
3
4
|
import { Requirement } from "../maximize";
|
|
4
5
|
import { sum } from "../utils";
|
|
6
|
+
/**
|
|
7
|
+
* Merge a set of constraints into one
|
|
8
|
+
*
|
|
9
|
+
* @param allConstraints Constraints to mege
|
|
10
|
+
* @returns Merged constraints
|
|
11
|
+
*/
|
|
5
12
|
function mergeConstraints(...allConstraints) {
|
|
6
13
|
const familiars = allConstraints
|
|
7
14
|
.map((constraints) => constraints.familiar)
|
|
@@ -79,6 +86,7 @@ export class ActionSource {
|
|
|
79
86
|
}
|
|
80
87
|
/**
|
|
81
88
|
* Create a compound action source with merged constraints.
|
|
89
|
+
*
|
|
82
90
|
* @param others Other actions to have available.
|
|
83
91
|
* @returns Merged constraints, or null if they are inconsistent.
|
|
84
92
|
*/
|
|
@@ -89,10 +97,11 @@ export class ActionSource {
|
|
|
89
97
|
// Inconsistent constraints - no path forward here.
|
|
90
98
|
return null;
|
|
91
99
|
}
|
|
92
|
-
return new ActionSource([...actions.map((action) => action.source)
|
|
100
|
+
return new ActionSource([...flat(actions.map((action) => action.source))], () => sum(actions, (action) => action.potential()), Macro.step(...actions.map((action) => action.macro)), constraints);
|
|
93
101
|
}
|
|
94
102
|
/**
|
|
95
103
|
* Perform all preparation necessary to make this action available.
|
|
104
|
+
*
|
|
96
105
|
* @param otherRequirements Any other equipment requirements.
|
|
97
106
|
* @returns Whether preparation succeeded.
|
|
98
107
|
*/
|
|
@@ -115,6 +124,7 @@ export class ActionSource {
|
|
|
115
124
|
/**
|
|
116
125
|
* Perform all preparation necessary to make this action available.
|
|
117
126
|
* Throws an error if preparation fails.
|
|
127
|
+
*
|
|
118
128
|
* @param otherRequirements Any other equipment requirements.
|
|
119
129
|
*/
|
|
120
130
|
ensure(otherRequirements) {
|
|
@@ -123,6 +133,13 @@ export class ActionSource {
|
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* See if a supplied action meets a set of constraints
|
|
138
|
+
*
|
|
139
|
+
* @param action Action to test
|
|
140
|
+
* @param constraints Constraints to apply
|
|
141
|
+
* @returns Whether action meets constraints
|
|
142
|
+
*/
|
|
126
143
|
function filterAction(action, constraints) {
|
|
127
144
|
return (action.available() &&
|
|
128
145
|
(constraints.allowedAction === undefined ||
|
|
@@ -136,6 +153,7 @@ function filterAction(action, constraints) {
|
|
|
136
153
|
}
|
|
137
154
|
/**
|
|
138
155
|
* Find an available action source subject to constraints.
|
|
156
|
+
*
|
|
139
157
|
* @param actions Action source list.
|
|
140
158
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
141
159
|
* @returns Available action source satisfying constraints, or null.
|
|
@@ -149,6 +167,7 @@ export function findActionSource(actions, constraints = {}) {
|
|
|
149
167
|
/**
|
|
150
168
|
* Count available action sources subject to constraints. Note that, if
|
|
151
169
|
* constraints.maximumCost is high enough, this will return Infinity.
|
|
170
|
+
*
|
|
152
171
|
* @param actions Action source list.
|
|
153
172
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
154
173
|
* @returns Count of available action sources.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActionSource, FindActionSourceConstraints } from "./ActionSource";
|
|
2
2
|
/**
|
|
3
3
|
* Find an available free kill source subject to constraints.
|
|
4
|
+
*
|
|
4
5
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
5
6
|
* @returns Free kill source satisfying constraints, or null.
|
|
6
7
|
*/
|
|
@@ -8,6 +9,7 @@ export declare function tryFindFreeKill(constraints?: FindActionSourceConstraint
|
|
|
8
9
|
/**
|
|
9
10
|
* Ensure an available free kill source subject to constraints.
|
|
10
11
|
* Throws an error if no source can be found.
|
|
12
|
+
*
|
|
11
13
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
12
14
|
* @returns Free kill source satisfying constraints.
|
|
13
15
|
*/
|
package/dist/actions/FreeKill.js
CHANGED
|
@@ -71,6 +71,7 @@ const freeKillSources = [
|
|
|
71
71
|
];
|
|
72
72
|
/**
|
|
73
73
|
* Find an available free kill source subject to constraints.
|
|
74
|
+
*
|
|
74
75
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
75
76
|
* @returns Free kill source satisfying constraints, or null.
|
|
76
77
|
*/
|
|
@@ -80,6 +81,7 @@ export function tryFindFreeKill(constraints) {
|
|
|
80
81
|
/**
|
|
81
82
|
* Ensure an available free kill source subject to constraints.
|
|
82
83
|
* Throws an error if no source can be found.
|
|
84
|
+
*
|
|
83
85
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
84
86
|
* @returns Free kill source satisfying constraints.
|
|
85
87
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActionSource, FindActionSourceConstraints } from "./ActionSource";
|
|
2
2
|
/**
|
|
3
3
|
* Find an available free run source subject to constraints.
|
|
4
|
+
*
|
|
4
5
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
5
6
|
* @returns Free run source satisfying constraints, or null.
|
|
6
7
|
*/
|
|
@@ -8,6 +9,7 @@ export declare function tryFindFreeRun(constraints?: FindActionSourceConstraints
|
|
|
8
9
|
/**
|
|
9
10
|
* Ensure an available free run source subject to constraints.
|
|
10
11
|
* Throws an error if no source can be found.
|
|
12
|
+
*
|
|
11
13
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
12
14
|
* @returns Free run source satisfying constraints.
|
|
13
15
|
*/
|
package/dist/actions/FreeRun.js
CHANGED
|
@@ -123,6 +123,7 @@ const freeRunSources = [
|
|
|
123
123
|
];
|
|
124
124
|
/**
|
|
125
125
|
* Find an available free run source subject to constraints.
|
|
126
|
+
*
|
|
126
127
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
127
128
|
* @returns Free run source satisfying constraints, or null.
|
|
128
129
|
*/
|
|
@@ -138,6 +139,7 @@ export function tryFindFreeRun(constraints) {
|
|
|
138
139
|
/**
|
|
139
140
|
* Ensure an available free run source subject to constraints.
|
|
140
141
|
* Throws an error if no source can be found.
|
|
142
|
+
*
|
|
141
143
|
* @param constraints Preexisting constraints that restrict possible sources.
|
|
142
144
|
* @returns Free run source satisfying constraints.
|
|
143
145
|
*/
|