mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
重构并精简了部分UI组件,移除冗余弹窗与详情组件,新增NPC相关逻辑(npcBehaviorLogic、npcGrowthLogic、npcStore等)及外交逻辑(diplomaticLogic、DiplomacyView)。完善分页、标签、复选框等通用UI组件。优化战报弹窗,调整README下载链接为相对路径,修复部分国际化内容。
24 lines
587 B
TypeScript
24 lines
587 B
TypeScript
import { defineStore } from 'pinia'
|
|
import type { NPC } from '@/types/game'
|
|
import pkg from '../../package.json'
|
|
import { encryptData, decryptData } from '@/utils/crypto'
|
|
|
|
/**
|
|
* NPC Store
|
|
* 存储和管理所有NPC数据
|
|
*/
|
|
export const useNPCStore = defineStore('npc', {
|
|
state: () => ({
|
|
npcs: [] as NPC[],
|
|
lastGrowthCheck: {} as Record<string, number> // npcId -> timestamp
|
|
}),
|
|
persist: {
|
|
key: `${pkg.name}-npcs`,
|
|
storage: localStorage,
|
|
serializer: {
|
|
serialize: state => encryptData(state),
|
|
deserialize: value => decryptData(value)
|
|
}
|
|
}
|
|
})
|