This commit is contained in:
Liwanyi 2023-06-27 16:57:16 +08:00
parent e7effb0881
commit 9c1db27ebe
5 changed files with 92 additions and 66 deletions

View File

@ -5,6 +5,15 @@
# CHANGE
## 1.0.7
2023年06月27日
### 修改
- 物品功能补充完善
- 菜单顺序调整
## 1.0.6
2023年06月26日

View File

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

File diff suppressed because one or more lines are too long

View File

@ -15,8 +15,7 @@
</el-badge>
</el-button>
</el-button-group>
<el-dialog v-model="drawer" :fullscreen="isMobilePhone" :lock-scroll="true"
width="65%">
<el-dialog v-model="drawer" :fullscreen="isMobilePhone" :lock-scroll="true" width="65%">
<el-tabs v-model="editableTabsValue" closable style="margin-top: -1em" type="border-card" @tab-remove="removeTab">
<el-tab-pane v-for="item in editableTabs" :key="item.name" :label="item.title" :name="item.name">
<component :is="item.content"/>
@ -122,12 +121,12 @@ import CityUItems from "./CityUItems.vue";
import CompanyWithdraw from "./CompanyWithdraw.vue";
import EventsViewer from "./EventsViewer.vue";
import ForeignStock from "./ForeignStock.vue";
import InventoryView from "./InventoryView.vue";
import MarketHelper from "./MarketHelper.vue";
import PTMarketView from "./PTMarketView.vue";
import QuickCrime from "./QuickCrime.vue";
import UpdateDate from "./UpdateScript.vue";
import VirusProgramming from "./VirusProgramming.vue";
import InventoryView from "./InventoryView.vue";
const logger = inject(LoggerKey);
const quickGymTrain = inject(QuickGymTrainKey);
@ -173,10 +172,6 @@ const menuItemList: MenuItem[] = [
title: '🚓 快速犯罪',
template: QuickCrime,
},
{
title: '🌸 飞花库存',
template: ForeignStock,
},
{
title: '📢 浏览通知',
template: EventsViewer,
@ -185,14 +180,6 @@ const menuItemList: MenuItem[] = [
title: '🚮 地图垃圾',
template: CityUItems,
},
{
title: '🩼 配置自动登陆',
template: AutoLoginForm,
},
{
title: '💻 PC',
template: VirusProgramming,
},
{
title: '🛒 购物助手',
template: MarketHelper,
@ -205,13 +192,25 @@ const menuItemList: MenuItem[] = [
title: '💰 公司存钱',
template: CompanyWithdraw,
},
{
title: '📦 物品',
template: InventoryView,
},
{
title: '🫵 关闭店铺(双击开启)',
handler: () => bazaarControl.method(),
},
{
title: '📦 物品',
template: InventoryView,
title: '🌸 飞花库存',
template: ForeignStock,
},
{
title: '💻 PC',
template: VirusProgramming,
},
{
title: '🩼 配置自动登陆',
template: AutoLoginForm,
},
{
title: '🚀 更新历史',

View File

@ -2,7 +2,7 @@
import { Check, Delete, Promotion } from "@element-plus/icons-vue"
import { ElMessage } from "element-plus"
import { inject, onMounted, ref } from "vue"
import { inject, onMounted, ref, watch } from "vue"
import { LoggerKey } from "../ts/class/Logger"
import { itemNameDict } from "../ts/dictionary/translation"
import Sleep from "../ts/func/utils/Sleep"
@ -23,7 +23,9 @@ type Item = {
damage: number
accuracy: number
defence: number
type: number
//
type?: number
bonus: string
}
type ItemDetails = {
@ -39,6 +41,7 @@ type ItemDetails = {
itemInfoContent: string
itemCirculation: string
armoryID: boolean
// TODO
itemRareIcon: string
}
@ -141,41 +144,42 @@ const parseListHtml = (html: string) => {
const ret: Item[] = []
let tmp = document.createElement('div')
tmp.innerHTML = html
tmp.childNodes.forEach(li => {
if (li.nodeType === 1) {
const item: Item = {
type: 0,
defence: 0,
accuracy: 0, damage: 0,
armoryId: 0,
details: undefined,
isDetailsLoading: false,
amount: -1, isEquipped: false, id: -1, name: "", nameZh: ""
}
let elem = li as HTMLElement
//
let name: HTMLElement = elem.querySelector('.name-wrap .name')
item.name = name.innerText.trim()
item.nameZh = itemNameDict[item.name]
//
item.amount = Number(elem.getAttribute('data-qty'))
// id
item.id = Number(elem.getAttribute('data-item'))
//
item.isEquipped = elem.getAttribute('data-equipped').trim() === 'true'
// id
item.armoryId = Number(elem.getAttribute('data-armoryid'))
//
item.damage = Number(elem.querySelector('.bonus-attachment-item-damage-bonus')?.nextElementSibling.innerText?.trim())
//
item.accuracy = Number(elem.querySelector('.bonus-attachment-item-accuracy-bonus')?.nextElementSibling.innerText?.trim())
//
item.defence = Number(elem.querySelector('.bonus-attachment-item-defence-bonus')?.nextElementSibling.innerText?.trim())
//
item.type = Number(elem.querySelector('ul.actions-wrap li[data-type]')?.getAttribute('data-type').trim())
ret.push(item)
tmp.querySelectorAll(':scope > li').forEach(li => {
const item: Item = {
type: 0,
defence: 0,
accuracy: 0, damage: 0,
armoryId: 0,
details: undefined,
isDetailsLoading: false,
amount: -1, isEquipped: false, id: -1, name: "", nameZh: "",
bonus: ""
}
let elem = li as HTMLElement
//
let name: HTMLElement = elem.querySelector('.name-wrap .name')
item.name = name.innerText.trim()
item.nameZh = itemNameDict[item.name]
//
item.amount = Number(elem.getAttribute('data-qty'))
// id
item.id = Number(elem.getAttribute('data-item'))
//
item.isEquipped = elem.getAttribute('data-equipped').trim() === 'true'
// id
item.armoryId = Number(elem.getAttribute('data-armoryid'))
//
item.damage = Number(elem.querySelector('.bonus-attachment-item-damage-bonus')?.nextElementSibling.innerText?.trim())
//
item.accuracy = Number(elem.querySelector('.bonus-attachment-item-accuracy-bonus')?.nextElementSibling.innerText?.trim())
//
item.defence = Number(elem.querySelector('.bonus-attachment-item-defence-bonus')?.nextElementSibling.innerText?.trim())
//
item.type = Number(elem.querySelector('li[data-type][data-action="equip"][data-item][data-id]')?.getAttribute('data-type').trim())
//
item.bonus = elem.querySelector('li.bonus i[class*="bonus-attachment"][title]')?.getAttribute('title').trim()
ret.push(item)
})
return ret
}
@ -227,6 +231,7 @@ const _equipItem = async (item: Item) => {
onMounted(async () => {
itemList.value = parseListHtml(await fetchList())
})
watch(itemList, (_cb) => logger.info(_cb))
</script>
<template>
@ -235,16 +240,18 @@ onMounted(async () => {
{{ item.label }}
</el-button>
</el-button-group>
<el-space size="default" wrap>
<el-skeleton v-if="itemList.length === 0" :rows="5" animated/>
<el-space size="default" style="margin-top: 0.5em;" wrap>
<div v-for="item in itemList" v-infinite-scroll="loadMore" :infinite-scroll-delay="500"
:infinite-scroll-disabled="disabledInfiniteLoading">
<el-badge :hidden="item.amount < 2" :value="item.amount">
<el-badge :hidden="item.amount < 2" :max="999" :value="item.amount">
<el-popover :show-after="300" :width="240" trigger="hover">
<template #reference>
<el-card :body-style="{ padding: '0px' }" :style="item.isEquipped ? { borderColor: '#32CD32' } : null"
shadow="hover">
<el-image :alt="item.id.toString()" :mouseover="itemHover(item)"
:src="`/images/items/${item.id}/medium.png`" style="width: 60px;height: 30px"/>
<el-tag v-if="item.bonus">🌟</el-tag>
<el-row v-if="item.damage > 0 && item.accuracy > 0">
<el-col :span="12">
<el-tag>{{ item.damage }}</el-tag>
@ -275,9 +282,12 @@ onMounted(async () => {
<el-row v-if="item.defence">
<el-text>防御: {{ item.defence }}</el-text>
</el-row>
<el-row v-if="item.bonus">
<el-text>特效: <span v-html="item.bonus"></span></el-text>
</el-row>
<el-row :gutter="4">
<el-col :span="8">
<el-button :icon="Check" @click="item.armoryId ? _equipItem(item) : useItem(item.id.toString())"/>
<el-button :icon="Check" @click="item.type ? _equipItem(item) : useItem(item.id.toString())"/>
</el-col>
<el-col :span="8">
<el-button :icon="Delete" disabled/>
@ -286,11 +296,19 @@ onMounted(async () => {
<el-button :icon="Promotion" disabled/>
</el-col>
</el-row>
<div v-if="item.details || item.isDetailsLoading" v-loading="item.isDetailsLoading"
v-html="item.details?.itemInfoContent || ''"></div>
<el-row v-if="item.details">
<el-text>估值: {{ item.details.itemValue }}</el-text>
</el-row>
<template v-if="item.details">
<div v-if="item.isDetailsLoading || item.details?.itemInfoContent"
v-html="item.details?.itemInfoContent.replace(item.details?.itemInfo, '') || ''"></div>
<el-row v-if="item.details.itemRareIcon">
<el-text>稀有度: {{ item.details.itemRareIcon }}</el-text>
</el-row>
<el-row v-if="item.details.itemCirculation">
<el-text>流通数: {{ item.details.itemCirculation }}</el-text>
</el-row>
<el-row v-if="item.details.itemValue">
<el-text>估值: {{ item.details.itemValue }}</el-text>
</el-row>
</template>
</el-popover>
</el-badge>
</div>