Pixel Quests+

Makes it easier to create new custom quests for Idle Pixel

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/487191/1326544/Pixel%20Quests%2B.js

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

(function() {
    'use strict';
	let tabs = ['story', 'optional']
	window.addEventListener('load', function() {
		newQuestButtons();
	})
	
	function newQuestButtons() {
		let questButtons = document.createElement('div');
		questButtons.id = "questsButtons";
		questButtons.style.cssText = "white-space: nowrap; overflow-x: auto;";
		document.getElementById('panel-quests').prepend(questButtons);
		questButtons.appendChild(document.getElementById('story-quest-tab-button'));
		document.getElementById('story-quest-tab-button').style.whiteSpace = "normal";
		questButtons.appendChild(document.getElementById('optional-quest-tab-button'));
		document.getElementById('optional-quest-tab-button').style.whiteSpace = "normal";
	}
	
	function changeQuestTabsFunction(tabs) {
		//Change Quest Class to Make the Quest Tab Button Work
		Quests.changeQuestTabs = function(value) {
			let questTabs = tabs;

			// Oculta todos os tabs e remove o destaque
			for (const tabId of questTabs) {
				document.getElementById(tabId + '-quest-tab').style.display = "none";
				document.getElementById(tabId + '-quest-tab-button').style.backgroundColor = "";
			}

			if (value == 'optional') {
				if(Items.getItem('optional_quests_unlocked') == 0) {
					document.getElementById('story-quest-tab').style.display = "";
					document.getElementById('story-quest-tab-button').style.backgroundColor = "#f77a81";
					Modals.open_image_modal('SIDE QUESTS', 'images/lock.png', 'Unlock side quests?  You need to complete at least 4 of the main story quests to unlock this.','Unlock Optional Quests!','Cancel','UNLOCK_OPTIONAL_QUESTS');
					return;
				}
				document.getElementById('optional-quest-tab').style.display = "";
				document.getElementById('optional-quest-tab-button').style.backgroundColor = "#f77a81";
			} else {
				document.getElementById(value + '-quest-tab').style.display = "";
				document.getElementById(value + '-quest-tab-button').style.backgroundColor = "#f77a81";
			}
		}
	}
	
	function newQuestType(type,description) {
		tabs.push(type);
		let newTabButton = document.createElement('div');
		newTabButton.id = type + "-quest-tab-button";
		newTabButton.className = "quest-tab-button hover";
		newTabButton.style.marginLeft = "20px";
		newTabButton.innerHTML = `${type.toLocaleUpperCase()} QUESTS
			<span style="margin-left:20px;" id="${type}-quest-tab-button-label">
				<span class="color-yellow">0/0</span>
			</span>`;
		newTabButton.onclick = function() {
			Quests.changeQuestTabs(type);
		};
		document.getElementById('questsButtons').appendChild(newTabButton);
		
		let newTabPanel = document.createElement('div');
		newTabPanel.id = type + "-quest-tab"
		newTabPanel.style.display = "none"
		newTabPanel.className = "quest-tabs"
		newTabPanel.innerHTML = `<h1 style="color:#f77a81">${type.toLocaleUpperCase()} QUESTS</h1>
			<span>${description}</span>
			<hr>
			<div id="${type}-quest-area"></div>`
		document.getElementById('panel-quests').appendChild(newTabPanel);
		
		changeQuestTabsFunction(tabs);
	}

})