Greasy Fork

Greasy Fork is available in English.

猫国建设者挂机插件

游戏《猫国建设者/喵国建设者/Kittens Game》网页自动化插件(就是外挂),可以在页面->选项->MoeScript中开启/关闭自动化功能

当前为 2025-01-09 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         猫国建设者挂机插件
// @namespace	https://github.com/jiang-ruo/moescript
// @description 游戏《猫国建设者/喵国建设者/Kittens Game》网页自动化插件(就是外挂),可以在页面->选项->MoeScript中开启/关闭自动化功能
// @version     0.14.2
// @author		jiang
// @author      visnz
// @match       https://likexia.gitee.io/cat-zh/*
// @match		https://zhaolinxu.github.io/cat-zh/*
// @grant 		GM_addStyle
// @license		GPL-3.0
// 
// ==/UserScript==
// 
//  因为使用了中文作为函数名,在脚本这边只使用经过优化处理的js代码。
//  源码可以直接访问上方 @namespace 地址
//  frok from: https://github.com/visnz/moescript
//  基于@visnz的版本进行了二开,做一些符合个人喜好的改动,以及适配新的网址
//
// 下面是声明变量:
// $ - jquery的简写 - 页面自带jquery,不知道原作者为什么要引入,这里将@require中的jquery移除,使用页面中的jquery
// gamePage - 页面中自带的gamePage对象
/* global $ */
/* global gamePage */

var __defProp = Object.defineProperty;
var __typeError = (msg) => {
  throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
var _ratio;
const RESOURCE_INITIAL_INFO = [
  { "name": "catnip", "title": "猫薄荷", "type": "common" },
  { "name": "wood", "title": "木材", "type": "common" },
  { "name": "minerals", "title": "矿物", "type": "common" },
  { "name": "coal", "title": "煤", "type": "common" },
  { "name": "iron", "title": "铁", "type": "common" },
  { "name": "titanium", "title": "钛", "type": "common" },
  { "name": "gold", "title": "黄金", "type": "common" },
  { "name": "oil", "title": "石油", "type": "common" },
  { "name": "uranium", "title": "铀", "type": "common" },
  { "name": "unobtainium", "title": "难得素", "type": "common" },
  { "name": "antimatter", "title": "反物质", "type": "common" },
  { "name": "manpower", "title": "喵力", "type": "common" },
  { "name": "science", "title": "科学", "type": "common" },
  { "name": "culture", "title": "文化", "type": "common" },
  { "name": "faith", "title": "信仰", "type": "common" },
  { "name": "kittens", "title": "猫口", "type": "common" },
  { "name": "zebras", "title": "斑马", "type": "common" },
  { "name": "starchart", "title": "星图", "type": "common" },
  { "name": "temporalFlux", "title": "时间通量", "type": "common" },
  { "name": "gflops", "title": "浮点", "type": "common" },
  { "name": "hashrates", "title": "哈希率", "type": "common" },
  { "name": "furs", "title": "毛皮", "type": "uncommon" },
  { "name": "ivory", "title": "象牙", "type": "uncommon" },
  { "name": "spice", "title": "香料", "type": "uncommon" },
  { "name": "unicorns", "title": "独角兽", "type": "rare" },
  { "name": "alicorn", "title": "天角兽", "type": "rare" },
  { "name": "necrocorn", "title": "死灵兽", "type": "rare" },
  { "name": "tears", "title": "眼泪", "type": "rare" },
  { "name": "karma", "title": "业", "type": "rare" },
  { "name": "paragon", "title": "领导力", "type": "common" },
  { "name": "burnedParagon", "title": "燃烧领导力", "type": "common" },
  { "name": "timeCrystal", "title": "时间水晶", "type": "common" },
  { "name": "sorrow", "title": "悲伤", "type": "common" },
  { "name": "relic", "title": "遗物", "type": "exotic" },
  { "name": "void", "title": "虚空", "type": "exotic" },
  { "name": "elderBox", "title": "礼物盒", "type": "exotic" },
  { "name": "wrappingPaper", "title": "包装纸", "type": "exotic" },
  { "name": "blackcoin", "title": "黑币", "type": "exotic" },
  { "name": "bloodstone", "title": "血石", "type": "exotic" },
  { "name": "tMythril", "title": "T秘银", "type": "exotic" },
  { "name": "beam", "title": "木梁", "type": "common" },
  { "name": "slab", "title": "石板", "type": "common" },
  { "name": "plate", "title": "金属板", "type": "common" },
  { "name": "steel", "title": "钢", "type": "common" },
  { "name": "concrate", "title": "混凝土", "type": "common" },
  { "name": "gear", "title": "齿轮", "type": "common" },
  { "name": "alloy", "title": "合金", "type": "common" },
  { "name": "eludium", "title": "E合金", "type": "common" },
  { "name": "scaffold", "title": "脚手架", "type": "common" },
  { "name": "ship", "title": "船", "type": "common" },
  { "name": "tanker", "title": "油轮", "type": "common" },
  { "name": "kerosene", "title": "煤油", "type": "common" },
  { "name": "parchment", "title": "羊皮纸", "type": "common" },
  { "name": "manuscript", "title": "手稿", "type": "common" },
  { "name": "compedium", "title": "概要", "type": "common" },
  { "name": "blueprint", "title": "蓝图", "type": "common" },
  { "name": "thorium", "title": "钍", "type": "common" },
  { "name": "megalith", "title": "巨石", "type": "common" }
];
const resourceMap = {};
for (const value of RESOURCE_INITIAL_INFO) {
  resourceMap[value.title] = {
    name: value.name,
    title: value.title,
    type: value.type,
    class: `resource_${value.name}`
  };
}
var GenerateType = /* @__PURE__ */ ((GenerateType2) => {
  GenerateType2["GT1"] = "craft-1pc";
  GenerateType2["GT5"] = "craft-5pc";
  GenerateType2["GT10"] = "craft-10pc";
  GenerateType2["GT_ALL"] = "all";
  return GenerateType2;
})(GenerateType || {});
var TabEnum = /* @__PURE__ */ ((TabEnum2) => {
  TabEnum2[TabEnum2["篝火"] = 1] = "篝火";
  TabEnum2[TabEnum2["营火"] = 1] = "营火";
  TabEnum2[TabEnum2["殖民地"] = 3] = "殖民地";
  TabEnum2[TabEnum2["村庄"] = 3] = "村庄";
  TabEnum2[TabEnum2["小镇"] = 3] = "小镇";
  return TabEnum2;
})(TabEnum || {});
var operate;
((operate2) => {
  function getResourceInfo(resource) {
    const game = moe.game();
    if (!game) return;
    const base = resourceMap[resource];
    if (!base) {
      moe.log.console(`资源【${resource}】不存在`);
      return;
    }
    const res = game.resPool.resourceMap[base.name];
    if (!res) {
      moe.log.console(`资源【${resource}】不存在`);
      return;
    }
    return {
      resource,
      value: res.value,
      maxValue: res.maxValue,
      tickCached: res.perTickCached
    };
  }
  operate2.getResourceInfo = getResourceInfo;
  function getResourceRatio(resource) {
    const ri = getResourceInfo(resource);
    if (!ri) return NaN;
    return ri.value / ri.maxValue;
  }
  operate2.getResourceRatio = getResourceRatio;
  function generateResource(resource, type) {
    const base = resourceMap[resource];
    if (!base) {
      moe.log.console(`资源【${resource}】不存在`);
      return;
    }
    $(`div.craft.${base.class} .${type}`).click();
  }
  operate2.generateResource = generateResource;
  function getActiveTab() {
    return $(".activeTab").parent().children(".activeTab").index() + 1;
  }
  operate2.getActiveTab = getActiveTab;
  function changeTab(tab) {
    $(`a.tab:nth-child(${tab})`)[0].click();
  }
  operate2.changeTab = changeTab;
  function 提拔小猫() {
    $("div.panelContainer:nth-child(3) > div:nth-child(3) > table:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > div:nth-child(4) > div:nth-child(1)").click();
  }
  operate2.提拔小猫 = 提拔小猫;
})(operate || (operate = {}));
var moe;
((moe2) => {
  moe2.STORAGE_KEY = "com.nuclearunicorn.kittengame.plugin.moe";
  moe2.ALL_CLASS_NAME = "moe-moescript";
  function game() {
    try {
      return gamePage;
    } catch (e) {
      return void 0;
    }
  }
  moe2.game = game;
  ((log2) => {
    let timer = false;
    const logs = [];
    function consumer() {
      const game3 = moe2.game();
      if (!game3) {
        setTimeout(consumer, 500);
      } else {
        for (const l of logs) {
          game3.console.msg(l);
        }
        timer = false;
      }
    }
    function plog(msg) {
      logs.push(msg);
      if (!timer) {
        consumer();
        timer = true;
      }
    }
    function game2(msg) {
      const l = `${log2.PREFIX}${msg}}`;
      const g = moe2.game();
      if (g) {
        g.console.msg(l);
      } else {
        plog(l);
      }
    }
    log2.game = game2;
    log2.PREFIX = "猫国建设者挂机插件: ";
    function console(msg) {
      window.console.log(`${log2.PREFIX}${msg}`);
    }
    log2.console = console;
  })(moe2.log || (moe2.log = {}));
  moe2.operate = operate;
})(moe || (moe = {}));
const sec = (s) => s * 1e3;
const min = (m) => m * sec(60);
const hour = (h) => h * min(60);
var Period = ((Period2) => {
  Period2[Period2["S0立即执行"] = sec(0)] = "S0立即执行";
  Period2[Period2["S5秒"] = sec(5)] = "S5秒";
  Period2[Period2["S15秒"] = sec(15)] = "S15秒";
  Period2[Period2["S30秒"] = sec(30)] = "S30秒";
  Period2[Period2["M1分钟"] = min(1)] = "M1分钟";
  Period2[Period2["M5分钟"] = min(5)] = "M5分钟";
  Period2[Period2["H1小时"] = hour(1)] = "H1小时";
  return Period2;
})(Period || {});
const options = {};
let verifyOptions = function() {
  return true;
};
function regiterOption(option) {
  if (options[option.flag]) {
    verifyOptions = function() {
      alert(`${moe.log.PREFIX}无法运行,因为定义了重复的缓存键: ${option.flag}`);
      return false;
    };
  } else {
    options[option.flag] = option;
  }
}
let config;
function loadConfig() {
  const configStr = localStorage.getItem(moe.STORAGE_KEY);
  config = configStr ? JSON.parse(configStr) : {};
  for (const key in config) {
    if (!options[key]) setConfig(false, key);
  }
}
const events = {};
function interval(period) {
  const gp = moe.game();
  if (!gp || gp.isPaused) return;
  const opts = events[period];
  if (!opts) return;
  for (const option of opts) {
    option.script(true, { ...options }, { ...config });
  }
}
function setConfig(isSet, flag2) {
  if (isSet) {
    config[flag2] = true;
  } else {
    delete config[flag2];
  }
  localStorage.setItem(moe.STORAGE_KEY, JSON.stringify(config));
}
function setEvent(isSet, option) {
  try {
    if (option.period === Period.S0立即执行) {
      option.script(isSet, { ...options }, { ...config });
      return;
    }
    if (isSet) {
      if (!events[option.period]) {
        events[option.period] = [];
        moe.log.console(`设置周期为${option.period}的事件`);
        setInterval(() => {
          interval(option.period);
        }, option.period);
      }
      events[option.period].push(option);
    } else {
      const index = events[option.period].findIndex((o) => o === option);
      if (index >= 0) {
        events[option.period].splice(index, 1);
      }
    }
  } finally {
    setConfig(isSet, option.flag);
  }
}
function optionSelect(e) {
  const target = e.currentTarget;
  const flag2 = target.id.replace("moe-", "");
  const option = options[flag2];
  if (target.checked) {
    setEvent(true, option);
    moe.log.game(`开启选项【${option.name}】${option.description.activate}`);
  } else {
    setEvent(false, option);
    moe.log.game(`关闭选项【${option.name}】${option.description.deactivate}`);
  }
}
function moeHtml() {
  const OPTION_STYLES = `
	.moe-tabs-header {
		border-bottom: 1px solid #999;
		margin-bottom: 15px;
	}

	.moe-tab {
		display: inline-block;
		padding: 5px 15px;
		margin-right: 5px;
		text-decoration: none;
		color: inherit;
	}

	.moe-tab.moe-active {
		border: 1px solid #999;
		border-bottom: none;
		background: #fff;
	}
        `;
  GM_addStyle(OPTION_STYLES);
  const groupedOptions = {};
  for (const key in options) {
    const option = options[key];
    if (groupedOptions[option.panel]) {
      groupedOptions[option.panel].push(option);
    } else {
      groupedOptions[option.panel] = [option];
    }
  }
  const allOperators = [];
  for (const panel in groupedOptions) {
    allOperators.push({ panel, list: groupedOptions[panel] });
  }
  const bindClick = [];
  const optionHtml = allOperators.map((operator) => {
    operator.list.sort((a, b) => {
      return (a.index || 9999) - (b.index || 9999);
    });
    const optionsHtml = operator.list.map((option) => {
      const id = `moe-${option.flag}`;
      bindClick.push(() => {
        $(`#${id}`).on("click", optionSelect);
        if (config[option.flag]) $(`#${id}`).click();
      });
      return `
                <span style="white-space:nowrap;">
                    <input class="${moe.ALL_CLASS_NAME}" id="${id}" type="checkbox" style="display:inline">
                    <span>${option.name}</span>
                </span>
            `;
    }).join("");
    return `
            <div>
                <h4>${operator.panel}</h4>
                <div style="display:flex;flex-wrap:wrap">
                    ${optionsHtml}
                </div>
            </div>
        `;
  }).join("");
  const optionsDiv = $("#optionsDiv");
  if (optionsDiv.length === 0) return;
  const originalContent = optionsDiv.html();
  const tabsHtml = `
        <a id="optionsDialogClose" href="#" class="close" onclick="gamePage.closeOptions()" style="position: absolute; top: 10px; right: 15px;">关闭</a>
        <div class="moe-tabs-header" style="margin: 10px 0;">
            <a href="#" class="moe-tab moe-active" data-tab="moe-game">游戏选项</a>
            <a href="#" class="moe-tab" data-tab="moe-moe">MoeScript</a>
        </div>
        <div class="moe-tab-content" id="moe-gameTab" style="display: block;">
            ${originalContent}
        </div>
        <div class="moe-tab-content" id="moe-moeTab" style="display: none;">
            <!-- 添加更多MoeScript选项 -->
            ${optionHtml}
        </div>
    `;
  $("#optionsDiv").html(tabsHtml);
  $(".moe-tab").on("click", function(e) {
    e.preventDefault();
    const targetTab = $(this).data("tab");
    $(".moe-tab").removeClass("moe-active");
    $(this).addClass("moe-active");
    $(".moe-tab-content").hide();
    $(`#${targetTab}Tab`).show();
  });
  for (const fn of bindClick) {
    fn();
  }
}
function optionPanel() {
  if (!verifyOptions()) return;
  loadConfig();
  moeHtml();
}
const seeSky观测天空gctk = {
  panel: "基本",
  name: "自动观测天空",
  description: {
    activate: "出现天文事件时将会自动观测天空",
    deactivate: "停止自动观测天空"
  },
  flag: "观测天空",
  script: async function() {
    const obsBtn = $("#observeBtn");
    if (obsBtn.length === 0) return false;
    moe.log.console(`检测到天空中出现一种罕见的天文现象,自动进行“观测天空”操作`);
    $("#observeBtn").click();
    return true;
  },
  /**
   * 观测天空选项会持续30天(60秒)
   * 但是当先前的天文事件未被观测时,新的天文事件仍有可能发生。
   * 这会导致覆盖之前的事件,所以如果出现了天文事件,需要尽快处理。
   * 
   * 时间设定为5s,会有极小概率错过天文事件(两次天文事件产生在5s内),实测错过概率< 1%
   * 如果不像错过天文事件,可以将时间将时间改到3s内
   */
  period: Period.S5秒
};
seeSky观测天空gctk.script;
seeSky观测天空gctk.flag;
regiterOption(seeSky观测天空gctk);
class GenerateByPeriod {
  constructor(from2, to2, period) {
    __publicField(this, "from");
    __publicField(this, "to");
    __publicField(this, "period");
    this.from = from2;
    this.to = to2;
    this.period = period;
  }
  get panel() {
    return "合成";
  }
  get name() {
    return `${this.from}合成${this.to}`;
  }
  get description() {
    if (this.period === Period.S0立即执行) {
      return {
        activate: `立即执行合成${this.to}(激活)`,
        deactivate: `立即执行合成${this.to}(关闭)`
      };
    }
    let p;
    switch (this.period) {
      case Period.S5秒:
        p = "每5秒";
        break;
      case Period.S15秒:
        p = "每15秒";
        break;
      case Period.S30秒:
        p = "每30秒";
        break;
      case Period.M1分钟:
        p = "每分钟";
        break;
      case Period.M5分钟:
        p = "每5分钟";
        break;
      case Period.H1小时:
        p = "每小时";
        break;
      default:
        throw new Error("未定义的时间周期");
    }
    return {
      activate: `${p}自动将所有${this.to}合成${this.from}`,
      deactivate: `停止自动合成${this.to}`
    };
  }
  get flag() {
    return `${this.from}合成${this.to}`;
  }
  async script() {
    moe.log.console(`执行自动合成${this.to}`);
    moe.operate.generateResource(this.to, GenerateType.GT_ALL);
    return true;
  }
}
class GenerateByRatio extends GenerateByPeriod {
  constructor(from2, to2, period, ratio2) {
    super(from2, to2, period);
    __privateAdd(this, _ratio);
    if (ratio2 <= 0 || ratio2 > 1) throw new Error("ratio must be in (0, 1]");
    __privateSet(this, _ratio, ratio2);
  }
  get description() {
    return {
      activate: `将在${this.from}库存达到${__privateGet(this, _ratio) * 100}%时自动合成${this.to}`,
      deactivate: `停止自动合成${this.to}`
    };
  }
  async script() {
    const rate = moe.operate.getResourceRatio(this.from);
    if (rate === Infinity) {
      moe.log.game(`合成${this.to}时计算异常,无法获取原料【${this.from}】仓库大小。`);
      return false;
    }
    if (rate < __privateGet(this, _ratio)) return false;
    moe.log.console(`检测到${this.from}储量达到${__privateGet(this, _ratio) * 100}%,自动合成${this.to}`);
    moe.operate.generateResource(this.to, GenerateType.GT_ALL);
    return true;
  }
}
_ratio = new WeakMap();
const from$5 = "木材";
const to$5 = "木梁";
const ratio$4 = 0.95;
const generate木梁from木材 = new GenerateByRatio(from$5, to$5, Period.S30秒, ratio$4);
generate木梁from木材.oriScript = generate木梁from木材.script;
generate木梁from木材.flag;
regiterOption(generate木梁from木材);
const from$4 = "矿物";
const to$4 = "石板";
const ratio$3 = 0.95;
const generate石板from矿物 = new GenerateByRatio(from$4, to$4, Period.S30秒, ratio$3);
generate石板from矿物.oriScript = generate石板from矿物.script;
generate石板from矿物.flag;
regiterOption(generate石板from矿物);
const from$3 = "煤";
const to$3 = "钢";
const ratio$2 = 0.95;
const generate钢from煤 = new GenerateByRatio(from$3, to$3, Period.M1分钟, ratio$2);
generate钢from煤.oriScript = generate钢from煤.script;
generate钢from煤.flag;
regiterOption(generate钢from煤);
const from$2 = "铁";
const to$2 = "钢";
const ratio$1 = 0.95;
const genearte钢from铁 = new GenerateByRatio(from$2, to$2, Period.M1分钟, ratio$1);
genearte钢from铁.oriScript = genearte钢from铁.script;
genearte钢from铁.flag;
regiterOption(genearte钢from铁);
const from$1 = "铁";
const to$1 = "金属板";
const ratio = 0.95;
const generate金属板from铁 = new GenerateByRatio(from$1, to$1, Period.M1分钟, ratio);
generate金属板from铁.oriScript = generate金属板from铁.script;
generate金属板from铁.flag;
regiterOption(generate金属板from铁);
const level$1 = 0.95;
const script$1 = async function() {
  const rate = moe.operate.getResourceRatio("喵力");
  if (rate < level$1) return false;
  moe.log.console(`检测到达到${level$1 * 100}%,自动执行打猎。`);
  $("#fastHuntContainerCount").click();
  return true;
};
const hunt打猎 = {
  panel: "基本",
  name: "自动打猎",
  description: {
    activate: `喵力达到${level$1 * 100}%时自动打猎`,
    deactivate: "停止自动打猎"
  },
  flag: "打猎",
  script: script$1,
  /**
   * 观测天空选项会持续30天(60秒)
   * 但是当先前的天文事件未被观测时,新的天文事件仍有可能发生。
   * 这会导致覆盖之前的事件,所以如果出现了天文事件,需要尽快处理。
   * 
   * 时间设定为5s,会有极小概率错过天文事件(两次天文事件产生在5s内),实测错过概率< 1%
   * 如果不像错过天文事件,可以将时间将时间改到3s内
   */
  period: Period.M1分钟
};
const flag = hunt打猎.flag;
regiterOption(hunt打猎);
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const level = 0.95;
const goldPromoteCat提拔小猫 = {
  panel: "基本",
  name: "小猫升职器",
  description: {
    activate: `黄金达到${level * 100}%时自动提拔小猫`,
    deactivate: "停止自动提拔小猫"
  },
  flag: "升职器",
  script: async function() {
    const rate = moe.operate.getResourceRatio("黄金");
    if (rate < level) return false;
    moe.log.console(`检测到黄金储量达到${level * 100}%,自动提拔小猫`);
    const tab = moe.operate.getActiveTab();
    moe.operate.changeTab(TabEnum.村庄);
    await sleep(500);
    moe.operate.提拔小猫();
    await sleep(500);
    moe.operate.changeTab(tab);
    return true;
  },
  /**
   * 观测天空选项会持续30天(60秒)
   * 但是当先前的天文事件未被观测时,新的天文事件仍有可能发生。
   * 这会导致覆盖之前的事件,所以如果出现了天文事件,需要尽快处理。
   * 
   * 时间设定为5s,会有极小概率错过天文事件(两次天文事件产生在5s内),实测错过概率< 1%
   * 如果不像错过天文事件,可以将时间将时间改到3s内
   */
  period: Period.S5秒
};
goldPromoteCat提拔小猫.script;
goldPromoteCat提拔小猫.flag;
regiterOption(goldPromoteCat提拔小猫);
const from = "毛皮";
const to = "羊皮纸";
const generate羊皮纸from毛皮 = new GenerateByPeriod(from, to, Period.H1小时);
generate羊皮纸from毛皮.oriScript = generate羊皮纸from毛皮.script;
const script = () => {
  generate羊皮纸from毛皮.oriScript();
};
generate羊皮纸from毛皮.flag;
regiterOption(generate羊皮纸from毛皮);
const generate羊皮纸After打猎 = {
  panel: "合成",
  name: "自动打猎后执行合成羊皮纸",
  description: {
    activate: "自动打猎后将会自动合成羊皮纸,该功能需要启用【自动打猎】",
    deactivate: "自动打猎后将不再自动合成羊皮纸"
  },
  flag: "打猎合成羊皮纸",
  script: async function(activate, options2) {
    const opt = options2[flag];
    if (activate) {
      opt.script = async function() {
        const hunt = await script$1();
        if (hunt) {
          await sleep(1e3);
          await script();
          return true;
        }
        return false;
      };
    } else {
      opt.script = script$1;
    }
    return true;
  },
  period: Period.S0立即执行
};
generate羊皮纸After打猎.script;
generate羊皮纸After打猎.flag;
regiterOption(generate羊皮纸After打猎);
(function() {
  optionPanel();
})();