farming-weight 0.2.12 → 0.3.0
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 +31 -18
- 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.d.ts +1 -0
- package/dist/constants/tools.js +122 -113
- 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 +2 -2
- package/dist/util/jacob.js +3 -8
- 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 +87 -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,84 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
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';
|
|
8
7
|
const crops = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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,
|
|
20
19
|
];
|
|
21
|
-
function
|
|
20
|
+
export function calculateAverageDrops(options) {
|
|
22
21
|
const result = {};
|
|
23
22
|
for (const crop of crops) {
|
|
24
|
-
result[crop] =
|
|
23
|
+
result[crop] = calculateExpectedDrops({
|
|
25
24
|
crop: crop,
|
|
26
25
|
...options,
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
return result;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
function CalculateDetailedAverageDrops(options) {
|
|
30
|
+
export function calculateDetailedAverageDrops(options) {
|
|
33
31
|
const result = {};
|
|
34
32
|
for (const crop of crops) {
|
|
35
|
-
result[crop] =
|
|
33
|
+
result[crop] = calculateDetailedDrops({
|
|
36
34
|
crop: crop,
|
|
37
35
|
...options,
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
|
-
const wheat = result[
|
|
41
|
-
const seeds = result[
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const wheat = result[Crop.Wheat];
|
|
39
|
+
const seeds = result[Crop.Seeds];
|
|
40
|
+
// Combine seeds into wheat
|
|
41
|
+
const seedCollection = seeds.collection - options.blocksBroken;
|
|
42
|
+
wheat.otherCollection['Seeds'] = seedCollection;
|
|
43
|
+
wheat.coinSources['Seeds'] = seedCollection * CROP_INFO[Crop.Seeds].npc;
|
|
44
44
|
if (options.bountiful) {
|
|
45
45
|
wheat.coinSources['Bountiful (Seeds)'] = seeds.coinSources['Bountiful'] ?? 0;
|
|
46
46
|
}
|
|
47
47
|
wheat.npcCoins = Object.values(wheat.coinSources).reduce((a, b) => a + b, 0);
|
|
48
|
+
// Count mooshroom mushrooms as normal mushroom collection
|
|
49
|
+
if (options.mooshroom) {
|
|
50
|
+
const mushroom = result[Crop.Mushroom];
|
|
51
|
+
const mooshroom = mushroom.otherCollection['Mushroom'] ?? 0;
|
|
52
|
+
mushroom.collection += mooshroom;
|
|
53
|
+
mushroom.otherCollection['Mooshroom'] = mooshroom;
|
|
54
|
+
delete mushroom.otherCollection['Mushroom'];
|
|
55
|
+
}
|
|
48
56
|
return result;
|
|
49
57
|
}
|
|
50
|
-
|
|
51
|
-
function CalculateExpectedDrops(options) {
|
|
58
|
+
export function calculateExpectedDrops(options) {
|
|
52
59
|
const { farmingFortune, blocksBroken, crop } = options;
|
|
53
|
-
const fortune = farmingFortune ??
|
|
60
|
+
const fortune = farmingFortune ?? MAX_CROP_FORTUNE[crop] ?? 0;
|
|
54
61
|
if (fortune <= 0 || blocksBroken < 0)
|
|
55
62
|
return 0;
|
|
56
|
-
const { drops } =
|
|
63
|
+
const { drops } = getCropInfo(crop);
|
|
57
64
|
if (!drops)
|
|
58
65
|
return 0;
|
|
59
|
-
const baseDrops = blocksBroken * drops * (fortune * 0.01);
|
|
66
|
+
const baseDrops = blocksBroken * drops * ((fortune + 100) * 0.01);
|
|
60
67
|
switch (crop) {
|
|
61
|
-
case
|
|
62
|
-
case
|
|
63
|
-
case
|
|
64
|
-
case
|
|
68
|
+
case Crop.Cactus:
|
|
69
|
+
case Crop.Wheat:
|
|
70
|
+
case Crop.Mushroom:
|
|
71
|
+
case Crop.SugarCane:
|
|
65
72
|
return Math.round(baseDrops);
|
|
66
|
-
case
|
|
67
|
-
case
|
|
68
|
-
case
|
|
69
|
-
case
|
|
70
|
-
case
|
|
73
|
+
case Crop.Carrot:
|
|
74
|
+
case Crop.CocoaBeans:
|
|
75
|
+
case Crop.NetherWart:
|
|
76
|
+
case Crop.Potato:
|
|
77
|
+
case Crop.Seeds:
|
|
71
78
|
return Math.round(baseDrops - blocksBroken); // Replenish takes away one drop per block broken
|
|
72
|
-
case
|
|
73
|
-
return Math.round(baseDrops + (
|
|
74
|
-
case
|
|
75
|
-
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));
|
|
76
83
|
default:
|
|
77
84
|
return 0;
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
|
-
|
|
81
|
-
function CalculateDetailedDrops(options) {
|
|
87
|
+
export function calculateDetailedDrops(options) {
|
|
82
88
|
const result = {
|
|
83
89
|
collection: 0,
|
|
84
90
|
npcCoins: 0,
|
|
@@ -87,46 +93,56 @@ function CalculateDetailedDrops(options) {
|
|
|
87
93
|
otherCollection: {},
|
|
88
94
|
};
|
|
89
95
|
const { farmingFortune, blocksBroken, crop, bountiful } = options;
|
|
90
|
-
let fortune = farmingFortune ??
|
|
96
|
+
let fortune = farmingFortune ?? MAX_CROP_FORTUNE[crop] ?? 0;
|
|
91
97
|
if (fortune <= 0 || blocksBroken < 0)
|
|
92
98
|
return result;
|
|
93
99
|
if (!bountiful && !farmingFortune) {
|
|
94
|
-
fortune
|
|
100
|
+
// Add the difference in farming fortune if the user has blessed instead of bountiful
|
|
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;
|
|
104
|
+
fortune += blessedFortune - bountifulFortune;
|
|
95
105
|
}
|
|
96
106
|
result.fortune = fortune;
|
|
97
|
-
const { drops, npc, breaks = 1, replenish = false } =
|
|
107
|
+
const { drops, npc, breaks = 1, replenish = false } = getCropInfo(crop);
|
|
98
108
|
if (!drops)
|
|
99
109
|
return result;
|
|
100
|
-
const baseDrops = blocksBroken * drops * (fortune * 0.01);
|
|
110
|
+
const baseDrops = blocksBroken * drops * ((fortune + 100) * 0.01);
|
|
111
|
+
result.otherCollection['Normal'] = Math.round(baseDrops);
|
|
101
112
|
// Coin sources
|
|
102
113
|
if (bountiful) {
|
|
103
114
|
result.coinSources['Bountiful'] = Math.round(baseDrops * 0.2);
|
|
104
115
|
}
|
|
105
116
|
if (options.mooshroom) {
|
|
106
|
-
|
|
107
|
-
result.
|
|
117
|
+
const mushroomDrops = Math.round(blocksBroken * breaks);
|
|
118
|
+
result.coinSources['Mooshroom'] = mushroomDrops * CROP_INFO[Crop.Mushroom].npc;
|
|
119
|
+
result.otherCollection['Mushroom'] = mushroomDrops;
|
|
108
120
|
}
|
|
109
|
-
const
|
|
121
|
+
const armorPieces = crop === Crop.Cactus ? 3 : 4;
|
|
122
|
+
const specialCrops = calculateAverageSpecialCrops(blocksBroken, crop, armorPieces);
|
|
110
123
|
result.otherCollection[specialCrops.type] = Math.round(specialCrops.amount);
|
|
111
124
|
result.coinSources[specialCrops.type] = Math.round(specialCrops.npc);
|
|
112
125
|
let extraDrops = 0;
|
|
113
126
|
switch (crop) {
|
|
114
|
-
case
|
|
115
|
-
extraDrops = Math.round((
|
|
127
|
+
case Crop.Pumpkin:
|
|
128
|
+
extraDrops = Math.round(calculatePumpkinPerkBonus(blocksBroken));
|
|
116
129
|
result.coinSources['Dicer RNG'] = Math.round(extraDrops * npc);
|
|
117
|
-
result.collection = Math.round(baseDrops + extraDrops);
|
|
118
130
|
result.coinSources['Collection'] = Math.round(baseDrops * npc);
|
|
131
|
+
result.otherCollection['RNG Pumpkin'] = Math.round(extraDrops);
|
|
132
|
+
result.collection = Math.round(baseDrops + extraDrops);
|
|
119
133
|
break;
|
|
120
|
-
case
|
|
121
|
-
extraDrops = Math.round((
|
|
134
|
+
case Crop.Melon:
|
|
135
|
+
extraDrops = Math.round(calculateMelonPerkBonus(blocksBroken));
|
|
122
136
|
result.coinSources['Dicer RNG'] = Math.round(extraDrops * npc);
|
|
123
|
-
result.collection = Math.round(baseDrops + extraDrops);
|
|
124
137
|
result.coinSources['Collection'] = Math.round(baseDrops * npc);
|
|
138
|
+
result.otherCollection['RNG Melon'] = Math.round(extraDrops);
|
|
139
|
+
result.collection = Math.round(baseDrops + extraDrops);
|
|
125
140
|
break;
|
|
126
141
|
default:
|
|
127
142
|
if (replenish) {
|
|
128
143
|
// Replenish takes away one drop per block broken
|
|
129
144
|
result.coinSources['Collection'] = Math.round((baseDrops - blocksBroken * breaks) * npc);
|
|
145
|
+
result.otherCollection['Replenish'] = -Math.round(blocksBroken * breaks);
|
|
130
146
|
result.collection = Math.round(baseDrops);
|
|
131
147
|
break;
|
|
132
148
|
}
|
|
@@ -137,36 +153,32 @@ function CalculateDetailedDrops(options) {
|
|
|
137
153
|
result.npcCoins = Object.values(result.coinSources).reduce((a, b) => a + b, 0);
|
|
138
154
|
return result;
|
|
139
155
|
}
|
|
140
|
-
|
|
141
|
-
function GetFortuneRequiredForCollection(options) {
|
|
156
|
+
export function getFortuneRequiredForCollection(options) {
|
|
142
157
|
const { blocksBroken, crop, useDicers, useMooshroom } = options;
|
|
143
158
|
let { collection } = options;
|
|
144
|
-
const { drops } =
|
|
159
|
+
const { drops } = getCropInfo(options.crop);
|
|
145
160
|
if (useDicers)
|
|
146
161
|
switch (crop) {
|
|
147
|
-
case
|
|
148
|
-
collection -= (
|
|
162
|
+
case Crop.Pumpkin:
|
|
163
|
+
collection -= calculatePumpkinPerkBonus(blocksBroken);
|
|
149
164
|
break;
|
|
150
|
-
case
|
|
151
|
-
collection -= (
|
|
165
|
+
case Crop.Melon:
|
|
166
|
+
collection -= calculateMelonPerkBonus(blocksBroken);
|
|
152
167
|
break;
|
|
153
168
|
}
|
|
154
|
-
if (useMooshroom && crop ===
|
|
169
|
+
if (useMooshroom && crop === Crop.Mushroom) {
|
|
155
170
|
collection -= blocksBroken; // "* breaks" not needed because it's always 1 for mushroom
|
|
156
171
|
}
|
|
157
172
|
const fortune = (collection * 100) / (drops * blocksBroken) - 100;
|
|
158
173
|
return Math.ceil(fortune);
|
|
159
174
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const { npc } = GetCropInfo(crop);
|
|
175
|
+
export function getNPCProfitFromCrops(crop, amount) {
|
|
176
|
+
const { npc } = getCropInfo(crop);
|
|
163
177
|
if (!npc)
|
|
164
178
|
return 0;
|
|
165
179
|
return npc * amount;
|
|
166
180
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return crops_1.CROP_INFO[crop] ?? {};
|
|
181
|
+
export function getCropInfo(crop) {
|
|
182
|
+
return CROP_INFO[crop] ?? {};
|
|
170
183
|
}
|
|
171
|
-
exports.GetCropInfo = GetCropInfo;
|
|
172
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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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,CA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