You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
6.2 KiB
217 lines
6.2 KiB
1 month ago
|
<template>
|
||
3 weeks ago
|
<div class="equip-dialog" v-if="equip">
|
||
4 weeks ago
|
<Tooltip :infos="[rt('desc.1'), rt('desc.2'), rt('desc.3'), rt('desc.4')]" width="8rem">
|
||
|
<div class="descript">- {{ rt('desc.0') }} -</div>
|
||
|
</Tooltip>
|
||
3 weeks ago
|
<div class="equip">
|
||
|
<EquipIcon :equip="equip" />
|
||
|
<div class='name' :class="equip.quality.quality">
|
||
|
{{ t(equip.type + '.' + equip.base.name + '.0') }}
|
||
|
{{ equip.strengthenLv ? '(+' + equip.strengthenLv + ')' : '' }}
|
||
|
</div>
|
||
|
</div>
|
||
4 weeks ago
|
<div @mouseover="reforgeFlag = true" @mouseleave="reforgeFlag = false; reforgeing = false;" @click="reforge">
|
||
|
<div class="extraEntry" v-if="!reforgeFlag || reforgeing">
|
||
|
<div v-if="tempEntry" class="extraEntry-item" v-for="(v, k) in tempEntry" :key="k">
|
||
|
<button class="button">
|
||
|
<div>
|
||
|
{{ t(v.type + '.0') }} : {{ v.showVal }}({{ v.percent }}%)
|
||
|
</div>
|
||
|
</button>
|
||
|
</div>
|
||
|
<div v-if="!tempEntry" class="extraEntry-item" v-for="(v, k) in equip.extraEntry" :key="v.type + k">
|
||
|
<button class="button">
|
||
|
<div>
|
||
|
{{ t(v.type + '.0') }} : {{ v.showVal }}({{ v.percent }}%)
|
||
|
</div>
|
||
|
</button>
|
||
|
</div>
|
||
1 month ago
|
</div>
|
||
4 weeks ago
|
<div class="reforge-tip" v-if="reforgeFlag && !reforgeing">
|
||
|
<div :class="useCoins < reforgeNeed ? 'red' : ''">{{ replace(rt('action.0'), [reforgeNeed]) }}
|
||
|
</div>
|
||
1 month ago
|
</div>
|
||
|
</div>
|
||
4 weeks ago
|
<div class="btn-group">
|
||
|
<button class="button" @click="saveOld">{{ rt('action.1') }}</button>
|
||
|
<button class="button" @click="saveNew">{{ rt('action.2') }}</button>
|
||
|
</div>
|
||
|
<div class="btn-group" v-if='!auto'>
|
||
|
<p>{{ rt('atuo.0') }}:</p>
|
||
|
<select v-model="autoAttr">
|
||
|
<option v-for="item in entrys" :value="item">{{ t(item + '.0') }}</option>
|
||
|
</select>
|
||
|
x
|
||
|
<select v-model="autoNum">
|
||
|
<option v-for="i in 5" :value="i">{{ i }}</option>
|
||
|
</select>
|
||
|
<button class="button" @click="startAuto">{{ rt('atuo.1') }}</button>
|
||
|
</div>
|
||
|
<div class="btn-group" v-if='auto'>
|
||
|
<p>{{ rt('atuo.2') }}...</p>
|
||
|
<button class="button" @click="stopAuto">{{ rt('atuo.3') }}</button>
|
||
1 month ago
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts" setup>
|
||
|
import { useStore } from "vuex";
|
||
|
import { reactive, onMounted, ref, computed, watch } from "vue";
|
||
3 weeks ago
|
import { Tooltip, EquipIcon } from "@/components"
|
||
1 month ago
|
import { createt } from "@/config/i18n";
|
||
4 weeks ago
|
import { Entry, extra_entry_num } from "@/config";
|
||
|
import * as config from "@/config";
|
||
1 month ago
|
import { replace } from "@/tool";
|
||
|
import { useI18n } from "vue3-i18n";
|
||
|
|
||
|
const { t } = useI18n();
|
||
4 weeks ago
|
const rt = createt('reforge.');
|
||
1 month ago
|
const { state, commit, dispatch } = useStore();
|
||
|
const reforgeFlag = ref(false);
|
||
|
const reforgeing = ref(false);
|
||
|
const reforgeNeed = computed(() => {
|
||
|
const equip = prop.equip;
|
||
|
if (!equip) {
|
||
|
return 0;
|
||
|
}
|
||
|
return Math.round(equip.lv * equip.quality.qualityCoefficient * (200 + 10 * equip.lv) / 6);
|
||
|
})
|
||
|
const useCoins = computed(() => {
|
||
|
return state.playerAttribute.coins;
|
||
|
})
|
||
|
const height = computed(() => {
|
||
|
if (prop.equip) {
|
||
|
return prop.equip.extraEntry.length * 2.5 + 'rem';
|
||
|
}
|
||
|
return '1rem';
|
||
|
})
|
||
|
const tempEntry = ref<Entry[] | null>();
|
||
|
const tempId = ref();
|
||
|
|
||
4 weeks ago
|
const auto = ref(false);
|
||
|
const autoAttr = ref('');
|
||
|
const autoNum = ref(3);
|
||
|
const entrys = computed(() => {
|
||
|
if (prop.equip) {
|
||
|
const key = prop.equip.type + 'ExtraEntrys';
|
||
|
return config[key];
|
||
|
}
|
||
|
return null;
|
||
|
});
|
||
|
|
||
1 month ago
|
const prop = defineProps({
|
||
|
equip: {
|
||
|
type: Object,
|
||
|
default: null
|
||
|
}
|
||
|
});
|
||
|
watch(() => prop.equip, (n) => {
|
||
|
tempEntry.value = null;
|
||
|
})
|
||
|
|
||
|
const reforge = () => {
|
||
4 weeks ago
|
const need = Math.ceil(reforgeNeed.value * (auto.value ? 1.5 : 1));
|
||
4 weeks ago
|
if (useCoins.value < need) {
|
||
1 month ago
|
commit("set_sys_info", { msg: t('stNoCoins'), type: "warning", });
|
||
|
return
|
||
|
}
|
||
|
const equip = prop.equip;
|
||
|
const quality = equip.quality.quality;
|
||
|
const extraQuality = equip.quality.extraQuality;
|
||
|
const extraEntryNum = extra_entry_num[quality];
|
||
|
const extraEntry = new Array();
|
||
|
for (let i = 0; i < extraEntryNum; i++) {
|
||
4 weeks ago
|
const key = equip.type + 'ExtraEntry';
|
||
|
const entry = config[key](quality, equip.lv, extraQuality);
|
||
1 month ago
|
extraEntry.push(entry);
|
||
|
}
|
||
4 weeks ago
|
commit("add_player_coins", -1 * need);
|
||
1 month ago
|
tempId.value = equip.id;
|
||
|
tempEntry.value = extraEntry;
|
||
|
reforgeing.value = true;
|
||
4 weeks ago
|
check();
|
||
|
auto.value && setTimeout(reforge, 200);
|
||
1 month ago
|
}
|
||
|
|
||
|
const saveOld = () => {
|
||
|
tempEntry.value = null;
|
||
|
}
|
||
|
const saveNew = () => {
|
||
|
if (!tempEntry.value) {
|
||
|
return;
|
||
|
}
|
||
|
prop.equip.extraEntry = tempEntry.value;
|
||
|
tempEntry.value = null;
|
||
|
}
|
||
|
|
||
4 weeks ago
|
const check = () => {
|
||
|
debugger
|
||
|
if (!auto.value || !tempEntry.value) return;
|
||
|
let cout = 0;
|
||
|
const entrys = tempEntry.value || prop.equip.extraEntry;
|
||
|
entrys.forEach(entry => {
|
||
|
if (entry.type == autoAttr.value) {
|
||
|
cout++;
|
||
|
}
|
||
|
})
|
||
|
auto.value = cout < autoNum.value;
|
||
|
}
|
||
|
const startAuto = () => {
|
||
|
auto.value = true;
|
||
|
check();
|
||
|
auto.value && reforge();
|
||
|
}
|
||
|
const stopAuto = () => {
|
||
|
auto.value = false;
|
||
|
}
|
||
|
|
||
1 month ago
|
onMounted(() => { });
|
||
|
</script>
|
||
|
<style lang="scss" scoped>
|
||
3 weeks ago
|
.extraEntry {
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
justify-content: center;
|
||
|
width: 100%;
|
||
|
padding-left: 1.2rem;
|
||
|
padding-bottom: 0.6rem;
|
||
|
height: v-bind('height');
|
||
|
cursor: pointer;
|
||
|
|
||
|
div {
|
||
1 month ago
|
display: flex;
|
||
|
justify-content: center;
|
||
|
|
||
3 weeks ago
|
&>div {
|
||
1 month ago
|
display: flex;
|
||
|
justify-content: center;
|
||
|
}
|
||
|
}
|
||
|
|
||
3 weeks ago
|
.button {
|
||
|
border: 0;
|
||
|
width: 80%;
|
||
4 weeks ago
|
}
|
||
3 weeks ago
|
}
|
||
1 month ago
|
|
||
3 weeks ago
|
.reforge-tip {
|
||
|
width: 100%;
|
||
|
flex-direction: column;
|
||
|
display: flex;
|
||
|
justify-content: center;
|
||
|
height: v-bind('height');
|
||
|
color: #68d5ed;
|
||
1 month ago
|
}
|
||
|
|
||
3 weeks ago
|
.red {
|
||
|
color: red !important;
|
||
|
}
|
||
1 month ago
|
|
||
3 weeks ago
|
.btn-group {
|
||
|
margin-bottom: 0.5rem;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
1 month ago
|
}
|
||
3 weeks ago
|
|
||
1 month ago
|
</style>
|