✨ feat(每周结算): 新增对演武台boss的伤害排名获得活跃值
This commit is contained in:
@@ -9,7 +9,7 @@ import { findWhere } from 'underscore'
|
|||||||
import { GUILD_STRUCTURE, GUILD_BOSS_STATUS, GUILD_POINT_WAYS } from '../../../consts/constModules/guildConst';
|
import { GUILD_STRUCTURE, GUILD_BOSS_STATUS, GUILD_POINT_WAYS } from '../../../consts/constModules/guildConst';
|
||||||
import { DATA_NAME } from '../../../consts/dataName';
|
import { DATA_NAME } from '../../../consts/dataName';
|
||||||
import { UserGuildModel } from '../../../db/UserGuild';
|
import { UserGuildModel } from '../../../db/UserGuild';
|
||||||
import { addActive } from '../../../services/guildService';
|
import { addActive, getBossWarExtendActive } from '../../../services/guildService';
|
||||||
import { GuildModel } from '../../../db/Guild';
|
import { GuildModel } from '../../../db/Guild';
|
||||||
import { gameData, getBossByLv } from '../../../pubUtils/data';
|
import { gameData, getBossByLv } from '../../../pubUtils/data';
|
||||||
import { lockData } from '../../../services/redLockService';
|
import { lockData } from '../../../services/redLockService';
|
||||||
@@ -197,6 +197,8 @@ export class GuildHandler {
|
|||||||
await pushBossStatus(guildCode, result);
|
await pushBossStatus(guildCode, result);
|
||||||
pushGuildBossSucMsg(roleId, roleName, guildCode, bossInstance);
|
pushGuildBossSucMsg(roleId, roleName, guildCode, bossInstance);
|
||||||
|
|
||||||
|
await addActive(roleId, serverId, GUILD_POINT_WAYS.BOSS_WAR_EXTEND, null, await getBossWarExtendActive(bossCode, roleId));//获得活跃值
|
||||||
|
|
||||||
res.releaseCallback();//解锁
|
res.releaseCallback();//解锁
|
||||||
return resResult(STATUS.SUCCESS, { bossHp: 0 });
|
return resResult(STATUS.SUCCESS, { bossHp: 0 });
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -160,6 +160,28 @@ export async function getGuildActiveByRefTime(guildCode: string, refTime: Date)
|
|||||||
return guildActive ? guildActive.active : 0;
|
return guildActive ? guildActive.active : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取伤害排名
|
||||||
|
* @param code
|
||||||
|
* @param roleId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export async function getBossWarExtendActive(code: string, roleId: string) {
|
||||||
|
const bossInstance = await BossInstanceModel.findByCode(code);
|
||||||
|
if (!bossInstance || !bossInstance.ranks || bossInstance.ranks.length == 0) return 0;
|
||||||
|
let ranks = bossInstance.ranks;
|
||||||
|
ranks.sort((obj1, obj2) => obj2.score - obj1.score);
|
||||||
|
const index = ranks.findIndex((obj) => obj.roleId == roleId) + 1;
|
||||||
|
|
||||||
|
const dicBossRankActivePoint = gameData.bossRankActivePoint;
|
||||||
|
const foundEntry = dicBossRankActivePoint.find(
|
||||||
|
(entry) => index >= entry.bossRankMin && index <= entry.bossRankMax
|
||||||
|
);
|
||||||
|
|
||||||
|
return foundEntry ? foundEntry.activePoint : 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加活跃
|
* 增加活跃
|
||||||
* @param guildCode 军团唯一code
|
* @param guildCode 军团唯一code
|
||||||
|
|||||||
@@ -235,6 +235,8 @@ export enum GUILD_POINT_WAYS {
|
|||||||
TRAIN = 3, // 训练场
|
TRAIN = 3, // 训练场
|
||||||
BOSS_WAR = 4, // 演武台
|
BOSS_WAR = 4, // 演武台
|
||||||
ACTIVITY = 5, // 军团活动
|
ACTIVITY = 5, // 军团活动
|
||||||
|
BOSS_WAR_EXTEND = 6, //演舞台额外
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 军团活动id
|
// 军团活动id
|
||||||
|
|||||||
@@ -653,6 +653,7 @@ export const FILENAME = {
|
|||||||
DIC_AUTHORS_BOOK_POINT: 'dic_zyz_authorsBookPoint',
|
DIC_AUTHORS_BOOK_POINT: 'dic_zyz_authorsBookPoint',
|
||||||
DIC_AUTHORS_BOOK_SUB: 'dic_zyz_authorsBookSub',
|
DIC_AUTHORS_BOOK_SUB: 'dic_zyz_authorsBookSub',
|
||||||
DIC_AUTHORS_GOODID: 'dic_zyz_authorsGoodId',
|
DIC_AUTHORS_GOODID: 'dic_zyz_authorsGoodId',
|
||||||
|
DIC_BOSS_RANK_ACTIVE_POINT:'dic_zyz_bossRank_activePoint',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WAR_RELATE_TABLES = [
|
export const WAR_RELATE_TABLES = [
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ import { dicAuthorsBookGoodId, loadAuthorsBookGoodId } from "./dictionary/DicAut
|
|||||||
import { dicAuthorsBookMaxProgress, dicAuthorsBookSubs, dicAuthorsBookSubStar, loadAuthorsBookSub } from "./dictionary/DicAuthorsBookSub";
|
import { dicAuthorsBookMaxProgress, dicAuthorsBookSubs, dicAuthorsBookSubStar, loadAuthorsBookSub } from "./dictionary/DicAuthorsBookSub";
|
||||||
import { dicAuthorsBookPoint, loadAuthorsBookPoint } from "./dictionary/DicAuthorsBookPoint";
|
import { dicAuthorsBookPoint, loadAuthorsBookPoint } from "./dictionary/DicAuthorsBookPoint";
|
||||||
import { dicAuthorsBook, loadAuthorsBook } from './dictionary/DicAuthorsBook';
|
import { dicAuthorsBook, loadAuthorsBook } from './dictionary/DicAuthorsBook';
|
||||||
|
import { dicBossRankActivePoint, loadBossRankActivePoint } from "./dictionary/DicBossRankActivePoint";
|
||||||
|
|
||||||
export const gameData = {
|
export const gameData = {
|
||||||
daily: dicDaily,
|
daily: dicDaily,
|
||||||
@@ -358,7 +359,8 @@ export const gameData = {
|
|||||||
authorBookSubStar: dicAuthorsBookSubStar,
|
authorBookSubStar: dicAuthorsBookSubStar,
|
||||||
authorBookSubs: dicAuthorsBookSubs,
|
authorBookSubs: dicAuthorsBookSubs,
|
||||||
authorBookPoint: dicAuthorsBookPoint,
|
authorBookPoint: dicAuthorsBookPoint,
|
||||||
authorBookMaxProgress: dicAuthorsBookMaxProgress
|
authorBookMaxProgress: dicAuthorsBookMaxProgress,
|
||||||
|
bossRankActivePoint: dicBossRankActivePoint,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||||
@@ -1670,6 +1672,8 @@ function loadDatas(type?: string) {
|
|||||||
if (type == undefined || type == 'loadAuthorsBook')
|
if (type == undefined || type == 'loadAuthorsBook')
|
||||||
loadAuthorsBook();
|
loadAuthorsBook();
|
||||||
|
|
||||||
|
if (type == undefined || type == 'loadBossRankActivePoint')
|
||||||
|
loadBossRankActivePoint();
|
||||||
console.log('loadDatas type: ', type || 'all');
|
console.log('loadDatas type: ', type || 'all');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { readFileAndParse } from '../util'
|
||||||
|
import { FILENAME } from '../../consts'
|
||||||
|
|
||||||
|
export interface DicBossRankActivePoint {
|
||||||
|
readonly id: number;
|
||||||
|
readonly bossRankMin: number;
|
||||||
|
readonly bossRankMax: number;
|
||||||
|
readonly activePoint: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// const DicBossRankActivePointKeys: KeysEnum<DicBossRankActivePoint> = {
|
||||||
|
// id: true,
|
||||||
|
// bossRankMin: true,
|
||||||
|
// bossRankMax: true,
|
||||||
|
// activePoint: true,
|
||||||
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
export const dicBossRankActivePoint = new Array<DicBossRankActivePoint>();
|
||||||
|
|
||||||
|
export function loadBossRankActivePoint() {
|
||||||
|
dicBossRankActivePoint.splice(0, dicBossRankActivePoint.length);
|
||||||
|
|
||||||
|
let arr = readFileAndParse(FILENAME.DIC_BOSS_RANK_ACTIVE_POINT);
|
||||||
|
|
||||||
|
arr.forEach(o => {
|
||||||
|
dicBossRankActivePoint.push(o);
|
||||||
|
});
|
||||||
|
|
||||||
|
arr = undefined;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user