diff --git a/game-server/app/servers/role/handler/equipHandler.ts b/game-server/app/servers/role/handler/equipHandler.ts index c5a2d0f30..1ff2dbab9 100644 --- a/game-server/app/servers/role/handler/equipHandler.ts +++ b/game-server/app/servers/role/handler/equipHandler.ts @@ -11,7 +11,7 @@ import { calPlayerCeAndSave } from "../../../services/playerCeService"; import { getGoodById, gameData, getEquipByJobClassAndEPlace, getNextEquipQuality, getEquipQualityIdByEquipIdAndPoint, getEquipStarIdByEquipId, getNextEquipStar } from "../../../pubUtils/data"; import { BAG, EQUIP } from "../../../pubUtils/dicParam"; import { ITID, QUALITY_TYPE, equipTypeToSortAttr, IT_TYPE, QUENCH_TYPE, REFINE_TYPE } from "../../../consts"; -import { checkMaterialEnough, checkEquipCanPut, quenchOnce, checkQuenchMaxByQualityAndGrade, getRandSeResult, refineOnce, checkRefineReachNextLv, calEquipCe, updateEplace, updateEplaces, checkJewelCanPutOnEquip, updateStone, checkStoneCanPutOnEquip } from "../../../services/equipService"; +import { checkEquipCanPut, quenchOnce, checkQuenchMaxByQualityAndGrade, getRandSeResult, refineOnce, checkRefineReachNextLv, calEquipCe, updateEplace, updateEplaces, checkJewelCanPutOnEquip, updateStone, checkStoneCanPutOnEquip } from "../../../services/equipService"; import { findIndex, isNumber, pick } from 'underscore'; import { pushEquipRefineSucMsg, pushNormalEquipMsg, pushNormalItemMsg } from "../../../services/chatService"; @@ -199,6 +199,10 @@ export class EquipHandler { if(update.quality == curEquip.quality && update.qualityStage == curEquip.qualityStage) { return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); } + let consumes = check.getConsume(); + let result = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.EQUIP_QUALITYUP); + if (!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); + let isUpQuality = update.quality != curEquip.quality; let { newEplace, updatedEplace } = updateEplace(hero.ePlace, ePlaceId, update); @@ -266,6 +270,9 @@ export class EquipHandler { if(update.star == curEquip.star && update.starStage == curEquip.starStage) { return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); } + let consumes = check.getConsume(); + let result = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.EQUIP_STARUP); + if (!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); let { newEplace, updatedEplace } = updateEplace(hero.ePlace, ePlaceId, update); hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_STAR, sid, roleId, hero, { ePlace: newEplace }, [ePlaceId]); @@ -608,7 +615,7 @@ export class EquipHandler { for (let { id, count } of origin) { let dicGoods = getGoodById(id); if (!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND); - if (!dicGoods.decomposeItem) return resResult(STATUS.CONSUME_TYPE_ERR); + if (!dicGoods.decomposeItem || dicGoods.decomposeItem.length <= 0) return resResult(STATUS.CONSUME_TYPE_ERR); for(let result of dicGoods.decomposeItem) { goods.push({ id: result.id, count: result.count * count }); @@ -652,521 +659,23 @@ export class EquipHandler { return resResult(STATUS.SUCCESS, { goods: combineItems(result) }); } - - - // //穿戴或卸载装备 1-穿上装备(包括替换) 2-脱下装备 - // public async putOnOrOff(msg: { eid: number, hid: number, type: number }, session: BackendSession) { - // let { eid, hid, type } = msg; - // let roleId: string = session.get('roleId'); - // let serverId: number = session.get('serverId'); - // let sid: string = session.get('sid'); + //宝石合成 + public async composeStone(msg: { id: number, count: number }, session: BackendSession) { + let { id, count } = msg; + let roleId: string = session.get('roleId'); + let roleName: string = session.get('roleName'); + let sid: string = session.get('sid'); + let check = new CheckMeterial(roleId); + let isEnough = await check.composeStone(id, count); + if(!isEnough) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); - // // 原武将:heroA,原武将穿戴着的装备a,将要穿戴的装备b,装备b被装备着的武将B - // let heroA = await HeroModel.findByHidAndRoleWithEquip(hid, roleId); - // if (!heroA) return resResult(STATUS.HERO_NOT_FIND); - // let oldCountA = heroA.ePlace.filter(cur => cur.equip).length; - // let oldCountB = 0; - - // let equip = await EquipModel.getEquip(eid); // 装备:1-equipB 2-equipA - // if(!equip) return resResult(STATUS.EQUIP_NOT_FIND); - - // let argsA = calEquipSeids(heroA); - // let heroB: HeroType, equipA: EquipType, equipB: EquipType, argsB: number[] = []; - // let heroAPutNum = 0, heroBPutTNum = 0; // 1:多一件 0:没变化 -1:少一件 - - // let goodInfo = getGoodById(equip.id); - // let obj = ITID.get(goodInfo.itid); - // let eplaceId = obj.type; // 位置 - - // if (type == 1) { - // equipB = equip; // 要穿上的装备 - // if (equipB.hid == hid) return resResult(STATUS.WRONG_PARMS); - // if(!checkEquipCanPut(heroA, equipB.id)) return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO); - - // let index = heroA.ePlace.findIndex(cur => cur.id == eplaceId); - // if (index == -1) return resResult(STATUS.WRONG_PARMS); - // equipA = heroA.ePlace[index].equip; // 要脱下的装备 - - // if(equipB.hid > 0) { - // heroB = await HeroModel.findByHidAndRoleWithEquip(equipB.hid, roleId); - // argsB = calEquipSeids(heroB); - // oldCountB = heroB.ePlace.filter(cur => cur.equip).length; - // } - - // if(equipA) { - // if(equipB.hid > 0) { - // if(checkEquipCanPut(heroB, equipA.id)) { // A=>b & B=>a - // equipA = await EquipModel.putOnOrOff(equipA._id, equipB.hid); - // heroB = await HeroModel.addEquip(roleId, heroB.hid, eplaceId, equipA._id); - // } else { // A=>b & B=>0 & 0=>a - // equipA = await EquipModel.putOnOrOff(equipA._id, 0); - // heroB = await HeroModel.removeEquip(roleId, equipB.hid, eplaceId); - // heroBPutTNum = -1; - // } - // } else { // A=>b & 0=>a - // equipA = await EquipModel.putOnOrOff(equipA._id, 0); - // } - // } else { - // if(equipB.hid > 0) { // A=>b & B=>0 - // heroB = await HeroModel.removeEquip(roleId, equipB.hid, eplaceId); - // heroBPutTNum = -1; - // } - // // A=>b - // heroAPutNum = 1; - // } - - // heroA = await HeroModel.addEquip(roleId, heroA.hid, eplaceId, equipB._id); - // equipB = await EquipModel.putOnOrOff(equipB._id, heroA.hid); - - // } else if (type == 2) { // A=>0 & 0=>a - // if (!equip.hid) return resResult(STATUS.EQUIP_NOT_EQUIPED); - // equipA = await EquipModel.putOnOrOff(equip._id, 0); - // heroA = await HeroModel.removeEquip(roleId, heroA.hid, eplaceId); - // heroAPutNum = -1; - // } - - // if(heroA) { - // await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, heroA, {}, argsA); - // if(heroAPutNum != 0) { - // await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, heroA, [heroAPutNum, oldCountA]); - // } - // } - // if(heroB) { - // await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, heroB, {}, argsB); - // if(heroBPutTNum != 0) await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, heroA, [heroBPutTNum, oldCountB]); - // } - // if(heroAPutNum + heroBPutTNum != 0) { - // await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, heroAPutNum + heroBPutTNum, true, {}); - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUM, heroAPutNum + heroBPutTNum) - // } - - // let curEquips: Array<{ seqId: number, hid: number }> = []; - // if(equipA) { - // curEquips.push(pick(equipA, ['seqId', 'hid'])); - // if(equipA.hid == 0) { - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_QUALITY, equipA, [-1]); // equipA必然是脱,如果hid不为0说明从一个人穿到另一个人,不算任务 - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_QUALITY, 1, { quality: equipA.quality }); - // } - // } - // if(equipB) { - // curEquips.push(pick(equipB, ['seqId', 'hid'])); - // if(equipB.hid != 0) { - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_QUALITY, equipB, [1]); // equipB必然是穿,如果hid为0说明没有变化,不算任务 - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_QUALITY, 1, { quality: equipB.quality }); - // } - // } - - // if(type == 1) { - // let { isTask, jewelLevel } = await checkTaskConditionEquipSuitJewelStage(heroA)//英雄满装备且都镶嵌相同阶数的宝石 - // if (isTask) { - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUIT_JEWEL_STAGE, 1, { stage: jewelLevel }) - // } - // } - - // return resResult(STATUS.SUCCESS, { curEquips: curEquips }); - // } - - // // 一次性装备上 - // public async putOnOnce(msg: { hid: number }, session: BackendSession) { - // let { hid } = msg; - // let roleId: string = session.get('roleId'); - // const serverId = session.get('serverId'); - // let sid: string = session.get('sid'); + let consumes = check.getConsume(); + let costResult = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.COMPOSE_STONE); + if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); - // let hero = await HeroModel.findByHidAndRoleWithEquip(hid, roleId); - // if (!hero) return resResult(STATUS.HERO_NOT_FIND); - // let args = calEquipSeids(hero); + let goods = await addItems(roleId, roleName, sid, [{ id, count }], ITEM_CHANGE_REASON.COMPOSE_STONE); + return resResult(STATUS.SUCCESS, goods); + } - // let dicHero = gameData.hero.get(hid); - // if (!dicHero) return resResult(STATUS.DIC_DATA_NOT_FOUND); - // let dicJob = gameData.job.get(dicHero.jobid); - - - // let allEquips = await EquipModel.findNotWearEquips(roleId); - // let sortEquips = allEquips.map(equip => { - // let { id, quality, ePlaceId, randMain } = equip; - // let { goodsAbility, lvLimited } = gameData.goods.get(id); - // let ce = calEquipCe(goodsAbility, randMain); - // return { id, quality, ce, equip, goodsAbility, lvLimited, ePlaceId } - // }); - // let { ePlace, lv } = hero; - // let oldCount = ePlace.filter(cur => cur.equip).length; - - // let curEquips: Array<{ seqId: number, hid: number }> = []; - // let equips: EquipType[] = []; - // for (let curEPlace of ePlace) { - // if (!curEPlace.equip) { // 未装备 - // let sortAttrId = equipTypeToSortAttr.get(curEPlace.id); - // let sortedAndSuitEquips = sortEquips.filter(equipInfos => { // 筛选可穿的 - // let { id, lvLimited, ePlaceId } = equipInfos; - // return lv >= lvLimited && checkEquipCanPut(hero, id) && curEPlace.id == ePlaceId; - // }); - // // console.log('sortedAndSuitEquips', JSON.stringify(sortedAndSuitEquips, null, 4)) - // sortedAndSuitEquips = sortedAndSuitEquips.sort((a, b) => { // 排序按:战力 => 根据位置看个别属性 => 品质 - // if (b.ce - a.ce != 0) return b.ce - a.ce; - // let abilityA = a.goodsAbility.get(sortAttrId) || 0; - // let abilityB = b.goodsAbility.get(sortAttrId) || 0; - // if (abilityA - abilityB != 0) return abilityB - abilityA; - // return b.quality - a.quality; - // }); - - // if (sortedAndSuitEquips.length > 0) { - // let { equip } = sortedAndSuitEquips.shift(); - // hero = await HeroModel.addEquip(roleId, hero.hid, equip.ePlaceId, equip._id); - // equip = await EquipModel.putOnOrOff(equip._id, hero.hid); - // if (!!equip) { - // curEquips.push(pick(equip, ['seqId', 'hid'])); - // equips.push(equip); - // } - // } - - // } - // } - // if (curEquips.length > 0) { - // //任务 - // await checkTaskWithHero(roleId, sid, TASK_TYPE.EQUIP_BY_HERO, hero, [1, oldCount]); - // await checkTask(roleId, sid, TASK_TYPE.EQUIP_SUM, curEquips.length, true, {}); - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUM, curEquips.length); - // for(let equip of equips) { - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_QUALITY, equip, [1]); // equipA必然是脱,如果hid不为0说明从一个人穿到另一个人,不算任务 - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_QUALITY, 1, { quality: equip.quality }); - // } - // //英雄满装备且都镶嵌相同阶数的宝石 - // let { isTask, jewelLevel } = await checkTaskConditionEquipSuitJewelStage(hero) - // if (isTask) { - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUIT_JEWEL_STAGE, 1, { stage: jewelLevel }) - // } - - // await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args); - // } - - // return resResult(STATUS.SUCCESS, { curEquips }); - // } - - // //装备打孔 - // public async digHole(msg: { eid: number, id: number }, session: BackendSession) { - // let { eid, id } = msg; - // let roleId: string = session.get('roleId'); - // let sid: string = session.get('sid'); - // let equip = await EquipModel.getEquip(eid); - // let index = findIndex(equip.holes, { id }); - // if (index < 0) - // return resResult(STATUS.EQUIP_HOLE_NOT_FIND); - // if (equip.holes[index].isOpen) - // return resResult(STATUS.EQUIP_HOLE_IS_DUG); - // let consumes: Array<{ id: number, count: number }> = []; - // if (id == 1) { - // consumes = parseGoodStr(EQUIP.EQUIP_ONE_HOLE); - // } else if (id == 2) { - // consumes = parseGoodStr(EQUIP.EQUIP_TWO_HOLE); - // } else if (id == 3) { - // consumes = parseGoodStr(EQUIP.EQUIP_THREE_HOLE); - // } - // let result = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.EQUIP_DIG_HOLE); - // if (!result) - // return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); - // equip.holes[index].isOpen = true; - // await EquipModel.updateEquipInfo(eid, { holes: equip.holes }); - // return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } }); - // } - - // //宝石镶嵌 - // public async fillHole(msg: { eid: number, id: number, jewel: number }, session: BackendSession) { - // let { eid, id, jewel } = msg; - // let roleId: string = session.get('roleId'); - // const serverId = session.get('serverId'); - // let sid: string = session.get('sid'); - - // let consumes: Array<{ id: number, count: number }> = []; - // let goods: Array<{ id: number, count: number }> = []; - // let equip = await EquipModel.getEquip(eid); - // let oldJewelCount = equip.holes.filter(cur => cur.jewel > 0).length; - - // let { itid } = getGoodById(equip.id); - // let { equipJewel } = ITID.get(itid); - // let jewelInfo = getGoodById(jewel); - // if (jewelInfo.itid != equipJewel) - // return resResult(STATUS.EQUIP_NOT_MATCH_JEWEL); - // let index = findIndex(equip.holes, { id }); - // if (index < 0) - // return resResult(STATUS.EQUIP_HOLE_NOT_FIND); - // if (!equip.holes[index].isOpen) - // return resResult(STATUS.EQUIP_HOLE_IS_NOT_DUG); - // let oldJewel = equip.holes[index].jewel; - // if (!!oldJewel) - // goods.push({ id: oldJewel, count: 1 }); - // consumes.push({ id: jewel, count: 1 }); - // let result = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.EQUIP_FILL_HOLE); - // if (!result) - // return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); - // equip.holes[index].jewel = jewel; - // await EquipModel.updateEquipInfo(eid, { holes: equip.holes }); - // let roleName: string = session.get('roleName'); - // if (goods.length) - // await addItems(roleId, roleName, sid, goods, ITEM_CHANGE_REASON.TAKE_OUT_JEWEL); - // if (!!equip.hid) { - // let hero = await HeroModel.findByHidAndRoleWithEquip(equip.hid, roleId); - // await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_ON, sid, roleId, hero, {}, [jewel, oldJewel]); - // //任务 - // //英雄满装备且都镶嵌相同阶数的宝石 - // let { isTask, jewelLevel } = await checkTaskConditionEquipSuitJewelStage(hero) - // if (isTask) { - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUIT_JEWEL_STAGE, 1, { stage: jewelLevel }) - // } - // } - - // // 任务 - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_JEWEL, equip, [oldJewelCount]); - // await checkTaskWithArgs(roleId, sid, TASK_TYPE.EQUIP_JEWEL_STAGE, [jewel, oldJewel]); - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_JEWEL_SUM, equip, [oldJewelCount]); - // //成长任务 - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_JEWEL_SUM, 1) - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_JEWEL_STAGE, 1, { stage: jewelInfo.lvLimited }) - - // return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } }); - // } - - // //宝石合成(一键放入type:1, 合成type:2) - // public async composeJewel(msg: { jewel: number, count: number, consumes: Array<{ id: number, count: number }>, type: number }, session: BackendSession) { - // let { count, consumes, jewel, type } = msg; - // let roleId: string = session.get('roleId'); - // let roleName: string = session.get('roleName'); - // let serverId: number = session.get('serverId'); - // let sid: string = session.get('sid'); - // let goodInfo = getGoodById(jewel); - // let good = ITID.get(goodInfo.itid); - // if (good.type != CONSUME_TYPE.JEWEL) - // return resResult(STATUS.WRONG_PARMS); - // let needConsumes = checkMaterialEnough(consumes, jewel, count);//检查是否可以合成,并返回最终需要消耗的材料 - // if (!needConsumes) - // return resResult(STATUS.WRONG_PARMS); - // let res = await handleCost(roleId, sid, needConsumes, ITEM_CHANGE_REASON.JEWEL_COMPOSE); - // if (!res) - // return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); - // let result = await addItems(roleId, roleName, sid, [{ id: jewel, count: count }], ITEM_CHANGE_REASON.JEWEL_COMPOSE); - - // if (goodInfo.lvLimited >= JEWEL_PUSH_LV) { - // pushNormalItemMsg(roleId, roleName, serverId, MSG_SOURCE.JEWEL_COMPOSE, jewel, goodInfo.name); - // } - // if (type == 1) - // return resResult(STATUS.SUCCESS, { goods: result }); - - // return resResult(STATUS.SUCCESS); - // } - - // //宝石卸下 - // public async putOffHole(msg: { eid: number, id: number }, session: BackendSession) { - // let { eid, id } = msg; - // let roleId: string = session.get('roleId'); - // let roleName: string = session.get('roleName'); - - // let sid: string = session.get('sid'); - // let goods: Array<{ id: number, count: number }> = []; - // let equip = await EquipModel.getEquip(eid); - // let oldJewelCount = equip.holes.filter(cur => cur.jewel > 0).length; - // let index = findIndex(equip.holes, { id }); - // if (index < 0) - // return resResult(STATUS.EQUIP_HOLE_NOT_FIND); - // let jewel = equip.holes[index].jewel; - // if (!jewel) - // return resResult(STATUS.EQUIP_NOT_FILL_HOLE); - // goods.push({ id: jewel, count: 1 }); - // equip.holes[index].jewel = 0; - // await EquipModel.updateEquipInfo(eid, { holes: equip.holes }); - // await addItems(roleId, roleName, sid, goods, ITEM_CHANGE_REASON.TAKE_OUT_JEWEL); - // if (!!equip.hid) { - // let hero = await HeroModel.findByHidAndRole(equip.hid, roleId); - // await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_OFF, sid, roleId, hero, {}, [jewel]); - // } - - // // 任务 - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_JEWEL, equip, [oldJewelCount]); - // await checkTaskWithArgs(roleId, sid, TASK_TYPE.EQUIP_JEWEL_STAGE, [0, jewel]); - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_JEWEL_SUM, equip, [oldJewelCount]); - // return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } }); - // } - - // //宝石购买并合成 - // public async composeAndPurchaseJewel(msg: { jewel: number, count: number, consumes: Array<{ id: number, count: number }>, purchaseGoods: Array<{ id: number, count: number }> }, session: BackendSession) { - // let { count, consumes, jewel, purchaseGoods } = msg; - // let roleId: string = session.get('roleId'); - // let roleName: string = session.get('roleName'); - // let sid: string = session.get('sid'); - // const serverId = session.get('serverId'); - // let goodInfo = getGoodById(jewel); - // let good = ITID.get(goodInfo.itid); - // if (good.type != CONSUME_TYPE.JEWEL) - // return resResult(STATUS.WRONG_PARMS); - // if (!purchaseGoods) //需要购买才可进行合成的物品 - // purchaseGoods = []; - // if (!consumes) - // consumes = []; - // let needConsumes = checkMaterialEnough(consumes.concat(purchaseGoods), jewel, count);//检查是否可以合成,并返回最终需要消耗的材料 - // if (!needConsumes) - // return resResult(STATUS.WRONG_PARMS); - // let items: ItemInter[] = []; - // for (let item of purchaseGoods) { - // items.push({ id: item.id, count: item.count })//加上购买的数量 - // } - // items = items.concat(needConsumes); - // let costResult = await handleCost(roleId, sid, items, ITEM_CHANGE_REASON.JEWEL_COMPOSE);//合并消耗是否足够 - // if (!costResult) - // return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); - // await addItems(roleId, roleName, sid, [{ id: jewel, count: count }], ITEM_CHANGE_REASON.JEWEL_COMPOSE); - // if (goodInfo.lvLimited >= JEWEL_PUSH_LV) { - // pushNormalItemMsg(roleId, roleName, serverId, MSG_SOURCE.JEWEL_COMPOSE, jewel, goodInfo.name); - // } - // return resResult(STATUS.SUCCESS); - // } - // /** - // * 临时使用的购买物品,后应该在商店中购买 - // * @param msg - // * @param session - // */ - // public async purchaseGoods(msg: { purchaseGoods: Array<{ id: number, count: number }> }, session: BackendSession) { - // let { purchaseGoods } = msg; - // let roleId: string = session.get('roleId'); - // let roleName: string = session.get('roleName'); - // let sid: string = session.get('sid'); - // let result = await addItems(roleId, roleName, sid, purchaseGoods, ITEM_CHANGE_REASON.DEBUG); - // if (!result) { - // return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); - // } - // return resResult(STATUS.SUCCESS); - // } - // /** - // * 合成下一级宝石并穿戴(装备镶嵌界面) - // * @param msg - // * @param session - // */ - // public async composeNextLevelJewel(msg: { jewel: number, count: number, eid: number, id: number }, session: BackendSession) { - // let { count, jewel, eid, id } = msg; - // let roleId: string = session.get('roleId'); - // let roleName: string = session.get('roleName'); - // let sid: string = session.get('sid'); - // let serverId = session.get('serverId'); - - // let goodInfo = getGoodById(jewel); - // let good = ITID.get(goodInfo.itid); - // let needUpdate = false; - // let oldJewel: number; - // let consumes: Array<{ id: number, count: number }> = []; - // if (good.type != CONSUME_TYPE.JEWEL || !eid || eid < 0) - // return resResult(STATUS.WRONG_PARMS); - // let equip = await EquipModel.getEquip(eid); - // if (!equip) return resResult(STATUS.EQUIP_NOT_FIND); - - // let oldJewelCount = equip.holes.filter(cur => cur.jewel > 0).length; - - // let index = findIndex(equip.holes, { id }); - // //装备上该位置有穿戴该宝石,且在合成的材料中 - // if (!!equip.holes[index] && equip.holes[index].jewel == goodInfo.composeMaterial[0].id) { - // oldJewel = equip.holes[index].jewel; - // equip.holes[index].jewel = jewel;//合成后的新宝石穿戴到装备上 - // needUpdate = true; - // consumes.push({ id: goodInfo.composeMaterial[0].id, count: 1 });//ratio:1表示可以释放掉一颗宝石 - // } - - // consumes = consumes.concat(goodInfo.composeMaterial); - // if (goodInfo.specialMaterial.count) { - // consumes.push({ id: goodInfo.specialMaterial.ids[0], count: goodInfo.specialMaterial.count }) - // } - // let costResult = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.JEWEL_COMPOSE);//检查是消耗是否足够 - // if (!costResult) - // return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); - - // if (goodInfo.lvLimited >= JEWEL_PUSH_LV) { - // pushNormalItemMsg(roleId, roleName, serverId, MSG_SOURCE.JEWEL_COMPOSE, jewel, goodInfo.name); - // } - - // let result = {}; - // if (needUpdate) { - // //穿戴宝石 - // equip = await EquipModel.updateEquipInfo(eid, { holes: equip.holes }); - // if (!!equip.hid) { - // let hero = await HeroModel.findByHidAndRoleWithEquip(equip.hid, roleId); - // await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_ON, sid, roleId, hero, {}, [jewel, oldJewel]); - - // //任务 - // //英雄满装备且都镶嵌相同阶数的宝石 - // let { isTask, jewelLevel } = await checkTaskConditionEquipSuitJewelStage(hero) - // if (isTask) { - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_SUIT_JEWEL_STAGE, 1, { stage: jewelLevel }) - // } - // } - - // // 任务 - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_JEWEL, equip, [oldJewelCount]); - // await checkTaskWithArgs(roleId, sid, TASK_TYPE.EQUIP_JEWEL_STAGE, [jewel, oldJewel]); - // await checkTaskWithEquip(roleId, sid, TASK_TYPE.EQUIP_JEWEL_SUM, equip, [oldJewelCount]); - // //成长任务 - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.EQUIP_JEWEL_SUM, count) - - // return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } }); - // } else { - // result = await addItems(roleId, roleName, sid, [{ id: jewel, count: count }], ITEM_CHANGE_REASON.JEWEL_COMPOSE); - // return resResult(STATUS.SUCCESS, { goods: [{ id: jewel, count }] }); - // } - // } - - - // /** - // * @description 藏宝图合成 - // * @param {{target: number, original: Array<{id: number, count: number}>}} msg - // * @param {BackendSession} session - // * @returns - // * @memberof ComBattleHandler - // */ - // async composeBlueprt(msg: { target: number, original: Array<{ id: number, count: number }> }, session: BackendSession) { - // const roleId = session.get('roleId'); - // const roleName = session.get('roleName'); - // const sid = session.get('sid'); - // const serverId = session.get('serverId'); - - - // const { target, original } = msg; - - // // 原材料检查 - // let originalQuality: number, originalSum: number = 0; - // for (let { id, count } of original) { - // const goodInfo = gameData.goods.get(id); - // if (!originalQuality) originalQuality = goodInfo.quality; - // if (originalQuality != goodInfo.quality) { - // return resResult(STATUS.COM_BLUEPRT_QUALITY_ERROR); - // } - - // if (goodInfo.itid == IT_TYPE.BLUEPRT) { - // originalSum += count; - // } - // } - - - // const dicCompose = gameData.blurprtCompose.get(originalQuality); - // if (!dicCompose) { - // return resResult(STATUS.COM_BLUEPRT_QUALITY_CANNOT_COMPOSE); - // } - // if (originalSum != dicCompose.blueprtNum) { - // return resResult(STATUS.COM_BLUEPRT_COUNT_ERROR); - // } - - // let dicTargetInfo = gameData.goods.get(target); - // if (!dicTargetInfo) return resResult(STATUS.WRONG_PARMS); - // if (dicTargetInfo.quality != dicCompose.targetQuality) return resResult(STATUS.COM_BLUEPRT_QUALITY_ERROR); - - // // 消耗藏宝图和寻宝币 - - // let costResult = await handleCost(roleId, sid, [...original, ...dicCompose.coinNum], ITEM_CHANGE_REASON.BLUEPRT_COMPOSE); - // if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); - - // const reward = [{ id: target, count: 1 }]; - // const goods = await addItems(roleId, roleName, sid, reward, ITEM_CHANGE_REASON.BLUEPRT_COMPOSE); - // if (dicCompose.targetQuality >= QUALITY_TYPE.ORANGE) { - // const { name } = gameData.goods.get(target); - // pushNormalItemMsg(roleId, roleName, serverId, MSG_SOURCE.ORANGE_BLUEPRT_COMPOSE, target, name); - // } - // await checkTask(roleId, sid, TASK_TYPE.COM_BATTLE_BLUEPRT, 1, true, { quality: dicCompose.targetQuality }); - // await checkActivityTask(serverId, sid, roleId, TASK_TYPE.COM_BATTLE_BLUEPRT, 1, { quality: dicCompose.targetQuality }) - // return resResult(STATUS.SUCCESS, { goods, costGold: 0 }); - // } } \ No newline at end of file diff --git a/game-server/app/services/rewardService.ts b/game-server/app/services/rewardService.ts index 0b580c315..09b758c11 100644 --- a/game-server/app/services/rewardService.ts +++ b/game-server/app/services/rewardService.ts @@ -33,6 +33,7 @@ import { updateEplaces } from './equipService'; export class CheckMeterial { private roleId: string; private itemsIndb: Map = new Map(); // 玩家已有的东西 + private notEnoughItems: Map = new Map(); // 缺少的数量 private consumes: ItemInter[] = []; // 消耗,正向数 private goldId = CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD); @@ -51,18 +52,36 @@ export class CheckMeterial { } } + private pushToNotEnoughItems(id: number, count: number) { + if(!this.notEnoughItems.has(id)) { + this.notEnoughItems.set(id, 0); + } + this.notEnoughItems.set(id, this.notEnoughItems.get(id) + count); + } + + private getNotEnoughItems() { + let map = new Map(); + for(let [ id, count ] of this.notEnoughItems) { + map.set(id, count); + } + return map; + } + public async decrease(goods: {id: number, count: number}[]) { + this.notEnoughItems.clear(); let { items, gold, coin } = sortItems(goods, HANDLE_REWARD_TYPE.COST); let isEnough = true; for(let { id, count} of items) { if(!this.itemsIndb.has(id)) { - let item = await ItemModel.findbyRoleAndGidAndCount(this.roleId, id, count); + let item = await ItemModel.findbyRoleAndGid(this.roleId, id); if(!item) { + this.pushToNotEnoughItems(id, count); isEnough = false; break; } this.itemsIndb.set(id, item.count); } if(this.itemsIndb.get(id) < count) { + this.pushToNotEnoughItems(id, count - this.itemsIndb.get(id)); isEnough = false; break; } this.itemsIndb.set(id, this.itemsIndb.get(id) - count); @@ -75,7 +94,10 @@ export class CheckMeterial { this.itemsIndb.set(this.coinId, role.coin); } let goldCost = gold.reduce((pre, cur) => { return pre + cur.count }, 0); - if(this.itemsIndb.get(this.goldId) < goldCost) isEnough = false; + if(this.itemsIndb.get(this.goldId) < goldCost) { + this.pushToNotEnoughItems(this.goldId, goldCost - this.itemsIndb.get(this.goldId)); + isEnough = false; + } } if(isEnough && coin.length > 0) { if(!this.itemsIndb.has(this.coinId)) { @@ -84,13 +106,57 @@ export class CheckMeterial { this.itemsIndb.set(this.coinId, role.coin); } let coinCost = coin.reduce((pre, cur) => pre + cur, 0); - if(this.itemsIndb.get(this.coinId) < coinCost) isEnough = false; + if(this.itemsIndb.get(this.coinId) < coinCost) { + this.pushToNotEnoughItems(this.coinId, coinCost - this.itemsIndb.get(this.coinId)); + isEnough = false; + } } if(isEnough) this.consumes.push(...goods); return isEnough; } + private getMaterialEnough(materials: RewardInter[], notEnoughItems: Map) { + let newMaterials: RewardInter[] = []; + for(let {id, count} of materials) { + if(notEnoughItems.has(id)) { + newMaterials.push({ id, count: count - notEnoughItems.get(id) }); + } else { + newMaterials.push({ id, count }); + } + } + return newMaterials; + } + + // 检查地玉石是否可以合成 + public async composeStone(id: number, count: number) { + let dicStone = gameData.stone.get(id); + if(!dicStone || dicStone.composeMaterial.length <= 0) return false; // 1阶石头不能再从下合成返回不行 + let materials = dicStone.composeMaterial.map(cur => ({...cur, count: cur.count * count })); + console.log('#######materials', materials) + let isEnough = await this.decrease(materials); + console.log('#####isEnough', isEnough, this.notEnoughItems) + if(!isEnough) { + let notEnoughItems = this.getNotEnoughItems(); + let newMaterials = this.getMaterialEnough(materials, notEnoughItems); + console.log('#######newMaterials', newMaterials, this.notEnoughItems) + let isEnough = await this.decrease(newMaterials); // 消耗掉除了不足的部分以外的其他部分 + if(!isEnough) return false; + + let isAllOK = true; // 如果有石头不足,向下补充,isAllOK标识不足的都能补充上 + for(let [id, count] of notEnoughItems) { + let isEnough = await this.composeStone(id, count); + console.log('####') + if(!isEnough) { + isAllOK = false; break; + } + } + return isAllOK; + } else { + return true; + } + } + public getConsume() { return this.consumes; } diff --git a/shared/consts/constModules/sysConst.ts b/shared/consts/constModules/sysConst.ts index 53508217b..a766ec097 100644 --- a/shared/consts/constModules/sysConst.ts +++ b/shared/consts/constModules/sysConst.ts @@ -935,6 +935,9 @@ export enum ITEM_CHANGE_REASON { GET_HERO_UNLOCK_SKIN = 134, // 获得武将解锁皮肤 AP_RECOVERY = 135, // 自然恢复体力 LV_UP = 136, // 升级恢复 + EQUIP_QUALITYUP = 137, // 装备升品 + EQUIP_STARUP = 138, // 装备升星 + COMPOSE_STONE = 139, // 合成地玉石 } export enum TA_EVENT { diff --git a/shared/db/Item.ts b/shared/db/Item.ts index adb13ca92..fdea259f5 100644 --- a/shared/db/Item.ts +++ b/shared/db/Item.ts @@ -45,6 +45,11 @@ export default class Item extends BaseModel { return items; } + public static async findbyRoleAndGid(roleId: string, id: number, lean = true) { + const items: ItemType = await ItemModel.findOne({ roleId, id }).select('id count type').lean(lean); + return items; + } + public static async increaseItem(roleId: string, id: number, count: number, itemInfo: { roleId: string, roleName: string, id: number, itemName: string, type: number, hid?: number }) { const doc = new ItemModel(); const setOnInsert = Object.assign(doc.toJSON(), itemInfo); diff --git a/shared/resource/jsons/dic_goods.json b/shared/resource/jsons/dic_goods.json index 08919c519..8f65f50ce 100644 --- a/shared/resource/jsons/dic_goods.json +++ b/shared/resource/jsons/dic_goods.json @@ -5,7 +5,7 @@ "quality": 1, "image_id": "shengji_jingyanshu1", "itid": 35, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -23,7 +23,7 @@ "quality": 2, "image_id": "shengji_jingyanshu2", "itid": 35, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -41,7 +41,7 @@ "quality": 3, "image_id": "shengji_jingyanshu3", "itid": 35, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -59,7 +59,7 @@ "quality": 4, "image_id": "shengji_jingyanshu4", "itid": 35, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -77,7 +77,7 @@ "quality": 1, "image_id": "shengwang1", "itid": 36, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -95,7 +95,7 @@ "quality": 1, "image_id": "shengwang2", "itid": 36, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -113,7 +113,7 @@ "quality": 2, "image_id": "shengwang3", "itid": 36, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -131,7 +131,7 @@ "quality": 2, "image_id": "shengwang4", "itid": 36, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -149,7 +149,7 @@ "quality": 4, "image_id": "yupei", "itid": 49, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2399,7 +2399,7 @@ "quality": 5, "image_id": "wujiangjuexingshi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2417,7 +2417,7 @@ "quality": 1, "image_id": "xunliandan_baihu_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2435,7 +2435,7 @@ "quality": 1, "image_id": "xunliandan_xuanwu_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2453,7 +2453,7 @@ "quality": 1, "image_id": "xunliandan_qinglong_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2471,7 +2471,7 @@ "quality": 1, "image_id": "xunliandan_zhuque_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2489,7 +2489,7 @@ "quality": 1, "image_id": "xunliandan_qilin_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2507,7 +2507,7 @@ "quality": 1, "image_id": "xunliandan_baihu_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2525,7 +2525,7 @@ "quality": 1, "image_id": "xunliandan_xuanwu_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2543,7 +2543,7 @@ "quality": 1, "image_id": "xunliandan_qinglong_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2561,7 +2561,7 @@ "quality": 1, "image_id": "xunliandan_zhuque_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2579,7 +2579,7 @@ "quality": 1, "image_id": "xunliandan_qilin_lan", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2597,7 +2597,7 @@ "quality": 2, "image_id": "xunliandan_baihu_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2615,7 +2615,7 @@ "quality": 2, "image_id": "xunliandan_xuanwu_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2633,7 +2633,7 @@ "quality": 2, "image_id": "xunliandan_qinglong_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2651,7 +2651,7 @@ "quality": 2, "image_id": "xunliandan_zhuque_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2669,7 +2669,7 @@ "quality": 2, "image_id": "xunliandan_qilin_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2687,7 +2687,7 @@ "quality": 2, "image_id": "xunliandan_baihu_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2705,7 +2705,7 @@ "quality": 2, "image_id": "xunliandan_xuanwu_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2723,7 +2723,7 @@ "quality": 2, "image_id": "xunliandan_qinglong_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2741,7 +2741,7 @@ "quality": 2, "image_id": "xunliandan_zhuque_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2759,7 +2759,7 @@ "quality": 2, "image_id": "xunliandan_qilin_zi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2777,7 +2777,7 @@ "quality": 3, "image_id": "xunliandan_baihu_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2795,7 +2795,7 @@ "quality": 3, "image_id": "xunliandan_xuanwu_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2813,7 +2813,7 @@ "quality": 3, "image_id": "xunliandan_qinglong_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2831,7 +2831,7 @@ "quality": 3, "image_id": "xunliandan_zhuque_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2849,7 +2849,7 @@ "quality": 3, "image_id": "xunliandan_qilin_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2867,7 +2867,7 @@ "quality": 3, "image_id": "xunliandan_baihu_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2885,7 +2885,7 @@ "quality": 3, "image_id": "xunliandan_xuanwu_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2903,7 +2903,7 @@ "quality": 3, "image_id": "xunliandan_qinglong_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2921,7 +2921,7 @@ "quality": 3, "image_id": "xunliandan_zhuque_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2939,7 +2939,7 @@ "quality": 3, "image_id": "xunliandan_qilin_cheng", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2957,7 +2957,7 @@ "quality": 4, "image_id": "xunliandan_baihu_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2975,7 +2975,7 @@ "quality": 4, "image_id": "xunliandan_xuanwu_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -2993,7 +2993,7 @@ "quality": 4, "image_id": "xunliandan_qinglong_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3011,7 +3011,7 @@ "quality": 4, "image_id": "xunliandan_zhuque_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3029,7 +3029,7 @@ "quality": 4, "image_id": "xunliandan_qilin_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3047,7 +3047,7 @@ "quality": 4, "image_id": "xunliandan_baihu_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3065,7 +3065,7 @@ "quality": 4, "image_id": "xunliandan_xuanwu_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3083,7 +3083,7 @@ "quality": 4, "image_id": "xunliandan_qinglong_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3101,7 +3101,7 @@ "quality": 4, "image_id": "xunliandan_zhuque_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3119,7 +3119,7 @@ "quality": 4, "image_id": "xunliandan_qilin_hong", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3137,7 +3137,7 @@ "quality": 5, "image_id": "jinjie_hufu", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3155,7 +3155,7 @@ "quality": 5, "image_id": "bailianzao", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3173,7 +3173,7 @@ "quality": 5, "image_id": "xilianshi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3191,7 +3191,7 @@ "quality": 5, "image_id": "qiankunsuo", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3209,7 +3209,7 @@ "quality": 1, "image_id": "juewei_1", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3227,7 +3227,7 @@ "quality": 2, "image_id": "juewei_4", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3245,7 +3245,7 @@ "quality": 3, "image_id": "juewei_3", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3263,7 +3263,7 @@ "quality": 4, "image_id": "juewei_2", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3281,7 +3281,7 @@ "quality": 5, "image_id": "juewei_5", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3299,7 +3299,7 @@ "quality": 1, "image_id": "gengjin", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3317,7 +3317,7 @@ "quality": 1, "image_id": "shenxiang_yushi", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3335,7 +3335,7 @@ "quality": 1, "image_id": "shenxiang_yusui", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3353,7 +3353,7 @@ "quality": 1, "image_id": "bintie", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3371,7 +3371,7 @@ "quality": 5, "image_id": "tianwaiyunjin", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3389,7 +3389,7 @@ "quality": 5, "image_id": "xirang", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -3407,7 +3407,7 @@ "quality": 5, "image_id": "bailianzao", "itid": 38, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4469,7 +4469,7 @@ "quality": 1, "image_id": "baotu_lan_jian", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4487,7 +4487,7 @@ "quality": 1, "image_id": "baotu_zi_jian", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4505,7 +4505,7 @@ "quality": 2, "image_id": "baotu_cheng_jian", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4523,7 +4523,7 @@ "quality": 2, "image_id": "baotu_hong_jian", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4541,7 +4541,7 @@ "quality": 3, "image_id": "baotu_lan_yifu", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4559,7 +4559,7 @@ "quality": 3, "image_id": "baotu_zi_yifu", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4577,7 +4577,7 @@ "quality": 4, "image_id": "baotu_cheng_yifu", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4595,7 +4595,7 @@ "quality": 4, "image_id": "baotu_hong_yifu", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4613,7 +4613,7 @@ "quality": 5, "image_id": "baotu_lan_toukui", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4631,7 +4631,7 @@ "quality": 1, "image_id": "baotu_zi_toukui", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4649,7 +4649,7 @@ "quality": 1, "image_id": "baotu_cheng_toukui", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4667,7 +4667,7 @@ "quality": 2, "image_id": "baotu_hong_toukui", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4685,7 +4685,7 @@ "quality": 2, "image_id": "baotu_lan_xiezi", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4703,7 +4703,7 @@ "quality": 3, "image_id": "baotu_zi_xiezi", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4721,7 +4721,7 @@ "quality": 3, "image_id": "baotu_cheng_xiezi", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4739,7 +4739,7 @@ "quality": 4, "image_id": "baotu_hong_xiezi", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4757,7 +4757,7 @@ "quality": 4, "image_id": "baotu_lan_juanzhou", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4775,7 +4775,7 @@ "quality": 5, "image_id": "baotu_zi_juanzhou", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4793,7 +4793,7 @@ "quality": 1, "image_id": "baotu_cheng_juanzhou", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4811,7 +4811,7 @@ "quality": 1, "image_id": "baotu_hong_juanzhou", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4829,7 +4829,7 @@ "quality": 2, "image_id": "baotu_lan_jiezhi", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4847,7 +4847,7 @@ "quality": 2, "image_id": "baotu_zi_jiezhi", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4865,7 +4865,7 @@ "quality": 3, "image_id": "baotu_cheng_jiezhi", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4883,7 +4883,7 @@ "quality": 3, "image_id": "baotu_hong_jiezhi", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4901,7 +4901,7 @@ "quality": 4, "image_id": "baotu_lan_jian", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4919,7 +4919,7 @@ "quality": 4, "image_id": "baotu_zi_jian", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4937,7 +4937,7 @@ "quality": 5, "image_id": "baotu_cheng_jian", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4955,7 +4955,7 @@ "quality": 1, "image_id": "baotu_hong_jian", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4973,7 +4973,7 @@ "quality": 1, "image_id": "baotu_lan_yifu", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -4991,7 +4991,7 @@ "quality": 2, "image_id": "baotu_zi_yifu", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -5009,7 +5009,7 @@ "quality": 2, "image_id": "baotu_cheng_yifu", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -5027,7 +5027,7 @@ "quality": 3, "image_id": "baotu_hong_yifu", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -5045,7 +5045,7 @@ "quality": 3, "image_id": "baotu_lan_toukui", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -5063,7 +5063,7 @@ "quality": 4, "image_id": "baotu_zi_toukui", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -5081,7 +5081,7 @@ "quality": 4, "image_id": "baotu_cheng_toukui", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -5099,7 +5099,7 @@ "quality": 5, "image_id": "baotu_hong_toukui", "itid": 28, - "goodType": 4, + "goodType": 3, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -8033,7 +8033,7 @@ "quality": 1, "image_id": "shaoroubox", "itid": 55, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -8051,7 +8051,7 @@ "quality": 1, "image_id": 72011, "itid": 56, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -8069,7 +8069,7 @@ "quality": 2, "image_id": 72021, "itid": 56, - "goodType": 1, + "goodType": 2, "redPoint": 0, "decomposeItem": "&", "hid": 0, @@ -8105,7 +8105,7 @@ "quality": 1, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&100", "hid": 0, @@ -8123,7 +8123,7 @@ "quality": 1, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&200", "hid": 0, @@ -8141,7 +8141,7 @@ "quality": 2, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&300", "hid": 0, @@ -8159,7 +8159,7 @@ "quality": 2, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&400", "hid": 0, @@ -8177,7 +8177,7 @@ "quality": 3, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&500", "hid": 0, @@ -8195,7 +8195,7 @@ "quality": 3, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&600", "hid": 0, @@ -8213,7 +8213,7 @@ "quality": 4, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&700", "hid": 0, @@ -8231,7 +8231,7 @@ "quality": 4, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&800", "hid": 0, @@ -8249,7 +8249,7 @@ "quality": 5, "image_id": 72021, "itid": 59, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&900", "hid": 0, @@ -8267,7 +8267,7 @@ "quality": 1, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&100", "hid": 0, @@ -8285,7 +8285,7 @@ "quality": 1, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&200", "hid": 0, @@ -8303,7 +8303,7 @@ "quality": 2, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&300", "hid": 0, @@ -8321,7 +8321,7 @@ "quality": 2, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&400", "hid": 0, @@ -8339,7 +8339,7 @@ "quality": 3, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&500", "hid": 0, @@ -8357,7 +8357,7 @@ "quality": 3, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&600", "hid": 0, @@ -8375,7 +8375,7 @@ "quality": 4, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&700", "hid": 0, @@ -8393,7 +8393,7 @@ "quality": 4, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&800", "hid": 0, @@ -8411,7 +8411,7 @@ "quality": 5, "image_id": 72021, "itid": 60, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&900", "hid": 0, @@ -8429,7 +8429,7 @@ "quality": 1, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&100", "hid": 0, @@ -8447,7 +8447,7 @@ "quality": 1, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&200", "hid": 0, @@ -8465,7 +8465,7 @@ "quality": 2, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&300", "hid": 0, @@ -8483,7 +8483,7 @@ "quality": 2, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&400", "hid": 0, @@ -8501,7 +8501,7 @@ "quality": 3, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&500", "hid": 0, @@ -8519,7 +8519,7 @@ "quality": 3, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&600", "hid": 0, @@ -8537,7 +8537,7 @@ "quality": 4, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&700", "hid": 0, @@ -8555,7 +8555,7 @@ "quality": 4, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&800", "hid": 0, @@ -8573,7 +8573,7 @@ "quality": 5, "image_id": 72021, "itid": 61, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&900", "hid": 0, @@ -8591,7 +8591,7 @@ "quality": 1, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&100", "hid": 0, @@ -8609,7 +8609,7 @@ "quality": 1, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&200", "hid": 0, @@ -8627,7 +8627,7 @@ "quality": 2, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&300", "hid": 0, @@ -8645,7 +8645,7 @@ "quality": 2, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&400", "hid": 0, @@ -8663,7 +8663,7 @@ "quality": 3, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&500", "hid": 0, @@ -8681,7 +8681,7 @@ "quality": 3, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&600", "hid": 0, @@ -8699,7 +8699,7 @@ "quality": 4, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&700", "hid": 0, @@ -8717,7 +8717,7 @@ "quality": 4, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&800", "hid": 0, @@ -8735,7 +8735,7 @@ "quality": 5, "image_id": 72021, "itid": 62, - "goodType": 14, + "goodType": 4, "redPoint": 0, "decomposeItem": "40002&900", "hid": 0,