pvp:修复赛季相关

This commit is contained in:
luying
2021-11-02 10:16:50 +08:00
parent 15ed1f71fe
commit 4c80a22ccf
15 changed files with 178 additions and 91 deletions

View File

@@ -4,6 +4,8 @@ import { RoleType } from "../../db/Role";
import { WAR_TYPE } from "../../consts";
import { gameData } from "../../pubUtils/data";
import { EXTERIOR } from "../../pubUtils/dicParam";
import { HeroType } from "../../db/Hero";
import { PvpDefenseType } from "../../db/PvpDefense";
export class PlayerDetailHero {
actorId: number;
@@ -12,7 +14,8 @@ export class PlayerDetailHero {
star: number;
colorStar: number;
quality: number;
score: number;
score: number = 0;
isDefense: boolean;
setPvpHeroInfo?(hero: PvpEnemies|PvpOtherHeroes) {
this.actorId = hero.actorId;
@@ -23,6 +26,37 @@ export class PlayerDetailHero {
this.quality = hero.quality;
this.score = hero.score;
}
setByDbHero?(hero: HeroType) {
if(!hero) return;
this.actorId = hero.hid;
this.lv = hero.lv;
this.star = hero.star;
this.colorStar = hero.colorStar;
this.quality = hero.quality;
this.skinId = hero.skinId;
}
setPvpDefense?(pvpDefense: PvpDefenseType) {
if(!pvpDefense) return;
let { heroScores, defense } = pvpDefense;
let heroScore = heroScores.find(cur => cur.hid == this.actorId);
this.score = heroScore? heroScore.score: 0;
if(defense && defense.heroes) {
let h = defense.heroes.find(cur => cur.actorId == this.actorId);
if(!!h) this.isDefense = true;
} else {
this.isDefense = false;
}
}
setIsDefense?(isDefense: boolean) {
this.isDefense = isDefense;
}
}
class PlayerDetailBattle {

View File

@@ -77,7 +77,7 @@ export class Enemies extends PvpHeroInfo {
@prop({ required: false })
y: number; // 战场y坐标
@prop({ required: false })
direction: number; // 朝向
dirction: number; // 朝向
@prop({ required: false })
var: number; // 变量
@prop({ required: false })
@@ -99,7 +99,7 @@ export class Enemies extends PvpHeroInfo {
this.outIndex = heroInfo.outIndex != undefined ? heroInfo.outIndex : warjson.outIndex;
this.x = warjson.x;
this.y = warjson.y;
this.direction = warjson.direction;
this.dirction = warjson.dirction;
this.var = warjson.var;
this.lv = heroInfo.lv != undefined ? heroInfo.lv : warjson.lv;
this.hide = warjson.hide;

View File

@@ -316,6 +316,7 @@ export class KeyName {
guildCode?: string;
cityId?: number;
hid?: number;
seasonNum?: number;
constructor(key: string, param: KeyNameParam) {
this.key = key;
@@ -323,6 +324,7 @@ export class KeyName {
if(param.guildCode) this.guildCode = param.guildCode;
if(param.cityId) this.cityId = param.cityId;
if(param.hid) this.hid = param.hid;
if(param.seasonNum) this.seasonNum = param.seasonNum;
}
public getName() {
@@ -331,6 +333,7 @@ export class KeyName {
if(this.guildCode) res += `:${this.guildCode}`;
if(this.cityId) res += `:${this.cityId}`;
if(this.hid) res += `:${this.hid}`;
if(this.seasonNum) res += `:${this.seasonNum}`;
return res;
}