farming-weight 0.2.13 → 0.3.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/dist/classes/farmingaccessory.d.ts +15 -0
- package/dist/classes/farmingaccessory.js +42 -0
- package/dist/classes/farmingaccessory.js.map +1 -0
- package/dist/classes/farmingarmor.d.ts +6 -5
- package/dist/classes/farmingarmor.js +38 -36
- package/dist/classes/farmingarmor.js.map +1 -1
- package/dist/classes/farmingpet.d.ts +18 -3
- package/dist/classes/farmingpet.js +75 -9
- package/dist/classes/farmingpet.js.map +1 -1
- package/dist/classes/farmingtool.d.ts +13 -9
- package/dist/classes/farmingtool.js +51 -35
- package/dist/classes/farmingtool.js.map +1 -1
- package/dist/classes/item.d.ts +1 -1
- package/dist/classes/item.js +1 -2
- package/dist/classes/lotusgear.d.ts +5 -5
- package/dist/classes/lotusgear.js +19 -21
- package/dist/classes/lotusgear.js.map +1 -1
- package/dist/classes/player.d.ts +33 -9
- package/dist/classes/player.js +140 -28
- package/dist/classes/player.js.map +1 -1
- package/dist/classes/weightcalc.d.ts +1 -1
- package/dist/classes/weightcalc.js +27 -31
- package/dist/classes/weightcalc.js.map +1 -1
- package/dist/constants/accessories.d.ts +14 -0
- package/dist/constants/accessories.js +36 -0
- package/dist/constants/accessories.js.map +1 -0
- package/dist/constants/armor.js +125 -128
- package/dist/constants/armor.js.map +1 -1
- package/dist/constants/crops.d.ts +2 -0
- package/dist/constants/crops.js +20 -7
- package/dist/constants/crops.js.map +1 -1
- package/dist/constants/enchants.js +67 -70
- package/dist/constants/enchants.js.map +1 -1
- package/dist/constants/lotus.js +26 -29
- package/dist/constants/lotus.js.map +1 -1
- package/dist/constants/personalbests.d.ts +1 -1
- package/dist/constants/personalbests.js +17 -21
- package/dist/constants/personalbests.js.map +1 -1
- package/dist/constants/pests.d.ts +2 -2
- package/dist/constants/pests.js +10 -15
- package/dist/constants/pests.js.map +1 -1
- package/dist/constants/pets.d.ts +21 -3
- package/dist/constants/pets.js +37 -23
- package/dist/constants/pets.js.map +1 -1
- package/dist/constants/reforges.js +8 -11
- package/dist/constants/reforges.js.map +1 -1
- package/dist/constants/skills.js +2 -5
- package/dist/constants/skills.js.map +1 -1
- package/dist/constants/specialcrops.js +16 -19
- package/dist/constants/specialcrops.js.map +1 -1
- package/dist/constants/specific.d.ts +3 -0
- package/dist/constants/specific.js +5 -5
- package/dist/constants/specific.js.map +1 -1
- package/dist/constants/tools.js +121 -124
- package/dist/constants/tools.js.map +1 -1
- package/dist/constants/weight.js +15 -18
- package/dist/constants/weight.js.map +1 -1
- package/dist/crops/melon.d.ts +1 -1
- package/dist/crops/melon.js +3 -7
- package/dist/crops/melon.js.map +1 -1
- package/dist/crops/pumpkin.d.ts +1 -1
- package/dist/crops/pumpkin.js +3 -7
- package/dist/crops/pumpkin.js.map +1 -1
- package/dist/crops/special.d.ts +1 -1
- package/dist/crops/special.js +6 -10
- package/dist/crops/special.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25 -38
- package/dist/index.js.map +1 -1
- package/dist/util/itemstats.d.ts +3 -3
- package/dist/util/itemstats.js +48 -53
- package/dist/util/itemstats.js.map +1 -1
- package/dist/util/jacob.d.ts +3 -3
- package/dist/util/jacob.js +10 -11
- package/dist/util/jacob.js.map +1 -1
- package/dist/util/lore.d.ts +1 -1
- package/dist/util/lore.js +1 -5
- package/dist/util/lore.js.map +1 -1
- package/dist/util/names.d.ts +5 -4
- package/dist/util/names.js +102 -78
- package/dist/util/names.js.map +1 -1
- package/dist/util/ratecalc.d.ts +7 -7
- package/dist/util/ratecalc.js +65 -75
- package/dist/util/ratecalc.js.map +1 -1
- package/dist/util/skyblocktime.d.ts +1 -0
- package/dist/util/skyblocktime.js +8 -5
- package/dist/util/skyblocktime.js.map +1 -1
- package/package.json +1 -1
package/dist/util/ratecalc.js
CHANGED
|
@@ -1,57 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const melon_1 = require("../crops/melon");
|
|
8
|
-
const pumpkin_1 = require("../crops/pumpkin");
|
|
9
|
-
const special_1 = require("../crops/special");
|
|
1
|
+
import { CROP_INFO, Crop, MAX_CROP_FORTUNE } from '../constants/crops';
|
|
2
|
+
import { REFORGES, Rarity, Stat } from '../constants/reforges';
|
|
3
|
+
import { BEST_FARMING_TOOLS } from '../constants/tools';
|
|
4
|
+
import { calculateMelonPerkBonus } from '../crops/melon';
|
|
5
|
+
import { calculatePumpkinPerkBonus } from '../crops/pumpkin';
|
|
6
|
+
import { calculateAverageSpecialCrops } from '../crops/special';
|
|
10
7
|
const crops = [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
Crop.Cactus,
|
|
9
|
+
Crop.Carrot,
|
|
10
|
+
Crop.CocoaBeans,
|
|
11
|
+
Crop.Melon,
|
|
12
|
+
Crop.Mushroom,
|
|
13
|
+
Crop.NetherWart,
|
|
14
|
+
Crop.Potato,
|
|
15
|
+
Crop.Pumpkin,
|
|
16
|
+
Crop.SugarCane,
|
|
17
|
+
Crop.Wheat,
|
|
18
|
+
Crop.Seeds,
|
|
22
19
|
];
|
|
23
|
-
function
|
|
20
|
+
export function calculateAverageDrops(options) {
|
|
24
21
|
const result = {};
|
|
25
22
|
for (const crop of crops) {
|
|
26
|
-
result[crop] =
|
|
23
|
+
result[crop] = calculateExpectedDrops({
|
|
27
24
|
crop: crop,
|
|
28
25
|
...options,
|
|
29
26
|
});
|
|
30
27
|
}
|
|
31
28
|
return result;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
function CalculateDetailedAverageDrops(options) {
|
|
30
|
+
export function calculateDetailedAverageDrops(options) {
|
|
35
31
|
const result = {};
|
|
36
32
|
for (const crop of crops) {
|
|
37
|
-
result[crop] =
|
|
33
|
+
result[crop] = calculateDetailedDrops({
|
|
38
34
|
crop: crop,
|
|
39
35
|
...options,
|
|
40
36
|
});
|
|
41
37
|
}
|
|
42
|
-
const wheat = result[
|
|
43
|
-
const seeds = result[
|
|
38
|
+
const wheat = result[Crop.Wheat];
|
|
39
|
+
const seeds = result[Crop.Seeds];
|
|
44
40
|
// Combine seeds into wheat
|
|
45
41
|
const seedCollection = seeds.collection - options.blocksBroken;
|
|
46
42
|
wheat.otherCollection['Seeds'] = seedCollection;
|
|
47
|
-
wheat.coinSources['Seeds'] = seedCollection *
|
|
43
|
+
wheat.coinSources['Seeds'] = seedCollection * CROP_INFO[Crop.Seeds].npc;
|
|
48
44
|
if (options.bountiful) {
|
|
49
45
|
wheat.coinSources['Bountiful (Seeds)'] = seeds.coinSources['Bountiful'] ?? 0;
|
|
50
46
|
}
|
|
51
47
|
wheat.npcCoins = Object.values(wheat.coinSources).reduce((a, b) => a + b, 0);
|
|
52
48
|
// Count mooshroom mushrooms as normal mushroom collection
|
|
53
49
|
if (options.mooshroom) {
|
|
54
|
-
const mushroom = result[
|
|
50
|
+
const mushroom = result[Crop.Mushroom];
|
|
55
51
|
const mooshroom = mushroom.otherCollection['Mushroom'] ?? 0;
|
|
56
52
|
mushroom.collection += mooshroom;
|
|
57
53
|
mushroom.otherCollection['Mooshroom'] = mooshroom;
|
|
@@ -59,38 +55,36 @@ function CalculateDetailedAverageDrops(options) {
|
|
|
59
55
|
}
|
|
60
56
|
return result;
|
|
61
57
|
}
|
|
62
|
-
|
|
63
|
-
function CalculateExpectedDrops(options) {
|
|
58
|
+
export function calculateExpectedDrops(options) {
|
|
64
59
|
const { farmingFortune, blocksBroken, crop } = options;
|
|
65
|
-
const fortune = farmingFortune ??
|
|
60
|
+
const fortune = farmingFortune ?? MAX_CROP_FORTUNE[crop] ?? 0;
|
|
66
61
|
if (fortune <= 0 || blocksBroken < 0)
|
|
67
62
|
return 0;
|
|
68
|
-
const { drops } =
|
|
63
|
+
const { drops } = getCropInfo(crop);
|
|
69
64
|
if (!drops)
|
|
70
65
|
return 0;
|
|
71
66
|
const baseDrops = blocksBroken * drops * ((fortune + 100) * 0.01);
|
|
72
67
|
switch (crop) {
|
|
73
|
-
case
|
|
74
|
-
case
|
|
75
|
-
case
|
|
76
|
-
case
|
|
68
|
+
case Crop.Cactus:
|
|
69
|
+
case Crop.Wheat:
|
|
70
|
+
case Crop.Mushroom:
|
|
71
|
+
case Crop.SugarCane:
|
|
77
72
|
return Math.round(baseDrops);
|
|
78
|
-
case
|
|
79
|
-
case
|
|
80
|
-
case
|
|
81
|
-
case
|
|
82
|
-
case
|
|
73
|
+
case Crop.Carrot:
|
|
74
|
+
case Crop.CocoaBeans:
|
|
75
|
+
case Crop.NetherWart:
|
|
76
|
+
case Crop.Potato:
|
|
77
|
+
case Crop.Seeds:
|
|
83
78
|
return Math.round(baseDrops - blocksBroken); // Replenish takes away one drop per block broken
|
|
84
|
-
case
|
|
85
|
-
return Math.round(baseDrops + (
|
|
86
|
-
case
|
|
87
|
-
return Math.round(baseDrops + (
|
|
79
|
+
case Crop.Pumpkin:
|
|
80
|
+
return Math.round(baseDrops + calculatePumpkinPerkBonus(blocksBroken));
|
|
81
|
+
case Crop.Melon:
|
|
82
|
+
return Math.round(baseDrops + calculateMelonPerkBonus(blocksBroken));
|
|
88
83
|
default:
|
|
89
84
|
return 0;
|
|
90
85
|
}
|
|
91
86
|
}
|
|
92
|
-
|
|
93
|
-
function CalculateDetailedDrops(options) {
|
|
87
|
+
export function calculateDetailedDrops(options) {
|
|
94
88
|
const result = {
|
|
95
89
|
collection: 0,
|
|
96
90
|
npcCoins: 0,
|
|
@@ -99,18 +93,18 @@ function CalculateDetailedDrops(options) {
|
|
|
99
93
|
otherCollection: {},
|
|
100
94
|
};
|
|
101
95
|
const { farmingFortune, blocksBroken, crop, bountiful } = options;
|
|
102
|
-
let fortune = farmingFortune ??
|
|
96
|
+
let fortune = farmingFortune ?? MAX_CROP_FORTUNE[crop] ?? 0;
|
|
103
97
|
if (fortune <= 0 || blocksBroken < 0)
|
|
104
98
|
return result;
|
|
105
99
|
if (!bountiful && !farmingFortune) {
|
|
106
100
|
// Add the difference in farming fortune if the user has blessed instead of bountiful
|
|
107
|
-
const maxRarity =
|
|
108
|
-
const bountifulFortune =
|
|
109
|
-
const blessedFortune =
|
|
101
|
+
const maxRarity = BEST_FARMING_TOOLS[crop]?.maxRarity ?? Rarity.Mythic;
|
|
102
|
+
const bountifulFortune = REFORGES.bountiful?.tiers[maxRarity]?.stats?.[Stat.FarmingFortune] ?? 0;
|
|
103
|
+
const blessedFortune = REFORGES.blessed?.tiers[maxRarity]?.stats?.[Stat.FarmingFortune] ?? 0;
|
|
110
104
|
fortune += blessedFortune - bountifulFortune;
|
|
111
105
|
}
|
|
112
106
|
result.fortune = fortune;
|
|
113
|
-
const { drops, npc, breaks = 1, replenish = false } =
|
|
107
|
+
const { drops, npc, breaks = 1, replenish = false } = getCropInfo(crop);
|
|
114
108
|
if (!drops)
|
|
115
109
|
return result;
|
|
116
110
|
const baseDrops = blocksBroken * drops * ((fortune + 100) * 0.01);
|
|
@@ -121,24 +115,24 @@ function CalculateDetailedDrops(options) {
|
|
|
121
115
|
}
|
|
122
116
|
if (options.mooshroom) {
|
|
123
117
|
const mushroomDrops = Math.round(blocksBroken * breaks);
|
|
124
|
-
result.coinSources['Mooshroom'] = mushroomDrops *
|
|
118
|
+
result.coinSources['Mooshroom'] = mushroomDrops * CROP_INFO[Crop.Mushroom].npc;
|
|
125
119
|
result.otherCollection['Mushroom'] = mushroomDrops;
|
|
126
120
|
}
|
|
127
|
-
const armorPieces = crop ===
|
|
128
|
-
const specialCrops = (
|
|
121
|
+
const armorPieces = crop === Crop.Cactus ? 3 : 4;
|
|
122
|
+
const specialCrops = calculateAverageSpecialCrops(blocksBroken, crop, armorPieces);
|
|
129
123
|
result.otherCollection[specialCrops.type] = Math.round(specialCrops.amount);
|
|
130
124
|
result.coinSources[specialCrops.type] = Math.round(specialCrops.npc);
|
|
131
125
|
let extraDrops = 0;
|
|
132
126
|
switch (crop) {
|
|
133
|
-
case
|
|
134
|
-
extraDrops = Math.round((
|
|
127
|
+
case Crop.Pumpkin:
|
|
128
|
+
extraDrops = Math.round(calculatePumpkinPerkBonus(blocksBroken));
|
|
135
129
|
result.coinSources['Dicer RNG'] = Math.round(extraDrops * npc);
|
|
136
130
|
result.coinSources['Collection'] = Math.round(baseDrops * npc);
|
|
137
131
|
result.otherCollection['RNG Pumpkin'] = Math.round(extraDrops);
|
|
138
132
|
result.collection = Math.round(baseDrops + extraDrops);
|
|
139
133
|
break;
|
|
140
|
-
case
|
|
141
|
-
extraDrops = Math.round((
|
|
134
|
+
case Crop.Melon:
|
|
135
|
+
extraDrops = Math.round(calculateMelonPerkBonus(blocksBroken));
|
|
142
136
|
result.coinSources['Dicer RNG'] = Math.round(extraDrops * npc);
|
|
143
137
|
result.coinSources['Collection'] = Math.round(baseDrops * npc);
|
|
144
138
|
result.otherCollection['RNG Melon'] = Math.round(extraDrops);
|
|
@@ -159,36 +153,32 @@ function CalculateDetailedDrops(options) {
|
|
|
159
153
|
result.npcCoins = Object.values(result.coinSources).reduce((a, b) => a + b, 0);
|
|
160
154
|
return result;
|
|
161
155
|
}
|
|
162
|
-
|
|
163
|
-
function GetFortuneRequiredForCollection(options) {
|
|
156
|
+
export function getFortuneRequiredForCollection(options) {
|
|
164
157
|
const { blocksBroken, crop, useDicers, useMooshroom } = options;
|
|
165
158
|
let { collection } = options;
|
|
166
|
-
const { drops } =
|
|
159
|
+
const { drops } = getCropInfo(options.crop);
|
|
167
160
|
if (useDicers)
|
|
168
161
|
switch (crop) {
|
|
169
|
-
case
|
|
170
|
-
collection -= (
|
|
162
|
+
case Crop.Pumpkin:
|
|
163
|
+
collection -= calculatePumpkinPerkBonus(blocksBroken);
|
|
171
164
|
break;
|
|
172
|
-
case
|
|
173
|
-
collection -= (
|
|
165
|
+
case Crop.Melon:
|
|
166
|
+
collection -= calculateMelonPerkBonus(blocksBroken);
|
|
174
167
|
break;
|
|
175
168
|
}
|
|
176
|
-
if (useMooshroom && crop ===
|
|
169
|
+
if (useMooshroom && crop === Crop.Mushroom) {
|
|
177
170
|
collection -= blocksBroken; // "* breaks" not needed because it's always 1 for mushroom
|
|
178
171
|
}
|
|
179
172
|
const fortune = (collection * 100) / (drops * blocksBroken) - 100;
|
|
180
173
|
return Math.ceil(fortune);
|
|
181
174
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const { npc } = GetCropInfo(crop);
|
|
175
|
+
export function getNPCProfitFromCrops(crop, amount) {
|
|
176
|
+
const { npc } = getCropInfo(crop);
|
|
185
177
|
if (!npc)
|
|
186
178
|
return 0;
|
|
187
179
|
return npc * amount;
|
|
188
180
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return crops_1.CROP_INFO[crop] ?? {};
|
|
181
|
+
export function getCropInfo(crop) {
|
|
182
|
+
return CROP_INFO[crop] ?? {};
|
|
192
183
|
}
|
|
193
|
-
exports.GetCropInfo = GetCropInfo;
|
|
194
184
|
//# sourceMappingURL=ratecalc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ratecalc.js","sourceRoot":"","sources":["../../src/util/ratecalc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ratecalc.js","sourceRoot":"","sources":["../../src/util/ratecalc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAY,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAA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E,UAAU,EAAE,GAAG,OAAO,CAAC;IAE7B,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C,IAAI,SAAS;QACZ,QAAQ,IAAI,EAAE;YACb,KAAK,IAAI,CAAC,OAAO;gBAChB,UAAU,IAAI,yBAAyB,CAAC,YAAY,CAAC,CAAC;gBACtD,MAAM;YACP,KAAK,IAAI,CAAC,KAAK;gBACd,UAAU,IAAI,uBAAuB,CAAC,YAAY,CAAC,CAAC;gBACpD,MAAM;SACP;IAEF,IAAI,YAAY,IAAI,IAAI,KAAK,IAAI,CAAC,QAAQ,EAAE;QAC3C,UAAU,IAAI,YAAY,CAAC,CAAC,2DAA2D;KACvF;IAED,MAAM,OAAO,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC;IAClE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAU,EAAE,MAAc;IAC/D,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,GAAG;QAAE,OAAO,CAAC,CAAC;IACnB,OAAO,GAAG,GAAG,MAAM,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAU;IACrC,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -9,6 +9,7 @@ export declare class SkyBlockTime {
|
|
|
9
9
|
constructor(unixMs: number);
|
|
10
10
|
static from(sbYear: number, sbMonth?: number, sbDay?: number): SkyBlockTime;
|
|
11
11
|
static fromZeroIndexed(sbYear: number, sbMonth?: number, sbDay?: number): SkyBlockTime;
|
|
12
|
+
static fromContestKey(contestKey: string): SkyBlockTime;
|
|
12
13
|
get monthName(): "Early Spring" | "Spring" | "Late Spring" | "Early Summer" | "Summer" | "Late Summer" | "Early Autumn" | "Autumn" | "Late Autumn" | "Early Winter" | "Winter" | "Late Winter" | undefined;
|
|
13
14
|
isSpring(): boolean;
|
|
14
15
|
isSummer(): boolean;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SkyBlockTime = void 0;
|
|
4
|
-
class SkyBlockTime {
|
|
1
|
+
export class SkyBlockTime {
|
|
5
2
|
static SkyBlockEpochSeconds = 1560275700;
|
|
6
3
|
static MonthNames = [
|
|
7
4
|
'Early Spring',
|
|
@@ -36,6 +33,13 @@ class SkyBlockTime {
|
|
|
36
33
|
const elapsedSeconds = elapsedDays * 1200;
|
|
37
34
|
return new SkyBlockTime((elapsedSeconds + SkyBlockTime.SkyBlockEpochSeconds) * 1000);
|
|
38
35
|
}
|
|
36
|
+
static fromContestKey(contestKey) {
|
|
37
|
+
// Contest keys are in this format: '160:6_30:CROP_ID'
|
|
38
|
+
// Year counts from zero, month and day start at 1 (for some reason)
|
|
39
|
+
const [year, monthDay] = contestKey.split(':') ?? [];
|
|
40
|
+
const [month, day] = monthDay?.split('_').map(Number) ?? [];
|
|
41
|
+
return this.fromZeroIndexed(+(year ?? 0), (month ?? 0) - 1, (day ?? 0) - 1);
|
|
42
|
+
}
|
|
39
43
|
get monthName() {
|
|
40
44
|
return SkyBlockTime.MonthNames[this.month - 1];
|
|
41
45
|
}
|
|
@@ -55,7 +59,6 @@ class SkyBlockTime {
|
|
|
55
59
|
return `${this.monthName} ${appendOrdinalSuffix(this.day)}, Year ${this.year}`;
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
|
-
exports.SkyBlockTime = SkyBlockTime;
|
|
59
62
|
function appendOrdinalSuffix(number) {
|
|
60
63
|
const j = number % 10;
|
|
61
64
|
const k = number % 100;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skyblocktime.js","sourceRoot":"","sources":["../../src/util/skyblocktime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skyblocktime.js","sourceRoot":"","sources":["../../src/util/skyblocktime.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAY;IACxB,MAAM,CAAU,oBAAoB,GAAG,UAAU,CAAC;IAClD,MAAM,CAAU,UAAU,GAAG;QAC5B,cAAc;QACd,QAAQ;QACR,aAAa;QACb,cAAc;QACd,QAAQ;QACR,aAAa;QACb,cAAc;QACd,QAAQ;QACR,aAAa;QACb,cAAc;QACd,QAAQ;QACR,aAAa;KACJ,CAAC;IAOX,MAAM,KAAK,GAAG;QACb,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,YAAY,MAAc;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;QAE7C,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,oBAAoB,CAAC;QAC5E,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;QAEtD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QACtD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAAc,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC;QACjD,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,GAAG,CAA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