Skip to content

Commit

Permalink
修复无限乱斗模式 fandom 英雄平衡性数据展示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanxven committed Sep 1, 2024
1 parent 59d5b7c commit f9b9425
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 16 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

- 添加了一个设置项,位于 `应用` -> `其他` -> `禁用硬件加速`,可选择是否禁用硬件加速。适用于界面渲染模糊的情况,但也会显著降低性能。

- [TODO] 添加了一个设置项,是否在同大区时仍按照账号区分玩家。(同时注明标记者)

## 调整

- OP.GG 添加装备方案时,将不会添加到自定义装备方案,而是通过写文件的方式保存。这将避免出现添加失败的情况。
Expand All @@ -16,6 +18,11 @@

- [TODO] 可设置最后一秒秒退的阈值。


## 修复

- 平衡性数据在 URF 模式不显示的问题。

# v1.2.4 (2024-08-12)

## 新增
Expand Down
4 changes: 2 additions & 2 deletions src/main/modules/external-data-source/fandom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class BalanceEds {
}

return {
gameMode: this._lcu.gameflow.session.map.gameMode,
queueGameMode: this._lcu.gameflow.session.gameData.queue.gameMode,
queueType: this._lcu.gameflow.session.gameData.queue.type
}
},
Expand All @@ -92,7 +92,7 @@ export class BalanceEds {
return
}

this._updateBalanceData(info.gameMode, info.queueType)
this._updateBalanceData(info.queueGameMode, info.queueType)
},
{ fireImmediately: true }
)
Expand Down
34 changes: 33 additions & 1 deletion src/main/modules/lcu-state-sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { LcuEvent } from '@shared/types/lcu/event'
import { BallotLegacy } from '@shared/types/lcu/honorV2'
import { formatError } from '@shared/utils/errors'
import { isAxiosError } from 'axios'
import { comparer, computed, runInAction } from 'mobx'
import { comparer, computed, makeAutoObservable, observable, runInAction } from 'mobx'
import PQueue from 'p-queue'

import { LcuConnectionModule } from '../akari-core/lcu-connection'
Expand All @@ -45,7 +45,34 @@ import { LoginState } from './login'
import { MatchmakingState } from './matchmaking'
import { SummonerState } from './summoner'

interface SyncProgress {
currentTask: string
finishedTasks: number
totalTasks: number
}

class LcuSyncModuleState {
isInitialized = false

progress: SyncProgress | null = null

constructor() {
makeAutoObservable(this, {
progress: observable.ref
})
}

setInitialized(value: boolean) {
this.isInitialized = value
}

setProgress(p: SyncProgress | null) {
this.progress = p
}
}

export class LcuSyncModule extends MobxBasedBasicModule {
public state = new LcuSyncModuleState()
public gameflow = new GameflowState()
public chat = new ChatState()
public honor = new HonorState()
Expand All @@ -65,6 +92,11 @@ export class LcuSyncModule extends MobxBasedBasicModule {
private _lcm: LcuConnectionModule
private _mwm: MainWindowModule

private _taskQueue: {
task: () => Promise<any>
name: string
}[] = []

private _gameDataLimiter = new PQueue({
concurrency: 3
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,34 @@ const cs = useChampSelectStore()
const eds = useExternalDataSourceStore()
const gameflow = useGameflowStore()
const modes = new Map<string, string>([
['ARAM', 'aram'],
['ONEFORALL', 'ofa'],
['URF', 'urf'],
['CHERRY', 'ar'],
['ULTBOOK', 'usb']
])
const gameMode = computed(() => {
if (!gameflow.session) {
return null
}
return gameflow.session.map.gameMode
return gameflow.session.gameData.queue.gameMode
})
const getBalanceData = (id: number) => {
if (!eds.balanceData || !gameMode.value) {
return null
}
return eds.balanceData.map[id]?.balance['aram'] || null
const fandomModes = modes.get(gameMode.value)
if (!fandomModes) {
return null
}
return eds.balanceData.map[id]?.balance[fandomModes] || null
}
const BALANCE_TYPES: Record<
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src-auxiliary-window/views/opgg/Opgg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
:version="version || undefined"
@set-runes="setRunes"
@set-spells="setSummonerSpells"
@set-summoner-spells="setSummonerSpells"
/>
</div>
<Transition name="fade">
Expand Down
3 changes: 0 additions & 3 deletions src/renderer/src-auxiliary-window/views/opgg/OpggChampion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,7 @@ import { useLocalStorage } from '@vueuse/core'
import {
NButton,
NCheckbox,
NFlex,
NIcon,
NRadio,
NRadioGroup,
NScrollbar,
NSpin,
NSwitch,
Expand Down
1 change: 0 additions & 1 deletion src/renderer/src-main-window/NaiveUIProviderApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
abstract
inline-theme-disabled
>
<!-- 需要给一个相对于 Title Bar 的偏移量 -->
<NMessageProvider :container-style="{ top: 'calc(var(--title-bar-height) + 12px)' }">
<NNotificationProvider placement="bottom-right">
<NDialogProvider>
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/src-main-window/views/test/Test.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<!-- <OngoingGameNew /> -->
<!-- <ChampionIcon :champion-id="4" /> -->
<SpectateStatus />
<div style="width: 256px">
<SpectateStatus />
</div>
</template>

<script lang="ts" setup>
Expand Down
7 changes: 1 addition & 6 deletions src/shared/data-sources/normalized/champ-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ export interface ChampBalanceInfoV1 {
}

export interface ChampBalanceModeMapV1 {
ar?: ChampModeBalanceV1
aram?: ChampModeBalanceV1
nb?: ChampModeBalanceV1
ofa?: ChampModeBalanceV1
urf?: ChampModeBalanceV1
usb?: ChampModeBalanceV1
[key: string]: ChampModeBalanceV1
}

export interface ChampModeBalanceV1 {
Expand Down

0 comments on commit f9b9425

Please sign in to comment.