Skip to content

Commit 7d5a85f

Browse files
committed
update 1.21.1215
1 parent 64af4ef commit 7d5a85f

File tree

6 files changed

+201
-51
lines changed

6 files changed

+201
-51
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"license": "MIT",
44
"private": false,
55
"author": "Java_S",
6-
"version": "1.20.1215",
6+
"version": "1.21.1215",
77
"main": "background.js",
88
"email": "[email protected]",
99
"description": "A bran-new League of Legends assistant software, a replacement for WeGame.",

src/render/components/assist/champRank.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<n-card class="boxShadow" size="small">
44
<n-space>
5-
<n-tag type="info" :bordered="false" size="large">
5+
<n-tag type="info" :bordered="false" size="large" style="border-radius: 5px">
66
国服英雄数据排行
77
</n-tag>
88
<n-select v-model:value="tier" style="width: 118px"
@@ -113,7 +113,7 @@
113113
</n-space>
114114
</n-space>
115115
</template>
116-
<n-scrollbar style="max-height: 372px">
116+
<n-scrollbar style="max-height: 365px">
117117
<n-list-item v-for="champRes in restraintList">
118118
<n-space class=alignCenter>
119119
<n-avatar
@@ -226,7 +226,7 @@ const isCheck = ref(1)
226226
let lane = ref(appConfig.get('champRankOption.lane'))
227227
let restraintActive = ref(false)
228228
let restraintList = ref([])
229-
let selectedList = ref([])
229+
const selectedList = ref([])
230230
let isRestraint = ref(true)
231231
let searchValue = ref(null)
232232
@@ -327,7 +327,7 @@ const getRestraintData = async (champId, position, imgUrl, name, level, win, ban
327327
restraintList.value = []
328328
selectedList.value = [imgUrl, name, level, win, ban]
329329
restraintActive.value = true
330-
const url = `https://lol.qq.com/act/lbp/common/guides/champDetail/champDetail_${champId}.js?ts=2760378`
330+
const url = `https://lol.qq.com/act/lbp/common/guides/champDetail/champDetail_${champId}.js`
331331
const result = await request({
332332
'url': url,
333333
method: 'GET',
@@ -419,9 +419,6 @@ const handleChangePosition = (pos) => {
419419
width: auto;
420420
}
421421
422-
.n-tag {
423-
border-radius: 5px;
424-
}
425422
426423
.isHover:hover {
427424
background-color: #ffffff;
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<template>
2+
<div>
3+
<n-list>
4+
<template #header>
5+
<n-space justify="space-around" class="aligncenter">
6+
<n-avatar
7+
round
8+
:bordered="false"
9+
:size="50"
10+
:src=imgUrl
11+
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
12+
style="display: block"
13+
/>
14+
<n-popover trigger="hover">
15+
<template #trigger>
16+
<n-tag :bordered="false">是否使用自动符文</n-tag>
17+
</template>
18+
<span>下次选择此英雄自动配置符文</span>
19+
</n-popover>
20+
<n-switch @update:value="setIsAutoRune()"
21+
v-model:value="isAutoRune" />
22+
</n-space>
23+
<n-tabs style="margin-top: 12px" type="segment"
24+
:default-value="0">
25+
<n-tab-pane v-for="(restraint,index) in restraintList"
26+
:tab="restraint.position" :name="index">
27+
<n-scrollbar style="max-height: 385px">
28+
<n-list-item v-for="champRes in restraint.restraint">
29+
<n-space class=aligncenter>
30+
<n-avatar
31+
round
32+
:bordered="false"
33+
:size="50"
34+
:src=champRes[1]
35+
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
36+
style="display: block"
37+
/>
38+
<n-tag type="success" :bordered="false"
39+
style="width: 100px;justify-content: center">
40+
胜率 {{ (champRes[2] * 0.01).toFixed(1) + '%' }}
41+
</n-tag>
42+
<p>{{ champRes[0] }}</p>
43+
</n-space>
44+
</n-list-item>
45+
</n-scrollbar>
46+
</n-tab-pane>
47+
</n-tabs>
48+
</template>
49+
</n-list>
50+
</div>
51+
</template>
52+
53+
<script>
54+
export default {
55+
name: "restraint"
56+
}
57+
</script>
58+
59+
<script setup>
60+
import {
61+
NAvatar, NList, NScrollbar,NSwitch,NPopover,
62+
NListItem, NSpace, NTag,NTabs,NTabPane
63+
} from "naive-ui";
64+
import {ref,onMounted} from "vue";
65+
import {champDict} from "@/utils/render/lolDataList";
66+
import {appConfig} from "@/utils/main/config";
67+
import {request} from "@/utils/render/request";
68+
import {createHttp1Request} from "@/utils/league-connect";
69+
const props = defineProps({
70+
champ: {
71+
type: String,
72+
}
73+
})
74+
const emits = defineEmits(['autoRune'])
75+
76+
const isAutoRune = ref(false)
77+
const imgUrl = ref(null)
78+
const restraintList = ref([])
79+
80+
81+
onMounted(() => {
82+
imgUrl.value = `https://game.gtimg.cn/images/lol/act/img/champion/${champDict[props.champ].alias}.png`
83+
isAutoRune.value = appConfig.has(`autoRune.${props.champ}`) === true ? true : false
84+
getRestraintData()
85+
})
86+
87+
const getRestraintData = async () => {
88+
restraintList.value = []
89+
const url = `https://lol.qq.com/act/lbp/common/guides/champDetail/champDetail_${props.champ}.js`
90+
const result = await request({
91+
'url': url,
92+
method: 'GET',
93+
params: {ts: '2760378'}
94+
})
95+
const detailsData = JSON.parse(result.data.split('=')[1].split(';/*')[0])
96+
const championFightKeys = Object.keys(detailsData.list.championFight)
97+
for (const championFightKey of championFightKeys) {
98+
const position = getPosition(championFightKey)
99+
const restraint = getDetailsData(detailsData.list.championFight[championFightKey])
100+
restraintList.value.push({position,restraint})
101+
}
102+
}
103+
104+
// 获取位置信息
105+
const getPosition = (pos) => {
106+
switch (pos) {
107+
case 'mid':
108+
return '中单';
109+
case 'top':
110+
return '上单';
111+
case 'support':
112+
return '辅助';
113+
case 'jungle':
114+
return '打野';
115+
case 'bottom':
116+
return '射手';
117+
case 'aram':
118+
return '极地';
119+
}
120+
}
121+
// 获取压制英雄数据
122+
const getDetailsData = (restraint) => {
123+
let resList = []
124+
125+
for (const restraintListElement of restraint) {
126+
const chapmId = restraintListElement.championid2
127+
const label = champDict[chapmId].label
128+
const imgUrl = `https://game.gtimg.cn/images/lol/act/img/champion/${champDict[chapmId].alias}.png`
129+
const winRate = 10000 - Number(restraintListElement.winrate)
130+
resList.push([label, imgUrl, winRate])
131+
}
132+
resList.sort((a, b) => {
133+
return a[2] < b[2] ? 1 : -1
134+
})
135+
return resList
136+
}
137+
// 设置是否自动符文
138+
const setIsAutoRune = async () => {
139+
if (!isAutoRune.value){
140+
// 获取符文页信息
141+
const currentRuneList = (await createHttp1Request({
142+
method: "GET",
143+
url: 'lol-perks/v1/pages',
144+
}, appConfig.get('credentials'))).json()
145+
const current = currentRuneList.find((i) => i.current && i.isDeletable)
146+
appConfig.set(`autoRune.${props.champ}`, current)
147+
emits('autoRune', true)
148+
149+
}else {
150+
appConfig.delete(`autoRune.${props.champ}`)
151+
emits('autoRune', false)
152+
}
153+
}
154+
</script>
155+
156+
<style scoped>
157+
.aligncenter {
158+
align-items: center;
159+
}
160+
</style>

src/render/components/assist/rune.vue

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,17 @@
22
<div v-if="runeDataListFor.length !=0">
33
<n-card class="boxShadow" size="small">
44
<n-space justify="space-between">
5-
<n-popconfirm :show-icon="false" positive-text="确认" negative-text="取消"
6-
@positive-click="setAutoRune" @negative-click="deleteAutoRune"
7-
>
8-
<template #trigger>
9-
<n-badge :value="isAutoRune" color="#ff6666">
10-
<n-avatar
11-
round
12-
:bordered="false"
13-
:size="50"
14-
:src="currentChampImgUrl"
15-
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
16-
style="display: block"
17-
/>
18-
</n-badge>
19-
</template>
20-
设置自动配置符文
21-
</n-popconfirm>
22-
5+
<n-badge :value="isAutoRune" color="#ff6666">
6+
<n-avatar
7+
round
8+
:bordered="false"
9+
:size="50"
10+
:src="currentChampImgUrl"
11+
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
12+
style="display: block"
13+
@click="restraintActive = true"
14+
/>
15+
</n-badge>
2316
<div>
2417
<n-tag type="success" :bordered="false" :round="true">
2518
{{ currentChampName }}
@@ -100,6 +93,14 @@
10093

10194
</div>
10295
</n-card>
96+
97+
<n-drawer :auto-focus="false" v-model:show="restraintActive"
98+
style="border-top-left-radius: 12px;border-top-right-radius: 12px"
99+
:height="546" placement="bottom">
100+
<n-drawer-content >
101+
<restraint :champ="currentChamp" @autoRune="autoRune"></restraint>
102+
</n-drawer-content>
103+
</n-drawer>
103104
</div>
104105

105106
<div v-else>
@@ -115,14 +116,16 @@
115116
<script setup>
116117
import {ipcRenderer} from "electron"
117118
import {
118-
NCard, NAvatar, NSpace, NTag, NGrid, NGi, NIcon, NBadge, NButton, NPopconfirm, useMessage
119+
NCard, NAvatar, NSpace, NTag, NGrid, NGi, NIcon,
120+
NBadge, NButton, NPopconfirm, useMessage,NDrawer, NDrawerContent
119121
} from 'naive-ui'
120122
import {ref} from "vue";
121123
import {champDict, mapNameFromUrl} from '../../../utils/render/lolDataList'
122124
import {appConfig} from '../../../utils/main/config'
123125
import {ArrowBigRightLine, ArrowBigLeftLine} from '@vicons/tabler'
124126
import {request} from "../../../utils/render/request"
125-
import {applyRunePage,setAutoRuneFromChamp} from "@/utils/main/lcu";
127+
import {applyRunePage} from "@/utils/main/lcu";
128+
import Restraint from "./restraint.vue";
126129
127130
const currentChamp = ref(null)
128131
const currentChampImgUrl = ref('')
@@ -138,11 +141,13 @@ const skillsAndItems = ref([])
138141
const itemCount = ref(1)
139142
const credentials = appConfig.get('credentials')
140143
let currentGameMode = ''
144+
const restraintActive = ref(false)
141145
142146
const message = useMessage()
143147
144148
ipcRenderer.on('show-other-summoner', () => {
145149
runeDataListFor.value.length = 0
150+
currentChamp.value=null
146151
})
147152
ipcRenderer.on('query-other-summoner', () => {
148153
currentGameMode = ''
@@ -212,7 +217,9 @@ const getRuneData = async (gameMode) => {
212217
}
213218
214219
}
215-
// getRuneData()
220+
221+
222+
216223
217224
// 切换不同的装备进行显示
218225
const changeItemsImg = () => {
@@ -319,16 +326,11 @@ const pageNext = () => {
319326
}
320327
}
321328
322-
// 设置自动配置符文
323-
const setAutoRune = () => {
324-
setAutoRuneFromChamp(credentials,currentChamp.value)
325-
isAutoRune.value = 'auto'
326-
}
327-
// 删除自动配置符文
328-
const deleteAutoRune = () => {
329-
if (appConfig.has(`autoRune.${currentChamp.value}`)) {
330-
appConfig.delete(`autoRune.${currentChamp.value}`)
331-
isAutoRune.value = 0
329+
const autoRune = (e) => {
330+
if (e){
331+
isAutoRune.value='auto'
332+
}else {
333+
isAutoRune.value=0
332334
}
333335
}
334336
</script>

src/render/store/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const useStore = defineStore('app', {
1616
currentQueryGameId:0,
1717
currentSummonerName:'',
1818
currentTeam:1, // 当前队伍
19-
frankVersion:'1.20.1215'
19+
frankVersion:'1.21.1215'
2020
}
2121
},
2222
actions:{

src/utils/main/lcu.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,11 @@ const champSelectPatchAction = async (credentials, actionID, champId, type) => {
1111
}
1212

1313
try {
14-
// const res = await createHttp1Request({
15-
// method: "PATCH",
16-
// url: `/lol-champ-select/v1/session/actions/${actionID}`,
17-
// body: localBody
18-
// }, credentials)
19-
// todo http2 PATCH
20-
const session = await createHttpSession(credentials)
21-
const res = await createHttp2Request({
14+
const res = await createHttp1Request({
2215
method: "PATCH",
2316
url: `/lol-champ-select/v1/session/actions/${actionID}`,
2417
body: localBody
25-
},session, credentials)
26-
session.close()
27-
console.log(res.raw)
18+
}, credentials)
2819
return res.status
2920
} catch (e) {
3021
console.log('Json Error Can Ignore')

0 commit comments

Comments
 (0)