战力,出生皮肤

This commit is contained in:
mamengke01
2020-12-22 14:07:43 +08:00
parent ba4f58509d
commit eec53b688f
17 changed files with 1173 additions and 314 deletions
@@ -43,11 +43,7 @@ export class EntryHandler {
if (!role) { if (!role) {
return resResult(STATUS.ROLE_NOT_FOUND); return resResult(STATUS.ROLE_NOT_FOUND);
} }
// duplicate log in sessionService.kick(role.roleId);//踢掉之前登录的账号code:1005
if (!!sessionService.getByUid(role.roleId)) {
console.log('duplicate log in', role.roleId);
return resResult(STATUS.DUP_LOGIN);
}
await session.abind(role.roleId); await session.abind(role.roleId);
session.set('uid', role.roleId); session.set('uid', role.roleId);
session.set('roleId', role.roleId); session.set('roleId', role.roleId);
@@ -44,7 +44,7 @@ export class EquipHandler {
let targetGood = gameData.goods.get(gid); let targetGood = gameData.goods.get(gid);
if (!targetGood) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if (!targetGood) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let cost = new Array<ItemInter>(); let cost = new Array<ItemInter>();
if (targetGood.suitId > 0) { // 套装 if (targetGood.suitId > 0) { // 套装
@@ -172,13 +172,13 @@ export class EquipHandler {
// 是否成功精炼 // 是否成功精炼
let dicRefine = gameData.refine.get(refineLv + 1); let dicRefine = gameData.refine.get(refineLv + 1);
if (!dicRefine) { if (!dicRefine) {
return resResult(STATUS.ROLE_INFO_NOT_FOUND) return resResult(STATUS.DIC_DATA_NOT_FOUND)
} }
let { successRate } = dicRefine; let { successRate } = dicRefine;
for (let { id, count } of material) { for (let { id, count } of material) {
let dicGoods = gameData.goods.get(id); let dicGoods = gameData.goods.get(id);
if (!dicGoods) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if (!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND);
if (!SPEICAL_ITEM.REFINE_ADD_RATE.includes(id)) { if (!SPEICAL_ITEM.REFINE_ADD_RATE.includes(id)) {
return resResult(STATUS.ROLE_WRONG_ITEM) return resResult(STATUS.ROLE_WRONG_ITEM)
} }
@@ -264,7 +264,7 @@ export class EquipHandler {
} }
let dicGoods = gameData.goods.get(id); let dicGoods = gameData.goods.get(id);
if (!dicGoods) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if (!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let { randomEffect } = dicGoods; let { randomEffect } = dicGoods;
let pool = randomEffect.map(cur => gameData.randomEffectPool.get(cur)); let pool = randomEffect.map(cur => gameData.randomEffectPool.get(cur));
@@ -354,12 +354,14 @@ export class EquipHandler {
let equip = await EquipModel.getEquip(eid); let equip = await EquipModel.getEquip(eid);
let goodInfo = getGoodById(equip.id); let goodInfo = getGoodById(equip.id);
let obj = ITID.get(goodInfo.itid); let obj = ITID.get(goodInfo.itid);
let ePlaceId = obj.type; let id = obj.type;
let curEquips: Array<{ seqId: number, hid: number, ePlaceId: number }> = []; let curEquips: Array<{ seqId: number, hid: number, ePlaceId: number }> = [];
let hero = await HeroModel.findByHidAndRole(hid, roleId); let hero = await HeroModel.findByHidAndRole(hid, roleId);
if (!hero) if (!hero)
return resResult(STATUS.HERO_NOT_FIND); return resResult(STATUS.HERO_NOT_FIND);
if (type == 1) { if (type == 1) {
if (!!equip.hid)
return resResult(STATUS.EQUIP_IS_EQUIPED);
if (goodInfo.lvLimited > hero.lv) if (goodInfo.lvLimited > hero.lv)
return resResult(STATUS.EQUIP_LEVEL_LIMIT); return resResult(STATUS.EQUIP_LEVEL_LIMIT);
let { jobid } = gameData.hero.get(hid); let { jobid } = gameData.hero.get(hid);
@@ -367,40 +369,26 @@ export class EquipHandler {
let { classId } = getHeroEquipByClassId(goodInfo.itid); let { classId } = getHeroEquipByClassId(goodInfo.itid);
if (_.indexOf(classId, job_class) < 0) if (_.indexOf(classId, job_class) < 0)
return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO); return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO);
if (!!equip.hid) let index = _.findIndex(hero.ePlace, { id });
return resResult(STATUS.EQUIP_IS_EQUIPED);
let index = _.findIndex(hero.ePlace, { id: ePlaceId });
if (index < 0) if (index < 0)
return resResult(STATUS.WRONG_PARMS); return resResult(STATUS.WRONG_PARMS);
let objectId = <string>hero.ePlace[index].equip; let objectId = <string>hero.ePlace[index].equip;
if (!!objectId) { if (!!objectId) {
let lastEquip = await EquipModel.updateEquipInfobyObjectId(objectId, { hid: 0, ePlaceId: 0 }); let {seqId, ePlaceId} = await EquipModel.updateEquipInfobyObjectId(objectId, { hid: 0, ePlaceId: 0 });
curEquips.push({ curEquips.push({ seqId, hid, ePlaceId });
seqId: lastEquip.seqId,
hid: lastEquip.hid,
ePlaceId: lastEquip.ePlaceId
});
} }
await HeroModel.addEquip(roleId, hid, ePlaceId, equip._id); await HeroModel.addEquip(roleId, hid, id, equip._id);
curEquips.push({ curEquips.push({ seqId: eid, hid, ePlaceId:id});
seqId: eid,
hid: hid,
ePlaceId: ePlaceId
});
} else if (type == 2) { } else if (type == 2) {
if (!equip.hid) if (!equip.hid)
return resResult(STATUS.EQUIP_NOT_EQUIPED); return resResult(STATUS.EQUIP_NOT_EQUIPED);
let index = _.findIndex(hero.ePlace, { id: ePlaceId }); let index = _.findIndex(hero.ePlace, { id });
if (index < 0) if (index < 0)
return resResult(STATUS.WRONG_PARMS); return resResult(STATUS.WRONG_PARMS);
hero.ePlace[index].equip = null; hero.ePlace[index].equip = null;
await HeroModel.updateHeroInfo(roleId, hid, { ePlace: hero.ePlace }); await HeroModel.updateHeroInfo(roleId, hid, { ePlace: hero.ePlace });
equip = await EquipModel.updateEquipInfo(eid, { hid: 0, ePlaceId: 0 }); let {seqId, ePlaceId} = await EquipModel.updateEquipInfo(eid, { hid: 0, ePlaceId: 0 });
curEquips.push({ curEquips.push({ seqId, hid, ePlaceId });
seqId: equip.seqId,
hid: equip.hid,
ePlaceId: equip.ePlaceId
});
} }
return resResult(STATUS.SUCCESS, { curEquips: curEquips }); return resResult(STATUS.SUCCESS, { curEquips: curEquips });
} }
@@ -438,18 +426,29 @@ export class EquipHandler {
let roleId: string = session.get('roleId'); let roleId: string = session.get('roleId');
let sid: string = session.get('sid'); let sid: string = session.get('sid');
let consumes: Array<{ id: number, count: number }> = []; let consumes: Array<{ id: number, count: number }> = [];
let goods: Array<{ id: number, count: number }> = [];
let equip = await EquipModel.getEquip(eid); let equip = await EquipModel.getEquip(eid);
let { itid } = getGoodById(equip.id);
let {equipJewel} = ITID.get(itid);
let jewelInfo = getGoodById(jewel);
if (jewelInfo.itid != equipJewel)
return resResult(STATUS.EQUIP_NOT_MATCH_JEWEL);
let index = _.findIndex(equip.holes, { id }); let index = _.findIndex(equip.holes, { id });
if (index > 0) if (index > 0)
return resResult(STATUS.EQUIP_HOLE_NOT_FIND); return resResult(STATUS.EQUIP_HOLE_NOT_FIND);
if (!equip.holes[index].isOpen) if (!equip.holes[index].isOpen)
return resResult(STATUS.EQUIP_HOLE_IS_NOT_DUG); return resResult(STATUS.EQUIP_HOLE_IS_NOT_DUG);
if (!!equip.holes[index].jewel)
goods.push({id: equip.holes[index].jewel, count:1});
consumes.push({ id: jewel, count: 1 }); consumes.push({ id: jewel, count: 1 });
let result = await handleCost(roleId, sid, consumes); let result = await handleCost(roleId, sid, consumes);
if (!result) if (!result)
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
equip.holes[index].jewel = jewel; equip.holes[index].jewel = jewel;
await EquipModel.updateEquipInfo(eid, { holes: equip.holes }); await EquipModel.updateEquipInfo(eid, { holes: equip.holes });
let roleName: string = session.get('roleName');
if (goods.length)
await addItems(roleId, roleName, sid, goods);
return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } }); return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } });
} }
@@ -67,14 +67,14 @@ export class HeroHandler {
if(hasHero) return resResult(STATUS.ROLE_HERO_EXISTS); if(hasHero) return resResult(STATUS.ROLE_HERO_EXISTS);
// 根据dic_hero 获得 1. 碎片id 2. 碎片数量 3. 初始武将星级 4. 初始品质 // 根据dic_hero 获得 1. 碎片id 2. 碎片数量 3. 初始武将星级 4. 初始品质
let dicHero = gameData.hero.get(hid); let dicHero = gameData.hero.get(hid);
if(!dicHero) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if(!dicHero) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let {pieceId, quality, initialStars: star, pieceCount, jobid: job, name: hName} = dicHero; let {pieceId, quality, initialStars: star, pieceCount, jobid: job, name: hName, initialSkin} = dicHero;
// 碎片数量是否足够 // 碎片数量是否足够
let costResult = await handleCost(roleId, sid, [{id: pieceId, count: pieceCount}]); let costResult = await handleCost(roleId, sid, [{id: pieceId, count: pieceCount}]);
if(!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); if(!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
// createHero // createHero
let curHero = await HeroModel.createHero({ let curHero = await HeroModel.createHero({
roleId, serverId, roleName, hid, hName, star, quality, job roleId, serverId, roleName, hid, hName, star, quality, job, skins:[{id: initialSkin, enable: true}]
}); });
await calPlayerCeAndSave(sid, roleId, [curHero], HERO_SYSTEM_TYPE.STAR, getAllAttrStage()); await calPlayerCeAndSave(sid, roleId, [curHero], HERO_SYSTEM_TYPE.STAR, getAllAttrStage());
return resResult(STATUS.SUCCESS, {curHero}); return resResult(STATUS.SUCCESS, {curHero});
@@ -110,7 +110,7 @@ export class HeroHandler {
let material = new Array<RewardInter>(); let material = new Array<RewardInter>();
for(let {id, count} of originalConsumes) { for(let {id, count} of originalConsumes) {
let dicGoods = gameData.goods.get(id); let dicGoods = gameData.goods.get(id);
if(!dicGoods) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if(!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let _count = Math.ceil(needExp/dicGoods.value); let _count = Math.ceil(needExp/dicGoods.value);
if(_count < count) { if(_count < count) {
material.push({id, count: _count}); material.push({id, count: _count});
@@ -149,7 +149,7 @@ export class HeroHandler {
let {hid, star, starStage} = msg; let {hid, star, starStage} = msg;
// 根据dic_hero 获得 1. 碎片id 2. 碎片数量 3. 初始武将星级 4. 初始品质 // 根据dic_hero 获得 1. 碎片id 2. 碎片数量 3. 初始武将星级 4. 初始品质
let dicHero = gameData.hero.get(hid); let dicHero = gameData.hero.get(hid);
if(!dicHero) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if(!dicHero) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let {pieceId} = dicHero; let {pieceId} = dicHero;
let hero = await HeroModel.findByHidAndRole(hid, roleId); let hero = await HeroModel.findByHidAndRole(hid, roleId);
@@ -164,7 +164,7 @@ export class HeroHandler {
} }
// 根据dic_zyz_hero_star 计算需要花的碎片并检查碎片数量 // 根据dic_zyz_hero_star 计算需要花的碎片并检查碎片数量
const curDicHeroStar = getHeroStarByQuality(quality, oldStar); const curDicHeroStar = getHeroStarByQuality(quality, oldStar);
if(!curDicHeroStar) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if(!curDicHeroStar) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let costResult = await handleCost(roleId, sid, [{id: pieceId, count: curDicHeroStar.advanceUpFragmentNum}]); let costResult = await handleCost(roleId, sid, [{id: pieceId, count: curDicHeroStar.advanceUpFragmentNum}]);
if(!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); if(!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
@@ -191,7 +191,7 @@ export class HeroHandler {
let {hid, quality} = msg; let {hid, quality} = msg;
let dicHero = gameData.hero.get(hid); let dicHero = gameData.hero.get(hid);
if(!dicHero) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if(!dicHero) return resResult(STATUS.DIC_DATA_NOT_FOUND);
// 根据dic_hero 获得 碎片id // 根据dic_hero 获得 碎片id
let {pieceId} = dicHero; let {pieceId} = dicHero;
@@ -210,7 +210,7 @@ export class HeroHandler {
// 根据dic_zyz_hero_quality_up 获得需要的材料 // 根据dic_zyz_hero_quality_up 获得需要的材料
const curDicHeroQualityUp = gameData.heroQualityUp.get(quality); const curDicHeroQualityUp = gameData.heroQualityUp.get(quality);
if(!curDicHeroQualityUp) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if(!curDicHeroQualityUp) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let {fragmentNum} = curDicHeroQualityUp; let {fragmentNum} = curDicHeroQualityUp;
let costResult = await handleCost(roleId, sid, [{id: pieceId, count: fragmentNum}]); let costResult = await handleCost(roleId, sid, [{id: pieceId, count: fragmentNum}]);
@@ -234,7 +234,7 @@ export class HeroHandler {
let {hid, colorStar, colorStarStage} = msg; let {hid, colorStar, colorStarStage} = msg;
// 根据dic_hero 获得 1. 碎片id 2. 碎片数量 3. 初始武将星级 4. 初始品质 // 根据dic_hero 获得 1. 碎片id 2. 碎片数量 3. 初始武将星级 4. 初始品质
let dicHero = gameData.hero.get(hid); let dicHero = gameData.hero.get(hid);
if(!dicHero) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if(!dicHero) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let {pieceId} = dicHero; let {pieceId} = dicHero;
let hero = await HeroModel.findByHidAndRole(hid, roleId); let hero = await HeroModel.findByHidAndRole(hid, roleId);
@@ -252,7 +252,7 @@ export class HeroHandler {
} }
// 根据dic_zyz_hero_wake 计算需要花的碎片并检查碎片数量 // 根据dic_zyz_hero_wake 计算需要花的碎片并检查碎片数量
const curDicHeroStar = getHeroWakeByQuality(dicHero.quality, oldColorStar) const curDicHeroStar = getHeroWakeByQuality(dicHero.quality, oldColorStar)
if(!curDicHeroStar) return resResult(STATUS.ROLE_INFO_NOT_FOUND); if(!curDicHeroStar) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let {fragmentNum, consume} = curDicHeroStar; let {fragmentNum, consume} = curDicHeroStar;
@@ -39,7 +39,8 @@ export class RoleHandler {
quality: 1, quality: 1,
job: 1, job: 1,
star: 0, star: 0,
serverId: 1 serverId: 1,
skins:[{id: 41001, enable: true}]
} }
await HeroModel.createHero(heroInfo); await HeroModel.createHero(heroInfo);
} }
+8 -2
View File
@@ -6,7 +6,7 @@ import { pinus } from 'pinus';
import { STATUS } from '../consts/statusCode'; import { STATUS } from '../consts/statusCode';
import { resResult } from '../pubUtils/util'; import { resResult } from '../pubUtils/util';
import { calPlayerCeAndSave as pubCalPlayerCeAndSave } from '../pubUtils/playerCe'; import { calPlayerCeAndSave as pubCalPlayerCeAndSave, reCalAllHeroCe } from '../pubUtils/playerCe';
import { HeroType } from '../db/Hero'; import { HeroType } from '../db/Hero';
const _ = require('underscore'); const _ = require('underscore');
@@ -14,9 +14,15 @@ const _ = require('underscore');
//修改并下发战力 //修改并下发战力
export async function calPlayerCeAndSave(sid: string, roleId: string, heros: Array<HeroType>, type?: number, args?: Array<number>) { export async function calPlayerCeAndSave(sid: string, roleId: string, heros: Array<HeroType>, type?: number, args?: Array<number>) {
let {role, pushHeros} = await pubCalPlayerCeAndSave(roleId, heros, type, args); let {role, pushHeros} = await pubCalPlayerCeAndSave(roleId, heros, type, args);
//下发战力 //下发战力
let uids = [{ uid: roleId, sid }]; let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: role.ce, heros: pushHeros, topFiveCe: 0 }), uids); pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: role.ce, heros: pushHeros, topFiveCe: 0 }), uids);
return heros; return heros;
} }
export async function calAllHeroCe(sid: string, roleId: string, type:number, args:Array<number>) {
let {ce, pushHeros}= await reCalAllHeroCe(roleId,type, args);
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: ce, heros: pushHeros, topFiveCe: 0 }), uids);
return;
}
+6 -2
View File
@@ -4,6 +4,7 @@ import { resResult, parseReward } from '../pubUtils/util';
import { getGoodById } from '../pubUtils/gamedata'; import { getGoodById } from '../pubUtils/gamedata';
import { RoleModel } from '../db/Role'; import { RoleModel } from '../db/Role';
import { setAp } from './actionPointService'; import { setAp } from './actionPointService';
import { calAllHeroCe } from './playerCeService';
import { ItemModel } from '../db/Item'; import { ItemModel } from '../db/Item';
import { STATUS } from '../consts/statusCode'; import { STATUS } from '../consts/statusCode';
import { pinus } from 'pinus'; import { pinus } from 'pinus';
@@ -139,21 +140,24 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
showItems.push({id: item.id, count: item.count}); showItems.push({id: item.id, count: item.count});
bagInfos.push(bagInfo); bagInfos.push(bagInfo);
} }
//背包除去装备推送 //背包除去装备推送
if (!!bagInfos.length) if (!!bagInfos.length)
pinus.app.get('channelService').pushMessageByUids('onItemUpdate', resResult(STATUS.SUCCESS, {goods: bagInfos}), uids); pinus.app.get('channelService').pushMessageByUids('onItemUpdate', resResult(STATUS.SUCCESS, {goods: bagInfos}), uids);
let skinInfos = []; let skinInfos = [];
let addSkinIds = [];
for (let skinId of skins) {//皮肤推送 for (let skinId of skins) {//皮肤推送
let result = await addSkins(roleId, skinId); let result = await addSkins(roleId, skinId);
if (!!result) { if (!!result) {
showItems.push({id: skinId, count: 1}); showItems.push({id: skinId, count: 1});
skinInfos.push(result); skinInfos.push(result);
addSkinIds.push(skinId);
} }
} }
if (!!skinInfos.length) if (!!skinInfos.length) {
calAllHeroCe(sid, roleId, 1, addSkinIds)
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, {skinInfos}), uids); pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, {skinInfos}), uids);
}
return showItems; return showItems;
} }
+3 -2
View File
@@ -197,10 +197,11 @@ export default class GMUsers extends Service {
if(hero) continue; if(hero) continue;
let dicHero = ctx.service.utils.getHeroById(hid); let dicHero = ctx.service.utils.getHeroById(hid);
if(!dicHero) continue; if(!dicHero) continue;
let {quality, initialStars: star, jobid: job, name: hName} = dicHero; let {quality, initialStars: star, jobid: job, name: hName, initialSkin} = dicHero;
const heroInfo = { const heroInfo = {
roleId, roleName: role.roleName, hid, hName, star, quality, job, serverId: role.serverId, roleId, roleName: role.roleName, hid, hName, star, quality, job, serverId: role.serverId,
lv: hlv lv: hlv,
skins:[{id: initialSkin, enable: true}],
} }
heroInfos.push(heroInfo); heroInfos.push(heroInfo);
} }
+38 -25
View File
@@ -1,6 +1,5 @@
export const IT_TYPE = { export const IT_TYPE = {
BLUEPRT: 28, BLUEPRT: 28,
JEWEL: 42
} }
@@ -38,6 +37,15 @@ export enum EQUIP_TYPE {
END = 6 END = 6
} }
export enum JEWEL_TYPE {
WEAPON = 42, // 神兵(武器)
CLOTHES = 43, // 宝甲(上装)
SHOES = 45, // 行具(下装)
CAP = 44, // 冠冕(头部)
BOOK = 47, // 典籍(饰品)
ACCESSORY = 46, // 礼器(饰品)
}
export const ITEM_TABLE = { export const ITEM_TABLE = {
EQUIP: 'equip', EQUIP: 'equip',
ITEM: 'item', ITEM: 'item',
@@ -46,28 +54,28 @@ export const ITEM_TABLE = {
} }
const itid_array = [ const itid_array = [
{ id: 1, name: '短兵(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON }, { id: 1, name: '短兵(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON, equipJewel: JEWEL_TYPE.WEAPON},
{ id: 2, name: '枪矛(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON }, { id: 2, name: '枪矛(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON, equipJewel: JEWEL_TYPE.WEAPON },
{ id: 3, name: '重兵(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON }, { id: 3, name: '重兵(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON, equipJewel: JEWEL_TYPE.WEAPON },
{ id: 4, name: '弓弩(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON }, { id: 4, name: '弓弩(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON, equipJewel: JEWEL_TYPE.WEAPON },
{ id: 5, name: '奇门(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON }, { id: 5, name: '奇门(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON, equipJewel: JEWEL_TYPE.WEAPON },
{ id: 6, name: '羽扇(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON }, { id: 6, name: '羽扇(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON, equipJewel: JEWEL_TYPE.WEAPON },
{ id: 7, name: '法器(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON }, { id: 7, name: '法器(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON, equipJewel: JEWEL_TYPE.WEAPON },
{ id: 8, name: '杖(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON }, { id: 8, name: '杖(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON, equipJewel: JEWEL_TYPE.WEAPON },
{ id: 9, name: '头盔(冠冕)', table: 'equip', type: EQUIP_TYPE.CAP }, { id: 9, name: '头盔(冠冕)', table: 'equip', type: EQUIP_TYPE.CAP, equipJewel: JEWEL_TYPE.CAP },
{ id: 10, name: '头巾(冠冕)', table: 'equip', type: EQUIP_TYPE.CAP }, { id: 10, name: '头巾(冠冕)', table: 'equip', type: EQUIP_TYPE.CAP, equipJewel: JEWEL_TYPE.CAP },
{ id: 11, name: '重铠(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES }, { id: 11, name: '重铠(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES, equipJewel: JEWEL_TYPE.CLOTHES },
{ id: 12, name: '皮甲(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES }, { id: 12, name: '皮甲(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES, equipJewel: JEWEL_TYPE.CLOTHES },
{ id: 13, name: '布衣(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES }, { id: 13, name: '布衣(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES, equipJewel: JEWEL_TYPE.CLOTHES },
{ id: 14, name: '兵书(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK }, { id: 14, name: '兵书(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK, equipJewel: JEWEL_TYPE.BOOK },
{ id: 15, name: '杂记(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK }, { id: 15, name: '杂记(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK, equipJewel: JEWEL_TYPE.BOOK },
{ id: 16, name: '经典(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK }, { id: 16, name: '经典(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK, equipJewel: JEWEL_TYPE.BOOK },
{ id: 17, name: '马(行具)', table: 'equip', type: EQUIP_TYPE.SHOES }, { id: 17, name: '马(行具)', table: 'equip', type: EQUIP_TYPE.SHOES, equipJewel: JEWEL_TYPE.SHOES },
{ id: 18, name: '鞋(行具)', table: 'equip', type: EQUIP_TYPE.SHOES }, { id: 18, name: '鞋(行具)', table: 'equip', type: EQUIP_TYPE.SHOES, equipJewel: JEWEL_TYPE.SHOES },
{ id: 19, name: '车(行具)', table: 'equip', type: EQUIP_TYPE.SHOES }, { id: 19, name: '车(行具)', table: 'equip', type: EQUIP_TYPE.SHOES, equipJewel: JEWEL_TYPE.SHOES },
{ id: 20, name: '佩饰(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY }, { id: 20, name: '佩饰(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY, equipJewel: JEWEL_TYPE.ACCESSORY },
{ id: 21, name: '钟鼎(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY }, { id: 21, name: '钟鼎(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY, equipJewel: JEWEL_TYPE.ACCESSORY },
{ id: 22, name: '印章(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY }, { id: 22, name: '印章(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY, equipJewel: JEWEL_TYPE.ACCESSORY },
{ id: 23, name: '消耗品', table: 'item', type: CONSUME_TYPE.CONSUME }, { id: 23, name: '消耗品', table: 'item', type: CONSUME_TYPE.CONSUME },
@@ -92,10 +100,15 @@ const itid_array = [
{ id: 39, name: '时装', table: 'hero', type: CONSUME_TYPE.SKIN }, { id: 39, name: '时装', table: 'hero', type: CONSUME_TYPE.SKIN },
{ id: 40, name: '装备碎片', table: 'item', type: CONSUME_TYPE.PIECE }, { id: 40, name: '装备碎片', table: 'item', type: CONSUME_TYPE.PIECE },
{ id: 41, name: '图纸', table: 'item', type: CONSUME_TYPE.CONSUME }, { id: 41, name: '图纸', table: 'item', type: CONSUME_TYPE.CONSUME },
{ id: 42, name: '宝石', table: 'item', type: CONSUME_TYPE.JEWEL } { id: 42, name: '神兵宝石', table: 'item', type: CONSUME_TYPE.JEWEL },
{ id: 43, name: '宝甲宝石', table: 'item', type: CONSUME_TYPE.JEWEL },
{ id: 44, name: '免冠宝石', table: 'item', type: CONSUME_TYPE.JEWEL },
{ id: 45, name: '足具宝石', table: 'item', type: CONSUME_TYPE.JEWEL },
{ id: 46, name: '礼器宝石', table: 'item', type: CONSUME_TYPE.JEWEL },
{ id: 47, name: '典籍宝石', table: 'item', type: CONSUME_TYPE.JEWEL }
]; ];
export const ITID = new Map<number, {id: number, name: string, table: string, type?: number, isCurrency?: boolean}>(); export const ITID = new Map<number, {id: number, name: string, table: string, type?: number, isCurrency?: boolean, equipJewel?: number}>();
for(let obj of itid_array) { for(let obj of itid_array) {
ITID.set(obj.id, obj); ITID.set(obj.id, obj);
} }
+2 -2
View File
@@ -113,7 +113,7 @@ export const STATUS = {
DUNGEON_TIMES_LACK: { code: 20701, simStr: '挑战次数不足' }, DUNGEON_TIMES_LACK: { code: 20701, simStr: '挑战次数不足' },
// 通用 30000 - 30099 // 通用 30000 - 30099
ROLE_INFO_NOT_FOUND: { code: 30000, simStr: '数据表未找到' }, DIC_DATA_NOT_FOUND: { code: 30000, simStr: '数据表未找到' },
ROLE_MATERIAL_NOT_ENOUGH: { code: 30001, simStr: '材料数量不足' }, ROLE_MATERIAL_NOT_ENOUGH: { code: 30001, simStr: '材料数量不足' },
// 武将养成通用 30100 - 30199 // 武将养成通用 30100 - 30199
@@ -165,7 +165,7 @@ export const STATUS = {
EQUIP_NOT_FILL_HOLE: {code: 30506, simStr: '未穿戴宝石' }, EQUIP_NOT_FILL_HOLE: {code: 30506, simStr: '未穿戴宝石' },
EQUIP_NOT_EQUIPED_HERO: {code: 30507, simStr: '装备不能被该武将穿戴'}, EQUIP_NOT_EQUIPED_HERO: {code: 30507, simStr: '装备不能被该武将穿戴'},
EQUIP_LEVEL_LIMIT: {code: 30508, simStr: '装备穿戴等级限制'}, EQUIP_LEVEL_LIMIT: {code: 30508, simStr: '装备穿戴等级限制'},
EQUIP_NOT_MATCH_JEWEL: {code: 30504, simStr: '装备不能镶嵌该宝石' },
// 社交相关状态 40000 - 49999 // 社交相关状态 40000 - 49999
// 运营模块相关状态 50000 - 59999 // 运营模块相关状态 50000 - 59999
// GM后台相关状态 60000 - 69999 // GM后台相关状态 60000 - 69999
+1 -1
View File
@@ -160,7 +160,7 @@ export default class Hero extends BaseModel {
return hero; return hero;
} }
public static async createHero(heroInfo: {roleId: string, serverId: number, roleName: string, hid: number, hName: string, star: number, quality: number, job: number, lv?: number }, lean = true) { public static async createHero(heroInfo: {roleId: string, serverId: number, roleName: string, hid: number, hName: string, star: number, quality: number, job: number, lv?: number, skins:Skin[]}, lean = true) {
const doc = new HeroModel(); const doc = new HeroModel();
const seqId = await CounterModel.getNewCounter(COUNTER.HID)||-1; const seqId = await CounterModel.getNewCounter(COUNTER.HID)||-1;
const update = Object.assign(doc.toJSON(), heroInfo, {seqId}); const update = Object.assign(doc.toJSON(), heroInfo, {seqId});
+1
View File
@@ -12,6 +12,7 @@ interface roleUpdate {
gold?:number; gold?:number;
frdCnt?: number; frdCnt?: number;
expeditionPoint?:number; expeditionPoint?:number;
globalCeAttr?:CeAttr;
} }
class TopHero { class TopHero {
+3 -5
View File
@@ -1,6 +1,6 @@
// 物品表 // 物品表
import {decodeArrayListStr, readJsonFile, parseReward, parseNumberList, decodeArrayStr, deepCopy} from '../util' import {decodeArrayListStr, readJsonFile, parseReward, parseNumberList, decodeArrayStr} from '../util'
import { FILENAME, IT_TYPE, ABI_TYPE } from '../../consts' import { FILENAME, IT_TYPE, ABI_TYPE , GOOD_TYPE} from '../../consts'
import { RewardInter } from '../interface'; import { RewardInter } from '../interface';
const _ = require('lodash'); const _ = require('lodash');
const underscore = require('underscore'); const underscore = require('underscore');
@@ -87,7 +87,6 @@ const DicGoodsKeys: KeysEnum<DicGoods> = {
export const dicJewel = new Map<number, DicGoods>(); export const dicJewel = new Map<number, DicGoods>();
export const dicGoods = new Map<number, DicGoods>(); export const dicGoods = new Map<number, DicGoods>();
export const blueprt = new Map<number, Array<number>>(); export const blueprt = new Map<number, Array<number>>();
let jewelsMap = {};
arr.forEach(o => { arr.forEach(o => {
o.goodsAbility = parseAbility(o); o.goodsAbility = parseAbility(o);
o.goodsAbilityUp = parseAbilityUp(o); o.goodsAbilityUp = parseAbilityUp(o);
@@ -102,7 +101,7 @@ arr.forEach(o => {
let arr = blueprt.get(o.quality)||new Array<number>(); let arr = blueprt.get(o.quality)||new Array<number>();
arr.push(o.good_id); arr.push(o.good_id);
blueprt.set(o.quality, arr); blueprt.set(o.quality, arr);
} else if (o.itid == IT_TYPE.JEWEL) { } else if (o.itid == GOOD_TYPE.JEWEL) {
let material = o.composeMaterial[0]; let material = o.composeMaterial[0];
if (!!material && !!material.id) { if (!!material && !!material.id) {
let lastJewel = underscore.findWhere(arr,{good_id:material.id}); let lastJewel = underscore.findWhere(arr,{good_id:material.id});
@@ -115,7 +114,6 @@ arr.forEach(o => {
} }
}); });
jewelsMap = undefined;
arr = undefined; arr = undefined;
function parseSpecialAttr(str: string) { function parseSpecialAttr(str: string) {
+2 -1
View File
@@ -26,13 +26,14 @@ export interface DicHero {
// 主属性 // 主属性
readonly baseAbilityArr:Map<number, number>; readonly baseAbilityArr:Map<number, number>;
readonly baseAbilityUpArr:Map<number, number>; readonly baseAbilityUpArr:Map<number, number>;
readonly initialSkin: number;
} }
const str = readJsonFile(FILENAME.DIC_HERO); const str = readJsonFile(FILENAME.DIC_HERO);
let arr = JSON.parse(str); let arr = JSON.parse(str);
type KeysEnum<T> = { [P in keyof Required<T>]: true }; type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicHeroKeys: KeysEnum<DicHero> = {heroId: true, name: true, quality: true, camp: true, jobid: true, skill: true, pieceId: true, initialStars: true, pieceCount: true, baseAbilityArr: true, baseAbilityUpArr: true}; const DicHeroKeys: KeysEnum<DicHero> = {heroId: true, name: true, quality: true, camp: true, jobid: true, skill: true, pieceId: true, initialStars: true, pieceCount: true, baseAbilityArr: true, baseAbilityUpArr: true, initialSkin: true};
export const dicHero = new Map<number, DicHero>(); export const dicHero = new Map<number, DicHero>();
arr.forEach(o => { arr.forEach(o => {
o.baseAbilityArr = parseBaseAbilityArr(o); o.baseAbilityArr = parseBaseAbilityArr(o);
+57 -15
View File
@@ -8,7 +8,7 @@ import { deepCopy } from './util';
import { HeroModel, HeroType } from '../db/Hero'; import { HeroModel, HeroType } from '../db/Hero';
import { RoleModel } from '../db/Role'; import { RoleModel } from '../db/Role';
import { CeAttrData, CeAttr, CeAttrNumber } from '../db/generalField'; import { CeAttrData, CeAttr, CeAttrNumber } from '../db/generalField';
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE, SEID_TYPE, HERO_ATTR} from '../consts'; import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE, SEID_TYPE} from '../consts';
import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById } from './data'; import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById } from './data';
import { Attributes } from './interface'; import { Attributes } from './interface';
import { DicSe } from './dictionary/DicSe'; import { DicSe } from './dictionary/DicSe';
@@ -18,7 +18,7 @@ import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
const HERO_CE_RATIO = 100; const HERO_CE_RATIO = 100;
const _ = require('underscore'); const _ = require('underscore');
//战力计算TODO //战力计算TODO
export function calPlayerCe(hero: HeroType, type: number, args: Array<number>) { export function calPlayerCe(globalCeAttr: CeAttr, hero: HeroType, type: number, args: Array<number>) {
let incCe = 0; let incCe = 0;
let incArr: Attributes = {}; let incArr: Attributes = {};
let reIncAttr: CeAttr = {}; // {"hp": {"base": number, "fixUp": number, "ratioUp": number}} let reIncAttr: CeAttr = {}; // {"hp": {"base": number, "fixUp": number, "ratioUp": number}}
@@ -33,7 +33,7 @@ export function calPlayerCe(hero: HeroType, type: number, args: Array<number>) {
} else if (type == HERO_SYSTEM_TYPE.STAGEUP) { } else if (type == HERO_SYSTEM_TYPE.STAGEUP) {
reIncAttr = calHeroJobStageUpIncAttr(hero, args, addSeidList, removeSeidList ) reIncAttr = calHeroJobStageUpIncAttr(hero, args, addSeidList, removeSeidList )
} else if (type == HERO_SYSTEM_TYPE.SKIN) { } else if (type == HERO_SYSTEM_TYPE.SKIN) {
reIncAttr = calWaerHeroSkinIncAttr(hero, args); reIncAttr = calHeroWearSkinIncAttr(hero, args);
} else if (type == HERO_SYSTEM_TYPE.FAVOUR) { } else if (type == HERO_SYSTEM_TYPE.FAVOUR) {
reIncAttr = calHeroFavourUpIncAttr(hero, args); reIncAttr = calHeroFavourUpIncAttr(hero, args);
} else if (type == HERO_SYSTEM_TYPE.CONNECT) { } else if (type == HERO_SYSTEM_TYPE.CONNECT) {
@@ -51,12 +51,12 @@ export function calPlayerCe(hero: HeroType, type: number, args: Array<number>) {
if(!hero.ceAttr) hero.ceAttr = new CeAttr(); if(!hero.ceAttr) hero.ceAttr = new CeAttr();
for (let attrName in reIncAttr) { for (let attrName in reIncAttr) {
let originalAttrData: CeAttrData = hero.ceAttr[attrName]||new CeAttrData(); let originalAttrData: CeAttrData = hero.ceAttr[attrName]||new CeAttrData();
let oldCe = (originalAttrData.fixUp + originalAttrData.equipUp||0) * HERO_CE_RATIO + originalAttrData.base *(HERO_CE_RATIO + originalAttrData.ratioUp); let oldCe = (originalAttrData.fixUp + (originalAttrData.equipUp||0)) * HERO_CE_RATIO + originalAttrData.base *(HERO_CE_RATIO + originalAttrData.ratioUp + globalCeAttr[attrName].ratioUp);
if(!hero.ceAttr[attrName]) hero.ceAttr[attrName] = new CeAttrData(); if(!hero.ceAttr[attrName]) hero.ceAttr[attrName] = new CeAttrData();
for (let attrKey in reIncAttr[attrName]) { for (let attrKey in reIncAttr[attrName]) {
hero.ceAttr[attrName][attrKey] = parseInt(reIncAttr[attrName][attrKey]||0); hero.ceAttr[attrName][attrKey] = parseInt(reIncAttr[attrName][attrKey]||0);
} }
incArr[attrName] = (reIncAttr[attrName].fixUp + reIncAttr[attrName].equipUp||0) * HERO_CE_RATIO + reIncAttr[attrName].base *(HERO_CE_RATIO + reIncAttr[attrName].ratioUp) - oldCe; //计算属性 incArr[attrName] = (reIncAttr[attrName].fixUp + (reIncAttr[attrName].equipUp||0)) * HERO_CE_RATIO + reIncAttr[attrName].base *(HERO_CE_RATIO + reIncAttr[attrName].ratioUp + globalCeAttr[attrName].ratioUp) - oldCe; //计算属性
incCe += incArr[attrName] * getAttrCeRatio(attrName); incCe += incArr[attrName] * getAttrCeRatio(attrName);
} }
hero.ce += incCe; hero.ce += incCe;
@@ -67,19 +67,17 @@ export function calPlayerCe(hero: HeroType, type: number, args: Array<number>) {
export async function calPlayerCeAndSave(roleId: string, heros: Array<HeroType>, type?: number, args?: Array<number>) { export async function calPlayerCeAndSave(roleId: string, heros: Array<HeroType>, type?: number, args?: Array<number>) {
let incPlayerCe = 0; let incPlayerCe = 0;
let pushHeros = new Array<{hid: number, ce: number, incHeroCe: number}>(); let pushHeros = new Array<{hid: number, ce: number, incHeroCe: number}>();
let role = await RoleModel.findByRoleId(roleId);
for (let hero of heros) { for (let hero of heros) {
let incHeroCe = calPlayerCe(hero, type, args); let incHeroCe = calPlayerCe(role.globalCeAttr, hero, type, args);
incPlayerCe += incHeroCe; incPlayerCe += incHeroCe;
await HeroModel.updateHeroInfo(roleId, hero.hid, hero);
await HeroModel.updateHeroInfo(roleId, hero.hid, hero );
pushHeros.push({ pushHeros.push({
hid: hero.hid, hid: hero.hid,
ce: hero.ce, ce: hero.ce,
incHeroCe : incHeroCe, incHeroCe : incHeroCe,
}); });
} }
let role = await RoleModel.findByRoleId(roleId);
role.ce += incPlayerCe; role.ce += incPlayerCe;
await RoleModel.updateRoleInfo(roleId, role); await RoleModel.updateRoleInfo(roleId, role);
return {pushHeros, role} return {pushHeros, role}
@@ -177,7 +175,7 @@ export function calHeroJobStageUpIncAttr(hero: HeroType, args: Array<number>, ad
} }
//穿戴时装 //穿戴时装
export function calWaerHeroSkinIncAttr(hero: HeroType, args: Array<number>) { export function calHeroWearSkinIncAttr(hero: HeroType, args: Array<number>) {
let res: CeAttr = {}; let res: CeAttr = {};
let addSkin = gameData.fashion.get(args[0]); let addSkin = gameData.fashion.get(args[0]);
let delSkin = gameData.fashion.get(args[1]); let delSkin = gameData.fashion.get(args[1]);
@@ -185,12 +183,12 @@ export function calWaerHeroSkinIncAttr(hero: HeroType, args: Array<number>) {
for (let attr of delSkin.actorAttr) { for (let attr of delSkin.actorAttr) {
attrName = getAtrrNameById(attr.id); attrName = getAtrrNameById(attr.id);
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp}; res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
res[attrName].fixUp += attr.number * HERO_CE_RATIO; res[attrName].fixUp -= attr.number * HERO_CE_RATIO;
} }
for (let attr of addSkin.actorAttr) { for (let attr of addSkin.actorAttr) {
attrName = getAtrrNameById(attr.id); attrName = getAtrrNameById(attr.id);
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp}; res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
res[attrName].fixUp -= attr.number * HERO_CE_RATIO; res[attrName].fixUp += attr.number * HERO_CE_RATIO;
} }
return res; return res;
} }
@@ -426,10 +424,54 @@ function addSeid(effectList: Array<any>, seidId:number, rand: number, seidValue
} }
return; return;
} }
effectList.push(curSeid);
let seid: DicSe|DicRandomEffectPool = deepCopy(curSeid); let seid: DicSe|DicRandomEffectPool = deepCopy(curSeid);
if(curSeid.index > 0) { if(curSeid.index > 0) {
seid.gainValueArr[curSeid.index - 1] = rand; seid.gainValueArr[curSeid.index - 1] = rand;
} }
effectList.push(seid); effectList.push(seid);
} }
//全局属性加成
export async function reCalAllHeroCe(roleId: string, type: number, args:Array<number>) {
let reIncAttr: CeAttr = {};
let role = await RoleModel.findByRoleId(roleId);
if(!role.globalCeAttr) role.globalCeAttr = new CeAttr();
let originalAttr = role.globalCeAttr;
let pushHeros:Array<{hid:number, ce:number, incHeroCe:number}> = []
if (type == 1) {//获得皮肤
reIncAttr = calHeroAddSkin(args, role.globalCeAttr);
}
for (let attrName in reIncAttr) {
role.globalCeAttr[attrName].fixUp = reIncAttr[attrName].fixUp;
role.globalCeAttr[attrName].ratioUp = reIncAttr[attrName].ratioUp;
}
let heros = await HeroModel.findByRole(roleId);
for (let hero of heros) {
let incHeroCe = 0;
for (let attrName in reIncAttr) {
let oldcCe = originalAttr[attrName].fixUp * HERO_CE_RATIO + hero.ceAttr[attrName].base * (HERO_CE_RATIO + originalAttr[attrName].ratioUp);
let incArr = role.globalCeAttr[attrName].fixUp * HERO_CE_RATIO + hero.ceAttr[attrName].base * (HERO_CE_RATIO + role.globalCeAttr[attrName].ratioUp) - oldcCe;
incHeroCe += incArr * getAttrCeRatio(attrName);
}
incHeroCe += incHeroCe;
hero.ce += incHeroCe;
pushHeros.push({ hid: hero.hid, ce: hero.ce, incHeroCe });
await HeroModel.updateHeroInfo(roleId, hero.hid, {ce: hero.ce});
}
await RoleModel.updateRoleInfo(roleId, {globalCeAttr: role.globalCeAttr, ce: role.ce});
return {pushHeros, ce: role.ce}
}
function calHeroAddSkin(args:Array<number>, ceAttr: CeAttr){
let res: CeAttr = {};
for (let arg of args) {
let addSkin = gameData.fashion.get(arg);
let attrName: string;
for (let attr of addSkin.globalAttr) {
attrName = getAtrrNameById(attr.id);
res[attrName] = {fixUp: ceAttr[attrName].fixUp, ratioUp: ceAttr[attrName].ratioUp};
res[attrName].fixUp += attr.number * HERO_CE_RATIO;
}
}
return res;
}
+618 -18
View File
@@ -6,7 +6,7 @@
"name": "魏武之强", "name": "魏武之强",
"level": 1, "level": 1,
"memberId": "2&3&4&5", "memberId": "2&3&4&5",
"attribute": "1&200|2&300", "attribute": "1&200",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -16,7 +16,7 @@
"name": "魏武之强", "name": "魏武之强",
"level": 2, "level": 2,
"memberId": "2&3&4&5", "memberId": "2&3&4&5",
"attribute": "1&300|2&400", "attribute": "1&300",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -26,7 +26,7 @@
"name": "魏武之强", "name": "魏武之强",
"level": 3, "level": 3,
"memberId": "2&3&4&5", "memberId": "2&3&4&5",
"attribute": "1&400|2&500", "attribute": "1&400",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -36,7 +36,7 @@
"name": "魏武之强", "name": "魏武之强",
"level": 4, "level": 4,
"memberId": "2&3&4&5", "memberId": "2&3&4&5",
"attribute": "1&600|2&700", "attribute": "1&600",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -46,7 +46,7 @@
"name": "魏武之强", "name": "魏武之强",
"level": 5, "level": 5,
"memberId": "2&3&4&5", "memberId": "2&3&4&5",
"attribute": "1&800|2&900", "attribute": "1&800",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -56,7 +56,7 @@
"name": "魏武之强", "name": "魏武之强",
"level": 6, "level": 6,
"memberId": "2&3&4&5", "memberId": "2&3&4&5",
"attribute": "1&1000|2&1000", "attribute": "1&1000",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -66,7 +66,7 @@
"name": "家族之力", "name": "家族之力",
"level": 1, "level": 1,
"memberId": "6&7", "memberId": "6&7",
"attribute": "1&200|2&300", "attribute": "2&300",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -76,7 +76,7 @@
"name": "家族之力", "name": "家族之力",
"level": 2, "level": 2,
"memberId": "6&7", "memberId": "6&7",
"attribute": "1&300|2&400", "attribute": "2&400",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -86,7 +86,7 @@
"name": "家族之力", "name": "家族之力",
"level": 3, "level": 3,
"memberId": "6&7", "memberId": "6&7",
"attribute": "1&400|2&500", "attribute": "2&500",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -96,7 +96,7 @@
"name": "家族之力", "name": "家族之力",
"level": 4, "level": 4,
"memberId": "6&7", "memberId": "6&7",
"attribute": "1&600|2&700", "attribute": "2&700",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -106,7 +106,7 @@
"name": "家族之力", "name": "家族之力",
"level": 5, "level": 5,
"memberId": "6&7", "memberId": "6&7",
"attribute": "1&800|2&900", "attribute": "2&900",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -116,7 +116,7 @@
"name": "家族之力", "name": "家族之力",
"level": 6, "level": 6,
"memberId": "6&7", "memberId": "6&7",
"attribute": "1&1000|2&1000", "attribute": "2&1000",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -126,7 +126,7 @@
"name": "曹氏双雄", "name": "曹氏双雄",
"level": 1, "level": 1,
"memberId": "8&", "memberId": "8&",
"attribute": "1&200|2&300", "attribute": "2&300",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -136,7 +136,7 @@
"name": "曹氏双雄", "name": "曹氏双雄",
"level": 2, "level": 2,
"memberId": "8&", "memberId": "8&",
"attribute": "1&300|2&400", "attribute": "2&400",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -146,7 +146,7 @@
"name": "曹氏双雄", "name": "曹氏双雄",
"level": 3, "level": 3,
"memberId": "8&", "memberId": "8&",
"attribute": "1&400|2&500", "attribute": "2&500",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -156,7 +156,7 @@
"name": "曹氏双雄", "name": "曹氏双雄",
"level": 4, "level": 4,
"memberId": "8&", "memberId": "8&",
"attribute": "1&600|2&700", "attribute": "2&700",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -166,7 +166,7 @@
"name": "曹氏双雄", "name": "曹氏双雄",
"level": 5, "level": 5,
"memberId": "8&", "memberId": "8&",
"attribute": "1&800|2&900", "attribute": "2&900",
"costCoin": 0 "costCoin": 0
}, },
{ {
@@ -176,7 +176,607 @@
"name": "曹氏双雄", "name": "曹氏双雄",
"level": 6, "level": 6,
"memberId": "8&", "memberId": "8&",
"attribute": "1&1000|2&1000", "attribute": "2&1000",
"costCoin": 0
},
{
"id": 19,
"shipId": 20001,
"actorId": 2,
"name": "本家兄弟",
"level": 1,
"memberId": "1&4",
"attribute": "1&200",
"costCoin": 0
},
{
"id": 20,
"shipId": 20001,
"actorId": 2,
"name": "本家兄弟",
"level": 2,
"memberId": "1&4",
"attribute": "1&300",
"costCoin": 0
},
{
"id": 21,
"shipId": 20001,
"actorId": 2,
"name": "本家兄弟",
"level": 3,
"memberId": "1&4",
"attribute": "1&400",
"costCoin": 0
},
{
"id": 22,
"shipId": 20001,
"actorId": 2,
"name": "本家兄弟",
"level": 4,
"memberId": "1&4",
"attribute": "1&600",
"costCoin": 0
},
{
"id": 23,
"shipId": 20001,
"actorId": 2,
"name": "本家兄弟",
"level": 5,
"memberId": "1&4",
"attribute": "1&800",
"costCoin": 0
},
{
"id": 24,
"shipId": 20001,
"actorId": 2,
"name": "本家兄弟",
"level": 6,
"memberId": "1&4",
"attribute": "1&1000",
"costCoin": 0
},
{
"id": 25,
"shipId": 20002,
"actorId": 2,
"name": "魏武先锋",
"level": 1,
"memberId": "7&15",
"attribute": "2&300",
"costCoin": 0
},
{
"id": 26,
"shipId": 20002,
"actorId": 2,
"name": "魏武先锋",
"level": 2,
"memberId": "7&15",
"attribute": "2&400",
"costCoin": 0
},
{
"id": 27,
"shipId": 20002,
"actorId": 2,
"name": "魏武先锋",
"level": 3,
"memberId": "7&15",
"attribute": "2&500",
"costCoin": 0
},
{
"id": 28,
"shipId": 20002,
"actorId": 2,
"name": "魏武先锋",
"level": 4,
"memberId": "7&15",
"attribute": "2&700",
"costCoin": 0
},
{
"id": 29,
"shipId": 20002,
"actorId": 2,
"name": "魏武先锋",
"level": 5,
"memberId": "7&15",
"attribute": "2&900",
"costCoin": 0
},
{
"id": 30,
"shipId": 20002,
"actorId": 2,
"name": "魏武先锋",
"level": 6,
"memberId": "7&15",
"attribute": "2&1000",
"costCoin": 0
},
{
"id": 31,
"shipId": 20003,
"actorId": 2,
"name": "武艺超群",
"level": 1,
"memberId": "24&",
"attribute": "1&200",
"costCoin": 0
},
{
"id": 32,
"shipId": 20003,
"actorId": 2,
"name": "武艺超群",
"level": 2,
"memberId": "24&",
"attribute": "1&300",
"costCoin": 0
},
{
"id": 33,
"shipId": 20003,
"actorId": 2,
"name": "武艺超群",
"level": 3,
"memberId": "24&",
"attribute": "1&400",
"costCoin": 0
},
{
"id": 34,
"shipId": 20003,
"actorId": 2,
"name": "武艺超群",
"level": 4,
"memberId": "24&",
"attribute": "1&600",
"costCoin": 0
},
{
"id": 35,
"shipId": 20003,
"actorId": 2,
"name": "武艺超群",
"level": 5,
"memberId": "24&",
"attribute": "1&800",
"costCoin": 0
},
{
"id": 36,
"shipId": 20003,
"actorId": 2,
"name": "武艺超群",
"level": 6,
"memberId": "24&",
"attribute": "1&1000",
"costCoin": 0
},
{
"id": 37,
"shipId": 30001,
"actorId": 3,
"name": "故友知交",
"level": 1,
"memberId": "18&",
"attribute": "2&300",
"costCoin": 0
},
{
"id": 38,
"shipId": 30001,
"actorId": 3,
"name": "故友知交",
"level": 2,
"memberId": "18&",
"attribute": "2&400",
"costCoin": 0
},
{
"id": 39,
"shipId": 30001,
"actorId": 3,
"name": "故友知交",
"level": 3,
"memberId": "18&",
"attribute": "2&500",
"costCoin": 0
},
{
"id": 40,
"shipId": 30001,
"actorId": 3,
"name": "故友知交",
"level": 4,
"memberId": "18&",
"attribute": "2&700",
"costCoin": 0
},
{
"id": 41,
"shipId": 30001,
"actorId": 3,
"name": "故友知交",
"level": 5,
"memberId": "18&",
"attribute": "2&900",
"costCoin": 0
},
{
"id": 42,
"shipId": 30001,
"actorId": 3,
"name": "故友知交",
"level": 6,
"memberId": "18&",
"attribute": "2&1000",
"costCoin": 0
},
{
"id": 43,
"shipId": 30002,
"actorId": 3,
"name": "孤胆冲阵",
"level": 1,
"memberId": "36&37",
"attribute": "1&200",
"costCoin": 0
},
{
"id": 44,
"shipId": 30002,
"actorId": 3,
"name": "孤胆冲阵",
"level": 2,
"memberId": "36&37",
"attribute": "1&300",
"costCoin": 0
},
{
"id": 45,
"shipId": 30002,
"actorId": 3,
"name": "孤胆冲阵",
"level": 3,
"memberId": "36&37",
"attribute": "1&400",
"costCoin": 0
},
{
"id": 46,
"shipId": 30002,
"actorId": 3,
"name": "孤胆冲阵",
"level": 4,
"memberId": "36&37",
"attribute": "1&600",
"costCoin": 0
},
{
"id": 47,
"shipId": 30002,
"actorId": 3,
"name": "孤胆冲阵",
"level": 5,
"memberId": "36&37",
"attribute": "1&800",
"costCoin": 0
},
{
"id": 48,
"shipId": 30002,
"actorId": 3,
"name": "孤胆冲阵",
"level": 6,
"memberId": "36&37",
"attribute": "1&1000",
"costCoin": 0
},
{
"id": 49,
"shipId": 30003,
"actorId": 3,
"name": "临危不惧",
"level": 1,
"memberId": "5&10",
"attribute": "2&300",
"costCoin": 0
},
{
"id": 50,
"shipId": 30003,
"actorId": 3,
"name": "临危不惧",
"level": 2,
"memberId": "5&10",
"attribute": "2&400",
"costCoin": 0
},
{
"id": 51,
"shipId": 30003,
"actorId": 3,
"name": "临危不惧",
"level": 3,
"memberId": "5&10",
"attribute": "2&500",
"costCoin": 0
},
{
"id": 52,
"shipId": 30003,
"actorId": 3,
"name": "临危不惧",
"level": 4,
"memberId": "5&10",
"attribute": "2&700",
"costCoin": 0
},
{
"id": 53,
"shipId": 30003,
"actorId": 3,
"name": "临危不惧",
"level": 5,
"memberId": "5&10",
"attribute": "2&900",
"costCoin": 0
},
{
"id": 54,
"shipId": 30003,
"actorId": 3,
"name": "临危不惧",
"level": 6,
"memberId": "5&10",
"attribute": "2&1000",
"costCoin": 0
},
{
"id": 55,
"shipId": 40001,
"actorId": 4,
"name": "箭术无双",
"level": 1,
"memberId": "21&45",
"attribute": "1&200",
"costCoin": 0
},
{
"id": 56,
"shipId": 40001,
"actorId": 4,
"name": "箭术无双",
"level": 2,
"memberId": "21&45",
"attribute": "1&300",
"costCoin": 0
},
{
"id": 57,
"shipId": 40001,
"actorId": 4,
"name": "箭术无双",
"level": 3,
"memberId": "21&45",
"attribute": "1&400",
"costCoin": 0
},
{
"id": 58,
"shipId": 40001,
"actorId": 4,
"name": "箭术无双",
"level": 4,
"memberId": "21&45",
"attribute": "1&600",
"costCoin": 0
},
{
"id": 59,
"shipId": 40001,
"actorId": 4,
"name": "箭术无双",
"level": 5,
"memberId": "21&45",
"attribute": "1&800",
"costCoin": 0
},
{
"id": 60,
"shipId": 40001,
"actorId": 4,
"name": "箭术无双",
"level": 6,
"memberId": "21&45",
"attribute": "1&1000",
"costCoin": 0
},
{
"id": 61,
"shipId": 40002,
"actorId": 4,
"name": "兄弟情深",
"level": 1,
"memberId": "1&2",
"attribute": "2&300",
"costCoin": 0
},
{
"id": 62,
"shipId": 40002,
"actorId": 4,
"name": "兄弟情深",
"level": 2,
"memberId": "1&2",
"attribute": "2&400",
"costCoin": 0
},
{
"id": 63,
"shipId": 40002,
"actorId": 4,
"name": "兄弟情深",
"level": 3,
"memberId": "1&2",
"attribute": "2&500",
"costCoin": 0
},
{
"id": 64,
"shipId": 40002,
"actorId": 4,
"name": "兄弟情深",
"level": 4,
"memberId": "1&2",
"attribute": "2&700",
"costCoin": 0
},
{
"id": 65,
"shipId": 40002,
"actorId": 4,
"name": "兄弟情深",
"level": 5,
"memberId": "1&2",
"attribute": "2&900",
"costCoin": 0
},
{
"id": 66,
"shipId": 40002,
"actorId": 4,
"name": "兄弟情深",
"level": 6,
"memberId": "1&2",
"attribute": "2&1000",
"costCoin": 0
},
{
"id": 67,
"shipId": 40003,
"actorId": 4,
"name": "恃勇轻谋",
"level": 1,
"memberId": "37&",
"attribute": "1&200",
"costCoin": 0
},
{
"id": 68,
"shipId": 40003,
"actorId": 4,
"name": "恃勇轻谋",
"level": 2,
"memberId": "37&",
"attribute": "1&300",
"costCoin": 0
},
{
"id": 69,
"shipId": 40003,
"actorId": 4,
"name": "恃勇轻谋",
"level": 3,
"memberId": "37&",
"attribute": "1&400",
"costCoin": 0
},
{
"id": 70,
"shipId": 40003,
"actorId": 4,
"name": "恃勇轻谋",
"level": 4,
"memberId": "37&",
"attribute": "1&600",
"costCoin": 0
},
{
"id": 71,
"shipId": 40003,
"actorId": 4,
"name": "恃勇轻谋",
"level": 5,
"memberId": "37&",
"attribute": "1&800",
"costCoin": 0
},
{
"id": 72,
"shipId": 40003,
"actorId": 4,
"name": "恃勇轻谋",
"level": 6,
"memberId": "37&",
"attribute": "1&1000",
"costCoin": 0
},
{
"id": 73,
"shipId": 50001,
"actorId": 5,
"name": "天妒英才",
"level": 1,
"memberId": "23&",
"attribute": "2&300",
"costCoin": 0
},
{
"id": 74,
"shipId": 50001,
"actorId": 5,
"name": "天妒英才",
"level": 2,
"memberId": "23&",
"attribute": "2&400",
"costCoin": 0
},
{
"id": 75,
"shipId": 50001,
"actorId": 5,
"name": "天妒英才",
"level": 3,
"memberId": "23&",
"attribute": "2&500",
"costCoin": 0
},
{
"id": 76,
"shipId": 50001,
"actorId": 5,
"name": "天妒英才",
"level": 4,
"memberId": "23&",
"attribute": "2&700",
"costCoin": 0
},
{
"id": 77,
"shipId": 50001,
"actorId": 5,
"name": "天妒英才",
"level": 5,
"memberId": "23&",
"attribute": "2&900",
"costCoin": 0
},
{
"id": 78,
"shipId": 50001,
"actorId": 5,
"name": "天妒英才",
"level": 6,
"memberId": "23&",
"attribute": "2&1000",
"costCoin": 0 "costCoin": 0
} }
] ]
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -143,10 +143,11 @@ export default class Auth extends Service {
if(!dicHero) { if(!dicHero) {
break; break;
} }
let {quality, initialStars: star, jobid: job, name: hName} = dicHero; let {quality, initialStars: star, jobid: job, name: hName, initialSkin} = dicHero;
hero = await HeroModel.createHero({ hero = await HeroModel.createHero({
roleId, roleName: role.roleName, hid, hName, star, quality, job, serverId: role.serverId roleId, roleName: role.roleName, hid, hName, star, quality, job, serverId: role.serverId,
skins:[{id: initialSkin, enable: true}]
}); });
await calPlayerCeAndSave(roleId, [hero], HERO_SYSTEM_TYPE.STAR, getAllAttrStage()); await calPlayerCeAndSave(roleId, [hero], HERO_SYSTEM_TYPE.STAR, getAllAttrStage());
} }