Migrate the extension menu.

This commit is contained in:
Tipx-L 2023-12-08 07:23:31 -08:00
parent fb534ef868
commit a04a2d4732
37 changed files with 372 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import { CONFIGURATION_MENU } from "./library/configuration-menu.js";
import { dynamicTranslate } from "./library/dynamic-translate.js";
import { element } from "./library/element.js";
import { emotionList } from "./library/emotion-list.js";
import { extensionMenu } from "./library/extension-menu.js";
import { extensionPack } from "./library/extension-pack.js";
import { hookMap } from "./library/hook-map.js";
import { hook } from "./library/hook.js";
@ -101,6 +102,7 @@ export class Library {
])
static characterDialogGroup = CharacterDialogGroup;
static configMenu = CONFIGURATION_MENU;
static extensionMenu = extensionMenu;
constructor() {
throw new TypeError(`${new.target.name} is not a constructor`);

View File

@ -0,0 +1,11 @@
import { BOSS } from "./extension-menu/boss.js";
import { CARD_PILE } from "./extension-menu/card-pile.js";
import { COIN } from "./extension-menu/coin.js";
import { WUXING } from "./extension-menu/wuxing.js";
export const extensionMenu = {
cardpile: CARD_PILE,
boss: BOSS,
wuxing: WUXING,
coin: COIN
};

View File

@ -0,0 +1,11 @@
import { ENABLE_AI } from "./boss/enable-ai.js";
import { ENABLE } from "./boss/enable.js";
import { HIDE } from "./boss/hide.js";
import { INTRODUCTION } from "./boss/introduction.js";
export const BOSS = {
enable: ENABLE,
intro: INTRODUCTION,
enableai: ENABLE_AI,
hide: HIDE
};

View File

@ -0,0 +1,4 @@
export const ENABLE_AI = {
name: "随机选将可用",
init: false
};

View File

@ -0,0 +1,37 @@
export const ENABLE = {
name: "开启",
init: false,
restart: true,
onswitch(bool) {
if (bool) {
var storage = { boss: {}, versus: {}, translate: {} };
var loadversus = function () {
game.loadModeAsync("versus", function (mode) {
for (var i in mode.translate) {
storage.translate[i] = mode.translate[i];
}
for (var i in mode.jiangeboss) {
if (mode.jiangeboss[i][4].contains("bossallowed")) {
storage.versus[i] = mode.jiangeboss[i];
}
}
localStorage.setItem("boss_storage_playpackconfig", JSON.stringify(storage));
});
};
game.loadModeAsync("boss", function (mode) {
for (var i in mode.translate) {
storage.translate[i] = mode.translate[i];
}
for (var i in mode.characterPack.mode_boss) {
if (mode.characterPack.mode_boss[i][4].contains("bossallowed")) {
storage.boss[i] = mode.characterPack.mode_boss[i];
}
}
loadversus();
});
}
else {
localStorage.removeItem("boss_storage_playpackconfig");
}
}
};

View File

@ -0,0 +1,19 @@
export const HIDE = {
name: "隐藏此扩展",
clear: true,
onclick() {
if (this.firstChild.innerHTML == "隐藏此扩展") {
this.firstChild.innerHTML = "此扩展将在重启后隐藏";
lib.config.hiddenPlayPack.add("boss");
if (!lib.config.prompt_hidepack) {
alert("隐藏的扩展包可通过选项-其它-重置隐藏内容恢复");
game.saveConfig("prompt_hidepack", true);
}
}
else {
this.firstChild.innerHTML = "隐藏此扩展";
lib.config.hiddenPlayPack.remove("boss");
}
game.saveConfig("hiddenPlayPack", lib.config.hiddenPlayPack);
}
};

View File

@ -0,0 +1,5 @@
export const INTRODUCTION = {
name: "将剑阁和挑战模式的武将添加到其它模式",
clear: true,
nopointer: true
};

View File

@ -0,0 +1,33 @@
import { ENABLE } from "./card-pile/enable.js";
import { GUOHE } from "./card-pile/guohe.js";
import { HIDE } from "./card-pile/hide.js";
import { INTRODUCTION } from "./card-pile/introduction.js";
import { JIU } from "./card-pile/jiu.js";
import { NANMAN } from "./card-pile/nanman.js";
import { SHA_FIRE } from "./card-pile/sha-fire.js";
import { SHA_THUNDER } from "./card-pile/sha-thunder.js";
import { SHA } from "./card-pile/sha.js";
import { SHAN } from "./card-pile/shan.js";
import { SHUNSHOU } from "./card-pile/shunshou.js";
import { TAO } from "./card-pile/tao.js";
import { TIESUO } from "./card-pile/tiesuo.js";
import { WANJIAN } from "./card-pile/wanjian.js";
import { WUXIE } from "./card-pile/wuxie.js";
export const CARD_PILE = {
enable: ENABLE,
intro: INTRODUCTION,
sha: SHA,
huosha: SHA_FIRE,
leisha: SHA_THUNDER,
shan: SHAN,
tao: TAO,
jiu: JIU,
wuxie: WUXIE,
nanman: NANMAN,
wanjian: WANJIAN,
guohe: GUOHE,
shunshou: SHUNSHOU,
tiesuo: TIESUO,
hide: HIDE
};

View File

@ -0,0 +1,5 @@
export const CARD_PILE_ITEM = {
"1": "补充全部",
"0.5": "补充一半",
"0": "不补充"
};

View File

@ -0,0 +1,5 @@
export const ENABLE = {
name: "开启",
init: false,
restart: true
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const GUOHE = {
name: "过河拆桥",
init: "0",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,19 @@
export const HIDE = {
name: "隐藏此扩展",
clear: true,
onclick() {
if (this.firstChild.innerHTML == "隐藏此扩展") {
this.firstChild.innerHTML = "此扩展将在重启后隐藏";
lib.config.hiddenPlayPack.add("boss");
if (!lib.config.prompt_hidepack) {
alert("隐藏的扩展包可通过选项-其它-重置隐藏内容恢复");
game.saveConfig("prompt_hidepack", true);
}
}
else {
this.firstChild.innerHTML = "隐藏此扩展";
lib.config.hiddenPlayPack.remove("boss");
}
game.saveConfig("hiddenPlayPack", lib.config.hiddenPlayPack);
}
};

View File

@ -0,0 +1,5 @@
export const INTRODUCTION = {
name: "将杀闪等牌在牌堆中的比例维持在与军争牌堆相同,防止开启扩展包后被过多地稀释",
clear: true,
nopointer: true
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const JIU = {
name: "酒",
init: "0",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const NANMAN = {
name: "南蛮入侵",
init: "0",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const SHA_FIRE = {
name: "火杀",
init: "1",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const SHA_THUNDER = {
name: "雷杀",
init: "1",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const SHA = {
name: "杀",
init: "1",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const SHAN = {
name: "闪",
init: "1",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const SHUNSHOU = {
name: "顺手牵羊",
init: "0",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const TAO = {
name: "桃",
init: "0",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const TIESUO = {
name: "铁索连环",
init: "0",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const WANJIAN = {
name: "万箭齐发",
init: "0",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,7 @@
import { CARD_PILE_ITEM } from "./card-pile-item.js";
export const WUXIE = {
name: "无懈可击",
init: "0.5",
item: CARD_PILE_ITEM
};

View File

@ -0,0 +1,13 @@
import { CANVAS } from "./coin/canvas.js";
import { DISPLAY } from "./coin/display.js";
import { ENABLE } from "./coin/enable.js";
import { HIDE } from "./coin/hide.js";
import { INTRODUCTION } from "./coin/introduction.js";
export const COIN = {
enable: ENABLE,
intro: INTRODUCTION,
display: DISPLAY,
canvas: CANVAS,
hide: HIDE
};

View File

@ -0,0 +1,13 @@
export const CANVAS = {
name: "特效置顶",
init: false,
onclick(bool) {
game.saveConfig("coin_canvas_playpackconfig", bool);
if (bool) {
ui.window.classList.add("canvas_top");
}
else {
ui.window.classList.remove("canvas_top");
}
}
};

View File

@ -0,0 +1,11 @@
import { ITEM } from "./display/item.js";
export const DISPLAY = {
name: "金币显示",
init: "text",
item: ITEM,
onclick(item) {
game.saveConfig("coin_display_playpackconfig", item);
if (game.changeCoin) game.changeCoin(0);
}
};

View File

@ -0,0 +1,4 @@
export const ITEM = {
symbol: "符号",
text: "文字"
};

View File

@ -0,0 +1,14 @@
export const ENABLE = {
name: '开启',
init: false,
restart: true,
onclick(bool) {
if (bool) {
lib.config.plays.add('coin');
}
else {
lib.config.plays.remove('coin');
}
game.saveConfig('plays', lib.config.plays);
}
};

View File

@ -0,0 +1,19 @@
export const HIDE = {
name: "隐藏此扩展",
clear: true,
onclick() {
if (this.firstChild.innerHTML == "隐藏此扩展") {
this.firstChild.innerHTML = "此扩展将在重启后隐藏";
lib.config.hiddenPlayPack.add("coin");
if (!lib.config.prompt_hidepack) {
alert("隐藏的扩展包可通过选项-其它-重置隐藏内容恢复");
game.saveConfig("prompt_hidepack", true);
}
}
else {
this.firstChild.innerHTML = "隐藏此扩展";
lib.config.hiddenPlayPack.remove("coin");
}
game.saveConfig("hiddenPlayPack", lib.config.hiddenPlayPack);
}
};

View File

@ -0,0 +1,5 @@
export const INTRODUCTION = {
name: "每完成一次对局,可获得一定数量的金币;金币可用于购买游戏特效",
clear: true,
nopointer: true
};

View File

@ -0,0 +1,11 @@
import { ENABLE } from "./wuxing/enable.js";
import { HIDE } from "./wuxing/hide.js";
import { INTRODUCTION } from "./wuxing/introduction.js";
import { NUMBER } from "./wuxing/number.js";
export const WUXING = {
enable: ENABLE,
intro: INTRODUCTION,
num: NUMBER,
hide: HIDE
};

View File

@ -0,0 +1,5 @@
export const ENABLE = {
name: "开启",
init: false,
restart: true
};

View File

@ -0,0 +1,19 @@
export const HIDE = {
name: "隐藏此扩展",
clear: true,
onclick() {
if (this.firstChild.innerHTML == "隐藏此扩展") {
this.firstChild.innerHTML = "此扩展将在重启后隐藏";
lib.config.hiddenPlayPack.add("wuxing");
if (!lib.config.prompt_hidepack) {
alert("隐藏的扩展包可通过选项-其它-重置隐藏内容恢复");
game.saveConfig("prompt_hidepack", true);
}
}
else {
this.firstChild.innerHTML = "隐藏此扩展";
lib.config.hiddenPlayPack.remove("wuxing");
}
game.saveConfig("hiddenPlayPack", lib.config.hiddenPlayPack);
}
};

View File

@ -0,0 +1,5 @@
export const INTRODUCTION = {
name: "每名角色和部分卡牌在游戏开始时随机获得一个属性",
clear: true,
nopointer: true
};

View File

@ -0,0 +1,7 @@
import { ITEM } from "./number/item.js";
export const NUMBER = {
name: "带属性卡牌",
init: "0.3",
item: ITEM
};

View File

@ -0,0 +1,6 @@
export const ITEM = {
"0.1": "10%",
"0.2": "20%",
"0.3": "30%",
"0.5": "50%"
};