This commit is contained in:
Liwanyi 2023-06-16 10:43:40 +08:00
parent 207bea46ca
commit 0a255f0e51
5 changed files with 53 additions and 125 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "wuhu-torn-helper", "name": "wuhu-torn-helper",
"version": "1.0.2", "version": "1.0.3",
"description": "芜湖助手", "description": "芜湖助手",
"scripts": { "scripts": {
"release": "cross-env NODE_ENV=production rollup -c && node build.mjs", "release": "cross-env NODE_ENV=production rollup -c && node build.mjs",

File diff suppressed because one or more lines are too long

View File

@ -61,7 +61,7 @@ export default class QuickFlyBtnHandler {
} }
// 起飞目的地id // 起飞目的地id
private static getDestId(dest): number { private static getDestId(dest: number): number {
// 墨、开、加、夏、英、阿、瑞s、立本、祖、迪、南 // 墨、开、加、夏、英、阿、瑞s、立本、祖、迪、南
return [2, 12, 9, 3, 10, 7, 8, 5, 6, 11, 4][dest]; return [2, 12, 9, 3, 10, 7, 8, 5, 6, 11, 4][dest];
} }
@ -121,7 +121,7 @@ export default class QuickFlyBtnHandler {
yaoCD.innerHTML = `药CD剩余${ CommonUtils.getYaoCD() }`; yaoCD.innerHTML = `药CD剩余${ CommonUtils.getYaoCD() }`;
} }
public async directFly(destIndex, typeIndex) { public async directFly(destIndex: number, typeIndex: number) {
// 获取key // 获取key
let key; let key;
try { try {

View File

@ -99,7 +99,7 @@ onMounted(() => {
<el-form-item :label="'现金 $' + toThousands(formModel.cash)"> <el-form-item :label="'现金 $' + toThousands(formModel.cash)">
<el-input <el-input
v-model="inputWithdrawMoney" v-model="inputWithdrawMoney"
:formatter="toThousands" :formatter="toThousands" clearable
:parser="(value) => value.replaceAll(',', '')" :parser="(value) => value.replaceAll(',', '')"
> >
<template #prepend> <template #prepend>
@ -113,7 +113,7 @@ onMounted(() => {
<el-form-item :label="'公司可用余额 $' + toThousands(formModel.company)"> <el-form-item :label="'公司可用余额 $' + toThousands(formModel.company)">
<el-input <el-input
v-model="inputMoney" v-model="inputMoney"
:formatter="toThousands" :formatter="toThousands" clearable
:parser="(value) => value.replaceAll(',', '')" :parser="(value) => value.replaceAll(',', '')"
> >
<template #prepend> <template #prepend>
@ -127,4 +127,8 @@ onMounted(() => {
</el-form> </el-form>
</template> </template>
<style scoped></style> <style scoped>
.el-input {
max-width: 400px;
}
</style>

View File

@ -1,92 +1,20 @@
<template> <template>
<el-config-provider :size="'default'" :z-index="1000000"> <el-config-provider :size="'default'" :z-index="1000000">
<!-- <el-dropdown--> <el-button circle class="wh-menu-button" style="z-index: 1000000;" @click="expanded = !expanded">
<!-- :hide-on-click="false"-->
<!-- :max-height="(documentHeight * 0.8 | 0) + 'px'" size="small" style="z-index: 1000000;user-select: none"-->
<!-- trigger="click"-->
<!-- >-->
<el-button circle class="wh-menu-button" @click="expanded=!expanded">
<el-icon> <el-icon>
<MoonNight/> <MoonNight/>
</el-icon> </el-icon>
</el-button> </el-button>
<!-- <template #dropdown>-->
<!-- <el-dropdown-menu>-->
<!-- <el-dropdown-item>芜湖助手</el-dropdown-item>-->
<!-- <el-dropdown-item divided>-->
<!-- <el-dropdown placement="bottom-end" size="small" style="width: 100%" trigger="click">-->
<!-- <el-button link size="small" style="width: 100%;text-align: left;">💪 快速锻炼 ></el-button>-->
<!-- <template #dropdown>-->
<!-- <el-dropdown-item @click="quickGymTrain.doTrain(BATTLE_STAT.STR)">力量-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item @click="quickGymTrain.doTrain(BATTLE_STAT.DEF)">防御-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item @click="quickGymTrain.doTrain(BATTLE_STAT.SPD)">速度-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item @click="quickGymTrain.doTrain(BATTLE_STAT.DEX)">闪避-->
<!-- </el-dropdown-item>-->
<!-- </template>-->
<!-- </el-dropdown>-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item>-->
<!-- <el-dropdown placement="bottom-end" size="small" style="width: 100%" trigger="click">-->
<!-- <el-button link size="small" style="width: 100%;text-align: left;"> 一键起飞 ></el-button>-->
<!-- <template #dropdown>-->
<!-- <template v-for="travel in travelData">-->
<!-- <el-dropdown-item>-->
<!-- <el-dropdown placement="bottom-end" size="small" style="width: 100%"-->
<!-- trigger="click">-->
<!-- <div style="width: 100%">{{ travel.cName }} ></div>-->
<!-- <template #dropdown>-->
<!-- <el-dropdown-item @click="travelConfirm(travel.index, 0)">-->
<!-- 普通飞机-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item @click="travelConfirm(travel.index, 1)">-->
<!-- PI飞机-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item @click="travelConfirm(travel.index, 2)">-->
<!-- 股票飞机-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item @click="travelConfirm(travel.index, 3)">-->
<!-- 商务飞机(机票或内衣店)-->
<!-- </el-dropdown-item>-->
<!-- </template>-->
<!-- </el-dropdown>-->
<!-- </el-dropdown-item>-->
<!-- </template>-->
<!-- </template>-->
<!-- </el-dropdown>-->
<!-- </el-dropdown-item>-->
<!-- <template v-for="(item, i) in menuItemList">-->
<!-- <el-dropdown-item v-if="i === 0" divided @click="menuClick(item)">-->
<!-- {{ item.title }}-->
<!-- </el-dropdown-item>-->
<!-- <el-dropdown-item v-else @click="menuClick(item)">-->
<!-- {{ item.title }}-->
<!-- </el-dropdown-item>-->
<!-- </template>-->
<!-- <el-dropdown-item @click="bazaarControl.method()">🫵 关闭店铺(双击开启)-->
<!-- </el-dropdown-item>-->
<!-- </el-dropdown-menu>-->
<!-- </template>-->
<!-- </el-dropdown>-->
<el-dialog v-model="drawer" :destroy-on-close="true" :fullscreen="isMobilePhone" :lock-scroll="true" <el-dialog v-model="drawer" :destroy-on-close="true" :fullscreen="isMobilePhone" :lock-scroll="true"
:title="drawerTitle" width="65%"> :title="drawerTitle" width="65%">
<component :is="drawerContent"/> <component :is="drawerContent"/>
</el-dialog> </el-dialog>
<el-drawer <el-drawer v-model="expanded" :size="isMobilePhone ? '85%' : '30%'" direction="rtl">
v-model="expanded"
:size="isMobilePhone?'85%':'30%'"
direction="rtl"
>
<template #header> <template #header>
<p>便捷菜单</p> <p>便捷菜单</p>
<el-button link>芜湖助手 v{{ globVars.version.startsWith('$') ? '-1' : globVars.version }}</el-button> <el-button link>芜湖助手 {{ globVars.version.startsWith('$') ? 'dev' : 'v' + globVars.version }}</el-button>
</template> </template>
<el-menu <el-menu :unique-opened="true" class="el-menu-vertical-demo">
:unique-opened="true"
class="el-menu-vertical-demo"
>
<el-sub-menu index="1"> <el-sub-menu index="1">
<template #title> <template #title>
<el-icon></el-icon> <el-icon></el-icon>
@ -135,7 +63,7 @@
import { MoonNight } from "@element-plus/icons-vue"; import { MoonNight } from "@element-plus/icons-vue";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { inject, onMounted, ref, shallowRef } from 'vue'; import { Component, inject, onMounted, ref, shallowRef } from 'vue';
import { LoggerKey } from "../ts/class/Logger"; import { LoggerKey } from "../ts/class/Logger";
import { QuickGymTrainKey } from "../ts/class/action/QuickGymTrain"; import { QuickGymTrainKey } from "../ts/class/action/QuickGymTrain";
import { QuickFlyBtnHandlerKey } from "../ts/class/handler/QuickFlyBtnHandler"; import { QuickFlyBtnHandlerKey } from "../ts/class/handler/QuickFlyBtnHandler";
@ -186,18 +114,19 @@ const useItem = (itemId: string) => {
})); }));
}; };
const menuItemList = [ type MenuItem = { title: string, template?: Component, handler?: Function };
const menuItemList: MenuItem[] = [
{ {
title: '💊 吃 XAN', title: '💊 吃 XAN',
template: () => useItem('206'), handler: () => useItem('206'),
}, },
{ {
title: '🍺 喝啤酒', title: '🍺 喝啤酒',
template: () => useItem('180'), handler: () => useItem('180'),
}, },
{ {
title: '♻️ REFILL', title: '♻️ REFILL',
template: () => fetch(window.addRFC("https://www.torn.com/points.php?step=pointsbuy&action=energyrefill2"), { handler: () => fetch(window.addRFC("https://www.torn.com/points.php?step=pointsbuy&action=energyrefill2"), {
"headers": { "headers": {
"accept": "text/plain, */*; q=0.01", "accept": "text/plain, */*; q=0.01",
"sec-ch-ua-mobile": "?0", "sec-ch-ua-mobile": "?0",
@ -215,14 +144,11 @@ const menuItemList = [
}) })
.then(res => res.json()) .then(res => res.json())
.then(res => ElMessage({ .then(res => ElMessage({
message: `<p>${ res.msg }</p><p>剩余refill: ${ res.refills }</p>`, message: `<p>${ res.msg }</p><p>剩余refill: ${ res["refills"] }</p>`,
type: res.state === 'done' ? 'success' : 'error', type: res.state === 'done' ? 'success' : 'error',
dangerouslyUseHTMLString: true dangerouslyUseHTMLString: true
})) }))
.catch(e => ElMessage({ .catch(e => ElMessage.error(e.toString)),
message: e.toString,
type: 'error'
})),
}, },
{ {
title: '🚓 快速犯罪', title: '🚓 快速犯罪',
@ -262,16 +188,12 @@ const menuItemList = [
}, },
{ {
title: '🫵 关闭店铺(双击开启)', title: '🫵 关闭店铺(双击开启)',
template: () => bazaarControl.method(), handler: () => bazaarControl.method(),
}, },
{ {
title: '⚙️ 插件配置', title: '⚙️ 插件配置',
template: Config, template: Config,
}, },
// {
// title: 'test',
// template: () => expanded.value = !expanded.value,
// },
]; ];
const drawer = ref(false); const drawer = ref(false);
const drawerTitle = ref(''); const drawerTitle = ref('');
@ -282,32 +204,34 @@ const expanded = ref(false);
// fast travel // fast travel
const travelData = [ const travelData = [
{ cName: "墨西哥", index: "0" }, { cName: "墨西哥", index: 0 },
{ cName: "开曼", index: "1" }, { cName: "开曼", index: 1 },
{ cName: "加拿大", index: "2" }, { cName: "加拿大", index: 2 },
{ cName: "夏威夷", index: "3" }, { cName: "夏威夷", index: 3 },
{ cName: "嘤国", index: "4" }, { cName: "嘤国", index: 4 },
{ cName: "阿根廷", index: "5" }, { cName: "阿根廷", index: 5 },
{ cName: "瑞士 (解毒)", index: "6" }, { cName: "瑞士 (解毒)", index: 6 },
{ cName: "立本", index: "7" }, { cName: "立本", index: 7 },
{ cName: "祖国", index: "8" }, { cName: "祖国", index: 8 },
{ cName: "阿联酋 (UAE)", index: "9" }, { cName: "阿联酋 (UAE)", index: 9 },
{ cName: "南非", index: "10" }, { cName: "南非", index: 10 },
]; ];
const menuClick = (menuItem) => { const menuClick = (menuItem: MenuItem) => {
if (typeof menuItem.template === 'function') { if (menuItem.handler) {
menuItem.template(); menuItem.handler();
} else { } else if (menuItem.template) {
drawer.value = true; drawer.value = true;
drawerTitle.value = menuItem.title; drawerTitle.value = menuItem.title;
drawerContent.value = menuItem.template; drawerContent.value = menuItem.template;
} }
}; };
const travelConfirm = (destIndex, typeIndex) => { const travelConfirm = (destIndex: number, typeIndex: number) => {
const destName = travelData[destIndex].cName;
const typeName = ['普通飞机', 'PI飞机', '股票飞机', '商务飞机(机票或内衣店)'][typeIndex];
ElMessageBox.confirm( ElMessageBox.confirm(
'即将使用[' + ['普通飞机', 'PI飞机', '股票飞机', '商务飞机(机票或内衣店)'][typeIndex] + ']飞往[' + travelData[destIndex].cName + ']', '即将使用「' + typeName + '」飞往「' + destName + '」',
'确认', '确认',
{ {
confirmButtonText: '好', confirmButtonText: '好',
@ -329,9 +253,9 @@ const travelConfirm = (destIndex, typeIndex) => {
}; };
const bazaarControl = { const bazaarControl = {
wait: (t) => new Promise(resolve => window.setTimeout(() => resolve(null), t)), wait: (t: number) => new Promise(resolve => window.setTimeout(() => resolve(null), t)),
count: 0, count: 0,
doGet: async (isClose) => { doGet: async (isClose: boolean) => {
let response; let response;
try { try {
response = await (await fetch( response = await (await fetch(