✨ feat(寻宝): 队长奖励加成限制上限
This commit is contained in:
@@ -15,7 +15,7 @@ import { RoleStatus, ComBattleTeamModel, ComBattleTeamType, BossHp, ComRoleStatu
|
|||||||
import { ItemModel, ItemType } from '../../../db/Item';
|
import { ItemModel, ItemType } from '../../../db/Item';
|
||||||
import { addItems, handleCost } from '../../../services/role/rewardService';
|
import { addItems, handleCost } from '../../../services/role/rewardService';
|
||||||
import { checkRoleInQueue, getServerName, rmCreatedTeamFromRedis, rmRoleFromQueue, setTeamSearchReq } from '../../../services/redisService';
|
import { checkRoleInQueue, getServerName, rmCreatedTeamFromRedis, rmRoleFromQueue, setTeamSearchReq } from '../../../services/redisService';
|
||||||
import { getRandBlueprtId, clearComBtlTimer, getFrd, updateRobotHurtByTime, comBtlLvInvalid, clearRobotHurtTimer, setDismissTimer, dismissTeam, handleComBtlProgress, getComBattleFriendAdd, teammateInBlackList, blueprtIdValid, hasEnoughBlueprt, addRoleToTeam, addRoleStToTeam, addValidSearchingRoles, validToJoin, addRobotsToTeam, addRobotsLater, teamIsFullToStart, oneTeamNotInBlack, getAllAssistCnt, checkHasMyTeam, checkTeamStatusAndSend, getComBtlLvByPlayerLv, addToSearchingTeams } from '../../../services/comBattleService';
|
import { getRandBlueprtId, clearComBtlTimer, getFrd, updateRobotHurtByTime, comBtlLvInvalid, clearRobotHurtTimer, setDismissTimer, dismissTeam, handleComBtlProgress, getComBattleFriendAdd, teammateInBlackList, blueprtIdValid, hasEnoughBlueprt, addRoleToTeam, addRoleStToTeam, addValidSearchingRoles, validToJoin, addRobotsToTeam, addRobotsLater, teamIsFullToStart, oneTeamNotInBlack, getAllAssistCnt, checkHasMyTeam, checkTeamStatusAndSend, getComBtlLvByPlayerLv, addToSearchingTeams, getCapFrd, getCapExtraCnt } from '../../../services/comBattleService';
|
||||||
import { setAp } from '../../../services/actionPointService';
|
import { setAp } from '../../../services/actionPointService';
|
||||||
import { roleLevelup } from '../../../services/normalBattleService';
|
import { roleLevelup } from '../../../services/normalBattleService';
|
||||||
import { getSimpleRoleInfo } from '../../../services/roleService';
|
import { getSimpleRoleInfo } from '../../../services/roleService';
|
||||||
@@ -72,7 +72,9 @@ export class ComBattleHandler {
|
|||||||
|
|
||||||
// 创建队伍数据结构
|
// 创建队伍数据结构
|
||||||
let comTeam = new MemComBtlTeam(teamCode, pub, blueprtId, roleId, ceLimit, sid);
|
let comTeam = new MemComBtlTeam(teamCode, pub, blueprtId, roleId, ceLimit, sid);
|
||||||
addRoleToTeam(comTeam, roleInfo, sid, true, false);
|
|
||||||
|
let isFrd = await getCapFrd(roleId);
|
||||||
|
addRoleToTeam(comTeam, roleInfo, sid, true, isFrd);
|
||||||
addUserToTeamChannel(teamCode, true, roleId, sid);
|
addUserToTeamChannel(teamCode, true, roleId, sid);
|
||||||
// 将正在匹配的符合要求的玩家加入队伍,并推送入队消息
|
// 将正在匹配的符合要求的玩家加入队伍,并推送入队消息
|
||||||
if(pub == true) await addValidSearchingRoles(comTeam);
|
if(pub == true) await addValidSearchingRoles(comTeam);
|
||||||
@@ -657,7 +659,8 @@ export class ComBattleHandler {
|
|||||||
let roleId = session.get('roleId');
|
let roleId = session.get('roleId');
|
||||||
let cnt = await getAllAssistCnt(roleId);
|
let cnt = await getAllAssistCnt(roleId);
|
||||||
const blueprts = await ItemModel.findByRoleAndType(roleId, CONSUME_TYPE.BLUEPRT);
|
const blueprts = await ItemModel.findByRoleAndType(roleId, CONSUME_TYPE.BLUEPRT);
|
||||||
return resResult(STATUS.SUCCESS, { blueprts, assistCnt: cnt });
|
let capExtraCnt = await getCapExtraCnt(roleId);
|
||||||
|
return resResult(STATUS.SUCCESS, { blueprts, assistCnt: cnt, capExtraCnt });
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendTeamMsg(msg: { teamCode: string, type: number, content: string, targetRoleId: string, targetMsgCode: string }, session: BackendSession) {
|
async sendTeamMsg(msg: { teamCode: string, type: number, content: string, targetRoleId: string, targetMsgCode: string }, session: BackendSession) {
|
||||||
|
|||||||
@@ -164,6 +164,9 @@ export async function getRealReward(blueprtId: number, roleSts: RoleStatus[], ro
|
|||||||
let fixRewards: RewardInter[] = [], extraRewards: RewardInter[] = [], hasExtraReward = true;
|
let fixRewards: RewardInter[] = [], extraRewards: RewardInter[] = [], hasExtraReward = true;
|
||||||
if (roleSt.isCap) {
|
if (roleSt.isCap) {
|
||||||
fixRewards.push(...dicReward.captainReward);
|
fixRewards.push(...dicReward.captainReward);
|
||||||
|
if(roleSt.isFrd && !roleSt.isRobot) {
|
||||||
|
hasExtraReward = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (roleSt.isFrd && !roleSt.isRobot) {
|
if (roleSt.isFrd && !roleSt.isRobot) {
|
||||||
// 情谊值有上限,送到上限为止
|
// 情谊值有上限,送到上限为止
|
||||||
@@ -201,6 +204,11 @@ export async function getAllAssistCnt(roleId: string) {
|
|||||||
return teams.length;
|
return teams.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getCapExtraCnt(roleId: string) {
|
||||||
|
let teams = await ComBattleTeamModel.getCapExtraRewardCnt(roleId, getZeroPointD());
|
||||||
|
return teams.length;
|
||||||
|
}
|
||||||
|
|
||||||
export async function getFrd(roleId: string) {
|
export async function getFrd(roleId: string) {
|
||||||
let isFrd = false;
|
let isFrd = false;
|
||||||
let cnt = await getAllAssistCnt(roleId);
|
let cnt = await getAllAssistCnt(roleId);
|
||||||
@@ -208,6 +216,13 @@ export async function getFrd(roleId: string) {
|
|||||||
return isFrd;
|
return isFrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getCapFrd(roleId: string) {
|
||||||
|
let isFrd = false;
|
||||||
|
let cnt = await getCapExtraCnt(roleId);
|
||||||
|
if (cnt >= TREASURE.TREASURE_CAP_EXTRA_TIME) isFrd = true;
|
||||||
|
return isFrd;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 更新队伍状态
|
* @description 更新队伍状态
|
||||||
* @export
|
* @export
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { getFriendList, getApplyList } from './friendService';
|
|||||||
import { getDailyBattleList } from './dailyBattleService';
|
import { getDailyBattleList } from './dailyBattleService';
|
||||||
import { getExpeditionStatus } from './expeditionService';
|
import { getExpeditionStatus } from './expeditionService';
|
||||||
import { getTowerStatus, getHungupRewards, getTasks } from './battleService';
|
import { getTowerStatus, getHungupRewards, getTasks } from './battleService';
|
||||||
import { getAllAssistCnt, getComBtlLvByPlayerLv } from './comBattleService';
|
import { getAllAssistCnt, getCapExtraCnt, getComBtlLvByPlayerLv } from './comBattleService';
|
||||||
import { getDungeonData } from './dungeonService';
|
import { getDungeonData } from './dungeonService';
|
||||||
import { PvpSeasonResultModel } from '../db/PvpSeasonResult';
|
import { PvpSeasonResultModel } from '../db/PvpSeasonResult';
|
||||||
import { nowSeconds, getZeroPoint } from '../pubUtils/timeUtil';
|
import { nowSeconds, getZeroPoint } from '../pubUtils/timeUtil';
|
||||||
@@ -317,7 +317,8 @@ async function getComBattleEntryData(role: RoleType) {
|
|||||||
let { minLv, maxLv } = getComBtlLvByPlayerLv(lv);
|
let { minLv, maxLv } = getComBtlLvByPlayerLv(lv);
|
||||||
let refreshTime = nowSeconds() - INFO_WINDOW.TEAM_INFORMATION_TIME;
|
let refreshTime = nowSeconds() - INFO_WINDOW.TEAM_INFORMATION_TIME;
|
||||||
const invitations = await ComBattleTeamModel.findInvitations(roleId, minLv, maxLv, topLineupCe, refreshTime, 1);
|
const invitations = await ComBattleTeamModel.findInvitations(roleId, minLv, maxLv, topLineupCe, refreshTime, 1);
|
||||||
return { assistCnt, blueprts, hasInvitation: invitations.length > 0, invitationTime: invitations.length > 0?invitations[0].inviteTime: 0 }
|
let capExtraCnt = await getCapExtraCnt(roleId);
|
||||||
|
return { assistCnt, blueprts, hasInvitation: invitations.length > 0, invitationTime: invitations.length > 0?invitations[0].inviteTime: 0, capExtraCnt }
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function pushRefreshTime() {
|
export async function pushRefreshTime() {
|
||||||
|
|||||||
@@ -377,6 +377,13 @@ export default class ComBattleTeam extends BaseModel {
|
|||||||
return teams;
|
return teams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async getCapExtraRewardCnt(roleId: string, time: Date) {
|
||||||
|
const teams: ComBattleTeamType[] = await ComBattleTeamModel.find({
|
||||||
|
capId: roleId, createdAt: { $gte: time }, status: {$in: [0, 1, 2]}, hasTimeExtraReward: true
|
||||||
|
}).lean();
|
||||||
|
return teams;
|
||||||
|
}
|
||||||
|
|
||||||
public static async getTeamByRoleAndBattleCode(roleId: string, battleCode: string, lean = true) {
|
public static async getTeamByRoleAndBattleCode(roleId: string, battleCode: string, lean = true) {
|
||||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOne({roleIds: roleId, 'roleStatus.battleCode': battleCode}).lean(lean);
|
const team: ComBattleTeamType = await ComBattleTeamModel.findOne({roleIds: roleId, 'roleStatus.battleCode': battleCode}).lean(lean);
|
||||||
return team;
|
return team;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export const TREASURE = {
|
|||||||
GUILD_REWARD: '20&30', // 特殊时段时两人同军团额外加成20%,三人同军团额外加成30%
|
GUILD_REWARD: '20&30', // 特殊时段时两人同军团额外加成20%,三人同军团额外加成30%
|
||||||
TREASURE_ASSIST_LIMITED: '1&20&100|2&30&100|3&40&100|4&45&100|5&50&100|6&55&100|7&60&100|8&70&100|9&110&100', // 协助寻宝星级开启玩家等级限制
|
TREASURE_ASSIST_LIMITED: '1&20&100|2&30&100|3&40&100|4&45&100|5&50&100|6&55&100|7&60&100|8&70&100|9&110&100', // 协助寻宝星级开启玩家等级限制
|
||||||
TREASURE_ASSIST_TIME: 3, // 协助寻宝总次数
|
TREASURE_ASSIST_TIME: 3, // 协助寻宝总次数
|
||||||
|
TREASURE_CAP_EXTRA_TIME: 3, // 队长加成次数
|
||||||
};
|
};
|
||||||
export const FRIEND = {
|
export const FRIEND = {
|
||||||
FRIEND_CLOSEPOINT_ADD: 5, // 每赠送/领取一次增加的亲密度
|
FRIEND_CLOSEPOINT_ADD: 5, // 每赠送/领取一次增加的亲密度
|
||||||
|
|||||||
Reference in New Issue
Block a user