宝石类型
This commit is contained in:
@@ -7,7 +7,7 @@ import { EquipModel, RandSe } from "../../../db/Equip";
|
|||||||
import { HeroModel, EPlace } from "../../../db/Hero";
|
import { HeroModel, EPlace } from "../../../db/Hero";
|
||||||
import Role from "../../../db/Role";
|
import Role from "../../../db/Role";
|
||||||
import { calPlayerCeAndSave } from "../../../services/playerCeService";
|
import { calPlayerCeAndSave } from "../../../services/playerCeService";
|
||||||
import { getGoodById, gameData } from "../../../pubUtils/data";
|
import { getGoodById, gameData, getJewelById } from "../../../pubUtils/data";
|
||||||
import { EQUIP } from "../../../pubUtils/dicParam";
|
import { EQUIP } from "../../../pubUtils/dicParam";
|
||||||
import { ITID } from "../../../consts/constModules/itemConst";
|
import { ITID } from "../../../consts/constModules/itemConst";
|
||||||
|
|
||||||
@@ -430,9 +430,18 @@ export class EquipHandler {
|
|||||||
if (!goodInfo.composeMaterial)
|
if (!goodInfo.composeMaterial)
|
||||||
return resResult(STATUS.WRONG_PARMS);
|
return resResult(STATUS.WRONG_PARMS);
|
||||||
//检查宝石消耗是否合法TODO
|
//检查宝石消耗是否合法TODO
|
||||||
|
let comJewelMap = {};
|
||||||
for (let {id, count} of goodInfo.composeMaterial) {
|
for (let {id, count} of goodInfo.composeMaterial) {
|
||||||
|
let jewel = getJewelById(id);
|
||||||
|
if (!jewel) {
|
||||||
|
return resResult(STATUS.WRONG_PARMS);
|
||||||
|
}
|
||||||
|
count = (jewel.count + (comJewelMap[jewel.good_id]||0))/count;
|
||||||
|
delete comJewelMap[jewel.good_id];
|
||||||
|
comJewelMap[jewel.nextJewelId] = count + (comJewelMap[jewel.nextJewelId]||0);
|
||||||
}
|
}
|
||||||
|
if (comJewelMap[jewel] != count || Object.keys(comJewelMap).length != 1)
|
||||||
|
return resResult(STATUS.WRONG_PARMS);
|
||||||
let res = await handleCost(roleId, sid, consumes);
|
let res = await handleCost(roleId, sid, consumes);
|
||||||
if (!res)
|
if (!res)
|
||||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
"pump": "^3.0.0",
|
"pump": "^3.0.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"temp": "^0.9.1",
|
"temp": "^0.9.1",
|
||||||
|
"underscore": "^1.12.0",
|
||||||
"unzip-stream": "^0.3.0"
|
"unzip-stream": "^0.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ const itid_array = [
|
|||||||
{ id: 34, name: '代币', table: 'item', type: CONSUME_TYPE.POINT },
|
{ id: 34, name: '代币', table: 'item', type: CONSUME_TYPE.POINT },
|
||||||
{ id: 39, name: '时装', table: 'hero', type: CONSUME_TYPE.SKIN },
|
{ id: 39, name: '时装', table: 'hero', type: CONSUME_TYPE.SKIN },
|
||||||
{ id: 40, name: '装备碎片', table: 'item', type: CONSUME_TYPE.PIECE },
|
{ id: 40, name: '装备碎片', table: 'item', type: CONSUME_TYPE.PIECE },
|
||||||
{ id: 41, name: '宝石', table: 'item', type: CONSUME_TYPE.JEWEL }
|
{ id: 42, name: '宝石', table: 'item', type: CONSUME_TYPE.JEWEL }
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ITID = new Map<number, {id: number, name: string, table: string, type?: number, isCurrency?: boolean}>();
|
export const ITID = new Map<number, {id: number, name: string, table: string, type?: number, isCurrency?: boolean}>();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { dicHero } from "./dictionary/DicHero";
|
import { dicHero } from "./dictionary/DicHero";
|
||||||
import { dicGoods, blueprt } from "./dictionary/DicGoods";
|
import { dicGoods, blueprt, jewels } from "./dictionary/DicGoods";
|
||||||
import { dicBlueprtCompose } from "./dictionary/DicBlueprtCompose";
|
import { dicBlueprtCompose } from "./dictionary/DicBlueprtCompose";
|
||||||
import { dicBlueprtPossibility } from "./dictionary/DicBlueprtPossibility";
|
import { dicBlueprtPossibility } from "./dictionary/DicBlueprtPossibility";
|
||||||
import { dicDaily } from "./dictionary/DicDaily";
|
import { dicDaily } from "./dictionary/DicDaily";
|
||||||
@@ -66,7 +66,8 @@ export const gameData = {
|
|||||||
friendShipLevelMap: dicFriendShipLevelMap,
|
friendShipLevelMap: dicFriendShipLevelMap,
|
||||||
randomEffectPool: dicRandomEffectPool,
|
randomEffectPool: dicRandomEffectPool,
|
||||||
strengthenCost: dicStrengthenCost,
|
strengthenCost: dicStrengthenCost,
|
||||||
refine: dicRefine
|
refine: dicRefine,
|
||||||
|
jewels: jewels
|
||||||
};
|
};
|
||||||
|
|
||||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||||
@@ -180,4 +181,6 @@ export function getFriendShipById(shipId: number, level: number) {
|
|||||||
export function getGoodById(gid:number) {
|
export function getGoodById(gid:number) {
|
||||||
return gameData.goods.get(gid);
|
return gameData.goods.get(gid);
|
||||||
}
|
}
|
||||||
|
export function getJewelById(gid:number) {
|
||||||
|
return gameData.jewels.get(gid);
|
||||||
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ const DicGoodsKeys: KeysEnum<DicGoods> = {
|
|||||||
|
|
||||||
export const dicGoods = new Map<number, DicGoods>();
|
export const dicGoods = new Map<number, DicGoods>();
|
||||||
export const blueprt = new Map<number, Array<number>>();
|
export const blueprt = new Map<number, Array<number>>();
|
||||||
export const jewels = new Map<number, Array<number>>();
|
export const jewels = new Map<number, DicGoods>();
|
||||||
let jewelsMap = {};
|
let jewelsMap = {};
|
||||||
arr.forEach(o => {
|
arr.forEach(o => {
|
||||||
o.goodsAbility = parseAbility(o);
|
o.goodsAbility = parseAbility(o);
|
||||||
@@ -107,14 +107,16 @@ arr.forEach(o => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// for (let key in jewelsMap) {
|
for (let key in jewelsMap) {
|
||||||
// let jewel = jewelsMap[key];
|
let jewel = jewelsMap[key];
|
||||||
// let material = jewel.composeMaterial[0];
|
let material = jewel.composeMaterial[0];
|
||||||
// let nextJewel = jewelsMap[material.id];
|
if (!!material && !!material.id) {
|
||||||
// nextJewel.count = material.count;
|
let nextJewel = jewelsMap[material.id];
|
||||||
// nextJewel.nextJewelId = material.id;
|
nextJewel.count = material.count;
|
||||||
// jewels.set(jewel.good_id, _.pick(nextJewel, Object.keys(DicGoodsKeys)));
|
nextJewel.nextJewelId = material.id;
|
||||||
// }
|
jewels.set(jewel.good_id, _.pick(nextJewel, Object.keys(DicGoodsKeys)));
|
||||||
|
}
|
||||||
|
}
|
||||||
jewelsMap = undefined;
|
jewelsMap = undefined;
|
||||||
arr = undefined;
|
arr = undefined;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user