-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
119 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { retrieveJson } from '@/common/datasource'; | ||
import { GamecoreTask } from './gamecore'; | ||
import { Mutex } from '@/common/mutex'; | ||
|
||
export interface AIFactor | ||
{ | ||
CombineOperator: string | ||
Source: GamecoreTask | ||
Mapper: GamecoreTask | ||
} | ||
|
||
export interface AIFactorGroup | ||
{ | ||
CombineOperator: string | ||
Factors: AIFactor[] | ||
IsBpGroup: boolean | ||
} | ||
|
||
export interface AIFactorGroupConfig | ||
{ | ||
GroupsMap: | ||
{ | ||
[key:string]: AIFactorGroup | ||
} | ||
} | ||
|
||
const aiFactorGroupConfigCache:{[commitId: string]: AIFactorGroupConfig} = {} | ||
const aiFactorGroupConfigMutex = new Mutex() | ||
export async function getAIFactorGroups(commitId:string) : Promise<AIFactorGroupConfig> | ||
{ | ||
return aiFactorGroupConfigMutex.runExclusive(async () => | ||
{ | ||
let config = aiFactorGroupConfigCache[commitId] | ||
if (config == undefined) | ||
{ | ||
const aiFactorGroups = await retrieveJson('Config/ConfigAI/ComplexSkillAIGlobalGroup/Global_FactorGroups.json', commitId, false) as AIFactorGroupConfig | ||
|
||
config = aiFactorGroupConfigCache[commitId] = aiFactorGroups | ||
console.log('cached auto ai config for ' + commitId) | ||
} | ||
return config | ||
}) | ||
} | ||
|
||
export async function getAIFactorGroup(commitId:string, id:string) : Promise<AIFactorGroup> | ||
{ | ||
return (await getAIFactorGroups(commitId)).GroupsMap[id] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script setup lang="ts"> | ||
import { ref, inject, } from 'vue'; | ||
import { cleanupNumber } from '@/common/common'; | ||
import { CharacterSkillAIWeightGroup } from '@/sources/character'; | ||
import { AIFactorGroup, getAIFactorGroup } from '@/sources/autofactorgroup'; | ||
import AnyTask from '@/gamecore/AnyTask.vue'; | ||
const props = defineProps<{weightGroup:CharacterSkillAIWeightGroup}>() | ||
const commitId = inject<string>('commitId') as string | ||
const aiFactorGroup = ref<AIFactorGroup>(await getAIFactorGroup(commitId, props.weightGroup.GroupName)) | ||
</script> | ||
|
||
<template> | ||
{{ weightGroup.GroupName }} | ||
{{ cleanupNumber(weightGroup.Weight?.Value ?? 1) }} | ||
|
||
<!-- <div class="minor">{{ aiFactorGroup.CombineOperator ?? "Add" }}</div> --> | ||
<template v-for="factor in aiFactorGroup.Factors"> | ||
<div class="minor">{{ factor.CombineOperator ?? "Add" }}</div> | ||
<AnyTask :node="factor.Source" /> | ||
<AnyTask :node="factor.Mapper" /> | ||
</template> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script setup lang="ts"> | ||
import { cleanupNumber } from '@/common/common'; | ||
import { CharacterSkillAIWeightData } from '@/sources/character'; | ||
import AIWeight from './AIWeight.vue'; | ||
defineProps<{weightData:CharacterSkillAIWeightData}>() | ||
</script> | ||
|
||
<template> | ||
<ul> | ||
<li v-for="weightGroup in weightData?.Groups"> | ||
<AIWeight :weightGroup="weightGroup" /> | ||
</li> | ||
</ul> | ||
<div class="minor" v-if="weightData?.SkillBasicPower"> | ||
Power: {{ cleanupNumber(weightData?.SkillBasicPower.Value) }} | ||
</div> | ||
</template> |