fixoraclecards for Hero Wars Helper

fixoraclecards for HeroWarsHelper script

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name			fixoraclecards for Hero Wars Helper
// @name:en			fixoraclecards for Hero Wars Helper
// @name:ru			fixoraclecards for Hero Wars Helper
// @namespace		fixoraclecards for Hero Wars Helper
// @version			0.0.3
// @description		fixoraclecards for HeroWarsHelper script
// @description:en	fixoraclecards for HeroWarsHelper script
// @description:ru	fixoraclecards для скрипта HeroWarsHelper
// @author			ZingerY & Orb
// @license 		Copyright ZingerY
// @homepage		https://zingery.ru/scripts/HWHBestDungeonExt.user.js
// @icon			https://zingery.ru/scripts/VaultBoyIco16.ico
// @icon64			https://zingery.ru/scripts/VaultBoyIco64.png
// @match			https://www.hero-wars.com/*
// @match			https://apps-1701433570146040.apps.fbsbx.com/*
// @run-at			document-start
// ==/UserScript==

(function () {
	if (!this.HWHClasses) {
		console.log('%cObject for extension not found', 'color: red');
		return;
	}
	if (!this.HWHData) {
		console.log('HWHData not found');
	} else {console.log('HWHDataLoaded')}

	console.log('%cStart Extension ' + GM_info.script.name + ', v' + GM_info.script.version + ' by ' + GM_info.script.author, 'color: red');
	const { addExtentionName } = HWHFuncs;
	addExtentionName(GM_info.script.name, GM_info.script.version, GM_info.script.author);

	const {

		getInput,
		setProgress,
		hideProgress,
		I18N,
		send,
		getTimer,
		countdownTimer,
		getUserInfo,
		getSaveVal,
		setSaveVal,
		popup,
		setIsCancalBattle,
		random,
		EventEmitterMixin,
	} = HWHFuncs;
	const executeDungeon = HWHClasses;


    executeDungeon.Prototype.endBattle = async function (battleInfo) {
		if (battleInfo.result.win) {
			const args = {
				result: battleInfo.result,
				progress: battleInfo.progress,
			}
			if (HWHData.countPredictionCard > 0) {
				args.isRaid = true;
			} else {
				const timer = getTimer(battleInfo.battleTime);
				console.log(timer);
				await countdownTimer(timer, `${I18N('DUNGEON')}: ${I18N('TITANIT')} ${dungeonActivity}/${maxDungeonActivity} ${talentMsg}`);
			}
			const calls = [{
				name: "dungeonEndBattle",
				args,
				ident: "body"
			}];
			lastDungeonBattleData = null;
			try {send(JSON.stringify({ calls }), resultEndBattle);}
            catch(e) {// Check if error contains "abnormal speed" or "NotAvailable in dungeonEndBattle"
					if (e.message.includes("abnormal speed") || e.message.includes("NotAvailable in dungeonEndBattle")) {
						console.warn("Server detected fast dungeon completion, retrying without raid...");
						HWHData.countPredictionCard = 0; delete args.isRaid; endBattle(battleInfo)}

		 else {
			endDungeon('dungeonEndBattle win: false\n', battleInfo);
		} }}
	}



    })();