diff --git a/src/api_s2c/weiwang/ApiOpen.ts b/src/api_s2c/weiwang/ApiOpen.ts new file mode 100644 index 0000000..2965f31 --- /dev/null +++ b/src/api_s2c/weiwang/ApiOpen.ts @@ -0,0 +1,17 @@ +import { ApiCall } from "tsrpc"; +import { ReqOpen, ResOpen } from "../../shared/protocols/weiwang/PtlOpen"; + +export default async function (call: ApiCall) { + let data = await G.mongodb.collection("weiwang").findOne({ uid: call.uid }); + + if (!data) { + // 初始化威望数据 + data = (await G.mongodb.collection("weiwang").findOneAndUpdate( + { uid: call.uid }, + { $set: { hp: 0, atk: 0, def: 0 } }, + { upsert: true, returnDocument: "after" } + )).value; + } + + call.succ({ lv: { hp: data.hp, atk: data.atk, def: data.def } }); +} \ No newline at end of file diff --git a/src/api_s2c/weiwang/ApiUpLv.ts b/src/api_s2c/weiwang/ApiUpLv.ts new file mode 100644 index 0000000..ab4fbc3 --- /dev/null +++ b/src/api_s2c/weiwang/ApiUpLv.ts @@ -0,0 +1,94 @@ +import { ApiCall } from "tsrpc"; +import { ReqUpLv, ResUpLv } from "../../shared/protocols/weiwang/PtlUpLv"; +import { PlayerFun } from "../../public/player"; + + +export default async function (call: ApiCall) { + let data = await G.mongodb.collection("weiwang").findOne({ uid: call.uid }); + + if (!data) { + // 初始化威望数据 + data = (await G.mongodb.collection("weiwang").findOneAndUpdate( + { uid: call.uid }, + { $set: { hp: 0, atk: 0, def: 0 } }, + { upsert: true, returnDocument: "after" } + )).value; + } + + let cur_lv = data[call.req.type]; + let min_lv = Math.min(data.atk, data.def, data.hp); + + let ids = Object.keys(G.gc.renown_level).sort( + (a, b) => Number(a) - Number(b) + ); + + let config; + for (let id of ids) { + config = G.gc.renown_level[id]; + if (min_lv < config.renownlevel) { + break; + } + } + + // 超过档期威望的最大等级 + if (cur_lv + call.req.lv > config.maxlevel) { + return call.error("", { code: -1, message: lng.weiwang_12 }); + } + + let need = [{ a: config.cost[0].a, t: config.cost[0].t, n: config.cost[0].n * call.req.lv }]; + + // 检测消耗是否足够 + await PlayerFun.checkNeedIsMeet(call, need); + + // 扣除消耗 + await PlayerFun.cutNeed(call, need); + + data[call.req.type] += call.req.lv; + + // 重新计算buff + let buff = calc_weiwang_buff(data.atk, data.def, data.hp); + G.mongodb.collection("weiwang").updateOne({ uid: call.uid }, { + $set: { buff: buff }, + $inc: { [call.req.type]: call.req.lv }, + }); + + call.succ({ lv: { hp: data.hp, atk: data.atk, def: data.def } }); +} + +/** + * 计算当前威望buff +*/ +function calc_weiwang_buff(atk: number, def: number, hp: number) { + let buff: k_v = { + "hp": 0, "def": 0, "atk": 0 + }; + + let ids = Object.keys(G.gc.renown_level).sort( + (a, b) => Number(a) - Number(b) + ); + + for (let i = 0; i < ids.length; i++) { + let curr = G.gc.renown_level[ids[i]]; + if (i == 0) { + buff["hp"] += curr.hp * Math.min(curr.maxlevel, hp); + buff["atk"] += curr.atk * Math.min(curr.maxlevel, atk); + buff["def"] += curr.def * Math.min(curr.maxlevel, def); + } else { + let prev = G.gc.renown_level[ids[i - 1]]; + + if (hp > prev.maxlevel) { + buff["hp"] += curr.hp * Math.min(hp - prev.maxlevel, curr.maxlevel - prev.maxlevel); + } + + if (atk > prev.maxlevel) { + buff["atk"] += curr.atk * Math.min(atk - prev.maxlevel, curr.maxlevel - prev.maxlevel); + } + + if (def > prev.maxlevel) { + buff["def"] += curr.def * Math.min(def - prev.maxlevel, curr.maxlevel - prev.maxlevel); + } + } + } + + return buff; +} \ No newline at end of file diff --git a/src/extends.ts b/src/extends.ts index ac96a9a..1d4b16e 100644 --- a/src/extends.ts +++ b/src/extends.ts @@ -14,7 +14,7 @@ import { ResLogin } from './shared/protocols/user/PtlLogin'; import { HeroShared, otherBuff } from './shared/public/hero'; import { PlayerShared } from './shared/public/player'; import { PublicShared } from './shared/public/public'; -import {RankKfjs} from "./public/rank/rank_kfjs"; +import { RankKfjs } from "./public/rank/rank_kfjs"; import { setGud } from './public/gud'; export function extendType() { @@ -52,7 +52,7 @@ declare module 'tsrpc' { /**API 锁 */ apiLock: k_v; /**获取默认上阵战斗数据 */ - getDefaultFightData(def?: k_v): Promise; + getDefaultFightData(def?: k_v, ext_buff?: { [type: string]: k_v }): Promise; /**刷新上阵英雄战力 */ refreshPower(): Promise; /**玩家计算在线时长时间戳 */ @@ -125,7 +125,7 @@ Object.defineProperties(BaseConnection.prototype, { }, }); -BaseConnection.prototype.getDefaultFightData = async function (this: BaseConnection, def?: k_v) { +BaseConnection.prototype.getDefaultFightData = async function (this: BaseConnection, def?: k_v, ext_buff?: { [type: string]: k_v }) { let posObj = def || this.heroPos; let roles: k_v = {}; @@ -144,7 +144,11 @@ BaseConnection.prototype.getDefaultFightData = async function (this: BaseConnect roles[pos] = { ...hero, attr: { - ...HeroShared.getHeroBasicAttr(hero, { ...this.otherBuff, allBuff: HeroShared.getAllBuff(heros) }, Number(pos)) + ...HeroShared.getHeroBasicAttr(hero, { + ...ext_buff, + ...this.otherBuff, + allBuff: HeroShared.getAllBuff(heros) + }, Number(pos)) } }; } @@ -189,40 +193,40 @@ BaseConnection.prototype.refreshPower = async function (this: BaseConnection 0) { + if (this.gud.renown > 0) { let mwConf = G.gc.mw_dj // 各等级累加 - for(let i = 1; i <= this.gud.renown; i++) { + for (let i = 1; i <= this.gud.renown; i++) { let mwData = mwConf[i] - for(let k in mwData.buff) { + for (let k in mwData.buff) { zjBuff[k] += mwData.buff[k] } } } // 训练计划加成 let skillConf = G.gc.xunlianjihua - if(this.gud.skills) { - for(let i in this.gud.skills) { + if (this.gud.skills) { + for (let i in this.gud.skills) { let item = skillConf[i] - for(let j in zjBuff) { - if((j + 'pro') == item.skill) { - zjBuff[j] += Math.floor(zjBuff[j] * PublicShared.eval(item.v, { slv: this.gud.skills[i]})) + for (let j in zjBuff) { + if ((j + 'pro') == item.skill) { + zjBuff[j] += Math.floor(zjBuff[j] * PublicShared.eval(item.v, { slv: this.gud.skills[i] })) } } } @@ -239,15 +243,15 @@ BaseConnection.prototype.refreshPower = async function (this: BaseConnection this.gud?.maxpower){ + if (power > this.gud?.maxpower) { //记录历史最大战力 //this.gud.maxpower = power; dbUpdate['maxpower'] = power; } //this.gud.power = power; - setGud(this.uid,dbUpdate); - + setGud(this.uid, dbUpdate); + G.mongodb.collection('user').updateOne({ uid: this.uid }, { $set: dbUpdate }); this.sendMsg('msg_s2c/PlayerChange', dbUpdate); @@ -311,9 +315,9 @@ ApiCall.prototype.addEventMsg = function (this: ApiCall) { if (!this.eventMsg[msgName][msgKey]) this.eventMsg[msgName][msgKey] = {}; PublicShared.mergeProperty(this.eventMsg[msgName][msgKey], msg); } else { - if(doubleApi.includes(this.service?.name) && this.service?.type=='api'&& Object.keys(this.eventMsg[msgName])[0]==Object.keys(msgKey)[0]){ + if (doubleApi.includes(this.service?.name) && this.service?.type == 'api' && Object.keys(this.eventMsg[msgName])[0] == Object.keys(msgKey)[0]) { this.eventMsg[msgName] = msgKey - }else { + } else { PublicShared.mergeProperty(this.eventMsg[msgName], msgKey); } } diff --git a/src/jsonType.ts b/src/jsonType.ts index 59a07a6..c6edbea 100644 --- a/src/jsonType.ts +++ b/src/jsonType.ts @@ -106,6 +106,18 @@ type gc_clsl_com = { "divide": { "day": [number, number], "group": number, [x: string]: any }[], "divideTime": number, "fightTime": [number, number], "prizeTime": number, "fightWinPrize": { "total": number, "prize": { "a": string, "t": string, "n": number, [x: string]: any }[], "star": number, [x: string]: any }[], "fightNum": number, "vipBuyFightNum": [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number], "buyFightNumNeed": { "a": string, "t": string, "n": number, [x: string]: any }[], "rankPrize": { "rank": [number, number], "prize": { "a": string, "t": string, "n": number, [x: string]: any }[], "title": string, [x: string]: any }[], "danPrize": { "star": number, "prize": { "a": string, "t": string, "n": number, [x: string]: any }[], [x: string]: any }[], "email_rank": { "title": string, "content": string, [x: string]: any }, "email_dan": { "title": string, "content": string, [x: string]: any }, [x: string]: any } +type gc_renown_level = { + [id: string]: { + id: number, + renownlevel: number, + maxlevel: number, + cost: { "a": string, "t": string, "n": number, [x: string]: any }[], + atk: number, + def: number, + hp: number, + } +} + type gc_clsl_dan = k_v<{ /** 总星级 */ 'allStar': number @@ -1946,7 +1958,7 @@ type gcType = { kfcb_prize: gc_kfcb_prize yuyuemail: gc_yuyuemail tuisonglibao: gc_push_gift - + renown_level: gc_renown_level } @@ -1957,4 +1969,3 @@ declare global { export function initGcType() { } - \ No newline at end of file diff --git a/src/lng.ts b/src/lng.ts index dc754fb..4593c26 100644 --- a/src/lng.ts +++ b/src/lng.ts @@ -352,7 +352,9 @@ class Lng { huoqupaihang: "huoqupaihang"; wucigonghui: "wucigonghui"; nameyicunzai: "nameyicunzai"; - ljlibaotips_8:"ljlibaotips_8"; + ljlibaotips_8: "ljlibaotips_8"; + + weiwang_12: "weiwang_12"; "11111" = "globalThis.lng.chat_1" // return call.error('', { code: -3, message: globalThis.lng.chat_2 }); diff --git a/src/module/collection_weiwang.ts b/src/module/collection_weiwang.ts new file mode 100644 index 0000000..6d72fc5 --- /dev/null +++ b/src/module/collection_weiwang.ts @@ -0,0 +1,9 @@ +export type CollectionWeiwang = { + uid: string; + + hp: number; + atk: number; + def: number; + + buff: k_v; +} \ No newline at end of file diff --git a/src/module/mongodb.ts b/src/module/mongodb.ts index 8bcacc7..dd22c84 100644 --- a/src/module/mongodb.ts +++ b/src/module/mongodb.ts @@ -60,6 +60,7 @@ import {CollectionRmbuse} from "./collection_rmbuse"; import {CollectionFightLog} from "./collection_fightLog"; import {CollectionShop} from "./collection_shop"; import {CollectionPushGift} from "./collection_pushgift"; +import { CollectionWeiwang } from './collection_weiwang'; export type MongodbCollections = { user: CollectionUser; @@ -136,4 +137,5 @@ export type MongodbCollections = { pushgift:CollectionPushGift huodong_user: CollectionUser; + weiwang: CollectionWeiwang; }; \ No newline at end of file diff --git a/src/public/fight.ts b/src/public/fight.ts index b2029a4..712624b 100644 --- a/src/public/fight.ts +++ b/src/public/fight.ts @@ -1,43 +1,43 @@ -import {ApiCall, TsrpcError} from 'tsrpc'; -import {FightControl} from '../shared/fightControl/fightCntrol'; -import {formatNpcData} from '../shared/fightControl/fightFun'; -import {fightResult, joinFightData, roleDataType} from '../shared/fightControl/fightType'; -import {rankInfo} from '../shared/protocols/type'; -import {HeroShared} from '../shared/public/hero'; -import {PlayerShared} from '../shared/public/player'; -import {HeroFun} from './hero'; -import {UserFun} from './user'; -import {re, string} from "mathjs"; -import {getGud} from './gud'; -import {PushGiftFun} from "./pushgift"; +import { ApiCall, TsrpcError } from 'tsrpc'; +import { FightControl } from '../shared/fightControl/fightCntrol'; +import { formatNpcData } from '../shared/fightControl/fightFun'; +import { fightResult, joinFightData, roleDataType } from '../shared/fightControl/fightType'; +import { rankInfo } from '../shared/protocols/type'; +import { HeroShared } from '../shared/public/hero'; +import { PlayerShared } from '../shared/public/player'; +import { HeroFun } from './hero'; +import { UserFun } from './user'; +import { re, string } from "mathjs"; +import { getGud } from './gud'; +import { PushGiftFun } from "./pushgift"; type fightType = 'tanxian' | 'pata' | 'jjc' | 'gbtx' | 'qjzzd' | 'meirishilian' | 'wzrycross'; -let fights:{[key:string]:FightControl} = { - +let fights: { [key: string]: FightControl } = { + }; -function clearFights (){ +function clearFights() { //定时清理战斗 - setInterval(()=>{ + setInterval(() => { let now = Date.now(); - for (let key in fights){ - if (now - fights[key].startTime > 30000){ - console.log("清理战斗",key); - try{ + for (let key in fights) { + if (now - fights[key].startTime > 30000) { + console.log("清理战斗", key); + try { fights[key].release(); - }catch(e){ + } catch (e) { console.error(e); } delete fights[key]; } } - },5000); + }, 5000); } clearFights(); export class FightFun { - static fightIndex:number = 0; + static fightIndex: number = 0; static fight(data: joinFightData[], maxRoundNums = 30, fightType: "pvp" | "pve" = 'pvp') { this.fightIndex++; @@ -80,7 +80,7 @@ export class FightFun { }); return { - player: {...player, buff: PlayerShared.getBuff(player)}, + player: { ...player, buff: PlayerShared.getBuff(player) }, roles: roles }; } @@ -101,8 +101,15 @@ export class FightFun { /**挑战npc */ static async fightNpc(call: ApiCall, npcId: string | number, type: fightType, data?: joinFightData) { + let ext_buff = {}; - let my = data || await call.conn.getDefaultFightData(); + if (["tanxian"].indexOf(type) != -1) { + // 威望buff + let weiwang = await G.mongodb.collection("weiwang").findOne({ uid: call.uid }); + ext_buff["weiwang"] = weiwang?.buff ? weiwang.buff : { "atk": 0, "def": 0, "hp": 0 }; + } + + let my = data || await call.conn.getDefaultFightData(undefined, ext_buff); if (Object.keys(my.roles).length < 1) { throw new TsrpcError('至少需要上阵一个英雄'); @@ -133,11 +140,11 @@ export class FightFun { let writeList = ['ganhai', 'jjc', 'hbzbJfs', 'hbzbZbs', 'slzd', 'clsl'] if (uid.indexOf('npc') != -1 || !writeList.includes(type)) return; - G.mongodb.collection('fightLog').insertOne({uid, type, ...result}) + G.mongodb.collection('fightLog').insertOne({ uid, type, ...result }) } static async readLog(uid: string, type: string, len = 20) { - return await G.mongodb.collection('fightLog').find({uid, type}).limit(len).toArray() || [] + return await G.mongodb.collection('fightLog').find({ uid, type }).limit(len).toArray() || [] } } \ No newline at end of file diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 2dc1df9..638b116 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -330,10 +330,12 @@ import { ReqRenownBuy, ResRenownBuy } from './user/PtlRenownBuy'; import { ReqRenownGetPrize, ResRenownGetPrize } from './user/PtlRenownGetPrize'; import { ReqRenownOpen, ResRenownOpen } from './user/PtlRenownOpen'; import { ReqTujian, ResTujian } from './user/PtlTujian'; +import { ReqOpen as ReqOpen_61, ResOpen as ResOpen_61 } from './weiwang/PtlOpen'; +import { ReqUpLv, ResUpLv } from './weiwang/PtlUpLv'; import { ReqDecompose, ResDecompose } from './weixiuchang/PtlDecompose'; import { ReqExchange as ReqExchange_1, ResExchange as ResExchange_1 } from './weixiuchang/PtlExchange'; -import { ReqOpen as ReqOpen_61, ResOpen as ResOpen_61 } from './weixiuchang/PtlOpen'; -import { ReqUpLv, ResUpLv } from './weixiuchang/PtlUpLv'; +import { ReqOpen as ReqOpen_62, ResOpen as ResOpen_62 } from './weixiuchang/PtlOpen'; +import { ReqUpLv as ReqUpLv_1, ResUpLv as ResUpLv_1 } from './weixiuchang/PtlUpLv'; import { ReqUpStar, ResUpStar } from './weixiuchang/PtlUpStar'; import { ReqAutoBaoMing, ResAutoBaoMing } from './wzry/PtlAutoBaoMing'; import { ReqBaoMing, ResBaoMing } from './wzry/PtlBaoMing'; @@ -343,7 +345,7 @@ import { ReqDldFight, ResDldFight } from './wzry/PtlDldFight'; import { ReqDldRefre, ResDldRefre } from './wzry/PtlDldRefre'; import { ReqJingCai, ResJingCai } from './wzry/PtlJingCai'; import { ReqJingCaiOpen, ResJingCaiOpen } from './wzry/PtlJingCaiOpen'; -import { ReqOpen as ReqOpen_62, ResOpen as ResOpen_62 } from './wzry/PtlOpen'; +import { ReqOpen as ReqOpen_63, ResOpen as ResOpen_63 } from './wzry/PtlOpen'; import { ReqUpdateFight, ResUpdateFight } from './wzry/PtlUpdateFight'; import { ReqWzzd, ResWzzd } from './wzry/PtlWzzd'; import { ReqZuanShiOpen, ResZuanShiOpen } from './wzry/PtlZuanShiOpen'; @@ -351,7 +353,7 @@ import { ReqAllGet, ResAllGet } from './xstask/PtlAllGet'; import { ReqGet as ReqGet_3, ResGet as ResGet_3 } from './xstask/PtlGet'; import { ReqLvUp as ReqLvUp_4, ResLvUp as ResLvUp_4 } from './xstask/PtlLvUp'; import { ReqOnekeyReceive, ResOnekeyReceive } from './xstask/PtlOnekeyReceive'; -import { ReqOpen as ReqOpen_63, ResOpen as ResOpen_63 } from './xstask/PtlOpen'; +import { ReqOpen as ReqOpen_64, ResOpen as ResOpen_64 } from './xstask/PtlOpen'; import { ReqReceive as ReqReceive_10, ResReceive as ResReceive_10 } from './xstask/PtlReceive'; import { ReqRefresh as ReqRefresh_8, ResRefresh as ResRefresh_8 } from './xstask/PtlRefresh'; import { ReqHandle, ResHandle } from './yongbingzhuzhan/PtlHandle'; @@ -1569,6 +1571,14 @@ export interface ServiceType { req: ReqTujian, res: ResTujian }, + "weiwang/Open": { + req: ReqOpen_61, + res: ResOpen_61 + }, + "weiwang/UpLv": { + req: ReqUpLv, + res: ResUpLv + }, "weixiuchang/Decompose": { req: ReqDecompose, res: ResDecompose @@ -1578,12 +1588,12 @@ export interface ServiceType { res: ResExchange_1 }, "weixiuchang/Open": { - req: ReqOpen_61, - res: ResOpen_61 + req: ReqOpen_62, + res: ResOpen_62 }, "weixiuchang/UpLv": { - req: ReqUpLv, - res: ResUpLv + req: ReqUpLv_1, + res: ResUpLv_1 }, "weixiuchang/UpStar": { req: ReqUpStar, @@ -1622,8 +1632,8 @@ export interface ServiceType { res: ResJingCaiOpen }, "wzry/Open": { - req: ReqOpen_62, - res: ResOpen_62 + req: ReqOpen_63, + res: ResOpen_63 }, "wzry/UpdateFight": { req: ReqUpdateFight, @@ -1654,8 +1664,8 @@ export interface ServiceType { res: ResOnekeyReceive }, "xstask/Open": { - req: ReqOpen_63, - res: ResOpen_63 + req: ReqOpen_64, + res: ResOpen_64 }, "xstask/Receive": { req: ReqReceive_10, @@ -3488,141 +3498,151 @@ export const serviceProto: ServiceProto = { }, { "id": 331, - "name": "weixiuchang/Decompose", + "name": "weiwang/Open", "type": "api" }, { "id": 332, - "name": "weixiuchang/Exchange", + "name": "weiwang/UpLv", "type": "api" }, { "id": 333, - "name": "weixiuchang/Open", + "name": "weixiuchang/Decompose", "type": "api" }, { "id": 334, - "name": "weixiuchang/UpLv", + "name": "weixiuchang/Exchange", "type": "api" }, { "id": 335, - "name": "weixiuchang/UpStar", + "name": "weixiuchang/Open", "type": "api" }, { "id": 336, - "name": "wzry/AutoBaoMing", + "name": "weixiuchang/UpLv", "type": "api" }, { "id": 337, - "name": "wzry/BaoMing", + "name": "weixiuchang/UpStar", "type": "api" }, { "id": 338, - "name": "wzry/catFightLog", + "name": "wzry/AutoBaoMing", "type": "api" }, { "id": 339, - "name": "wzry/CatGroup", + "name": "wzry/BaoMing", "type": "api" }, { "id": 340, - "name": "wzry/DldFight", + "name": "wzry/catFightLog", "type": "api" }, { "id": 341, - "name": "wzry/DldRefre", + "name": "wzry/CatGroup", "type": "api" }, { "id": 342, - "name": "wzry/JingCai", + "name": "wzry/DldFight", "type": "api" }, { "id": 343, - "name": "wzry/JingCaiOpen", + "name": "wzry/DldRefre", "type": "api" }, { "id": 344, - "name": "wzry/Open", + "name": "wzry/JingCai", "type": "api" }, { "id": 345, - "name": "wzry/UpdateFight", + "name": "wzry/JingCaiOpen", "type": "api" }, { "id": 346, - "name": "wzry/Wzzd", + "name": "wzry/Open", "type": "api" }, { "id": 347, - "name": "wzry/ZuanShiOpen", + "name": "wzry/UpdateFight", "type": "api" }, { "id": 348, - "name": "xstask/AllGet", + "name": "wzry/Wzzd", "type": "api" }, { "id": 349, - "name": "xstask/Get", + "name": "wzry/ZuanShiOpen", "type": "api" }, { "id": 350, - "name": "xstask/LvUp", + "name": "xstask/AllGet", "type": "api" }, { "id": 351, - "name": "xstask/OnekeyReceive", + "name": "xstask/Get", "type": "api" }, { "id": 352, - "name": "xstask/Open", + "name": "xstask/LvUp", "type": "api" }, { "id": 353, - "name": "xstask/Receive", + "name": "xstask/OnekeyReceive", "type": "api" }, { "id": 354, - "name": "xstask/Refresh", + "name": "xstask/Open", "type": "api" }, { "id": 355, - "name": "yongbingzhuzhan/Handle", + "name": "xstask/Receive", "type": "api" }, { "id": 356, - "name": "zhanqianbushu/ChangePos", + "name": "xstask/Refresh", "type": "api" }, { "id": 357, - "name": "zhanqianbushu/Select", + "name": "yongbingzhuzhan/Handle", "type": "api" }, { "id": 358, + "name": "zhanqianbushu/ChangePos", + "type": "api" + }, + { + "id": 359, + "name": "zhanqianbushu/Select", + "type": "api" + }, + { + "id": 360, "name": "zhanqianbushu/Up", "type": "api" } @@ -22052,6 +22072,121 @@ export const serviceProto: ServiceProto = { "user/PtlTujian/ResTujian": { "type": "Interface" }, + "weiwang/PtlOpen/ReqOpen": { + "type": "Interface" + }, + "weiwang/PtlOpen/ResOpen": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "lv", + "type": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "hp", + "type": { + "type": "Number" + } + }, + { + "id": 1, + "name": "atk", + "type": { + "type": "Number" + } + }, + { + "id": 2, + "name": "def", + "type": { + "type": "Number" + } + } + ] + } + } + ] + }, + "weiwang/PtlUpLv/ReqUpLv": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "lv", + "type": { + "type": "Number" + } + }, + { + "id": 1, + "name": "type", + "type": { + "type": "Union", + "members": [ + { + "id": 0, + "type": { + "type": "Literal", + "literal": "hp" + } + }, + { + "id": 1, + "type": { + "type": "Literal", + "literal": "atk" + } + }, + { + "id": 2, + "type": { + "type": "Literal", + "literal": "def" + } + } + ] + } + } + ] + }, + "weiwang/PtlUpLv/ResUpLv": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "lv", + "type": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "hp", + "type": { + "type": "Number" + } + }, + { + "id": 1, + "name": "atk", + "type": { + "type": "Number" + } + }, + { + "id": 2, + "name": "def", + "type": { + "type": "Number" + } + } + ] + } + } + ] + }, "weixiuchang/PtlDecompose/ReqDecompose": { "type": "Interface", "properties": [ diff --git a/src/shared/protocols/weiwang/PtlOpen.ts b/src/shared/protocols/weiwang/PtlOpen.ts new file mode 100644 index 0000000..f3ce057 --- /dev/null +++ b/src/shared/protocols/weiwang/PtlOpen.ts @@ -0,0 +1,11 @@ +export interface ReqOpen { + +} + +export interface ResOpen { + lv: { + hp: number + atk: number + def: number + } +} diff --git a/src/shared/protocols/weiwang/PtlUpLv.ts b/src/shared/protocols/weiwang/PtlUpLv.ts new file mode 100644 index 0000000..e431c40 --- /dev/null +++ b/src/shared/protocols/weiwang/PtlUpLv.ts @@ -0,0 +1,12 @@ +export interface ReqUpLv { + lv: number + type: "hp" | "atk" | "def" +} + +export interface ResUpLv { + lv: { + hp: number + atk: number + def: number + } +}