style: LF -> CRLF

This commit is contained in:
unanmed 2026-07-13 23:22:31 +08:00
parent f6383e41e8
commit 8677271b69
3 changed files with 13 additions and 11 deletions

View File

@ -9,5 +9,5 @@
"vueIndentScriptAndStyle": false,
"arrowParens": "avoid",
"trailingComma": "none",
"endOfLine": "auto"
}
"endOfLine": "crlf"
}

View File

@ -1,6 +1,6 @@
import { isNil } from 'lodash-es';
import { IDataCommon, ItemCategory, SaveCompression } from '@user/data-common';
import { HeroEquipsStore } from './equipment';
import { HeroEquipsStore } from './equipStore';
import {
IHeroItems,
IHeroItemSave,
@ -25,7 +25,7 @@ export class HeroItems<THero> implements IHeroItems<THero> {
* item num id tileStore num
* @param item id
*/
private resolveNum(item: number | string): number | null {
private resolveNum(item: number | string): number | undefined {
if (typeof item === 'number') return item;
return this.state.tileStore.idToNumber(item);
}

View File

@ -6,14 +6,14 @@ import {
ItemCategory
} from './types';
export class ItemStore<TLegacy> implements IItemStore<TLegacy> {
export class ItemStore<THero, TLegacy> implements IItemStore<THero, TLegacy> {
/** 以道具图块数字为键的原始道具定义表 */
private readonly dataMap: Map<number, IItemRawData> = new Map();
private readonly dataMap: Map<number, IItemRawData<THero>> = new Map();
/** 当前挂载的旧样板道具转换器 */
private converter: IItemLegacyConverter<TLegacy> | null = null;
private converter: IItemLegacyConverter<THero, TLegacy> | null = null;
getData(num: number): IItemRawData | null {
getData(num: number): IItemRawData<THero> | null {
return this.dataMap.get(num) ?? null;
}
@ -21,15 +21,17 @@ export class ItemStore<TLegacy> implements IItemStore<TLegacy> {
return this.dataMap.get(num)?.category ?? ItemCategory.Unknown;
}
addItem(data: IItemRawData): void {
addItem(data: IItemRawData<THero>): void {
this.dataMap.set(data.num, data);
}
attachLegacyConverter(converter: IItemLegacyConverter<TLegacy>): void {
attachLegacyConverter(
converter: IItemLegacyConverter<THero, TLegacy>
): void {
this.converter = converter;
}
fromLegacy(num: number, legacy: TLegacy): IItemRawData {
fromLegacy(num: number, legacy: TLegacy): IItemRawData<THero> {
const converter = this.converter;
if (!converter) {
logger.error(57);