Merge branch 'feature/skin' into dev

This commit is contained in:
xichaoyin 2024-01-05 20:46:58 +08:00
commit 4e2b7ca74e
6 changed files with 26 additions and 23 deletions

View File

@ -1,7 +1,7 @@
import { ApiCall } from "tsrpc";
import HeroSkinFun from "../../public/heroskin";
import { PlayerFun } from "../../public/player";
import { ReqUplv, ResUplv } from "../../shared/protocols/heroskin/PtlUplv";
import HeroSkinFun from "../../public/heroskin";
export default async function (call: ApiCall<ReqUplv, ResUplv>) {

View File

@ -1,7 +1,7 @@
import { ApiCall } from "tsrpc";
import { HeroFun } from "../../public/hero";
import HeroSkinFun from "../../public/heroskin";
import { ReqWear, ResWear } from "../../shared/protocols/heroskin/PtlWear";
import HeroSkinFun from "../../public/heroskin";
export default async function (call: ApiCall<ReqWear, ResWear>) {
let hero = await HeroFun.getHero(call, call.req.heroOid);

View File

@ -1,6 +1,6 @@
import { ApiCall } from "tsrpc";
import { call } from "../public/player";
import { PlayerFun } from "./player";
import { PlayerFun } from "../public/player";
export default class HeroSkinFun {
@ -29,21 +29,4 @@ export default class HeroSkinFun {
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<number> {
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;
}
}

View File

@ -21,7 +21,6 @@ import { PushGiftFun } from "./pushgift";
import { ActionLog } from './actionLog/actionLog';
import HeroSkinFun from './heroskin';
export type call = {
get otherBuff(): otherBuff;
uid: string;

View File

@ -1,7 +1,7 @@
import HeroSkinFun from '../../public/heroskin';
import { ResGetList } from '../protocols/hero/PtlGetList';
import { player } from '../protocols/user/type';
import { EquipShared } from './equip';
import HeroSkinShared from './heroskin';
import { PeijianShared } from './peijian';
import { PlayerShared } from './player';
import { PublicShared } from './public';
@ -289,7 +289,7 @@ export class HeroShared {
for (let skinId in otherBuff.heroskin) {
let skinConf = G.gc.heroSkin[skinId];
if (skinConf.heroId != hero.heroId) console;
PublicShared.mergeProperty(buff, HeroSkinFun.calcBuff(
PublicShared.mergeProperty(buff, HeroSkinShared.calcBuff(
skinId, otherBuff.heroskin[skinId]
));
}

View File

@ -0,0 +1,21 @@
export default class HeroSkinShared {
/**
* buff
* @param skid
* @param lv
* @returns {[string]: number}
* */
static calcBuff(skid: string, lv: number): k_v<number> {
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;
}
}