Merge branch 'feature/weiwang' into dev

This commit is contained in:
xichaoyin 2024-01-04 16:13:12 +08:00
commit a0d06cdaf4
5 changed files with 91 additions and 14 deletions

View File

@ -1316,6 +1316,20 @@ export const serviceProto: ServiceProto<ServiceType> = {
}
},
"optional": true
},
{
"id": 38,
"name": "weiwang",
"type": {
"type": "Interface",
"indexSignature": {
"keyType": "String",
"type": {
"type": "Number"
}
}
},
"optional": true
}
]
},

View File

@ -2637,6 +2637,20 @@ export const serviceProto: ServiceProto<ServiceType> = {
}
},
"optional": true
},
{
"id": 38,
"name": "weiwang",
"type": {
"type": "Interface",
"indexSignature": {
"keyType": "String",
"type": {
"type": "Number"
}
}
},
"optional": true
}
]
},

View File

@ -4585,6 +4585,20 @@ export const serviceProto: ServiceProto<ServiceType> = {
}
},
"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<ServiceType> = {
}
},
"optional": true
},
{
"id": 38,
"name": "weiwang",
"type": {
"type": "Interface",
"indexSignature": {
"keyType": "String",
"type": {
"type": "Number"
}
}
},
"optional": true
}
]
},
@ -24380,6 +24408,20 @@ export const serviceProto: ServiceProto<ServiceType> = {
}
},
"optional": true
},
{
"id": 38,
"name": "weiwang",
"type": {
"type": "Interface",
"indexSignature": {
"keyType": "String",
"type": {
"type": "Number"
}
}
},
"optional": true
}
]
},

View File

@ -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 };
};

View File

@ -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<player & {
allBuff: k_v<number>;
@ -31,7 +31,7 @@ export class HeroShared {
*/
static getHeroBasicAttr(hero: heroDataType, otherBuff: otherBuff = G.otherBuff, pos = 0) {
let jiban = 0;
let buff: k_v<any> = {skillArr: []};
let buff: k_v<any> = { 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 }
];
}