✨ feat(宝物): 添加宝物系统

This commit is contained in:
luying
2022-12-08 15:49:51 +08:00
parent b684307818
commit a83deeff5f
46 changed files with 15656 additions and 54 deletions
+13 -2
View File
@@ -6,6 +6,7 @@ import { errlogger } from '../../util/logger';
export function sortItems(goods: ItemInter[], handleType: HANDLE_REWARD_TYPE) {
let items: { id: number, count: number }[] = []; // 可叠加道具
let jewels: { seqId?: number, id?: number, hid?: number }[] = []; // 不可叠加装备
let artifacts: { seqId?: number, id?: number }[] = []; // 不可叠加宝物
let gold: { count: number, isPay: boolean }[] = []; // 金币
let coin: number[] = [];
let ap: number = 0;
@@ -74,11 +75,21 @@ export function sortItems(goods: ItemInter[], handleType: HANDLE_REWARD_TYPE) {
}
}
}
} else if (table == ITEM_TABLE.ARTIFACT) {
if(handleType == HANDLE_REWARD_TYPE.RECEIVE) {
for(let i = 0; i < good.count; i++) {
artifacts.push({ id: good.id })
}
} else {
if(!!good.seqId) {
artifacts.push({ seqId: good.seqId });
}
}
}
}
return { items, jewels, gold, coin, ap, skins, figures }
return { items, jewels, gold, coin, ap, skins, figures, artifacts }
}
export function getGoldEventProperties(inc: number, count: number, reason: ITEM_CHANGE_REASON) {
@@ -98,7 +109,7 @@ export function combineItems(items: { id?: number, count?: number, seqId?: numbe
for(let { id, count = 1, seqId, isBag } of items) {
let dicGoods = gameData.goods.get(id);
let dicItid = ITID.get(dicGoods.itid);
if(dicItid.table != 'jewel') {
if(dicItid.table != 'jewel' && dicItid.table != 'artifact') {
let index = result.findIndex(cur => cur.id == id);
if(index == -1) {
result.push({ id, count, seqId, isBag });