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

  1. (function() {
  2. 'use strict';
  3. let tabs = ['story', 'optional']
  4. window.addEventListener('load', function() {
  5. newQuestButtons();
  6. })
  7. function newQuestButtons() {
  8. let questButtons = document.createElement('div');
  9. questButtons.id = "questsButtons";
  10. questButtons.style.cssText = "white-space: nowrap; overflow-x: auto;";
  11. document.getElementById('panel-quests').prepend(questButtons);
  12. questButtons.appendChild(document.getElementById('story-quest-tab-button'));
  13. document.getElementById('story-quest-tab-button').style.whiteSpace = "normal";
  14. questButtons.appendChild(document.getElementById('optional-quest-tab-button'));
  15. document.getElementById('optional-quest-tab-button').style.whiteSpace = "normal";
  16. }
  17. function changeQuestTabsFunction(tabs) {
  18. //Change Quest Class to Make the Quest Tab Button Work
  19. Quests.changeQuestTabs = function(value) {
  20. let questTabs = tabs;
  21.  
  22. // Oculta todos os tabs e remove o destaque
  23. for (const tabId of questTabs) {
  24. document.getElementById(tabId + '-quest-tab').style.display = "none";
  25. document.getElementById(tabId + '-quest-tab-button').style.backgroundColor = "";
  26. }
  27.  
  28. if (value == 'optional') {
  29. if(Items.getItem('optional_quests_unlocked') == 0) {
  30. document.getElementById('story-quest-tab').style.display = "";
  31. document.getElementById('story-quest-tab-button').style.backgroundColor = "#f77a81";
  32. 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');
  33. return;
  34. }
  35. document.getElementById('optional-quest-tab').style.display = "";
  36. document.getElementById('optional-quest-tab-button').style.backgroundColor = "#f77a81";
  37. } else {
  38. document.getElementById(value + '-quest-tab').style.display = "";
  39. document.getElementById(value + '-quest-tab-button').style.backgroundColor = "#f77a81";
  40. }
  41. }
  42. }
  43. function newQuestType(type,description) {
  44. tabs.push(type);
  45. let newTabButton = document.createElement('div');
  46. newTabButton.id = type + "-quest-tab-button";
  47. newTabButton.className = "quest-tab-button hover";
  48. newTabButton.style.marginLeft = "20px";
  49. newTabButton.innerHTML = `${type.toLocaleUpperCase()} QUESTS
  50. <span style="margin-left:20px;" id="${type}-quest-tab-button-label">
  51. <span class="color-yellow">0/0</span>
  52. </span>`;
  53. newTabButton.onclick = function() {
  54. Quests.changeQuestTabs(type);
  55. };
  56. document.getElementById('questsButtons').appendChild(newTabButton);
  57. let newTabPanel = document.createElement('div');
  58. newTabPanel.id = type + "-quest-tab"
  59. newTabPanel.style.display = "none"
  60. newTabPanel.className = "quest-tabs"
  61. newTabPanel.innerHTML = `<h1 style="color:#f77a81">${type.toLocaleUpperCase()} QUESTS</h1>
  62. <span>${description}</span>
  63. <hr>
  64. <div id="${type}-quest-area"></div>`
  65. document.getElementById('panel-quests').appendChild(newTabPanel);
  66. changeQuestTabsFunction(tabs);
  67. }
  68.  
  69. })

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址