好友:玩家武将详细信息
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { PvpEnemies, PvpOtherHeroes } from "../../db/generalField";
|
||||
import { PvpEnemies, PvpOtherHeroes } from "../../domain/dbGeneral";
|
||||
import { reduceCe } from "../../pubUtils/util";
|
||||
import { GuildType } from "../../db/Guild";
|
||||
import { RoleType } from "../../db/Role";
|
||||
import { RoleType, WarStar } from "../../db/Role";
|
||||
import { WAR_TYPE } from "../../consts/consts";
|
||||
|
||||
export class PlayerDetailHero {
|
||||
actorId: number;
|
||||
@@ -21,6 +22,24 @@ export class PlayerDetailHero {
|
||||
}
|
||||
}
|
||||
|
||||
class PlayerDetailBattle {
|
||||
main: number = 0;
|
||||
tower: number = 0;
|
||||
dungeon: number = 0;
|
||||
|
||||
constructor(warStar: WarStar[]) {
|
||||
for(let { id, warType } of warStar) {
|
||||
if(warType == WAR_TYPE.NORMAL) {
|
||||
if(id > this.main) this.main = id;
|
||||
} else if (warType == WAR_TYPE.TOWER) {
|
||||
if(id > this.tower) this.tower = id;
|
||||
} else if (warType == WAR_TYPE.MYSTERY) {
|
||||
if(id > this.dungeon) this.dungeon = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class PlayerDetail {
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
@@ -35,6 +54,9 @@ export class PlayerDetail {
|
||||
|
||||
heroes: PlayerDetailHero[];
|
||||
rank?:number = 0;
|
||||
|
||||
battle?: PlayerDetailBattle = new PlayerDetailBattle([]);
|
||||
|
||||
constructor(detail: PlayerDetail) {
|
||||
if(detail.roleId) this.roleId = detail.roleId;
|
||||
if(detail.roleName) this.roleName = detail.roleName;
|
||||
@@ -48,6 +70,10 @@ export class PlayerDetail {
|
||||
if(detail.heroes) this.heroes = detail.heroes;
|
||||
if(detail.rank) this.rank = detail.rank;
|
||||
}
|
||||
|
||||
setWarStar?(warStar: WarStar[]) {
|
||||
this.battle = new PlayerDetailBattle(warStar);
|
||||
}
|
||||
}
|
||||
|
||||
// 军团返回
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
import { prop } from '@typegoose/typegoose';
|
||||
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
||||
import { HeroType } from '../db/Hero';
|
||||
import { CeAttrNumber } from './roleField/attribute';
|
||||
|
||||
// 从玩家数据中覆盖warjson的部分字段
|
||||
export class PvpHeroInfo {
|
||||
@prop({ required: true })
|
||||
actorId?: number = 0; // 敌人id
|
||||
@prop({ required: false })
|
||||
actorName?: string = ""; // 敌人名
|
||||
@prop({ required: false })
|
||||
outIndex?: number = 0; // 程序将信息存入数组顺序
|
||||
@prop({ required: false })
|
||||
star?: number = 0; // 角色星级
|
||||
@prop({ required: false })
|
||||
lv?: number = 0; // 角色等级
|
||||
@prop({ required: false })
|
||||
skill?: string = "0"; // 技能
|
||||
@prop({ required: false })
|
||||
seid?: string = "&"; // 技能
|
||||
@prop({ required: false })
|
||||
spine?: string = "0"; // S动画
|
||||
@prop({ required: false })
|
||||
colorStar?: number = 0; // 觉醒
|
||||
@prop({ required: false })
|
||||
quality?: number = 0; // 品质
|
||||
|
||||
@prop({ required: true, _id: false })
|
||||
attribute?: CeAttrNumber; // 属性
|
||||
|
||||
setHeroInfo(hero: HeroType) {
|
||||
this.actorId = hero.hid;
|
||||
this.actorName = hero.hName;
|
||||
this.star = hero.star;
|
||||
this.lv = hero.lv;
|
||||
this.colorStar = hero.colorStar;
|
||||
this.quality = hero.quality;
|
||||
}
|
||||
|
||||
setRobotInfo(warjson: DicWarJson, lv: number, initialStar: number, quality: number) {
|
||||
this.actorId = warjson.actorId;
|
||||
this.actorName = warjson.actorName;
|
||||
this.star = initialStar;
|
||||
this.lv = lv;
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
setAttribute(attribute: CeAttrNumber) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
|
||||
setOutIndex(order: number) {
|
||||
this.outIndex = order;
|
||||
}
|
||||
}
|
||||
|
||||
// 远征敌军
|
||||
export class Enemies extends PvpHeroInfo {
|
||||
@prop({ required: true })
|
||||
actorId: number; // 敌人id
|
||||
@prop({ required: false })
|
||||
actorName: string; // 敌人名
|
||||
@prop({ required: false })
|
||||
dataId: number; // 战场中唯一指向武将的代码
|
||||
@prop({ required: false })
|
||||
relation: number; // 角色属于我方还是地方
|
||||
@prop({ required: false })
|
||||
x: number; // 战场x坐标
|
||||
@prop({ required: false })
|
||||
y: number; // 战场y坐标
|
||||
@prop({ required: false })
|
||||
direction: number; // 朝向
|
||||
@prop({ required: false })
|
||||
var: number; // 变量
|
||||
@prop({ required: false })
|
||||
hide: number; // 是否隐藏
|
||||
@prop({ required: false })
|
||||
initial_ai: number; // AI类型
|
||||
|
||||
// warjson 出兵表
|
||||
// heroInfo 覆盖掉出兵表的相应参数
|
||||
constructor(warjson: DicWarJson, heroInfo: PvpHeroInfo) {
|
||||
super();
|
||||
this.actorId = heroInfo.actorId != undefined ? heroInfo.actorId : warjson.actorId;
|
||||
this.actorName = heroInfo.actorName != undefined ? heroInfo.actorName : warjson.actorName;
|
||||
this.dataId = warjson.dataId;
|
||||
this.relation = warjson.relation;
|
||||
this.outIndex = heroInfo.outIndex != undefined ? heroInfo.outIndex : warjson.outIndex;
|
||||
this.x = warjson.x;
|
||||
this.y = warjson.y;
|
||||
this.direction = warjson.direction;
|
||||
this.var = warjson.var;
|
||||
this.lv = heroInfo.lv != undefined ? heroInfo.lv : warjson.lv;
|
||||
this.hide = warjson.hide;
|
||||
this.initial_ai = warjson.initial_ai;
|
||||
this.attribute = heroInfo.attribute;
|
||||
this.skill = heroInfo.skill != undefined ? heroInfo.skill : warjson.skill;
|
||||
this.seid = heroInfo.seid != undefined ? heroInfo.seid : warjson.seid;
|
||||
this.star = heroInfo.star != undefined ? heroInfo.star : warjson.star;
|
||||
this.spine = heroInfo.spine != undefined ? heroInfo.spine : warjson.spine;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class PvpEnemies extends Enemies {
|
||||
@prop({ required: true })
|
||||
star: number;
|
||||
@prop({ required: true })
|
||||
colorStar: number;
|
||||
@prop({ required: true })
|
||||
quality: number;
|
||||
@prop({ required: true })
|
||||
lv: number;
|
||||
@prop({ required: true })
|
||||
score: number;
|
||||
|
||||
// score: 这个武将的军功
|
||||
constructor(warjson: DicWarJson, heroInfo: PvpHeroInfo, score: number) {
|
||||
super(warjson, heroInfo);
|
||||
this.star = heroInfo.star;
|
||||
this.colorStar = heroInfo.colorStar;
|
||||
this.quality = heroInfo.quality;
|
||||
this.lv = heroInfo.lv;
|
||||
this.score = score;
|
||||
}
|
||||
}
|
||||
|
||||
// 未显示在阵容中的其他武将
|
||||
export class PvpOtherHeroes extends PvpHeroInfo {
|
||||
@prop({ required: true })
|
||||
score: number;
|
||||
|
||||
// score: 这个武将的军功
|
||||
constructor(score: number) {
|
||||
super();
|
||||
this.score = score;
|
||||
}
|
||||
}
|
||||
|
||||
export class ItemReward {
|
||||
@prop({ required: true })
|
||||
id: number;
|
||||
@prop({ required: true })
|
||||
count: number;
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
import { prop } from '@typegoose/typegoose';
|
||||
|
||||
// hero表内属性基础格式
|
||||
export class CeAttrData {
|
||||
@prop({ required: true })
|
||||
base: number = 0;
|
||||
@prop({ required: true })
|
||||
ratioUp: number = 0;
|
||||
@prop({ required: true })
|
||||
fixUp: number = 0;
|
||||
@prop({ required: true })
|
||||
equipUp: number = 0;
|
||||
}
|
||||
|
||||
// hero表全属性
|
||||
export class CeAttr {
|
||||
@prop({ required: false, _id: false })
|
||||
hp?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
atk?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
matk?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
def?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
mdef?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
agi?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
luk?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
hit?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
cri?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
flee?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
antCri?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
damageIncrease?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
damageDecrease?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
defIngnore?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
bloodSuck?: CeAttrData = new CeAttrData();
|
||||
}
|
||||
|
||||
// role表属性格式
|
||||
export class CeAttrDataRole {
|
||||
@prop({ required: true })
|
||||
ratioUp: number = 0;
|
||||
@prop({ required: true })
|
||||
fixUp: number = 0;
|
||||
}
|
||||
|
||||
// role表全属性
|
||||
export class CeAttrRole {
|
||||
@prop({ required: false, _id: false })
|
||||
hp?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
atk?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
matk?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
def?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
mdef?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
agi?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
luk?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
hit?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
cri?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
flee?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
antCri?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
damageIncrease?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
damageDecrease?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
defIngnore?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
bloodSuck?: CeAttrDataRole = new CeAttrDataRole();
|
||||
}
|
||||
|
||||
// 所有属性使用数字格式
|
||||
export class CeAttrNumber {
|
||||
@prop({ required: false })
|
||||
hp?: number = 0;
|
||||
@prop({ required: false })
|
||||
atk?: number = 0;
|
||||
@prop({ required: false })
|
||||
matk?: number = 0;
|
||||
@prop({ required: false })
|
||||
def?: number = 0;
|
||||
@prop({ required: false })
|
||||
mdef?: number = 0;
|
||||
@prop({ required: false })
|
||||
agi?: number = 0;
|
||||
@prop({ required: false })
|
||||
luk?: number = 0;
|
||||
@prop({ required: false })
|
||||
hit?: number = 0;
|
||||
@prop({ required: false })
|
||||
cri?: number = 0;
|
||||
@prop({ required: false })
|
||||
flee?: number = 0;
|
||||
@prop({ required: false })
|
||||
antCri?: number = 0;
|
||||
@prop({ required: false })
|
||||
damageIncrease?: number = 0;
|
||||
@prop({ required: false })
|
||||
damageDecrease?: number = 0;
|
||||
@prop({ required: false })
|
||||
defIngnore?: number = 0;
|
||||
@prop({ required: false })
|
||||
bloodSuck?: number = 0;
|
||||
}
|
||||
|
||||
// 主属性
|
||||
export class MainAttrNumber {
|
||||
hp: number = 0;
|
||||
atk: number = 0;
|
||||
matk: number = 0;
|
||||
def: number = 0;
|
||||
mdef: number = 0;
|
||||
agi: number = 0;
|
||||
luk: number = 0;
|
||||
|
||||
constructor(attr: CeAttrNumber) {
|
||||
if(attr.hp) this.hp = attr.hp;
|
||||
if(attr.atk) this.atk = attr.atk;
|
||||
if(attr.def) this.def = attr.def;
|
||||
if(attr.mdef) this.mdef = attr.mdef;
|
||||
if(attr.agi) this.agi = attr.agi;
|
||||
if(attr.luk) this.luk = attr.luk;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user