✨ feat(gvg): 遗迹生成数据

This commit is contained in:
luying
2023-02-17 10:58:06 +08:00
parent 3c8ac3c9e5
commit 4035645772
12 changed files with 2174 additions and 1270 deletions
+164 -2
View File
@@ -1,11 +1,15 @@
import { RoleType } from "../../db/Role";
import { GVGLeagueType } from "../../db/GVGLeague";
import { GVGLeaguePrepareType } from "../../db/GVGLeaguePrepare";
import { Distribute, GVGUserDataType } from "../../db/GVGUserData";
import { GVGUserDataType } from "../../db/GVGUserData";
import { GuildType } from "../../db/Guild";
import { LEAGUE_JOB } from "../../consts";
import { GVGLeagueFarmType } from "../../db/GVGLeagueFarm";
import { nowSeconds } from "../../pubUtils/timeUtil";
import { DicGVGVestige } from "../../pubUtils/dictionary/DicGVGVestige";
import { EXTERIOR, GVG } from "../../pubUtils/dicParam";
import { DicWarJson } from "../../pubUtils/dictionary/DicWarJson";
import { gameData } from "../../pubUtils/data";
import { HeroType } from "../../db/Hero";
class LeagueLeaderInfo {
name: string; // 盟主名
@@ -353,3 +357,161 @@ export interface LeagueGood {
id: number,
count: number
}
export class GVGVestigeOppPlayer {
rank: number;
roleId: string;
roleName: string;
lv: number;
head: number;
frame: number;
spine: number;
title: number;
guildName: string;
serverName: string;
lineupCe: number;
score: number;
constructor(rank: number) {
this.rank = rank;
}
setByRole(role: RoleType, serverNames: any, lineupCe: number, score: number) {
this.roleId = role.roleId;
this.roleName = role.roleName;
this.lv = role.lv;
this.head = role.head;
this.frame = role.frame;
this.spine = role.spine;
this.title = role.title;
this.guildName = role.guildName;
this.serverName = serverNames[role.serverId];
this.lineupCe = lineupCe;
this.score = score;
}
setByDic(dic: DicGVGVestige, serverName: string) {
this.lineupCe = dic.ce;
this.roleId = `robot${this.rank}`;
this.roleName = GVG.GVG_ROBOT_NAME;
this.lv = dic.level;
this.head = dic.head;
this.frame = EXTERIOR.EXTERIOR_FACECASE;
this.spine = dic.spine;
this.title = 1;
this.guildName = '';
this.serverName = serverName;
this.lineupCe = dic.ce;
this.score = dic.score;
}
}
// getOppLineup返回
export class GVGVestigeOppLineupHero {
hid: number; // 武将
skinId: number; // 皮肤id
quality: number; // 品质
star: number; // 星级
colorStar: number; // 彩星
lv: number; // 等级
setByWarJson(warJson: DicWarJson) {
this.hid = warJson.actorId;
this.skinId = warJson.actorId;
this.lv = warJson.lv;
let dicHero = gameData.hero.get(warJson.actorId);
if(dicHero) {
this.quality = dicHero.quality;
if(this.quality == 4) {
this.star = 6;
this.colorStar = warJson.star;
} else {
this.star = warJson.star;
this.colorStar = 0;
}
}
}
setByDefenseHero(hero: HeroType) {
this.hid = hero.hid;
this.skinId = hero.skinId;
this.quality = hero.quality;
this.star = hero.star;
this.colorStar = hero.colorStar;
this.lv = hero.lv;
}
}
export class GVGVestigeOppLineup {
vestigeId: number; // 遗迹id
myRank: number;
rank: number;
score: number;
isRobot: boolean;
roleId: string;
roleName: string;
serverName: string;
guildName: string;
lv: number;
head: number;
frame: number;
spine: number;
title: number;
lineupCe: number = 0; // 阵容战力
heroes: GVGVestigeOppLineupHero[] = [];
constructor(vestigeId: number) {
this.vestigeId = vestigeId;
}
setMyRank(myRank: number) {
this.myRank = myRank;
}
setRobot(dic: DicGVGVestige, warJsons: DicWarJson[], serverName: string) {
this.isRobot = true;
this.rank = dic.rank;
this.score = dic.score;
this.roleId = `robot${dic.rank}`;
this.roleName = GVG.GVG_ROBOT_NAME;
this.serverName = serverName;
this.guildName = '';
this.lineupCe = dic.ce;
this.lv = dic.level;
this.head = dic.head;
this.frame = EXTERIOR.EXTERIOR_FACECASE;
this.spine = dic.spine;
this.title = 1;
for(let warJson of warJsons) {
if(warJson.relation == 2) {
let hero = new GVGVestigeOppLineupHero();
hero.setByWarJson(warJson);
this.heroes.push(hero);
}
}
}
setPlayer(dic: DicGVGVestige, role: RoleType, heroes: HeroType[], serverNames: any) {
this.isRobot = false;
this.rank = dic.rank;
this.score = dic.score;
this.roleId = role.roleId;
this.roleName = role.roleName;
this.serverName = serverNames[role.serverId];
this.guildName = role.guildName;
this.title = role.title;
this.lv = role.lv;
this.head = role.head;
this.frame = role.frame;
this.spine = role.spine;
for(let hero of heroes) {
this.lineupCe += hero.ce;
let obj = new GVGVestigeOppLineupHero();
obj.setByDefenseHero(hero);
this.heroes.push(obj);
}
}
}