Merge branch 'feature/login'
Conflicts: game-server/app/servers/role/handler/heroHandler.ts game-server/app/services/redisService.ts shared/consts/index.ts shared/resource/jsons/dic_zyz_gk_main.json
This commit is contained in:
@@ -62,7 +62,7 @@ app.configure(function() {
|
||||
}
|
||||
});
|
||||
|
||||
const redisClient = connectRedis(app.get('database').redis);
|
||||
const redisClient = connectRedis(app.get('database').redis, app.get('database').redispw);
|
||||
app.set('redis', redisClient);
|
||||
redLockService.initRedlock(redisClient);
|
||||
redlockCacheService.init();
|
||||
@@ -78,7 +78,7 @@ app.configure(function() {
|
||||
});
|
||||
|
||||
// app configuration
|
||||
app.configure('production|development|alpha|dev', 'connector', function () {
|
||||
app.configure('production|development|alpha|dev|isbn', 'connector', function () {
|
||||
app.set('connectorConfig',
|
||||
{
|
||||
connector: pinus.connectors.hybridconnector,
|
||||
@@ -103,7 +103,7 @@ app.configure('production|development|alpha|dev', 'connector', function () {
|
||||
});
|
||||
});
|
||||
|
||||
app.configure('production|development|alpha|dev', 'gate', function () {
|
||||
app.configure('production|development|alpha|dev|isbn', 'gate', function () {
|
||||
app.set('connectorConfig',
|
||||
{
|
||||
connector: pinus.connectors.hybridconnector,
|
||||
@@ -111,7 +111,7 @@ app.configure('production|development|alpha|dev', 'gate', function () {
|
||||
});
|
||||
});
|
||||
|
||||
app.configure('production|development|alpha|dev', 'gm', function () {
|
||||
app.configure('production|development|alpha|dev|isbn', 'gm', function () {
|
||||
app.set('connectorConfig',
|
||||
{
|
||||
connector: pinus.connectors.hybridconnector,
|
||||
@@ -120,7 +120,7 @@ app.configure('production|development|alpha|dev', 'gm', function () {
|
||||
init();//将gm后台数据加载到gate服
|
||||
});
|
||||
|
||||
app.configure('production|development|alpha|dev', 'systimer', function () {
|
||||
app.configure('production|development|alpha|dev|isbn', 'systimer', function () {
|
||||
app.set('connectorConfig',
|
||||
{
|
||||
connector: pinus.connectors.hybridconnector,
|
||||
@@ -154,7 +154,7 @@ export function globalErrorHandler(err: Error, msg: any, resp: any,
|
||||
}
|
||||
|
||||
// app configure
|
||||
app.configure('production|development|alpha|dev', function () {
|
||||
app.configure('production|development|alpha|dev|isbn', function () {
|
||||
app.set(RESERVED.ERROR_HANDLER, errorHandler);
|
||||
app.set(RESERVED.GLOBAL_ERROR_HANDLER, globalErrorHandler);
|
||||
app.globalAfter((err: Error, routeRecord: RouteRecord, msg: any, session: FrontendOrBackendSession, resp: any, cb: HandlerCallback) => {
|
||||
|
||||
@@ -55,7 +55,7 @@ export class EntryHandler {
|
||||
await self.app.rpc.connector.connectorRemote.remoteLogin.toServer(connect.sid, role.roleId);
|
||||
}
|
||||
let serverName = this.app.getServerId();
|
||||
await roleLogin(role.roleId, user.userCode, serverName); // 保存在线用户
|
||||
await roleLogin(role.roleId, user.userCode, serverName, user.pkgName); // 保存在线用户
|
||||
await session.abind(role.roleId);
|
||||
session.set('uid', role.roleId);
|
||||
session.set('roleId', role.roleId);
|
||||
|
||||
@@ -138,7 +138,7 @@ export class EquipHandler {
|
||||
|
||||
hero.ePlace = ePlace;
|
||||
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP_BASE);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_BASE, sid, roleId, hero, { ePlace });
|
||||
const curHero = {
|
||||
hid,
|
||||
ePlace: strengthenArr
|
||||
@@ -197,7 +197,7 @@ export class EquipHandler {
|
||||
|
||||
hero.ePlace = ePlace;
|
||||
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP_BASE);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_BASE, sid, roleId, hero, { ePlace });
|
||||
const curHero = {
|
||||
hid,
|
||||
ePlace: strengthenArr
|
||||
@@ -261,7 +261,7 @@ export class EquipHandler {
|
||||
let result = await handleCost(roleId, sid, cost);
|
||||
if (!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP_BASE);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_BASE, sid, roleId, hero, { ePlace });
|
||||
|
||||
const curHero = {
|
||||
hid,
|
||||
@@ -381,7 +381,7 @@ export class EquipHandler {
|
||||
|
||||
// 更新战力
|
||||
const hero = await HeroModel.findByHidAndRoleWithEquip(hid, roleId);
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.RESTRENGTHEN, [ePlaceId, ...removeSeidList]);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.RESTRENGTHEN, sid, roleId, hero, {}, [ePlaceId, ...removeSeidList]);
|
||||
|
||||
return resResult(STATUS.SUCCESS,{curEquip});
|
||||
|
||||
@@ -448,7 +448,7 @@ export class EquipHandler {
|
||||
} else if (type == 2) {
|
||||
if (!equip.hid)
|
||||
return resResult(STATUS.EQUIP_NOT_EQUIPED);
|
||||
let curEquip = await takeOffEquipAndCalPlayerCe(roleId, sid, equip.seqId, hero, id)
|
||||
let curEquip = await takeOffEquipAndCalPlayerCe(roleId, sid, hero, equip, id)
|
||||
curEquips.push(curEquip);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { curEquips: curEquips });
|
||||
@@ -513,7 +513,7 @@ export class EquipHandler {
|
||||
await addItems(roleId, roleName, sid, goods);
|
||||
if (!!equip.hid) {
|
||||
let hero = await HeroModel.findByHidAndRole(equip.hid, roleId);
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.JEWEL_ON, [jewel, oldJewel]);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_ON, sid, roleId, hero, {}, [jewel, oldJewel]);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } });
|
||||
}
|
||||
@@ -560,7 +560,7 @@ export class EquipHandler {
|
||||
await addItems(roleId, roleName, sid, goods);
|
||||
if (!!equip.hid) {
|
||||
let hero = await HeroModel.findByHidAndRole(equip.hid, roleId);
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.JEWEL_OFF, [jewel]);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_OFF, sid, roleId, hero, {}, [jewel]);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } });
|
||||
}
|
||||
@@ -651,7 +651,7 @@ export class EquipHandler {
|
||||
await EquipModel.updateEquipInfo(eid, { holes: equip.holes });
|
||||
if (!!equip.hid) {
|
||||
let hero = await HeroModel.findByHidAndRole(equip.hid, roleId);
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.JEWEL_ON, [jewel, oldJewel]);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.JEWEL_ON, sid, roleId, hero, {}, [jewel, oldJewel]);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { curEquip: { seqId: eid, holes: equip.holes } });
|
||||
} else {
|
||||
|
||||
@@ -681,12 +681,12 @@ export class FriendHandler {
|
||||
if(heroList.length <= 0) return resResult(STATUS.HERO_NOT_FIND);
|
||||
|
||||
let list = new Array();
|
||||
for(let {roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job, skins, ceAttr} of heroList) {
|
||||
for(let {roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job, skins, attr: heroAttrs} of heroList) {
|
||||
|
||||
let curSkin = skins.find(cur => cur.enable);
|
||||
let equips = await EquipModel.findListByHidAndRole(hisRoleId, hid, EQUIP_SELECT.HERO_DETAIL);
|
||||
|
||||
let attributes = getPlayerMainAttribute(ceAttr, role.globalCeAttr);
|
||||
let attributes = getPlayerMainAttribute(heroAttrs, role.attr);
|
||||
|
||||
list.push({
|
||||
roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {Application, BackendSession, ChannelService} from 'pinus';
|
||||
import { handleCost, addItems } from '../../../services/rewardService';
|
||||
import { calPlayerCeAndSave } from '../../../services/playerCeService';
|
||||
import { resResult, returnHeroCeRatio } from '../../../pubUtils/util';
|
||||
import { calPlayerCeAndSave, calAllHeroCe } from '../../../services/playerCeService';
|
||||
import { resResult, returnHeroCeRatio, deepCopy } from '../../../pubUtils/util';
|
||||
import { STATUS } from '../../../consts/statusCode';
|
||||
import {HeroModel} from '../../../db/Hero';
|
||||
import { HeroModel, Connect } from '../../../db/Hero';
|
||||
import {CURRENCY_BY_TYPE, CURRENCY_TYPE, CONSUME_TYPE, HERO_GROW_MAX, HERO_SYSTEM_TYPE, ITID, ABI_STAGE, HERO_CE_RATIO} from '../../../consts';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { ItemModel } from '../../../db/Item';
|
||||
@@ -12,6 +12,8 @@ import { RewardInter } from '../../../pubUtils/interface';
|
||||
import { getDropItems } from '../../../consts/constModules/itemConst'
|
||||
import { getRoleOnlineInfo, getAllOnlineRoles } from '../../../services/redisService';
|
||||
import { pushHeroQualityUpMsg } from '../../../services/chatService';
|
||||
import { CeAttrDataRole, CeAttrData } from '../../../domain/roleField/attribute';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new HeroHandler(app);
|
||||
}
|
||||
@@ -81,8 +83,9 @@ export class HeroHandler {
|
||||
let curHero = await HeroModel.createHero({
|
||||
roleId, serverId, roleName, hid, hName, star, quality, job, skins:[{id: initialSkin, enable: true}]
|
||||
});
|
||||
await calPlayerCeAndSave(sid, roleId, [curHero], HERO_SYSTEM_TYPE.INIT);
|
||||
return resResult(STATUS.SUCCESS, {curHero: returnHeroCeRatio(curHero)});
|
||||
let hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, sid, roleId, curHero, {});
|
||||
await calAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, sid, roleId, {}, [initialSkin])
|
||||
return resResult(STATUS.SUCCESS, {curHero: returnHeroCeRatio(hero)});
|
||||
}
|
||||
|
||||
// 武将升级
|
||||
@@ -138,12 +141,14 @@ export class HeroHandler {
|
||||
let costResult = await handleCost(roleId, sid, material);
|
||||
if(!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
|
||||
hero.lv = playerLv > newLv?newLv: playerLv;
|
||||
hero.exp = newExp;
|
||||
let update = {
|
||||
lv: playerLv > newLv?newLv: playerLv,
|
||||
exp: newExp
|
||||
}
|
||||
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.LVUP, [hid]);
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.LVUP, sid, roleId, hero, update);
|
||||
const curHero = {
|
||||
hid, lv : heros[0].lv, exp : heros[0].exp
|
||||
hid, lv : hero.lv, exp : hero.exp
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { curHero });
|
||||
|
||||
@@ -178,16 +183,20 @@ export class HeroHandler {
|
||||
if(!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
|
||||
let isUpStar = oldStarStage + 1 == ABI_STAGE.END;
|
||||
hero.star = isUpStar? oldStar + 1: oldStar;
|
||||
hero.starStage = isUpStar? ABI_STAGE.START: oldStarStage + 1;
|
||||
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.STAR, [hid, isUpStar?1:0]);
|
||||
let update = {
|
||||
star: isUpStar? oldStar + 1: oldStar,
|
||||
starStage: isUpStar? ABI_STAGE.START: oldStarStage + 1
|
||||
}
|
||||
|
||||
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]); // 升星可能影响到百家学院全局加成
|
||||
const curHero = {
|
||||
hid,
|
||||
star : heros[0].star,
|
||||
starStage : heros[0].starStage,
|
||||
colorStar: heros[0].colorStar,
|
||||
colorStarStage: heros[0].colorStarStage
|
||||
star : hero.star,
|
||||
starStage : hero.starStage,
|
||||
colorStar: hero.colorStar,
|
||||
colorStarStage: hero.colorStarStage
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, {isUpStar, curHero});
|
||||
}
|
||||
@@ -226,11 +235,14 @@ export class HeroHandler {
|
||||
let costResult = await handleCost(roleId, sid, [{id: pieceId, count: fragmentNum}]);
|
||||
if(!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
|
||||
hero.quality ++;
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.QUALITY, [hid]);
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.QUALITY, sid, roleId, hero, {
|
||||
quality: hero.quality + 1
|
||||
});
|
||||
await calAllHeroCe(HERO_SYSTEM_TYPE.QUALITY, sid, roleId, {}, [hid, 0]); // 升品可能影响到百家学院全局加成
|
||||
|
||||
const curHero = {
|
||||
hid,
|
||||
quality : heros[0].quality
|
||||
quality : hero.quality
|
||||
}
|
||||
pushHeroQualityUpMsg(roleId, roleName, serverId, hero);
|
||||
return resResult(STATUS.SUCCESS, {curHero});
|
||||
@@ -273,16 +285,21 @@ export class HeroHandler {
|
||||
|
||||
let isWakeUp = oldColorStar == 0;
|
||||
let isUpStar = isWakeUp || oldColorStarStage + 1 == ABI_STAGE.END;
|
||||
hero.colorStar = isUpStar? oldColorStar + 1: oldColorStar;
|
||||
hero.colorStarStage = isUpStar? ABI_STAGE.START: oldColorStarStage + 1;
|
||||
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.COLORSTAR, [hid, isUpStar?1:0, isWakeUp?1:0]);
|
||||
let update = {
|
||||
colorStar: isUpStar? oldColorStar + 1: oldColorStar,
|
||||
colorStarStage: isUpStar? ABI_STAGE.START: oldColorStarStage + 1
|
||||
}
|
||||
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.COLORSTAR, sid, roleId, hero, update);
|
||||
if(isUpStar) await calAllHeroCe(HERO_SYSTEM_TYPE.COLORSTAR, sid, roleId, {}, [hid, isUpStar?1:0]); // 升星可能影响到百家学院全局加成
|
||||
|
||||
const curHero = {
|
||||
hid,
|
||||
star : heros[0].star,
|
||||
starStage : heros[0].starStage,
|
||||
colorStar: heros[0].colorStar,
|
||||
colorStarStage: heros[0].colorStarStage
|
||||
star : hero.star,
|
||||
starStage : hero.starStage,
|
||||
colorStar: hero.colorStar,
|
||||
colorStarStage: hero.colorStarStage
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, {isUpStar, curHero});
|
||||
}
|
||||
@@ -293,26 +310,30 @@ export class HeroHandler {
|
||||
let sid: string = session.get('sid');
|
||||
let { hid } = msg;
|
||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
if (!hero)
|
||||
return resResult(STATUS.HERO_NOT_FIND);
|
||||
let heroJob = gameData.job.get(hero.job);
|
||||
if (hero.jobStage >= 6)
|
||||
if (!hero) return resResult(STATUS.HERO_NOT_FIND);
|
||||
|
||||
let dicJob = gameData.job.get(hero.job);
|
||||
if(!dicJob) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
if (hero.jobStage >= ABI_STAGE.END)
|
||||
return resResult(STATUS.HERO_JOB_STAGE_REACH_MAX_STAGE);
|
||||
if (hero.job >= getMaxGradeByjobClass(heroJob.job_class))
|
||||
if (hero.job >= getMaxGradeByjobClass(dicJob.job_class))
|
||||
return resResult(STATUS.HERO_JOB_REACH_MAX_STAGE);
|
||||
|
||||
let consume = new Array<RewardInter>();
|
||||
if(heroJob.trainingConsume[hero.jobStage]) {
|
||||
consume.push(heroJob.trainingConsume[hero.jobStage]);
|
||||
if(dicJob.trainingConsume[hero.jobStage]) {
|
||||
consume.push(dicJob.trainingConsume[hero.jobStage]);
|
||||
}
|
||||
let result = await handleCost(roleId, sid, consume);
|
||||
if(!result) {
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
}
|
||||
hero.jobStage = hero.jobStage +1;
|
||||
|
||||
//重算战力并下发
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.TRAIN);
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, job : heros[0].job, jobStage: heros[0].jobStage}});
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.TRAIN, sid, roleId, hero, {
|
||||
jobStage: hero.jobStage + 1
|
||||
});
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : hero.hid, job : hero.job, jobStage: hero.jobStage}});
|
||||
}
|
||||
|
||||
//进阶
|
||||
@@ -334,27 +355,30 @@ export class HeroHandler {
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
}
|
||||
let nextHeroJob = getJobByGradeAndClass(heroJob.job_class, heroJob.grade + 1);
|
||||
hero.job = nextHeroJob.jobid;
|
||||
hero.jobStage = 0;
|
||||
|
||||
//重算战力并下发
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.STAGEUP, [curJob]);
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, job : heros[0].job, jobStage : heros[0].jobStage}});
|
||||
let update = {
|
||||
job: nextHeroJob.jobid,
|
||||
jobStage: 0
|
||||
}
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.STAGEUP, sid, roleId, hero, update);
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : hero.hid, job : hero.job, jobStage : hero.jobStage}});
|
||||
}
|
||||
|
||||
//激活羁绊
|
||||
async heroConectionActivate(msg: {shipId: number}, session: BackendSession) {
|
||||
async heroConectionActivate(msg: { shipId: number }, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
let sid: string = session.get('sid');
|
||||
let { shipId } = msg;
|
||||
let shipHidAndLevel = gameData.friendShipHidAandIds.get(shipId);
|
||||
if (!shipHidAndLevel)
|
||||
return resResult(STATUS.HERO_CONECTION_IS_NOT_EXIT);
|
||||
if (!shipHidAndLevel) return resResult(STATUS.HERO_CONECTION_IS_NOT_EXIT);
|
||||
let hero = await HeroModel.findByHidAndRole(shipHidAndLevel.actorId, roleId);
|
||||
if (!hero)
|
||||
return resResult(STATUS.HERO_NOT_FIND);
|
||||
if (!hero) return resResult(STATUS.HERO_NOT_FIND);
|
||||
|
||||
let heroConnections: Connect[] = deepCopy(hero.connections);
|
||||
let flag = true;
|
||||
let level = 1;
|
||||
for (let conection of hero.connections) {
|
||||
for (let conection of heroConnections) {
|
||||
if (conection.shipId == shipId ) {
|
||||
if (conection.level >= shipHidAndLevel.level) {
|
||||
return resResult(STATUS.HERO_CONECTION_IS_MAX_LEVEL);
|
||||
@@ -366,7 +390,7 @@ export class HeroHandler {
|
||||
}
|
||||
}
|
||||
if (!!flag) {
|
||||
hero.connections.push({shipId, level});
|
||||
heroConnections.push({shipId, level});
|
||||
}
|
||||
let friendShip = getFriendShipById(shipId, level);
|
||||
if (hero.star < friendShip.level)
|
||||
@@ -386,8 +410,8 @@ export class HeroHandler {
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
}
|
||||
//重算战力并下发
|
||||
let heros = await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.CONNECT, [shipId, level]);
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : heros[0].hid, connections : heros[0].connections}});
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.CONNECT, sid, roleId, hero, { connections: heroConnections }, [shipId]);
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : hero.hid, connections : hero.connections}});
|
||||
}
|
||||
|
||||
//赠送(包括一键赠送)
|
||||
@@ -445,8 +469,6 @@ export class HeroHandler {
|
||||
}
|
||||
|
||||
let newLv = getFavourLvByExp(newExp);
|
||||
hero.favour = newExp;
|
||||
hero.favourLv = newLv;
|
||||
|
||||
let result = await handleCost(roleId, sid, material);
|
||||
if(!result) {
|
||||
@@ -454,11 +476,13 @@ export class HeroHandler {
|
||||
}
|
||||
//重算战力并下发
|
||||
if (oldLv != hero.favourLv) {
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.FAVOUR, [oldLv]);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.FAVOUR, sid, roleId, hero, {
|
||||
favour: newExp, favourLv: newLv
|
||||
}, [oldLv]);
|
||||
} else {
|
||||
await HeroModel.updateHeroInfo(roleId, hero.hid, hero);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { curHero: {hid : hero.hid, favour : hero.favour, favourLv : hero.favourLv}});
|
||||
return resResult(STATUS.SUCCESS, { curHero: { hid: hero.hid, favour: hero.favour, favourLv: hero.favourLv } });
|
||||
}
|
||||
|
||||
//穿带时装
|
||||
@@ -467,14 +491,15 @@ export class HeroHandler {
|
||||
let sid: string = session.get('sid');
|
||||
let { id } = msg;
|
||||
let skinInfo = gameData.fashion.get(id);
|
||||
if (!skinInfo)
|
||||
return resResult(STATUS.HERO_SKIN_NOT_FIND);
|
||||
if (!skinInfo) return resResult(STATUS.HERO_SKIN_NOT_FIND);
|
||||
let hero = await HeroModel.findByHidAndRole(skinInfo.actorId, roleId);
|
||||
if (!hero)
|
||||
return resResult(STATUS.HERO_NOT_FIND);
|
||||
if (!hero) return resResult(STATUS.HERO_NOT_FIND);
|
||||
|
||||
let heroSkins = deepCopy(hero.skins);
|
||||
|
||||
let result = false;
|
||||
let lastSkinId: number;
|
||||
for (let skin of hero.skins) {
|
||||
for (let skin of heroSkins) {
|
||||
if (skin.id == id) {
|
||||
if (!!skin.enable) {
|
||||
return resResult(STATUS.HERO_SKIN_IS_EQUIPED);
|
||||
@@ -491,7 +516,7 @@ export class HeroHandler {
|
||||
if (!result) {
|
||||
return resResult(STATUS.HERO_SKIN_NOT_FIND);
|
||||
}
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.SKIN, [id, lastSkinId]);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.SKIN, sid, roleId, hero, { skins: heroSkins }, [id, lastSkinId]);
|
||||
return resResult(STATUS.SUCCESS, {curHero: {hid : hero.hid, skins : hero.skins} });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { STATUS } from '../../../consts/statusCode';
|
||||
import { RoleModel } from './../../../db/Role';
|
||||
import { HeroModel } from '../../../db/Hero';
|
||||
import { resResult, decodeIdCntArrayStr, parseGoodStr, reduceCe } from '../../../pubUtils/util';
|
||||
import {Application, BackendSession} from 'pinus';
|
||||
import { resResult, decodeIdCntArrayStr, parseGoodStr } from '../../../pubUtils/util';
|
||||
import {Application, BackendSession, pinus} from 'pinus';
|
||||
import { handleCost } from '../../../services/rewardService';
|
||||
import { getTitle, getTeraph, gameData, getScollByStar, getFriendLvByExp } from '../../../pubUtils/data';
|
||||
import { SCHOOL, SCROLL } from '../../../pubUtils/dicParam';
|
||||
import { getTeraphAttr, getAtrrNameById } from '../../../consts/constModules/abilityConst'
|
||||
import { getAtrrNameById } from '../../../consts/constModules/abilityConst'
|
||||
import { findIndex } from 'underscore';
|
||||
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
|
||||
import { SchoolModel } from '../../../db/School';
|
||||
@@ -79,11 +79,12 @@ export class RoleHandler {
|
||||
//爵位
|
||||
async roleTitleLevelUp(msg: {}, session: BackendSession){
|
||||
let roleId = session.get('roleId');
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let oldCe = role.ce;
|
||||
let sid: string = session.get('sid');
|
||||
let title = ++role.title;
|
||||
let titleInfo = getTitle(role.title);
|
||||
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
|
||||
let { title } = role;
|
||||
let titleInfo = getTitle(title + 1);
|
||||
if (!titleInfo)
|
||||
return resResult(STATUS.DIC_DATA_NOT_FOUND)
|
||||
if (titleInfo.lvLimited > role.lv)
|
||||
@@ -92,44 +93,47 @@ export class RoleHandler {
|
||||
let result = await handleCost(roleId, sid, consumes);
|
||||
if (!result)
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
await RoleModel.updateRoleInfo(roleId, { title });
|
||||
let {ce} = await calAllHeroCe( sid, roleId, HERO_SYSTEM_TYPE.TITLE, [title]);
|
||||
return resResult(STATUS.SUCCESS, { roleId, title });
|
||||
|
||||
let update = { title: title + 1 }
|
||||
role = await calAllHeroCe(HERO_SYSTEM_TYPE.TITLE, sid, roleId, update);
|
||||
return resResult(STATUS.SUCCESS, { roleId, title: role.title });
|
||||
}
|
||||
|
||||
//神像强化
|
||||
async roleTeraphStrengthen(msg: {id: number, count: number}, session: BackendSession){
|
||||
let {id, count} = msg;
|
||||
let roleId = session.get('roleId');
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let sid: string = session.get('sid');
|
||||
let index = findIndex(role.teraphs, {id});
|
||||
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let teraphs = role.teraphs;
|
||||
let index = findIndex(teraphs, {id});
|
||||
if (index < 0)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
let teraph = role.teraphs[index];
|
||||
let teraphInfo = getTeraph(id, teraph.grade);
|
||||
if (!teraphInfo)
|
||||
return resResult(STATUS.DIC_DATA_NOT_FOUND)
|
||||
let attrs = [];
|
||||
for (let attrName in getTeraphAttr()) {
|
||||
let attrNameMax = attrName+'Max';
|
||||
if (teraph[attrName] < teraphInfo[attrNameMax]) {
|
||||
attrs.push(attrName);
|
||||
let teraph = teraphs[index];
|
||||
let dicTeraph = getTeraph(id, teraph.grade);
|
||||
if (!dicTeraph)
|
||||
return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
let attrs = new Array<number>(); // 可以强化的属性
|
||||
dicTeraph.mainAttrMax.forEach(( max, id) => {
|
||||
let attrName = getAtrrNameById(id);
|
||||
if (teraph[attrName] < max) {
|
||||
attrs.push(id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!attrs.length)
|
||||
return resResult(STATUS.ROLE_TERAPH_NOT_STRENGTHEN);
|
||||
// 随机神像中的一条属性并检查道具是否足够
|
||||
let {attr, consumes} = checkTeraphMaterialEnough(count, attrs, teraphInfo, teraph);
|
||||
for (let key in attr) {
|
||||
teraph[key] += attr[key];
|
||||
role.globalCeAttr[key].fixUp += attr[key];
|
||||
}
|
||||
|
||||
// 随机神像中的一条属性并检查道具是否足够,以及更新teraph
|
||||
let { consumes} = checkTeraphMaterialEnough(count, attrs, dicTeraph, teraph);
|
||||
|
||||
let result = await handleCost(roleId, sid, consumes);
|
||||
if (!result)
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
await RoleModel.updateRoleInfo(roleId, { teraphs: role.teraphs, globalCeAttr: role.globalCeAttr});
|
||||
await calAllHeroCe( sid, roleId);
|
||||
|
||||
role = await calAllHeroCe(HERO_SYSTEM_TYPE.TERAPH, sid, roleId, { teraphs }, [id]);
|
||||
return resResult(STATUS.SUCCESS, { roleId, teraphs: role.teraphs });
|
||||
}
|
||||
|
||||
@@ -137,34 +141,37 @@ export class RoleHandler {
|
||||
async roleTeraphQualityUp(msg: {id: number}, session: BackendSession){
|
||||
let {id} = msg;
|
||||
let roleId = session.get('roleId');
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let sid: string = session.get('sid');
|
||||
let index = findIndex(role.teraphs, {id});
|
||||
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let teraphs = role.teraphs;
|
||||
let index = findIndex(teraphs, {id});
|
||||
if (index < 0)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
let teraph = role.teraphs[index];
|
||||
let teraph = teraphs[index];
|
||||
let teraphInfo = getTeraph(id, teraph.grade);
|
||||
if (!teraphInfo)
|
||||
return resResult(STATUS.DIC_DATA_NOT_FOUND)
|
||||
for (let attrName in getTeraphAttr()) {
|
||||
if (teraph[attrName] != teraphInfo[attrName +'Max'])
|
||||
|
||||
for(let [attrId, val] of teraph.attr) {
|
||||
if (val < teraphInfo.mainAttrMax.get(attrId))
|
||||
return resResult(STATUS.ROLE_TERAPH_NOT_QUILITY);
|
||||
teraph[attrName] = 0;
|
||||
|
||||
teraph.attr.set(attrId, 0);
|
||||
}
|
||||
teraph.grade++;
|
||||
teraph.grade ++;
|
||||
|
||||
|
||||
let nextTeraphInfo = getTeraph(id, teraph.grade)
|
||||
if (!nextTeraphInfo)
|
||||
return resResult(STATUS.DIC_DATA_NOT_FOUND)
|
||||
return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
let consumes = teraphInfo.upGradeMaterial;
|
||||
let result = await handleCost(roleId, sid, consumes);
|
||||
if (!result)
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
for (let {id, number} of nextTeraphInfo.assiAttrValue) {
|
||||
let attrName = getAtrrNameById(id);
|
||||
role.globalCeAttr[attrName].ratioUp += number;
|
||||
}
|
||||
await RoleModel.updateRoleInfo(roleId, { teraphs: role.teraphs, globalCeAttr: role.globalCeAttr});
|
||||
await calAllHeroCe(sid, roleId);
|
||||
|
||||
role = await calAllHeroCe(HERO_SYSTEM_TYPE.TERAPH_UP, sid, roleId, { teraphs }, [id]);
|
||||
return resResult(STATUS.SUCCESS, { roleId, teraphs: role.teraphs });
|
||||
}
|
||||
|
||||
@@ -246,7 +253,7 @@ export class RoleHandler {
|
||||
}
|
||||
|
||||
await SchoolModel.updateBySclAndPos(roleId, schoolId, positionId, { hid, isOpen })
|
||||
await calPlayerCeAndSave(sid, roleId, [], HERO_SYSTEM_TYPE.SCHOOL, [schoolId, hid, preHid]);
|
||||
await calAllHeroCe(HERO_SYSTEM_TYPE.SCHOOL, sid, roleId, {}, [schoolId, hid, preHid]);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
schoolId, positionId, hid, preHid, isOpen
|
||||
@@ -294,7 +301,7 @@ export class RoleHandler {
|
||||
|
||||
let { hid } = msg;
|
||||
|
||||
let curHero = await HeroModel.findByHidAndRole(hid, roleId, 'star colorStar quality scrollId scrollActive scrollStar scrollColorStar scrollQuality favour favourLv');
|
||||
let curHero = await HeroModel.findByHidAndRole(hid, roleId, 'hid star colorStar quality scrollId scrollActive scrollStar scrollColorStar scrollQuality favour favourLv connections attr ce');
|
||||
if (!curHero) return resResult(STATUS.HERO_NOT_FIND);
|
||||
|
||||
let dicHero = gameData.hero.get(hid);
|
||||
@@ -334,12 +341,67 @@ export class RoleHandler {
|
||||
let dicHeroScroll = getScollByStar(dicHero.quality, update.scrollStar, update.scrollQuality, update.scrollColorStar);
|
||||
update.scrollId = dicHeroScroll?dicHeroScroll.id: 0;
|
||||
|
||||
curHero = await HeroModel.updateHeroInfo(roleId, hid, update, 'hid scrollActive scrollId scrollStar scrollColorStar scrollQuality favour favourLv');
|
||||
await calPlayerCeAndSave(sid, roleId, [], HERO_SYSTEM_TYPE.SCROLL, [hid, favourLv]);
|
||||
let hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.SCROLL, sid, roleId, curHero, update); // 更新单个武将战力
|
||||
calAllHeroCe(HERO_SYSTEM_TYPE.SCROLL, sid, roleId, {}, [hid]); // 全局增加战力
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
curHero
|
||||
curHero: {
|
||||
hid: hero.hid,
|
||||
scrollActive: hero.scrollActive,
|
||||
scrollId: hero.scrollId,
|
||||
scrollStar: hero.scrollStar,
|
||||
scrollColorStar: hero.scrollColorStar,
|
||||
scrollQuality: hero.scrollQuality,
|
||||
favour: hero.favour,
|
||||
favourLv: hero.favourLv,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async debugPlayerTime(msg: { type: number }, session: BackendSession) {
|
||||
let { type } = msg;
|
||||
let roleId = session.get('roleId');
|
||||
let sid = session.get('sid');
|
||||
|
||||
if(type == 1) {
|
||||
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
|
||||
isGuest: true,
|
||||
guestTime: 60 * 60, // 游客已体验时间
|
||||
hasAuthenticated: false, // 是否进行过实名认证
|
||||
isAdult: false, // 是否已成年
|
||||
todayPlayTime: 60 * 60, // 今天已游戏时长
|
||||
type: 1
|
||||
} ), [{uid: roleId, sid: sid}]);
|
||||
} else if (type == 2) {
|
||||
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
|
||||
isGuest: false,
|
||||
guestTime: 0, // 游客已体验时间
|
||||
hasAuthenticated: true, // 是否进行过实名认证
|
||||
isAdult: false, // 是否已成年
|
||||
todayPlayTime: 60 * 60, // 今天已游戏时长
|
||||
type: 2
|
||||
} ), [{uid: roleId, sid: sid}]);
|
||||
} else if (type == 3) {
|
||||
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
|
||||
isGuest: false,
|
||||
guestTime: 0, // 游客已体验时间
|
||||
hasAuthenticated: true, // 是否进行过实名认证
|
||||
isAdult: false, // 是否已成年
|
||||
todayPlayTime: 3 * 60 * 60, // 今天已游戏时长
|
||||
type: 3
|
||||
} ), [{uid: roleId, sid: sid}]);
|
||||
} else if (type == 4) {
|
||||
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
|
||||
isGuest: false,
|
||||
guestTime: 0, // 游客已体验时间
|
||||
hasAuthenticated: true, // 是否进行过实名认证
|
||||
isAdult: false, // 是否已成年
|
||||
todayPlayTime: 1.5 * 60 * 60, // 今天已游戏时长
|
||||
type: 4
|
||||
} ), [{uid: roleId, sid: sid}]);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { HeroModel } from './../db/Hero';
|
||||
import { HangUpRecordModel } from './../db/HangUpRecord';
|
||||
import { ChannelService, pinus } from 'pinus';
|
||||
import { pinus } from 'pinus';
|
||||
import { HANG_UP_CONSTS, TOWER_TASK_CONST, REDIS_KEY } from './../consts';
|
||||
import { BattleRecordModel } from './../db/BattleRecord';
|
||||
import { TowerRecordModel } from './../db/TowerRecord';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeSameGoods } from '../pubUtils/util';
|
||||
import { mergeSameGoods, deepCopy } from '../pubUtils/util';
|
||||
import { EquipModel } from "../db/Equip";
|
||||
import { HeroModel, EPlace, HeroType } from "../db/Hero";
|
||||
import { getHeroJob, getGoodById, gameData, getJewelById, getHeroEquipByClassId } from "../pubUtils/data";
|
||||
@@ -77,7 +77,7 @@ export async function changeEquip(roleId: string, sid: string, equip: EquipType,
|
||||
return res;
|
||||
}
|
||||
} else if (!!hero) {//从穿戴装备的武将上卸下装备
|
||||
await takeOffEquipAndCalPlayerCe(roleId, sid, seqId, hero, id);//卸下装备并重算战力
|
||||
await takeOffEquipAndCalPlayerCe(roleId, sid, hero, equip, id);//卸下装备并重算战力
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -88,15 +88,12 @@ export async function changeEquip(roleId: string, sid: string, equip: EquipType,
|
||||
* @param hero
|
||||
* @param id
|
||||
*/
|
||||
export async function takeOffEquipAndCalPlayerCe(roleId: string, sid: string, seqId: number, hero:HeroType, id: number ) {
|
||||
let index = findIndex(hero.ePlace, { id });
|
||||
if (index < 0)
|
||||
return;
|
||||
await EquipModel.updateEquipInfo(seqId, { hid: 0 });
|
||||
hero.ePlace[index].equip = null;
|
||||
export async function takeOffEquipAndCalPlayerCe(roleId: string, sid: string, hero:HeroType, equip: EquipType, id: number ) {
|
||||
let args = calEquipSeids(hero);
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP, args);
|
||||
return { seqId, hid: 0};
|
||||
hero = await HeroModel.removeEquip(roleId, hero.hid, id, equip._id);
|
||||
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
|
||||
return { seqId: equip.seqId, hid: 0};
|
||||
}
|
||||
/**
|
||||
* 穿戴装备并重算战力
|
||||
@@ -106,9 +103,10 @@ export async function takeOffEquipAndCalPlayerCe(roleId: string, sid: string, se
|
||||
* @param equip
|
||||
*/
|
||||
export async function dressEquip(roleId: string, sid: string, hero:HeroType, equip: EquipType) {
|
||||
hero = await HeroModel.addEquip(roleId, hero.hid, equip.ePlaceId, equip._id);
|
||||
let args = calEquipSeids(hero);
|
||||
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP, args);
|
||||
|
||||
hero = await HeroModel.addEquip(roleId, hero.hid, equip.ePlaceId, equip._id);
|
||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
|
||||
return { seqId: equip.seqId, hid: hero.hid };
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -3,9 +3,9 @@ import { ExpeditionPointModel } from '../db/ExpeditionPoint';
|
||||
import Role, { RoleModel, RoleType } from '../db/Role';
|
||||
import { PvpDefenseModel } from '../db/PvpDefense';
|
||||
|
||||
import { getWarJsons, getGamedata, getExpeditionById } from '../pubUtils/gamedata';
|
||||
import { decodeStr, resResult, shouldRefresh } from '../pubUtils/util';
|
||||
import { EXPEDITION_CONST, HERO_CE_RATIO, getAttrCeRatio } from '../consts';
|
||||
import { getWarJsons, getGamedata } from '../pubUtils/gamedata';
|
||||
import { decodeStr, shouldRefresh } from '../pubUtils/util';
|
||||
import { EXPEDITION_CONST, HERO_CE_RATIO } from '../consts';
|
||||
import { getAtrrNameById} from '../consts';
|
||||
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
|
||||
import { HeroType } from '../db/Hero';
|
||||
@@ -75,7 +75,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
|
||||
let result = resultRange[index];
|
||||
let {roleId, heroes, defCe } = result;
|
||||
let role = <RoleType>result.role;
|
||||
let { globalCeAttr } = role;
|
||||
let { attr: roleAttrs } = role;
|
||||
|
||||
enemyObj.enemyFrom = 1;
|
||||
enemyObj.enemyId = roleId;
|
||||
@@ -87,9 +87,9 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
|
||||
let hero = heroes[heroIndex];
|
||||
if(hero) {
|
||||
let h = <HeroType>hero.hero;
|
||||
let { star, lv, ceAttr } = h;
|
||||
let { star, lv, attr: heroAttrs } = h;
|
||||
let dicHero = gameData.hero.get(hero.actorId);
|
||||
let newAttribute = getPlayerAttribute(ceAttr, globalCeAttr);
|
||||
let newAttribute = getPlayerAttribute(heroAttrs, roleAttrs);
|
||||
let heroInfo = {
|
||||
actorId: hero.actorId,
|
||||
actorName: dicHero.name,
|
||||
@@ -127,10 +127,7 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number,
|
||||
const { attribute } = json;
|
||||
|
||||
let newAttribute = getRobotAttribute(attribute, myCe, robotCe, scale);
|
||||
let ce = 0;
|
||||
for(let attrName in newAttribute) {
|
||||
ce += newAttribute[attrName] * getAttrCeRatio(attrName)||0;
|
||||
}
|
||||
let ce = newAttribute.calCelAndReduce();
|
||||
enemyObj.enemies.push({...json, attribute: newAttribute, lv});
|
||||
allCe += ce;
|
||||
}
|
||||
@@ -156,21 +153,6 @@ export async function getCEScaleAndRange(roleId: string, curDicExpedition: any)
|
||||
return {scale, range, lv: role.lv}
|
||||
}
|
||||
|
||||
// 远征表属性解码
|
||||
export function decodeWarJsonAttribute(attribute: string) {
|
||||
let arr = decodeStr('attribute', attribute);
|
||||
// 初始化
|
||||
let obj = {hp: 0, atk: 0, matk: 0, def: 0, mdef: 0, speed: 0, agi: 0, luk: 0, hit: 0, cri: 0, flee: 0, antCri: 0, damageIncrease: 0, damageDecrease: 0, defIngnore: 0, bloodSuck: 0}
|
||||
|
||||
for(let {id, value} of arr) {
|
||||
let field = getAtrrNameById(id);
|
||||
if(field) {
|
||||
obj[field] = value;
|
||||
}
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
// 远征累计点数获取
|
||||
export async function getPointRewardStatus(roleId: string, role?: Role) {
|
||||
if(!role) {
|
||||
|
||||
@@ -7,22 +7,26 @@ import { STATUS } from '../consts/statusCode';
|
||||
|
||||
import { resResult, reduceCe } from '../pubUtils/util';
|
||||
import { calPlayerCeAndSave as pubCalPlayerCeAndSave, reCalAllHeroCe } from '../pubUtils/playerCe';
|
||||
import { HeroType } from '../db/Hero';
|
||||
import Hero, { HeroType, HeroUpdate } from '../db/Hero';
|
||||
import { defaultHeroes } from './pvpService';
|
||||
import { RoleUpdate } from '../db/Role';
|
||||
|
||||
//修改并下发战力
|
||||
export async function calPlayerCeAndSave(sid: string, roleId: string, heros: Array<HeroType>, type?: number, args?: Array<number>) {
|
||||
let {role, pushHeros, topLineupCe} = await pubCalPlayerCeAndSave(roleId, heros, type, args);
|
||||
export async function calPlayerCeAndSave(type: number, sid: string, roleId: string, originHero: HeroType, update: HeroUpdate, args?: Array<number>) {
|
||||
let {role, pushHeros, topLineupCe, hero} = await pubCalPlayerCeAndSave(type, roleId, originHero, update, args);
|
||||
console.log(JSON.stringify(pushHeros))
|
||||
//下发战力
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(role.ce) , heros: pushHeros, topLineupCe: reduceCe(topLineupCe) }), uids);
|
||||
defaultHeroes(role);
|
||||
return heros;
|
||||
return hero;
|
||||
}
|
||||
|
||||
export async function calAllHeroCe(sid: string, roleId: string, type?:number, args?:Array<number>) {
|
||||
let {ce, pushHeros, topLineupCe }= await reCalAllHeroCe(roleId, type, args);
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(ce), heros: pushHeros, topLineupCe: reduceCe(topLineupCe) }), uids);
|
||||
return {ce: reduceCe(ce)};
|
||||
export async function calAllHeroCe(type:number, sid: string, roleId: string, update: RoleUpdate, args?:Array<number>) {
|
||||
let {role, ce, pushHeros, topLineupCe } = await reCalAllHeroCe(type, roleId, update, args);
|
||||
if(pushHeros.length > 0) {
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(ce), heros: pushHeros, topLineupCe: reduceCe(topLineupCe) }), uids);
|
||||
}
|
||||
return role;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { PVP_HERO_POS, ROBOT_NAME, REDIS_KEY, PVP_CONST, HERO_CE_RATIO } from '.
|
||||
import { setPvpDefResult } from '../services/timeTaskService';
|
||||
import { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent";
|
||||
import { getRandomIndexByLen, genCode, getRandomByLen, shouldRefresh, reduceCe, getChineseName } from '../pubUtils/util';
|
||||
import { oppPlayersInter, pvpEndParamInter, Attributes } from '../pubUtils/interface';
|
||||
import { oppPlayersInter, pvpEndParamInter } from '../pubUtils/interface';
|
||||
import { RankParam } from '../domain/rank';
|
||||
import { gameData, getPLvByScore } from "../pubUtils/data";
|
||||
import { PVP } from '../pubUtils/dicParam';
|
||||
@@ -14,7 +14,7 @@ import { setRank, getMyRank, getFieldByRank } from './redisService';
|
||||
import { nowSeconds, checkTodayTime } from '../pubUtils/timeUtil';
|
||||
import { HeroesRecord } from '../db/PvpRecord';
|
||||
import { HeroModel, HeroType } from '../db/Hero';
|
||||
import { CeAttrNumber, CeAttr, CeAttrRole, MainAttrNumber } from '../domain/roleField/attribute';
|
||||
import { MainAttrNumber, Attribute, CeAttrData, CeAttrDataRole } from '../domain/roleField/attribute';
|
||||
import { PvpEnemies, PvpHeroInfo, PvpOtherHeroes } from '../domain/dbGeneral';
|
||||
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
||||
import { findWhere, findIndex } from 'underscore';
|
||||
@@ -213,7 +213,7 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, mapWarJson: DicWarJ
|
||||
let heroInfo = new PvpHeroInfo();
|
||||
heroInfo.setHeroInfo(dbHero);
|
||||
heroInfo.setOutIndex(h.order);
|
||||
let attribute = getPlayerAttribute(dbHero.ceAttr, role.globalCeAttr);
|
||||
let attribute = getPlayerAttribute(dbHero.attr, role.attr);
|
||||
heroInfo.setAttribute(attribute);
|
||||
let enemy = new PvpEnemies(warJson, heroInfo, hs?hs.score: 0);
|
||||
heroes.push(enemy);
|
||||
@@ -491,16 +491,13 @@ export async function findPvpDefAllByRoleId(roleId: string) {
|
||||
* @param enemyCe 出兵表对手战力
|
||||
* @param ratio 系数
|
||||
*/
|
||||
export function getRobotAttribute(attribute: Attributes, ce: number, enemyCe: number, ratio: number) {
|
||||
export function getRobotAttribute(attribute: {id: number, val: number}[], ce: number, enemyCe: number, ratio: number) {
|
||||
|
||||
let newAttribute = new CeAttrNumber();
|
||||
for(let attrName in newAttribute) {
|
||||
newAttribute[attrName] = Math.floor(attribute[attrName] * ce / enemyCe * ratio);
|
||||
}
|
||||
newAttribute['speed'] = 0;
|
||||
newAttribute['ap'] = 0;
|
||||
let newAttribute = new Attribute();
|
||||
newAttribute.setByWarJson(attribute, ce / enemyCe * ratio);
|
||||
let attrJson = newAttribute.getReduceAttributes();
|
||||
|
||||
return newAttribute;
|
||||
return attrJson;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,18 +505,12 @@ export function getRobotAttribute(attribute: Attributes, ce: number, enemyCe: nu
|
||||
* @param ceAttr hero表的ceAttr
|
||||
* @param globalCeAttr role表中的globalCeAttr
|
||||
*/
|
||||
export function getPlayerAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
||||
let newAttribute = new CeAttrNumber();
|
||||
for(let attrName in newAttribute) {
|
||||
let { base, ratioUp, fixUp, equipUp } = ceAttr[attrName];
|
||||
let { ratioUp: ratioUp2, fixUp: fixUp2 } = globalCeAttr[attrName];
|
||||
let result = base * ( HERO_CE_RATIO + ratioUp + ratioUp2) + (fixUp + fixUp2 + equipUp) * HERO_CE_RATIO;
|
||||
newAttribute[attrName] += reduceCe(result);
|
||||
}
|
||||
newAttribute['speed'] = 0;
|
||||
newAttribute['ap'] = 0;
|
||||
export function getPlayerAttribute(heroAttrs: CeAttrData[] = [], roleAttrs: CeAttrDataRole[] = []) {
|
||||
let newAttribute = new Attribute();
|
||||
newAttribute.setByDbData(roleAttrs, heroAttrs);
|
||||
let attrJson = newAttribute.getReduceAttributes();
|
||||
|
||||
return newAttribute;
|
||||
return attrJson;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -527,8 +518,8 @@ export function getPlayerAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
||||
* @param ceAttr
|
||||
* @param globalCeAttr
|
||||
*/
|
||||
export function getPlayerMainAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
||||
let attribute = getPlayerAttribute(ceAttr, globalCeAttr);
|
||||
export function getPlayerMainAttribute(heroAttrs: CeAttrData[], roleAttrs: CeAttrDataRole[]) {
|
||||
let attribute = getPlayerAttribute(heroAttrs, roleAttrs);
|
||||
let mainAttributes = new MainAttrNumber(attribute);
|
||||
|
||||
return mainAttributes;
|
||||
|
||||
@@ -10,6 +10,7 @@ import { SystemConfigModel } from '../db/SystemConfig';
|
||||
import { GuildRankParam, GuildLeader, RankParam } from '../domain/rank';
|
||||
import { GuildModel } from '../db/Guild';
|
||||
import { comBtlRanges } from '../pubUtils/gamedata';
|
||||
import { stringify } from 'querystring';
|
||||
/**
|
||||
* 在服务重新启动时,将信息存入redis
|
||||
*/
|
||||
@@ -366,8 +367,8 @@ export async function clearChannelServers() {
|
||||
* @param userCode user表唯一字符串标识
|
||||
* @param sid connector服的那个sid
|
||||
*/
|
||||
export async function roleLogin(roleId: string, userCode: string, sid: string) {
|
||||
let param = { userCode, sid };
|
||||
export async function roleLogin(roleId: string, userCode: string, sid: string, pkgName: string) {
|
||||
let param = { userCode, sid, pkgName };
|
||||
return await redisClient().hsetAsync(REDIS_KEY.ONLINE_USERS, roleId, JSON.stringify(param));
|
||||
}
|
||||
|
||||
@@ -400,7 +401,8 @@ export async function getRoleOnlineInfo(roleId: string) {
|
||||
return {
|
||||
isOnline: true,
|
||||
userCode: result.userCode,
|
||||
sid: result.sid
|
||||
sid: result.sid,
|
||||
pkgName: result.pkgName
|
||||
}
|
||||
} catch(e) {
|
||||
return { isOnline: false }
|
||||
@@ -414,8 +416,20 @@ export async function getRoleOnlineInfo(roleId: string) {
|
||||
* 获得所有在线的玩家
|
||||
*/
|
||||
export async function getAllOnlineRoles() {
|
||||
const client: Redis.RedisClient = pinus.app.get('redis');
|
||||
let allRoles = await redisClient().hgetallAsync(REDIS_KEY.ONLINE_USERS);
|
||||
return allRoles;
|
||||
let result = new Array<{roleId: string, userCode: string, sid: string, pkgName: string}>();
|
||||
for(let roleId in allRoles) {
|
||||
try{
|
||||
let param = JSON.parse(allRoles[roleId]);
|
||||
if(param) {
|
||||
result.push({ roleId, userCode: param.userCode, sid: param.sid, pkgName: param.pkgName });
|
||||
}
|
||||
} catch(e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function resetPvpRanks() {
|
||||
|
||||
@@ -9,7 +9,7 @@ interface UserCache {
|
||||
var userCacheMap = new Map<string, UserCache>();
|
||||
|
||||
export function init() {
|
||||
scheduleJob("0/5 * * * * *", clearDirtyData, {name:'clearDirtyData'});//每个5秒钟,释放redis锁
|
||||
scheduleJob('clearDirtyData', "0/5 * * * * *", clearDirtyData);//每个5秒钟,释放redis锁
|
||||
}
|
||||
/**
|
||||
* 释放锁
|
||||
|
||||
@@ -156,7 +156,7 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
}
|
||||
}
|
||||
if (!!skinInfos.length) {
|
||||
calAllHeroCe(sid, roleId, HERO_SYSTEM_TYPE.ADD_SKIN, addSkinIds)
|
||||
calAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, sid, roleId, {}, addSkinIds);
|
||||
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, {skinInfos}), uids);
|
||||
}
|
||||
return showItems;
|
||||
|
||||
@@ -3,44 +3,47 @@ import { Channel } from 'pinus';
|
||||
import { getRandNum, getRandomArr } from '../pubUtils/util';
|
||||
import { TERAPH_RANDOM } from "../consts/consts";
|
||||
import { indexOf } from 'underscore';
|
||||
import { DicTeraph } from '../pubUtils/dictionary/DicTeraph';
|
||||
import { Teraph } from '../db/Role';
|
||||
const TERAPH_STRENGTHEN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
/**
|
||||
* 计算强化次数和消耗
|
||||
* @param count 强化次数
|
||||
* @param attrNames 可以强化的属性名字
|
||||
* @param attrs 可以强化的属性名字
|
||||
* @param teraphInfo 字典表对应的神像信息
|
||||
* @param teraph
|
||||
* @param teraph 数据库内单个神像信息
|
||||
*/
|
||||
export function checkTeraphMaterialEnough(count: number, attrNames:Array<any>, teraphInfo: any, teraph: any) {
|
||||
let res = {};
|
||||
export function checkTeraphMaterialEnough(count: number, attrs:number[], teraphInfo: DicTeraph, teraph: Teraph) {
|
||||
let consumes = [];
|
||||
let times = 0;
|
||||
if (count < 10) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
if (!attrNames.length) {
|
||||
if (!attrs.length) {
|
||||
break;
|
||||
}
|
||||
let num = getRandNum(TERAPH_RANDOM.MIN, TERAPH_RANDOM.MAX);
|
||||
let arr = getRandomArr(attrNames, num)
|
||||
let num = getRandNum(TERAPH_RANDOM.MIN, TERAPH_RANDOM.MAX); // 强化时随机增加 2-4 属性
|
||||
let arr: number[] = getRandomArr(attrs, num); // 随机出的属性id
|
||||
let critical = getRandNum(0, 100);//属性暴击率
|
||||
let criEffect = 1;
|
||||
let criEffect = 1; // 暴击效果
|
||||
if (critical <= teraphInfo.criRate)
|
||||
criEffect = teraphInfo.criEffect;
|
||||
for (let attrName of arr) {
|
||||
let attrNameMax = attrName+'Max';
|
||||
res[attrName] = teraphInfo[attrName] * criEffect;
|
||||
if (teraph[attrName] + res[attrName] > teraphInfo[attrNameMax]) {
|
||||
res[attrName] = teraphInfo[attrNameMax] - teraph[attrName];
|
||||
let attrIndex = indexOf(attrNames, attrName);
|
||||
attrNames.splice(attrIndex, 1);
|
||||
for (let attrId of arr) {
|
||||
let val = teraph.attr.get(attrId); // 已有的强化值
|
||||
val += teraphInfo.mainAttrUp.get(attrId) * criEffect;
|
||||
let max = teraphInfo.mainAttrMax.get(attrId);
|
||||
if(val > max) {
|
||||
val = max;
|
||||
let attrIndex = attrs.indexOf(attrId);
|
||||
attrs.splice(attrIndex, 1);
|
||||
}
|
||||
teraph.attr.set(attrId, val);
|
||||
}
|
||||
times++;
|
||||
}
|
||||
} else if (count == 10){
|
||||
let criticalArrTimes = getRandomArr(TERAPH_STRENGTHEN, 2);//10次中随机2次发生暴击
|
||||
for (let item of TERAPH_STRENGTHEN) {
|
||||
if (!attrNames.length) {
|
||||
if (!attrs.length) {
|
||||
break;
|
||||
}
|
||||
let criEffect = 1;
|
||||
@@ -49,24 +52,27 @@ export function checkTeraphMaterialEnough(count: number, attrNames:Array<any>, t
|
||||
criEffect = teraphInfo.criEffect;//本次是暴击 item 在 criticalArrTimes 中
|
||||
}
|
||||
let num = getRandNum(TERAPH_RANDOM.MIN, TERAPH_RANDOM.MAX);
|
||||
let arr = getRandomArr(attrNames, num);
|
||||
for (let attrName of arr) {
|
||||
res[attrName] = (res[attrName]||0) + teraphInfo[attrName] * criEffect;
|
||||
let attrNameMax = attrName+'Max';
|
||||
if (teraph[attrName] + res[attrName] > teraphInfo[attrNameMax]) {
|
||||
res[attrName] = teraphInfo[attrNameMax] - teraph[attrName];
|
||||
let attrIndex = indexOf(attrNames, attrName);
|
||||
attrNames.splice(attrIndex, 1);
|
||||
let arr: number[] = getRandomArr(attrs, num);
|
||||
for (let attrId of arr) {
|
||||
let val = teraph.attr.get(attrId); // 已有的强化值
|
||||
val += teraphInfo.mainAttrUp.get(attrId) * criEffect;
|
||||
let max = teraphInfo.mainAttrMax.get(attrId);
|
||||
|
||||
if(val > max) {
|
||||
val = max;
|
||||
let attrIndex = attrs.indexOf(attrId);
|
||||
attrs.splice(attrIndex, 1);
|
||||
}
|
||||
teraph.attr.set(attrId, val);
|
||||
}
|
||||
times++;
|
||||
}
|
||||
}
|
||||
//计算消耗
|
||||
for (let {id, count} of teraphInfo.upMaterial) {
|
||||
consumes.push({ id, count: count*times});
|
||||
consumes.push({ id, count: count * times});
|
||||
}
|
||||
return {attr: res, consumes};
|
||||
return { consumes};
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -3,12 +3,12 @@ import { scheduleJob, Job } from 'node-schedule';
|
||||
import { SystemConfigModel } from '../db/SystemConfig';
|
||||
import PvpDefenseType,{ PvpDefenseModel } from '../db/PvpDefense';
|
||||
import { PVP } from '../pubUtils/dicParam';
|
||||
import { nowSeconds, getTodayZeroPoint } from '../pubUtils/timeUtil';
|
||||
import { nowSeconds, getTodayZeroPoint, getAge } from '../pubUtils/timeUtil';
|
||||
import { getPvpGkWarIds, getPvpRankRewards, getPvpHeroRewards, getResultMaxRank } from '../pubUtils/data';
|
||||
import { deepCopy, getRandomArr, resResult } from '../pubUtils/util';
|
||||
import { deepCopy, getRandomArr, resResult, shouldRefresh } from '../pubUtils/util';
|
||||
import { getLvByScore } from './pvpService';
|
||||
import { getMyRank, setRank, resetPvpRanks } from './redisService';
|
||||
import { MAIL_TYPE, REDIS_KEY } from '../consts';
|
||||
import { getMyRank, setRank, resetPvpRanks, getAllOnlineRoles } from './redisService';
|
||||
import { MAIL_TYPE, REDIS_KEY, ADULT_AGE, GUEST_MAX_TIME, ADDICTION_PREVENTION_CODE } from '../consts';
|
||||
import { RankParam } from '../domain/rank';
|
||||
import { RoleModel } from '../db/Role';
|
||||
import { MailModel, MailType } from '../db/Mail';
|
||||
@@ -18,6 +18,8 @@ import { PvpSeasonResultModel } from '../db/PvpSeasonResult';
|
||||
import { settleGuildWeekly } from './guildService';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { getMailContent, sendMail } from './mailService';
|
||||
import { reportOnline } from '../pubUtils/httpUtil';
|
||||
import User, { UserModel } from '../db/User';
|
||||
const PER_SECOND = 1 * 1000;
|
||||
const PER_DAY = 24 * 60 * 60;
|
||||
const SETTLE_DIFF = 29 * 60;
|
||||
@@ -34,7 +36,7 @@ export async function init() {
|
||||
let seasonEndTime = 0;
|
||||
let systemConfig = await SystemConfigModel.findSystemConfig();//系统全局参数表
|
||||
if (!systemConfig) {
|
||||
console.log('create season seasonNum = '+ systemConfig.seasonNum);
|
||||
console.log('create season seasonNum = '+ systemConfig?.seasonNum);
|
||||
let warIds = getPvpGkWarIds();
|
||||
let warId = warIds[0];
|
||||
seasonEndTime = PVP.PVP_SEASON_DAYS * PER_DAY + getTodayZeroPoint();
|
||||
@@ -50,21 +52,27 @@ export async function init() {
|
||||
}
|
||||
}
|
||||
let settleTime = (seasonEndTime - SETTLE_DIFF)* PER_SECOND;
|
||||
seasonJobId = scheduleJob(settleTime, setPvpSeasonResult, { name: 'setPvpSeasonResult' });//设置实际赛季结算时间
|
||||
seasonJobId = scheduleJob('setPvpSeasonResult', settleTime, setPvpSeasonSchdule);//设置实际赛季结算时间
|
||||
|
||||
seasonEndTimeJobId = scheduleJob(seasonEndTime* PER_SECOND, resetPvpRanks, { name: 'resetRank' });//由于24之后,才展示结算之后的信息,为保排行榜信息一致性,设置实际重置排行榜的时间为12点
|
||||
seasonEndTimeJobId = scheduleJob('resetRank', seasonEndTime * PER_SECOND, resetPvpRanks);//由于24之后,才展示结算之后的信息,为保排行榜信息一致性,设置实际重置排行榜的时间为12点
|
||||
warJobId = scheduleJob("0 0 0 * * 1", resetPvpWarId);//每周1零点重置地图
|
||||
await resetPvpRanks();//服务器重启,重置排行榜的信息
|
||||
|
||||
// 周功勋结算任务
|
||||
guildWeeklyJobId = scheduleJob('0 0 0 * * 1', settleGuildWeekly, { name: 'settleGuildWeekly' });
|
||||
guildWeeklyJobId = scheduleJob('settleGuildWeekly', '0 0 0 * * 1', settleGuildWeekly);
|
||||
|
||||
scheduleJob('reportOnline', '0 0/5 * * * *', reportOnlineSchedule)
|
||||
}
|
||||
|
||||
function setPvpSeasonSchdule() {
|
||||
setPvpSeasonResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* pvp定时任务赛季结算
|
||||
* @param obj
|
||||
*/
|
||||
export async function setPvpSeasonResult(obj:{ name:string, notSetNext?: boolean, notPush?: boolean }) {
|
||||
export async function setPvpSeasonResult(obj?:{ name:string, notSetNext?: boolean, notPush?: boolean }) {
|
||||
console.log('exce setPvpSeasonResult'+ obj?.name);
|
||||
let { seasonNum, seasonEndTime, oldSeasonEndTime } = await setNextPvpTime(obj?.notSetNext);//设置下个结算任务
|
||||
let resultMaxRank = getResultMaxRank();//根据排行榜的奖励表,获得最大排名挡位的最小值,其余不在结算中结算的玩家按照最大排名挡位在登录或进入pvp时结算
|
||||
@@ -214,8 +222,8 @@ async function setNextPvpTime(notSetNext: boolean) {
|
||||
seasonEndTime = (PVP.PVP_SEASON_DAYS + 1) * PER_DAY + getTodayZeroPoint();
|
||||
await SystemConfigModel.updateSeason(seasonEndTime, oldSeasonEndTime);
|
||||
let settleTime = (seasonEndTime - SETTLE_DIFF)* PER_SECOND;
|
||||
seasonJobId = scheduleJob(settleTime, setPvpSeasonResult, { name: 'setPvpSeasonResult' });
|
||||
seasonEndTimeJobId = scheduleJob(seasonEndTime* PER_SECOND, resetPvpRanks, { name: 'resetRank' });
|
||||
seasonJobId = scheduleJob('setPvpSeasonResult', settleTime, setPvpSeasonSchdule);
|
||||
seasonEndTimeJobId = scheduleJob('resetRank', seasonEndTime* PER_SECOND, resetPvpRanks);
|
||||
return { seasonEndTime, seasonNum: seasonNum + 1, oldSeasonEndTime };
|
||||
}
|
||||
|
||||
@@ -254,6 +262,51 @@ export async function resetPvpSeasonTime(hour: number) {
|
||||
}
|
||||
let settleTime = (seasonEndTime - SETTLE_DIFF)* PER_SECOND;
|
||||
console.log('settleTime = ' + settleTime)
|
||||
seasonJobId = scheduleJob(settleTime, setPvpSeasonResult, { name: 'setPvpSeasonResult' });
|
||||
seasonJobId = scheduleJob('setPvpSeasonResult', settleTime, setPvpSeasonSchdule);
|
||||
return { seasonEndTime, seasonNum };
|
||||
}
|
||||
|
||||
|
||||
export async function reportOnlineSchedule() {
|
||||
let allRoles = await getAllOnlineRoles();
|
||||
console.log('reportOnlineSchedule all roles count: ', allRoles.length)
|
||||
for(let { roleId, userCode, sid, pkgName } of allRoles) {
|
||||
let result = await reportOnline(userCode, pkgName); // 连接sdk
|
||||
if(!result || result.code == -1) continue;
|
||||
|
||||
let user = await UserModel.findUserByUserCode(userCode);
|
||||
if(!user) continue;
|
||||
let { reportTime = new Date(), lastLoginTime = new Date(), guestTime, isGuest, hasAuthenticated, birthday } = user;
|
||||
|
||||
let age = getAge(birthday);
|
||||
let isAdult = age >= ADULT_AGE;
|
||||
|
||||
if(result.code != ADDICTION_PREVENTION_CODE.SUCCESS) { // 未成年人防沉迷
|
||||
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
|
||||
isGuest,
|
||||
guestTime, // 游客已体验时间
|
||||
hasAuthenticated, // 是否进行过实名认证
|
||||
isAdult, // 是否已成年
|
||||
todayPlayTime: result.total, // 今天已游戏时长
|
||||
type: result.code
|
||||
} ), [{uid: roleId, sid: sid}]);
|
||||
} else {
|
||||
let lastTime = lastLoginTime > reportTime? lastLoginTime.getTime(): reportTime.getTime();
|
||||
let guestTimeInc = Math.floor((Date.now() - lastTime)/1000);
|
||||
user = await UserModel.updatePlayTime(userCode, guestTimeInc, result.total); // 记录时间
|
||||
|
||||
guestTime = user.guestTime;
|
||||
if (isGuest && guestTime > GUEST_MAX_TIME) {
|
||||
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
|
||||
isGuest,
|
||||
guestTime, // 游客已体验时间
|
||||
hasAuthenticated, // 是否进行过实名认证
|
||||
isAdult, // 是否已成年
|
||||
todayPlayTime: result.total, // 今天已游戏时长
|
||||
type: ADDICTION_PREVENTION_CODE.GUEST,
|
||||
} ), [{uid: roleId, sid: sid}]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ function main (){
|
||||
let env = args[0];
|
||||
if(args[0] == 'stable') {
|
||||
env = 'production';
|
||||
}
|
||||
}
|
||||
|
||||
let configObject = {
|
||||
env: env
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
module.exports = {
|
||||
'development': {
|
||||
'mongo': 'mongodb://127.0.0.1/zyz',
|
||||
'redis': '127.0.0.1'
|
||||
'redis': '127.0.0.1',
|
||||
'redispw': 'zyz_2020'
|
||||
},
|
||||
|
||||
'production': {
|
||||
'mongo': 'mongodb://dbop:zyzdbopbantu@dds-8vbdb47c6fb58a541.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vbdb47c6fb58a542.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-500808098',
|
||||
'redis': 'r-8vb4i2kgl91886fkxd.redis.zhangbei.rds.aliyuncs.com'
|
||||
'redis': 'r-8vb4i2kgl91886fkxd.redis.zhangbei.rds.aliyuncs.com',
|
||||
'redispw': 'zyz_2020'
|
||||
},
|
||||
'alpha': {
|
||||
'mongo': 'mongodb://dbop:zyzdbopbantu@dds-8vbdb47c6fb58a541.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vbdb47c6fb58a542.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-500808098',
|
||||
'redis': 'r-8vb4i2kgl91886fkxd.redis.zhangbei.rds.aliyuncs.com'
|
||||
'redis': 'r-8vb4i2kgl91886fkxd.redis.zhangbei.rds.aliyuncs.com',
|
||||
'redispw': 'zyz_2020'
|
||||
},
|
||||
'dev': {
|
||||
'mongo': 'mongodb://dbop:zyzdbopbantu@dds-8vbdb47c6fb58a541.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vbdb47c6fb58a542.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-500808098',
|
||||
'redis': 'r-8vb4i2kgl91886fkxd.redis.zhangbei.rds.aliyuncs.com'
|
||||
'redis': 'r-8vb4i2kgl91886fkxd.redis.zhangbei.rds.aliyuncs.com',
|
||||
'redispw': 'zyz_2020'
|
||||
},
|
||||
'isbn': {
|
||||
'mongo': 'mongodb://root:Bantus123@dds-8vb74337eab84d641.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb74337eab84d642.mongodb.zhangbei.rds.aliyuncs.com:3717/admin?replicaSet=mgset-504694158',
|
||||
'redis': 'r-8vbekkbb3z8ru2ckuj.redis.zhangbei.rds.aliyuncs.com',
|
||||
'redispw': 'zyz_isbn_2021'
|
||||
}
|
||||
};
|
||||
170
game-server/config/isbn/log4js.pro.ts
Normal file
170
game-server/config/isbn/log4js.pro.ts
Normal file
@@ -0,0 +1,170 @@
|
||||
module.exports = {
|
||||
'appenders': {
|
||||
'console': {
|
||||
'type': 'console'
|
||||
},
|
||||
'logger': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/logger.log',
|
||||
'pattern': 'connector',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/log.log',
|
||||
'pattern': 'connector',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'con-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/con-log-${opts:serverId}.log',
|
||||
'pattern': 'connector',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'rpc-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/rpc-log-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'forward-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/forward-log-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'rpc-debug': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/rpc-debug-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'crash-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/crash.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'admin-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/admin.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'pinus': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/pinus-default.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'error': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/error.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'pinus-admin': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/pinus-admin.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'pinus-rpc': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/pinus-rpc-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
}
|
||||
},
|
||||
|
||||
'categories': {
|
||||
'default': {
|
||||
'appenders': ['console'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'pinus': {
|
||||
'appenders': ['console', 'pinus'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'con-log': {
|
||||
'appenders': ['console', 'log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'rpc-log': {
|
||||
'appenders': ['console', 'log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'forward-log': {
|
||||
'appenders': ['console', 'log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'rpc-debug': {
|
||||
'appenders': ['console', 'log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'crash-log': {
|
||||
'appenders': ['console', 'crash-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'admin-log': {
|
||||
'appenders': ['console', 'log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'pinus-admin': {
|
||||
'appenders': ['console', 'log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'pinus-rpc': {
|
||||
'appenders': ['console', 'log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'logger': {
|
||||
'appenders': ['console', 'logger'],
|
||||
'level': 'error'
|
||||
}
|
||||
},
|
||||
|
||||
'prefix': '${opts:serverId} ',
|
||||
'replaceConsole': true,
|
||||
'lineDebug': false,
|
||||
'errorStack': true
|
||||
};
|
||||
134
game-server/config/isbn/log4js.ts
Normal file
134
game-server/config/isbn/log4js.ts
Normal file
@@ -0,0 +1,134 @@
|
||||
module.exports = {
|
||||
'appenders': {
|
||||
'console': {
|
||||
'type': 'console'
|
||||
},
|
||||
'con-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/con-log-${opts:serverId}.log',
|
||||
'pattern': 'connector',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'rpc-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/rpc-log-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'forward-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/forward-log-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'rpc-debug': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/rpc-debug-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'crash-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/crash.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'admin-log': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/admin.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'pinus': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/pinus-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'pinus-admin': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/pinus-admin.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
},
|
||||
'pinus-rpc': {
|
||||
'type': 'file',
|
||||
'filename': '${opts:base}/logs/pinus-rpc-${opts:serverId}.log',
|
||||
'maxLogSize': 1048576,
|
||||
'layout': {
|
||||
'type': 'basic'
|
||||
},
|
||||
'backups': 5
|
||||
}
|
||||
},
|
||||
|
||||
'categories': {
|
||||
'default': {
|
||||
'appenders': ['console', 'pinus'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'con-log': {
|
||||
'appenders': ['con-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'rpc-log': {
|
||||
'appenders': ['rpc-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'forward-log': {
|
||||
'appenders': ['forward-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'rpc-debug': {
|
||||
'appenders': ['rpc-debug'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'crash-log': {
|
||||
'appenders': ['crash-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'admin-log': {
|
||||
'appenders': ['admin-log'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'pinus-admin': {
|
||||
'appenders': ['pinus-admin'],
|
||||
'level': 'debug'
|
||||
},
|
||||
'pinus-rpc': {
|
||||
'appenders': ['pinus-rpc'],
|
||||
'level': 'debug'
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
'prefix': '${opts:serverId} ',
|
||||
'replaceConsole': true,
|
||||
'lineDebug': false,
|
||||
'errorStack': true
|
||||
};
|
||||
@@ -18,5 +18,10 @@ module.exports = {
|
||||
'id': 'master-server-1',
|
||||
'host': '127.0.0.1',
|
||||
'port': 3005
|
||||
},
|
||||
'isbn': {
|
||||
'id': 'master-server-1',
|
||||
'host': '127.0.0.1',
|
||||
'port': 3005
|
||||
}
|
||||
};
|
||||
@@ -63,11 +63,11 @@ declare module 'redis' {
|
||||
}
|
||||
}
|
||||
|
||||
export function connectRedis(redisArr: string) {
|
||||
export function connectRedis(redisArr: string, redisPw: string) {
|
||||
|
||||
// 创建 redis 连接
|
||||
const oldRedisClient = Redis.createClient(6379, redisArr, {detect_buffers: true});
|
||||
oldRedisClient.auth('zyz_2020', (err, reply) => {
|
||||
oldRedisClient.auth(redisPw, (err, reply) => {
|
||||
if (err) {
|
||||
console.log('redis err', err);
|
||||
} else {
|
||||
|
||||
@@ -21,8 +21,9 @@ module.exports = {
|
||||
"message Hero": {
|
||||
'required uInt32 hid': 1,
|
||||
'required uInt32 ce': 2,
|
||||
'required sInt32 incHeroCe': 3,
|
||||
},
|
||||
'required uInt32 ce': 1,
|
||||
'required sInt32 ce': 1,
|
||||
'repeated Hero heros': 2,
|
||||
'required uInt32 topLineupCe': 3
|
||||
},
|
||||
|
||||
@@ -145,5 +145,37 @@ module.exports = {
|
||||
'systimer': [
|
||||
{'id': 'systimer-server-1', 'host': '127.0.0.1', 'port': 6056, "args": " --inspect=9233"}
|
||||
]
|
||||
},
|
||||
'isbn': {
|
||||
'connector': [
|
||||
{'id': 'connector-server-1', 'port': 4050, 'clientHost': 'zyz_isbn.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3050, 'frontend': true},
|
||||
{'id': 'connector-server-2', 'port': 4051, 'clientHost': 'zyz_isbn.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3051, 'frontend': true},
|
||||
{'id': 'connector-server-3', 'port': 4052, 'clientHost': 'zyz_isbn.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3052, 'frontend': true}
|
||||
],
|
||||
'chat': [
|
||||
{'id': 'chat-server-1', 'host': '127.0.0.1', 'port': 6050},
|
||||
],
|
||||
'role': [
|
||||
{'id': 'role-server-1', 'host': '127.0.0.1', 'port': 6053}
|
||||
],
|
||||
'battle': [
|
||||
{'id': 'battle-server-1', 'host': '127.0.0.1', 'port': 6054}
|
||||
],
|
||||
'gate': [
|
||||
{'id': 'gate-server-1', 'host': '127.0.0.1', 'clientHost': 'zyz_isbn.trgame.cn', 'clientPort': 3014, 'frontend': true},
|
||||
{
|
||||
'id': 'gate-server-2',
|
||||
'host': '127.0.0.1',
|
||||
'clientHost': 'zyz_isbn.trgame.cn',
|
||||
'clientPort': 3015,
|
||||
'frontend': true
|
||||
}
|
||||
],
|
||||
'gm': [
|
||||
{'id': 'gm-server-1', 'host': '127.0.0.1', 'port': 6055}
|
||||
],
|
||||
'systimer': [
|
||||
{'id': 'systimer-server-1', 'host': '127.0.0.1', 'port': 6056}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,5 +41,20 @@ module.exports = {
|
||||
'gate': [
|
||||
{'id': 'gate-server-1', 'host': '127.0.0.1', 'clientPort': 3014, 'frontend': true}
|
||||
]
|
||||
},
|
||||
'isbn': {
|
||||
'connector': [
|
||||
{'id': 'connector-server-1', 'host': '127.0.0.1', 'port': 4050, 'clientPort': 3050, 'frontend': true},
|
||||
{'id': 'connector-server-2', 'host': '127.0.0.1', 'port': 4051, 'clientPort': 3051, 'frontend': true},
|
||||
{'id': 'connector-server-3', 'host': '127.0.0.1', 'port': 4052, 'clientPort': 3052, 'frontend': true}
|
||||
],
|
||||
'chat': [
|
||||
{'id': 'chat-server-1', 'host': '127.0.0.1', 'port': 6050},
|
||||
{'id': 'chat-server-2', 'host': '127.0.0.1', 'port': 6051},
|
||||
{'id': 'chat-server-3', 'host': '39.100.68.60', 'port': 6052}
|
||||
],
|
||||
'gate': [
|
||||
{'id': 'gate-server-1', 'host': '127.0.0.1', 'clientPort': 3014, 'frontend': true}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
110
game-server/package-lock.json
generated
110
game-server/package-lock.json
generated
@@ -67,6 +67,11 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/caseless": {
|
||||
"version": "0.12.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz",
|
||||
"integrity": "sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w=="
|
||||
},
|
||||
"@types/chai": {
|
||||
"version": "4.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.14.tgz",
|
||||
@@ -121,6 +126,15 @@
|
||||
"resolved": "https://registry.npm.taobao.org/@types/node/download/@types/node-8.10.54.tgz?cache=0&sync_timestamp=1595281257528&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-8.10.54.tgz",
|
||||
"integrity": "sha1-HIjrJTrBIQ8aWHaVP7cPfMSShAI="
|
||||
},
|
||||
"@types/node-schedule": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node-schedule/-/node-schedule-1.3.1.tgz",
|
||||
"integrity": "sha512-xAY/ZATrThUkMElSDfOk+5uXprCrV6c6GQ5gTw3U04qPS6NofE1dhOUW+yrOF2UyrUiAax/Zc4WtagrbPAN3Tw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/redis": {
|
||||
"version": "2.8.25",
|
||||
"resolved": "https://registry.npm.taobao.org/@types/redis/download/@types/redis-2.8.25.tgz",
|
||||
@@ -129,6 +143,26 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/request": {
|
||||
"version": "2.48.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.5.tgz",
|
||||
"integrity": "sha512-/LO7xRVnL3DxJ1WkPGDQrp4VTV1reX9RkC85mJ+Qzykj2Bdw+mG15aAfDahc76HtknjzE16SX/Yddn6MxVbmGQ==",
|
||||
"requires": {
|
||||
"@types/caseless": "*",
|
||||
"@types/node": "*",
|
||||
"@types/tough-cookie": "*",
|
||||
"form-data": "^2.5.0"
|
||||
}
|
||||
},
|
||||
"@types/request-promise": {
|
||||
"version": "4.1.47",
|
||||
"resolved": "https://registry.npmjs.org/@types/request-promise/-/request-promise-4.1.47.tgz",
|
||||
"integrity": "sha512-eRSZhAS8SMsrWOM8vbhxFGVZhTbWSJvaRKyufJTdIf4gscUouQvOBlfotPSPHbMR3S7kfkyKbhb1SWPmQdy3KQ==",
|
||||
"requires": {
|
||||
"@types/bluebird": "*",
|
||||
"@types/request": "*"
|
||||
}
|
||||
},
|
||||
"@types/socket.io": {
|
||||
"version": "2.1.10",
|
||||
"resolved": "https://registry.npm.taobao.org/@types/socket.io/download/@types/socket.io-2.1.10.tgz",
|
||||
@@ -138,6 +172,11 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/tough-cookie": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.0.tgz",
|
||||
"integrity": "sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A=="
|
||||
},
|
||||
"@types/underscore": {
|
||||
"version": "1.10.24",
|
||||
"resolved": "https://registry.npm.taobao.org/@types/underscore/download/@types/underscore-1.10.24.tgz",
|
||||
@@ -256,6 +295,11 @@
|
||||
"resolved": "https://registry.npm.taobao.org/async-limiter/download/async-limiter-1.0.1.tgz",
|
||||
"integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"backo2": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npm.taobao.org/backo2/download/backo2-1.0.2.tgz",
|
||||
@@ -520,6 +564,14 @@
|
||||
"resolved": "https://registry.npm.taobao.org/colors/download/colors-1.0.3.tgz",
|
||||
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"commander": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npm.taobao.org/commander/download/commander-3.0.2.tgz?cache=0&sync_timestamp=1595168120323&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-3.0.2.tgz",
|
||||
@@ -639,6 +691,11 @@
|
||||
"object-keys": "^1.0.12"
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
|
||||
},
|
||||
"delegates": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
|
||||
@@ -817,6 +874,16 @@
|
||||
"resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.3.tgz",
|
||||
"integrity": "sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg=="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npm.taobao.org/fs-extra/download/fs-extra-8.1.0.tgz",
|
||||
@@ -2177,6 +2244,16 @@
|
||||
"resolved": "https://registry.npm.taobao.org/process-nextick-args/download/process-nextick-args-2.0.1.tgz",
|
||||
"integrity": "sha1-eCDZsWEgzFXKmud5JoCufbptf+I="
|
||||
},
|
||||
"psl": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
|
||||
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"random-to": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/random-to/-/random-to-0.0.2.tgz",
|
||||
@@ -2285,6 +2362,25 @@
|
||||
"resolved": "https://registry.npm.taobao.org/regexp-clone/download/regexp-clone-1.0.0.tgz",
|
||||
"integrity": "sha1-Ii25Z2IydwViYLmSYmNUoEzpv2M="
|
||||
},
|
||||
"request-promise": {
|
||||
"version": "4.2.6",
|
||||
"resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.6.tgz",
|
||||
"integrity": "sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ==",
|
||||
"requires": {
|
||||
"bluebird": "^3.5.0",
|
||||
"request-promise-core": "1.1.4",
|
||||
"stealthy-require": "^1.1.1",
|
||||
"tough-cookie": "^2.3.3"
|
||||
}
|
||||
},
|
||||
"request-promise-core": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz",
|
||||
"integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.19"
|
||||
}
|
||||
},
|
||||
"require-directory": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npm.taobao.org/require-directory/download/require-directory-2.1.1.tgz",
|
||||
@@ -2532,6 +2628,11 @@
|
||||
"resolved": "https://registry.npm.taobao.org/stack-trace/download/stack-trace-0.0.10.tgz?cache=0&sync_timestamp=1575992264808&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstack-trace%2Fdownload%2Fstack-trace-0.0.10.tgz",
|
||||
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
|
||||
},
|
||||
"stealthy-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
||||
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks="
|
||||
},
|
||||
"stream-pkg": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npm.taobao.org/stream-pkg/download/stream-pkg-0.0.5.tgz",
|
||||
@@ -2676,6 +2777,15 @@
|
||||
"is-number": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"requires": {
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "8.10.2",
|
||||
"resolved": "https://registry.npm.taobao.org/ts-node/download/ts-node-8.10.2.tgz?cache=0&sync_timestamp=1590685779800&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fts-node%2Fdownload%2Fts-node-8.10.2.tgz",
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"@types/mongoose": "^5.7.36",
|
||||
"@types/node": "8.10.54",
|
||||
"@types/redis": "^2.8.25",
|
||||
"@types/request-promise": "^4.1.47",
|
||||
"@types/underscore": "^1.10.24",
|
||||
"bcrypt": "^5.0.0",
|
||||
"bluebird": "^3.5.1",
|
||||
@@ -46,10 +47,13 @@
|
||||
"redis": "^3.0.2",
|
||||
"redlock": "^4.2.0",
|
||||
"reflect-metadata": "^0.1.10",
|
||||
"request": "^2.88.2",
|
||||
"request-promise": "^4.2.6",
|
||||
"source-map-support": "^0.5.0",
|
||||
"ts-node": "^8.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node-schedule": "^1.3.1",
|
||||
"tslint": "^5.9.1",
|
||||
"typescript": "^3.9.7"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user