diff --git a/game-server/app/servers/guild/handler/raceActivityHandler.ts b/game-server/app/servers/guild/handler/raceActivityHandler.ts index 13561c7dd..4b4f4c781 100644 --- a/game-server/app/servers/guild/handler/raceActivityHandler.ts +++ b/game-server/app/servers/guild/handler/raceActivityHandler.ts @@ -132,6 +132,7 @@ export class RaceActivityHandler { let sid = session.get('sid'); let {id, count, toGuild} = msg; + if(!count || count < 0) return resResult(STATUS.WRONG_PARMS); let obj = getRaceActivityObj(); let woodenHorse = obj.getWoodenHorse(toGuild, serverId); if(!woodenHorse) return resResult(STATUS.WRONG_PARMS); diff --git a/game-server/app/servers/role/handler/shopHandler.ts b/game-server/app/servers/role/handler/shopHandler.ts index fbcf32d50..11119ee74 100644 --- a/game-server/app/servers/role/handler/shopHandler.ts +++ b/game-server/app/servers/role/handler/shopHandler.ts @@ -1,13 +1,15 @@ import { Application, BackendSession } from "pinus"; import { gameData } from "../../../pubUtils/data"; import { resResult } from "../../../pubUtils/util"; -import { STATUS, GUILD_STRUCTURE } from "../../../consts"; +import { STATUS, GUILD_STRUCTURE, ITID, CONSUME_TYPE, HERO_QUALITY_TYPE } from "../../../consts"; import { DicShopListModel } from "../../../db/DicShopList"; import { ShopItem } from "../../../domain/dbGeneral"; import { ShopItemListParam } from '../../../domain/roleField/shop'; import { UserShopModel } from "../../../db/UserShop"; import { handleCost, addItems } from "../../../services/rewardService"; import { GuildModel } from "../../../db/Guild"; +import { SHOP } from "../../../pubUtils/dicParam"; +import { getHonourObject } from "../../../pubUtils/itemUtils"; export default function(app: Application) { return new ShopHandler(app); @@ -135,7 +137,44 @@ export class ShopHandler { // 将魂回收 async recycleSoul(msg: { goodsId: number, count: number }, session: BackendSession) { - + let roleId = session.get('roleId'); + let roleName = session.get('roleName'); + let sid = session.get('sid'); + let { goodsId, count } = msg; + if(!count || count < 0) return resResult(STATUS.WRONG_PARMS); + + let dicGoods = gameData.goods.get(goodsId); + if(!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND); + let dicItid = ITID.get(dicGoods.itid); + if(!dicItid) return resResult(STATUS.DIC_DATA_NOT_FOUND); + if(dicItid.type != CONSUME_TYPE.SOUL) { + return resResult(STATUS.ITEM_NOT_SOUL); + } + + // 检查自己的数量 + let cost = [{ + id: goodsId, count + }]; + let costResult = await handleCost(roleId, sid, cost); + if(!costResult) return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); + + let honour = 0; + switch (dicGoods.quality) { + case HERO_QUALITY_TYPE.BLUE: + honour = SHOP.HERO_SOUL_BULE * count; break; + case HERO_QUALITY_TYPE.PURPLE: + honour = SHOP.HERO_SOUL_PURPLE * count; break; + case HERO_QUALITY_TYPE.GOLD: + honour = SHOP.HERO_SOUL_GOLDEN * count; break; + } + // 增加功勋 + let reward = getHonourObject(honour); + let goods = await addItems(roleId, roleName, sid, [reward]); + + return resResult(STATUS.SUCCESS, { + goodsId, count, + goods + }); } // !测试接口,初始化:将json表中的内容加入数据库内 diff --git a/shared/consts/constModules/itemConst.ts b/shared/consts/constModules/itemConst.ts index d6fc9bbc2..36830095d 100644 --- a/shared/consts/constModules/itemConst.ts +++ b/shared/consts/constModules/itemConst.ts @@ -199,6 +199,13 @@ export const RANDOM_SE_COUNT = new Map([ [QUALITY_TYPE.GOLD, 4] ]); + +export enum HERO_QUALITY_TYPE { + BLUE = 1, // 蓝将 + PURPLE = 2, // 紫将 + GOLD = 3, // 金 +} + export const FIX_ATTRIBUTES_RAN = 20; // 固定属性值+-20%随机 diff --git a/shared/consts/statusCode.ts b/shared/consts/statusCode.ts index 5bd209b9c..988d08442 100644 --- a/shared/consts/statusCode.ts +++ b/shared/consts/statusCode.ts @@ -306,6 +306,7 @@ export const STATUS = { // 商店相关 30900-31000 BUY_COUNT_OVER: { code: 30900, simStr: '已超过限购次数' }, GUILD_LV_LIMIT: { code: 30901, simStr: '军团等级不足' }, + ITEM_NOT_SOUL: { code: 30902, simStr: '该物品不是将魂' }, // 社交相关状态 40000 - 49999 SYS_CHANNEL_AUTH_NOT_ENOUGH: {code: 40000, simStr: '无法在系统频道发送消息'}, diff --git a/shared/resource/jsons/dic_zyz_gk_dungeon.json b/shared/resource/jsons/dic_zyz_gk_dungeon.json index 21cbcd4bb..749eff59e 100644 --- a/shared/resource/jsons/dic_zyz_gk_dungeon.json +++ b/shared/resource/jsons/dic_zyz_gk_dungeon.json @@ -52,8 +52,8 @@ "bossSkill": "249&251" }, { - "war_id": 5003, - "dispatchJsonId": 5003, + "war_id": 5020, + "dispatchJsonId": 5020, "bg_img_id": 550, "script_id": 0, "fixReward": "11004&4|17002&8|17007&6|17008&5", @@ -78,8 +78,8 @@ "bossSkill": "18&19" }, { - "war_id": 5004, - "dispatchJsonId": 5004, + "war_id": 5030, + "dispatchJsonId": 5030, "bg_img_id": 550, "script_id": 0, "fixReward": "11004&1|17001&10|17005&2|17006&4", @@ -104,8 +104,8 @@ "bossSkill": "18&19" }, { - "war_id": 5005, - "dispatchJsonId": 5005, + "war_id": 5040, + "dispatchJsonId": 5040, "bg_img_id": 550, "script_id": 0, "fixReward": "11004&1|17002&10|17007&2|17008&4", @@ -130,8 +130,8 @@ "bossSkill": "18&19" }, { - "war_id": 5006, - "dispatchJsonId": 5006, + "war_id": 5050, + "dispatchJsonId": 5050, "bg_img_id": 550, "script_id": 0, "fixReward": "11004&4|17002&8|17007&6|17008&6", @@ -156,8 +156,8 @@ "bossSkill": "18&19" }, { - "war_id": 5007, - "dispatchJsonId": 5007, + "war_id": 5060, + "dispatchJsonId": 5060, "bg_img_id": 550, "script_id": 0, "fixReward": "11004&1|17001&10|17005&2|17006&5",