From 2e054daa656ef2ad631767e709ebf6b000babe9d Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Thu, 4 Jan 2024 16:12:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A8=81=E6=9C=9B?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=B1=9E=E6=80=A7=E5=9C=A8=E6=8E=A2=E9=99=A9?= =?UTF-8?q?=E6=88=98=E6=96=97=E4=B8=AD=E6=B2=A1=E6=9C=89=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cross/protocols/serviceProto.ts | 14 +++++++++ src/monopoly/protocols/serviceProto.ts | 14 +++++++++ src/shared/protocols/serviceProto.ts | 42 ++++++++++++++++++++++++++ src/shared/protocols/user/PtlLogin.ts | 4 ++- src/shared/public/hero.ts | 31 +++++++++++-------- 5 files changed, 91 insertions(+), 14 deletions(-) diff --git a/src/cross/protocols/serviceProto.ts b/src/cross/protocols/serviceProto.ts index e99cd52..6ba4ee3 100644 --- a/src/cross/protocols/serviceProto.ts +++ b/src/cross/protocols/serviceProto.ts @@ -1319,6 +1319,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 38, + "name": "weiwang", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, diff --git a/src/monopoly/protocols/serviceProto.ts b/src/monopoly/protocols/serviceProto.ts index 886f4d6..21be2fe 100644 --- a/src/monopoly/protocols/serviceProto.ts +++ b/src/monopoly/protocols/serviceProto.ts @@ -2637,6 +2637,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 38, + "name": "weiwang", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 26ce61e..0175ebe 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -4585,6 +4585,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 38, + "name": "weiwang", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, @@ -5829,6 +5843,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 38, + "name": "weiwang", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, @@ -24355,6 +24383,20 @@ export const serviceProto: ServiceProto = { } }, "optional": true + }, + { + "id": 38, + "name": "weiwang", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Number" + } + } + }, + "optional": true } ] }, diff --git a/src/shared/protocols/user/PtlLogin.ts b/src/shared/protocols/user/PtlLogin.ts index 49f56e3..6be7445 100644 --- a/src/shared/protocols/user/PtlLogin.ts +++ b/src/shared/protocols/user/PtlLogin.ts @@ -1,4 +1,4 @@ -import {gonghuiLevel} from '../gonghui/type'; +import { gonghuiLevel } from '../gonghui/type'; /** * 登录 @@ -193,4 +193,6 @@ export type playerAppend = { chatFrames?: { [id: string]: number; }; + /**威望额外属性*/ + weiwang?: { [k: string]: number }; }; \ No newline at end of file diff --git a/src/shared/public/hero.ts b/src/shared/public/hero.ts index dbddc83..4b6a644 100644 --- a/src/shared/public/hero.ts +++ b/src/shared/public/hero.ts @@ -1,10 +1,10 @@ -import {ResGetList} from '../protocols/hero/PtlGetList'; -import {player} from '../protocols/user/type'; -import {EquipShared} from './equip'; -import {PeijianShared} from './peijian'; -import {PlayerShared} from './player'; -import {PublicShared} from './public'; -import {ShiwuShared} from './shiwu'; +import { ResGetList } from '../protocols/hero/PtlGetList'; +import { player } from '../protocols/user/type'; +import { EquipShared } from './equip'; +import { PeijianShared } from './peijian'; +import { PlayerShared } from './player'; +import { PublicShared } from './public'; +import { ShiwuShared } from './shiwu'; export type otherBuff = Partial; @@ -31,7 +31,7 @@ export class HeroShared { */ static getHeroBasicAttr(hero: heroDataType, otherBuff: otherBuff = G.otherBuff, pos = 0) { let jiban = 0; - let buff: k_v = {skillArr: []}; + let buff: k_v = { skillArr: [] }; let heroConf = G.gc.hero[hero.heroId]; let heroLv = G.gc.herolv[heroConf.lvup]; let heroGrow = G.gc.herogrow[heroConf.jjup]?.[hero.jieji]; @@ -40,7 +40,7 @@ export class HeroShared { for (let k in heroLv.buff) { let val = heroLv.buff[k]; if (typeof val == 'number') buff[k] = val; - else buff[k] = PublicShared.eval(val, {lv: hero.lv}); + else buff[k] = PublicShared.eval(val, { lv: hero.lv }); // else buff[k] = Math.floor(new Function(`let lv=${hero.lv}; return ${val}`)()); } @@ -135,7 +135,7 @@ export class HeroShared { PublicShared.mergeProperty(buff, PeijianShared.getAttr(p)); let conf = G.gc.peijian[p.peijianId]; if (conf.suit) { - if (!suitObj[conf.suit]) suitObj[conf.suit] = {num: 0, minLv: 0}; + if (!suitObj[conf.suit]) suitObj[conf.suit] = { num: 0, minLv: 0 }; suitObj[conf.suit].num++; if (!suitObj[conf.suit].minLv || p.lv < suitObj[conf.suit].minLv) suitObj[conf.suit].minLv = p.lv; } @@ -273,11 +273,16 @@ export class HeroShared { if (otherBuff?.skills) { for (let [id, lv] of Object.entries(otherBuff.skills)) { if (lv && G.gc.xunlianjihua[id].use == 0) { - PublicShared.mergeProperty(buff, Object.fromEntries([G.gc.xunlianjihua[id].skill].map(k => [k, PublicShared.eval(G.gc.xunlianjihua[id].v[0], {slv: lv})]))); + PublicShared.mergeProperty(buff, Object.fromEntries([G.gc.xunlianjihua[id].skill].map(k => [k, PublicShared.eval(G.gc.xunlianjihua[id].v[0], { slv: lv })]))); } } } + // 威望加成计算 + if (otherBuff?.weiwang) { + PublicShared.mergeProperty(buff, otherBuff?.weiwang || {}); + } + //最后进行加成属性计算 for (let k in buff) { if (k.indexOf('pro') == -1) continue; @@ -368,8 +373,8 @@ export class HeroShared { static getHeroLvUpNeed(id: string | number, lv = 1): atn[] { return [ - {a: 'item', t: '1', n: G.gc.herolvup[lv].expneed}, - {a: 'attr', t: 'jinbi', n: G.gc.herolvup[lv].jinbineed} + { a: 'item', t: '1', n: G.gc.herolvup[lv].expneed }, + { a: 'attr', t: 'jinbi', n: G.gc.herolvup[lv].jinbineed } ]; }