✨ feat(gvg): 添加激战期动态
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
|
||||
// 动态
|
||||
import { GVG_REC_ID, GVG_REC_TYPE, GVG_RESOURCE_TYPE } from "../../consts";
|
||||
import { GVGBattleRecType } from "../../db/GVGBattleRec";
|
||||
import { GVGRecModel } from "../../db/GVGRec";
|
||||
import { GVGTeamType } from "../../db/GVGTeam";
|
||||
import { GVGVestigeRecType } from "../../db/GVGVestigeRec";
|
||||
import { gameData } from "../../pubUtils/data";
|
||||
import { nowSeconds } from "../../pubUtils/timeUtil";
|
||||
@@ -64,4 +66,49 @@ export async function addVestigeLeagueRankRec(configId: number, ranks: { rank: n
|
||||
let params = [ `第${rank}名`];
|
||||
return { leagueCode, configId, type: GVG_REC_TYPE.PREPARE, recId: GVG_REC_ID.VESTIGE_RANK, createTime: nowSeconds(), params };
|
||||
}));
|
||||
}
|
||||
|
||||
export async function addBattleEndRec(rec: GVGBattleRecType) {
|
||||
let { isSuccess, attackTeam, defenseTeam, configId } = rec;
|
||||
let { roleId, leagueCode, cityId, index, curTeamBreak, originPointId } = defenseTeam;
|
||||
if(!defenseTeam.isRobot) { // 防守的不是机器
|
||||
if(isSuccess) {
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_ROLE, recId: GVG_REC_ID.TEAM_BE_HIT, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, `队伍${index}`] });
|
||||
if(curTeamBreak && originPointId > 0 ) {
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_ROLE, recId: GVG_REC_ID.TEAM_LOST_POINT, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, `队伍${index}`, getPointName(originPointId)] });
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_CITY, recId: GVG_REC_ID.CITY_OCCUPY_CHANGE, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, `${defenseTeam.roleName}`, getPointName(originPointId)] });
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_LEAGUE, recId: GVG_REC_ID.LEAGUE_OCCUPY_CHANGE, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, `${defenseTeam.roleName}`, getPointName(originPointId)] });
|
||||
}
|
||||
} else {
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_ROLE, recId: GVG_REC_ID.TEAM_GUARD_SUCCESS, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, `队伍${index}`] });
|
||||
|
||||
}
|
||||
}
|
||||
if(defenseTeam.isRobot && defenseTeam.isCatapult) {
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_CITY, recId: GVG_REC_ID.CITY_CATAPULT, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, getCityName(cityId)] });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getPointName(pointId: number) {
|
||||
let dicAreaPoint = gameData.gvgAreaPoint.get(pointId);
|
||||
let dicArea = gameData.gvgArea.get(dicAreaPoint?.areaId);
|
||||
if(!dicArea) return '';
|
||||
return dicArea.areaName||'';
|
||||
}
|
||||
|
||||
function getCityName(cityId: number) {
|
||||
let dicCity = gameData.gvgCity.get(cityId);
|
||||
return dicCity?.cityName||'';
|
||||
}
|
||||
|
||||
export async function addTeamSettleRec(team: GVGTeamType) {
|
||||
let { roleId, roleName, leagueCode, configId, cityId, pointId } = team;
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_CITY, recId: GVG_REC_ID.CITY_TEAM_SETTLE, createTime: nowSeconds(), params: [`${roleName}`, getPointName(pointId)] });
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_LEAGUE, recId: GVG_REC_ID.LEAGUE_TEAM_SETTLE, createTime: nowSeconds(), params: [`${roleName}`, getPointName(pointId)] });
|
||||
}
|
||||
|
||||
export async function addTeamLeaveRec(team: GVGTeamType, pointId: number) {
|
||||
let { roleId, roleName, leagueCode, configId, cityId } = team;
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, type: GVG_REC_TYPE.BATTLE_BY_LEAGUE, recId: GVG_REC_ID.LEAGUE_TEAM_LEAVE, createTime: nowSeconds(), params: [`${roleName}`, getPointName(pointId)] });
|
||||
}
|
||||
Reference in New Issue
Block a user