Merge branch 'feature/ce'

This commit is contained in:
luying
2022-03-30 21:19:32 +08:00
54 changed files with 16380 additions and 2502 deletions
@@ -4,7 +4,7 @@ import { ExpeditionRecordModel } from '../../../db/ExpeditionRecord';
import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord'; import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord';
import { ExpeditionPointModel } from '../../../db/ExpeditionPoint'; import { ExpeditionPointModel } from '../../../db/ExpeditionPoint';
import { RoleModel } from '../../../db/Role'; import { RoleModel } from '../../../db/Role';
import { calculateSumCE, genCode, getWarTypeName } from '../../../pubUtils/util'; import { genCode, getWarTypeName } from '../../../pubUtils/util';
import { getPointRewardStatus, getResetRemainCnt, findOrCreateEnemies, getExpeditionStatus } from '../../../services/expeditionService'; import { getPointRewardStatus, getResetRemainCnt, findOrCreateEnemies, getExpeditionStatus } from '../../../services/expeditionService';
import { DEBUG_MAGIC_WORD, EXPEDITION_WAR_RECORD_STATUS, ITEM_CHANGE_REASON, KING_EXP_RATIO_TYPE, LINEUP_NUM, TASK_TYPE, TA_EVENT } from '../../../consts'; import { DEBUG_MAGIC_WORD, EXPEDITION_WAR_RECORD_STATUS, ITEM_CHANGE_REASON, KING_EXP_RATIO_TYPE, LINEUP_NUM, TASK_TYPE, TA_EVENT } from '../../../consts';
import { WarReward } from '../../../services/warRewardService'; import { WarReward } from '../../../services/warRewardService';
@@ -18,6 +18,7 @@ import { gameData } from '../../../pubUtils/data';
import * as dicParam from '../../../pubUtils/dicParam'; import * as dicParam from '../../../pubUtils/dicParam';
import { getSeconds, nowSeconds } from '../../../pubUtils/timeUtil'; import { getSeconds, nowSeconds } from '../../../pubUtils/timeUtil';
import { reportTAEvent } from '../../../services/sdkService'; import { reportTAEvent } from '../../../services/sdkService';
import { getSumCe } from '../../../services/playerCeService';
export default function (app: Application) { export default function (app: Application) {
new HandlerService(app, {}); new HandlerService(app, {});
@@ -58,8 +59,8 @@ export class ExpeditionBattleHandler {
await ExpeditionRecordModel.hideRecord(roleId); // 刷掉旧关卡 await ExpeditionRecordModel.hideRecord(roleId); // 刷掉旧关卡
// 我方战力(暂定) // 我方战力
let myCe = await calculateSumCE(roleId, 1, { num: LINEUP_NUM }); let myCe = await getSumCe(roleId, LINEUP_NUM);
// 每一关的挑战状态 // 每一关的挑战状态
let { expeditionCode, heroes } = await ExpeditionRecordModel.createRecord({ let { expeditionCode, heroes } = await ExpeditionRecordModel.createRecord({
roleId, roleName, heroes: [], myCe roleId, roleName, heroes: [], myCe
@@ -92,7 +92,6 @@ export class GuildRemote {
*/ */
private pushMessage(guildCode: string, path: string, message: any) { private pushMessage(guildCode: string, path: string, message: any) {
let channel = this.getChannel(guildCode); let channel = this.getChannel(guildCode);
console.log('##### channel', guildCode, channel)
if (!!channel) { if (!!channel) {
channel.pushMessage(path, resResult(STATUS.SUCCESS, message)); channel.pushMessage(path, resResult(STATUS.SUCCESS, message));
} }
@@ -18,11 +18,10 @@ import { reportTAEvent } from '../../../services/sdkService';
import { sendMailByContent } from '../../../services/mailService'; import { sendMailByContent } from '../../../services/mailService';
import { GuildLeader } from '../../../domain/rank'; import { GuildLeader } from '../../../domain/rank';
import { HeroModel } from '../../../db/Hero'; import { HeroModel } from '../../../db/Hero';
import { calAllHeroCe, calPlayerCeAndSave } from '../../../services/playerCeService';
import { SkinModel } from '../../../db/Skin'; import { SkinModel } from '../../../db/Skin';
import { PvpDefenseModel } from '../../../db/PvpDefense'; import { PvpDefenseModel } from '../../../db/PvpDefense';
import { calculatetopLineup } from '../../../pubUtils/playerCe';
import { createHeroes } from '../../../services/role/createHero'; import { createHeroes } from '../../../services/role/createHero';
import { calculateCeWithHero } from '../../../services/playerCeService';
let timer: NodeJS.Timer; let timer: NodeJS.Timer;
export default function (app: Application) { export default function (app: Application) {
@@ -95,14 +94,16 @@ export class GmRoleHandler {
param.lv = newLv; param.lv = newLv;
param['exp'] = exp; param['exp'] = exp;
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.STAR, sid, roleId, hero, param); await calculateCeWithHero(HERO_SYSTEM_TYPE.INIT, roleId, hero.serverId, sid, hid, param);
if(param.job > 0) { // if(param.job > 0) {
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.STAGEUP, sid, roleId, hero, { job: param.job, jobStage: 0 }); // await calculateCe(HERO_SYSTEM_TYPE.STAGEUP, roleId, hero.serverId, sid, param, {}, { hid });
}
if (hero.star != param.star) { // hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.STAGEUP, sid, roleId, hero, { job: param.job, jobStage: 0 });
await calAllHeroCe(HERO_SYSTEM_TYPE.STAR, sid, roleId, {}, [hid, 1]); // 升星可能影响到百家学院全局加成 // }
}
// if (hero.star != param.star) {
// await calAllHeroCe(HERO_SYSTEM_TYPE.STAR, sid, roleId, {}, [hid, 1]); // 升星可能影响到百家学院全局加成
// }
return resResult(STATUS.SUCCESS); return resResult(STATUS.SUCCESS);
} }
@@ -116,9 +117,8 @@ export class GmRoleHandler {
await HeroModel.deleteHero(roleId, hid); await HeroModel.deleteHero(roleId, hid);
await SkinModel.deleteByHero(roleId, hid); await SkinModel.deleteByHero(roleId, hid);
let role = await RoleModel.findByRoleId(roleId); let role = await RoleModel.findByRoleId(roleId);
let { topLineup, topLineupCe } = await calculatetopLineup(role, hid, 0, null);
await PvpDefenseModel.deleteHero(roleId, hid); await PvpDefenseModel.deleteHero(roleId, hid);
await RoleModel.updateRoleInfo(roleId, { topLineup, topLineupCe, ce: role.ce - hero.ce }); await RoleModel.updateRoleInfo(roleId, { topLineup: role.topLineup.filter(cur => cur.hid != hid), topLineupCe: role.topLineupCe - hero.ce, ce: role.ce - hero.ce });
return resResult(STATUS.SUCCESS); return resResult(STATUS.SUCCESS);
} }
@@ -5,7 +5,6 @@ import { ItemInter, RewardInter } from "../../../pubUtils/interface";
import { resResult, parseGoodStr } from "../../../pubUtils/util"; import { resResult, parseGoodStr } from "../../../pubUtils/util";
import { addItems, getJewelRandSe, handleCost } from "../../../services/role/rewardService"; import { addItems, getJewelRandSe, handleCost } from "../../../services/role/rewardService";
import { HeroModel, EPlace } from "../../../db/Hero"; import { HeroModel, EPlace } from "../../../db/Hero";
import { calPlayerCeAndSave } from "../../../services/playerCeService";
import { gameData, getEquipByJobClassAndEPlace, getNextEquipQuality, getEquipStarIdByEquipId, getNextEquipStar } from "../../../pubUtils/data"; import { gameData, getEquipByJobClassAndEPlace, getNextEquipQuality, getEquipStarIdByEquipId, getNextEquipStar } from "../../../pubUtils/data";
import { BAG, EQUIP } from "../../../pubUtils/dicParam"; import { BAG, EQUIP } from "../../../pubUtils/dicParam";
import { getRandSeResult, updateEplace, updateEplaces, checkJewelCanPutOnEquip, updateStone, checkStoneCanPutOnEquip, isLocked } from "../../../services/equipService"; import { getRandSeResult, updateEplace, updateEplaces, checkJewelCanPutOnEquip, updateStone, checkStoneCanPutOnEquip, isLocked } from "../../../services/equipService";
@@ -17,6 +16,7 @@ import { pushEquipQualityMax, pushEquipStarMax } from "../../../services/sysChat
import { addConsumeToHero } from "../../../services/roleService"; import { addConsumeToHero } from "../../../services/roleService";
import { CheckMeterial } from "../../../services/role/checkMaterial"; import { CheckMeterial } from "../../../services/role/checkMaterial";
import { combineItems } from "../../../services/role/util"; import { combineItems } from "../../../services/role/util";
import { calculateCeWithHero } from "../../../services/playerCeService";
export default function (app: Application) { export default function (app: Application) {
new HandlerService(app, {}); new HandlerService(app, {});
@@ -57,15 +57,15 @@ export class EquipHandler {
ePlace: newEplace, ePlace: newEplace,
consumes: addConsumeToHero(hero.consumes, dicEquip.composeMaterial), consumes: addConsumeToHero(hero.consumes, dicEquip.composeMaterial),
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.COMPOSE_EQUIP, sid, roleId, hero, update, [ePlaceId]);
await calculateCeWithHero(HERO_SYSTEM_TYPE.COMPOSE_EQUIP, roleId, serverId, sid, hid, update, { ePlaceId });
await checkTaskInComposeEquip(serverId, roleId, sid, oldEplace, newEplace); await checkTaskInComposeEquip(serverId, roleId, sid, oldEplace, newEplace);
return resResult(STATUS.SUCCESS, { let curHero = {
curHero: { hid,
hid: hero.hid, ePlace: [newEquip]
ePlace: [newEquip] }
} return resResult(STATUS.SUCCESS, { curHero });
})
} }
// 装备栏强化 // 装备栏强化
@@ -105,7 +105,7 @@ export class EquipHandler {
ePlace: newEplace, ePlace: newEplace,
consumes: addConsumeToHero(hero.consumes, consumes) consumes: addConsumeToHero(hero.consumes, consumes)
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, sid, roleId, hero, update, [ePlaceId]); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, roleId, serverId, sid, hid, update, { ePlaceIds: [ePlaceId] });
await checkTaskInEquipLvUp(serverId, roleId, sid, oldEplace, newEplace, [ePlaceId]); await checkTaskInEquipLvUp(serverId, roleId, sid, oldEplace, newEplace, [ePlaceId]);
const curHero = { const curHero = {
@@ -156,7 +156,7 @@ export class EquipHandler {
ePlace: newEplace, ePlace: newEplace,
consumes: addConsumeToHero(hero.consumes, consumes), consumes: addConsumeToHero(hero.consumes, consumes),
} }
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, sid, roleId, hero, update, [...eplaceIds.keys()]); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, roleId, serverId, sid, hid, update, { ePlaceIds: [...eplaceIds.keys()] });
await checkTaskInEquipLvUp(serverId, roleId, sid, ePlace, newEplace, [...eplaceIds.keys()]); await checkTaskInEquipLvUp(serverId, roleId, sid, ePlace, newEplace, [...eplaceIds.keys()]);
const curHero = { const curHero = {
@@ -223,7 +223,7 @@ export class EquipHandler {
ePlace: newEplace, ePlace: newEplace,
consumes: addConsumeToHero(hero.consumes, consumes), consumes: addConsumeToHero(hero.consumes, consumes),
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_QUALITY, sid, roleId, hero, update, [ePlaceId]); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_QUALITY, roleId, serverId, sid, hid, update, { ePlaceId });
await checkTaskInEquipQualityUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpQuality); await checkTaskInEquipQualityUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpQuality);
pushEquipQualityMax(roleId, roleName, serverId, hid, newEquip, isUpQuality); pushEquipQualityMax(roleId, roleName, serverId, hid, newEquip, isUpQuality);
@@ -298,7 +298,7 @@ export class EquipHandler {
ePlace: newEplace, ePlace: newEplace,
consumes: addConsumeToHero(hero.consumes, consumes) consumes: addConsumeToHero(hero.consumes, consumes)
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_STAR, sid, roleId, hero, update, [ePlaceId]); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STAR, roleId, serverId, sid, hid, update, { ePlaceId });
await checkTaskInEquipStarUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpStar); await checkTaskInEquipStarUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpStar);
pushEquipStarMax(roleId, roleName, serverId, hid, newEquip, isUpStar); pushEquipStarMax(roleId, roleName, serverId, hid, newEquip, isUpStar);
@@ -343,7 +343,7 @@ export class EquipHandler {
let canChange = originJewel && checkJewelCanPutOnEquip(originEquip, originJewel); let canChange = originJewel && checkJewelCanPutOnEquip(originEquip, originJewel);
if(canChange) canSentMineToOrigin = true; if(canChange) canSentMineToOrigin = true;
let { newEplace, updatedEplace } = updateEplace(originEplace, ePlaceId, { jewel: canChange? originJewel.seqId: 0 }); let { newEplace, updatedEplace } = updateEplace(originEplace, ePlaceId, { jewel: canChange? originJewel.seqId: 0 });
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_JEWEL, sid, roleId, originHero, { ePlace: newEplace }, [ePlaceId], { oldJewel: jewel, newJewel: canChange? originJewel:null }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, jewel.hid, { ePlace: newEplace }, { ePlaceId, jewel: canChange? originJewel: null });
await checkTaskInPutJewel(serverId, roleId, sid, originEplace, newEplace, ePlaceId, jewel, canChange? originJewel:null); await checkTaskInPutJewel(serverId, roleId, sid, originEplace, newEplace, ePlaceId, jewel, canChange? originJewel:null);
originHeroResult = { hid: originHero.hid, ePlace: updatedEplace }; originHeroResult = { hid: originHero.hid, ePlace: updatedEplace };
@@ -356,7 +356,7 @@ export class EquipHandler {
// 目标镶嵌上 // 目标镶嵌上
let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId); let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: seqId }); let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: seqId });
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_JEWEL, sid, roleId, hero, { ePlace: newEplace }, [ePlaceId], { oldJewel: originJewel, newJewel: curJewel }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: curJewel });
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, originJewel, curJewel); await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, originJewel, curJewel);
let curHero = { let curHero = {
@@ -384,7 +384,7 @@ export class EquipHandler {
let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0); let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: 0 }); let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: 0 });
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_JEWEL, sid, roleId, hero, { ePlace: newEplace }, [ePlaceId], { oldJewel: curJewel }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: null });
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, null, curJewel); await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, null, curJewel);
let curHero = { let curHero = {
@@ -437,7 +437,7 @@ export class EquipHandler {
ePlace: newEplace, ePlace: newEplace,
consumes: updateConsumes, consumes: updateConsumes,
} }
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_STONE, sid, roleId, hero, update, [ePlaceId], { jewel }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STONE, roleId, serverId, sid, hid, update, { ePlaceId, jewel });
await checkTaskInPutStone(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, jewel); await checkTaskInPutStone(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, jewel);
let curHero = { let curHero = {
@@ -557,7 +557,7 @@ export class EquipHandler {
// 更新战力 // 更新战力
if(hid > 0) { if(hid > 0) {
const hero = await HeroModel.findByHidAndRole(hid, roleId); const hero = await HeroModel.findByHidAndRole(hid, roleId);
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, sid, roleId, hero, {}, [ePlaceId], { oldJewel: jewel, newJewel }); await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId, jewel: newJewel });
} }
await checkTaskInEquipReset(serverId, roleId, sid); await checkTaskInEquipReset(serverId, roleId, sid);
@@ -639,7 +639,7 @@ export class EquipHandler {
// 更新战力 // 更新战力
if(isSuccess && hid > 0) { if(isSuccess && hid > 0) {
const hero = await HeroModel.findByHidAndRole(hid, roleId); const hero = await HeroModel.findByHidAndRole(hid, roleId);
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_QUENCH, sid, roleId, hero, {}, [ePlaceId], { oldJewel: jewel, newJewel }); await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_QUENCH, roleId, serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId, jewel: newJewel });
} }
await checkTaskInEquipQuench(serverId, roleId, sid, isSuccess); await checkTaskInEquipQuench(serverId, roleId, sid, isSuccess);
@@ -759,7 +759,8 @@ export class EquipHandler {
// 更新战力 // 更新战力
if(targetJewel.hid > 0) { if(targetJewel.hid > 0) {
const hero = await HeroModel.findByHidAndRole(targetJewel.hid, roleId); const hero = await HeroModel.findByHidAndRole(targetJewel.hid, roleId);
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, sid, roleId, hero, {}, [targetJewel.ePlaceId], { oldJewel: originJewel, newJewel }); await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, targetJewel.hid, { ePlace: hero.ePlace }, { ePlaceId: targetJewel.ePlaceId, jewel: newJewel });
} }
await checkTaskInEquipReset(serverId, roleId, sid); await checkTaskInEquipReset(serverId, roleId, sid);
@@ -15,7 +15,6 @@ import { addItems, getFriendPointObject, handleCost } from "../../../services/ro
import { RewardInter } from "../../../pubUtils/interface"; import { RewardInter } from "../../../pubUtils/interface";
import { FriendPresentLogModel } from '../../../db/FriendPresentLog'; import { FriendPresentLogModel } from '../../../db/FriendPresentLog';
import { HeroModel, EPlace } from "../../../db/Hero"; import { HeroModel, EPlace } from "../../../db/Hero";
import { getPlayerMainAttribute } from "../../../services/pvpService";
import { FRIEND } from "../../../pubUtils/dicParam"; import { FRIEND } from "../../../pubUtils/dicParam";
import { PlayerDetail, PlayerDetailHero } from "../../../domain/battleField/guild"; import { PlayerDetail, PlayerDetailHero } from "../../../domain/battleField/guild";
import { createPrivateMsg, pushMsgToRole, pushPresent } from "../../../services/chatService"; import { createPrivateMsg, pushMsgToRole, pushPresent } from "../../../services/chatService";
@@ -23,6 +22,7 @@ import { Rank } from "../../../services/rankService";
import { checkTaskWithRoles, checkTask } from "../../../services/task/taskService"; import { checkTaskWithRoles, checkTask } from "../../../services/task/taskService";
import { ComBattleTeamModel } from "../../../db/ComBattleTeam"; import { ComBattleTeamModel } from "../../../db/ComBattleTeam";
import { JewelModel } from "../../../db/Jewel"; import { JewelModel } from "../../../db/Jewel";
import { getHeroesAttributes } from "../../../services/playerCeService";
export default function (app: Application) { export default function (app: Application) {
@@ -719,9 +719,12 @@ export class FriendHandler {
let jewels = await JewelModel.findMapbyRoleAndHids(hisRoleId, hids); let jewels = await JewelModel.findMapbyRoleAndHids(hisRoleId, hids);
let attrByHid = await getHeroesAttributes(hisRoleId);
let list: HeroDetailParam[] = []; let list: HeroDetailParam[] = [];
for (let hero of heroList) { for (let hero of heroList) {
let attributes = getPlayerMainAttribute(hero.attr, role.attr); let attr = attrByHid.get(hero.hid);
if(!attr) continue;
let attributes = attr.getMainAttributes();
let heroParam = new HeroDetailParam(hero); let heroParam = new HeroDetailParam(hero);
heroParam.setAttributes(attributes); heroParam.setAttributes(attributes);
heroParam.setJewels(jewels); heroParam.setJewels(jewels);
@@ -1,7 +1,6 @@
import { Application, BackendSession, ChannelService, HandlerService, } from 'pinus'; import { Application, BackendSession, ChannelService, HandlerService, } from 'pinus';
import { handleCost, addItems, unlockFigure, getCoinObject, getGoldObject } from '../../../services/role/rewardService'; import { handleCost, addItems, unlockFigure, getCoinObject, getGoldObject } from '../../../services/role/rewardService';
import { calPlayerCeAndSave, calAllHeroCe } from '../../../services/playerCeService'; import { resResult, deepCopy, parseGoodStr } from '../../../pubUtils/util';
import { resResult, deepCopy, reduceCe, parseGoodStr } from '../../../pubUtils/util';
import { STATUS } from '../../../consts/statusCode'; import { STATUS } from '../../../consts/statusCode';
import { HeroModel, Connect, HeroSkin, HeroUpdate, EPlace, Talent } from '../../../db/Hero'; import { HeroModel, Connect, HeroSkin, HeroUpdate, EPlace, Talent } from '../../../db/Hero';
import { CURRENCY_BY_TYPE, CURRENCY_TYPE, CONSUME_TYPE, HERO_GROW_MAX, HERO_SYSTEM_TYPE, ABI_STAGE, DEBUG_MAGIC_WORD, HERO_INITIAL_QUALITY, REDIS_KEY, TASK_TYPE, ITEM_CHANGE_REASON } from '../../../consts'; import { CURRENCY_BY_TYPE, CURRENCY_TYPE, CONSUME_TYPE, HERO_GROW_MAX, HERO_SYSTEM_TYPE, ABI_STAGE, DEBUG_MAGIC_WORD, HERO_INITIAL_QUALITY, REDIS_KEY, TASK_TYPE, ITEM_CHANGE_REASON } from '../../../consts';
@@ -11,18 +10,17 @@ import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, g
import { ItemInter, RewardInter } from '../../../pubUtils/interface'; import { ItemInter, RewardInter } from '../../../pubUtils/interface';
import { getDropItems, FIGURE_UNLOCK_CONDITION } from '../../../consts/constModules/itemConst' import { getDropItems, FIGURE_UNLOCK_CONDITION } from '../../../consts/constModules/itemConst'
import { pushComposeOrangeHero, pushHeroQualityUpMsg, pushHeroStarMax, pushHeroWakeUp } from '../../../services/chatService'; import { pushComposeOrangeHero, pushHeroQualityUpMsg, pushHeroStarMax, pushHeroWakeUp } from '../../../services/chatService';
import { calculatetopLineup } from '../../../pubUtils/playerCe';
import { PvpDefenseModel } from '../../../db/PvpDefense'; import { PvpDefenseModel } from '../../../db/PvpDefense';
import { checkTask, checkTaskInHeroQUalityUp, checkTaskInHeroStarUp, checkTaskInHeroTrain, checkTaskInHeroWakeUp } from '../../../services/task/taskService'; import { checkTask, checkTaskInHeroQUalityUp, checkTaskInHeroStarUp, checkTaskInHeroTrain, checkTaskInHeroWakeUp } from '../../../services/task/taskService';
import { isNumber, pick } from 'underscore'; import { isNumber, pick } from 'underscore';
import { updateEplaces } from '../../../services/equipService'; import { updateEplaces } from '../../../services/equipService';
import { addConsumeToHero, checkUnlockTalentCondition, initSkinTalent, updateSkinTalent } from '../../../services/roleService'; import { addConsumeToHero, checkUnlockTalentCondition, initSkinTalent, updateSkinTalent } from '../../../services/roleService';
import { JewelModel, jewelUpdate } from '../../../db/Jewel'; import { JewelModel, jewelUpdate } from '../../../db/Jewel';
import { CalHeroCe } from '../../../domain/roleField/calCe';
import { HERO, REBORN } from '../../../pubUtils/dicParam'; import { HERO, REBORN } from '../../../pubUtils/dicParam';
import { createHero, createHeroes } from '../../../services/role/createHero'; import { createHero, createHeroes } from '../../../services/role/createHero';
import { CheckMeterial } from '../../../services/role/checkMaterial'; import { CheckMeterial } from '../../../services/role/checkMaterial';
import { HeroParam } from '../../../domain/roleField/hero'; import { HeroParam } from '../../../domain/roleField/hero';
import { calculateCeWithHero } from '../../../services/playerCeService';
export default function (app: Application) { export default function (app: Application) {
new HandlerService(app, {}); new HandlerService(app, {});
@@ -85,7 +83,6 @@ export class HeroHandler {
let { lv: oldLv, exp: oldExp } = hero; let { lv: oldLv, exp: oldExp } = hero;
if (oldLv >= playerLv) return resResult(STATUS.ROLE_HERO_LV_OVER); if (oldLv >= playerLv) return resResult(STATUS.ROLE_HERO_LV_OVER);
if (oldLv + addLv > playerLv) addLv = playerLv - oldLv; if (oldLv + addLv > playerLv) addLv = playerLv - oldLv;
console.log('******* addLv', addLv, oldLv, playerLv);
let nextExp = getHeroExpByLv(oldLv + addLv - 1); let nextExp = getHeroExpByLv(oldLv + addLv - 1);
console.log('nextExp', nextExp, oldLv + addLv - 1, oldExp) console.log('nextExp', nextExp, oldLv + addLv - 1, oldExp)
@@ -127,15 +124,11 @@ export class HeroHandler {
consumes: addConsumeToHero(hero.consumes, material) consumes: addConsumeToHero(hero.consumes, material)
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.LVUP, sid, roleId, hero, update); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.LVUP, roleId, serverId, sid, hid, update);
// 任务 // 任务
await checkTask(serverId, roleId, sid, TASK_TYPE.HERO_LV, { oldLv, hero }); await checkTask(serverId, roleId, sid, TASK_TYPE.HERO_LV, { oldLv, hero: curHero });
return resResult(STATUS.SUCCESS, { curHero: pick(curHero, ['hid', 'lv', 'exp']), cost: material });
const curHero = {
hid, lv: hero.lv, exp: hero.exp
}
return resResult(STATUS.SUCCESS, { curHero, cost: material });
} }
@@ -191,21 +184,12 @@ export class HeroHandler {
consumes: addConsumeToHero(hero.consumes, consumes) consumes: addConsumeToHero(hero.consumes, consumes)
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.STAR, sid, roleId, hero, update);
if (isUpStar) {
await calAllHeroCe(HERO_SYSTEM_TYPE.STAR, sid, roleId, {}, [hid, isUpStar ? 1 : 0]); // 升星可能影响到百家学院全局加成
// 任务
await checkTaskInHeroStarUp(serverId, roleId, sid, hero, oldStar);
}
const curHero = { let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.STAR, roleId, serverId, sid, hid, update, { hid, hero, isUpStar });
hid, if (isUpStar) {
star: hero.star, await checkTaskInHeroStarUp(serverId, roleId, sid, curHero, oldStar); // 任务
starStage: hero.starStage,
colorStar: hero.colorStar,
colorStarStage: hero.colorStarStage
} }
return resResult(STATUS.SUCCESS, { isUpStar, curHero }); return resResult(STATUS.SUCCESS, { isUpStar, curHero: pick(curHero, ['hid', 'star', 'starStage', 'colorStar', 'colorStarStage']) });
} }
// 武将升品 // 武将升品
@@ -248,16 +232,11 @@ export class HeroHandler {
quality: hero.quality + 1, quality: hero.quality + 1,
consumes: addConsumeToHero(hero.consumes, material) consumes: addConsumeToHero(hero.consumes, material)
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.QUALITY, sid, roleId, hero, update);
await calAllHeroCe(HERO_SYSTEM_TYPE.QUALITY, sid, roleId, {}, [hid, 0]); // 升品可能影响到百家学院全局加成
await checkTaskInHeroQUalityUp(serverId, roleId, sid, hero);
const curHero = { let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.QUALITY, roleId, serverId, sid, hid, update, { hero });
hid, await checkTaskInHeroQUalityUp(serverId, roleId, sid, curHero);
quality: hero.quality pushHeroQualityUpMsg(roleId, roleName, serverId, curHero);
} return resResult(STATUS.SUCCESS, { curHero: pick(curHero, ['hid', 'quality']) });
pushHeroQualityUpMsg(roleId, roleName, serverId, hero);
return resResult(STATUS.SUCCESS, { curHero });
} }
// 武将觉醒 // 武将觉醒
@@ -319,25 +298,13 @@ export class HeroHandler {
consumes: addConsumeToHero(hero.consumes, consumes) consumes: addConsumeToHero(hero.consumes, consumes)
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.COLORSTAR, sid, roleId, hero, update); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.COLORSTAR, roleId, serverId, sid, hid, update, { hero, isUpStar });
if (isUpStar) { if (isUpStar) {
await calAllHeroCe(HERO_SYSTEM_TYPE.COLORSTAR, sid, roleId, {}, [hid, isUpStar ? 1 : 0]); // 升星可能影响到百家学院全局加成 await checkTaskInHeroWakeUp(serverId, roleId, sid, curHero, oldColorStar); // 任务
// 任务
await checkTaskInHeroWakeUp(serverId, roleId, sid, hero, oldColorStar);
} }
const curHero = { if (isWakeUp) pushHeroWakeUp(roleId, roleName, serverId, curHero); // 第一次觉醒
hid, pushHeroStarMax(roleId, roleName, serverId, curHero);
quality: hero.quality, return resResult(STATUS.SUCCESS, { isUpStar, curHero: pick(curHero, ['hid', 'quality', 'star', 'starStage', 'colorStar', 'colorStarStage']) });
star: hero.star,
starStage: hero.starStage,
colorStar: hero.colorStar,
colorStarStage: hero.colorStarStage
}
if (isWakeUp) pushHeroWakeUp(roleId, roleName, serverId, hero); // 第一次觉醒
pushHeroStarMax(roleId, roleName, serverId, hero);
return resResult(STATUS.SUCCESS, { isUpStar, curHero });
} }
//训练 //训练
@@ -380,14 +347,13 @@ export class HeroHandler {
//重算战力并下发 //重算战力并下发
let update = { let update = {
job: hero.job,
jobStage: newJobStage, jobStage: newJobStage,
consumes: addConsumeToHero(hero.consumes, consumes) consumes: addConsumeToHero(hero.consumes, consumes)
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.TRAIN, sid, roleId, hero, update); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TRAIN, roleId, serverId, sid, hid, update, { hero });
// 任务 await checkTaskInHeroTrain(serverId, roleId, sid, curHero, trainCount); // 任务
await checkTaskInHeroTrain(serverId, roleId, sid, hero, trainCount); return resResult(STATUS.SUCCESS, { curHero: pick(curHero, ['hid', 'job', 'jobStage'])});
return resResult(STATUS.SUCCESS, { curHero: { hid: hero.hid, job: hero.job, jobStage: hero.jobStage } });
} }
//进阶 //进阶
@@ -420,11 +386,10 @@ export class HeroHandler {
jobStage: 0, jobStage: 0,
consumes: addConsumeToHero(hero.consumes, consumes) consumes: addConsumeToHero(hero.consumes, consumes)
} }
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.STAGEUP, sid, roleId, hero, update);
// 任务
await checkTask(serverId, roleId, sid, TASK_TYPE.HERO_STAGE_UP, { hero, stageUpCnt: 1 })
const heroResult = new HeroParam(hero); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.STAGEUP, roleId, serverId, sid, hid, update, { hid, hero });
await checkTask(serverId, roleId, sid, TASK_TYPE.HERO_STAGE_UP, { hero: curHero, stageUpCnt: 1 }); // 任务
const heroResult = new HeroParam(curHero);
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'job', 'jobStage', 'totalTalentPoint']) }}); return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'job', 'jobStage', 'totalTalentPoint']) }});
} }
@@ -477,11 +442,10 @@ export class HeroHandler {
consumes: addConsumeToHero(hero.consumes, consumes) consumes: addConsumeToHero(hero.consumes, consumes)
} }
//重算战力并下发 //重算战力并下发
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.CONNECT, sid, roleId, hero, update, [shipId]); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.CONNECT, roleId, serverId, sid, hero.hid, update, { shipId, hero });
// 任务 // 任务
await checkTask(serverId, roleId, sid, TASK_TYPE.HERO_CONNECT, { connectLv: level }) await checkTask(serverId, roleId, sid, TASK_TYPE.HERO_CONNECT, { connectLv: level })
return resResult(STATUS.SUCCESS, { curHero: { hid: hero.hid, connections: hero.connections } }); return resResult(STATUS.SUCCESS, { curHero: pick(curHero, ['hid', 'connections']) });
} }
//赠送(包括一键赠送) //赠送(包括一键赠送)
@@ -554,17 +518,14 @@ export class HeroHandler {
consumes: updateConsume consumes: updateConsume
} }
//重算战力并下发 let isFavourLvUp = oldLv != newLv;
if (oldLv != newLv) {
await unlockFigure(sid, roleId, [{ type: FIGURE_UNLOCK_CONDITION.HERO_FAVOR, paramHid: hero.hid, paramFavourLv: hero.favourLv }]);
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.FAVOUR, sid, roleId, hero, update, [oldLv]);
// 任务 let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.FAVOUR, roleId, serverId, sid, hero.hid, update, { isFavourLvUp, hero });
await checkTask(serverId, roleId, sid, TASK_TYPE.HERO_FAVOUR_LV, { hero, oldFavourLv: oldLv }); if(isFavourLvUp) {
} else { await unlockFigure(sid, roleId, [{ type: FIGURE_UNLOCK_CONDITION.HERO_FAVOR, paramHid: curHero.hid, paramFavourLv: curHero.favourLv }]);
hero = await HeroModel.updateHeroInfo(roleId, hero.hid, update); await checkTask(serverId, roleId, sid, TASK_TYPE.HERO_FAVOUR_LV, { hero: curHero, oldFavourLv: oldLv }); // 任务
} }
return resResult(STATUS.SUCCESS, { curHero: { hid: hero.hid, favour: hero.favour, favourLv: hero.favourLv, cost: material } }); return resResult(STATUS.SUCCESS, { curHero: { ...pick(curHero, ['hid', 'favour', 'favourLv']), cost: material } });
} }
//穿带时装 //穿带时装
@@ -613,9 +574,14 @@ export class HeroHandler {
} }
let { newEplace } = updateEplaces(oldEplace, eplaceIds); let { newEplace } = updateEplaces(oldEplace, eplaceIds);
let update = {
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.SKIN, sid, roleId, hero, { skins: newHeroSkins, skinId: dicSkin.heroId, job: dicNewJob.jobid, ePlace: newEplace }); skins: newHeroSkins,
let resultHero = new HeroParam(hero); skinId: dicSkin.heroId,
job: dicNewJob.jobid,
ePlace: newEplace
}
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.SKIN, roleId, serverId, sid, hero.hid, update);
let resultHero = new HeroParam(curHero);
return resResult(STATUS.SUCCESS, { curHero: {...pick(resultHero, ['hid', 'skins', 'skinId', 'job', 'talent', 'usedTalentPoint']), ePlace: newEplace }}); return resResult(STATUS.SUCCESS, { curHero: {...pick(resultHero, ['hid', 'skins', 'skinId', 'job', 'talent', 'usedTalentPoint']), ePlace: newEplace }});
} }
@@ -634,6 +600,7 @@ export class HeroHandler {
let roleId: string = session.get('roleId'); let roleId: string = session.get('roleId');
let roleName: string = session.get('roleName'); let roleName: string = session.get('roleName');
let sid: string = session.get('sid'); let sid: string = session.get('sid');
let serverId: number = session.get('serverId');
let { hid } = msg; let { hid } = msg;
if(!isNumber(hid) && !hid) return resResult(STATUS.WRONG_PARMS); if(!isNumber(hid) && !hid) return resResult(STATUS.WRONG_PARMS);
@@ -654,9 +621,8 @@ export class HeroHandler {
let newSkins = initSkinTalent(skins); let newSkins = initSkinTalent(skins);
let dicHeroScroll = getScollByStar(dicHero.quality, dicHero.initialStars, dicHero.quality, 0); let dicHeroScroll = getScollByStar(dicHero.quality, dicHero.initialStars, dicHero.quality, 0);
let initInfo = HeroModel.getInitInfo({ let initInfo = HeroModel.getInitInfo(hid, {
job: dicJob.jobid, skins: newSkins, skinId, ce, job: dicJob.jobid, skins: newSkins, skinId, ce,
star: dicHero.initialStars, quality: dicHero.quality,
scrollActive: scrollActive, scrollActive: scrollActive,
scrollId: scrollActive? dicHeroScroll.id: 0, scrollId: scrollActive? dicHeroScroll.id: 0,
scrollStar: scrollActive? dicHeroScroll.stars: 0, scrollStar: scrollActive? dicHeroScroll.stars: 0,
@@ -664,10 +630,6 @@ export class HeroHandler {
scrollColorStar: scrollActive? dicHeroScroll.colorstars: 0, scrollColorStar: scrollActive? dicHeroScroll.colorstars: 0,
}); });
let calHeroCe = new CalHeroCe(hid, initInfo);
let heroAttr = calHeroCe.cal(HERO_SYSTEM_TYPE.REBIRTH);
await HeroModel.updateHeroInfo(roleId, hid, { ...initInfo, attr: heroAttr });
// 天晶石 // 天晶石
let curJewels: jewelUpdate[] = []; let curJewels: jewelUpdate[] = [];
for(let { jewel, id } of hero.ePlace) { for(let { jewel, id } of hero.ePlace) {
@@ -681,9 +643,7 @@ export class HeroHandler {
} }
} }
let { heros } = await calAllHeroCe(HERO_SYSTEM_TYPE.REBIRTH, sid, roleId, {}, [hid], { originHero: hero, heroUpdate: initInfo }); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.REBIRTH, roleId, serverId, sid, hid, initInfo, { });
let curHero = heros.find(cur => cur.hid == hid);
let goods = await addItems(roleId, roleName, sid, consumes, ITEM_CHANGE_REASON.REBIRTH); let goods = await addItems(roleId, roleName, sid, consumes, ITEM_CHANGE_REASON.REBIRTH);
const heroResult = new HeroParam(curHero); const heroResult = new HeroParam(curHero);
@@ -694,6 +654,7 @@ export class HeroHandler {
public async unlockTalent(msg: { hid: number, id: number }, session: BackendSession) { public async unlockTalent(msg: { hid: number, id: number }, session: BackendSession) {
let roleId = session.get('roleId'); let roleId = session.get('roleId');
let sid = session.get('sid'); let sid = session.get('sid');
let serverId = session.get('serverId');
let { hid, id } = msg; let { hid, id } = msg;
let hero = await HeroModel.findByHidAndRole(hid, roleId); let hero = await HeroModel.findByHidAndRole(hid, roleId);
@@ -722,9 +683,8 @@ export class HeroHandler {
let { newSkins } = updateSkinTalent(skins, new Talent(id), usedTalentPoint + needTalentPoint); let { newSkins } = updateSkinTalent(skins, new Talent(id), usedTalentPoint + needTalentPoint);
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.TALENT, sid, roleId, hero, { skins: newSkins }); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT, roleId, serverId, sid, hid, { skins: newSkins });
const heroResult = new HeroParam(curHero);
const heroResult = new HeroParam(hero);
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }}); return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }});
} }
@@ -733,6 +693,7 @@ export class HeroHandler {
public async upgradeTalent(msg: { hid: number, id: number }, session: BackendSession) { public async upgradeTalent(msg: { hid: number, id: number }, session: BackendSession) {
let roleId = session.get('roleId'); let roleId = session.get('roleId');
let sid = session.get('sid'); let sid = session.get('sid');
let serverId = session.get('serverId');
let { hid, id } = msg; let { hid, id } = msg;
let hero = await HeroModel.findByHidAndRole(hid, roleId); let hero = await HeroModel.findByHidAndRole(hid, roleId);
@@ -759,9 +720,8 @@ export class HeroHandler {
let { newSkins } = updateSkinTalent(skins, new Talent(id, talent.level + 1), usedTalentPoint + needTalentPoint); let { newSkins } = updateSkinTalent(skins, new Talent(id, talent.level + 1), usedTalentPoint + needTalentPoint);
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.TALENT, sid, roleId, hero, { skins: newSkins }); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT, roleId, serverId, sid, hid, { skins: newSkins });
const heroResult = new HeroParam(curHero);
const heroResult = new HeroParam(hero);
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }}); return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }});
} }
@@ -769,6 +729,7 @@ export class HeroHandler {
public async resetTalent(msg: { hid: number }, session: BackendSession) { public async resetTalent(msg: { hid: number }, session: BackendSession) {
let roleId = session.get('roleId'); let roleId = session.get('roleId');
let sid = session.get('sid'); let sid = session.get('sid');
let serverId = session.get('serverId');
let { hid } = msg; let { hid } = msg;
let hero = await HeroModel.findByHidAndRole(hid, roleId); let hero = await HeroModel.findByHidAndRole(hid, roleId);
@@ -784,9 +745,9 @@ export class HeroHandler {
let newSkins = initSkinTalent(skins); let newSkins = initSkinTalent(skins);
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.TALENT, sid, roleId, hero, { skins: newSkins }); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.TALENT, roleId, serverId, sid, hid, { skins: newSkins });
const heroResult = new HeroParam(hero); const heroResult = new HeroParam(curHero);
return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }}); return resResult(STATUS.SUCCESS, { curHero: {...pick(heroResult, ['hid', 'talent', 'usedTalentPoint', 'totalTalentPoint']) }});
} }
@@ -844,7 +805,6 @@ export class HeroHandler {
await HeroModel.deleteHero(roleId, hid); await HeroModel.deleteHero(roleId, hid);
let role = await RoleModel.findByRoleId(roleId); let role = await RoleModel.findByRoleId(roleId);
await calculatetopLineup(role, hid, 0, null);
await PvpDefenseModel.deleteHero(roleId, hid); await PvpDefenseModel.deleteHero(roleId, hid);
await RoleModel.updateRoleInfo(roleId, { topLineup: role.topLineup, topLineupCe: role.topLineupCe, ce: role.ce - hero.ce }); await RoleModel.updateRoleInfo(roleId, { topLineup: role.topLineup, topLineupCe: role.topLineupCe, ce: role.ce - hero.ce });
return resResult(STATUS.SUCCESS); return resResult(STATUS.SUCCESS);
@@ -1,17 +1,16 @@
import { STATUS } from '../../../consts/statusCode'; import { STATUS } from '../../../consts/statusCode';
import { RoleModel, RoleUpdate } from './../../../db/Role'; import { RoleModel, RoleUpdate } from './../../../db/Role';
import { HeroModel, HeroUpdate } from '../../../db/Hero'; import { HeroModel, HeroType, HeroUpdate } from '../../../db/Hero';
import { resResult, decodeIdCntArrayStr, parseGoodStr, genCode } from '../../../pubUtils/util'; import { resResult, decodeIdCntArrayStr, parseGoodStr, genCode } from '../../../pubUtils/util';
import { Application, BackendSession, pinus, HandlerService, } from 'pinus'; import { Application, BackendSession, pinus, HandlerService, } from 'pinus';
import { handleCost, addItems, getGoldObject, getCoinObject } from '../../../services/role/rewardService'; import { handleCost, addItems, getGoldObject, getCoinObject } from '../../../services/role/rewardService';
import { getTitle, getTeraph, gameData, getScollByStar, getFriendLvByExp, getHeroExpByLv, getExpByLv } from '../../../pubUtils/data'; import { getTitle, getTeraph, gameData, getScollByStar, getFriendLvByExp, getHeroExpByLv, getExpByLv } from '../../../pubUtils/data';
import { SCHOOL, SCROLL, EXTERIOR, SCRIPT } from '../../../pubUtils/dicParam'; import { SCHOOL, SCROLL, EXTERIOR, SCRIPT } from '../../../pubUtils/dicParam';
import { getAtrrNameById } from '../../../consts/constModules/abilityConst' import { getAtrrNameById } from '../../../consts/constModules/abilityConst'
import { findIndex } from 'underscore'; import { findIndex, pick } from 'underscore';
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface'; import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
import { SchoolModel } from '../../../db/School'; import { SchoolModel } from '../../../db/School';
import { getTeraphStrengthenResult, getSchoolList } from '../../../services/roleService' import { getTeraphStrengthenResult, getSchoolList } from '../../../services/roleService'
import { calPlayerCeAndSave, calAllHeroCe } from '../../../services/playerCeService';
import { HERO_SYSTEM_TYPE, LINEUP_NUM, ROLE_SELECT, REDIS_KEY, TASK_TYPE, DEFAULT_HEROES, DEFAULT_HERO_LV, DEFAULT_ITEMS, DEFAULT_EQUIPS, DEFAULT_GOLD, DEFAULT_COIN, DEBUG_MAGIC_WORD, COUNTER, DEFAULT_LV, ITEM_CHANGE_REASON } from '../../../consts'; import { HERO_SYSTEM_TYPE, LINEUP_NUM, ROLE_SELECT, REDIS_KEY, TASK_TYPE, DEFAULT_HEROES, DEFAULT_HERO_LV, DEFAULT_ITEMS, DEFAULT_EQUIPS, DEFAULT_GOLD, DEFAULT_COIN, DEBUG_MAGIC_WORD, COUNTER, DEFAULT_LV, ITEM_CHANGE_REASON } from '../../../consts';
import { checkBattleHeroesByHid, roleLevelup } from '../../../services/normalBattleService'; import { checkBattleHeroesByHid, roleLevelup } from '../../../services/normalBattleService';
import { Rank } from '../../../services/rankService'; import { Rank } from '../../../services/rankService';
@@ -25,7 +24,8 @@ import * as dicParam from '../../../pubUtils/dicParam';
import Counter from '../../../db/Counter'; import Counter from '../../../db/Counter';
import { UserModel } from '../../../db/User'; import { UserModel } from '../../../db/User';
import { checkFilterWords, reportTAEvent, treatRoleName } from '../../../services/sdkService'; import { checkFilterWords, reportTAEvent, treatRoleName } from '../../../services/sdkService';
import { CreateHeroes } from '../../../services/role/createHero'; import { createHeroes } from '../../../services/role/createHero';
import { calculateCeWithHero, calculateCeWithRole } from '../../../services/playerCeService';
export default function (app: Application) { export default function (app: Application) {
new HandlerService(app, {}); new HandlerService(app, {});
@@ -44,26 +44,14 @@ export class RoleHandler {
let { roleName } = msg; let { roleName } = msg;
let role = await RoleModel.findByRoleId(roleId, 'roleName hasInit', true); let role = await RoleModel.findByRoleId(roleId, 'roleName hasInit title teraphs', true);
if (role.hasInit) return resResult(STATUS.ROLE_HAS_INIT); if (role.hasInit) return resResult(STATUS.ROLE_HAS_INIT);
let checkName = await RoleModel.checkName(roleName, serverId); let checkName = await RoleModel.checkName(roleName, serverId);
if (checkName) return resResult(STATUS.NAME_HAS_USED); if (checkName) return resResult(STATUS.NAME_HAS_USED);
let initInfos: { role: RoleUpdate, initInfos: {heroInfo: HeroUpdate, skinInfo: SkinUpdate}[], figureInfo: { heads: Figure[], frames: Figure[], spines: Figure[] }} let { resultHeroes: heroes } = await createHeroes(roleId, roleName, sid, serverId, DEFAULT_HEROES.map(hid => ({hid, count: 1})), { roleName, hasInit: true, title: role.title, teraphs: role.teraphs, lv: role.lv });
= this.app.get('initRoleInfos'); // role = await RoleModel.updateRoleInfo(roleId, { roleName, hasInit: true }); // 在算战力的时候一起更新
role = await RoleModel.updateRoleInfo(roleId, {...initInfos.role, roleName, hasInit: true});
let createHero = new CreateHeroes(roleId, roleName, serverId);
let infos = new Map();
for(let {heroInfo, skinInfo} of initInfos.initInfos) {
infos.set(heroInfo.hid, { heroInfo, skinInfo });
}
await createHero.createWithInitInfo(infos, initInfos.figureInfo);
await createHero.pushMessage(sid);
await createHero.updateRedisRank();
let heroes = createHero.getResultHeroes();
session.set('roleName', roleName); session.set('roleName', roleName);
session.push('roleName', () => { }); session.push('roleName', () => { });
@@ -107,11 +95,11 @@ export class RoleHandler {
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
let update = { title: title + 1 } let update = { title: title + 1 }
let calResult = await calAllHeroCe(HERO_SYSTEM_TYPE.TITLE, sid, roleId, update); let { curRole } = await calculateCeWithRole(HERO_SYSTEM_TYPE.TITLE, roleId, serverId, sid, update);
// 任务 // 任务
await checkTask(serverId, roleId, sid, TASK_TYPE.ROLE_TITLE, { oldTitle: title, title: update.title }); await checkTask(serverId, roleId, sid, TASK_TYPE.ROLE_TITLE, { oldTitle: title, title: update.title });
return resResult(STATUS.SUCCESS, { roleId: calResult.role, title: role.title }); return resResult(STATUS.SUCCESS, { roleId, title: curRole.title });
} }
//神像强化 //神像强化
@@ -140,12 +128,12 @@ export class RoleHandler {
if (!result) if (!result)
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
let calResult = await calAllHeroCe(HERO_SYSTEM_TYPE.TERAPH, sid, roleId, { teraphs }, [id]); let { curRole } = await calculateCeWithRole(HERO_SYSTEM_TYPE.TERAPH, roleId, serverId, sid, { teraphs }, { teraphId: id });
// 任务 // 任务
await checkTask(serverId, roleId, sid, TASK_TYPE.ROLE_TERAPH_STRENGTHEN, { count }); await checkTask(serverId, roleId, sid, TASK_TYPE.ROLE_TERAPH_STRENGTHEN, { count });
return resResult(STATUS.SUCCESS, { roleId, teraphs: calResult.role.teraphs, criAttr }); return resResult(STATUS.SUCCESS, { roleId, teraphs: curRole.teraphs, criAttr });
} }
//神像进阶 //神像进阶
@@ -183,13 +171,12 @@ export class RoleHandler {
let result = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.TERAPH_QUALITY_UP); let result = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.TERAPH_QUALITY_UP);
if (!result) if (!result)
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
let { curRole } = await calculateCeWithRole(HERO_SYSTEM_TYPE.TERAPH_UP, roleId, serverId, sid, { teraphs }, { teraphId: id });
let calResult = await calAllHeroCe(HERO_SYSTEM_TYPE.TERAPH_UP, sid, roleId, { teraphs }, [id]);
// 神像进阶,进阶一次就触发一次礼包弹框 // 神像进阶,进阶一次就触发一次礼包弹框
await checkTask(serverId, roleId, sid, TASK_TYPE.ROLE_TERAPH_STAGE_UP); await checkTask(serverId, roleId, sid, TASK_TYPE.ROLE_TERAPH_STAGE_UP);
return resResult(STATUS.SUCCESS, { roleId, teraphs: calResult.role.teraphs }); return resResult(STATUS.SUCCESS, { roleId, teraphs: curRole.teraphs });
} }
// 获得百家学宫 // 获得百家学宫
@@ -217,14 +204,14 @@ export class RoleHandler {
return resResult(STATUS.DIC_DATA_NOT_FOUND); return resResult(STATUS.DIC_DATA_NOT_FOUND);
} }
let isOpen = !!dicPosition.get(positionId.toString()); // 该位置是否解锁 let isOpen = !!dicPosition.get(positionId.toString()); // 该位置是否解锁
let curHero: HeroType = null;
if (hid > 0) { if (hid > 0) {
let findHero = await SchoolModel.findByHid(roleId, hid); let findHero = await SchoolModel.findByHid(roleId, hid);
if (!!findHero) { if (!!findHero) {
return resResult(STATUS.ROLE_SCHOOL_HERO_USED); return resResult(STATUS.ROLE_SCHOOL_HERO_USED);
} }
let curHero = await HeroModel.findByHidAndRole(hid, roleId); curHero = await HeroModel.findByHidAndRole(hid, roleId);
if (!curHero) return resResult(STATUS.HERO_NOT_FIND); if (!curHero) return resResult(STATUS.HERO_NOT_FIND);
} }
@@ -241,7 +228,7 @@ export class RoleHandler {
} }
await SchoolModel.updateBySclAndPos(roleId, schoolId, positionId, { hid, isOpen }) await SchoolModel.updateBySclAndPos(roleId, schoolId, positionId, { hid, isOpen })
await calAllHeroCe(HERO_SYSTEM_TYPE.SCHOOL, sid, roleId, {}, [schoolId, hid, preHid]); await calculateCeWithRole(HERO_SYSTEM_TYPE.SCHOOL, roleId, serverId, sid, {}, { schoolId, hero: curHero, schoolHid: hid, preSchoolHid: preHid });
// 任务 // 任务
await checkTask(serverId, roleId, sid, TASK_TYPE.ROLE_SCHOOL_PUT_HERO, { hid, preHid }); await checkTask(serverId, roleId, sid, TASK_TYPE.ROLE_SCHOOL_PUT_HERO, { hid, preHid });
@@ -298,13 +285,13 @@ export class RoleHandler {
let { hid } = msg; let { hid } = msg;
let curHero = await HeroModel.findByHidAndRole(hid, roleId, 'hid lv star colorStar quality scrollId scrollActive scrollStar scrollColorStar scrollQuality favour favourLv connections attr ce'); let hero = await HeroModel.findByHidAndRole(hid, roleId, 'hid lv star colorStar quality scrollId scrollActive scrollStar scrollColorStar scrollQuality favour favourLv connections attr ce');
if (!curHero) return resResult(STATUS.HERO_NOT_FIND); if (!hero) return resResult(STATUS.HERO_NOT_FIND);
let dicHero = gameData.hero.get(hid); let dicHero = gameData.hero.get(hid);
if (!dicHero) return resResult(STATUS.DIC_DATA_NOT_FOUND); if (!dicHero) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let { star, colorStar, quality, scrollId, scrollActive, scrollStar, scrollColorStar, scrollQuality, favour, favourLv } = curHero; let { star, colorStar, quality, scrollId, scrollActive, scrollStar, scrollColorStar, scrollQuality, favour, favourLv } = hero;
let update = { let update = {
scrollActive, scrollId, scrollStar, scrollColorStar, scrollQuality, favour, favourLv scrollActive, scrollId, scrollStar, scrollColorStar, scrollQuality, favour, favourLv
@@ -331,23 +318,13 @@ export class RoleHandler {
let dicHeroScroll = getScollByStar(dicHero.quality, update.scrollStar, update.scrollQuality, update.scrollColorStar); let dicHeroScroll = getScollByStar(dicHero.quality, update.scrollStar, update.scrollQuality, update.scrollColorStar);
update.scrollId = dicHeroScroll ? dicHeroScroll.id : 0; update.scrollId = dicHeroScroll ? dicHeroScroll.id : 0;
let hero = await HeroModel.updateHeroInfo(roleId, hid, update); let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.SCROLL, roleId, serverId, sid, hid, update);
await calAllHeroCe(HERO_SYSTEM_TYPE.SCROLL, sid, roleId, {}, [hid]); // 全局增加战力
// 任务 // 任务
await checkTaskInActiveScroll(serverId, roleId, sid, scrollActive, hero); await checkTaskInActiveScroll(serverId, roleId, sid, scrollActive, hero);
return resResult(STATUS.SUCCESS, { return resResult(STATUS.SUCCESS, {
curHero: { curHero: pick(curHero, ['hid', 'scrollActive', 'scrollId', 'scrollStar', 'scrollColorStar', 'scrollQuality', 'favour', 'favourLv'])
hid: hero.hid,
scrollActive: hero.scrollActive,
scrollId: hero.scrollId,
scrollStar: hero.scrollStar,
scrollColorStar: hero.scrollColorStar,
scrollQuality: hero.scrollQuality,
favour: hero.favour,
favourLv: hero.favourLv,
}
}); });
} }
@@ -5,14 +5,11 @@ import { HeroUpdate } from '../../../db/Hero';
import { RoleUpdate } from '../../../db/Role'; import { RoleUpdate } from '../../../db/Role';
import { SkinUpdate } from '../../../db/Skin'; import { SkinUpdate } from '../../../db/Skin';
import { RankFirstModel, RankFirstType } from '../../../db/RankFirst'; import { RankFirstModel, RankFirstType } from '../../../db/RankFirst';
import { DEFAULT_HEROES } from '../../../consts';
import { Figure } from '../../../domain/dbGeneral'; import { Figure } from '../../../domain/dbGeneral';
import { getDefaultRoleInfo } from '../../../services/roleService';
import { PVPConfigModel, PVPConfigType } from '../../../db/SystemConfig'; import { PVPConfigModel, PVPConfigType } from '../../../db/SystemConfig';
import { treatRoleName, taflush } from '../../../services/sdkService'; import { treatRoleName, taflush } from '../../../services/sdkService';
import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService'; import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService';
import { errlogger } from '../../../util/logger'; import { errlogger } from '../../../util/logger';
import { getInitRoleInfo } from '../../../services/role/initRoleService';
export default function (app: Application) { export default function (app: Application) {
new HandlerService(app, {}); new HandlerService(app, {});
@@ -23,16 +20,12 @@ export class RoleRemote {
constructor(private app: Application) { constructor(private app: Application) {
this.app = app; this.app = app;
this.channelService = app.get('channelService'); // this.channelService = app.get('channelService');
this.setInitRole();
this.loadRankFirst(); this.loadRankFirst();
this.initPvpSeasonNum(); this.initPvpSeasonNum();
} }
private channelService: ChannelService; // private channelService: ChannelService;
private initHeroes: Map<number, HeroUpdate> = new Map(); // hid => hero
private initRole: RoleUpdate = {};
private initSkins: Map<number, SkinUpdate> = new Map(); // hid => skin
private figureInfo: {heads: Figure[], frames: Figure[], spines: Figure[]};
private rankFirstRewards: Map<number, Map<number, RankFirstType>> = new Map(); private rankFirstRewards: Map<number, Map<number, RankFirstType>> = new Map();
private async loadRankFirst() { private async loadRankFirst() {
@@ -68,76 +61,6 @@ export class RoleRemote {
} }
} }
public setInitRole() {
try {
let result = getInitRoleInfo();
let { role, heroes, skins, figureInfo } = result;
for(let hero of heroes) {
this.initHeroes.set(hero.hid, hero);
}
for(let skin of skins) {
this.initSkins.set(skin.hid, skin);
}
this.initRole = role;
this.figureInfo = figureInfo;
const initRoleInfos = getDefaultRoleInfo(this.initHeroes, this.initSkins, this.initRole, this.figureInfo);
this.app.set('initRoleInfos', initRoleInfos);
this.app.set('initHeroes', this.initHeroes);
this.app.set('initSkins', this.initSkins);
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
public getInitRoleInfos() {
try {
let initRoleInfos = this.app.get('initRoleInfos');
if (!initRoleInfos) {
initRoleInfos = getDefaultRoleInfo(this.initHeroes, this.initSkins, this.initRole, this.figureInfo);
this.app.set('initRoleInfos', initRoleInfos);
}
return initRoleInfos;
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
public getInitHeroes() {
try {
let result: HeroUpdate[] = [];
for(let hid of DEFAULT_HEROES) {
result.push(this.initHeroes.get(hid));
}
return result;
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
public getInitSkins() {
try {
let result: SkinUpdate[] = [];
for(let hid of DEFAULT_HEROES) {
result.push(this.initSkins.get(hid));
}
return result;
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
public getInitHeroById(hid: number) {
try {
return {
heroInfo: this.initHeroes.get(hid),
skinInfo: this.initSkins.get(hid)
}
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
/** /**
* 重载json资源 * 重载json资源
*/ */
@@ -222,8 +222,6 @@ export function getVipRegretCnt(vipStartTime: number) {
} }
export function vipCanSkipTower(recommendCeSum: number, heroesCeSum: number, vipStartTime: number) { export function vipCanSkipTower(recommendCeSum: number, heroesCeSum: number, vipStartTime: number) {
console.log('####', recommendCeSum, heroesCeSum, vipStartTime, );
let ratio = vipStartTime > 0? VIP.VIP_TOWER_SKIP_CE_RATIO_WITH_VIP: VIP.VIP_TOWER_SKIP_CE_RATIO_WITHOUT_VIP; let ratio = vipStartTime > 0? VIP.VIP_TOWER_SKIP_CE_RATIO_WITH_VIP: VIP.VIP_TOWER_SKIP_CE_RATIO_WITHOUT_VIP;
console.log('#####', VIP.VIP_TOWER_SKIP_CE_RATIO_WITH_VIP, VIP.VIP_TOWER_SKIP_CE_RATIO_WITHOUT_VIP, ratio)
return heroesCeSum > recommendCeSum * ratio; return heroesCeSum > recommendCeSum * ratio;
} }
+1 -1
View File
@@ -97,7 +97,7 @@ export function getDungeonBuyCountCost(num:number) {
} }
export async function saveDungeonFirst(role: RoleType, warId: number, battleRecord: BattleRecordType) { export async function saveDungeonFirst(role: RoleType, warId: number, battleRecord: BattleRecordType) {
let userInfo = new RankParam(role, true); let userInfo = new RankParam(role);
let lineup = battleRecord.record.lineup; let lineup = battleRecord.record.lineup;
let dicWar = gameData.war.get(warId); let dicWar = gameData.war.get(warId);
await DungeonFirstModel.createDungeonFirst(role.serverId, dicWar.movePoint, warId, { await DungeonFirstModel.createDungeonFirst(role.serverId, dicWar.movePoint, warId, {
+15 -1
View File
@@ -1,6 +1,6 @@
import { getRandEelm, } from '../pubUtils/util'; import { getRandEelm, } from '../pubUtils/util';
import { EPlace, Stone } from "../db/Hero"; import { EPlace, Stone } from "../db/Hero";
import { gameData, getRandEffectByGroupAndLevel } from "../pubUtils/data"; import { gameData, getJewelConditionByLvAndSeId, getRandEffectByGroupAndLevel } from "../pubUtils/data";
import { JewelType, RandSe } from '../db/Jewel'; import { JewelType, RandSe } from '../db/Jewel';
import { DicRandomEffectPool } from '../pubUtils/dictionary/DicRandomEffectPool'; import { DicRandomEffectPool } from '../pubUtils/dictionary/DicRandomEffectPool';
import { getJewelRandSe } from './role/rewardService'; import { getJewelRandSe } from './role/rewardService';
@@ -126,4 +126,18 @@ export function getJewelByEquip(oldEquip: EPlace, newEquip: EPlace, jewels: Jewe
let oldJewel = jewels.find(cur => cur && cur.seqId == oldEquip.jewel); let oldJewel = jewels.find(cur => cur && cur.seqId == oldEquip.jewel);
let newJewel = jewels.find(cur => cur && cur.seqId == newEquip.jewel); let newJewel = jewels.find(cur => cur && cur.seqId == newEquip.jewel);
return { oldJewel, newJewel } return { oldJewel, newJewel }
}
export function isRandSeUnLock(jewelId: number, randSeId: number, stones: Stone[]) {
let dicJewel = gameData.jewel.get(jewelId);
let dicJewelCondition = getJewelConditionByLvAndSeId(dicJewel.lv, randSeId);
let stoneCnt = 0, stoneLv = 0;
for(let { stone } of stones) {
let dicStone = gameData.stone.get(stone);
if(dicStone) {
stoneCnt++;
stoneLv += dicStone.lv;
}
}
return stoneCnt >= dicJewelCondition.stoneCnt && stoneLv >= dicJewelCondition.stoneLv;
} }
+14 -26
View File
@@ -1,15 +1,16 @@
import { ExpeditionPointModel } from '../db/ExpeditionPoint'; import { ExpeditionPointModel } from '../db/ExpeditionPoint';
import Role, { CeAttrDataRole, RoleModel } from '../db/Role'; import Role, { RoleModel } from '../db/Role';
import { shouldRefresh, calculateSumCE, getRandSingleEelm } from '../pubUtils/util'; import { shouldRefresh, getRandSingleEelm } from '../pubUtils/util';
import { LINEUP_NUM, EXPEDITION_WAR_RECORD_STATUS } from '../consts'; import { LINEUP_NUM, EXPEDITION_WAR_RECORD_STATUS } from '../consts';
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord'; import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
import { CeAttrData, HeroType } from '../db/Hero'; import { HeroType } from '../db/Hero';
import { gameData } from '../pubUtils/data'; import { gameData } from '../pubUtils/data';
import { getTimeFunD } from '../pubUtils/timeUtil'; import { getTimeFunD } from '../pubUtils/timeUtil';
import { ExpeditionRecordModel } from '../db/ExpeditionRecord'; import { ExpeditionRecordModel } from '../db/ExpeditionRecord';
import { Attribute, AttributeCal } from '../domain/roleField/attribute'; import { Attribute, AttributeCal } from '../domain/roleField/attribute';
import * as dicParam from '../pubUtils/dicParam'; import * as dicParam from '../pubUtils/dicParam';
import { getHeroesAttributes, getSumCe } from './playerCeService';
/** /**
* 获取远征关卡列表 * 获取远征关卡列表
@@ -24,7 +25,7 @@ export async function getExpeditionStatus(roleId: string, roleName: string) {
let expeditionRecord = await ExpeditionRecordModel.getCurRecord(roleId); let expeditionRecord = await ExpeditionRecordModel.getCurRecord(roleId);
if (!expeditionRecord) { // 首次新建一条记录 if (!expeditionRecord) { // 首次新建一条记录
// 我方战力 // 我方战力
let myCe = await calculateSumCE(roleId, 1, { num: LINEUP_NUM }); let myCe = await getSumCe(roleId, LINEUP_NUM);
expeditionRecord = await ExpeditionRecordModel.createRecord({ expeditionRecord = await ExpeditionRecordModel.createRecord({
roleId, roleName, heroes: [], myCe roleId, roleName, heroes: [], myCe
}); });
@@ -136,7 +137,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
let index = Math.floor(Math.random() * resultRange.length); let index = Math.floor(Math.random() * resultRange.length);
let role = resultRange[index]; let role = resultRange[index];
let {roleId, topLineup, topLineupCe } = role; let {roleId, topLineup, topLineupCe } = role;
let { attr: roleAttrs } = role; let attrByHid = await getHeroesAttributes(roleId);
enemyObj.enemyFrom = 1; enemyObj.enemyFrom = 1;
enemyObj.enemyId = roleId; enemyObj.enemyId = roleId;
@@ -149,9 +150,10 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
if(hero) { if(hero) {
let h = <HeroType>hero.hero; let h = <HeroType>hero.hero;
if(h) { if(h) {
let { star, lv, attr: heroAttrs, ce } = h; let { star, lv, ce } = h;
let dicHero = gameData.hero.get(hero.hid); let dicHero = gameData.hero.get(hero.hid);
let { attribute } = getPlayerAttribute(lv, heroAttrs, roleAttrs); let attr = attrByHid.get(hero.hid);
let attribute = attr.getAttributesToString();
let heroInfo = { let heroInfo = {
actorId: hero.hid, actorId: hero.hid,
skinId: h.skinId, skinId: h.skinId,
@@ -280,32 +282,18 @@ export async function getResetRemainCnt(curTime: Date, roleId: string, role?: Ro
let newAttribute = new AttributeCal(); let newAttribute = new AttributeCal();
newAttribute.setLv(lv); newAttribute.setLv(lv);
newAttribute.setByWarJson(subAttrs); // 次级属性 newAttribute.setByWarJson(subAttrs); // 次级属性
let subAttrCe = newAttribute.calSubAttrCeAndReduce() * enemyCount; let subAttrCe = newAttribute.calSubAttrCe() * enemyCount;
if(ce * ratio > subAttrCe) { if(ce * ratio > subAttrCe) {
let mainAttrCe = ce * ratio - subAttrCe; let mainAttrCe = ce * ratio - subAttrCe;
newAttribute.setByWarJson(mainAttrs, mainAttrCe / enemyCe); newAttribute.setByWarJson(mainAttrs, mainAttrCe / enemyCe);
let attrArr = newAttribute.getReduceAttributesToString(); let attrArr = newAttribute.getAttributesToString();
let newCe = newAttribute.calCelAndReduce(); let newCe = newAttribute.calCe();
return { attribute: attrArr, ce: newCe }; return { attribute: attrArr, ce: newCe };
} else { } else {
newAttribute = new AttributeCal(); newAttribute = new AttributeCal();
newAttribute.setByWarJson(mainAttrs, ce * ratio / enemyCe); newAttribute.setByWarJson(mainAttrs, ce * ratio / enemyCe);
let attrArr = newAttribute.getReduceAttributesToString(); let attrArr = newAttribute.getAttributesToString();
let newCe = newAttribute.calCelAndReduce(); let newCe = newAttribute.calCe();
return { attribute: attrArr, ce: newCe }; return { attribute: attrArr, ce: newCe };
} }
}
/**
* @description 根据玩家数据获取到他的属性
* @param ceAttr hero表的ceAttr
* @param globalCeAttr role表中的globalCeAttr
*/
export function getPlayerAttribute(lv: number, heroAttrs: CeAttrData[] = [], roleAttrs: CeAttrDataRole[] = []) {
let newAttribute = new AttributeCal();
newAttribute.setLv(lv);
newAttribute.setByDbData(roleAttrs, heroAttrs);
let attribute = newAttribute.getReduceAttributesToString();
let ce = newAttribute.calCelAndReduce();
return { attribute, ce };
} }
@@ -1,6 +1,5 @@
import { ServerlistModel } from "../../db/Serverlist"; import { ServerlistModel } from "../../db/Serverlist";
import { RoleModel } from "../../db/Role"; import { RoleModel } from "../../db/Role";
import { reduceCe } from "../../pubUtils/util";
import { GUILDACTIVITY } from "../../pubUtils/dicParam"; import { GUILDACTIVITY } from "../../pubUtils/dicParam";
import { gameData, getGuildAuctionRewards, getCityActivityRewards } from "../../pubUtils/data"; import { gameData, getGuildAuctionRewards, getCityActivityRewards } from "../../pubUtils/data";
import { getCurDay, nowSeconds, getTimeFun } from "../../pubUtils/timeUtil"; import { getCurDay, nowSeconds, getTimeFun } from "../../pubUtils/timeUtil";
@@ -82,7 +81,7 @@ export async function setPreDayActiveData() {
} }
} }
await ServerRecordModel.updateData(server.id, { activePlayerCnt, activePlayerCe: reduceCe(activePlayerCe), activePlayers, activeGuilds }); await ServerRecordModel.updateData(server.id, { activePlayerCnt, activePlayerCe, activePlayers, activeGuilds });
} }
return servers; return servers;
} }
+1 -3
View File
@@ -4,7 +4,7 @@ import { findIndex } from 'underscore';
import { sismemberAsync, smembersAsync, saddAsync, delAsync, getRoleOnlineInfo } from '../services/redisService'; import { sismemberAsync, smembersAsync, saddAsync, delAsync, getRoleOnlineInfo } from '../services/redisService';
import { pinus } from 'pinus'; import { pinus } from 'pinus';
import { STATUS } from '../consts/statusCode'; import { STATUS } from '../consts/statusCode';
import { reduceCe, resResult, shouldRefresh } from '../pubUtils/util'; import { resResult, shouldRefresh } from '../pubUtils/util';
import { BattleRecordModel } from '../db/BattleRecord'; import { BattleRecordModel } from '../db/BattleRecord';
import { getArmyBossRank, gameData, getAuctionRewardByPoolId } from '../pubUtils/data'; import { getArmyBossRank, gameData, getAuctionRewardByPoolId } from '../pubUtils/data';
import { sendMailToGuildByContent } from '../services/mailService'; import { sendMailToGuildByContent } from '../services/mailService';
@@ -197,8 +197,6 @@ export async function getBossHp(serverId: number, guildCode: string, dicBossBase
activeCe += activePlayers[i].topLineupCe; activeCe += activePlayers[i].topLineupCe;
} }
} }
activeCe = reduceCe(activeCe);
console.log(`getBossHp activeCe ${activeCe}`); console.log(`getBossHp activeCe ${activeCe}`);
let B = activeCe/6/GUILDACTIVITY.GATEACTIVITY_ENEMYCE; let B = activeCe/6/GUILDACTIVITY.GATEACTIVITY_ENEMYCE;
console.log(`getBossHp B ${B}`); console.log(`getBossHp B ${B}`);
@@ -4,7 +4,7 @@ import Role, { RoleModel, RoleType } from '../db/Role'
import { getLvByExp, getExpByLv, gameData, getDicApByLv } from '../pubUtils/data'; import { getLvByExp, getExpByLv, gameData, getDicApByLv } from '../pubUtils/data';
import { updateUserInfo } from './redisService'; import { updateUserInfo } from './redisService';
// import { switchOnFunc } from './funcSwitchService'; // import { switchOnFunc } from './funcSwitchService';
import { FUNC_OPT_TYPE, TASK_TYPE, WAR_TYPE, STATUS, KING_EXP_RATIO_TYPE, ITEM_CHANGE_REASON, POP_UP_SHOP_CONDITION_TYPE } from '../consts'; import { FUNC_OPT_TYPE, TASK_TYPE, WAR_TYPE, STATUS, KING_EXP_RATIO_TYPE, ITEM_CHANGE_REASON, POP_UP_SHOP_CONDITION_TYPE, HERO_SYSTEM_TYPE } from '../consts';
import { BackendSession, pinus } from 'pinus'; import { BackendSession, pinus } from 'pinus';
import { REDIS_KEY } from '../consts'; import { REDIS_KEY } from '../consts';
import { Rank } from './rankService'; import { Rank } from './rankService';
@@ -16,6 +16,7 @@ import { LineupParam } from '../domain/rank';
import { WarStar } from '../domain/dbGeneral'; import { WarStar } from '../domain/dbGeneral';
import { uniq } from 'underscore'; import { uniq } from 'underscore';
import { checkPopUpCondition } from './activity/popUpShopService'; import { checkPopUpCondition } from './activity/popUpShopService';
import { calculateCeWithRole } from './playerCeService';
export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kingExp: number = 0, session: BackendSession) { export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kingExp: number = 0, session: BackendSession) {
const serverId = session.get('serverId'); const serverId = session.get('serverId');
@@ -47,6 +48,7 @@ export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kin
await checkTask(serverId, roleId, session.get('sid'), TASK_TYPE.ROLE_LV, { oldLv: lv, lv: newLv }); await checkTask(serverId, roleId, session.get('sid'), TASK_TYPE.ROLE_LV, { oldLv: lv, lv: newLv });
// 弹出礼包 // 弹出礼包
await checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.LV_TO, { oldLv: lv, newLv }) await checkPopUpCondition(serverId, roleId, POP_UP_SHOP_CONDITION_TYPE.LV_TO, { oldLv: lv, newLv })
await calculateCeWithRole(HERO_SYSTEM_TYPE.ROLE_LV, roleId, serverId, sid, { lv: newLv });
} }
let actordata: { lv: number, exp: number, getExp: number, mostExp: number }[] = []; let actordata: { lv: number, exp: number, getExp: number, mostExp: number }[] = [];
+362 -52
View File
@@ -5,78 +5,358 @@
import { pinus } from 'pinus'; import { pinus } from 'pinus';
import { STATUS } from '../consts/statusCode'; import { STATUS } from '../consts/statusCode';
import { resResult, reduceCe } from '../pubUtils/util'; import { resResult } from '../pubUtils/util';
import { calPlayerCeAndSave as pubCalPlayerCeAndSave, reCalAllHeroCe } from '../pubUtils/playerCe'; import { HeroModel, HeroType, HeroUpdate } from '../db/Hero';
import { HeroType, HeroUpdate } from '../db/Hero';
import { RoleUpdate, RoleType } from '../db/Role'; import { RoleUpdate, RoleType, RoleModel } from '../db/Role';
import { Rank } from './rankService'; import { Rank } from './rankService';
import { REDIS_KEY } from '../consts'; import { HERO_SYSTEM_TYPE, REDIS_KEY } from '../consts';
import { updateUserInfo } from './redisService'; import { updateUserInfo } from './redisService';
import { GuildType } from '../db/Guild'; import { GuildModel, GuildType } from '../db/Guild';
import { CalCe } from './role/calCe';
import { RoleCeModel } from '../db/RoleCe';
import { PvpDefenseModel } from '../db/PvpDefense';
import { saveCeChangeLog } from '../pubUtils/logUtil';
import { JewelType } from '../db/Jewel';
import { SchoolModel } from '../db/School';
import { AttributeCal } from '../domain/roleField/attribute';
interface calPlayerReturn { interface Param {
serverId: number; isInitRole?: boolean,
role: RoleType; hid?: number,
guild?: GuildType; hero?: HeroType,
hero?: HeroType; isUpStar?: boolean,
pushHeros: {hid: number, ce: number, incHeroCe: number}[]; shipId?: number,
topLineupCe: number; isFavourLvUp?: boolean,
heros?: HeroType[] ePlaceId?: number,
ePlaceIds?: number[],
jewels?: JewelType[],
jewel?: JewelType,
teraphId?: number,
schoolId?: number,
schoolHid?: number,
preSchoolHid?: number,
skinId?: number,
} }
//修改并下发战力 export async function calculateCeWithHero(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, hid: number, heroUpdate: HeroUpdate, param: Param = {}) {
export async function calPlayerCeAndSave(type: number, sid: string, roleId: string, originHero: HeroType, update: HeroUpdate, args?: Array<number>, params?: any) { let heroUpdates = new Map<number, HeroUpdate>();
let result = await pubCalPlayerCeAndSave(type, roleId, originHero, update, args, params); heroUpdates.set(hid, heroUpdate);
return await pushCalPlayerCe(roleId, sid, result); let { heroes, curRole } = await calculateCes(type, roleId, serverId, sid, heroUpdates, {}, {}, param);
let curHero = heroes.find(cur => cur.hid == hid);
return { heroes, curHero, curRole }
} }
// 修改后战力的推送 export async function calculateCeWithRole(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, roleUpdate: RoleUpdate, param: Param = {}) {
export async function pushCalPlayerCe(roleId: string, sid: string, calResult: calPlayerReturn) { let { heroes, curRole } = await calculateCes(type, roleId, serverId, sid, new Map(), roleUpdate, {}, param);
let {role, pushHeros, topLineupCe, hero, guild, serverId} = calResult; return { heroes, curRole };
// console.log(JSON.stringify(pushHeros)) }
//下发战力
export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, heroUpdates: Map<number, HeroUpdate>, roleUpdate: RoleUpdate, roleIncUpdate: RoleUpdate, param: Param = {}) {
let calCe = new CalCe(roleId);
let roleCe = await RoleCeModel.findByRoleId(roleId);
calCe.setRoleCe(roleCe);
switch (type) {
case HERO_SYSTEM_TYPE.INIT:
{
for(let [hid, { skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, }] of heroUpdates) {
calCe.setHeroBase(hid, skinId);
calCe.setHeroLv(hid, lv);
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
calCe.setJob(hid, job, jobStage);
}
console.log('####### roleUpdate', param.isInitRole, roleUpdate)
if(param.isInitRole) {
let { title, teraphs, lv } = roleUpdate;
calCe.setRoleLv(lv)
calCe.setTitle(title);
calCe.setTeraph(teraphs);
}
break;
}
case HERO_SYSTEM_TYPE.LVUP: // 1. 升级
{
for(let [hid, { lv }] of heroUpdates) {
calCe.setHeroLv(hid, lv);
}
break;
}
case HERO_SYSTEM_TYPE.STAR: // 2. 升星
{
for(let [hid, { star, starStage }] of heroUpdates) {
let { hero: { quality, job, colorStar, colorStarStage }, isUpStar } = param;
await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, isUpStar);
}
break;
}
case HERO_SYSTEM_TYPE.QUALITY: // 3. 升品
{
for(let [hid, { quality }] of heroUpdates) {
let { hero: { star, starStage, colorStar, colorStarStage, job } } = param;
await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, true);
}
break;
}
case HERO_SYSTEM_TYPE.COLORSTAR: // 4. 觉醒
{
for(let [hid, { quality, colorStar, colorStarStage }] of heroUpdates) {
let { hero: { star, starStage, job }, isUpStar } = param;
await treatHeroStar(calCe, roleId, hid, star, starStage, quality, colorStar, colorStarStage, job, isUpStar);
}
break;
}
case HERO_SYSTEM_TYPE.TRAIN: // 5. 训练
case HERO_SYSTEM_TYPE.STAGEUP: // 6. 职业进阶
{
for(let [hid, { job, jobStage }] of heroUpdates) {
calCe.setJob(hid, job, jobStage);
}
break;
}
case HERO_SYSTEM_TYPE.SKIN: // 7. 穿皮肤
{
let { hero: { quality, star, starStage, colorStar, colorStarStage, skins } } = param;
for(let [hid, { skinId, job, ePlace }] of heroUpdates) {
calCe.setHeroBase(hid, skinId);
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) {
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
calCe.setEquipStrength(hid, id, equipId, lv);
calCe.setEquipStar(hid, id, equipId, star, starStage);
}
calCe.setTalent(hid, skins);
}
break;
}
case HERO_SYSTEM_TYPE.FAVOUR: // 8. 好感度
{
let { hero: { connections }, isFavourLvUp } = param;
console.log('####', connections, isFavourLvUp, heroUpdates)
if(isFavourLvUp) {
for(let [hid, { favourLv }] of heroUpdates) {
calCe.setFavour(hid, favourLv, connections);
}
}
break;
}
case HERO_SYSTEM_TYPE.CONNECT: // 9. 羁绊
{
for(let [ hid, { connections } ] of heroUpdates) {
let { shipId } = param;
calCe.setConnection(hid, shipId, connections);
}
break;
}
case HERO_SYSTEM_TYPE.ADD_SKIN: // 15. 第一次获得皮肤
{
let { skinId } = param;
calCe.setAddSkin(skinId);
break;
}
case HERO_SYSTEM_TYPE.SCHOOL: // 16. 放百家学宫
{
let { schoolId, schoolHid, preSchoolHid, hero } = param;
if(preSchoolHid) {
calCe.setSchool(false, preSchoolHid, schoolId, 0, 0, 0);
}
if(schoolHid) {
let { star, colorStar, quality } = hero;
calCe.setSchool(true, schoolHid, schoolId, star, colorStar, quality);
}
break;
}
case HERO_SYSTEM_TYPE.SCROLL: // 17. 名将谱
{
for(let [hid, { scrollStar, scrollQuality, scrollColorStar }] of heroUpdates) {
calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar);
}
break;
}
case HERO_SYSTEM_TYPE.TITLE: // 18. 爵位
{
let { title } = roleUpdate;
calCe.setTitle(title);
break;
}
case HERO_SYSTEM_TYPE.TERAPH: // 19. 神像
case HERO_SYSTEM_TYPE.TERAPH_UP: // 20. 神像进阶
{
let { teraphs } = roleUpdate;
calCe.setTeraph(teraphs);
break;
}
case HERO_SYSTEM_TYPE.COMPOSE_EQUIP: // 21. 合成装备
{
let { ePlaceId } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) {
if(ePlaceId == id) {
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
calCe.setEquipStrength(hid, id, equipId, lv);
calCe.setEquipStar(hid, id, equipId, star, starStage);
}
}
calCe.setEquipSuit(hid, ePlace);
}
break;
}
case HERO_SYSTEM_TYPE.EQUIP_STRENGTH: // 22. 装备强化
{
let { ePlaceIds } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, equipId, lv } of ePlace) {
if(ePlaceIds.indexOf(id) != -1) {
calCe.setEquipStrength(hid, id, equipId, lv);
}
}
}
break;
}
case HERO_SYSTEM_TYPE.EQUIP_QUALITY: // 23. 装备升品
{
let { ePlaceId } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, equipId, quality, qualityStage } of ePlace) {
if(ePlaceId == id) {
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
}
}
}
break;
}
case HERO_SYSTEM_TYPE.EQUIP_STAR: // 24. 装备升星
{
let { ePlaceId } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, equipId, star, starStage } of ePlace) {
if(ePlaceId == id) {
calCe.setEquipStar(hid, id, equipId, star, starStage);
}
}
calCe.setEquipSuit(hid, ePlace);
}
break;
}
case HERO_SYSTEM_TYPE.EQUIP_JEWEL: // 25. 装备天晶
case HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE: // 27. 洗练
case HERO_SYSTEM_TYPE.JEWEL_QUENCH: // 28. 淬炼
{
let { ePlaceId, jewel: curJewel } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, stones } of ePlace) {
if(ePlaceId == id) {
calCe.setJewel(hid, id, stones, curJewel);
}
}
calCe.setEquipSuit(hid, ePlace);
}
break;
}
case HERO_SYSTEM_TYPE.EQUIP_STONE: // 26. 装备地玉
{
let { ePlaceId, jewel: curJewel } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, stones } of ePlace) {
if(ePlaceId == id) {
calCe.setJewel(hid, id, stones, curJewel);
}
}
calCe.setEquipSuit(hid, ePlace);
}
break;
}
case HERO_SYSTEM_TYPE.REBIRTH: // 29. 重生
{
for(let [hid, { skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, skins, ePlace, scrollStar, scrollQuality, scrollColorStar }] of heroUpdates) {
calCe.setHeroBase(hid, skinId);
calCe.setHeroLv(hid, lv);
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
calCe.setJob(hid, job, jobStage);
for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) {
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
calCe.setEquipStrength(hid, id, equipId, lv);
calCe.setEquipStar(hid, id, equipId, star, starStage);
}
calCe.setTalent(hid, skins);
calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar);
}
break;
}
case HERO_SYSTEM_TYPE.TALENT: // 30. 天赋
{
for(let [hid, { skins }] of heroUpdates) {
calCe.setTalent(hid, skins);
}
break;
}
case HERO_SYSTEM_TYPE.ROLE_LV: // 31. 玩家等级
{
let { lv } = roleUpdate;
calCe.setRoleLv(lv);
break;
}
}
let { heroCe, roleInc } = calCe.getCeInc(); // 计算战力,获得有变化的武将战力
let changeHids: number[] = [];
let pushHeros = new Array<{ hid: number, ce: number, incHeroCe: number }>();
let heroes: HeroType[] = [];
for(let [hid, heroUpdate] of heroUpdates) {
if(heroCe.has(hid)) {
let { ce, inc } = heroCe.get(hid);
let heroUpdate = heroUpdates.get(hid)||{};
let hero = await HeroModel.updateHeroInfo(roleId, hid, { ...heroUpdate, ce });
calCe.setResultHero(hero);
heroes.push(hero);
await PvpDefenseModel.updateCe(roleId, hid, inc); // 更新pvp防守阵战力
pushHeros.push({ hid, ce, incHeroCe: inc });
changeHids.push(hid);
} else {
let hero = await HeroModel.updateHeroInfo(roleId, hid, heroUpdate);
heroes.push(hero);
}
}
for(let [hid, { ce, inc }] of heroCe) {
if(changeHids.indexOf(hid) == -1) {
let hero = await HeroModel.updateHeroInfo(roleId, hid, { ce });
pushHeros.push({ hid, ce: hero.ce, incHeroCe: inc });
changeHids.push(hid);
}
}
let { topLineup, topLineupCe } = calCe.getTopLineup();
let roleCeUpdate = calCe.getRoleCeTable();
roleCe = await RoleCeModel.updateRoleCe(roleId, roleCeUpdate);
let role = await RoleModel.incRoleInfo(roleId, { ...roleIncUpdate, ce: roleInc }, { ...roleUpdate, topLineup, topLineupCe });
let guild = await GuildModel.updateCe(roleId, roleInc); // 公会更新战力
saveCeChangeLog(role, roleInc, role.ce, type, changeHids);
updateRank(roleId, serverId, topLineupCe, role, pushHeros, guild);
let uids = [{ uid: roleId, sid }]; let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(role.ce) , heros: pushHeros, topLineupCe: reduceCe(topLineupCe) }), uids); pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: role.ce, heros: pushHeros, topLineupCe }), uids);
if(guild) { if(guild) {
await updateUserInfo(REDIS_KEY.GUILD_INFO, guild.code, [{ field: 'guildCe', value: guild.guildCe }]); await updateUserInfo(REDIS_KEY.GUILD_INFO, guild.code, [{ field: 'guildCe', value: guild.guildCe }]);
} }
updateRank(roleId, serverId, topLineupCe, role, pushHeros); return { heroes, curRole: role }
return hero;
} }
// 修改全局战力并下发 async function treatHeroStar(calCe: CalCe, roleId: string, hid: number, star: number, starStage: number, quality: number, colorStar: number, colorStarStage: number, job: number, isUpStar: boolean) {
export async function calAllHeroCe(type:number, sid: string, roleId: string, update: RoleUpdate, args?:Array<number>, params?: any) { calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
let result = await reCalAllHeroCe(type, roleId, update, args, params); if(isUpStar) {
if(result.pushHeros.length > 0) { let school = await SchoolModel.findByHid(roleId, hid);
return await pushCalAllHeroCe(roleId, sid, result); if(school) calCe.setSchool(true, hid, school.schoolId, star, colorStar, quality);
} else {
return result;
} }
} }
// 修改全局战力的推送
export async function pushCalAllHeroCe(roleId: string, sid: string, calResult: calPlayerReturn) {
let {role, pushHeros, topLineupCe, guild, serverId } = calResult;
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(role.ce), heros: pushHeros, topLineupCe: reduceCe(topLineupCe) }), uids);
if(guild) {
await updateUserInfo(REDIS_KEY.GUILD_INFO, guild.code, [{ field: 'guildCe', value: guild.guildCe }]);
}
updateRank(roleId, serverId, topLineupCe, role, pushHeros);
return calResult;
}
// 更新排行榜数据 // 更新排行榜数据
async function updateRank(roleId: string, serverId: number, topLineupCe: number, role: RoleType, pushHeros: {hid: number, ce: number}[]) { async function updateRank(roleId: string, serverId: number, topLineupCe: number, role: RoleType, pushHeros: {hid: number, ce: number}[], guild?: GuildType) {
// 最强阵容 // 最强阵容
let r = new Rank(REDIS_KEY.TOP_LINEUP_RANK, { serverId }); let r = new Rank(REDIS_KEY.TOP_LINEUP_RANK, { serverId });
await r.setRankWithRoleInfo(roleId, reduceCe(topLineupCe), 0, role); await r.setRankWithRoleInfo(roleId, topLineupCe, 0, role);
// 最强武将 // 最强武将
for(let { hid, ce } of pushHeros) { for(let { hid, ce } of pushHeros) {
@@ -89,9 +369,39 @@ async function updateRank(roleId: string, serverId: number, topLineupCe: number,
// 总战力 // 总战力
let r3 = new Rank(REDIS_KEY.SUM_CE_RANK, { serverId }); let r3 = new Rank(REDIS_KEY.SUM_CE_RANK, { serverId });
await r3.setRankWithRoleInfo(roleId, reduceCe(role.ce), 0, role); await r3.setRankWithRoleInfo(roleId, role.ce, 0, role);
// 更新最强五人阵容信息 // 更新最强五人阵容信息
let r5 = new Rank(REDIS_KEY.TOP_LINEUP_INFO, { serverId }); let r5 = new Rank(REDIS_KEY.TOP_LINEUP_INFO, { serverId });
await r5.generParamAndSet(REDIS_KEY.TOP_LINEUP_INFO, { roleId }, { role }); await r5.generParamAndSet(REDIS_KEY.TOP_LINEUP_INFO, { roleId }, { role });
if(guild) {
await updateUserInfo(REDIS_KEY.GUILD_INFO, guild.code, [{ field: 'guildCe', value: guild.guildCe }]);
}
}
export async function getSumCe(roleId: string, num: number) {
let roleCe = await RoleCeModel.findByRoleId(roleId);
let calCe = new CalCe(roleId);
calCe.setRoleCe(roleCe);
let arr = calCe.getResultCeArr();
let ce = 0;
for(let i = 0; i < num; i++) {
if(arr[i]) {
ce += arr[i].ce;
}
}
return ce;
}
export async function getHeroesAttributes(roleId: string) {
let roleCe = await RoleCeModel.findByRoleId(roleId);
let attrByHid = new Map<number, AttributeCal>();
for(let { hid, attrs } of roleCe.attributes||[]) {
let cal = new AttributeCal();
cal.setLv(roleCe.roleLv);
cal.setByWarJson(attrs);
attrByHid.set(hid, cal);
}
return attrByHid;
} }
+10 -32
View File
@@ -1,7 +1,7 @@
import { PvpDefenseModel, PvpDefenseType, pvpUpdateInter } from '../db/PvpDefense'; import { PvpDefenseModel, PvpDefenseType, pvpUpdateInter } from '../db/PvpDefense';
import { Defense, Attack, LineupCe, OppPlayer, HeroScore, HeroReward, OppPlayerReturn, AttackHero, DefenseHero } from '../domain/battleField/pvp'; import { Defense, Attack, LineupCe, OppPlayer, HeroScore, HeroReward, OppPlayerReturn, AttackHero, DefenseHero } from '../domain/battleField/pvp';
import { RoleType, CeAttrDataRole } from '../db/Role'; import { RoleType } from '../db/Role';
import { PVP_HERO_POS, REDIS_KEY, PVP_CONST, COUNTER, TASK_TYPE, MAIL_TYPE, TA_EVENT } from '../consts'; import { PVP_HERO_POS, REDIS_KEY, PVP_CONST, COUNTER, TASK_TYPE, MAIL_TYPE, TA_EVENT } from '../consts';
import { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent"; import { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent";
import { getRandSingleIndex, genCode, shouldRefresh, getChineseName, makeRobotId, robotIdComBack, getRandSingleEelm } from '../pubUtils/util'; import { getRandSingleIndex, genCode, shouldRefresh, getChineseName, makeRobotId, robotIdComBack, getRandSingleEelm } from '../pubUtils/util';
@@ -11,7 +11,7 @@ import { PVP } from '../pubUtils/dicParam';
import { PVPConfigModel, PVPConfigType } from '../db/SystemConfig' import { PVPConfigModel, PVPConfigType } from '../db/SystemConfig'
import { nowSeconds, getTimeFun } from '../pubUtils/timeUtil'; import { nowSeconds, getTimeFun } from '../pubUtils/timeUtil';
import { HeroesRecord, PvpRecordPlayerInfo } from '../db/PvpRecord'; import { HeroesRecord, PvpRecordPlayerInfo } from '../db/PvpRecord';
import { HeroModel, CeAttrData, HeroType } from '../db/Hero'; import { HeroModel, HeroType } from '../db/Hero';
import { AttributeCal } from '../domain/roleField/attribute'; import { AttributeCal } from '../domain/roleField/attribute';
import { PvpEnemies, PvpHeroInfo, PvpOtherHeroes } from '../domain/dbGeneral'; import { PvpEnemies, PvpHeroInfo, PvpOtherHeroes } from '../domain/dbGeneral';
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson'; import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
@@ -27,6 +27,7 @@ import { sendMailByContent } from './mailService';
import { RoleRankInfo } from '../domain/rank'; import { RoleRankInfo } from '../domain/rank';
import { reportTAEvent } from './sdkService'; import { reportTAEvent } from './sdkService';
import { getVipPvpChallengeMaxCnt } from './activity/monthlyTicketService'; import { getVipPvpChallengeMaxCnt } from './activity/monthlyTicketService';
import { getHeroesAttributes } from './playerCeService';
/** /**
* 返回对手三人信息 * 返回对手三人信息
@@ -61,7 +62,6 @@ export async function getEnemies(oppPlayers: OppPlayer[], winStreakNum: number)
* @param pLv 我的排名 * @param pLv 我的排名
*/ */
export async function refreshEnemies(role: RoleType, seasonNum: number, sumScore: number, score: number, pLv: number) { export async function refreshEnemies(role: RoleType, seasonNum: number, sumScore: number, score: number, pLv: number) {
console.log('#####',seasonNum, sumScore, score, pLv)
let { roleId } = role; let { roleId } = role;
let chosenOpps: string[] = []; let chosenOpps: string[] = [];
let pvpHistoryOppParam: PvpOppCreateParam[] = []; let pvpHistoryOppParam: PvpOppCreateParam[] = [];
@@ -204,6 +204,7 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos
let heroes = new Array<PvpEnemies>(); let heroes = new Array<PvpEnemies>();
let otherHeroes = new Array<PvpOtherHeroes>(); // 阵容外的所有武将信息 let otherHeroes = new Array<PvpOtherHeroes>(); // 阵容外的所有武将信息
let defCe = 0; let defCe = 0;
let attrByHid = await getHeroesAttributes(role.roleId);
for (let dbHero of dbHeroes) { for (let dbHero of dbHeroes) {
let h = defenseHeroes.find(cur => cur.actorId == dbHero.hid); // 阵容里是否有这个武将 let h = defenseHeroes.find(cur => cur.actorId == dbHero.hid); // 阵容里是否有这个武将
let hs = heroScores.find(cur => cur.hid == dbHero.hid); // 这个武将是否有这个得分 let hs = heroScores.find(cur => cur.hid == dbHero.hid); // 这个武将是否有这个得分
@@ -214,7 +215,10 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos
let heroInfo = new PvpHeroInfo(); let heroInfo = new PvpHeroInfo();
heroInfo.setHeroInfo(dbHero); heroInfo.setHeroInfo(dbHero);
// heroInfo.setOutIndex(h.order); // heroInfo.setOutIndex(h.order);
let { attribute, ce } = getPlayerAttribute(dbHero.lv, dbHero.attr, role.attr); let attr = attrByHid.get(h.actorId);
if(!attr) continue;
let attribute = attr.getAttributesToString();
let ce = attr.calCe();
heroInfo.setAttribute(attribute); heroInfo.setAttribute(attribute);
let enemy = new PvpEnemies(warJson, heroInfo, hs ? hs.score : 0, ce); let enemy = new PvpEnemies(warJson, heroInfo, hs ? hs.score : 0, ce);
enemy.setOutIndex(h.order); enemy.setOutIndex(h.order);
@@ -373,37 +377,11 @@ export function getRobotAttribute(hid: number, posRatio: number, score: number)
let newAttribute = new AttributeCal(); let newAttribute = new AttributeCal();
newAttribute.setLv(difficultRatio.enemyLv); newAttribute.setLv(difficultRatio.enemyLv);
newAttribute.setByMap(dicHero.baseAbilityArr, difficultRatio.value / 10000 * posRatio); newAttribute.setByMap(dicHero.baseAbilityArr, difficultRatio.value / 10000 * posRatio);
let attrArr = newAttribute.getReduceAttributesToString(); let attrArr = newAttribute.getAttributesToString();
let newCe = newAttribute.calCelAndReduce(); let newCe = newAttribute.calCe();
return { attribute: attrArr, ce: newCe, lv: difficultRatio.enemyLv }; return { attribute: attrArr, ce: newCe, lv: difficultRatio.enemyLv };
} }
/**
* @description 根据玩家数据获取到他的属性
* @param ceAttr hero表的ceAttr
* @param globalCeAttr role表中的globalCeAttr
*/
export function getPlayerAttribute(lv: number, heroAttrs: CeAttrData[] = [], roleAttrs: CeAttrDataRole[] = []) {
let newAttribute = new AttributeCal();
newAttribute.setLv(lv);
newAttribute.setByDbData(roleAttrs, heroAttrs);
let attribute = newAttribute.getReduceAttributesToString();
let ce = newAttribute.calCelAndReduce();
return { attribute, ce };
}
/**
* @description 根据玩家数据获取到他的主属性
* @param ceAttr
* @param globalCeAttr
*/
export function getPlayerMainAttribute(heroAttrs: CeAttrData[], roleAttrs: CeAttrDataRole[]) {
let newAttribute = new AttributeCal();
newAttribute.setByDbData(roleAttrs, heroAttrs);
let mainAttributes = newAttribute.getReduceMainAttributes();
return mainAttributes;
}
// 获取我方战报记录 // 获取我方战报记录
export async function generMyRecInfo(pvpDefense: PvpDefenseType, role: RoleType, isSuccess: boolean, pos: number, myHeroes: pvpEndParamInter[]) { export async function generMyRecInfo(pvpDefense: PvpDefenseType, role: RoleType, isSuccess: boolean, pos: number, myHeroes: pvpEndParamInter[]) {
let { attack, defense, heroScores, winStreakNum, hisWinStreakNum = 0, score, hisScore } = pvpDefense; let { attack, defense, heroScores, winStreakNum, hisWinStreakNum = 0, score, hisScore } = pvpDefense;
+17 -17
View File
@@ -243,13 +243,13 @@ export class Rank {
if (!role) { if (!role) {
role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.RANK, true); role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.RANK, true);
} }
let param = new RankParam(role, true); let param = new RankParam(role);
await this.setUserInfo(infoKey, { roleId }, param); await this.setUserInfo(infoKey, { roleId }, param);
} else if (infoKey == REDIS_KEY.GUILD_INFO) { } else if (infoKey == REDIS_KEY.GUILD_INFO) {
if (!guild) { if (!guild) {
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK) guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK)
} }
let param = new GuildRankParam(guild, true); let param = new GuildRankParam(guild);
await this.setUserInfo(infoKey, { guildCode }, param); await this.setUserInfo(infoKey, { guildCode }, param);
} else if (infoKey == REDIS_KEY.TOP_LINEUP_INFO) { } else if (infoKey == REDIS_KEY.TOP_LINEUP_INFO) {
if (!role) { if (!role) {
@@ -436,13 +436,13 @@ export class Rank {
if (!role) { if (!role) {
role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.RANK, true); role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.RANK, true);
} }
param = new RoleRankInfo(role, true); param = new RoleRankInfo(role);
param.setInfo(0, { roleId }, score, time); param.setInfo(0, { roleId }, score, time);
} else { } else {
const info = await redisClient().hgetAsync(this.infoKey, roleId); const info = await redisClient().hgetAsync(this.infoKey, roleId);
const userInfo = JSON.parse(info); const userInfo = JSON.parse(info);
param = new RoleRankInfo(userInfo, false); param = new RoleRankInfo(userInfo);
param.setInfo(0, { roleId }, score, time); param.setInfo(0, { roleId }, score, time);
} }
@@ -462,12 +462,12 @@ export class Rank {
if (!guild) { if (!guild) {
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK); guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK);
} }
param = new GuildRankInfo(guild, true); param = new GuildRankInfo(guild);
param.setInfo(0, { guildCode }, score, time); param.setInfo(0, { guildCode }, score, time);
} else { } else {
const info = await redisClient().hgetAsync(this.infoKey, guildCode); const info = await redisClient().hgetAsync(this.infoKey, guildCode);
const guildInfo = JSON.parse(info); const guildInfo = JSON.parse(info);
param = new GuildRankInfo(guildInfo, false); param = new GuildRankInfo(guildInfo);
param.setInfo(0, { guildCode }, score, time); param.setInfo(0, { guildCode }, score, time);
} }
@@ -487,12 +487,12 @@ export class Rank {
if (!guild) { if (!guild) {
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK); guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK);
} }
param = new GuildRankInfo(guild, true); param = new GuildRankInfo(guild);
param.setInfo2(0, { guildCode }, score, time, active); param.setInfo2(0, { guildCode }, score, time, active);
} else { } else {
const info = await redisClient().hgetAsync(this.infoKey, guildCode); const info = await redisClient().hgetAsync(this.infoKey, guildCode);
const guildInfo = JSON.parse(info); const guildInfo = JSON.parse(info);
param = new GuildRankInfo(guildInfo, false); param = new GuildRankInfo(guildInfo);
param.setInfo2(0, { guildCode }, score, time, active); param.setInfo2(0, { guildCode }, score, time, active);
} }
@@ -512,13 +512,13 @@ export class Rank {
if (!role) { if (!role) {
role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.RANK, true); role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.RANK, true);
} }
param = new RoleRankInfo(role, true); param = new RoleRankInfo(role);
param.setInfo(0, { roleId, hid }, score, time); param.setInfo(0, { roleId, hid }, score, time);
} else { } else {
const info = await redisClient().hgetAsync(this.infoKey, roleId); const info = await redisClient().hgetAsync(this.infoKey, roleId);
const userInfo = JSON.parse(info); const userInfo = JSON.parse(info);
param = new RoleRankInfo(userInfo, false); param = new RoleRankInfo(userInfo);
param.setInfo(0, { roleId, hid }, score, time); param.setInfo(0, { roleId, hid }, score, time);
} }
@@ -710,14 +710,14 @@ export class Rank {
if (nowSeconds() - userInfo.updatedAt > 2 * 30 * 24 * 60 * 60) { if (nowSeconds() - userInfo.updatedAt > 2 * 30 * 24 * 60 * 60) {
continue; continue;
} }
param = new RoleRankInfo(userInfo, false); param = new RoleRankInfo(userInfo);
param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]); param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]);
} else if (this.infoKey == REDIS_KEY.GUILD_INFO) { } else if (this.infoKey == REDIS_KEY.GUILD_INFO) {
if(this.key == REDIS_KEY.GUILD_LV_RANK) { if(this.key == REDIS_KEY.GUILD_LV_RANK) {
param = new GuildRankInfo(userInfo, false); param = new GuildRankInfo(userInfo);
param.setInfo2(Math.floor(ii / 2) + 1, myId, scores[0], scores[1], scores[2]); param.setInfo2(Math.floor(ii / 2) + 1, myId, scores[0], scores[1], scores[2]);
} else { } else {
param = new GuildRankInfo(userInfo, false); param = new GuildRankInfo(userInfo);
param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]); param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]);
} }
} }
@@ -759,14 +759,14 @@ export class Rank {
if (nowSeconds() - userInfo.updatedAt > 2 * 30 * 24 * 60 * 60) { if (nowSeconds() - userInfo.updatedAt > 2 * 30 * 24 * 60 * 60) {
continue; continue;
} }
param = new RoleRankInfo(userInfo, false); param = new RoleRankInfo(userInfo);
param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]); param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]);
} else if (this.infoKey == REDIS_KEY.GUILD_INFO) { } else if (this.infoKey == REDIS_KEY.GUILD_INFO) {
if(this.key == REDIS_KEY.GUILD_LV_RANK) { if(this.key == REDIS_KEY.GUILD_LV_RANK) {
param = new GuildRankInfo(userInfo, false); param = new GuildRankInfo(userInfo);
param.setInfo2(Math.floor(ii / 2) + 1, myId, scores[0], scores[1], scores[2]); param.setInfo2(Math.floor(ii / 2) + 1, myId, scores[0], scores[1], scores[2]);
} else { } else {
param = new GuildRankInfo(userInfo, false); param = new GuildRankInfo(userInfo);
param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]); param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]);
} }
} }
@@ -1083,7 +1083,7 @@ export async function getGeneralRank(role: RoleType & { rankReceived: number[] }
let r = new Rank(redisKey, { serverId }, false, 1); let r = new Rank(redisKey, { serverId }, false, 1);
let ranks = await r.getRankByRange(); let ranks = await r.getRankByRange();
// if (ranks.length > 0) { // if (ranks.length > 0) {
let param = new GeneralRankParam(id, ranks[0] || new RoleRankInfo({}, false), general, received); let param = new GeneralRankParam(id, ranks[0] || new RoleRankInfo({}), general, received);
result.push({...param, general}); result.push({...param, general});
} }
} }
File diff suppressed because it is too large Load Diff
+55 -231
View File
@@ -1,218 +1,17 @@
import { FIGURE_UNLOCK_CONDITION, ITEM_CHANGE_REASON, REDIS_KEY, STATUS, TASK_TYPE, HERO_SYSTEM_TYPE } from "../../consts"; import { FIGURE_UNLOCK_CONDITION, ITEM_CHANGE_REASON, REDIS_KEY, STATUS, TASK_TYPE, HERO_SYSTEM_TYPE, LINEUP_NUM, COUNTER } from "../../consts";
import { SkinModel } from "../../db/Skin"; import { SkinModel } from "../../db/Skin";
import { HeroModel, HeroSkin, HeroType, HeroUpdate } from "../../db/Hero"; import { HeroModel, HeroSkin, HeroType, HeroUpdate } from "../../db/Hero";
import { RoleModel, RoleType, RoleUpdate } from "../../db/Role";
import { SkinUpdate } from "../../db/Skin"; import { SkinUpdate } from "../../db/Skin";
import { Figure, TopHero } from "../../domain/dbGeneral";
import { TaskListReturn } from "../../domain/roleField/task";
import { GuildModel, GuildType } from "../../db/Guild";
import { PvpDefenseModel } from "../../db/PvpDefense";
import { pick } from "underscore";
import { calculatetopLineup } from "../../pubUtils/playerCe";
import { nowSeconds } from "../../pubUtils/timeUtil"; import { nowSeconds } from "../../pubUtils/timeUtil";
import { saveCeChangeLog } from "../../pubUtils/logUtil"; import { resResult } from "../../pubUtils/util";
import { getRandSingleEelm, reduceCe, resResult } from "../../pubUtils/util"; import { CreateHeroParam, HeroShowParam } from "../../domain/roleField/hero";
import { AttributeCal } from "../../domain/roleField/attribute";
import { CreateHeroParam, HeroParam, HeroShowParam } from "../../domain/roleField/hero";
import { pinus } from "pinus"; import { pinus } from "pinus";
import { Rank } from "../rankService";
import { checkTaskInCreateHero } from "../task/taskService";
import { ItemInter, RewardInter } from "../../pubUtils/interface"; import { ItemInter, RewardInter } from "../../pubUtils/interface";
import { transPiece } from "./util"; import { transPiece } from "./util";
import { getInitHeroById } from "../roleService"; import { addItems, unlockFigure, } from "./rewardService";
import { addItems, combineFigureInfo, unlockFigureWithoutSave } from "./rewardService"; import { CounterModel } from "../../db/Counter";
import { calculateCes } from "../playerCeService";
export class UpdateHeroes { import { RoleUpdate } from "../../db/Role";
roleId: string;
roleName: string;
serverId: number;
incHeroNum: number = 0;
incRoleCe: number = 0;
pushHeroes: {hid: number, incHeroCe: number, ce: number, hero: HeroUpdate}[] = [];
roleUpdate: RoleUpdate;
role: RoleType;
guild: GuildType;
constructor(roleId: string, roleName: string, serverId: number) {
this.roleId = roleId;
this.roleName = roleName;
this.serverId = serverId;
}
public setRole(role: RoleType) {
this.role = role;
}
public async getRole() {
if(!this.role) {
this.role = await RoleModel.findByRoleId(this.roleId);
}
return this.role;
}
public addRoleUpdateParam(param: RoleUpdate) {
this.roleUpdate = {...this.roleUpdate, ...param};
}
public async updateDbCe(isCreate: boolean, heroInfo: HeroUpdate, originCe = 0) {
let role = await this.getRole();
if(isCreate) this.incHeroNum ++;
if(heroInfo != originCe) this.incRoleCe += heroInfo.ce - originCe;
this.addRoleUpdateParam(await calculatetopLineup(role, heroInfo.hid, heroInfo.ce, heroInfo._id ));
this.pushHeroes.push({ hid: heroInfo.hid, incHeroCe: heroInfo.ce - originCe, ce: heroInfo.ce, hero: heroInfo });
}
// 更新战力相关的各个表
public async saveCeToDb() {
let role = await this.getRole();
// 更新role表
this.role = await RoleModel.updateRoleInfo(this.roleId, {
heroNum: this.incHeroNum + role.heroNum, ce: this.incRoleCe + role.ce, heroNumUpdatedAt: nowSeconds(), ...this.roleUpdate
});
// 更新guild表
if(role.hasGuild) {
this.guild = await GuildModel.updateCe(this.roleId, this.incRoleCe, true); // 公会更新战力
}
for(let { hid, incHeroCe } of this.pushHeroes) {
await PvpDefenseModel.updateCe(this.roleId, hid, incHeroCe); // 更新pvp防守阵战力
}
saveCeChangeLog(this.role, this.incRoleCe, this.role.ce, HERO_SYSTEM_TYPE.INIT, this.pushHeroes.map(cur => cur.hid));
}
public async updateRedisRank() {
let role = await this.getRole();
let { serverId, roleId, pushHeroes } = this;
// 更新军团信息
if(this.guild) {
let r = new Rank(REDIS_KEY.GUILD_INFO, { guildCode: this.guild.code });
await r.generParamAndSet(REDIS_KEY.GUILD_INFO, { guildCode: this.guild.code }, { guild: this.guild });
}
// 武将数量
if(this.incHeroNum > 0) {
let r = new Rank(REDIS_KEY.HERO_NUM_RANK, { serverId });
await r.setRankWithRoleInfo(roleId, role.heroNum, role.heroNumUpdatedAt, role);
}
// 最强阵容
let r = new Rank(REDIS_KEY.TOP_LINEUP_RANK, { serverId });
await r.setRankWithRoleInfo(roleId, reduceCe(role.topLineupCe), 0, role);
// 最强武将
for(let { hid, ce, hero } of pushHeroes) {
let r2 = new Rank(REDIS_KEY.TOP_HERO_RANK, { serverId });
await r2.setRankWithHeroInfo(roleId, hid, reduceCe(ce), 0, hero);
let r4 = new Rank(REDIS_KEY.HERO_RANK, { serverId, hid });
await r4.setRankWithHeroInfo(roleId, hid, reduceCe(ce), 0, hero);
}
// 总战力
let r3 = new Rank(REDIS_KEY.SUM_CE_RANK, { serverId });
await r3.setRankWithRoleInfo(roleId, reduceCe(role.ce), 0, role);
// 更新最强五人阵容信息
let r5 = new Rank(REDIS_KEY.TOP_LINEUP_INFO, { serverId });
await r5.generParamAndSet(REDIS_KEY.TOP_LINEUP_INFO, { roleId }, { role });
}
public async pushMessage(pinus: any, sid: string) {
let role = await this.getRole();
let uids = [{ uid: this.roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(role.ce) , heros: this.pushHeroes.map(cur => { return {...cur, ce: reduceCe(cur.ce), incHeroCe: reduceCe(cur.incHeroCe) }}), topLineupCe: reduceCe(role.topLineupCe) }), uids);
}
}
export class CreateHeroes extends UpdateHeroes {
private resultHeroes: HeroType[] = [];
private heroNum = 0;
// 推送信息
private figureInfos: { heads: Figure[], frames: Figure[], spines: Figure[] }[] = [];
private skinPushMessages: { heros: {skins: HeroSkin[], hid: number}[], skins: {id: number, hid: number, inc: number, reason: number }[]} = { heros: [], skins: [] };
private async getSkinsOfThisHero(hid: number, initSkinInfo: SkinUpdate, isInit: boolean) {
let allSkins = isInit? []: await SkinModel.findbyRoleAndHid(this.roleId, hid);
let skin = await SkinModel.insertSkins(this.roleId, this.roleName, [initSkinInfo]);
let skinInfos = skin.map(cur => ({ id: cur.id, hid, inc: 1, reason: ITEM_CHANGE_REASON.GET_HERO_UNLOCK_SKIN}))
this.skinPushMessages.skins.push(...skinInfos);
if(skin) allSkins.push(...skin);
let skins: HeroSkin[] = [];
for(let skin of allSkins) {
skins.push(new HeroSkin(skin.id, skin.skinId, skin._id, skin.id == initSkinInfo.id));
}
return skins
}
// game-server里面创建武将
public async createWithHeroInfo(infos: Map<number, { heroInfo: HeroUpdate, skinInfo: SkinUpdate }>) {
let role = await this.getRole();
// 数据处理
let conditions = new Array<{ type: number, paramHid?: number, paramFavourLv?: number, paramSkinId?: number }>(); // 解锁头像条件
let initHeroInfos: HeroUpdate[] = [];
for (let [ hid, { heroInfo, skinInfo }] of infos) {
conditions.push({ type: FIGURE_UNLOCK_CONDITION.GET_HERO, paramHid: heroInfo.hid });
this.updateDbCe(true, heroInfo);
// 皮肤使用初始加载进内存的数据
let skins = await this.getSkinsOfThisHero(hid, { ...skinInfo, _id: new SkinModel()._id }, false);
let newAttr = new AttributeCal();
newAttr.setLv(heroInfo.lv);
newAttr.setByDbData(role.attr, heroInfo.attr);
let heroCe = newAttr.calCe(); // 计算最终战力
initHeroInfos.push({ ...heroInfo, skins, _id: new HeroModel()._id, ce: heroCe });
this.heroNum ++;
}
// 武将使用初始加载数据插入
this.resultHeroes = await HeroModel.insertHeroes(this.roleId, this.roleName, this.serverId, initHeroInfos);
let heroSkins = this.resultHeroes.map(cur => { return pick(cur, ['hid', 'skins']) });
this.skinPushMessages.heros.push(...heroSkins);
// 头像解锁
let { figureInfo, frames, heads, spines } = unlockFigureWithoutSave(conditions, role);
this.figureInfos.push(figureInfo);
this.addRoleUpdateParam({ frames, heads, spines });
// 更新战力
await this.saveCeToDb();
}
// 创建初始账号时候的初始
public async createWithInitInfo(infos: Map<number, { heroInfo: HeroUpdate, skinInfo: SkinUpdate }>, figureInfo: { heads: Figure[], frames: Figure[], spines: Figure[] }) {
this.figureInfos.push(figureInfo);
let heroeInfos: HeroUpdate[] = [];
for (let [ hid, { heroInfo, skinInfo }] of infos) {
this.updateDbCe(true, heroInfo);
let model = new SkinModel();
let skins = await this.getSkinsOfThisHero(hid, { ...skinInfo, _id: model._id }, true);
heroeInfos.push({ ...heroInfo, skins, _id: new HeroModel()._id});
this.heroNum ++;
}
this.resultHeroes = await HeroModel.insertHeroes(this.roleId, this.roleName, this.serverId, heroeInfos);
}
public async pushMessage(sid: string) {
let role = await this.getRole();
let uids = [{ uid: this.roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(role.ce) , heros: this.pushHeroes.map(cur => { return {...cur, ce: reduceCe(cur.ce), incHeroCe: reduceCe(cur.incHeroCe) }}), topLineupCe: reduceCe(role.topLineupCe) }), uids);
let figureInfo = combineFigureInfo(this.figureInfos);
if (!!figureInfo && (figureInfo.heads.length > 0 || figureInfo.frames.length > 0 || figureInfo.spines.length > 0)) {
pinus.app.get('channelService').pushMessageByUids('onHeadChange', resResult(STATUS.SUCCESS, { ...figureInfo }), uids);
}
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, this.skinPushMessages), uids);
pinus.app.get('channelService').pushMessageByUids('onHeroUpdate', resResult(STATUS.SUCCESS, { heroes: this.getResultHeroes() }), uids);
checkTaskInCreateHero(this.serverId, this.roleId, sid, this.heroNum, this.resultHeroes)
}
public getResultHeroes() {
return this.resultHeroes;
}
public getShowHeroes() {
return this.resultHeroes.map(cur => {
let hero = new HeroShowParam(cur);
return { ...hero, ce: reduceCe(cur.ce)}
});
}
}
/** /**
* 创建多个武将 * 创建多个武将
@@ -221,29 +20,18 @@ export class CreateHeroes extends UpdateHeroes {
* @param serverId * @param serverId
* @param heroInfo * @param heroInfo
*/ */
export async function createHeroes(roleId: string, roleName: string, sid: string, serverId: number, heroInfo: CreateHeroParam[]) { export async function createHeroes(roleId: string, roleName: string, sid: string, serverId: number, heroInfo: CreateHeroParam[], initRoleInfos?: RoleUpdate) {
let hids = heroInfo.map(cur => cur.hid); let hids = heroInfo.map(cur => cur.hid);
let userHeroesMap = await HeroModel.findMapByHidRange(hids, roleId); let userHeroesMap = await HeroModel.findMapByHidRange(hids, roleId);
let infos: Map<number, { heroInfo: HeroUpdate, skinInfo: SkinUpdate }> = new Map(), pieces: ItemInter[] = []; let createHids: number[] = [], pieces: ItemInter[] = [];
for (let h of heroInfo) { for (let h of heroInfo) {
let heroCount = h.count || 1; let heroCount = h.count || 1;
if (userHeroesMap.has(h.hid)) { if (userHeroesMap.has(h.hid)) {
let { pieceId, count } = transPiece(h.hid); let { pieceId, count } = transPiece(h.hid);
pieces.push({ id: pieceId, count: count * heroCount }); pieces.push({ id: pieceId, count: count * heroCount });
} else { } else {
let initInfo: { heroInfo: HeroUpdate, skinInfo: SkinUpdate }; createHids.push(h.hid);
if(pinus.app.getServerType() == 'role') {
initInfo = getInitHeroById(h.hid);
} else {
let roleServers = pinus.app.getServersByType('role');
let server = getRandSingleEelm(roleServers);
initInfo = await pinus.app.rpc.role.roleRemote.getInitHeroById.toServer(server.id, h.hid);
}
initInfo.heroInfo = { ...initInfo.heroInfo, ...h };
infos.set(h.hid, initInfo);
userHeroesMap.set(h.hid, null); userHeroesMap.set(h.hid, null);
if (heroCount > 1) { if (heroCount > 1) {
let { pieceId, count } = transPiece(h.hid); let { pieceId, count } = transPiece(h.hid);
@@ -252,24 +40,60 @@ export class CreateHeroes extends UpdateHeroes {
} }
} }
let resultHeroes: HeroType[] = [], resultItems: RewardInter[] = [], heroes: HeroShowParam[] = []; let resultHeroes: HeroType[] = [], resultItems: RewardInter[] = [], showHeroes: HeroShowParam[] = [];
if (infos.size > 0) { let figureConditions: { type: FIGURE_UNLOCK_CONDITION, paramHid: number }[] = [];
let createHero = new CreateHeroes(roleId, roleName, serverId); let incHeroNum = 0;
await createHero.createWithHeroInfo(infos); let skins: SkinUpdate[] = [];
await createHero.pushMessage(sid); if (createHids.length > 0) {
await createHero.updateRedisRank(); let heroInfos = new Map<number, HeroUpdate>();
heroes = createHero.getShowHeroes(); for(let hid of createHids) {
resultHeroes = createHero.getResultHeroes(); let initSkin = SkinModel.getInitInfo(hid);
skins.push(initSkin); // 初始皮肤
let seqId = await CounterModel.getNewCounter(COUNTER.HID) || -1;
let initHero = HeroModel.getInitInfo(hid, { seqId, roleId, roleName, skins: [new HeroSkin(initSkin)] });
heroInfos.set(hid, initHero);
figureConditions.push({ type: FIGURE_UNLOCK_CONDITION.GET_HERO, paramHid: hid });
incHeroNum ++;
}
await unlockFigure(sid, roleId, figureConditions);
let roleUpdata: RoleUpdate = { heroNumUpdatedAt: nowSeconds() };
if(initRoleInfos) {
roleUpdata = { ...initRoleInfos, ...roleUpdata }
}
let { heroes } = await calculateCes(HERO_SYSTEM_TYPE.INIT, roleId, serverId, sid, heroInfos, roleUpdata, { heroNum: incHeroNum }, { isInitRole: !!initRoleInfos });
for(let hero of heroes) {
showHeroes.push(new HeroShowParam(hero));
resultHeroes.push(hero);
}
let uids = [{ uid: roleId, sid }];
await SkinModel.insertSkins(roleId, roleName, skins);
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, getSkinPushMsg(resultHeroes, skins)), uids);
pinus.app.get('channelService').pushMessageByUids('onHeroUpdate', resResult(STATUS.SUCCESS, { heroes }), uids);
} }
if (pieces.length > 0) { if (pieces.length > 0) {
let goods = await addItems(roleId, roleName, sid, pieces, ITEM_CHANGE_REASON.HERO_TRANSFER_PIECE); let goods = await addItems(roleId, roleName, sid, pieces, ITEM_CHANGE_REASON.HERO_TRANSFER_PIECE);
resultItems = goods; resultItems = goods;
} }
return { heroes, resultHeroes, goods: resultItems } return { heroes: showHeroes, resultHeroes, goods: resultItems }
} }
export async function createHero(roleId: string, roleName: string, sid: string, serverId: number, heroInfo: CreateHeroParam) { export async function createHero(roleId: string, roleName: string, sid: string, serverId: number, heroInfo: CreateHeroParam) {
let result = await createHeroes(roleId, roleName, sid, serverId, [heroInfo]); let result = await createHeroes(roleId, roleName, sid, serverId, [heroInfo]);
return result; return result;
}
function getSkinPushMsg(resultHeroes: HeroType[], skins: SkinUpdate[]) {
let skinPushMessages: {heros: {skins: HeroSkin[], hid: number}[], skins: {id: number, hid: number, inc: number, reason: number }[]} = { heros: [], skins:[] }; // 皮肤推送信息
for(let { hid, skins } of resultHeroes) {
skinPushMessages.heros.push({ hid, skins });
}
for(let { id, hid } of skins) {
skinPushMessages.skins.push({ id, hid, inc: 1, reason: ITEM_CHANGE_REASON.GET_HERO_UNLOCK_SKIN })
}
return skinPushMessages;
} }
@@ -1,61 +0,0 @@
import { DEFAULT_HEROES, DEFAULT_HERO_LV, FIGURE_UNLOCK_CONDITION, HERO_SYSTEM_TYPE, LINEUP_NUM } from "../../consts";
import { HeroModel, HeroSkin, HeroUpdate } from "../../db/Hero";
import { RoleModel, RoleUpdate } from "../../db/Role";
import { SkinModel, SkinUpdate } from "../../db/Skin";
import { TopHero } from "../../domain/dbGeneral";
import { CalHeroCe, CalRoleCe } from "../../domain/roleField/calCe";
import { gameData, getHeroExpByLv } from "../../pubUtils/data";
import { unlockFigureWithoutSave } from "./rewardService";
// 储存在内存中的初始数据
export function getInitRoleInfo() {
let topLineup: TopHero[] = [], topLineupCe = 0, allCe = 0,
heroes: HeroUpdate[] = [], initHeroes: HeroUpdate[] = [], initSkins: SkinUpdate[] = [], heroNum = 0,
conditions: {type: FIGURE_UNLOCK_CONDITION, paramHid: number }[] = [];
let role = new RoleModel();
let calRoleCe = new CalRoleCe(role);
let roleAttr = calRoleCe.cal(HERO_SYSTEM_TYPE.INIT);
for(let { actorId: hid } of gameData.recruit) {
let { quality, initialStars: star, jobid: job, name: hName, initialSkin } = gameData.hero.get(hid);
// 皮肤
let skin = new SkinModel();
let dicFashion = gameData.fashion.get(initialSkin);
if(!dicFashion) {
console.log(`not found skin: ${initialSkin} of ${hid}`);
continue;
}
let skinInfo = { ...skin.toJSON(), id: initialSkin, hid, skinName: dicFashion.name, skinId: dicFashion.heroId };
initSkins.push(skinInfo);
// 武将
let hero = new HeroModel();
let heroInfo = {...hero.toJSON(), hid, star, quality, hName, job, skins: [new HeroSkin(initialSkin, skinInfo.skinId, skinInfo._id, true)], skinId: skinInfo.skinId, lv: DEFAULT_HERO_LV, exp: getHeroExpByLv(DEFAULT_HERO_LV - 1) || 0 };
let calHeroCe = new CalHeroCe(hid, heroInfo);
let heroAttr = calHeroCe.cal(HERO_SYSTEM_TYPE.INIT);
let ce = calHeroCe.getCalculatedCe(roleAttr);
heroes.push({ ...heroInfo, attr: heroAttr, ce, historyCe: ce });
// 更新role表
if(DEFAULT_HEROES.includes(hid)) {
// 头像
conditions.push({ type: FIGURE_UNLOCK_CONDITION.GET_HERO, paramHid: hid });
allCe += ce;
heroNum++;
initHeroes.push({ ...heroInfo, attr: heroAttr, ce, historyCe: ce });
}
}
let { figureInfo, heads, frames, spines } = unlockFigureWithoutSave(conditions, role);
// 最强阵容
initHeroes.sort((a, b) => { return b.ce - a.ce });
for(let i = 0; i < LINEUP_NUM; i++) {
if(initHeroes[i]) {
let { hid, ce, _id } = initHeroes[i];
topLineup.push({ hid, ce, hero: _id });
topLineupCe += ce;
}
}
let initRole: RoleUpdate = { topLineupCe, topLineup, attr: roleAttr, ce: allCe, heroNum, heroNumUpdatedAt: Date.now(), heads, frames, spines };
return {
role: initRole, heroes, skins: initSkins, figureInfo
}
}
@@ -2,7 +2,6 @@ import { ITID, CONSUME_TYPE, ITEM_TABLE, CURRENCY, CURRENCY_TYPE, MAIL_TYPE, HAN
import { getDecimalCnt, getRandEelm, getRandEelmWithWeight, getRandSingleEelm, getRandValueByMinMax, resResult } from '../../pubUtils/util'; import { getDecimalCnt, getRandEelm, getRandEelmWithWeight, getRandSingleEelm, getRandValueByMinMax, resResult } from '../../pubUtils/util';
import { RoleModel, RoleType } from '../../db/Role'; import { RoleModel, RoleType } from '../../db/Role';
import { setAp } from '../actionPointService'; import { setAp } from '../actionPointService';
import { pushCalAllHeroCe, calPlayerCeAndSave, calAllHeroCe } from '../playerCeService';
import { ItemModel, ItemType } from '../../db/Item'; import { ItemModel, ItemType } from '../../db/Item';
import { STATUS } from '../../consts/statusCode'; import { STATUS } from '../../consts/statusCode';
import { pinus } from 'pinus'; import { pinus } from 'pinus';
@@ -23,10 +22,9 @@ import { reportTAEvent, reportTAUserSet } from '../sdkService';
import { saveCoinChangeLog, saveFigureInfoLog, saveGoldChangeLog, saveItemChangeLog } from '../../pubUtils/logUtil'; import { saveCoinChangeLog, saveFigureInfoLog, saveGoldChangeLog, saveItemChangeLog } from '../../pubUtils/logUtil';
import { JewelModel, JewelType, jewelUpdate, RandSe } from '../../db/Jewel'; import { JewelModel, JewelType, jewelUpdate, RandSe } from '../../db/Jewel';
import { updateEplaces } from '../equipService'; import { updateEplaces } from '../equipService';
import { checkPopUpConditionInCreateHero } from '../activity/popUpShopService';
import { CreateHeroes } from './createHero';
import { combineItems, getCoinEventProperties, getGoldEventProperties, sortItems } from './util'; import { combineItems, getCoinEventProperties, getGoldEventProperties, sortItems } from './util';
import { nowSeconds } from '../../pubUtils/timeUtil'; import { nowSeconds } from '../../pubUtils/timeUtil';
import { calculateCeWithHero, calculateCeWithRole } from '../playerCeService';
@@ -71,7 +69,7 @@ export async function handleCost(roleId: string, sid: string, goods: Array<ItemI
heroMap.get(jewel.hid).jewels.push(jewel); heroMap.get(jewel.hid).jewels.push(jewel);
} }
} }
for(let [_hid, {hero, jewels} ] of heroMap) { for(let [hid, {hero, jewels} ] of heroMap) {
// 脱下天晶石 // 脱下天晶石
let update = new Map<number, Partial<EPlace>>(); let update = new Map<number, Partial<EPlace>>();
for(let jewel of jewels) { for(let jewel of jewels) {
@@ -82,7 +80,7 @@ export async function handleCost(roleId: string, sid: string, goods: Array<ItemI
} }
} }
let { newEplace } = updateEplaces(hero.ePlace, update); let { newEplace } = updateEplaces(hero.ePlace, update);
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, sid, roleId, hero, { ePlace: newEplace }, [...update.keys()]); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, roleId, role.serverId, sid, hid, { ePlace: newEplace }, { ePlaceIds: [...update.keys()] });
} }
@@ -216,8 +214,6 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
pushHeroSkinMsg(heroskins, skinInfos, uids); // 推送onHeroSkinChange pushHeroSkinMsg(heroskins, skinInfos, uids); // 推送onHeroSkinChange
saveItemChangeLog(roleId, skinInfos, reason); saveItemChangeLog(roleId, skinInfos, reason);
} }
// 推送全局加成信息
if(calAllHeroResult) await pushCalAllHeroCe(roleId, sid, calAllHeroResult);
} }
// 5. 获得头像和相框等 // 5. 获得头像和相框等
@@ -362,12 +358,12 @@ export async function addSkin(roleId: string, roleName: string, sid: string, ski
if(skin.hid && !hero) hero = await HeroModel.findByHidAndRole(skin.hid, roleId); if(skin.hid && !hero) hero = await HeroModel.findByHidAndRole(skin.hid, roleId);
let condition = { type: FIGURE_UNLOCK_CONDITION.GET_SKIN, paramSkinId: skinId }; let condition = { type: FIGURE_UNLOCK_CONDITION.GET_SKIN, paramSkinId: skinId };
await unlockFigure(sid, roleId, [condition]); // 解锁头像 await unlockFigure(sid, roleId, [condition]); // 解锁头像
await calAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, sid, roleId, {}, [skinId]); // 全局加成 await calculateCeWithRole(HERO_SYSTEM_TYPE.ADD_SKIN, roleId, hero.serverId, sid, {}, { skinId }); // 全局加成
if (hero) { // 有武将的,将皮肤链接到武将上 if (hero) { // 有武将的,将皮肤链接到武将上
let curSkin = hero.skins.find(cur => cur.id == skinId); let curSkin = hero.skins.find(cur => cur.id == skinId);
if (!curSkin) { if (!curSkin) {
hero.skins.push(new HeroSkin(skin.id, skin.skinId, skin._id, enable )); hero.skins.push(new HeroSkin(skin, enable));
await HeroModel.updateHeroInfo(roleId, hero.hid, hero); await HeroModel.updateHeroInfo(roleId, hero.hid, hero);
} }
return hero; return hero;
+3 -3
View File
@@ -1,14 +1,14 @@
import { ChannelUser } from './../domain/ChannelUser'; import { ChannelUser } from './../domain/ChannelUser';
import { Channel, pinus } from 'pinus'; import { Channel, pinus } from 'pinus';
import { getRandValueByMinMax, getRandEelm, decodeIdCntArrayStr } from '../pubUtils/util'; import { getRandValueByMinMax, getRandEelm, decodeIdCntArrayStr } from '../pubUtils/util';
import { DEFAULT_HEROES, ROLE_SELECT, TALENT_RELATION_TYPE, TERAPH_RANDOM } from "../consts"; import { DEFAULT_HEROES, LINEUP_NUM, ROLE_SELECT, TALENT_RELATION_TYPE, TERAPH_RANDOM } from "../consts";
import { DicTeraph } from '../pubUtils/dictionary/DicTeraph'; import { DicTeraph } from '../pubUtils/dictionary/DicTeraph';
import { Teraph, RoleModel, RoleType, RoleUpdate } from '../db/Role'; import { Teraph, RoleModel, RoleType, RoleUpdate } from '../db/Role';
import { SCHOOL } from '../pubUtils/dicParam'; import { SCHOOL } from '../pubUtils/dicParam';
import { gameData, getHeroInitTalent } from '../pubUtils/data'; import { gameData, getHeroInitTalent } from '../pubUtils/data';
import { SchoolModel } from '../db/School'; import { SchoolModel } from '../db/School';
import { SclResultInter, SclPosInter, RewardInter, ItemInter } from '../pubUtils/interface'; import { SclResultInter, SclPosInter, RewardInter, ItemInter } from '../pubUtils/interface';
import { HeroSkin, HeroUpdate, Talent } from '../db/Hero'; import { HeroModel, HeroSkin, HeroUpdate, Talent } from '../db/Hero';
import { SkinUpdate } from '../db/Skin'; import { SkinUpdate } from '../db/Skin';
import { Figure } from '../domain/dbGeneral'; import { Figure } from '../domain/dbGeneral';
import { pick } from 'underscore'; import { pick } from 'underscore';
@@ -251,4 +251,4 @@ export function initSkinTalent(skins: HeroSkin[], isAll = false) {
} }
} }
return newSkins return newSkins
} }
+1 -2
View File
@@ -22,8 +22,7 @@ import { getZeroPoint } from "../../pubUtils/timeUtil";
import { resResult } from "../../pubUtils/util"; import { resResult } from "../../pubUtils/util";
import { getActivities, getActivitiesByType, getActivityByServerId } from "../activity/activityService"; import { getActivities, getActivitiesByType, getActivityByServerId } from "../activity/activityService";
import { getRoleCreateTime, getRoleOnlineInfo, getServerCreateTime } from "../redisService"; import { getRoleCreateTime, getRoleOnlineInfo, getServerCreateTime } from "../redisService";
import { getEquipById, getJewelByEquip } from "../equipService"; import { getEquipById, getJewelByEquip, isRandSeUnLock } from "../equipService";
import { isRandSeUnLock } from "../../pubUtils/playerCe";
export class CheckTask { export class CheckTask {
serverId: number; // 区id serverId: number; // 区id
+15 -15
View File
@@ -64,21 +64,21 @@ module.exports = {
'required uInt32 code': 2, 'required uInt32 code': 2,
'required Data data': 3 'required Data data': 3
}, },
'onPlayerCeUpdate': { // 'onPlayerCeUpdate': {
'message Data': { // 'message Data': {
"message Hero": { // "message Hero": {
'required uInt32 hid': 1, // 'required uInt32 hid': 1,
'required uInt32 ce': 2, // 'required uInt32 ce': 2,
'required sInt32 incHeroCe': 3, // 'required sInt32 incHeroCe': 3,
}, // },
'required sInt32 ce': 1, // 'required sInt32 ce': 1,
'repeated Hero heros': 2, // 'repeated Hero heros': 2,
'required uInt32 topLineupCe': 3 // 'required uInt32 topLineupCe': 3
}, // },
'required string msg': 1, // 'required string msg': 1,
'required uInt32 code': 2, // 'required uInt32 code': 2,
'required Data data': 3 // 'required Data data': 3
}, // },
'onPlayerDataChange': { 'onPlayerDataChange': {
'message Data': { 'message Data': {
'optional uInt32 coin': 1, 'optional uInt32 coin': 1,
-1
View File
@@ -177,7 +177,6 @@ function checkRoleHero(heros) {
expect(hero.exp).to.be.a('number'); expect(hero.exp).to.be.a('number');
expect(hero.lv).to.be.a('number'); expect(hero.lv).to.be.a('number');
expect(hero.ce).to.be.a('number'); expect(hero.ce).to.be.a('number');
expect(hero.historyCe).to.be.a('number');
expect(hero.star).to.be.a('number'); expect(hero.star).to.be.a('number');
expect(hero.starStage).to.be.a('number'); expect(hero.starStage).to.be.a('number');
expect(hero.colorStar).to.be.a('number'); expect(hero.colorStar).to.be.a('number');
+1 -1
View File
@@ -58,7 +58,7 @@ export default class Activity extends Service {
if(activity.type == ACTIVITY_TYPE.SIGN_IN || activity.type == ACTIVITY_TYPE.SIGN_IN_VIP) { if(activity.type == ACTIVITY_TYPE.SIGN_IN || activity.type == ACTIVITY_TYPE.SIGN_IN_VIP) {
// 签到活动的不显示期内也可以编辑 // 签到活动的不显示期内也可以编辑
let signInObj = new SignInData(activity, 0); let signInObj = new SignInData(activity, 0, 0);
if(signInObj.beginTime < now.getTime() && signInObj.endTime > now.getTime() ) { if(signInObj.beginTime < now.getTime() && signInObj.endTime > now.getTime() ) {
return this.ctx.service.utils.resResult(STATUS.GM_CAN_NOT_EDIT_ACT); return this.ctx.service.utils.resResult(STATUS.GM_CAN_NOT_EDIT_ACT);
} }
+9 -9
View File
@@ -1,12 +1,11 @@
import { UserModel } from '@db/User'; import { UserModel } from '@db/User';
import { CeAttrDataRole, RoleModel } from '@db/Role'; import { RoleModel } from '@db/Role';
import { HeroModel } from '@db/Hero'; import { HeroModel } from '@db/Hero';
import { Service } from 'egg'; import { Service } from 'egg';
import { STATUS, REDIS_KEY, WAR_TYPE } from '@consts'; import { STATUS, REDIS_KEY, WAR_TYPE } from '@consts';
import { ItemModel } from '@db/Item'; import { ItemModel } from '@db/Item';
import { gameData } from '@pubUtils/data'; import { gameData } from '@pubUtils/data';
import { AttributeCal } from '@domain/roleField/attribute';
import { smsModel } from '@db/Sms'; import { smsModel } from '@db/Sms';
import { isString } from 'underscore'; import { isString } from 'underscore';
import { GiftCodeModel } from '@db/GiftCode'; import { GiftCodeModel } from '@db/GiftCode';
@@ -22,6 +21,7 @@ import { RedisClient } from 'redis';
import { UserGuildModel } from '@db/UserGuild'; import { UserGuildModel } from '@db/UserGuild';
import { TowerRecordModel } from '@db/TowerRecord'; import { TowerRecordModel } from '@db/TowerRecord';
import { nowSeconds } from '@pubUtils/timeUtil'; import { nowSeconds } from '@pubUtils/timeUtil';
import { RoleCeModel, RoleCeType } from '@db/RoleCe';
// import { resResult } from '@pubUtils/util'; // import { resResult } from '@pubUtils/util';
@@ -295,18 +295,18 @@ export default class GMUsers extends Service {
const heroes = await HeroModel.findByCondition(page, pageSize, sortField, sortOrder, form); const heroes = await HeroModel.findByCondition(page, pageSize, sortField, sortOrder, form);
const total = await HeroModel.countByCondition( form ) const total = await HeroModel.countByCondition( form )
let roleMap = new Map<string, CeAttrDataRole[]>(); let roleMap = new Map<string, RoleCeType>();
for(let { roleId } of heroes) { for(let { roleId } of heroes) {
if(!roleMap.has(roleId)) { if(!roleMap.has(roleId)) {
let role = await RoleModel.findByRoleId(roleId, 'attr'); let roleCe = await RoleCeModel.findByRoleId(roleId);
roleMap.set(roleId, role.attr); roleMap.set(roleId, roleCe);
} }
} }
let list = heroes.map(cur => { let list = heroes.map(cur => {
let cal = new AttributeCal(); let roleCe = roleMap.get(cur.roleId);
cal.setByDbData(roleMap.get(cur.roleId), cur.attr); let obj = roleCe.attributes.find(ccur => ccur.hid == cur.hid);
return {...cur, calculatedAttr: cal.getReduceAttributesToArr(), env: ctx.app.config.realEnv} return {...cur, calculatedAttr: obj.attrs, env: ctx.app.config.realEnv}
}) })
return ctx.service.utils.resResult(STATUS.SUCCESS, { list, total }) return ctx.service.utils.resResult(STATUS.SUCCESS, { list, total })
+10 -6
View File
@@ -99,13 +99,17 @@ export const ABI_TYPE_SUB = [
export enum SEID_TYPE { export enum SEID_TYPE {
/**属性固定值加成(数值) */ /**属性固定值加成(数值) */
TYPE101 = 1, FIX = 1,
/**基础属性加百分比,除以1000以后加到ratioUp */ /**基础属性加百分比,除以1000 */
TYPE103 = 2, MAIN_RATIO = 2,
/**次级属性的百分比加成,乘以100后加到fixUp */ /**次级属性的百分比加成 */
TYPE104 = 3, SUB_RATIO = 3,
/**基础属性加百分比,除以1000 */
MAIN_RATIO_2 = 4,
/**次级属性的百分比加成 */
SUB_RATIO_2 = 5,
/**复合属性 */ /**复合属性 */
TYPE999 = 999, MIX = 999,
} }
export enum ABI_STAGE { export enum ABI_STAGE {
+9 -10
View File
@@ -1,8 +1,8 @@
//武将养成系统分类 //武将养成系统分类
export enum HERO_SYSTEM_TYPE { export enum HERO_SYSTEM_TYPE {
INIT = 0, // 初始武将 INIT = 0, // 初始武将
STAR = 1, // 升星 LVUP = 1, // 升级
LVUP = 2, // 升级 STAR = 2, // 升星
COLORSTAR = 3, // 觉醒 COLORSTAR = 3, // 觉醒
QUALITY = 4, // 升品 QUALITY = 4, // 升品
TRAIN = 5, // (职业)训练 TRAIN = 5, // (职业)训练
@@ -10,11 +10,11 @@ export enum HERO_SYSTEM_TYPE {
SKIN =7, // 皮肤 SKIN =7, // 皮肤
FAVOUR =8, // 好感 FAVOUR =8, // 好感
CONNECT =9, // 羁绊 CONNECT =9, // 羁绊
EQUIP = 10, // 装备穿脱 // EQUIP = 10, // 装备穿脱
EQUIP_BASE = 11, // 装备栏升级,装备精炼等 // EQUIP_BASE = 11, // 装备栏升级,装备精炼等
RESTRENGTHEN = 12, // 洗练 // RESTRENGTHEN = 12, // 洗练
JEWEL_ON = 13, // 穿宝石 // JEWEL_ON = 13, // 穿宝石
JEWEL_OFF = 14, // 脱宝石 // JEWEL_OFF = 14, // 脱宝石
ADD_SKIN = 15, // 第一次获取皮肤(全局) ADD_SKIN = 15, // 第一次获取皮肤(全局)
SCHOOL = 16, // 百家学宫 SCHOOL = 16, // 百家学宫
SCROLL = 17, // 名将谱 SCROLL = 17, // 名将谱
@@ -31,6 +31,7 @@ export enum HERO_SYSTEM_TYPE {
JEWEL_QUENCH = 28, // 天晶石淬炼 JEWEL_QUENCH = 28, // 天晶石淬炼
REBIRTH = 29, // 武将重生 REBIRTH = 29, // 武将重生
TALENT = 30, // 天赋 TALENT = 30, // 天赋
ROLE_LV = 31, // 玩家等级
}; };
// 武将上限 // 武将上限
@@ -47,10 +48,8 @@ export const JOB_TYPE = {
MAGIC: 2 MAGIC: 2
} }
// 武将战力放大系数
export const HERO_CE_RATIO = 100;
// 次级属性放大系数 // 次级属性放大系数
export const HERO_SUB_ATTR_RATIO = 1000 * 100; export const HERO_SUB_ATTR_RATIO = 1000;
export const HERO_INITIAL_QUALITY = { export const HERO_INITIAL_QUALITY = {
BLUE: 1, BLUE: 1,
+3 -3
View File
@@ -14,14 +14,14 @@ export enum ROLE_SELECT {
COM_BATTLE = 'lv head frame spine heads frames spines topLineupCe', COM_BATTLE = 'lv head frame spine heads frames spines topLineupCe',
GET_HEADS = 'heads head frames frame spines spine', GET_HEADS = 'heads head frames frame spines spine',
// 排行榜基础数据 // 排行榜基础数据
RANK = 'roleId roleName lv vLv head frame spine heads frames spines title guildName ce isReducedCe topLineup towerLv towerUpTime topLineupCe heroNum updatedAt heroNumUpdatedAt dungeonWarId dungeonUpdatedAt dungeonHeroes mainWarId mainUpdatedAt mainEliteWarId mainEliteUpdatedAt showLineup hasGuild', RANK = 'roleId roleName lv vLv head frame spine heads frames spines title guildName ce topLineup towerLv towerUpTime topLineupCe heroNum updatedAt heroNumUpdatedAt dungeonWarId dungeonUpdatedAt dungeonHeroes mainWarId mainUpdatedAt mainEliteWarId mainEliteUpdatedAt showLineup hasGuild',
}; };
export enum HERO_SELECT { export enum HERO_SELECT {
ENTRY = '-_id -attr', ENTRY = '-_id -attr',
HERO_DETAIL = 'roleId roleName hid hName ce isReducedCe lv star colorStar quality job skins attr ePlace skinId', HERO_DETAIL = 'roleId roleName hid hName ce lv star colorStar quality job skins attr ePlace skinId',
// 排行榜中lineup字段 // 排行榜中lineup字段
RANK_LINEUP = 'seqId roleId hid star colorStar lv quality job ce isReducedCe updatedAt skinId' RANK_LINEUP = 'seqId roleId hid star colorStar lv quality job ce updatedAt skinId'
} }
export enum EQUIP_SELECT { export enum EQUIP_SELECT {
+1
View File
@@ -540,6 +540,7 @@ export const FILENAME = {
DIC_STONE: 'dic_zyz_stone', DIC_STONE: 'dic_zyz_stone',
DIC_JEWEL_CONDITION: 'dic_zyz_jewel_condition', DIC_JEWEL_CONDITION: 'dic_zyz_jewel_condition',
DIC_MAIN_STAR_BOX: 'dic_zyz_main_star_reward', DIC_MAIN_STAR_BOX: 'dic_zyz_main_star_reward',
DIC_EQUIP_STRENGTH_ATTR: 'dic_zyz_equipStrengthAttr',
} }
export const WAR_RELATE_TABLES = [ export const WAR_RELATE_TABLES = [
+1 -5
View File
@@ -3,7 +3,6 @@ import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typ
import Role, { RoleType } from './Role'; import Role, { RoleType } from './Role';
import { GUILD_STRUCTURE, GUILD_STATUS, GUILD_PER_PAGE, GUILD_SELECT, REDIS_KEY, SHOP_REFRESH_TYPE } from '../consts'; import { GUILD_STRUCTURE, GUILD_STATUS, GUILD_PER_PAGE, GUILD_SELECT, REDIS_KEY, SHOP_REFRESH_TYPE } from '../consts';
import { getZeroPoint, getZeroPointD, nowSeconds } from '../pubUtils/timeUtil'; import { getZeroPoint, getZeroPointD, nowSeconds } from '../pubUtils/timeUtil';
import { reduceCe } from '../pubUtils/util';
import { gameData } from '../pubUtils/data'; import { gameData } from '../pubUtils/data';
import { SearchGuildParam } from '../domain/backEndField/search'; import { SearchGuildParam } from '../domain/backEndField/search';
@@ -77,12 +76,9 @@ export default class Guild extends BaseModel {
@prop({ required: true, default: new Date(), select: false }) @prop({ required: true, default: new Date(), select: false })
refTimeDaily: Date; refTimeDaily: Date;
@prop({ required: true, default: 0, get: (val:number) => reduceCe(val), set: (val: number) => val }) @prop({ required: true, default: 0 })
guildCe: number; // 总战力 guildCe: number; // 总战力
@prop({ required: false, set: (val: boolean) => val, get: () => true })
isReducedCe: boolean; // 如果战力没有缩过就会返回false,缩过了就会返回true
@prop({ required: true, type: String, default: [], select: false }) @prop({ required: true, type: String, default: [], select: false })
members: string[]; // 军团成员的roleId,用于增加战力的时候加入总战力 members: string[]; // 军团成员的roleId,用于增加战力的时候加入总战力
+30 -95
View File
@@ -1,55 +1,11 @@
import BaseModel from './BaseModel'; import BaseModel from './BaseModel';
import { index, getModelForClass, prop, Ref, mongoose, DocumentType } from '@typegoose/typegoose'; import { index, getModelForClass, prop, Ref, mongoose, DocumentType } from '@typegoose/typegoose';
// import Equip, { } from './Equip'; // import Equip, { } from './Equip';
import { CounterModel } from './Counter'; import { DEFAULT_HERO_LV } from '../consts';
import { COUNTER, HERO_CE_RATIO } from '../consts'; import Skin, { SkinUpdate } from './Skin';
import { reduceCe } from '../pubUtils/util';
import Skin from './Skin';
import { SearchHeroParam } from '../domain/backEndField/search'; import { SearchHeroParam } from '../domain/backEndField/search';
import { Reward } from '../domain/battleField/pvp'; import { Reward } from '../domain/battleField/pvp';
import { getHeroInitTalent } from '../pubUtils/data'; import { gameData, getHeroExpByLv, getHeroInitTalent } from '../pubUtils/data';
type CeAttrUpdate = Partial<CeAttrData>;
export class CeAttrData {
@prop({ required: true })
id: number = 0;
@prop({ required: true })
base: number = 0;
@prop({ required: true })
ratioUp: number = 0;
@prop({ required: true })
fixUp: number = 0;
@prop({ required: true })
equipUp: number = 0;
constructor(id: number) {
this.id = id;
}
public copyFromHero(data: CeAttrData) {
this.base = data.base;
this.ratioUp = data.ratioUp;
this.fixUp = data.fixUp;
this.equipUp = data.equipUp;
}
public updateAttr(update: { inc?: CeAttrUpdate, set?: CeAttrUpdate }) {
if(update.inc) {
let { base, equipUp, fixUp, ratioUp } = update.inc;
if(base != undefined) this.base += base * HERO_CE_RATIO;
if(equipUp != undefined) this.equipUp += equipUp * HERO_CE_RATIO;
if(fixUp != undefined) this.fixUp += fixUp * HERO_CE_RATIO;
if(ratioUp != undefined) this.ratioUp += ratioUp;
}
if(update.set) {
let { base, equipUp, fixUp, ratioUp } = update.set;
if(base != undefined) this.base = base * HERO_CE_RATIO;
if(equipUp != undefined) this.equipUp = equipUp * HERO_CE_RATIO;
if(fixUp != undefined) this.fixUp = fixUp * HERO_CE_RATIO;
if(ratioUp != undefined) this.ratioUp = ratioUp;
}
}
}
/** /**
* 英雄表 * 英雄表
@@ -88,12 +44,12 @@ export class HeroSkin {
@prop({ required: true }) @prop({ required: true })
usedTalentPoint: number; // 已使用的天赋点数 usedTalentPoint: number; // 已使用的天赋点数
constructor(id: number, skinId: number, skin: string, enable: boolean) { constructor(skin: SkinUpdate, enable = true) {
this.id = id; this.id = skin.id;
this.skinId = skinId; this.skinId = skin.skinId;
this.skin = skin; this.skin = skin._id;
this.enable = enable; this.enable = enable;
this.talent = getHeroInitTalent(skinId); this.talent = getHeroInitTalent(skin.skinId);
this.usedTalentPoint = 0; this.usedTalentPoint = 0;
} }
} }
@@ -111,7 +67,7 @@ export class EPlace {
@prop({ required: true }) @prop({ required: true })
equipId: number; equipId: number;
@prop({ required: true }) @prop({ required: true })
lv: number = 1; lv: number = 0;
@prop({ required: true }) @prop({ required: true })
quality: number = 1; quality: number = 1;
@prop({ required: true }) @prop({ required: true })
@@ -162,14 +118,8 @@ export default class Hero extends BaseModel {
exp: number; // 经验值 exp: number; // 经验值
@prop({ required: true, default: 1 }) @prop({ required: true, default: 1 })
lv: number; // 武将等级 lv: number; // 武将等级
@prop({ required: true, default: 0, set: (val: number) => val, get: (val: number) => reduceCe(val) })
ce: number; // 武将战力
@prop({ required: false, set: (val: boolean) => val, get: () => true })
isReducedCe: boolean; // 如果战力没有缩过就会返回false,缩过了就会返回true
@prop({ required: true, default: 0 }) @prop({ required: true, default: 0 })
historyCe: number; // 武将历史最高战力 ce: number; // 武将战力
@prop({ required: true, type: CeAttrData, default: [], _id: false })
attr: CeAttrData[]; // 影响战力的属性
@prop({ required: true, default: 1 }) @prop({ required: true, default: 1 })
star: number; // 星级 star: number; // 星级
@@ -274,39 +224,31 @@ export default class Hero extends BaseModel {
return hero; return hero;
} }
public static getInitInfo(heroInfo: HeroUpdate = {}): HeroUpdate { public static getInitInfo(hid: number, heroInfo: HeroUpdate = {}): HeroUpdate {
let dicHero = gameData.hero.get(hid)
let { quality, initialStars: star, jobid: job, name: hName } = dicHero;
const doc = new HeroModel(); const doc = new HeroModel();
const update = { ...doc.toJSON(), ...heroInfo}; const update = { ...doc.toJSON(), hid, skinId: hid, hName, star, quality, job, lv: DEFAULT_HERO_LV, exp: getHeroExpByLv(DEFAULT_HERO_LV - 1) || 0, ...heroInfo};
delete update._id; delete update._id;
return update return update
} }
public static async createHero(heroInfo: HeroUpdate, lean = true) { // public static async createHero(heroInfo: HeroUpdate, lean = true) {
const seqId = await CounterModel.getNewCounter(COUNTER.HID) || -1; // const seqId = await CounterModel.getNewCounter(COUNTER.HID) || -1;
const update = this.getInitInfo({ ...heroInfo, seqId }); // const update = this.getInitInfo(heroInfo.hid, { ...heroInfo, seqId });
const hero: HeroType = await HeroModel.findOneAndUpdate({ roleId: heroInfo.roleId, hid: heroInfo.hid }, update, { upsert: true, new: true }).lean(lean); // const hero: HeroType = await HeroModel.findOneAndUpdate({ roleId: heroInfo.roleId, hid: heroInfo.hid }, update, { upsert: true, new: true }).lean(lean);
return hero; // return hero;
} // }
public static async insertHeroes(roleId: string, roleName: string, serverId: number, heroInfos: HeroUpdate[]) { // public static async insertHeroes(roleId: string, roleName: string, serverId: number, heroInfos: HeroUpdate[]) {
let insertInfos: HeroUpdate[] = []; // let insertInfos: HeroUpdate[] = [];
for(let hero of heroInfos) { // for(let hero of heroInfos) {
const seqId = await CounterModel.getNewCounter(COUNTER.HID) || -1; // const seqId = await CounterModel.getNewCounter(COUNTER.HID) || -1;
insertInfos.push({ ...hero, seqId, roleId, roleName, serverId }) // insertInfos.push({ ...hero, seqId, roleId, roleName, serverId })
} // }
await HeroModel.insertMany(insertInfos); // await HeroModel.insertMany(insertInfos);
return <HeroType[]>insertInfos; // return <HeroType[]>insertInfos;
} // }
public static async sumTopHeroCe(roleId: string, num: number) {
let ce: Array<{ historyCe: number }> = await HeroModel.aggregate([
{ $match: { roleId } },
{ $sort: { historyCe: -1 } },
{ $limit: num },
{ $group: { _id: null, historyCe: { $sum: '$historyCe' } } }
]);
return ce.length > 0 ? ce[0].historyCe : 0;
}
public static async sumHeroCe(roleId: string) { public static async sumHeroCe(roleId: string) {
let ce: Array<{ ce: number }> = await HeroModel.aggregate([ let ce: Array<{ ce: number }> = await HeroModel.aggregate([
@@ -321,13 +263,6 @@ export default class Hero extends BaseModel {
return heroes; return heroes;
} }
public static async updateCe(roleId: string, hid: number, ce: number, oldCe: number, historyCe: number, lean = true) {
let distance = ce - oldCe;
let historyDistance = ce > historyCe ? ce - historyCe : 0;
let result: HeroType = await HeroModel.findOneAndUpdate({ roleId, hid }, { $inc: { ce: distance, historyCe: historyDistance } }).lean(lean);
return result;
}
public static async deleteAccount(roleId: string) { public static async deleteAccount(roleId: string) {
let result = await HeroModel.deleteMany({ roleId }); let result = await HeroModel.deleteMany({ roleId });
return result; return result;
@@ -340,7 +275,7 @@ export default class Hero extends BaseModel {
public static async updateHeroInfo(roleId: string, hid: number, heroUpdate: HeroUpdate, select?: string, getters = false) { public static async updateHeroInfo(roleId: string, hid: number, heroUpdate: HeroUpdate, select?: string, getters = false) {
delete heroUpdate._id; delete heroUpdate._id;
let result: HeroType = await HeroModel.findOneAndUpdate({ roleId, hid }, { $set: heroUpdate }, { new: true }).select(select).lean({ getters }); let result: HeroType = await HeroModel.findOneAndUpdate({ roleId, hid }, { $set: heroUpdate }, { new: true, upsert: true }).select(select).lean({ getters });
return result; return result;
} }
+4 -36
View File
@@ -1,42 +1,14 @@
import { ROLE_TERAPH, ROLE_SELECT, ABI_TYPE, HERO_CE_RATIO, BLOCK_TYPE } from './../consts'; import { ROLE_TERAPH, ROLE_SELECT, ABI_TYPE, BLOCK_TYPE } from './../consts';
import BaseModel from './BaseModel'; import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typegoose/typegoose'; import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typegoose/typegoose';
import User from './User'; import User from './User';
import { shouldRefresh, reduceCe } from '../pubUtils/util'; import { shouldRefresh } from '../pubUtils/util';
import { nowSeconds, getTimeFunD } from '../pubUtils/timeUtil'; import { nowSeconds, getTimeFunD } from '../pubUtils/timeUtil';
import { Figure } from '../domain/dbGeneral'; import { Figure } from '../domain/dbGeneral';
import * as dicParam from '../pubUtils/dicParam'; import * as dicParam from '../pubUtils/dicParam';
import Hero from './Hero'; import Hero from './Hero';
import { SearchRoleParam } from '../domain/backEndField/search'; import { SearchRoleParam } from '../domain/backEndField/search';
type CeAttrUpdate = Partial<CeAttrDataRole>;
// role表属性格式
export class CeAttrDataRole {
@prop({ required: true })
id: number = 0;
@prop({ required: true })
ratioUp: number = 0;
@prop({ required: true })
fixUp: number = 0;
constructor(id: number) {
this.id = id;
}
public updateAttr(update: { inc?: CeAttrUpdate, set?: CeAttrUpdate }) {
if(update.inc) {
let { fixUp, ratioUp } = update.inc;
if(fixUp != undefined) this.fixUp += fixUp * HERO_CE_RATIO;
if(ratioUp != undefined) this.ratioUp += ratioUp;
}
if(update.set) {
let { fixUp, ratioUp } = update.set;
if(fixUp != undefined) this.fixUp = fixUp * HERO_CE_RATIO;
if(ratioUp != undefined) this.ratioUp = ratioUp;
}
}
}
export class TopHero { export class TopHero {
@prop({ required: true }) @prop({ required: true })
hid: number; // 武将id hid: number; // 武将id
@@ -185,16 +157,12 @@ export default class Role extends BaseModel {
exp: number; // 经验值 exp: number; // 经验值
@prop({ required: true, default: 1 }) @prop({ required: true, default: 1 })
lv: number; // 主公等级 lv: number; // 主公等级
@prop({ required: true, default: 0, set: (val: number) => val, get: (val: number) => reduceCe(val) }) @prop({ required: true, default: 0 })
ce: number; // 总战力 ce: number; // 总战力
@prop({ required: true, type: CeAttrDataRole, default: [], _id: false }) @prop({ required: true, default: 0 })
attr: CeAttrDataRole[]; // 总战力
@prop({ required: true, default: 0, set: (val: number) => val, get: (val: number) => reduceCe(val) })
topLineupCe: number; // 最强x人战力 topLineupCe: number; // 最强x人战力
@prop({ required: true, type: TopHero, default: [], _id: false }) @prop({ required: true, type: TopHero, default: [], _id: false })
topLineup: Array<TopHero>; // 总战力 topLineup: Array<TopHero>; // 总战力
@prop({ required: false, set: (val: boolean) => val, get: () => true })
isReducedCe: boolean; // 如果战力没有缩过就会返回false,缩过了就会返回true
@prop({ required: true, default: 100 }) @prop({ required: true, default: 100 })
gold: number; // 总金币 gold: number; // 总金币
+122
View File
@@ -0,0 +1,122 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
// 全局加成
export class AttrCell {
@prop({ required: true })
attrId: number; // 属性id
@prop({ required: true, type: Number })
values: number[]; // 战力公式中的全局加成的数据,查表后的结果
}
// 单武将加成
export class HeroAttr {
@prop({ required: true })
hid: number; // 武将id
@prop({ required: true })
lv: number;
@prop({ required: true, type: () => AttrCell, _id: false })
attrs: AttrCell[];
@prop({ required: true })
historyCe: number;
@prop({ required: true })
objectId: string;
}
export class EquipAttr {
@prop({ required: true })
hid: number; // 武将id
@prop({ required: true })
eplaceId: number; // 装备位置
@prop({ required: true })
lv: number;
@prop({ required: true, type: () => AttrCell, _id: false })
attrs: AttrCell[];
}
// 百家学宫加成
export class SchoolAttr {
@prop({ required: true })
hid: number; // 武将id
@prop({ required: true })
attrId: number; // 属性id
@prop({ required: true })
value: number; // 百家学宫有多个武将,单独拎出来方便计算,计算之后结果存到globaAttrs的global1
}
// 名将谱加成
export class ScrollAttr {
@prop({ required: true })
hid: number; // 武将id
@prop({ required: true })
attrId: number; // 属性id
@prop({ required: true })
value: number; // 百家学宫有多个武将,单独拎出来方便计算,计算之后结果存到globaAttrs的global1
}
// 属性结果
export class SingleAttribute {
@prop({ required: true })
id: number; // 属性id
@prop({ required: true })
val: number; // 值
@prop({ required: true })
str: string; // 公式
}
export class Attribute {
@prop({ required: true })
hid: number;
@prop({ required: true, type: SingleAttribute, _id: false })
attrs: SingleAttribute[]; // 属性id
}
/**
* 属性表
*/
@index({ roleId: 1 })
@index({ roleId: 1 })
export default class RoleCe extends BaseModel {
@prop({ required: true })
roleId: string; // 角色 id
@prop({ required: true })
roleLv: number; // 玩家等级
@prop({ required: true, type: AttrCell, _id: false })
globalAttrs: AttrCell[]
@prop({ required: true, type: HeroAttr, _id: false })
heroAttrs: HeroAttr[]
@prop({ required: true, type: EquipAttr, _id: false })
equipAttrs: EquipAttr[]
@prop({ required: true, type: SchoolAttr, _id: false })
schoolAttrs: SchoolAttr[];
@prop({ required: true, type: ScrollAttr, _id: false })
scrollAttrs: ScrollAttr[];
@prop({ required: true, type: Attribute, _id: false })
attributes: Attribute[];
public static async findByRoleId(roleId: string) {
let result: RoleCeType = await RoleCeModel.findOne({ roleId }).lean();
return result;
}
public static async updateRoleCe(roleId: string, update: RoleCeUpdate) {
let result: RoleCeType = await RoleCeModel.findOneAndUpdate({ roleId }, { $set: update }, { new: true, upsert: true }).lean();
return result;
}
}
export const RoleCeModel = getModelForClass(RoleCe);
export interface RoleCeType extends Pick<DocumentType<RoleCe>, keyof RoleCe> { };
export type RoleCeUpdate = Partial<RoleCeType>;
+10
View File
@@ -1,5 +1,6 @@
import BaseModel from './BaseModel'; import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose'; import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
import { gameData } from '../pubUtils/data';
@index({ roleId: 1, id: 1 }) @index({ roleId: 1, id: 1 })
@index({ seqId: 1 }) @index({ seqId: 1 })
@modelOptions({ schemaOptions: { id: false } }) @modelOptions({ schemaOptions: { id: false } })
@@ -28,6 +29,15 @@ export default class Skin extends BaseModel {
return rec; return rec;
} }
public static getInitInfo(hid: number): SkinUpdate {
let dicHero = gameData.hero.get(hid);
let dicFashion = gameData.fashion.get(dicHero.initialSkin)
const doc = new SkinModel();
const update = { ...doc.toJSON(), id: dicFashion.id, skinId: dicFashion.heroId, skinName: dicFashion.name, hid};
delete update._id;
return update
}
public static async insertSkins(roleId: string, roleName: string, skinInfos: SkinUpdate[]) { public static async insertSkins(roleId: string, roleName: string, skinInfos: SkinUpdate[]) {
let insertInfos: SkinUpdate[] = []; let insertInfos: SkinUpdate[] = [];
for(let skinInfo of skinInfos) { for(let skinInfo of skinInfos) {
+7 -2
View File
@@ -65,10 +65,15 @@ export default class User extends BaseModel {
guestTime: number; // 游客体验时间 guestTime: number; // 游客体验时间
// 防沉迷相关 // 防沉迷相关
@prop({ required: false, default: false }) @prop({ required: false, default: true })
hasAuthenticated: boolean; // 是否是已认证 hasAuthenticated: boolean; // 是否是已认证
@prop({ required: false }) @prop({ required: false, default: '1990-01-01' })
birthday: string; // 生日年月 birthday: string; // 生日年月
// 暂时不使用内部防沉迷
// @prop({ required: false, default: false })
// hasAuthenticated: boolean; // 是否是已认证
// @prop({ required: false })
// birthday: string; // 生日年月
@prop({ required: false }) @prop({ required: false })
pi: string; // 已通过实名认证用户唯一标识 pi: string; // 已通过实名认证用户唯一标识
@prop({ required: false, default: 0 }) @prop({ required: false, default: 0 })
+1 -1
View File
@@ -4,7 +4,7 @@ import { DungeonFirstType } from '../../db/DungeonFirst';
class DungeonUserInfo extends RankParam { class DungeonUserInfo extends RankParam {
roleId: string; roleId: string;
constructor(roleId: string, userInfo: RankParam) { constructor(roleId: string, userInfo: RankParam) {
super(userInfo, false); super(userInfo);
this.roleId = roleId; this.roleId = roleId;
} }
} }
+4 -24
View File
@@ -1,7 +1,6 @@
import { EXTERIOR } from "../pubUtils/dicParam"; import { EXTERIOR } from "../pubUtils/dicParam";
import { WoodenHorse } from "./battleField/guildActivity"; import { WoodenHorse } from "./battleField/guildActivity";
import { RoleUpdate, RoleType } from "../db/Role"; import { RoleUpdate, RoleType } from "../db/Role";
import { reduceCe } from "../pubUtils/util";
import { GuildUpdateParam } from "../db/Guild"; import { GuildUpdateParam } from "../db/Guild";
import { HeroUpdate, } from "../db/Hero"; import { HeroUpdate, } from "../db/Hero";
import { getSeconds } from "../pubUtils/timeUtil"; import { getSeconds } from "../pubUtils/timeUtil";
@@ -38,7 +37,7 @@ export class RankParam {
@prop({ required: true }) @prop({ required: true })
updatedAt?: number = 0; updatedAt?: number = 0;
constructor(role: RoleUpdate|RankParam, fromDb: boolean) { constructor(role: RoleUpdate|RankParam) {
if(role.roleName) this.roleName = role.roleName; if(role.roleName) this.roleName = role.roleName;
if(role.lv) this.lv = role.lv; if(role.lv) this.lv = role.lv;
if(role.head) this.head = role.head; if(role.head) this.head = role.head;
@@ -46,13 +45,7 @@ export class RankParam {
if(role.spine) this.spine = role.spine; if(role.spine) this.spine = role.spine;
if(role.title) this.title = role.title; if(role.title) this.title = role.title;
if(role.guildName) this.guildName = role.guildName||""; if(role.guildName) this.guildName = role.guildName||"";
if(role.ce) { if(role.ce) this.ce = role.ce;
if(fromDb && !(<RoleUpdate>role).isReducedCe) {
this.ce = reduceCe(role.ce);
} else {
this.ce = role.ce;
}
}
if(role.updatedAt) { if(role.updatedAt) {
if(typeof role.updatedAt == 'number') { if(typeof role.updatedAt == 'number') {
this.updatedAt = role.updatedAt; this.updatedAt = role.updatedAt;
@@ -178,27 +171,14 @@ export class GuildRankParam {
@prop({ required: true }) @prop({ required: true })
guildCe: number; guildCe: number;
constructor(guild: GuildUpdateParam, fromDb: boolean) { constructor(guild: GuildUpdateParam) {
this.icon = guild.icon; this.icon = guild.icon;
this.name = guild.name; this.name = guild.name;
this.lv = guild.lv; this.lv = guild.lv;
let leader = <RoleType>guild.leader; let leader = <RoleType>guild.leader;
let _leader = new GuildLeader(leader); let _leader = new GuildLeader(leader);
this.leader = _leader; this.leader = _leader;
// console.log('*****', guild.isReducedCe, guild.guildCe, reduceCe(guild.guildCe)) this.guildCe = guild.guildCe;
if(guild.isReducedCe) {
this.guildCe = guild.guildCe;
} else {
this.guildCe = reduceCe(guild.guildCe);
}
if(fromDb && !(<GuildUpdateParam>guild).isReducedCe) {
this.guildCe = reduceCe(guild.guildCe);
} else {
this.guildCe = guild.guildCe;
}
this.memberCnt = guild.memberCnt; this.memberCnt = guild.memberCnt;
} }
} }
+18 -62
View File
@@ -1,8 +1,6 @@
import { HERO_CE_RATIO, getAtrrNameById, ABI_TYPE_MAIN } from '../../consts'; import { getAtrrNameById, ABI_TYPE_MAIN } from '../../consts';
import { CeAttrDataRole } from '../../db/Role';
import { CeAttrData } from '../../db/Hero';
import { gameData } from '../../pubUtils/data'; import { gameData } from '../../pubUtils/data';
import { decodeArrayListStr, reduceCe } from '../../pubUtils/util'; import { decodeArrayListStr } from '../../pubUtils/util';
import { ATTRIBUTE } from '../../pubUtils/dicParam'; import { ATTRIBUTE } from '../../pubUtils/dicParam';
export class AttributeCal { export class AttributeCal {
@@ -14,34 +12,12 @@ export class AttributeCal {
this.lv = lv; this.lv = lv;
} }
public setByDbData(roleAttrs: CeAttrDataRole[], heroAttrs: CeAttrData[]) {
for(let { id, fixUp: roleFix, ratioUp: roleRatio } of roleAttrs) {
let heroAttr = heroAttrs.find(heroAttr => heroAttr.id == id);
if(heroAttr) {
let { fixUp: heroFix, base: heroBase, ratioUp: heroRatio, equipUp: heroEquip } = heroAttr;
let value = this.calAttrValue(roleFix, roleRatio, heroBase, heroFix, heroRatio, heroEquip);
this.attrs.set(id, value);
} else {
let value = this.calAttrValue(roleFix, roleRatio, 0, 0, 0, 0);
this.attrs.set(id, value);
}
}
for(let { id, base: heroBase, fixUp: heroFix, ratioUp: heroRatio, equipUp: heroEquip } of heroAttrs) {
let roleAttr = roleAttrs.find(roleAttr => roleAttr.id == id);
if(!roleAttr) {
let value = this.calAttrValue(0, 0, heroBase, heroFix, heroRatio, heroEquip);
this.attrs.set(id, value);
}
}
}
public setByWarJson(attributes: {id: number, val: number}[], ratio: number = 1) { public setByWarJson(attributes: {id: number, val: number}[], ratio: number = 1) {
for(let {id, val} of attributes) { for(let {id, val} of attributes) {
if(ABI_TYPE_MAIN.includes(id)) { if(ABI_TYPE_MAIN.includes(id)) {
this.attrs.set(id, Math.floor(val * ratio * HERO_CE_RATIO * HERO_CE_RATIO)); this.attrs.set(id, Math.floor(val * ratio));
} else { } else {
this.attrs.set(id, Math.floor(val * HERO_CE_RATIO * HERO_CE_RATIO)); this.attrs.set(id, Math.floor(val));
} }
} }
} }
@@ -49,58 +25,42 @@ export class AttributeCal {
public setByMap( attributes: Map<number, number>, ratio: number = 1 ) { public setByMap( attributes: Map<number, number>, ratio: number = 1 ) {
for(let [id, val] of attributes) { for(let [id, val] of attributes) {
if(ABI_TYPE_MAIN.includes(id)) { if(ABI_TYPE_MAIN.includes(id)) {
this.attrs.set(id, Math.floor(val * ratio * HERO_CE_RATIO * HERO_CE_RATIO)); this.attrs.set(id, Math.floor(val * ratio));
} else { } else {
this.attrs.set(id, Math.floor(val * HERO_CE_RATIO * HERO_CE_RATIO)); this.attrs.set(id, Math.floor(val));
} }
} }
} }
private calAttrValue(roleFix: number = 0, roleRatio: number = 0, heroBase: number = 0, heroFix: number = 0, heroRatio: number = 0, heroEquip: number = 0) { private getAttrMap() {
return (heroFix + heroEquip + roleFix) * HERO_CE_RATIO + heroBase * ( HERO_CE_RATIO + heroRatio + roleRatio );
}
// private getRealAttrToMap() {
// let newMap = new Map<number, number>();
// for(let [id, val] of this.attrs) {
// if(ABI_TYPE_MAIN.includes(id)) { // 主属性
// newMap.set(id, val / HERO_CE_RATIO / HERO_CE_RATIO);
// } else {
// newMap.set(id, val / HERO_SUB_ATTR_RATIO / HERO_CE_RATIO / HERO_CE_RATIO);
// }
// }
// return newMap;
// }
private getReduceAttrMap() {
let newMap = new Map<number, number>(); let newMap = new Map<number, number>();
for(let [id, val] of this.attrs) { for(let [id, val] of this.attrs) {
newMap.set(id, reduceCe(val)); newMap.set(id, val);
} }
return newMap return newMap
} }
public getReduceAttributes() { public getAttributes() {
let attrs = new Attribute(); let attrs = new Attribute();
attrs.setByMap(this.getReduceAttrMap()); attrs.setByMap(this.getAttrMap());
return attrs; return attrs;
} }
public getReduceAttributesToArr() { public getAttributesToArr() {
let arr: {id: number, val: number}[] = []; let arr: {id: number, val: number}[] = [];
for(let [id, val] of this.getReduceAttrMap()) { for(let [id, val] of this.getAttrMap()) {
arr.push({ id, val }); arr.push({ id, val });
} }
return arr; return arr;
} }
public getReduceAttributesToString() { public getAttributesToString() {
let arr = this.getReduceAttributesToArr(); let arr = this.getAttributesToArr();
return arr.map(cur => `${cur.id}&${cur.val}`).join('|'); return arr.map(cur => `${cur.id}&${cur.val}`).join('|');
} }
public getReduceMainAttributes() { public getMainAttributes() {
let attribute = this.getReduceAttributes(); let attribute = this.getAttributes();
return attribute.getMainAttr(); return attribute.getMainAttr();
} }
@@ -126,12 +86,8 @@ export class AttributeCal {
return Math.floor(ce); return Math.floor(ce);
} }
public calSubAttrCeAndReduce() { public calSubAttrCe() {
return Math.floor(this.calCe(3) / HERO_CE_RATIO / HERO_CE_RATIO); return Math.floor(this.calCe(3));
}
public calCelAndReduce() {
return Math.floor(this.calCe() / HERO_CE_RATIO / HERO_CE_RATIO);
} }
} }
-249
View File
@@ -1,249 +0,0 @@
import { ABI_STAGE, ABI_STAGE_TO_TYPE, ABI_TYPE, ABI_TYPE_MAIN, HERO_CE_RATIO, HERO_SYSTEM_TYPE, SEID_TYPE } from "../../consts";
import { HeroModel, HeroUpdate, CeAttrData } from "../../db/Hero";
import { CeAttrDataRole, RoleUpdate } from "../../db/Role";
import { gameData, getHeroStarByQuality, getHeroWakeByQuality } from "../../pubUtils/data";
import { DicRandomEffectPool } from "../../pubUtils/dictionary/DicRandomEffectPool";
import { DicSe } from "../../pubUtils/dictionary/DicSe";
import { deepCopy } from "../../pubUtils/util";
import { AttributeCal } from "./attribute";
export class CalRoleCe {
private roleInfo: RoleUpdate;
private roleCeWithAttr: Map<ABI_TYPE, CeAttrDataRole> = new Map();
constructor(roleInfo?: RoleUpdate) {
this.roleInfo = roleInfo;
}
public cal(type: HERO_SYSTEM_TYPE) {
switch (type) {
case HERO_SYSTEM_TYPE.INIT:
this.calTitleAbility();
this.calTeraphMainAttr();
break;
}
return this.getRoleAttr();
}
private calTitleAbility() {
let { title } = this.roleInfo;
let dicTitle = gameData.title.get(title)||{ mainAttrValue: new Map(), assiAttrValue: new Map() };
for (let i = ABI_TYPE.ABI_HP; i < ABI_TYPE.ABI_MAX; i++) {
if (dicTitle.mainAttrValue.has(i)) {
let fixUp = dicTitle.mainAttrValue.get(i) || 0;
this.getSingleAttrObj(i).updateAttr({ inc: { fixUp } });
}
if (dicTitle.assiAttrValue.has(i)) {
let fixUp = dicTitle.assiAttrValue.get(i) || 0;
this.getSingleAttrObj(i).updateAttr({ inc: { fixUp } });
}
}
}
private calTeraphMainAttr(id?: number) {
let { teraphs = [] } = this.roleInfo;
for(let teraph of teraphs) {
if(id == undefined || teraph.id == id) {
for(let [attrId, val] of teraph.attr) {
this.getSingleAttrObj(attrId).updateAttr({ inc: { fixUp: val } });
}
}
}
}
// 获取一个CeAttrData对象,没有就新建
public getSingleAttrObj(attrId: ABI_TYPE) {
if(!this.roleCeWithAttr.has(attrId)) {
let calSingleAttr = new CeAttrDataRole(attrId);
this.roleCeWithAttr.set(attrId, calSingleAttr);
}
return this.roleCeWithAttr.get(attrId);
}
private getRoleAttr() {
let attr: CeAttrDataRole[] = [];
this.roleCeWithAttr.forEach(value => {
if(value.ratioUp > 0 || value.fixUp > 0) {
attr.push(value);
}
});
return attr;
}
}
export class CalHeroCe {
private hid: number;
private heroInfo: HeroUpdate;
private heroCeWithAttr: Map<ABI_TYPE, CeAttrData> = new Map();
constructor(hid: number, heroInfo?: HeroUpdate) {
this.hid = hid;
if(heroInfo) this.heroInfo = heroInfo;
}
public async setHeroInfoByHid(roleId: string) {
let hero = await HeroModel.findByHidAndRole(this.hid, roleId);
this.heroInfo = hero;
}
// 主要接口
public cal(type: HERO_SYSTEM_TYPE) {
switch (type) {
case HERO_SYSTEM_TYPE.INIT:
case HERO_SYSTEM_TYPE.REBIRTH:
this.calBaseAbility();
this.calSkinSeid();
this.calJobAbility();
break;
}
return this.getHeroAttr()
}
// 计算基础属性
private calBaseAbility() {
let { star, starStage, quality, colorStar, colorStarStage, lv, skinId } = this.heroInfo;
const dicHero = gameData.hero.get(skinId);
if(!dicHero) {
console.error(`not found hero: ${skinId}`);
return;
}
for (let stage = ABI_STAGE.START + 1; stage <= ABI_STAGE.END; stage++) {
let attrId = ABI_STAGE_TO_TYPE.get(stage);
const isWake = colorStar > 0; // 是否觉醒,只要激活了觉醒,彩星就会 > 1
// console.log('*isUpstar', isUpStar, originStar, star, originColorStar, colorStar)
const dicStar = isWake ? getHeroWakeByQuality(dicHero.jobClass, dicHero.quality, colorStarStage < stage? colorStar - 1: colorStar) : getHeroStarByQuality(dicHero.jobClass, quality, starStage < stage? star - 1: star); // 星级表
let heroAttr = dicHero.baseAbilityArr.get(attrId); // 武将表hp等
let heroUpAttr = dicHero.baseAbilityUpArr.get(attrId); // 武将表hp_up等
let starUp = 0; // 星级成长
if (!!dicStar && !!dicStar.ceAttr) {
starUp = dicStar.ceAttr.get(stage);
}
let base = heroAttr + lv * (heroUpAttr + starUp);
this.getSingleAttrObj(attrId).updateAttr({ set: { base } });
};
}
// 计算职业属性
private calJobAbility() {
let { job, jobStage } = this.heroInfo;
const dicJob = gameData.job.get(job);
for(let i = 1; i <= dicJob.maxStage; i++) {
if(jobStage >= i) {
let { id, attr } = dicJob.ceAttr.get(i);
this.getSingleAttrObj(id).updateAttr({ inc: { fixUp: attr } });
}
}
}
// 计算皮肤属性
private calSkinSeid() {
let { skinId, star: _star, colorStar: _colorStar } = this.heroInfo;
let seidList = new Map<number, number>(); // type => seid
let dicHero = gameData.hero.get(skinId);
let { starSeidArr, colorStarSeidArr } = gameData.heroSkill.get(dicHero.skill);
for (let { star, value, type } of starSeidArr) {
if (_star >= star) {
seidList.set(type, value);
}
}
for (let { star, value, type } of colorStarSeidArr) {
if (_colorStar >= star) {
seidList.set(type, value);
}
}
let list: number[] = [];
for(let [_type, value] of seidList) list.push(value);
addSeidEffect.bind(this, list);
}
public getHeroAttr() {
let attr: CeAttrData[] = [];
this.heroCeWithAttr.forEach(value => {
if(value.base > 0 || value.equipUp > 0 || value.fixUp > 0 || value.ratioUp > 0) {
attr.push(value);
}
});
return attr;
}
// 获取一个CeAttrData对象,没有就新建
public getSingleAttrObj(attrId: ABI_TYPE) {
if(!this.heroCeWithAttr.has(attrId)) {
let calSingleAttr = new CeAttrData(attrId);
this.heroCeWithAttr.set(attrId, calSingleAttr);
}
return this.heroCeWithAttr.get(attrId);
}
public getCalculatedCe(roleAttr: CeAttrDataRole[]) {
let attrCal = new AttributeCal();
attrCal.setLv(this.heroInfo.lv);
attrCal.setByDbData(roleAttr, this.getHeroAttr());
return attrCal.calCe();
}
}
// 添加技能增加的被动属性
function addSeidEffect(this: CalRoleCe|CalHeroCe, seidList: number[]) {
// console.log('******addSeidEffect',this, seidList)
// console.log('addSeidList', addSeidList.join())
// console.log('removeSeidList', removeSeidList.join())
let effectList: DicSe[] = []; // any: dic_zyz_se表内容
for (let ii = 0; ii < seidList.length; ii += 2) {
let seid = seidList[ii];
let rand = seidList[ii + 1] || 0;
let dicSeid: DicSe | DicRandomEffectPool = gameData.se.get(seid);
if (!dicSeid) dicSeid = gameData.randomEffectPool.get(seid);
if (dicSeid && dicSeid.id > 0) {
addSeid(effectList, dicSeid.id, rand, dicSeid.gainValueArr)
}
}
// console.log('effectList', JSON.stringify(effectList));
for (let { type, gainValueArr: [ability, value] } of effectList) {
if (type == SEID_TYPE.TYPE101) { // 加值
this.getSingleAttrObj(ability).updateAttr({ inc: { fixUp: value } });
} else if (type == SEID_TYPE.TYPE103) { // 主属性加百分比
if(ABI_TYPE_MAIN.includes(ability)) {
this.getSingleAttrObj(ability).updateAttr({ inc: {ratioUp: value / 1000} });
}
} else if (type == SEID_TYPE.TYPE104) { // 次级属性加百分比
if(!ABI_TYPE_MAIN.includes(ability)) {
this.getSingleAttrObj(ability).updateAttr({ inc: { fixUp: value * 100 * HERO_CE_RATIO } });
}
}
}
}
// 获取dic_zyz_se内容
function addSeid(effectList: (DicSe | DicRandomEffectPool)[], seidId: number, rand: number, seidValue: number[] = []) {
let curSeid: DicSe | DicRandomEffectPool = gameData.se.get(seidId);
if (!curSeid) curSeid = gameData.randomEffectPool.get(seidId);
if (!curSeid) { console.log("seidId not found:" + seidId); return; }
if (!seidValue) seidValue = curSeid.gainValueArr;
if (curSeid.type === SEID_TYPE.TYPE999) {
for (let i = 0; i < seidValue.length; i++) {
addSeid(effectList, seidValue[i], rand);
}
return;
}
let seid: DicSe | DicRandomEffectPool = deepCopy(curSeid);
if (curSeid.index > 0) {
seid.gainValueArr[curSeid.index - 1] = rand;
}
effectList.push(seid);
}
+1 -9
View File
@@ -1,7 +1,6 @@
import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Talent } from '../../db/Hero'; import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Talent } from '../../db/Hero';
import { gameData } from '../../pubUtils/data'; import { gameData } from '../../pubUtils/data';
import { reduceCe } from '../../pubUtils/util';
export interface CreateHeroParam extends HeroUpdate { export interface CreateHeroParam extends HeroUpdate {
hid: number; hid: number;
count: number; count: number;
@@ -41,7 +40,6 @@ export class HeroParam {
exp: number; // 经验值 exp: number; // 经验值
lv: number; // 武将等级 lv: number; // 武将等级
ce: number; // 武将战力 ce: number; // 武将战力
historyCe: number; // 武将历史最高战力
star: number; // 星级 star: number; // 星级
starStage: number; // 星级六维阶段 starStage: number; // 星级六维阶段
colorStar: number; // 觉醒, 彩星 colorStar: number; // 觉醒, 彩星
@@ -74,13 +72,7 @@ export class HeroParam {
this.hName = hero.hName; this.hName = hero.hName;
this.exp = hero.exp; this.exp = hero.exp;
this.lv = hero.lv; this.lv = hero.lv;
if(hero.isReducedCe) { this.ce = hero.ce;
this.ce = hero.ce;
this.historyCe = hero.historyCe;
} else {
this.ce = reduceCe(hero.ce);
this.historyCe = reduceCe(hero.historyCe);
}
this.star = hero.star; this.star = hero.star;
this.starStage = hero.starStage; this.starStage = hero.starStage;
this.colorStar = hero.colorStar; this.colorStar = hero.colorStar;
+9 -1
View File
@@ -103,6 +103,7 @@ import { dicJewelCondition, loadJewelCondition } from './dictionary/DicJewelCond
import { dicMainStarBox, dicMainStarBoxByChapter, loadMainStarBox } from './dictionary/DicMainStarBox'; import { dicMainStarBox, dicMainStarBoxByChapter, loadMainStarBox } from './dictionary/DicMainStarBox';
import { dicHeroTalent, initTalents, loadHeroTalent } from './dictionary/DicHeroTalent'; import { dicHeroTalent, initTalents, loadHeroTalent } from './dictionary/DicHeroTalent';
import { Talent } from "../db/Hero"; import { Talent } from "../db/Hero";
import { dicEquipStrengthAttr, loadEquipStrengthAttr } from './dictionary/DicEquipStrengthAttr';
export const gameData = { export const gameData = {
daily: dicDaily, daily: dicDaily,
@@ -257,6 +258,7 @@ export const gameData = {
heroTalent: dicHeroTalent, heroTalent: dicHeroTalent,
initTalents: initTalents, initTalents: initTalents,
talentPointOfJob: talentPointOfJob, talentPointOfJob: talentPointOfJob,
equipStrengthAttr: dicEquipStrengthAttr
}; };
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据 // 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
@@ -333,7 +335,7 @@ export function getBossHpByWarId(warId: number) {
if (relation === 2) { if (relation === 2) {
let newAttr = new AttributeCal(); let newAttr = new AttributeCal();
newAttr.setByWarJson(attribute, 1); newAttr.setByWarJson(attribute, 1);
let attrJson = newAttr.getReduceAttributes(); let attrJson = newAttr.getAttributes();
const hp = attrJson.hp || 0; const hp = attrJson.hp || 0;
if (hp > 0) { if (hp > 0) {
@@ -882,6 +884,11 @@ export function getHeroInitTalent(skinId: number) {
return ids.map(id => (new Talent(id))); return ids.map(id => (new Talent(id)));
} }
export function getEquipStrenthenAttr(equipId: number, lv: number) {
let result = gameData.equipStrengthAttr.get(`${equipId}_${lv}`);
return result
}
// 初始加载 // 初始加载
function initDatas() { function initDatas() {
parseDicParam(); parseDicParam();
@@ -1049,6 +1056,7 @@ function loadDatas() {
loadJewelCondition(); loadJewelCondition();
loadMainStarBox(); loadMainStarBox();
loadHeroTalent(); loadHeroTalent();
loadEquipStrengthAttr();
} }
// 重载dicParam // 重载dicParam
@@ -0,0 +1,39 @@
// 装备强化表
import { readFileAndParse, decodeArrayListStr } from '../util'
import { FILENAME } from '../../consts'
export interface DicEquipStrengthAttr {
// id
readonly id: number;
// 装备id
readonly equipId: number;
// 等级
readonly lv: number;
// 属性
readonly attr: {id: number, num: number}[];
}
export const dicEquipStrengthAttr = new Map<string, DicEquipStrengthAttr>();
export function loadEquipStrengthAttr() {
dicEquipStrengthAttr.clear();
let arr = readFileAndParse(FILENAME.DIC_EQUIP_STRENGTH_ATTR);
arr.forEach(o => {
o.attr = parseAttr(o.attr);
dicEquipStrengthAttr.set(`${o.equipId}_${o.lv}`, o);
});
arr = undefined;
}
function parseAttr(str: string) {
let result = new Array<{id: number, num: number}>();
if(!str) return result;
let decodeArr = decodeArrayListStr(str);
for(let [id, num] of decodeArr) {
if(isNaN(parseInt(id)) || isNaN(parseInt(num))) {
throw new Error('data table format wrong');
}
result.push({id: parseInt(id), num: parseInt(num)});
}
return result
}
+5 -5
View File
@@ -10,7 +10,7 @@ export interface DicEquipSuit {
// 套装内含的装备编号 // 套装内含的装备编号
readonly equips: number[]; readonly equips: number[];
// 按星级可解锁的属性 // 按星级可解锁的属性
readonly effect: { star: number, seid: number }[]; readonly effect: { star: number, id: number, val: number }[];
} }
export const dicEquipSuit = new Map<number, DicEquipSuit>(); export const dicEquipSuit = new Map<number, DicEquipSuit>();
@@ -30,14 +30,14 @@ export function loadEquipSuit() {
} }
function parseEffect(str: string) { function parseEffect(str: string) {
let result = new Array<{star: number, seid: number}>(); let result = new Array<{star: number, id: number, val: number}>();
if(!str) return result; if(!str) return result;
let decodeArr = decodeArrayListStr(str); let decodeArr = decodeArrayListStr(str);
for(let [star, seid] of decodeArr) { for(let [star, id, val] of decodeArr) {
if(isNaN(parseInt(star)) || isNaN(parseInt(seid))) { if(isNaN(parseInt(star)) || isNaN(parseInt(id)) || isNaN(parseInt(val))) {
throw new Error('data table format wrong'); throw new Error('data table format wrong');
} }
result.push({star: parseInt(star), seid: parseInt(seid)}); result.push({star: parseInt(star), id: parseInt(id), val: parseInt(val)});
} }
return result return result
} }
+19 -3
View File
@@ -23,8 +23,10 @@ export interface DicJob {
readonly trainingConsume: Array<RewardInter>; readonly trainingConsume: Array<RewardInter>;
// 升阶消耗 // 升阶消耗
readonly upGradeConsume: Array<RewardInter>; readonly upGradeConsume: Array<RewardInter>;
// 每阶升级属性 // 每阶升级属性 stage => {}
readonly ceAttr: Map<number, {id: number, attr: number}>; readonly ceAttr: Map<number, {id: number, attr: number}>;
// 次级属性基础 attr => value attr1
readonly baseSubAttr: {id: number, val: number}[];
// 一共有多少阶升级 // 一共有多少阶升级
readonly maxStage: number; readonly maxStage: number;
// 到这一阶能获得多少天赋点 // 到这一阶能获得多少天赋点
@@ -32,7 +34,7 @@ export interface DicJob {
} }
type KeysEnum<T> = { [P in keyof Required<T>]: true }; type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicJobKeys: KeysEnum<DicJob> = {jobid: true, name: true, grade: true, unlockLevel: true, job_class: true, type: true, trainingConsume: true, upGradeConsume: true, ceAttr: true, maxStage: true, talentPoint: true}; const DicJobKeys: KeysEnum<DicJob> = {jobid: true, name: true, grade: true, unlockLevel: true, job_class: true, type: true, trainingConsume: true, upGradeConsume: true, ceAttr: true, maxStage: true, talentPoint: true, baseSubAttr: true};
export const dicJob = new Map<number, DicJob>(); export const dicJob = new Map<number, DicJob>();
export const jobClassMaxGrades = new Map<number, {grade:number, jobid:number}>(); export const jobClassMaxGrades = new Map<number, {grade:number, jobid:number}>();
@@ -54,6 +56,7 @@ export function loadJob() {
o.maxStage = o.trainingConsume.length; o.maxStage = o.trainingConsume.length;
o.upGradeConsume = parseGoodStr(o.upGradeConsume); o.upGradeConsume = parseGoodStr(o.upGradeConsume);
o.ceAttr = parseCeAttr(o.maxStage, o.attr); o.ceAttr = parseCeAttr(o.maxStage, o.attr);
o.baseSubAttr = parseAttribute(o.baseSecondAttr||'');
dicJob.set(o.jobid, _.pick(o, Object.keys(DicJobKeys))); dicJob.set(o.jobid, _.pick(o, Object.keys(DicJobKeys)));
let jobClass = jobClassMaxGrades.get(o.job_class); let jobClass = jobClassMaxGrades.get(o.job_class);
if (!jobClass || jobClass.grade < o.grade) { if (!jobClass || jobClass.grade < o.grade) {
@@ -93,4 +96,17 @@ function parseCeAttr(maxStage: number, str: string) {
result.set(i, { id: parseInt(id), attr: parseFloat(attr) }); result.set(i, { id: parseInt(id), attr: parseFloat(attr) });
} }
return result return result
} }
function parseAttribute(str: string) {
let result = new Array<{ id: number, val: number }>();
if (!str) return result;
let decodeArr = decodeArrayListStr(str);
for (let [id, val] of decodeArr) {
if (isNaN(parseInt(id)) || isNaN(parseInt(val))) {
throw new Error('data table format wrong');
}
result.push({ id: parseInt(id), val: parseInt(val) });
}
return result
}
@@ -36,7 +36,7 @@ export function loadRandomEffectPool() {
arr.forEach(o => { arr.forEach(o => {
o.rate = parseRate(o.count); o.rate = parseRate(o.count);
o.gainValueArr = parseNumberList(o.gainvalue); o.gainValueArr = parseNumberList(o.gainValue);
dicRandomEffectPool.set(o.id, o); dicRandomEffectPool.set(o.id, o);
dicRandomEffectPoolByGroupAndLv.set(`${o.group}_${o.level}`, o.id); dicRandomEffectPoolByGroupAndLv.set(`${o.group}_${o.level}`, o.id);
}); });
+16 -4
View File
@@ -23,6 +23,7 @@ export interface DicTeraph {
readonly upMaterial:Array<RewardInter>; readonly upMaterial:Array<RewardInter>;
readonly assiAttrValue:Map<number, number>; // 次级属性 readonly assiAttrValue:Map<number, number>; // 次级属性
readonly basicAttrValue:Map<number, number>; // 主属性
readonly upGradeMaterial:Array<RewardInter>; readonly upGradeMaterial:Array<RewardInter>;
} }
export const dicTeraph = new Map<string, DicTeraph>(); export const dicTeraph = new Map<string, DicTeraph>();
@@ -42,6 +43,7 @@ export function loadTeraph() {
criEffect: true, criEffect: true,
upMaterial: true, upMaterial: true,
assiAttrValue: true, assiAttrValue: true,
basicAttrValue: true,
upGradeMaterial: true, upGradeMaterial: true,
} }
@@ -51,6 +53,7 @@ export function loadTeraph() {
o.upMaterial = parseGoodStr(o.upMaterial); o.upMaterial = parseGoodStr(o.upMaterial);
o.mainAttrMax = parseMainAttrMax(o); o.mainAttrMax = parseMainAttrMax(o);
o.mainAttrUp = parseMainAttrUp(o); o.mainAttrUp = parseMainAttrUp(o);
o.basicAttrValue = parseBasicAttr(o);
dicTeraph.set(o.index + '_' + o.grade, _.pick(o, Object.keys(DicTeraphKeys))); dicTeraph.set(o.index + '_' + o.grade, _.pick(o, Object.keys(DicTeraphKeys)));
}); });
@@ -72,10 +75,10 @@ function parseAttr(str: string) {
function parseMainAttrMax(elem) { function parseMainAttrMax(elem) {
let result = new Map<number, number>(); let result = new Map<number, number>();
result.set(ABI_TYPE.ABI_HP, elem.hpMax); result.set(ABI_TYPE.ABI_HP, elem.hpMax - elem.hpBasis);
result.set(ABI_TYPE.ABI_ATK, elem.atkMax); result.set(ABI_TYPE.ABI_ATK, elem.atkMax - elem.atkBasis);
result.set(ABI_TYPE.ABI_DEF, elem.defMax); result.set(ABI_TYPE.ABI_DEF, elem.defMax - elem.defBasis);
result.set(ABI_TYPE.ABI_MDEF, elem.mdefMax); result.set(ABI_TYPE.ABI_MDEF, elem.mdefMax - elem.mdefBasis);
return result return result
} }
@@ -86,4 +89,13 @@ function parseMainAttrUp(elem) {
result.set(ABI_TYPE.ABI_DEF, elem.defUp); result.set(ABI_TYPE.ABI_DEF, elem.defUp);
result.set(ABI_TYPE.ABI_MDEF, elem.mdefUp); result.set(ABI_TYPE.ABI_MDEF, elem.mdefUp);
return result return result
}
function parseBasicAttr(elem) {
let result = new Map<number, number>();
result.set(ABI_TYPE.ABI_HP, elem.hpBasis);
result.set(ABI_TYPE.ABI_ATK, elem.atkBasis);
result.set(ABI_TYPE.ABI_DEF, elem.defBasis);
result.set(ABI_TYPE.ABI_MDEF, elem.mdefBasis);
return result
} }
File diff suppressed because it is too large Load Diff
+57 -25
View File
@@ -1,12 +1,11 @@
import { STATUS } from './../consts/statusCode'; import { STATUS } from './../consts/statusCode';
import { HeroModel, HeroType } from '../db/Hero';
import { isNumber } from 'underscore'; import { isNumber } from 'underscore';
const csprng = require('csprng'); const csprng = require('csprng');
import fs = require('fs'); import fs = require('fs');
import path = require('path'); import path = require('path');
import { HERO_CE_RATIO, ABI_STAGE, GACHA_TO_FLOOR, REFRESH_TIME, ROBOT_SYS_TYPE, ITEM_CHANGE_REASON, WAR_TYPE } from '../consts'; import { ABI_STAGE, GACHA_TO_FLOOR, REFRESH_TIME, ROBOT_SYS_TYPE, ITEM_CHANGE_REASON, WAR_TYPE } from '../consts';
import { findIndex } from 'underscore'; import { findIndex } from 'underscore';
import { getTimeFunM } from './timeUtil'; import { getTimeFunM } from './timeUtil';
@@ -114,18 +113,6 @@ export function decodeIdCntArrayStr(str: string, multi: number) {
return strMap; return strMap;
} }
// 计算当前武将战力
export async function calculateSumCE(roleId: string, type: number, param: { num?: number, heroes?: Array<number> }) {
let sum: number;
if (type == 1) { // 最高num人历史最高战力和
sum = await HeroModel.sumTopHeroCe(roleId, param.num || 0);
} else if (type == 2) { // 所有人战力和
sum = await HeroModel.sumHeroCe(roleId);
}
sum = reduceCe(sum);
return sum;
}
/** /**
* 传入两个时间,返回按照时间差计算,第二个时间比第一个晚几天 * 传入两个时间,返回按照时间差计算,第二个时间比第一个晚几天
* @param preTime 之前的时间 * @param preTime 之前的时间
@@ -573,17 +560,6 @@ export function mergeSameGoods(goods: Array<{ id: number, count: number }>) {
return resGoods; return resGoods;
} }
export function returnHeroCeRatio(hero: HeroType) {
let ce = reduceCe(hero.ce);
return Object.assign(hero, { ce });
}
// 缩小战力
export function reduceCe(ce: number = 0) {
return Math.floor(ce / HERO_CE_RATIO / HERO_CE_RATIO)
}
// 获取全部属性 // 获取全部属性
export function getAllAttrStage() { export function getAllAttrStage() {
let attrs = new Array<number>(); // 有升级的属性 1-hp 2-atk 3-def 4-mdef 5-agi 6-luk let attrs = new Array<number>(); // 有升级的属性 1-hp 2-atk 3-def 4-mdef 5-agi 6-luk
@@ -788,3 +764,59 @@ export function stringToRewardInter(rewardStr: string): Array<RewardInter> {
} }
return result return result
} }
export function addToMap<T>(map: Map<T, number>, id: T, value: number) {
if(!map.has(id)) {
map.set(id, value);
} else {
map.set(id, map.get(id) + value);
}
}
// /**
// * 计算最强阵容战力
// * @param role
// * @param hid
// * @param ce
// * @param heroId
// */
// export async function calculatetopLineup(role: RoleType, hid?: number, ce?: number, heroId?: string) {
// let topLineup = role?.topLineup || new Array();
// if(!hid) { // 直接重新排
// let heroes = await HeroModel.getTopHero(role.roleId, LINEUP_NUM);
// topLineup = heroes.map(cur => { return { hid: cur.hid, ce: cur.ce, hero: cur._id } });
// } else {
// topLineup.sort((a, b) => { return b.ce - a.ce }); // 0-6,最大-最小
// let index = topLineup.findIndex(cur => cur.hid == hid);
// if(index != -1 && !heroId) {
// let heroes = await HeroModel.getTopHero(role.roleId, LINEUP_NUM);
// topLineup = heroes.map(cur => { return { hid: cur.hid, ce: cur.ce, hero: cur._id } });
// } else {
// if (index == -1) { // 不在最强列表
// if (topLineup.length < LINEUP_NUM) { // 不满6人
// topLineup.push({ hid, ce, hero: heroId });
// } else if (topLineup.length == LINEUP_NUM) {
// if (ce > topLineup[topLineup.length - 1].ce) { // 跻身最强6人
// topLineup.pop();
// topLineup.push({ hid, ce, hero: heroId });
// }
// } else {
// topLineup.splice(LINEUP_NUM, topLineup.length - LINEUP_NUM);
// }
// } else { // 原来就是最强6人
// if (ce < topLineup[topLineup.length - 1].ce) { // 滑出最强
// let heroes = await HeroModel.getTopHero(role.roleId, LINEUP_NUM);
// topLineup = heroes.map(cur => { return { hid: cur.hid, ce: cur.ce, hero: cur._id } });
// } else {
// topLineup[index].ce = ce;
// }
// }
// }
// }
// let topLineupCe = topLineup.reduce((pre, cur) => {
// return pre + cur.ce
// }, 0);
// return { topLineup, topLineupCe };
// }
-56
View File
@@ -5,8 +5,6 @@
"jobClass": 1, "jobClass": 1,
"eplaceId": 1, "eplaceId": 1,
"suitId": 1, "suitId": 1,
"attribute": "2&10",
"attributeUp": "2&10",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -16,8 +14,6 @@
"jobClass": 1, "jobClass": 1,
"eplaceId": 2, "eplaceId": 2,
"suitId": 1, "suitId": 1,
"attribute": "4&20",
"attributeUp": "4&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -27,8 +23,6 @@
"jobClass": 1, "jobClass": 1,
"eplaceId": 3, "eplaceId": 3,
"suitId": 1, "suitId": 1,
"attribute": "5&20",
"attributeUp": "5&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -38,8 +32,6 @@
"jobClass": 1, "jobClass": 1,
"eplaceId": 4, "eplaceId": 4,
"suitId": 1, "suitId": 1,
"attribute": "1&50",
"attributeUp": "1&50",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -49,8 +41,6 @@
"jobClass": 2, "jobClass": 2,
"eplaceId": 1, "eplaceId": 1,
"suitId": 2, "suitId": 2,
"attribute": "2&10",
"attributeUp": "2&10",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -60,8 +50,6 @@
"jobClass": 2, "jobClass": 2,
"eplaceId": 2, "eplaceId": 2,
"suitId": 2, "suitId": 2,
"attribute": "4&20",
"attributeUp": "4&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -71,8 +59,6 @@
"jobClass": 2, "jobClass": 2,
"eplaceId": 3, "eplaceId": 3,
"suitId": 2, "suitId": 2,
"attribute": "5&20",
"attributeUp": "5&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -82,8 +68,6 @@
"jobClass": 2, "jobClass": 2,
"eplaceId": 4, "eplaceId": 4,
"suitId": 2, "suitId": 2,
"attribute": "1&50",
"attributeUp": "1&50",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -93,8 +77,6 @@
"jobClass": 3, "jobClass": 3,
"eplaceId": 1, "eplaceId": 1,
"suitId": 3, "suitId": 3,
"attribute": "2&10",
"attributeUp": "2&10",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -104,8 +86,6 @@
"jobClass": 3, "jobClass": 3,
"eplaceId": 2, "eplaceId": 2,
"suitId": 3, "suitId": 3,
"attribute": "4&20",
"attributeUp": "4&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -115,8 +95,6 @@
"jobClass": 3, "jobClass": 3,
"eplaceId": 3, "eplaceId": 3,
"suitId": 3, "suitId": 3,
"attribute": "5&20",
"attributeUp": "5&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -126,8 +104,6 @@
"jobClass": 3, "jobClass": 3,
"eplaceId": 4, "eplaceId": 4,
"suitId": 3, "suitId": 3,
"attribute": "1&50",
"attributeUp": "1&50",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -137,8 +113,6 @@
"jobClass": 4, "jobClass": 4,
"eplaceId": 1, "eplaceId": 1,
"suitId": 4, "suitId": 4,
"attribute": "2&10",
"attributeUp": "2&10",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -148,8 +122,6 @@
"jobClass": 4, "jobClass": 4,
"eplaceId": 2, "eplaceId": 2,
"suitId": 4, "suitId": 4,
"attribute": "4&20",
"attributeUp": "4&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -159,8 +131,6 @@
"jobClass": 4, "jobClass": 4,
"eplaceId": 3, "eplaceId": 3,
"suitId": 4, "suitId": 4,
"attribute": "5&20",
"attributeUp": "5&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -170,8 +140,6 @@
"jobClass": 4, "jobClass": 4,
"eplaceId": 4, "eplaceId": 4,
"suitId": 4, "suitId": 4,
"attribute": "1&50",
"attributeUp": "1&50",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -181,8 +149,6 @@
"jobClass": 5, "jobClass": 5,
"eplaceId": 1, "eplaceId": 1,
"suitId": 5, "suitId": 5,
"attribute": "2&10",
"attributeUp": "2&10",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -192,8 +158,6 @@
"jobClass": 5, "jobClass": 5,
"eplaceId": 2, "eplaceId": 2,
"suitId": 5, "suitId": 5,
"attribute": "4&20",
"attributeUp": "4&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -203,8 +167,6 @@
"jobClass": 5, "jobClass": 5,
"eplaceId": 3, "eplaceId": 3,
"suitId": 5, "suitId": 5,
"attribute": "5&20",
"attributeUp": "5&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -214,8 +176,6 @@
"jobClass": 5, "jobClass": 5,
"eplaceId": 4, "eplaceId": 4,
"suitId": 5, "suitId": 5,
"attribute": "1&50",
"attributeUp": "1&50",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -225,8 +185,6 @@
"jobClass": 6, "jobClass": 6,
"eplaceId": 1, "eplaceId": 1,
"suitId": 6, "suitId": 6,
"attribute": "2&10",
"attributeUp": "2&10",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -236,8 +194,6 @@
"jobClass": 6, "jobClass": 6,
"eplaceId": 2, "eplaceId": 2,
"suitId": 6, "suitId": 6,
"attribute": "4&20",
"attributeUp": "4&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -247,8 +203,6 @@
"jobClass": 6, "jobClass": 6,
"eplaceId": 3, "eplaceId": 3,
"suitId": 6, "suitId": 6,
"attribute": "5&20",
"attributeUp": "5&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -258,8 +212,6 @@
"jobClass": 6, "jobClass": 6,
"eplaceId": 4, "eplaceId": 4,
"suitId": 6, "suitId": 6,
"attribute": "1&50",
"attributeUp": "1&50",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -269,8 +221,6 @@
"jobClass": 7, "jobClass": 7,
"eplaceId": 1, "eplaceId": 1,
"suitId": 7, "suitId": 7,
"attribute": "2&10",
"attributeUp": "2&10",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -280,8 +230,6 @@
"jobClass": 7, "jobClass": 7,
"eplaceId": 2, "eplaceId": 2,
"suitId": 7, "suitId": 7,
"attribute": "4&20",
"attributeUp": "4&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -291,8 +239,6 @@
"jobClass": 7, "jobClass": 7,
"eplaceId": 3, "eplaceId": 3,
"suitId": 7, "suitId": 7,
"attribute": "5&20",
"attributeUp": "5&20",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
}, },
@@ -302,8 +248,6 @@
"jobClass": 7, "jobClass": 7,
"eplaceId": 4, "eplaceId": 4,
"suitId": 7, "suitId": 7,
"attribute": "1&50",
"attributeUp": "1&50",
"composeMaterial": "50001&2", "composeMaterial": "50001&2",
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian" "imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
} }
File diff suppressed because it is too large Load Diff
+27 -27
View File
@@ -15,8 +15,8 @@
"turnLimted": 20, "turnLimted": 20,
"forcedCharactor": "&", "forcedCharactor": "&",
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "1.消灭所有敌军\r\n2.死亡的村民数量≤2\r\n3.剩下的村民都到达洞口", "victoryInfoInUI": "1.消灭所有敌军\n2.死亡的村民数量≤2\n3.剩下的村民都到达洞口",
"loseInfoInUI": "1.我方全部阵亡\r\n2.死亡的村民数量≥3\r\n3.20回合内未能胜利", "loseInfoInUI": "1.我方全部阵亡\n2.死亡的村民数量≥3\n3.20回合内未能胜利",
"starInfoInUI": "1.在20回合内获得胜利", "starInfoInUI": "1.在20回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&qingnian", "iconInMap": "spine&qingnian",
@@ -30,7 +30,7 @@
"needPrepare": 1, "needPrepare": 1,
"spineInBigMap": "&", "spineInBigMap": "&",
"HeroNum": "6&6", "HeroNum": "6&6",
"gkInfo": " 循着不详的气息,赵云一行人来到了一座神秘的小村庄。老人们说,他们是为了躲避连年战乱才来此地。\r\n 想不到即使是在这里,也藏着不为人知的阴谋……\r\n 这些阴兵,究竟由谁招来?山林里还有恶兽蠢蠢欲动……\r\n", "gkInfo": " 循着不详的气息,赵云一行人来到了一座神秘的小村庄。老人们说,他们是为了躲避连年战乱才来此地。\n 想不到即使是在这里,也藏着不为人知的阴谋……\n 这些阴兵,究竟由谁招来?山林里还有恶兽蠢蠢欲动……\n",
"HeroNum_1": "1&6", "HeroNum_1": "1&6",
"progress": "1&0|2&0", "progress": "1&0|2&0",
"progressDesc": "已逃走的百姓数量&被击杀的百姓数量", "progressDesc": "已逃走的百姓数量&被击杀的百姓数量",
@@ -52,8 +52,8 @@
"turnLimted": 20, "turnLimted": 20,
"forcedCharactor": "&", "forcedCharactor": "&",
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "1.消灭所有敌军\r\n2.解救所有被绑架的村民\r\n", "victoryInfoInUI": "1.消灭所有敌军\n2.解救所有被绑架的村民\n",
"loseInfoInUI": "1.我方全部阵亡\r\n2.20回合内未能胜利", "loseInfoInUI": "1.我方全部阵亡\n2.20回合内未能胜利",
"starInfoInUI": "1.在20回合内获得胜利", "starInfoInUI": "1.在20回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&yinbingdao&1", "iconInMap": "spine&yinbingdao&1",
@@ -67,7 +67,7 @@
"needPrepare": 1, "needPrepare": 1,
"spineInBigMap": "&", "spineInBigMap": "&",
"HeroNum": "6&6", "HeroNum": "6&6",
"gkInfo": " 赵云一行人刚将村中的百姓带入山洞避难,一位急急忙忙寻找妻子的青年便找上门来。\r\n 洞内仍有不少以往百姓为了躲避战乱设下的陷阱,可务必要当心!\r\n 也许在这昏暗的洞穴里,点燃火炬一路小心前行,才是上策。", "gkInfo": " 赵云一行人刚将村中的百姓带入山洞避难,一位急急忙忙寻找妻子的青年便找上门来。\n 洞内仍有不少以往百姓为了躲避战乱设下的陷阱,可务必要当心!\n 也许在这昏暗的洞穴里,点燃火炬一路小心前行,才是上策。",
"HeroNum_1": "1&6", "HeroNum_1": "1&6",
"progress": "1&0|6&0", "progress": "1&0|6&0",
"progressDesc": "已解救的百姓数量&待解救的百姓数量", "progressDesc": "已解救的百姓数量&待解救的百姓数量",
@@ -104,7 +104,7 @@
"needPrepare": 1, "needPrepare": 1,
"spineInBigMap": "&", "spineInBigMap": "&",
"HeroNum": "6&6", "HeroNum": "6&6",
"gkInfo": " 诡异的阴兵,神秘的阴珠,残忍的血法……从巨鹿废墟到山林小村,一个巨大的阴谋似乎一直笼罩在冀州的上空。\r\n 现在赵云一行人终于来到了最后的祭坛,即将揭开这一切的始作俑者……", "gkInfo": " 诡异的阴兵,神秘的阴珠,残忍的血法……从巨鹿废墟到山林小村,一个巨大的阴谋似乎一直笼罩在冀州的上空。\n 现在赵云一行人终于来到了最后的祭坛,即将揭开这一切的始作俑者……",
"HeroNum_1": "1&6", "HeroNum_1": "1&6",
"progress": "&", "progress": "&",
"progressDesc": "&", "progressDesc": "&",
@@ -128,7 +128,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "\r\n1.在20回合内获得胜利", "starInfoInUI": "\n1.在20回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&qingnian", "iconInMap": "spine&qingnian",
"iconName": "井底世界", "iconName": "井底世界",
@@ -141,7 +141,7 @@
"needPrepare": 1, "needPrepare": 1,
"spineInBigMap": "&", "spineInBigMap": "&",
"HeroNum": "6&6", "HeroNum": "6&6",
"gkInfo": " 在枯井的周围,一群宫女装扮的幽鬼盘亘。\r\n 原来,这些是洛阳被焚毁时,惨死于皇宫中的宫女,因为长久以来的怨气而化为幽鬼,她们憎恨一切活着的人类。\r\n 小心!她们来了!", "gkInfo": " 在枯井的周围,一群宫女装扮的幽鬼盘亘。\n 原来,这些是洛阳被焚毁时,惨死于皇宫中的宫女,因为长久以来的怨气而化为幽鬼,她们憎恨一切活着的人类。\n 小心!她们来了!",
"HeroNum_1": "1&6", "HeroNum_1": "1&6",
"progress": "&", "progress": "&",
"progressDesc": "&", "progressDesc": "&",
@@ -178,7 +178,7 @@
"needPrepare": 1, "needPrepare": 1,
"spineInBigMap": "&", "spineInBigMap": "&",
"HeroNum": "6&6", "HeroNum": "6&6",
"gkInfo": " 枯井的尽头是一条大门,出于好奇,赵云一行人穿越幽暗的隧道,来到大门前。\r\n 吱呀——推开大门,原来这里是一片墓室。\r\n 在昏黄的烛火中,他们看到了一群没有意识的侍卫,还有一个没有头颅的巨大身影……", "gkInfo": " 枯井的尽头是一条大门,出于好奇,赵云一行人穿越幽暗的隧道,来到大门前。\n 吱呀——推开大门,原来这里是一片墓室。\n 在昏黄的烛火中,他们看到了一群没有意识的侍卫,还有一个没有头颅的巨大身影……",
"HeroNum_1": "1&6", "HeroNum_1": "1&6",
"progress": "&", "progress": "&",
"progressDesc": "&", "progressDesc": "&",
@@ -202,7 +202,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在30回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在30回合内获得胜利",
"cost": 30, "cost": 30,
"iconInMap": "spine&zhangjiao", "iconInMap": "spine&zhangjiao",
"iconName": "何后废陵", "iconName": "何后废陵",
@@ -215,7 +215,7 @@
"needPrepare": 1, "needPrepare": 1,
"spineInBigMap": "&", "spineInBigMap": "&",
"HeroNum": "6&6", "HeroNum": "6&6",
"gkInfo": " 何太后身材窈窕,风流妩媚,进宫之后更是凭借自身的心计一步步征服了汉灵帝的心。然其天性善妒,刘协出生后,感到自身地位动摇的何太后用鸩酒毒杀了王美人。\r\n 天道有轮回,外戚与宦官相争,何进身死,董卓进京,何太后也被逼饮下毒酒。\r\n 陵墓尽头,彼岸花开,何太后已超脱生死,可千万别停留在这里!", "gkInfo": " 何太后身材窈窕,风流妩媚,进宫之后更是凭借自身的心计一步步征服了汉灵帝的心。然其天性善妒,刘协出生后,感到自身地位动摇的何太后用鸩酒毒杀了王美人。\n 天道有轮回,外戚与宦官相争,何进身死,董卓进京,何太后也被逼饮下毒酒。\n 陵墓尽头,彼岸花开,何太后已超脱生死,可千万别停留在这里!",
"HeroNum_1": "1&6", "HeroNum_1": "1&6",
"progress": "&", "progress": "&",
"progressDesc": "&", "progressDesc": "&",
@@ -239,7 +239,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&guanhai", "iconInMap": "spine&guanhai",
"iconName": 0, "iconName": 0,
@@ -276,7 +276,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&caosong", "iconInMap": "spine&caosong",
"iconName": 0, "iconName": 0,
@@ -313,7 +313,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 30, "cost": 30,
"iconInMap": "spine&zhangrang", "iconInMap": "spine&zhangrang",
"iconName": 0, "iconName": 0,
@@ -350,7 +350,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&qingnian", "iconInMap": "spine&qingnian",
"iconName": 0, "iconName": 0,
@@ -387,7 +387,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&yinbingdao", "iconInMap": "spine&yinbingdao",
"iconName": 0, "iconName": 0,
@@ -424,7 +424,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 30, "cost": 30,
"iconInMap": "spine&zhangjiao", "iconInMap": "spine&zhangjiao",
"iconName": 0, "iconName": 0,
@@ -461,7 +461,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&qingnian", "iconInMap": "spine&qingnian",
"iconName": 0, "iconName": 0,
@@ -498,7 +498,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&yinbingdao", "iconInMap": "spine&yinbingdao",
"iconName": 0, "iconName": 0,
@@ -535,7 +535,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 30, "cost": 30,
"iconInMap": "spine&zhangjiao", "iconInMap": "spine&zhangjiao",
"iconName": 0, "iconName": 0,
@@ -572,7 +572,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&wangcan", "iconInMap": "spine&wangcan",
"iconName": 0, "iconName": 0,
@@ -609,7 +609,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&yanshi", "iconInMap": "spine&yanshi",
"iconName": 0, "iconName": 0,
@@ -646,7 +646,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 30, "cost": 30,
"iconInMap": "spine&sengren", "iconInMap": "spine&sengren",
"iconName": 0, "iconName": 0,
@@ -683,7 +683,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&qingnian", "iconInMap": "spine&qingnian",
"iconName": "武陵顽猴", "iconName": "武陵顽猴",
@@ -720,7 +720,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 10, "cost": 10,
"iconInMap": "spine&yinbingdao", "iconInMap": "spine&yinbingdao",
"iconName": "桃源疫民", "iconName": "桃源疫民",
@@ -757,7 +757,7 @@
"fobiddenCharactor": "&", "fobiddenCharactor": "&",
"victoryInfoInUI": "消灭所有敌军", "victoryInfoInUI": "消灭所有敌军",
"loseInfoInUI": "我方全部阵亡", "loseInfoInUI": "我方全部阵亡",
"starInfoInUI": "1.我方无人阵亡;\r\n2.在5回合内获得胜利", "starInfoInUI": "1.我方无人阵亡;\n2.在5回合内获得胜利",
"cost": 30, "cost": 30,
"iconInMap": "spine&zhangjiao", "iconInMap": "spine&zhangjiao",
"iconName": "西夷疫魔", "iconName": "西夷疫魔",