装备:合成逻辑修改
This commit is contained in:
@@ -10,7 +10,7 @@ import Role from "../../../db/Role";
|
||||
import { calPlayerCeAndSave } from "../../../services/playerCeService";
|
||||
import { getHeroJob, getGoodById, gameData, getHeroEquipByClassId } from "../../../pubUtils/data";
|
||||
import { EQUIP } from "../../../pubUtils/dicParam";
|
||||
import { ITID, SPEICAL_ITEM, QUALITY_TYPE, equipTypeToSortAttr } from "../../../consts/constModules/itemConst";
|
||||
import { ITID, SPEICAL_ITEM, QUALITY_TYPE, equipTypeToSortAttr, IT_TYPE } from "../../../consts/constModules/itemConst";
|
||||
import { changeEquip, dressEquip, checkMaterialEnough, takeOffEquipAndCalPlayerCe } from "../../../services/equipService";
|
||||
|
||||
import { indexOf, findIndex } from 'underscore';
|
||||
@@ -43,7 +43,7 @@ export class EquipHandler {
|
||||
let roleId: string = session.get('roleId');
|
||||
let roleName: string = session.get('roleName');
|
||||
let sid: string = session.get('sid');
|
||||
const serverId = session.get('serverId');
|
||||
const serverId: number = session.get('serverId');
|
||||
// 消耗材料
|
||||
// 获得装备
|
||||
let { gid, originalEquip } = msg;
|
||||
@@ -52,16 +52,21 @@ export class EquipHandler {
|
||||
let targetGood = gameData.goods.get(gid);
|
||||
if (!targetGood) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
let cost = new Array<ItemInter>();
|
||||
let cost: ItemInter[] = [];
|
||||
let jewels: ItemInter[] = []; // 需要返还的镶嵌在装备上的宝石
|
||||
if (targetGood.suitId > 0) { // 套装
|
||||
cost = cost.concat(targetGood.composeMaterial);
|
||||
let specialMaterial = targetGood.specialMaterial;
|
||||
let costCount = 0;
|
||||
let equips = await EquipModel.getEquips(originalEquip);
|
||||
for (let { id, seqId } of equips) {
|
||||
for (let equip of equips) {
|
||||
let { id, seqId, holes } = equip;
|
||||
if (specialMaterial.ids.includes(id)) {
|
||||
costCount++;
|
||||
cost.push({ id, seqId, count: 1 });
|
||||
for(let { jewel } of holes) {
|
||||
if(jewel > 0) jewels.push({ id: jewel, count: 1});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (specialMaterial.count > costCount) {
|
||||
@@ -77,6 +82,7 @@ export class EquipHandler {
|
||||
let result = await handleCost(roleId, sid, cost);
|
||||
if (!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
|
||||
await addItems(roleId, roleName, sid, jewels); // 宝石返还
|
||||
let items = [{ id: gid, count: 1 }];
|
||||
let goods = await addItems(roleId, roleName, sid, items);
|
||||
if (targetGood.suitId) {
|
||||
@@ -462,17 +468,24 @@ export class EquipHandler {
|
||||
if (equips.length < originalEquip.length)
|
||||
return resResult(STATUS.EQUIP_NOT_FIND);
|
||||
let goods: Array<{ id: number, count: number }> = [];
|
||||
let jewels: ItemInter[] = []; // 宝石返还
|
||||
for (let equip of equips) {
|
||||
if (!!equip.hid)
|
||||
return resResult(STATUS.EQUIP_IS_EQUIPED_NOT_DECOMPOSE);
|
||||
let goodInfo = getGoodById(equip.id);
|
||||
if (!goodInfo)
|
||||
return resResult(STATUS.EQUIP_NOT_FIND);
|
||||
|
||||
let holes = equip.holes||[];
|
||||
for(let { jewel } of holes) {
|
||||
jewels.push({ id: jewel, count: 1 });
|
||||
}
|
||||
goods = goods.concat(goodInfo.decomposeItem);
|
||||
}
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
await EquipModel.deleteEquips(originalEquip);
|
||||
this.app.get('channelService').pushMessageByUids('onEquipDel', resResult(STATUS.SUCCESS, { equips: originalEquip }), uids);
|
||||
await addItems(roleId, roleName, sid, jewels); // 把原本镶嵌在装备上的宝石返还了
|
||||
let result = await addItems(roleId, roleName, sid, goods);
|
||||
return resResult(STATUS.SUCCESS, { goods: result });
|
||||
}
|
||||
@@ -854,4 +867,69 @@ export class EquipHandler {
|
||||
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 funcs: number[] = session.get('funcs');
|
||||
|
||||
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);
|
||||
|
||||
// 添加寻宝币
|
||||
original.push({
|
||||
id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.TREASURE_POINT),
|
||||
count: dicCompose.coinNum
|
||||
});
|
||||
// 消耗藏宝图和寻宝币
|
||||
|
||||
let costResult = await handleCost(roleId, sid, original);
|
||||
if(!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
|
||||
const reward = [{id: target, count: 1}];
|
||||
const goods = await addItems(roleId, roleName, sid, reward);
|
||||
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, funcs, TASK_TYPE.COM_BATTLE_BLUEPRT, 1, true, { quality: dicCompose.targetQuality });
|
||||
|
||||
return resResult(STATUS.SUCCESS, { goods, costGold: 0 });
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"type": 102,
|
||||
"gainValue": "2&0",
|
||||
"type": 200,
|
||||
"gainValue": "2&20&1000",
|
||||
"index": 2,
|
||||
"Min": 5,
|
||||
"Max": 10,
|
||||
"Min": 20,
|
||||
"Max": 40,
|
||||
"info": "物攻提高",
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
@@ -14,11 +14,11 @@
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": 102,
|
||||
"gainValue": "1&0",
|
||||
"type": 200,
|
||||
"gainValue": "1&20&1000",
|
||||
"index": 2,
|
||||
"Min": 5,
|
||||
"Max": 10,
|
||||
"Min": 20,
|
||||
"Max": 40,
|
||||
"info": "生命值提高",
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
@@ -27,24 +27,11 @@
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": 102,
|
||||
"gainValue": "3&0",
|
||||
"type": 200,
|
||||
"gainValue": "4&20&1000",
|
||||
"index": 2,
|
||||
"Min": 5,
|
||||
"Max": 10,
|
||||
"info": "策攻提高",
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": 102,
|
||||
"gainValue": "4&0",
|
||||
"index": 2,
|
||||
"Min": 5,
|
||||
"Max": 10,
|
||||
"Min": 20,
|
||||
"Max": 40,
|
||||
"info": "物防提高",
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
@@ -52,12 +39,12 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": 102,
|
||||
"gainValue": "5&0",
|
||||
"id": 4,
|
||||
"type": 200,
|
||||
"gainValue": "5&20&1000",
|
||||
"index": 2,
|
||||
"Min": 5,
|
||||
"Max": 10,
|
||||
"Min": 20,
|
||||
"Max": 40,
|
||||
"info": "策防提高",
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
@@ -65,8 +52,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": 102,
|
||||
"id": 5,
|
||||
"type": 200,
|
||||
"gainValue": "6&0",
|
||||
"index": 2,
|
||||
"Min": 5,
|
||||
@@ -78,8 +65,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"type": 102,
|
||||
"id": 6,
|
||||
"type": 200,
|
||||
"gainValue": "7&0",
|
||||
"index": 2,
|
||||
"Min": 5,
|
||||
@@ -91,8 +78,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": 101,
|
||||
"id": 7,
|
||||
"type": 200,
|
||||
"gainValue": "2&0",
|
||||
"index": 2,
|
||||
"Min": 200,
|
||||
@@ -104,8 +91,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"type": 101,
|
||||
"id": 8,
|
||||
"type": 200,
|
||||
"gainValue": "1&0",
|
||||
"index": 2,
|
||||
"Min": 200,
|
||||
@@ -117,8 +104,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"type": 101,
|
||||
"id": 9,
|
||||
"type": 200,
|
||||
"gainValue": "3&0",
|
||||
"index": 2,
|
||||
"Min": 200,
|
||||
@@ -130,8 +117,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"type": 101,
|
||||
"id": 10,
|
||||
"type": 200,
|
||||
"gainValue": "4&0",
|
||||
"index": 2,
|
||||
"Min": 200,
|
||||
@@ -143,8 +130,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"type": 101,
|
||||
"id": 11,
|
||||
"type": 200,
|
||||
"gainValue": "5&0",
|
||||
"index": 2,
|
||||
"Min": 200,
|
||||
@@ -156,8 +143,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"type": 101,
|
||||
"id": 12,
|
||||
"type": 200,
|
||||
"gainValue": "6&0",
|
||||
"index": 2,
|
||||
"Min": 200,
|
||||
@@ -169,8 +156,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"type": 101,
|
||||
"id": 13,
|
||||
"type": 200,
|
||||
"gainValue": "7&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -182,8 +169,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"type": 101,
|
||||
"id": 14,
|
||||
"type": 200,
|
||||
"gainValue": "8&0",
|
||||
"index": 2,
|
||||
"Min": 1,
|
||||
@@ -195,8 +182,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"type": 101,
|
||||
"id": 15,
|
||||
"type": 200,
|
||||
"gainValue": "9&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -208,8 +195,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"type": 101,
|
||||
"id": 16,
|
||||
"type": 200,
|
||||
"gainValue": "10&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -221,8 +208,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"type": 101,
|
||||
"id": 17,
|
||||
"type": 200,
|
||||
"gainValue": "11&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -234,8 +221,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"type": 101,
|
||||
"id": 18,
|
||||
"type": 200,
|
||||
"gainValue": "12&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -247,8 +234,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"type": 101,
|
||||
"id": 19,
|
||||
"type": 200,
|
||||
"gainValue": "13&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -260,8 +247,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"type": 101,
|
||||
"id": 20,
|
||||
"type": 200,
|
||||
"gainValue": "14&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -273,8 +260,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"type": 101,
|
||||
"id": 21,
|
||||
"type": 200,
|
||||
"gainValue": "15&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -286,8 +273,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"type": 101,
|
||||
"id": 22,
|
||||
"type": 200,
|
||||
"gainValue": "16&0",
|
||||
"index": 2,
|
||||
"Min": 5000,
|
||||
@@ -299,8 +286,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 24,
|
||||
"type": 101,
|
||||
"id": 23,
|
||||
"type": 200,
|
||||
"gainValue": "1&10",
|
||||
"index": 0,
|
||||
"Min": 0,
|
||||
@@ -312,8 +299,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 25,
|
||||
"type": 101,
|
||||
"id": 24,
|
||||
"type": 200,
|
||||
"gainValue": "2&20",
|
||||
"index": 0,
|
||||
"Min": 0,
|
||||
@@ -325,8 +312,8 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 26,
|
||||
"type": 101,
|
||||
"id": 25,
|
||||
"type": 200,
|
||||
"gainValue": "10&50000",
|
||||
"index": 0,
|
||||
"Min": 0,
|
||||
@@ -338,7 +325,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 27,
|
||||
"id": 26,
|
||||
"type": 301,
|
||||
"gainValue": "0&2",
|
||||
"index": 1,
|
||||
@@ -351,7 +338,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 28,
|
||||
"id": 27,
|
||||
"type": 301,
|
||||
"gainValue": "0&2",
|
||||
"index": 1,
|
||||
@@ -364,7 +351,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 29,
|
||||
"id": 28,
|
||||
"type": 314,
|
||||
"gainValue": "0&2&10",
|
||||
"index": 1,
|
||||
@@ -377,7 +364,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 30,
|
||||
"id": 29,
|
||||
"type": 314,
|
||||
"gainValue": "0&2&10",
|
||||
"index": 1,
|
||||
@@ -389,24 +376,24 @@
|
||||
"__EMPTY_2": 0,
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 30,
|
||||
"type": 401,
|
||||
"gainValue": "0&132",
|
||||
"index": 1,
|
||||
"Min": 50,
|
||||
"Max": 70,
|
||||
"info": "攻击或法术时%d概率给对方添加debuff致残",
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 31,
|
||||
"type": 401,
|
||||
"gainValue": "0&132",
|
||||
"index": 1,
|
||||
"Min": 50,
|
||||
"Max": 70,
|
||||
"info": "攻击或法术时%d概率给对方添加debuff致残",
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 32,
|
||||
"type": 401,
|
||||
"gainValue": "0&132",
|
||||
"index": 1,
|
||||
"Min": 20,
|
||||
"Max": 50,
|
||||
"info": "攻击或法术时%d概率给对方添加debuff致残",
|
||||
@@ -416,7 +403,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 33,
|
||||
"id": 32,
|
||||
"type": 314,
|
||||
"gainValue": "0&2&10",
|
||||
"index": 1,
|
||||
@@ -429,7 +416,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 34,
|
||||
"id": 33,
|
||||
"type": 425,
|
||||
"gainValue": "50&0",
|
||||
"index": 2,
|
||||
@@ -442,7 +429,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 35,
|
||||
"id": 34,
|
||||
"type": 425,
|
||||
"gainValue": "50&0",
|
||||
"index": 2,
|
||||
@@ -455,7 +442,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 36,
|
||||
"id": 35,
|
||||
"type": 504,
|
||||
"gainValue": "0&",
|
||||
"index": 1,
|
||||
@@ -468,7 +455,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 37,
|
||||
"id": 36,
|
||||
"type": 504,
|
||||
"gainValue": "0&",
|
||||
"index": 1,
|
||||
@@ -481,7 +468,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 38,
|
||||
"id": 37,
|
||||
"type": 504,
|
||||
"gainValue": "0&",
|
||||
"index": 1,
|
||||
@@ -494,7 +481,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 39,
|
||||
"id": 38,
|
||||
"type": 314,
|
||||
"gainValue": "0&2&10",
|
||||
"index": 1,
|
||||
@@ -507,7 +494,7 @@
|
||||
"__EMPTY_3": 0
|
||||
},
|
||||
{
|
||||
"id": 40,
|
||||
"id": 39,
|
||||
"type": 314,
|
||||
"gainValue": "0&2&10",
|
||||
"index": 1,
|
||||
|
||||
Reference in New Issue
Block a user