Skip to content

Commit

Permalink
Display auto skill weights and character AI tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damnae committed Oct 19, 2023
1 parent 5ffc4dc commit eae0bdb
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 17 deletions.
15 changes: 15 additions & 0 deletions src/common/hashstore.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { reactive, } from 'vue'
import { getHash } from './translate'

//console.log(`"${getHash('BPHealingSkill')}": "BPHealingSkill",`)

const defaultHashes:{[key:number]:string} =
{
// Expression functions
"1776456860": "floor",
"-1226284721": "int",
// AI Tags
"-833189093": "BPHealingSkill",
"-1649595214": "BPSkillForFree",
"-1351158859": "AlwaysNeedBP",
"-447313187": "BPSkillPriority",
"762466": "DamageCarry",
"-1570322415": "DamageNeedAttack",
"1646294870": "DamageNeedDef",
"1692650493": "DamageNeedHP",
"-2136914891": "DamageIncreaseTypeBP",
"-731068780": "AggroNeed",
//
"2612209": "DebuffNumber",
"2621308": "Hana",
"14492765": "MyHPRatio",
Expand Down
45 changes: 28 additions & 17 deletions src/sources/character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,33 @@ import { Monster } from './monster';
import { DynamicValues } from './gamecore';
import { BattleEvent } from './battleevent';

export interface CharacterSkillAIWeightData
{
SkillBasicPower?:
{
Value: number
}
Groups:
[
{
GroupName:string
Weight?:
{
Value: number
}
}
]
}

export interface CharacterSkill
{
Name: string
SkillType: string
EntryAbility: string
PrepareAbility?: string
ComplexSkillAI?:
{
SkillBasicPower?:
{
Value: number
}
Groups:
[
{
GroupName:string
Weight?:
{
Value: number
}
}
]
}
ComplexSkillAIPreCheck?:CharacterSkillAIWeightData
ComplexSkillAI?:CharacterSkillAIWeightData

ChildSkillList?: string[] // used by Phys MC's ult
}

Expand All @@ -46,6 +50,13 @@ export interface Character
[key: string]: number
}
DynamicValues?: DynamicValues
AITagList?:
{
Values:
{
[hash: number]: {}
}
}
}

export async function getCharacterByAvatar(commitId:string, avatar:Avatar) : Promise<Character|undefined>
Expand Down
85 changes: 85 additions & 0 deletions src/views/aside/AvatarAI.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<script setup lang="ts">
import { ref, computed, watch, inject, } from 'vue';
import { useRoute } from 'vue-router';
import useHashStore from '@/common/hashstore';
import { Avatar, getAvatar } from '@/sources/avatar';
import { Character, getCharacterByAvatar } from '@/sources/character';
import LoadingNav from '@/components/LoadingNav.vue';
import { cleanupNumber } from '@/common/common';
const commitId = inject<string>('commitId') as string
const route = useRoute()
const objectId = computed(() => Number.parseInt(route.params.objectId as string, 10))
const avatar = ref<Avatar>()
const character = ref<Character>()
const loading = ref(true)
watch(objectId, async () =>
{
loading.value = true
avatar.value = await getAvatar(commitId, objectId.value)
character.value = avatar.value ? await getCharacterByAvatar(commitId, avatar.value) : undefined
loading.value = false
},
{ immediate:true })
const hashStore = useHashStore();
</script>

<template>
<div v-if="loading">
<LoadingNav />
</div>
<template v-else-if="avatar && character">
<header>
<h1>
<span class="pretitle">Auto AI:</span>
{{ avatar.AvatarName.Text }}
</h1>
</header>
<section>

<template v-if="character?.AITagList">
<h2>AI Tags</h2>
{{ Object.keys(character.AITagList.Values).map(hash => hashStore.translate(parseInt(hash)) ?? hash).join(', ') }}
</template>

<template v-for="skill in character.SkillList">
<template v-if="skill.ComplexSkillAIPreCheck || skill.ComplexSkillAI">
<h2>{{ skill.Name }}</h2>

<template v-if="skill.ComplexSkillAIPreCheck">
<h3>Precheck Weights</h3>
<ul>
<li v-for="weightGroup in skill.ComplexSkillAIPreCheck?.Groups">
{{ weightGroup.GroupName }}
{{ cleanupNumber(weightGroup.Weight?.Value ?? 1) }}
</li>
</ul>
<span class="minor" v-if="skill.ComplexSkillAIPreCheck?.SkillBasicPower">
Power: {{ cleanupNumber(skill.ComplexSkillAIPreCheck?.SkillBasicPower.Value) }}
</span>
</template>

<template v-if="skill.ComplexSkillAI">
<h3>Weights</h3>
<ul>
<li v-for="weightGroup in skill.ComplexSkillAI?.Groups">
{{ weightGroup.GroupName }}
{{ cleanupNumber(weightGroup.Weight?.Value ?? 1) }}
</li>
</ul>
<span class="minor" v-if="skill.ComplexSkillAI?.SkillBasicPower">
Power: {{ cleanupNumber(skill.ComplexSkillAI?.SkillBasicPower.Value) }}
</span>
</template>

</template>
</template>

</section>
</template>
</template>
4 changes: 4 additions & 0 deletions src/views/aside/CommitAside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { shallowRef, watch } from 'vue';
import { useRoute } from 'vue-router';
import AvatarAI from './AvatarAI.vue';
import MonsterAI from './MonsterAI.vue';
const component = shallowRef()
Expand All @@ -11,6 +12,9 @@
{
switch (route.name)
{
case 'avatar':
component.value = AvatarAI
break;
case 'monster':
case 'monsterAbility':
case 'monsterModifier':
Expand Down

0 comments on commit eae0bdb

Please sign in to comment.