装备
This commit is contained in:
@@ -125,7 +125,14 @@ export const JEWEL_ATTR = {
|
||||
5: "agi",
|
||||
6: "luk"
|
||||
}
|
||||
|
||||
const BASE_ATTR = {
|
||||
'hp' : 1 ,
|
||||
'atk' : 2,
|
||||
'def' : 3,
|
||||
'mdef' : 4,
|
||||
'agi' : 5,
|
||||
'luk' : 6
|
||||
}
|
||||
export const ABI_TYPE_TO_STAGE = new Map<number, number | ((jobType: number) => number)>([
|
||||
[ABI_STAGE.HP, ABI_TYPE.ABI_HP],
|
||||
[ABI_STAGE.ATK, (jobType:number) => { return jobType == JOB_TYPE.PHYSIC?ABI_TYPE.ABI_ATK: ABI_TYPE.ABI_MATK}],
|
||||
@@ -140,10 +147,13 @@ export function getAtrrNameById(attrId: number):string {
|
||||
};
|
||||
|
||||
export function getAttrCeRatio(attr: string):number {
|
||||
return CE_RATIO[attr];
|
||||
return ;
|
||||
};
|
||||
|
||||
export function getAttrNameByJobStage(jobStage: number) {
|
||||
return HEROTARIN[jobStage];
|
||||
};
|
||||
|
||||
export function getTeraphAttr() {
|
||||
return BASE_ATTR;
|
||||
};
|
||||
|
||||
@@ -26,6 +26,11 @@ export const CONSUME_TYPE = {
|
||||
JEWEL: 9, //宝石
|
||||
};
|
||||
|
||||
export enum ROLE_TERAPH {
|
||||
START = 1,
|
||||
END = 4
|
||||
}
|
||||
|
||||
export enum EQUIP_TYPE {
|
||||
START = 1,
|
||||
WEAPON = 1, // 神兵(武器)
|
||||
|
||||
@@ -88,7 +88,8 @@ export const FILENAME = {
|
||||
DIC_REFINE: 'dic_zyz_jinglian',
|
||||
DIC_HERO_EQUIP: 'dic_zyz_heroEquip',
|
||||
DIC_SUIT: 'dic_zyz_suit',
|
||||
DIC_TITLE: 'dic_zyz_title'
|
||||
DIC_TITLE: 'dic_zyz_title',
|
||||
DIC_TERAPH: 'dic_zyz_teraph',
|
||||
}
|
||||
|
||||
export const WAR_RELATE_TABLES = [
|
||||
|
||||
@@ -288,6 +288,7 @@ export const COM_TEAM_STATUS = {
|
||||
LOOSE: 3
|
||||
}
|
||||
|
||||
|
||||
// 寻宝配置常量
|
||||
export const COM_BTL_CONST = {
|
||||
ENABLE_LV: 1, // 功能开启等级
|
||||
|
||||
@@ -170,7 +170,8 @@ export const STATUS = {
|
||||
EQUIP_NOT_MATCH_JEWEL: {code: 30504, simStr: '装备不能镶嵌该宝石' },
|
||||
//全局养成30500-30699
|
||||
ROLE_REACH_MAX_TITLE_LEVEL: {code: 30500, simStr: '玩家已达到最高的爵位'},
|
||||
|
||||
ROLE_TERAPH_NOT_STRENGTHEN: {code: 30501, simStr: '玩家神像不能强化'},
|
||||
ROLE_TERAPH_NOT_QUILITY: {code: 30502, simStr: '玩家神像不能进阶'},
|
||||
|
||||
// 社交相关状态 40000 - 49999
|
||||
// 运营模块相关状态 50000 - 59999
|
||||
|
||||
@@ -134,6 +134,11 @@ export default class Equip extends BaseModel {
|
||||
let result: EquipType = await EquipModel.findOneAndUpdate({_id}, {$set: equipUpdate}, {new: true}).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async getEquipByObjectId(_id: string) {
|
||||
let equip: EquipType = await EquipModel.findOne({ _id });
|
||||
return equip;
|
||||
}
|
||||
}
|
||||
|
||||
export const EquipModel = getModelForClass(Equip);
|
||||
|
||||
@@ -153,7 +153,7 @@ export default class Hero extends BaseModel {
|
||||
const hero: HeroType = await HeroModel.findOneAndUpdate(
|
||||
{ roleId, hid, 'ePlace.id': ePlaceId },
|
||||
{$set: {'ePlace.$.equip': equipId, 'ePlace.$.hid':hid, 'ePlace.$.ePlaceId':ePlaceId}},
|
||||
{new: true}).lean(lean);
|
||||
{new: true}).populate('ePlace.equip').lean(lean);
|
||||
if (hero) {
|
||||
await Equip.putOn(hero.hid, equipId);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HANG_UP_CONSTS } from './../consts';
|
||||
import { HANG_UP_CONSTS, ROLE_TERAPH } from './../consts';
|
||||
import BaseModel from './BaseModel';
|
||||
import { CeAttr } from './generalField';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
@@ -14,6 +14,7 @@ interface roleUpdate {
|
||||
expeditionPoint?:number;
|
||||
globalCeAttr?:CeAttr;
|
||||
title?:number;
|
||||
teraphs?: Teraph[];
|
||||
}
|
||||
|
||||
class TopHero {
|
||||
@@ -47,6 +48,41 @@ class WarStar {
|
||||
star: number; // 星级
|
||||
}
|
||||
|
||||
class Teraph{
|
||||
@prop({ required: true, default: 1 })
|
||||
id: number; // 神像的id
|
||||
@prop({ required: true, default: 1 })
|
||||
grade: number; // 等级
|
||||
@prop({ required: true, default: 0 })
|
||||
hp: number;
|
||||
@prop({ required: true, default: 0 })
|
||||
atk: number;
|
||||
@prop({ required: true, default: 0 })
|
||||
def: number;
|
||||
@prop({ required: true, default: 0 })
|
||||
mdef: number;
|
||||
@prop({ required: true, default: 0 })
|
||||
agi: number;
|
||||
@prop({ required: true, default: 0 })
|
||||
luk: number;
|
||||
}
|
||||
// 初始化
|
||||
function getInitialTeraph() {
|
||||
let teraphs = new Array<Teraph>();
|
||||
for(let i = ROLE_TERAPH.START; i <= ROLE_TERAPH.END; i++) {
|
||||
let p = new Teraph();
|
||||
p.id = i;
|
||||
p.grade = 1;
|
||||
p.hp = 0;
|
||||
p.atk = 0;
|
||||
p.def = 0;
|
||||
p.mdef = 0;
|
||||
p.agi = 0;
|
||||
p.luk = 0;
|
||||
teraphs.push(p);
|
||||
}
|
||||
return teraphs;
|
||||
}
|
||||
/**
|
||||
* 角色字段接口
|
||||
*/
|
||||
@@ -173,7 +209,8 @@ export default class Role extends BaseModel {
|
||||
@prop({ required: true, default: 1 })
|
||||
title: number; //爵位
|
||||
//神像
|
||||
|
||||
@prop({ required: true, type: Teraph, default: getInitialTeraph() })
|
||||
teraphs:Array<Teraph>;
|
||||
|
||||
public static async findByUid(uid: number, serverId: number, lean = true) {
|
||||
const role: RoleType = await RoleModel.findOne({ 'userInfo.uid': uid, serverId }).lean(lean);
|
||||
|
||||
@@ -30,7 +30,8 @@ import { dicStrengthenCost } from './dictionary/DicStrengthenCost';
|
||||
import { dicRefine } from './dictionary/DicRefine';
|
||||
import { dicHeroEquip } from './dictionary/DicHeroEquip';
|
||||
import { dicSuit } from './dictionary/DicSuit';
|
||||
import { dicTitle } from './dictionary/DicTitle'
|
||||
import { dicTitle } from './dictionary/DicTitle';
|
||||
import { dicTeraph } from './dictionary/DicTeraph';
|
||||
export const gameData = {
|
||||
blurprtCompose: dicBlueprtCompose,
|
||||
blueprtPossibility: dicBlueprtPossibility,
|
||||
@@ -72,7 +73,8 @@ export const gameData = {
|
||||
jewels: dicJewel,
|
||||
dicHeroEquip: dicHeroEquip,
|
||||
suit: dicSuit,
|
||||
title: dicTitle
|
||||
title: dicTitle,
|
||||
teraphs: dicTeraph
|
||||
};
|
||||
|
||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||
@@ -204,3 +206,8 @@ export function getTitle(titleLv: number) {
|
||||
const titleInfo = gameData.title.get(titleLv);
|
||||
return titleInfo;
|
||||
}
|
||||
|
||||
export function getTeraph(id: number, grade: number) {
|
||||
const teraphInfo = gameData.teraphs.get(id +'_'+ grade);
|
||||
return teraphInfo;
|
||||
}
|
||||
90
shared/pubUtils/dictionary/DicTeraph.ts
Normal file
90
shared/pubUtils/dictionary/DicTeraph.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
// 物品表
|
||||
import { decodeArrayListStr, readJsonFile, parseGoodStr } from '../util'
|
||||
import { FILENAME} from '../../consts'
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface SpecialMaterial {
|
||||
readonly ids: number[];
|
||||
readonly count: number;
|
||||
}
|
||||
|
||||
export interface DicTeraph {
|
||||
// 等级
|
||||
readonly id: number;
|
||||
readonly index: number;
|
||||
readonly grade: number;
|
||||
readonly hpMax: number;
|
||||
readonly atkMax: number;
|
||||
readonly defMax: number;
|
||||
readonly mdefMax: number;
|
||||
readonly agiMax: number;
|
||||
readonly lukMax: number;
|
||||
|
||||
readonly hp;
|
||||
readonly atk;
|
||||
readonly def;
|
||||
readonly mdef;
|
||||
readonly agi;
|
||||
readonly luk;
|
||||
readonly criRate;
|
||||
readonly criEffect;
|
||||
readonly upMaterial:Array<{id: number, number: number}>;
|
||||
|
||||
readonly assiAttrValue: Map<number, number>;
|
||||
readonly upGradeMaterial:Array<{id: number, number: number}>;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_TERAPH);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicTeraphKeys: KeysEnum<DicTeraph> = {
|
||||
id: true,
|
||||
index: true,
|
||||
grade: true,
|
||||
hpMax: true,
|
||||
atkMax: true,
|
||||
defMax: true,
|
||||
mdefMax: true,
|
||||
agiMax: true,
|
||||
lukMax: true,
|
||||
hp: true,
|
||||
atk: true,
|
||||
def: true,
|
||||
mdef: true,
|
||||
agi: true,
|
||||
luk: true,
|
||||
criRate: true,
|
||||
criEffect: true,
|
||||
upMaterial: true,
|
||||
assiAttrValue: true,
|
||||
upGradeMaterial: true,
|
||||
}
|
||||
export const dicTeraph = new Map<string, DicTeraph>();
|
||||
arr.forEach(o => {
|
||||
o.assiAttrValue = parseAttr(o.assiAttrValue);
|
||||
o.upGradeMaterial = parseGoodStr(o.upGradeMaterial);
|
||||
o.upMaterial = parseGoodStr(o.upMaterial);
|
||||
o.hp = o.hpUp;
|
||||
o.atk = o.atkUp;
|
||||
o.def = o.defUp;
|
||||
o.mdef = o.mdefUp;
|
||||
o.agi = o.agiUp;
|
||||
o.luk = o.lukUp;
|
||||
dicTeraph.set(o.index + '_' + o.grade, _.pick(o, Object.keys(DicTeraphKeys)));
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
|
||||
function parseAttr(str: string) {
|
||||
let result = new Array<{id: number, number: number}>();
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for(let [id, number] of decodeArr) {
|
||||
if(isNaN(parseInt(id)) || isNaN(parseInt(number))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({id: parseInt(id), number: parseInt(number)});
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export function calPlayerCe(globalCeAttr: CeAttr, hero: HeroType, type: number,
|
||||
} else if (type == HERO_SYSTEM_TYPE.JEWEL_OFF) {//宝石卸下
|
||||
reIncAttr = calHeroCeWhenJewelOff(hero, args);
|
||||
} else {
|
||||
reIncAttr = hero.ceAttr;
|
||||
return incCe;
|
||||
}
|
||||
|
||||
addSeidEffect(reIncAttr, hero.ceAttr, addSeidList, removeSeidList); // 处理加值
|
||||
|
||||
Reference in New Issue
Block a user