dankgrinder 8.95.0 → 8.97.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/lib/grinder.js +35 -2
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -672,6 +672,7 @@ class AccountWorker {
|
|
|
672
672
|
this._levelQuestDone = new Set();
|
|
673
673
|
this._questBetOverride = null;
|
|
674
674
|
this._commandRunning = false; // prevents grinding commands from overlapping with quest commands
|
|
675
|
+
this._verifyLevelUnlock = null; // holds level to verify after quest completion
|
|
675
676
|
this.commandQueue = null;
|
|
676
677
|
this.lastHealthCheck = Date.now();
|
|
677
678
|
this.doneToday = new Map();
|
|
@@ -2171,6 +2172,33 @@ class AccountWorker {
|
|
|
2171
2172
|
|
|
2172
2173
|
// ── Main Non-Blocking Grind Scheduler ───────────────────────
|
|
2173
2174
|
async tick() {
|
|
2175
|
+
// ── Level-unlock verification: runs after quests complete ──
|
|
2176
|
+
if (this._verifyLevelUnlock) {
|
|
2177
|
+
const targetLv = this._verifyLevelUnlock;
|
|
2178
|
+
this.setStatus(`verifying level ${targetLv}...`);
|
|
2179
|
+
try {
|
|
2180
|
+
const profile = await this.checkProfile(true);
|
|
2181
|
+
const currentLv = profile.level || this._level || 0;
|
|
2182
|
+
if (currentLv >= targetLv) {
|
|
2183
|
+
this.log('success', `[QUEST] Level ${targetLv} verified ✓ — level unlocked!`);
|
|
2184
|
+
this._level = currentLv;
|
|
2185
|
+
} else {
|
|
2186
|
+
this.log('warn', `[QUEST] Level ${targetLv} NOT verified — still at ${currentLv}. Re-triggering quests.`);
|
|
2187
|
+
// Re-trigger quests for this level
|
|
2188
|
+
this._levelQuestDone.delete(targetLv);
|
|
2189
|
+
this._startLevelQuests(targetLv);
|
|
2190
|
+
this.tickTimeout = setTimeout(() => this.tick(), 2000);
|
|
2191
|
+
return;
|
|
2192
|
+
}
|
|
2193
|
+
} catch (e) {
|
|
2194
|
+
this.log('warn', `[QUEST] Level verification failed: ${e.message} — continuing anyway`);
|
|
2195
|
+
}
|
|
2196
|
+
this._verifyLevelUnlock = null;
|
|
2197
|
+
this.setStatus('idle');
|
|
2198
|
+
this.tickTimeout = setTimeout(() => this.tick(), 2000);
|
|
2199
|
+
return;
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2174
2202
|
// BLOCK: quest mode active — run quests only, no normal grinding
|
|
2175
2203
|
if (this._levelQuestActive && this._levelQuestQueue.length > 0) {
|
|
2176
2204
|
const quest = this._levelQuestQueue[0];
|
|
@@ -2189,10 +2217,15 @@ class AccountWorker {
|
|
|
2189
2217
|
if (this._levelQuestQueue.length === 0) {
|
|
2190
2218
|
this._levelQuestActive = false;
|
|
2191
2219
|
this._levelQuestDone.add(quest.level);
|
|
2192
|
-
|
|
2220
|
+
const justCompletedLevel = quest.level;
|
|
2221
|
+
this.log('success', `[QUEST] Level ${justCompletedLevel} quests DONE — verifying unlock...`);
|
|
2193
2222
|
// Null out commandQueue so buildCommandQueue picks only unlocked commands
|
|
2194
2223
|
this.commandQueue = null;
|
|
2195
|
-
this.setStatus('
|
|
2224
|
+
this.setStatus('verifying level...');
|
|
2225
|
+
// Wait a moment for Dank Memer to process the unlock, then verify level
|
|
2226
|
+
this._verifyLevelUnlock = justCompletedLevel;
|
|
2227
|
+
this.tickTimeout = setTimeout(() => this.tick(), 3000);
|
|
2228
|
+
return;
|
|
2196
2229
|
}
|
|
2197
2230
|
this.tickTimeout = setTimeout(() => this.tick(), 2500);
|
|
2198
2231
|
return;
|