Skip to content

Commit

Permalink
update 1.21.1215
Browse files Browse the repository at this point in the history
  • Loading branch information
Java-S12138 committed Aug 20, 2022
1 parent 64af4ef commit 7d5a85f
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 51 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"license": "MIT",
"private": false,
"author": "Java_S",
"version": "1.20.1215",
"version": "1.21.1215",
"main": "background.js",
"email": "[email protected]",
"description": "A bran-new League of Legends assistant software, a replacement for WeGame.",
Expand Down
11 changes: 4 additions & 7 deletions src/render/components/assist/champRank.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<n-card class="boxShadow" size="small">
<n-space>
<n-tag type="info" :bordered="false" size="large">
<n-tag type="info" :bordered="false" size="large" style="border-radius: 5px">
国服英雄数据排行
</n-tag>
<n-select v-model:value="tier" style="width: 118px"
Expand Down Expand Up @@ -113,7 +113,7 @@
</n-space>
</n-space>
</template>
<n-scrollbar style="max-height: 372px">
<n-scrollbar style="max-height: 365px">
<n-list-item v-for="champRes in restraintList">
<n-space class=alignCenter>
<n-avatar
Expand Down Expand Up @@ -226,7 +226,7 @@ const isCheck = ref(1)
let lane = ref(appConfig.get('champRankOption.lane'))
let restraintActive = ref(false)
let restraintList = ref([])
let selectedList = ref([])
const selectedList = ref([])
let isRestraint = ref(true)
let searchValue = ref(null)
Expand Down Expand Up @@ -327,7 +327,7 @@ const getRestraintData = async (champId, position, imgUrl, name, level, win, ban
restraintList.value = []
selectedList.value = [imgUrl, name, level, win, ban]
restraintActive.value = true
const url = `https://lol.qq.com/act/lbp/common/guides/champDetail/champDetail_${champId}.js?ts=2760378`
const url = `https://lol.qq.com/act/lbp/common/guides/champDetail/champDetail_${champId}.js`
const result = await request({
'url': url,
method: 'GET',
Expand Down Expand Up @@ -419,9 +419,6 @@ const handleChangePosition = (pos) => {
width: auto;
}
.n-tag {
border-radius: 5px;
}
.isHover:hover {
background-color: #ffffff;
Expand Down
160 changes: 160 additions & 0 deletions src/render/components/assist/restraint.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<template>
<div>
<n-list>
<template #header>
<n-space justify="space-around" class="aligncenter">
<n-avatar
round
:bordered="false"
:size="50"
:src=imgUrl
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
style="display: block"
/>
<n-popover trigger="hover">
<template #trigger>
<n-tag :bordered="false">是否使用自动符文</n-tag>
</template>
<span>下次选择此英雄自动配置符文</span>
</n-popover>
<n-switch @update:value="setIsAutoRune()"
v-model:value="isAutoRune" />
</n-space>
<n-tabs style="margin-top: 12px" type="segment"
:default-value="0">
<n-tab-pane v-for="(restraint,index) in restraintList"
:tab="restraint.position" :name="index">
<n-scrollbar style="max-height: 385px">
<n-list-item v-for="champRes in restraint.restraint">
<n-space class=aligncenter>
<n-avatar
round
:bordered="false"
:size="50"
:src=champRes[1]
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
style="display: block"
/>
<n-tag type="success" :bordered="false"
style="width: 100px;justify-content: center">
胜率 {{ (champRes[2] * 0.01).toFixed(1) + '%' }}
</n-tag>
<p>{{ champRes[0] }}</p>
</n-space>
</n-list-item>
</n-scrollbar>
</n-tab-pane>
</n-tabs>
</template>
</n-list>
</div>
</template>

<script>
export default {
name: "restraint"
}
</script>

<script setup>
import {
NAvatar, NList, NScrollbar,NSwitch,NPopover,
NListItem, NSpace, NTag,NTabs,NTabPane
} from "naive-ui";
import {ref,onMounted} from "vue";
import {champDict} from "@/utils/render/lolDataList";
import {appConfig} from "@/utils/main/config";
import {request} from "@/utils/render/request";
import {createHttp1Request} from "@/utils/league-connect";
const props = defineProps({
champ: {
type: String,
}
})
const emits = defineEmits(['autoRune'])
const isAutoRune = ref(false)
const imgUrl = ref(null)
const restraintList = ref([])
onMounted(() => {
imgUrl.value = `https://game.gtimg.cn/images/lol/act/img/champion/${champDict[props.champ].alias}.png`
isAutoRune.value = appConfig.has(`autoRune.${props.champ}`) === true ? true : false
getRestraintData()
})
const getRestraintData = async () => {
restraintList.value = []
const url = `https://lol.qq.com/act/lbp/common/guides/champDetail/champDetail_${props.champ}.js`
const result = await request({
'url': url,
method: 'GET',
params: {ts: '2760378'}
})
const detailsData = JSON.parse(result.data.split('=')[1].split(';/*')[0])
const championFightKeys = Object.keys(detailsData.list.championFight)
for (const championFightKey of championFightKeys) {
const position = getPosition(championFightKey)
const restraint = getDetailsData(detailsData.list.championFight[championFightKey])
restraintList.value.push({position,restraint})
}
}
// 获取位置信息
const getPosition = (pos) => {
switch (pos) {
case 'mid':
return '中单';
case 'top':
return '上单';
case 'support':
return '辅助';
case 'jungle':
return '打野';
case 'bottom':
return '射手';
case 'aram':
return '极地';
}
}
// 获取压制英雄数据
const getDetailsData = (restraint) => {
let resList = []
for (const restraintListElement of restraint) {
const chapmId = restraintListElement.championid2
const label = champDict[chapmId].label
const imgUrl = `https://game.gtimg.cn/images/lol/act/img/champion/${champDict[chapmId].alias}.png`
const winRate = 10000 - Number(restraintListElement.winrate)
resList.push([label, imgUrl, winRate])
}
resList.sort((a, b) => {
return a[2] < b[2] ? 1 : -1
})
return resList
}
// 设置是否自动符文
const setIsAutoRune = async () => {
if (!isAutoRune.value){
// 获取符文页信息
const currentRuneList = (await createHttp1Request({
method: "GET",
url: 'lol-perks/v1/pages',
}, appConfig.get('credentials'))).json()
const current = currentRuneList.find((i) => i.current && i.isDeletable)
appConfig.set(`autoRune.${props.champ}`, current)
emits('autoRune', true)
}else {
appConfig.delete(`autoRune.${props.champ}`)
emits('autoRune', false)
}
}
</script>

<style scoped>
.aligncenter {
align-items: center;
}
</style>
64 changes: 33 additions & 31 deletions src/render/components/assist/rune.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@
<div v-if="runeDataListFor.length !=0">
<n-card class="boxShadow" size="small">
<n-space justify="space-between">
<n-popconfirm :show-icon="false" positive-text="确认" negative-text="取消"
@positive-click="setAutoRune" @negative-click="deleteAutoRune"
>
<template #trigger>
<n-badge :value="isAutoRune" color="#ff6666">
<n-avatar
round
:bordered="false"
:size="50"
:src="currentChampImgUrl"
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
style="display: block"
/>
</n-badge>
</template>
设置自动配置符文
</n-popconfirm>

<n-badge :value="isAutoRune" color="#ff6666">
<n-avatar
round
:bordered="false"
:size="50"
:src="currentChampImgUrl"
fallback-src="https://wegame.gtimg.com/g.26-r.c2d3c/helper/lol/assis/images/resources/usericon/4027.png"
style="display: block"
@click="restraintActive = true"
/>
</n-badge>
<div>
<n-tag type="success" :bordered="false" :round="true">
{{ currentChampName }}
Expand Down Expand Up @@ -100,6 +93,14 @@

</div>
</n-card>

<n-drawer :auto-focus="false" v-model:show="restraintActive"
style="border-top-left-radius: 12px;border-top-right-radius: 12px"
:height="546" placement="bottom">
<n-drawer-content >
<restraint :champ="currentChamp" @autoRune="autoRune"></restraint>
</n-drawer-content>
</n-drawer>
</div>

<div v-else>
Expand All @@ -115,14 +116,16 @@
<script setup>
import {ipcRenderer} from "electron"
import {
NCard, NAvatar, NSpace, NTag, NGrid, NGi, NIcon, NBadge, NButton, NPopconfirm, useMessage
NCard, NAvatar, NSpace, NTag, NGrid, NGi, NIcon,
NBadge, NButton, NPopconfirm, useMessage,NDrawer, NDrawerContent
} from 'naive-ui'
import {ref} from "vue";
import {champDict, mapNameFromUrl} from '../../../utils/render/lolDataList'
import {appConfig} from '../../../utils/main/config'
import {ArrowBigRightLine, ArrowBigLeftLine} from '@vicons/tabler'
import {request} from "../../../utils/render/request"
import {applyRunePage,setAutoRuneFromChamp} from "@/utils/main/lcu";
import {applyRunePage} from "@/utils/main/lcu";
import Restraint from "./restraint.vue";
const currentChamp = ref(null)
const currentChampImgUrl = ref('')
Expand All @@ -138,11 +141,13 @@ const skillsAndItems = ref([])
const itemCount = ref(1)
const credentials = appConfig.get('credentials')
let currentGameMode = ''
const restraintActive = ref(false)
const message = useMessage()
ipcRenderer.on('show-other-summoner', () => {
runeDataListFor.value.length = 0
currentChamp.value=null
})
ipcRenderer.on('query-other-summoner', () => {
currentGameMode = ''
Expand Down Expand Up @@ -212,7 +217,9 @@ const getRuneData = async (gameMode) => {
}
}
// getRuneData()
// 切换不同的装备进行显示
const changeItemsImg = () => {
Expand Down Expand Up @@ -319,16 +326,11 @@ const pageNext = () => {
}
}
// 设置自动配置符文
const setAutoRune = () => {
setAutoRuneFromChamp(credentials,currentChamp.value)
isAutoRune.value = 'auto'
}
// 删除自动配置符文
const deleteAutoRune = () => {
if (appConfig.has(`autoRune.${currentChamp.value}`)) {
appConfig.delete(`autoRune.${currentChamp.value}`)
isAutoRune.value = 0
const autoRune = (e) => {
if (e){
isAutoRune.value='auto'
}else {
isAutoRune.value=0
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/render/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const useStore = defineStore('app', {
currentQueryGameId:0,
currentSummonerName:'',
currentTeam:1, // 当前队伍
frankVersion:'1.20.1215'
frankVersion:'1.21.1215'
}
},
actions:{
Expand Down
13 changes: 2 additions & 11 deletions src/utils/main/lcu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,11 @@ const champSelectPatchAction = async (credentials, actionID, champId, type) => {
}

try {
// const res = await createHttp1Request({
// method: "PATCH",
// url: `/lol-champ-select/v1/session/actions/${actionID}`,
// body: localBody
// }, credentials)
// todo http2 PATCH
const session = await createHttpSession(credentials)
const res = await createHttp2Request({
const res = await createHttp1Request({
method: "PATCH",
url: `/lol-champ-select/v1/session/actions/${actionID}`,
body: localBody
},session, credentials)
session.close()
console.log(res.raw)
}, credentials)
return res.status
} catch (e) {
console.log('Json Error Can Ignore')
Expand Down

0 comments on commit 7d5a85f

Please sign in to comment.