Merge branch 'feature/skin' into dev
This commit is contained in:
commit
4e2b7ca74e
@ -1,7 +1,7 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import { ApiCall } from "tsrpc";
|
||||||
import HeroSkinFun from "../../public/heroskin";
|
|
||||||
import { PlayerFun } from "../../public/player";
|
import { PlayerFun } from "../../public/player";
|
||||||
import { ReqUplv, ResUplv } from "../../shared/protocols/heroskin/PtlUplv";
|
import { ReqUplv, ResUplv } from "../../shared/protocols/heroskin/PtlUplv";
|
||||||
|
import HeroSkinFun from "../../public/heroskin";
|
||||||
|
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqUplv, ResUplv>) {
|
export default async function (call: ApiCall<ReqUplv, ResUplv>) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import { ApiCall } from "tsrpc";
|
||||||
import { HeroFun } from "../../public/hero";
|
import { HeroFun } from "../../public/hero";
|
||||||
import HeroSkinFun from "../../public/heroskin";
|
|
||||||
import { ReqWear, ResWear } from "../../shared/protocols/heroskin/PtlWear";
|
import { ReqWear, ResWear } from "../../shared/protocols/heroskin/PtlWear";
|
||||||
|
import HeroSkinFun from "../../public/heroskin";
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqWear, ResWear>) {
|
export default async function (call: ApiCall<ReqWear, ResWear>) {
|
||||||
let hero = await HeroFun.getHero(call, call.req.heroOid);
|
let hero = await HeroFun.getHero(call, call.req.heroOid);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import { ApiCall } from "tsrpc";
|
||||||
import { call } from "../public/player";
|
import { call } from "../public/player";
|
||||||
import { PlayerFun } from "./player";
|
import { PlayerFun } from "../public/player";
|
||||||
|
|
||||||
|
|
||||||
export default class HeroSkinFun {
|
export default class HeroSkinFun {
|
||||||
@ -29,21 +29,4 @@ export default class HeroSkinFun {
|
|||||||
skin = Object.assign(skin, change);
|
skin = Object.assign(skin, change);
|
||||||
await PlayerFun.addAttr(call, { heroskin: skin });
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -21,7 +21,6 @@ import { PushGiftFun } from "./pushgift";
|
|||||||
import { ActionLog } from './actionLog/actionLog';
|
import { ActionLog } from './actionLog/actionLog';
|
||||||
import HeroSkinFun from './heroskin';
|
import HeroSkinFun from './heroskin';
|
||||||
|
|
||||||
|
|
||||||
export type call = {
|
export type call = {
|
||||||
get otherBuff(): otherBuff;
|
get otherBuff(): otherBuff;
|
||||||
uid: string;
|
uid: string;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import HeroSkinFun from '../../public/heroskin';
|
|
||||||
import { ResGetList } from '../protocols/hero/PtlGetList';
|
import { ResGetList } from '../protocols/hero/PtlGetList';
|
||||||
import { player } from '../protocols/user/type';
|
import { player } from '../protocols/user/type';
|
||||||
import { EquipShared } from './equip';
|
import { EquipShared } from './equip';
|
||||||
|
import HeroSkinShared from './heroskin';
|
||||||
import { PeijianShared } from './peijian';
|
import { PeijianShared } from './peijian';
|
||||||
import { PlayerShared } from './player';
|
import { PlayerShared } from './player';
|
||||||
import { PublicShared } from './public';
|
import { PublicShared } from './public';
|
||||||
@ -289,7 +289,7 @@ export class HeroShared {
|
|||||||
for (let skinId in otherBuff.heroskin) {
|
for (let skinId in otherBuff.heroskin) {
|
||||||
let skinConf = G.gc.heroSkin[skinId];
|
let skinConf = G.gc.heroSkin[skinId];
|
||||||
if (skinConf.heroId != hero.heroId) console;
|
if (skinConf.heroId != hero.heroId) console;
|
||||||
PublicShared.mergeProperty(buff, HeroSkinFun.calcBuff(
|
PublicShared.mergeProperty(buff, HeroSkinShared.calcBuff(
|
||||||
skinId, otherBuff.heroskin[skinId]
|
skinId, otherBuff.heroskin[skinId]
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
21
src/shared/public/heroskin.ts
Normal file
21
src/shared/public/heroskin.ts
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user