diff --git a/src/api_s2c/heroskin/ApiTakeOff.ts b/src/api_s2c/heroskin/ApiTakeOff.ts new file mode 100644 index 0000000..e097c0e --- /dev/null +++ b/src/api_s2c/heroskin/ApiTakeOff.ts @@ -0,0 +1,20 @@ +import { ApiCall } from "tsrpc"; +import { ReqTakeOff, ResTakeOff } from "../../shared/protocols/heroskin/PtlTakeOff"; +import { HeroFun } from "../../public/hero"; + +export default async function (call: ApiCall) { + let hero = await HeroFun.getHero(call, call.req.heroOid); + if (!hero) { // 英雄不存在 + call.error(lng.hero_1); + return; + } + + if (!hero.skin) { // 没有穿戴皮肤 + call.error(lng.hero_22); + return; + } + + HeroFun.changeHeroAttr(call, hero, { skin: "" }); + + call.succ({}); +} \ No newline at end of file diff --git a/src/api_s2c/heroskin/ApiUplv.ts b/src/api_s2c/heroskin/ApiUplv.ts new file mode 100644 index 0000000..d8ed43b --- /dev/null +++ b/src/api_s2c/heroskin/ApiUplv.ts @@ -0,0 +1,36 @@ +import { ApiCall } from "tsrpc"; +import HeroSkinFun from "../../public/heroskin"; +import { PlayerFun } from "../../public/player"; +import { ReqUplv, ResUplv } from "../../shared/protocols/heroskin/PtlUplv"; + + +export default async function (call: ApiCall) { + let skin = HeroSkinFun.getHeroSkin(call); + if (!skin[call.req.skid]) {// 皮肤未获得 + call.error(lng.hero_20); + } + + let cur_lv = skin[call.req.skid]; + let skinconf = G.gc.heroSkin[skin.skid]; + + let need = []; + for (let i = 0; i < call.req.lv; i++) { + need.concat( + G.gc.heroSkinLv[skinconf.colour][cur_lv + i].need + ) + } + + // 检测消耗 + await PlayerFun.checkNeedIsMeet(call, need); + + // 扣除消耗 + await PlayerFun.cutNeed(call, need); + + // 更新等级 + skin[call.req.skid] = cur_lv + call.req.lv; + + // 更新skinlv + HeroSkinFun.updateHeroSkinLv(call, { [call.req.skid]: cur_lv + call.req.lv }); + + call.succ({}); +} \ No newline at end of file diff --git a/src/api_s2c/heroskin/ApiWear.ts b/src/api_s2c/heroskin/ApiWear.ts new file mode 100644 index 0000000..ed42a15 --- /dev/null +++ b/src/api_s2c/heroskin/ApiWear.ts @@ -0,0 +1,28 @@ +import { ApiCall } from "tsrpc"; +import { HeroFun } from "../../public/hero"; +import HeroSkinFun from "../../public/heroskin"; +import { ReqWear, ResWear } from "../../shared/protocols/heroskin/PtlWear"; + +export default async function (call: ApiCall) { + let hero = await HeroFun.getHero(call, call.req.heroOid); + if (!hero) { // 英雄不存在 + call.error(lng.hero_1); + return; + } + + let skin = HeroSkinFun.getHeroSkin(call); + if (!skin || !skin[call.req.skid]) { // 皮肤不存在 + call.error(lng.hero_20); + return; + } + + let skinconf = G.gc.heroSkin[skin.skid]; + if (skinconf.heroid != hero.heroId) { // 皮肤不属于该英雄 + call.error(lng.hero_21); + return; + } + + HeroFun.changeHeroAttr(call, hero, { skin: call.req.skid }); + + call.succ({}); +} \ No newline at end of file diff --git a/src/cross/protocols/serviceProto.ts b/src/cross/protocols/serviceProto.ts index 4dbf718..c3f6feb 100644 --- a/src/cross/protocols/serviceProto.ts +++ b/src/cross/protocols/serviceProto.ts @@ -1330,6 +1330,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 39, + "name": "heroskin", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, @@ -1721,6 +1735,13 @@ export const serviceProto: ServiceProto = { } } } + }, + { + "id": 8, + "name": "skin", + "type": { + "type": "String" + } } ] }, diff --git a/src/jsonType.ts b/src/jsonType.ts index c6edbea..dbde216 100644 --- a/src/jsonType.ts +++ b/src/jsonType.ts @@ -136,9 +136,9 @@ type gc_clsl_dan = k_v<{ /** 机器人 */ 'npc': number, /** 随机机器人概率*/ - 'pro':number + 'pro': number /** 对手范围 */ - 'fighter':number[] + 'fighter': number[] }>; type gc_com = k_v<{ @@ -1809,6 +1809,28 @@ type gc_push_gift = { } } +type gc_hero_skin = { + [k: string]: { + /**皮肤id*/ + id: number + /**干部id*/ + heroid: number + /**皮肤品质*/ + colour: number + /**摸到重复时转换*/ + zhuanhuan: atn[] + } +} + +type gc_hero_skin_lv = { + [colour: string]: { + [lv: string]: { + buff: { [k: string]: number } + need: { a: string, t: string, n: number }[]; + } + } +} + type gcType = { [key: string]: any armyattr: gc_armyattr @@ -1959,6 +1981,8 @@ type gcType = { yuyuemail: gc_yuyuemail tuisonglibao: gc_push_gift renown_level: gc_renown_level + heroSkin: gc_hero_skin + heroSkinLv: gc_hero_skin_lv } diff --git a/src/lng.ts b/src/lng.ts index 4593c26..b399088 100644 --- a/src/lng.ts +++ b/src/lng.ts @@ -239,6 +239,9 @@ class Lng { hero_17 = "hero_17"; hero_18 = "hero_18"; hero_19 = "hero_19"; + hero_20 = "hero_20"; + hero_21 = "hero_21"; + hero_22 = "hero_22"; item_1 = "item_1"; item_2 = "item_2"; diff --git a/src/module/mongodb.ts b/src/module/mongodb.ts index dd22c84..6dc93a8 100644 --- a/src/module/mongodb.ts +++ b/src/module/mongodb.ts @@ -1,25 +1,25 @@ -import {ResSyncBtn} from '../shared/protocols/PtlSyncBtn'; -import {payLog} from '../shared/protocols/pay/PtlGetList'; -import {rankType} from '../shared/protocols/rank/PtlOpen'; -import {CollectionChatLog} from './collection_chatlog'; -import {CollectionActionLog} from './collection_actionLog'; -import {CollectionCardlog} from './collection_cardlog'; -import {CollectionCllsCrossGroup, CollectionCllsCrossUser} from './collection_clsl'; -import {CollectionCrosskv} from './collection_crosskv'; -import {CollectionDayPay} from './collection_dayPay'; -import {CollectionDxlt} from './collection_dxlt'; -import {CollectionEmail} from './collection_email'; -import {CollectionEquip} from './collection_equip'; -import {CollectionEvent} from './collection_event'; -import {CollectionFriend} from './collection_friend'; -import {CollectionGanHai} from './collection_ganhai'; -import {CollectionGBTX} from './collection_gbtx'; -import {CollectionGongHui, CollectionGongHuiFb, CollectionGongHuiUser} from './collection_gonghui'; -import {CollectionHbzbUserCross, CollectionHbzbUserZbs} from './collection_hbzb_user_cross'; -import {CollectionHero} from './collection_hero'; -import {CollectionItem} from './collection_item'; -import {CollectionJJC} from './collection_jjc'; -import {CollectionApiWeiXiuChang} from './collection_weixiuchang'; +import { ResSyncBtn } from '../shared/protocols/PtlSyncBtn'; +import { payLog } from '../shared/protocols/pay/PtlGetList'; +import { rankType } from '../shared/protocols/rank/PtlOpen'; +import { CollectionChatLog } from './collection_chatlog'; +import { CollectionActionLog } from './collection_actionLog'; +import { CollectionCardlog } from './collection_cardlog'; +import { CollectionCllsCrossGroup, CollectionCllsCrossUser } from './collection_clsl'; +import { CollectionCrosskv } from './collection_crosskv'; +import { CollectionDayPay } from './collection_dayPay'; +import { CollectionDxlt } from './collection_dxlt'; +import { CollectionEmail } from './collection_email'; +import { CollectionEquip } from './collection_equip'; +import { CollectionEvent } from './collection_event'; +import { CollectionFriend } from './collection_friend'; +import { CollectionGanHai } from './collection_ganhai'; +import { CollectionGBTX } from './collection_gbtx'; +import { CollectionGongHui, CollectionGongHuiFb, CollectionGongHuiUser } from './collection_gonghui'; +import { CollectionHbzbUserCross, CollectionHbzbUserZbs } from './collection_hbzb_user_cross'; +import { CollectionHero } from './collection_hero'; +import { CollectionItem } from './collection_item'; +import { CollectionJJC } from './collection_jjc'; +import { CollectionApiWeiXiuChang } from './collection_weixiuchang'; import { CollectionKbzzApplyUser, @@ -134,7 +134,7 @@ export type MongodbCollections = { rmbuse: CollectionRmbuse fightLog: CollectionFightLog shop: CollectionShop - pushgift:CollectionPushGift + pushgift: CollectionPushGift huodong_user: CollectionUser; weiwang: CollectionWeiwang; diff --git a/src/monopoly/protocols/serviceProto.ts b/src/monopoly/protocols/serviceProto.ts index c49cc84..56865dd 100644 --- a/src/monopoly/protocols/serviceProto.ts +++ b/src/monopoly/protocols/serviceProto.ts @@ -2651,6 +2651,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 39, + "name": "heroskin", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, diff --git a/src/public/heroskin.ts b/src/public/heroskin.ts new file mode 100644 index 0000000..f0e0504 --- /dev/null +++ b/src/public/heroskin.ts @@ -0,0 +1,49 @@ +import { ApiCall } from "tsrpc"; +import { call } from "../public/player"; +import { PlayerFun } from "./player"; + + +export default class HeroSkinFun { + + /** + * 获取英雄皮肤列表 + * @param uid + * @returns + */ + static getHeroSkin(call: call, oids: string | string[] = '') { + return call.conn.gud.heroskin || {}; + } + + /** + * 更新英雄皮肤数据 + * + * 说明 addAttr 会推送msg_s2c/PlayerChange + * addEventMsg 会检测 PlayerChange 如果change的key在player中则触发重算战力操作 + * 所以这个地放更新heroskin数据不需要主动重算战力 + * @param oid + * @param data + * @returns + * */ + static async updateHeroSkinLv(call: ApiCall, change: k_v) { + let skin = this.getHeroSkin(call); + skin = Object.assign(skin, change); + await PlayerFun.addAttr(call, { heroskin: skin }); + } + + /** + * 计算皮肤buff + * @param skid + * @param lv + * @returns {[string]: number} + * */ + static calcBuff(skid: string, lv: number): k_v { + let buff = {}; + let skin = G.gc.heroSkin[skid]; + for (let i = 1; i <= lv; i++) { + for (let k in G.gc.heroSkinLv[skin.colour][i].buff) { + buff[k] = (buff[k] || 0) + G.gc.heroSkinLv[skin.colour][i].buff[k]; + } + } + return buff; + } +} \ No newline at end of file diff --git a/src/public/player.ts b/src/public/player.ts index 2647bce..5c6e168 100644 --- a/src/public/player.ts +++ b/src/public/player.ts @@ -1,24 +1,25 @@ -import {ObjectId, OptionalId} from 'mongodb'; -import {ApiCall, BaseConnection, TsrpcError} from 'tsrpc'; -import {checkPlayerGift} from '../api_s2c/event/xianshilibao/fun'; -import {md_redPoint_check} from '../api_s2c/gongyu/mingdao/ApiOpen'; -import {CollectionPeiJian} from '../module/collection_peijian'; -import {Wjjl} from '../module/collection_wjjl'; -import {MongodbCollections} from '../module/mongodb'; -import {G123} from '../sdk/G123'; -import {ResGetList} from '../shared/protocols/item/PtlGetList'; -import {ResLogin} from '../shared/protocols/user/PtlLogin'; -import {player} from '../shared/protocols/user/type'; -import {HeroShared, otherBuff} from '../shared/public/hero'; -import {PublicShared} from '../shared/public/public'; -import {HeroFun} from './hero'; -import {ShiwuFun} from './shiwu'; -import {UserFun} from './user'; -import {getItemByItemId, getItemNum} from './item'; -import {getGud, setGud} from './gud'; -import {addGameLog} from "../gameLog"; -import {PushGiftFun} from "./pushgift"; +import { ObjectId, OptionalId } from 'mongodb'; +import { ApiCall, BaseConnection, TsrpcError } from 'tsrpc'; +import { checkPlayerGift } from '../api_s2c/event/xianshilibao/fun'; +import { md_redPoint_check } from '../api_s2c/gongyu/mingdao/ApiOpen'; +import { CollectionPeiJian } from '../module/collection_peijian'; +import { Wjjl } from '../module/collection_wjjl'; +import { MongodbCollections } from '../module/mongodb'; +import { G123 } from '../sdk/G123'; +import { ResGetList } from '../shared/protocols/item/PtlGetList'; +import { ResLogin } from '../shared/protocols/user/PtlLogin'; +import { player } from '../shared/protocols/user/type'; +import { HeroShared, otherBuff } from '../shared/public/hero'; +import { PublicShared } from '../shared/public/public'; +import { HeroFun } from './hero'; +import { ShiwuFun } from './shiwu'; +import { UserFun } from './user'; +import { getItemByItemId, getItemNum } from './item'; +import { getGud, setGud } from './gud'; +import { addGameLog } from "../gameLog"; +import { PushGiftFun } from "./pushgift"; import { ActionLog } from './actionLog/actionLog'; +import HeroSkinFun from './heroskin'; export type call = { @@ -70,13 +71,13 @@ export class PlayerFun { if (err) { // 消耗不足 触发推送礼包 PushGiftFun.chkItemGift(call.uid, atn) - throw new TsrpcError('', {code: -104, atn: atn}); + throw new TsrpcError('', { code: -104, atn: atn }); } else { - return {isOk: false, atn: atn}; + return { isOk: false, atn: atn }; } } } - return {isOk: true, atn: null}; + return { isOk: true, atn: null }; } /** @@ -94,7 +95,7 @@ export class PlayerFun { atn: need }; if (args.length < 1) { - throw new TsrpcError('', {code: -104, atn: meet.atn}); + throw new TsrpcError('', { code: -104, atn: meet.atn }); } return await this.checkNeedByArgs(call, ...args); } @@ -117,10 +118,10 @@ export class PlayerFun { all.push(this.addItem(call, item)); } // 记录消耗 - addGameLog(call.uid, call.service.name, call.req, {need: val}) + addGameLog(call.uid, call.service.name, call.req, { need: val }) await Promise.all(all); G.emit('USE_ITEM', call.conn.gud, needArr.map(need => { - return {...need, n: Math.abs(need.n)}; + return { ...need, n: Math.abs(need.n) }; })); } @@ -136,16 +137,18 @@ export class PlayerFun { let equip = prizeList.filter(atn => atn.a == 'equip' && atn.n != 0); let shiwu = prizeList.filter(atn => atn.a == 'shiwu' && atn.n != 0); let peijian = prizeList.filter(atn => atn.a == 'peijian' && atn.n != 0); + let heroskin = prizeList.filter(atn => atn.a == 'heroskin' && atn.n != 0); // 记录获得 - addGameLog(call.uid, call.service.name, call.req, {prize: prizeList}) + addGameLog(call.uid, call.service.name, call.req, { prize: prizeList }) await Promise.all([ attr.length > 0 && this.addAttr(call, attr), item.length > 0 && this.addItem(call, item), hero.length > 0 && this.addHero(call, hero), equip.length > 0 && this.addEquip(call, equip), shiwu.length > 0 && this.addShiwu(call, shiwu), - peijian.length > 0 && this.addPeijian(call, peijian) + peijian.length > 0 && this.addPeijian(call, peijian), + heroskin.length > 0 && this.addHeroskin(call, heroskin), ]); return prizeList; @@ -180,9 +183,9 @@ export class PlayerFun { } } - if( (atn.t == 'rmbmoney' || atn.t == 'jinbi') && atn.n > 0 ){ + if ((atn.t == 'rmbmoney' || atn.t == 'jinbi') && atn.n > 0) { //统计今日获取的金币和钻石 - ActionLog.addDayLog(call.conn.uid, { key: 'got_'+atn.t, val: atn.n }); + ActionLog.addDayLog(call.conn.uid, { key: 'got_' + atn.t, val: atn.n }); } // 增加vip经验的任务监听 @@ -190,7 +193,7 @@ export class PlayerFun { G.emit("Class_task_157", 'Class_task_157', call, atn.n, 0); } all.push(this.changeAttr(call.conn.uid, change)); - all.push(this.upAttr(call, {...atn, n: change[atn.t]})); + all.push(this.upAttr(call, { ...atn, n: change[atn.t] })); //await this.changeAttr(call.conn.uid, change); //await this.upAttr(call, {...atn, n: change[atn.t]}); } @@ -233,17 +236,17 @@ export class PlayerFun { G.mongodb.collection('rmbuse').insertOne(data); // 消费竞赛开启时写入跨服数据库 if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') { - G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid, type: `xfjs_${G.huodong.xfjsId}`}, { - $set: {time: G.time}, - $inc: {change: data.change} - }, {upsert: true}); + G.crossmongodb.collection('rmbuse').updateOne({ uid: data.uid, type: `xfjs_${G.huodong.xfjsId}` }, { + $set: { time: G.time }, + $inc: { change: data.change } + }, { upsert: true }); } } static async changeAttr(uid: string, change: Partial) { setGud(uid, change); - G.mongodb.collection('user').updateOne({uid: uid}, {$set: change}); + G.mongodb.collection('user').updateOne({ uid: uid }, { $set: change }); if (G.server.uid_connections[uid]) { checkPlayerGift(G.server.uid_connections[uid].gud, change); @@ -265,9 +268,9 @@ export class PlayerFun { const curLv = call.conn.gud.lv; while (conf[curLv + addLv + 1] && atn.n >= conf[curLv + addLv + 1].need) { addLv++; - G123.sendUserLevelUp({...call.conn.gud, lv: curLv + addLv, nexp: atn.n}); + G123.sendUserLevelUp({ ...call.conn.gud, lv: curLv + addLv, nexp: atn.n }); } - addLv && await this.addAttr(call, {lv: curLv + addLv}); + addLv && await this.addAttr(call, { lv: curLv + addLv }); break; case 'payExp': let addVip = 0; @@ -276,7 +279,7 @@ export class PlayerFun { while (vipConf[curVip + addVip + 1] && atn.n >= vipConf[curVip + addVip + 1].exp) { addVip++; } - addVip && await this.addAttr(call, {vip: curVip + addVip}); + addVip && await this.addAttr(call, { vip: curVip + addVip }); break; } } @@ -287,7 +290,7 @@ export class PlayerFun { static async addItem(call: call, val: atn[]) { for (let atn of val) { let upObj = { - filter: {uid: call.uid, itemId: atn.t}, + filter: { uid: call.uid, itemId: atn.t }, update: { $setOnInsert: { firstTime: G.time, @@ -319,7 +322,7 @@ export class PlayerFun { }; G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options); call.addEventMsg('msg_s2c/ItemChange', atn.t, data); - addGameLog(call.uid, "_itemChange", {"additem": 1}, { + addGameLog(call.uid, "_itemChange", { "additem": 1 }, { "filter": upObj.filter, "update": upObj.update, "options": upObj.options @@ -327,10 +330,10 @@ export class PlayerFun { } else { if (item.num + atn.n <= 0) { await Promise.all([ - G.mongodb.collection('item').deleteOne({uid: call.uid, itemId: atn.t}) + G.mongodb.collection('item').deleteOne({ uid: call.uid, itemId: atn.t }) ]); - call.addEventMsg('msg_s2c/ItemChange', atn.t, {num: 0}); - addGameLog(call.uid, "_itemChange", {"delitem": 1}, {"itemId": atn.t}) + call.addEventMsg('msg_s2c/ItemChange', atn.t, { num: 0 }); + addGameLog(call.uid, "_itemChange", { "delitem": 1 }, { "itemId": atn.t }) } else { await Promise.all([ G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options) @@ -339,7 +342,7 @@ export class PlayerFun { num: item.num + atn.n, lastTime: upObj.update.$set.lastTime }); - addGameLog(call.uid, "_itemChange", {"attritem": 1}, { + addGameLog(call.uid, "_itemChange", { "attritem": 1 }, { "filter": upObj.filter, "update": upObj.update, "options": upObj.options, @@ -374,7 +377,7 @@ export class PlayerFun { insertData.forEach((v, key) => { let id = result.insertedIds[key].toHexString(); - let {_id, ...ops} = v; + let { _id, ...ops } = v; Wjjl.setVal(call.uid, `has_equip_color_${G.gc.equip[ops.equipId].colour}`, 1, false); @@ -408,10 +411,10 @@ export class PlayerFun { */ static async cutEquip(call: call, _idArr: string[]) { for (let _id of _idArr) { - G.mongodb.collection('equip').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); - call.addEventMsg('msg_s2c/EquipChange', _id, {num: 0}); + G.mongodb.collection('equip').deleteOne({ uid: call.uid, _id: new ObjectId(_id) }); + call.addEventMsg('msg_s2c/EquipChange', _id, { num: 0 }); - addGameLog(call.uid, "_cutEquip", {}, {_id: _id}) + addGameLog(call.uid, "_cutEquip", {}, { _id: _id }) } } @@ -445,7 +448,7 @@ export class PlayerFun { let v = insertData[key] let id = result.insertedIds[key].toHexString(); - let {_id, ...ops} = v; + let { _id, ...ops } = v; call.addEventMsg('msg_s2c/HeroChange', id, { _id: id, @@ -478,9 +481,9 @@ export class PlayerFun { static async cutHero(call: call, _idArr: string[]) { for (let _id of _idArr) { await HeroFun.delHero(call, _id); - G.mongodb.collection('hero').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); - call.addEventMsg('msg_s2c/HeroChange', _id, {num: 0}); - addGameLog(call.uid, "_cutHero", {}, {_id: _id}) + G.mongodb.collection('hero').deleteOne({ uid: call.uid, _id: new ObjectId(_id) }); + call.addEventMsg('msg_s2c/HeroChange', _id, { num: 0 }); + addGameLog(call.uid, "_cutHero", {}, { _id: _id }) } } @@ -495,7 +498,7 @@ export class PlayerFun { colour: v.colour, wearId: '', shiwuId: v.t, - jichu: ShiwuFun.randomJichu({colour: v.colour, shiwuId: v.t}), + jichu: ShiwuFun.randomJichu({ colour: v.colour, shiwuId: v.t }), fujia: [] }; if (v.shiwuBuff) { @@ -515,7 +518,7 @@ export class PlayerFun { insertData.forEach((v, key) => { let id = result.insertedIds[key].toHexString(); - let {_id, ...ops} = v; + let { _id, ...ops } = v; call.addEventMsg('msg_s2c/ShiwuChange', id, { _id: id, ...ops @@ -534,9 +537,9 @@ export class PlayerFun { */ static async cutShiwu(call: call, _idArr: string[]) { for (let _id of _idArr) { - G.mongodb.collection('shiwu').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); - call.addEventMsg('msg_s2c/ShiwuChange', _id, {num: 0}); - addGameLog(call.uid, "_cutShiwu", {}, {_id: _id}) + G.mongodb.collection('shiwu').deleteOne({ uid: call.uid, _id: new ObjectId(_id) }); + call.addEventMsg('msg_s2c/ShiwuChange', _id, { num: 0 }); + addGameLog(call.uid, "_cutShiwu", {}, { _id: _id }) } } @@ -561,7 +564,7 @@ export class PlayerFun { addGameLog(call.uid, "_addPeiJian", {}, insertData) insertData.forEach((v, key) => { - let {_id, uid, ...ops} = v; + let { _id, uid, ...ops } = v; let id = _id.toHexString(); if (G.gc.peijian[v.peijianId].colour != 5) { @@ -569,8 +572,8 @@ export class PlayerFun { lshd[v.peijianId]++; } - G.redis.set('peijian', call.uid, id, {_id: id, ...ops}); - call.addEventMsg('msg_s2c/PeijianChange', id, {_id: id, ...ops}); + G.redis.set('peijian', call.uid, id, { _id: id, ...ops }); + call.addEventMsg('msg_s2c/PeijianChange', id, { _id: id, ...ops }); }); G.mongodb.collection('playerInfo', 'lshd_peijian').updateOne( @@ -591,15 +594,39 @@ export class PlayerFun { return Object.values(result.insertedIds).map(v => G.mongodb.conversionId(v)); } + /** + * 添加皮肤 + * */ + static async addHeroskin(call: call, val: atn[]) { + let prize = []; + let upskin = {}; + let heroskin = HeroSkinFun.getHeroSkin(call); + for (let p of val) { + if (!heroskin[p.t]) { + upskin[p.t] = 1; + } else { + prize.concat(G.gc.heroSkin[p.t].zhuanhuan); + } + } + if (Object.keys(upskin).length > 0) { + this.addAttr(call, Object.assign(heroskin, upskin)); + } + + // 皮肤存在转换为其他奖励 + if (prize.length > 0) { + this.sendPrize(call, prize); + } + } + /** * 删除配件 */ static async cutPeijian(call: call, _idArr: string[]) { for (let _id of _idArr) { G.redis.del('peijian', call.uid, _id); - G.mongodb.collection('peijian').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); - call.addEventMsg('msg_s2c/PeijianChange', _id, {num: 0}); - addGameLog(call.uid, "_cutPeijian", {}, {_id: _id}) + G.mongodb.collection('peijian').deleteOne({ uid: call.uid, _id: new ObjectId(_id) }); + call.addEventMsg('msg_s2c/PeijianChange', _id, { num: 0 }); + addGameLog(call.uid, "_cutPeijian", {}, { _id: _id }) } } @@ -608,7 +635,7 @@ export class PlayerFun { */ static async getAttr(uid: string, where: { ctype: string; }) { let _w = where; - Object.assign(_w, {uid: uid}); + Object.assign(_w, { uid: uid }); const _res = await G.mongodb.collection('playattr').find(_w).toArray(); _res.forEach(v => { if (v._id) { @@ -623,7 +650,7 @@ export class PlayerFun { */ static async getAttrOne(uid: string, where: { ctype: string; }) { let _w = where; - Object.assign(_w, {uid: uid}); + Object.assign(_w, { uid: uid }); const _res = await G.mongodb.collection('playattr').findOne(_w); if (_res) { delete _res['_id']; @@ -639,10 +666,10 @@ export class PlayerFun { time = G.time; } let _zeroTime = PublicShared.getToDayZeroTime(time); - let _tmp = {lasttime: {$gte: _zeroTime, $lte: _zeroTime + 24 * 60 * 60 - 1}}; + let _tmp = { lasttime: { $gte: _zeroTime, $lte: _zeroTime + 24 * 60 * 60 - 1 } }; let _w = where; - Object.assign(_w, {uid: uid, ..._tmp}); + Object.assign(_w, { uid: uid, ..._tmp }); const _res = await G.mongodb.collection('playattr').find(_w).toArray(); _res.forEach(v => { if (v._id) { @@ -657,7 +684,7 @@ export class PlayerFun { */ static async setAttr(uid: string, where: { ctype: string; }, data: {}, islasttime = 1) { let _w = where; - Object.assign(_w, {uid: uid}); + Object.assign(_w, { uid: uid }); if (islasttime == 1) { data["lasttime"] = G.time; @@ -668,7 +695,7 @@ export class PlayerFun { // 加入创建数据时间 data["ctime"] = G.time; } - let _res = await G.mongodb.collection('playattr').updateMany(_w, {$set: data}, {upsert: true}); + let _res = await G.mongodb.collection('playattr').updateMany(_w, { $set: data }, { upsert: true }); return _res; } } \ No newline at end of file diff --git a/src/shared/protocols/hero/PtlGetList.ts b/src/shared/protocols/hero/PtlGetList.ts index 3b180f0..76a0d24 100644 --- a/src/shared/protocols/hero/PtlGetList.ts +++ b/src/shared/protocols/hero/PtlGetList.ts @@ -71,4 +71,6 @@ type heroAddKey = { peijian: { [pos: string]: string; }; + /**皮肤*/ + skin: string; }; \ No newline at end of file diff --git a/src/shared/protocols/heroskin/PtlTakeOff.ts b/src/shared/protocols/heroskin/PtlTakeOff.ts new file mode 100644 index 0000000..55aefc3 --- /dev/null +++ b/src/shared/protocols/heroskin/PtlTakeOff.ts @@ -0,0 +1,7 @@ +export interface ReqTakeOff { + heroOid: string +} + +export interface ResTakeOff { + +} diff --git a/src/shared/protocols/heroskin/PtlUplv.ts b/src/shared/protocols/heroskin/PtlUplv.ts new file mode 100644 index 0000000..58c5ba2 --- /dev/null +++ b/src/shared/protocols/heroskin/PtlUplv.ts @@ -0,0 +1,6 @@ +export interface ReqUplv { + lv: 1; + skid: string; +} + +export interface ResUplv { } diff --git a/src/shared/protocols/heroskin/PtlWear.ts b/src/shared/protocols/heroskin/PtlWear.ts new file mode 100644 index 0000000..c33a1da --- /dev/null +++ b/src/shared/protocols/heroskin/PtlWear.ts @@ -0,0 +1,6 @@ +export interface ReqWear { + skid: string, + heroOid: string, +} + +export interface ResWear { } diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index b882e77..4167d5a 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -187,6 +187,9 @@ import { ReqRec as ReqRec_12, ResRec as ResRec_12 } from './hero/PtlRec'; import { ReqReset as ReqReset_2, ResReset as ResReset_2 } from './hero/PtlReset'; import { ReqTalent, ResTalent } from './hero/PtlTalent'; import { ReqWeaponUp, ResWeaponUp } from './hero/PtlWeaponUp'; +import { ReqTakeOff as ReqTakeOff_1, ResTakeOff as ResTakeOff_1 } from './heroskin/PtlTakeOff'; +import { ReqUplv, ResUplv } from './heroskin/PtlUplv'; +import { ReqWear as ReqWear_1, ResWear as ResWear_1 } from './heroskin/PtlWear'; import { ReqGet as ReqGet_2, ResGet as ResGet_2 } from './hongdian/PtlGet'; import { ReqGetList as ReqGetList_4, ResGetList as ResGetList_4 } from './item/PtlGetList'; import { ReqUse, ResUse } from './item/PtlUse'; @@ -267,9 +270,9 @@ import { ReqOneKeyLvUp as ReqOneKeyLvUp_1, ResOneKeyLvUp as ResOneKeyLvUp_1 } fr import { ReqOneKeyWear as ReqOneKeyWear_1, ResOneKeyWear as ResOneKeyWear_1 } from './peijian/PtlOneKeyWear'; import { ReqReset as ReqReset_3, ResReset as ResReset_3 } from './peijian/PtlReset'; import { ReqRm, ResRm } from './peijian/PtlRm'; -import { ReqTakeOff as ReqTakeOff_1, ResTakeOff as ResTakeOff_1 } from './peijian/PtlTakeOff'; +import { ReqTakeOff as ReqTakeOff_2, ResTakeOff as ResTakeOff_2 } from './peijian/PtlTakeOff'; import { ReqUnLock, ResUnLock } from './peijian/PtlUnLock'; -import { ReqWear as ReqWear_1, ResWear as ResWear_1 } from './peijian/PtlWear'; +import { ReqWear as ReqWear_2, ResWear as ResWear_2 } from './peijian/PtlWear'; import { ReqDeal, ResDeal } from './peijiancangku/PtlDeal'; import { ReqJump, ResJump } from './peijiancangku/PtlJump'; import { ReqOpen as ReqOpen_51, ResOpen as ResOpen_51 } from './peijiancangku/PtlOpen'; @@ -287,8 +290,8 @@ import { ReqExtract, ResExtract } from './shiwu/PtlExtract'; import { ReqGetList as ReqGetList_7, ResGetList as ResGetList_7 } from './shiwu/PtlGetList'; import { ReqLvUp as ReqLvUp_3, ResLvUp as ResLvUp_3 } from './shiwu/PtlLvUp'; import { ReqRecast, ResRecast } from './shiwu/PtlRecast'; -import { ReqTakeOff as ReqTakeOff_2, ResTakeOff as ResTakeOff_2 } from './shiwu/PtlTakeOff'; -import { ReqWear as ReqWear_2, ResWear as ResWear_2 } from './shiwu/PtlWear'; +import { ReqTakeOff as ReqTakeOff_3, ResTakeOff as ResTakeOff_3 } from './shiwu/PtlTakeOff'; +import { ReqWear as ReqWear_3, ResWear as ResWear_3 } from './shiwu/PtlWear'; import { ReqOpen as ReqOpen_55, ResOpen as ResOpen_55 } from './shootGame/PtlOpen'; import { ReqRec as ReqRec_13, ResRec as ResRec_13 } from './shootGame/PtlRec'; import { ReqBuy as ReqBuy_6, ResBuy as ResBuy_6 } from './shop/PtlBuy'; @@ -1115,6 +1118,18 @@ export interface ServiceType { req: ReqWeaponUp, res: ResWeaponUp }, + "heroskin/TakeOff": { + req: ReqTakeOff_1, + res: ResTakeOff_1 + }, + "heroskin/Uplv": { + req: ReqUplv, + res: ResUplv + }, + "heroskin/Wear": { + req: ReqWear_1, + res: ResWear_1 + }, "hongdian/Get": { req: ReqGet_2, res: ResGet_2 @@ -1320,16 +1335,16 @@ export interface ServiceType { res: ResRm }, "peijian/TakeOff": { - req: ReqTakeOff_1, - res: ResTakeOff_1 + req: ReqTakeOff_2, + res: ResTakeOff_2 }, "peijian/UnLock": { req: ReqUnLock, res: ResUnLock }, "peijian/Wear": { - req: ReqWear_1, - res: ResWear_1 + req: ReqWear_2, + res: ResWear_2 }, "peijiancangku/Deal": { req: ReqDeal, @@ -1400,12 +1415,12 @@ export interface ServiceType { res: ResRecast }, "shiwu/TakeOff": { - req: ReqTakeOff_2, - res: ResTakeOff_2 + req: ReqTakeOff_3, + res: ResTakeOff_3 }, "shiwu/Wear": { - req: ReqWear_2, - res: ResWear_2 + req: ReqWear_3, + res: ResWear_3 }, "shootGame/Open": { req: ReqOpen_55, @@ -2763,6 +2778,21 @@ export const serviceProto: ServiceProto = { }, { "id": 188, + "name": "heroskin/TakeOff", + "type": "api" + }, + { + "id": 189, + "name": "heroskin/Uplv", + "type": "api" + }, + { + "id": 190, + "name": "heroskin/Wear", + "type": "api" + }, + { + "id": 191, "name": "hongdian/Get", "type": "api", "conf": { @@ -2770,117 +2800,117 @@ export const serviceProto: ServiceProto = { } }, { - "id": 189, + "id": 192, "name": "item/GetList", "type": "api" }, { - "id": 190, + "id": 193, "name": "item/Use", "type": "api" }, { - "id": 191, + "id": 194, "name": "jiaotang/Lottery", "type": "api" }, { - "id": 192, + "id": 195, "name": "jiaotang/Open", "type": "api" }, { - "id": 193, + "id": 196, "name": "jiuba/Lottery", "type": "api" }, { - "id": 194, + "id": 197, "name": "jiuba/Open", "type": "api" }, { - "id": 195, + "id": 198, "name": "jjc/BuyFightNum", "type": "api" }, { - "id": 196, + "id": 199, "name": "jjc/Fight", "type": "api" }, { - "id": 197, + "id": 200, "name": "jjc/FightLog", "type": "api" }, { - "id": 198, + "id": 201, "name": "jjc/Open", "type": "api" }, { - "id": 199, + "id": 202, "name": "jjc/Receive", "type": "api" }, { - "id": 200, + "id": 203, "name": "jjc/Refresh", "type": "api" }, { - "id": 201, + "id": 204, "name": "kaifujingsai/Open", "type": "api" }, { - "id": 202, + "id": 205, "name": "kaifujingsai/Receive", "type": "api" }, { - "id": 203, + "id": 206, "name": "kbzz/Apply", "type": "api" }, { - "id": 204, + "id": 207, "name": "kbzz/AutoApply", "type": "api" }, { - "id": 205, + "id": 208, "name": "kbzz/BuyNum", "type": "api" }, { - "id": 206, + "id": 209, "name": "kbzz/Fight", "type": "api" }, { - "id": 207, + "id": 210, "name": "kbzz/FightLog", "type": "api" }, { - "id": 208, + "id": 211, "name": "kbzz/GroupState", "type": "api" }, { - "id": 209, + "id": 212, "name": "kbzz/Open", "type": "api" }, { - "id": 210, + "id": 213, "name": "kbzz/RecPrize", "type": "api" }, { - "id": 211, + "id": 214, "name": "kbzz/Refresh", "type": "api", "conf": { @@ -2888,287 +2918,287 @@ export const serviceProto: ServiceProto = { } }, { - "id": 212, + "id": 215, "name": "kuangdong/AddPkNum", "type": "api" }, { - "id": 213, + "id": 216, "name": "kuangdong/GetPrize", "type": "api" }, { - "id": 214, + "id": 217, "name": "kuangdong/KdInfo", "type": "api" }, { - "id": 215, + "id": 218, "name": "kuangdong/Log", "type": "api" }, { - "id": 216, + "id": 219, "name": "kuangdong/Open", "type": "api" }, { - "id": 217, + "id": 220, "name": "kuangdong/YanShi", "type": "api" }, { - "id": 218, + "id": 221, "name": "kuangdong/ZhanLing", "type": "api" }, { - "id": 219, + "id": 222, "name": "lingzhulaixi/Open", "type": "api" }, { - "id": 220, + "id": 223, "name": "lingzhulaixi/PkBoss", "type": "api" }, { - "id": 221, + "id": 224, "name": "lingzhulaixi/PkRank", "type": "api" }, { - "id": 222, + "id": 225, "name": "lingzhulaixi/SaoDang", "type": "api" }, { - "id": 223, + "id": 226, "name": "meirishilian/Buy", "type": "api" }, { - "id": 224, + "id": 227, "name": "meirishilian/Fight", "type": "api" }, { - "id": 225, + "id": 228, "name": "meirishilian/Open", "type": "api" }, { - "id": 226, + "id": 229, "name": "msg_c2s/BindUid", "type": "msg" }, { - "id": 227, + "id": 230, "name": "msg_c2s/Pay", "type": "msg" }, { - "id": 228, + "id": 231, "name": "msg_c2s/Sync", "type": "msg" }, { - "id": 229, + "id": 232, "name": "msg_s2c/Chat", "type": "msg" }, { - "id": 230, + "id": 233, "name": "msg_s2c/ChatHelp", "type": "msg" }, { - "id": 231, + "id": 234, "name": "msg_s2c/Collection", "type": "msg" }, { - "id": 232, + "id": 235, "name": "msg_s2c/Email", "type": "msg" }, { - "id": 233, + "id": 236, "name": "msg_s2c/EmailDel", "type": "msg" }, { - "id": 234, + "id": 237, "name": "msg_s2c/EquipChange", "type": "msg" }, { - "id": 235, + "id": 238, "name": "msg_s2c/Friend", "type": "msg" }, { - "id": 236, + "id": 239, "name": "msg_s2c/GhChange", "type": "msg" }, { - "id": 237, + "id": 240, "name": "msg_s2c/GongHuiBaoZang", "type": "msg" }, { - "id": 238, + "id": 241, "name": "msg_s2c/HeroChange", "type": "msg" }, { - "id": 239, + "id": 242, "name": "msg_s2c/HongDianChange", "type": "msg" }, { - "id": 240, + "id": 243, "name": "msg_s2c/ItemChange", "type": "msg" }, { - "id": 241, + "id": 244, "name": "msg_s2c/LoginQueue", "type": "msg" }, { - "id": 242, + "id": 245, "name": "msg_s2c/LshdChange", "type": "msg" }, { - "id": 243, + "id": 246, "name": "msg_s2c/NewDay", "type": "msg" }, { - "id": 244, + "id": 247, "name": "msg_s2c/OtherLogin", "type": "msg" }, { - "id": 245, + "id": 248, "name": "msg_s2c/PayChange", "type": "msg" }, { - "id": 246, + "id": 249, "name": "msg_s2c/PayResult", "type": "msg" }, { - "id": 247, + "id": 250, "name": "msg_s2c/PeijianChange", "type": "msg" }, { - "id": 248, + "id": 251, "name": "msg_s2c/PlayerChange", "type": "msg" }, { - "id": 249, + "id": 252, "name": "msg_s2c/Private", "type": "msg" }, { - "id": 250, + "id": 253, "name": "msg_s2c/PushGiftChange", "type": "msg" }, { - "id": 251, + "id": 254, "name": "msg_s2c/SendGift", "type": "msg" }, { - "id": 252, + "id": 255, "name": "msg_s2c/ShiwuChange", "type": "msg" }, { - "id": 253, + "id": 256, "name": "msg_s2c/TaskChange", "type": "msg" }, { - "id": 254, + "id": 257, "name": "msg_s2c/Xianshilibao", "type": "msg" }, { - "id": 255, + "id": 258, "name": "pata/Fight", "type": "api" }, { - "id": 256, + "id": 259, "name": "pata/GetPrize", "type": "api" }, { - "id": 257, + "id": 260, "name": "pata/Open", "type": "api" }, { - "id": 258, + "id": 261, "name": "pata/SaoDang", "type": "api" }, { - "id": 259, + "id": 262, "name": "pay/GetList", "type": "api" }, { - "id": 260, + "id": 263, "name": "peijian/GetList", "type": "api" }, { - "id": 261, + "id": 264, "name": "peijian/JingLian", "type": "api" }, { - "id": 262, + "id": 265, "name": "peijian/JinJie", "type": "api" }, { - "id": 263, + "id": 266, "name": "peijian/LvUp", "type": "api" }, { - "id": 264, + "id": 267, "name": "peijian/OneKeyLvUp", "type": "api" }, { - "id": 265, + "id": 268, "name": "peijian/OneKeyWear", "type": "api" }, { - "id": 266, + "id": 269, "name": "peijian/Reset", "type": "api" }, { - "id": 267, + "id": 270, "name": "peijian/Rm", "type": "api" }, { - "id": 268, + "id": 271, "name": "peijian/TakeOff", "type": "api", "conf": { @@ -3176,32 +3206,32 @@ export const serviceProto: ServiceProto = { } }, { - "id": 269, + "id": 272, "name": "peijian/UnLock", "type": "api" }, { - "id": 270, + "id": 273, "name": "peijian/Wear", "type": "api" }, { - "id": 271, + "id": 274, "name": "peijiancangku/Deal", "type": "api" }, { - "id": 272, + "id": 275, "name": "peijiancangku/Jump", "type": "api" }, { - "id": 273, + "id": 276, "name": "peijiancangku/Open", "type": "api" }, { - "id": 274, + "id": 277, "name": "Bingo", "type": "api", "conf": { @@ -3209,147 +3239,147 @@ export const serviceProto: ServiceProto = { } }, { - "id": 275, + "id": 278, "name": "FightTest", "type": "api" }, { - "id": 276, + "id": 279, "name": "SyncBtn", "type": "api" }, { - "id": 277, + "id": 280, "name": "Test", "type": "api" }, { - "id": 278, + "id": 281, "name": "pushgift/ItemNoEnough", "type": "api" }, { - "id": 279, + "id": 282, "name": "pushgift/Open", "type": "api" }, { - "id": 280, + "id": 283, "name": "qjzzd/Fight", "type": "api" }, { - "id": 281, + "id": 284, "name": "qjzzd/Open", "type": "api" }, { - "id": 282, + "id": 285, "name": "rank/Open", "type": "api" }, { - "id": 283, + "id": 286, "name": "shiwu/Concise", "type": "api" }, { - "id": 284, + "id": 287, "name": "shiwu/Extract", "type": "api" }, { - "id": 285, + "id": 288, "name": "shiwu/GetList", "type": "api" }, { - "id": 286, + "id": 289, "name": "shiwu/LvUp", "type": "api" }, { - "id": 287, + "id": 290, "name": "shiwu/Recast", "type": "api" }, { - "id": 288, + "id": 291, "name": "shiwu/TakeOff", "type": "api" }, { - "id": 289, + "id": 292, "name": "shiwu/Wear", "type": "api" }, { - "id": 290, + "id": 293, "name": "shootGame/Open", "type": "api" }, { - "id": 291, + "id": 294, "name": "shootGame/Rec", "type": "api" }, { - "id": 292, + "id": 295, "name": "shop/Buy", "type": "api" }, { - "id": 293, + "id": 296, "name": "shop/Open", "type": "api" }, { - "id": 294, + "id": 297, "name": "shop/Refresh", "type": "api" }, { - "id": 295, + "id": 298, "name": "sign/GetBoxPrize", "type": "api" }, { - "id": 296, + "id": 299, "name": "sign/GetPrize", "type": "api" }, { - "id": 297, + "id": 300, "name": "sign/Open", "type": "api" }, { - "id": 298, + "id": 301, "name": "slzd/Aim", "type": "api" }, { - "id": 299, + "id": 302, "name": "slzd/BuyNum", "type": "api" }, { - "id": 300, + "id": 303, "name": "slzd/Fight", "type": "api" }, { - "id": 301, + "id": 304, "name": "slzd/FightLog", "type": "api" }, { - "id": 302, + "id": 305, "name": "slzd/MyRank", "type": "api" }, { - "id": 303, + "id": 306, "name": "slzd/Open", "type": "api", "conf": { @@ -3359,77 +3389,77 @@ export const serviceProto: ServiceProto = { } }, { - "id": 304, + "id": 307, "name": "slzd/OpenFort", "type": "api" }, { - "id": 305, + "id": 308, "name": "slzd/Rec", "type": "api" }, { - "id": 306, + "id": 309, "name": "slzd/Refresh", "type": "api" }, { - "id": 307, + "id": 310, "name": "slzd/Slot", "type": "api" }, { - "id": 308, + "id": 311, "name": "tanxian/Event", "type": "api" }, { - "id": 309, + "id": 312, "name": "tanxian/FastGuaJi", "type": "api" }, { - "id": 310, + "id": 313, "name": "tanxian/Fight", "type": "api" }, { - "id": 311, + "id": 314, "name": "tanxian/GuaJi", "type": "api" }, { - "id": 312, + "id": 315, "name": "tanxian/Open", "type": "api" }, { - "id": 313, + "id": 316, "name": "tanxian/Receive", "type": "api" }, { - "id": 314, + "id": 317, "name": "task/AllFinsh", "type": "api" }, { - "id": 315, + "id": 318, "name": "task/Finsh", "type": "api" }, { - "id": 316, + "id": 319, "name": "task/Open", "type": "api" }, { - "id": 317, + "id": 320, "name": "user/CDKEY", "type": "api" }, { - "id": 318, + "id": 321, "name": "user/ChangeInfo", "type": "api", "conf": { @@ -3437,212 +3467,212 @@ export const serviceProto: ServiceProto = { } }, { - "id": 319, + "id": 322, "name": "user/ChangeName", "type": "api" }, { - "id": 320, + "id": 323, "name": "user/Dot", "type": "api" }, { - "id": 321, + "id": 324, "name": "user/Fight", "type": "api" }, { - "id": 322, + "id": 325, "name": "user/GetInfo", "type": "api" }, { - "id": 323, + "id": 326, "name": "user/InfoOpen", "type": "api" }, { - "id": 324, + "id": 327, "name": "user/Login", "type": "api" }, { - "id": 325, + "id": 328, "name": "user/Ping", "type": "api" }, { - "id": 326, + "id": 329, "name": "user/Renown", "type": "api" }, { - "id": 327, + "id": 330, "name": "user/RenownBuy", "type": "api" }, { - "id": 328, + "id": 331, "name": "user/RenownGetPrize", "type": "api" }, { - "id": 329, + "id": 332, "name": "user/RenownOpen", "type": "api" }, { - "id": 330, + "id": 333, "name": "user/Tujian", "type": "api" }, { - "id": 331, + "id": 334, "name": "weiwang/Open", "type": "api" }, { - "id": 332, + "id": 335, "name": "weiwang/UpLv", "type": "api" }, { - "id": 333, + "id": 336, "name": "weixiuchang/Decompose", "type": "api" }, { - "id": 334, + "id": 337, "name": "weixiuchang/Exchange", "type": "api" }, { - "id": 335, + "id": 338, "name": "weixiuchang/Open", "type": "api" }, { - "id": 336, + "id": 339, "name": "weixiuchang/UpLv", "type": "api" }, { - "id": 337, + "id": 340, "name": "weixiuchang/UpStar", "type": "api" }, { - "id": 338, + "id": 341, "name": "wzry/AutoBaoMing", "type": "api" }, { - "id": 339, + "id": 342, "name": "wzry/BaoMing", "type": "api" }, { - "id": 340, + "id": 343, "name": "wzry/catFightLog", "type": "api" }, { - "id": 341, + "id": 344, "name": "wzry/CatGroup", "type": "api" }, { - "id": 342, + "id": 345, "name": "wzry/DldFight", "type": "api" }, { - "id": 343, + "id": 346, "name": "wzry/DldRefre", "type": "api" }, { - "id": 344, + "id": 347, "name": "wzry/JingCai", "type": "api" }, { - "id": 345, + "id": 348, "name": "wzry/JingCaiOpen", "type": "api" }, { - "id": 346, + "id": 349, "name": "wzry/Open", "type": "api" }, { - "id": 347, + "id": 350, "name": "wzry/UpdateFight", "type": "api" }, { - "id": 348, + "id": 351, "name": "wzry/Wzzd", "type": "api" }, { - "id": 349, + "id": 352, "name": "wzry/ZuanShiOpen", "type": "api" }, { - "id": 350, + "id": 353, "name": "xstask/AllGet", "type": "api" }, { - "id": 351, + "id": 354, "name": "xstask/Get", "type": "api" }, { - "id": 352, + "id": 355, "name": "xstask/LvUp", "type": "api" }, { - "id": 353, + "id": 356, "name": "xstask/OnekeyReceive", "type": "api" }, { - "id": 354, + "id": 357, "name": "xstask/Open", "type": "api" }, { - "id": 355, + "id": 358, "name": "xstask/Receive", "type": "api" }, { - "id": 356, + "id": 359, "name": "xstask/Refresh", "type": "api" }, { - "id": 357, + "id": 360, "name": "yongbingzhuzhan/Handle", "type": "api" }, { - "id": 358, + "id": 361, "name": "zhanqianbushu/ChangePos", "type": "api" }, { - "id": 359, + "id": 362, "name": "zhanqianbushu/Select", "type": "api" }, { - "id": 360, + "id": 363, "name": "zhanqianbushu/Up", "type": "api" } @@ -4599,6 +4629,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 39, + "name": "heroskin", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, @@ -5857,6 +5901,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 39, + "name": "heroskin", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, @@ -6248,6 +6306,13 @@ export const serviceProto: ServiceProto = { } } } + }, + { + "id": 8, + "name": "skin", + "type": { + "type": "String" + } } ] }, @@ -14994,6 +15059,13 @@ export const serviceProto: ServiceProto = { } } } + }, + { + "id": 8, + "name": "skin", + "type": { + "type": "String" + } } ] }, @@ -15435,6 +15507,66 @@ export const serviceProto: ServiceProto = { } ] }, + "heroskin/PtlTakeOff/ReqTakeOff": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "heroOid", + "type": { + "type": "String" + } + } + ] + }, + "heroskin/PtlTakeOff/ResTakeOff": { + "type": "Interface" + }, + "heroskin/PtlUplv/ReqUplv": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "lv", + "type": { + "type": "Literal", + "literal": 1 + } + }, + { + "id": 1, + "name": "skid", + "type": { + "type": "String" + } + } + ] + }, + "heroskin/PtlUplv/ResUplv": { + "type": "Interface" + }, + "heroskin/PtlWear/ReqWear": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "skid", + "type": { + "type": "String" + } + }, + { + "id": 1, + "name": "heroOid", + "type": { + "type": "String" + } + } + ] + }, + "heroskin/PtlWear/ResWear": { + "type": "Interface" + }, "hongdian/PtlGet/ReqGet": { "type": "Array", "elementType": { @@ -24458,6 +24590,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 39, + "name": "heroskin", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, @@ -24849,6 +24995,13 @@ export const serviceProto: ServiceProto = { } } } + }, + { + "id": 8, + "name": "skin", + "type": { + "type": "String" + } } ] }, diff --git a/src/shared/protocols/user/PtlLogin.ts b/src/shared/protocols/user/PtlLogin.ts index be0c04d..92213e7 100644 --- a/src/shared/protocols/user/PtlLogin.ts +++ b/src/shared/protocols/user/PtlLogin.ts @@ -195,4 +195,9 @@ export type playerAppend = { }; /**威望额外属性*/ weiwangbuff?: { [k: string]: number }; + + /**获得的皮肤*/ + heroskin?: { + [skid: string]: number; + } }; \ No newline at end of file diff --git a/src/shared/public/hero.ts b/src/shared/public/hero.ts index 4b6a644..cc4d74e 100644 --- a/src/shared/public/hero.ts +++ b/src/shared/public/hero.ts @@ -1,3 +1,4 @@ +import HeroSkinFun from '../../public/heroskin'; import { ResGetList } from '../protocols/hero/PtlGetList'; import { player } from '../protocols/user/type'; import { EquipShared } from './equip'; @@ -279,8 +280,19 @@ export class HeroShared { } // 威望加成计算 - if (otherBuff?.weiwang) { - PublicShared.mergeProperty(buff, otherBuff?.weiwang || {}); + if (otherBuff?.weiwangbuff) { + PublicShared.mergeProperty(buff, otherBuff?.weiwangbuff || {}); + } + + // 计算皮肤buff + if (otherBuff?.heroskin) { + for (let skinId in otherBuff.heroskin) { + let skinConf = G.gc.heroSkin[skinId]; + if (skinConf.heroid != hero.heroId) console; + PublicShared.mergeProperty(buff, HeroSkinFun.calcBuff( + skinId, otherBuff.heroskin[skinId] + )); + } } //最后进行加成属性计算