import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Talent } from '../../db/Hero'; import { JewelType, RandSe } from '../../db/Jewel'; import { gameData } from '../../pubUtils/data'; export interface CreateHeroParam extends HeroUpdate { hid: number; count: number; } export class HeroShowParam { hid: number; seqId: number; skinId: number; quality: number; constructor(hero: HeroType) { this.hid = hero.hid; this.seqId = hero.seqId; this.skinId = hero.skinId; this.quality = hero.quality; } } class HeroSKinParam { id: number; skinId: number; // fashions表的heroId字段 enable: boolean; constructor(heroSkin: HeroSkin) { this.id = heroSkin.id; this.skinId = heroSkin.skinId; this.enable = heroSkin.enable; } } // 传给客户端的武将数据 export class HeroParam { hid: number; // 武将 id seqId: number; // 武将表自增 id exp: number; // 经验值 lv: number; // 武将等级 ce: number; // 武将战力 star: number; // 星级 starStage: number; // 星级六维阶段 colorStar: number; // 觉醒, 彩星 colorStarStage: number; // 觉醒六维阶段 quality: number; // 品质 scrollActive: boolean; // 是否在名将谱中激活 scrollId: number; // 名将谱id scrollStar: number; // 名将谱中保存的星级 scrollColorStar: number; // 名将谱中保存的觉醒等级 scrollQuality: number; // 名将谱中保存的品质 job: number; // 职业 jobStage: number; // 职阶 skinId: number; // 当前皮肤id,fashions表的heroId字段 favour: number; // 好感度 favourLv: number; // 好感等级 connections: Connect[]; // 羁绊 skins: HeroSKinParam[] = []; // 皮肤 ePlace: EPlace[]; // 武将装备引用数组 talent: Talent[] = []; usedTalentPoint: number = 0; totalTalentPoint: number = 0; constructor(hero: HeroType) { this.seqId = hero.seqId; this.hid = hero.hid; this.exp = hero.exp; this.lv = hero.lv; this.ce = hero.ce; this.star = hero.star; this.starStage = hero.starStage; this.colorStar = hero.colorStar; this.colorStarStage = hero.colorStarStage; this.quality = hero.quality; this.scrollActive = hero.scrollActive; this.scrollId = hero.scrollId; this.scrollStar = hero.scrollStar; this.scrollColorStar = hero.scrollColorStar; this.scrollQuality = hero.scrollQuality; this.job = hero.job; this.totalTalentPoint = gameData.talentPointOfJob.get(hero.job)||0; this.jobStage = hero.jobStage; this.skinId = hero.skinId; this.favour = hero.favour; this.favourLv = hero.favourLv; this.connections = hero.connections; for(let skin of hero.skins) { this.skins.push(new HeroSKinParam(skin)); if(skin.enable) { this.talent = skin.talent||[]; this.usedTalentPoint = skin.usedTalentPoint||0; } } this.ePlace = hero.ePlace; } } export class JewelParam { seqId: number; // 唯一id id: number; // 装备id name: string; // 装备名 hid: number; // 装备此装备的武将 ePlaceId: number; // 装备在哪个位置 randSe: RandSe[]; count: number; inc: number; reason: number; constructor(jewel: JewelType, isPush?: boolean, reason?: number) { this.seqId = jewel.seqId; this.id = jewel.id; this.name = jewel.name; this.hid = jewel.hid; this.ePlaceId = jewel.ePlaceId; this.randSe = jewel.randSe; if(isPush) { this.count = 1; this.inc = 1; this.reason = reason; } } }