### 修改
- 快捷功能的【喝啤酒】移动至【快速犯罪】中 - profile页面中在线状态调整
This commit is contained in:
parent
234022c80c
commit
5d42062001
@ -1,5 +1,14 @@
|
|||||||
# CHANGE
|
# CHANGE
|
||||||
|
|
||||||
|
## 1.1.8
|
||||||
|
|
||||||
|
2024年03月20日
|
||||||
|
|
||||||
|
### 修改
|
||||||
|
|
||||||
|
- 快捷功能的【喝啤酒】移动至【快速犯罪】中
|
||||||
|
- profile页面中在线状态调整
|
||||||
|
|
||||||
## 1.1.7
|
## 1.1.7
|
||||||
|
|
||||||
2024年03月15日
|
2024年03月15日
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wuhu-torn-helper",
|
"name": "wuhu-torn-helper",
|
||||||
"version": "1.1.7",
|
"version": "1.1.8",
|
||||||
"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
@ -88,15 +88,15 @@ export default class ProfileHelper implements ResponseInject, IFeature {
|
|||||||
for (let i = 0; i < resp.basicInformation.icons.length; i++) {
|
for (let i = 0; i < resp.basicInformation.icons.length; i++) {
|
||||||
let item = resp.basicInformation.icons[i]
|
let item = resp.basicInformation.icons[i]
|
||||||
if (item.id === 1) {
|
if (item.id === 1) {
|
||||||
onlineStatusTitle = '<li class="user-status-16-Online left"></li> 在线'
|
onlineStatusTitle = '🟢️ 在线'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (item.id === 62) {
|
if (item.id === 62) {
|
||||||
onlineStatusTitle = '<li class="user-status-16-Away left"></li> 挂机'
|
onlineStatusTitle = '🟡 挂机'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (item.id === 2) {
|
if (item.id === 2) {
|
||||||
onlineStatusTitle = '<li class="user-status-16-Offline left"></li> 离线'
|
onlineStatusTitle = '⚪ 离线'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,17 @@
|
|||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus"
|
||||||
|
|
||||||
const useItem = (itemId: string) => {
|
type CrimeResVo = { text: string, success: boolean }
|
||||||
|
|
||||||
|
const defaultCb = (res: CrimeResVo) => {
|
||||||
|
ElMessage({
|
||||||
|
message: res.text,
|
||||||
|
type: res.success ? 'success' : 'error',
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
grouping: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const useItem = (itemId: string, cb = defaultCb) => {
|
||||||
fetch(window.addRFC("https://www.torn.com/item.php"), {
|
fetch(window.addRFC("https://www.torn.com/item.php"), {
|
||||||
"headers": {
|
"headers": {
|
||||||
"accept": "*/*",
|
"accept": "*/*",
|
||||||
@ -19,15 +30,22 @@ const useItem = (itemId: string) => {
|
|||||||
"credentials": "include"
|
"credentials": "include"
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(res => ElMessage({
|
.then(res => cb(res))
|
||||||
message: res.text,
|
|
||||||
type: res.success ? 'success' : 'error',
|
|
||||||
dangerouslyUseHTMLString: true
|
|
||||||
}))
|
|
||||||
.catch(e => ElMessage({
|
.catch(e => ElMessage({
|
||||||
message: e.toString,
|
message: e.toString,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
}));
|
}));
|
||||||
};
|
}
|
||||||
|
|
||||||
export default useItem;
|
const useItemSync = (itemId: string, showMsg = true, cb = (response: CrimeResVo) => null) => {
|
||||||
|
return new Promise((res, rej) => {
|
||||||
|
useItem(itemId, (_res) => {
|
||||||
|
if (showMsg) defaultCb(_res)
|
||||||
|
cb(_res)
|
||||||
|
res(null)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default useItem
|
||||||
|
export { useItemSync }
|
||||||
|
|||||||
@ -175,42 +175,6 @@ const menuItemList: MenuItem[] = [
|
|||||||
ElMessage({ message: '毒 CD: ' + cd + 'h', showClose: true })
|
ElMessage({ message: '毒 CD: ' + cd + 'h', showClose: true })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '🍺 喝啤酒',
|
|
||||||
handler: () => {
|
|
||||||
useItem('180')
|
|
||||||
const sidebarData = getSidebarData()
|
|
||||||
const nerve = sidebarData.bars.nerve.amount
|
|
||||||
const cd = (sidebarData.statusIcons.icons.booster_cooldown?.timerExpiresAt - sidebarData.statusIcons.icons.booster_cooldown?.serverTimestamp) / 3600 | 0
|
|
||||||
ElMessage({ message: 'N: ' + nerve + ', CD: ' + cd + 'h', showClose: true })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '♻️ REFILL',
|
|
||||||
// handler: () => fetch(window.addRFC("https://www.torn.com/points.php?step=pointsbuy&action=energyrefill2"), {
|
|
||||||
// "headers": {
|
|
||||||
// "accept": "text/plain, */*; q=0.01",
|
|
||||||
// "sec-ch-ua-mobile": "?0",
|
|
||||||
// "sec-fetch-dest": "empty",
|
|
||||||
// "sec-fetch-mode": "cors",
|
|
||||||
// "sec-fetch-site": "same-origin",
|
|
||||||
// "x-requested-with": "XMLHttpRequest"
|
|
||||||
// },
|
|
||||||
// "referrer": "https://www.torn.com/points.php",
|
|
||||||
// "referrerPolicy": "strict-origin-when-cross-origin",
|
|
||||||
// "body": null,
|
|
||||||
// "method": "GET",
|
|
||||||
// "mode": "cors",
|
|
||||||
// "credentials": "include"
|
|
||||||
// })
|
|
||||||
// .then(res => res.json())
|
|
||||||
// .then(res => ElMessage({
|
|
||||||
// message: `<p>${ res.msg }</p><p>剩余refill: ${ res["refills"] }</p>`,
|
|
||||||
// type: res.state === 'done' ? 'success' : 'error',
|
|
||||||
// dangerouslyUseHTMLString: true
|
|
||||||
// }))
|
|
||||||
// .catch(e => ElMessage.error(e.toString)),
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
title: '🚓 快速犯罪',
|
title: '🚓 快速犯罪',
|
||||||
template: QuickCrime,
|
template: QuickCrime,
|
||||||
|
|||||||
@ -1,18 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-space direction="vertical">
|
|
||||||
<el-row>
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button @click="doCrime(11, 'warehouse')">烧仓库</el-button>
|
<el-button @click="doCrime(11, 'warehouse')">烧仓库</el-button>
|
||||||
<el-button @click="doCrime(15, 'napcop')">做15-3</el-button>
|
<el-button @click="doCrime(15, 'napcop')">做15-3</el-button>
|
||||||
<el-button @click="doCrime(18, 'hackbank')">做18-1</el-button>
|
<el-button @click="doCrime(18, 'hackbank')">做18-1</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-button type="primary" @click="doYouLikeABeer()">🍺 你喜欢啤酒吗</el-button>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-cascader :options="CrimeData" :show-all-levels="false" clearable v-model="crimeSelected" placeholder="选择其他" />
|
<el-cascader v-model="crimeSelected" :options="CrimeData" :show-all-levels="false" clearable
|
||||||
<el-button :disabled="!(crimeSelected && crimeSelected.length)" @click="doCrime(crimeSelected[0], crimeSelected[1])"
|
placeholder="选择其他"/>
|
||||||
type="danger" round :icon="Coffee">做</el-button>
|
<el-button :disabled="!(crimeSelected && crimeSelected.length)"
|
||||||
|
:icon="Coffee"
|
||||||
|
round type="danger" @click="doCrime(crimeSelected[0], crimeSelected[1])">做
|
||||||
|
</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-space>
|
<div>
|
||||||
|
<el-tag type="primary">NERVE {{ nerve }}</el-tag>
|
||||||
|
<el-tag type="danger">CD {{ boostCoolDown }}</el-tag>
|
||||||
|
</div>
|
||||||
|
<div v-if="responseHtmlString" v-html="responseHtmlString"></div>
|
||||||
<div v-if="results" v-html="results"></div>
|
<div v-if="results" v-html="results"></div>
|
||||||
<el-skeleton v-if="loading" :rows="3" animated/>
|
<el-skeleton v-if="loading" :rows="3" animated/>
|
||||||
</template>
|
</template>
|
||||||
@ -20,14 +31,19 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { Coffee } from "@element-plus/icons-vue";
|
import { Coffee } from "@element-plus/icons-vue";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { inject, ref } from 'vue';
|
import { inject, onMounted, ref } from 'vue';
|
||||||
import { LoggerKey } from "../ts/class/Logger";
|
import { LoggerKey } from "../ts/class/Logger";
|
||||||
import { CrimeData } from "./data/CrimeData";
|
import { CrimeData } from "./data/CrimeData";
|
||||||
|
import useItem, { useItemSync } from "../ts/func/utils/useItem";
|
||||||
|
import getSidebarData from "../ts/func/utils/getSidebarData";
|
||||||
|
|
||||||
const logger = inject(LoggerKey);
|
const logger = inject(LoggerKey)
|
||||||
const results = ref("");
|
const results = ref("")
|
||||||
const loading = ref(false);
|
const loading = ref(false)
|
||||||
const crimeSelected = ref(null)
|
const crimeSelected = ref(null)
|
||||||
|
const responseHtmlString = ref('')
|
||||||
|
const boostCoolDown = ref(0)
|
||||||
|
const nerve = ref(0)
|
||||||
|
|
||||||
const doCrime = async (nerve, crime: "hackbank" | "warehouse" | 'napcop') => {
|
const doCrime = async (nerve, crime: "hackbank" | "warehouse" | 'napcop') => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
@ -65,7 +81,27 @@ const doCrime = async (nerve, crime: "hackbank" | "warehouse" | 'napcop') => {
|
|||||||
logger.error(err);
|
logger.error(err);
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
updateData()
|
||||||
|
}
|
||||||
|
|
||||||
|
const doYouLikeABeer = async () => {
|
||||||
|
await useItemSync('180', false, (res) => {
|
||||||
|
responseHtmlString.value = res.text
|
||||||
|
updateData()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateData = () => {
|
||||||
|
const sidebarData = getSidebarData()
|
||||||
|
nerve.value = sidebarData.bars.nerve.amount
|
||||||
|
boostCoolDown.value = (sidebarData.statusIcons.icons.booster_cooldown?.timerExpiresAt - sidebarData.statusIcons.icons.booster_cooldown?.serverTimestamp) / 3600 | 0
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
updateData()
|
||||||
|
window.setInterval(() => updateData(), 60000)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
Loading…
x
Reference in New Issue
Block a user