🐞 fix(gvg): 修改动态
This commit is contained in:
@@ -27,7 +27,7 @@ import { getGoldObject, handleCost } from '../../../services/role/rewardService'
|
||||
import { GVGCityAreaPointModel } from '../../../db/GVGCityAreaPoint';
|
||||
import { Rank } from '../../../services/rankService';
|
||||
import { LeagueRankInfo, RoleRankInfo } from '../../../domain/rank';
|
||||
import { addBattleEndRec, addTeamSettleRec } from '../../../services/gvg/gvgRecService';
|
||||
import { addBattleEndRec } from '../../../services/gvg/gvgRecService';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { GVG } from '../../../pubUtils/dicParam';
|
||||
import { sendMessageToGVGAreaByTeamWithSuc } from '../../../services/pushService';
|
||||
@@ -385,7 +385,7 @@ export class GVGBattleHandler {
|
||||
let teamObj = getGVGBattleData(groupKey);
|
||||
teamObj.teamSettle(roleId, teamCode, pointId);
|
||||
|
||||
addTeamSettleRec(curTeam);
|
||||
// addTeamSettleRec(curTeam);
|
||||
|
||||
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(curTeam) });
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { GVGLeaguePrepareModel } from "../../../db/GVGLeaguePrepare";
|
||||
import { createGroupMsg, pushGroupMsgToRoom } from "../../../services/chatService";
|
||||
import { sendMailByContent, sendMailToGuildByContent, sendMailToLeagueByContent } from "../../../services/mailService";
|
||||
import { getGVGCities } from "../../../services/gvg/gvgBattleService";
|
||||
import { changeNoticeMessage, guildQuitLeagueRecord } from "../../../services/gvg/gvgRecService";
|
||||
import { addLeagueRenameRecord, changeNoticeMessage, guildQuitLeagueRecord } from "../../../services/gvg/gvgRecService";
|
||||
import { LeagueLeader } from "../../../domain/rank";
|
||||
|
||||
export default function (app: Application) {
|
||||
@@ -613,6 +613,7 @@ export class GVGManageHandler {
|
||||
myLeague = await GVGLeagueModel.setInfo(targetLeagueCode, name, notice, icon);
|
||||
if(name != undefined) {
|
||||
await updateUserInfo(REDIS_KEY.LEAGUE_INFO, myLeague.leagueCode, [{ field: 'name', value: name }]);
|
||||
addLeagueRenameRecord(myLeague.leagueCode, name);
|
||||
}
|
||||
if(icon != undefined) {
|
||||
await updateUserInfo(REDIS_KEY.LEAGUE_INFO, myLeague.leagueCode, [{ field: 'icon', value: name }]);
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
import { CHANNEL_PREFIX, GVG_REC_ID, GVG_REC_TYPE, GVG_RESOURCE_TYPE, MSG_SOURCE, MSG_TYPE } from "../../consts";
|
||||
import { GVGBattleRecType } from "../../db/GVGBattleRec";
|
||||
import { GVGLeagueModel, GVGLeagueType } from "../../db/GVGLeague";
|
||||
import { GVGRecModel } from "../../db/GVGRec";
|
||||
import { GVGTeamType } from "../../db/GVGTeam";
|
||||
import { GVGRecModel, GVGRecUpdate } from "../../db/GVGRec";
|
||||
import { GVGVestigeRecType } from "../../db/GVGVestigeRec";
|
||||
import { gameData } from "../../pubUtils/data";
|
||||
import { nowSeconds } from "../../pubUtils/timeUtil";
|
||||
@@ -27,6 +26,12 @@ async function leagueJoinOrQuitGuild(leagueCode: string, guildName: string, recI
|
||||
await GVGRecModel.addRec({ leagueCode, configId, type: GVG_REC_TYPE.PREPARE, recId, createTime: nowSeconds(), params })
|
||||
}
|
||||
|
||||
export async function addLeagueRenameRecord(leagueCode: string, leagueName: string) {
|
||||
let { configId } = getGVGConfig();
|
||||
let params = [leagueName];
|
||||
await GVGRecModel.addRec({ leagueCode, configId, type: GVG_REC_TYPE.PREPARE, recId: GVG_REC_ID.LEAGUE_RENAME, createTime: nowSeconds(), params })
|
||||
}
|
||||
|
||||
// 获得资源
|
||||
export async function addResourceRecord(roleId: string, roleName: string, leagueCode: string, resourceType: GVG_RESOURCE_TYPE, output: number) {
|
||||
let { configId } = getGVGConfig();
|
||||
@@ -72,27 +77,51 @@ export async function addVestigeLeagueRankRec(configId: number, groupKey: string
|
||||
|
||||
export async function addBattleEndRec(rec: GVGBattleRecType) {
|
||||
let { isSuccess, attackTeamAfter: attackTeam, defenseTeamAfter: defenseTeam, configId, groupKey } = rec;
|
||||
let { roleId, leagueCode, cityId, index, curTeamBreak, originPointId } = defenseTeam;
|
||||
let { roleId: defenseRoleId, leagueCode: defenseLeague, cityId, index: defenseIndex, curTeamBreak: defenseBreak, originPointId: defenseOriginPoint, roleName: defenseName } = defenseTeam;
|
||||
let { roleId: attackRoleId, leagueCode: attackLeague, index: attackIndex, roleName: attackName} = attackTeam;
|
||||
|
||||
let params = new GVGRecUpArr(configId, cityId, groupKey, nowSeconds());
|
||||
if(isSuccess) {
|
||||
if(!defenseTeam.isRobot) {
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, groupKey, type: GVG_REC_TYPE.BATTLE_BY_ROLE, recId: GVG_REC_ID.TEAM_BE_HIT, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, `队伍${index}`] });
|
||||
}
|
||||
if(curTeamBreak && originPointId > 0 ) {
|
||||
if(!defenseTeam.isRobot) params.pushRec(defenseRoleId, defenseLeague, GVG_REC_TYPE.BATTLE_BY_ROLE, GVG_REC_ID.TEAM_BE_ATTACKED_FAIL, [attackName, `队伍${defenseIndex}`]);
|
||||
params.pushRec(attackRoleId, attackLeague, GVG_REC_TYPE.BATTLE_BY_ROLE, GVG_REC_ID.TEAM_ATTACK_SUCCESS, [`队伍${attackIndex}`, defenseName]);
|
||||
if(defenseBreak && defenseOriginPoint > 0 ) {
|
||||
if(!defenseTeam.isRobot) {
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, groupKey, type: GVG_REC_TYPE.BATTLE_BY_ROLE, recId: GVG_REC_ID.TEAM_LOST_POINT, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, `队伍${index}`, getPointName(originPointId)] });
|
||||
params.pushRec(defenseRoleId, defenseLeague, GVG_REC_TYPE.BATTLE_BY_ROLE, GVG_REC_ID.TEAM_LOST_POINT, [attackName, `队伍${defenseIndex}`, getPointName(defenseOriginPoint)]);
|
||||
}
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, groupKey, 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, groupKey, type: GVG_REC_TYPE.BATTLE_BY_LEAGUE, recId: GVG_REC_ID.LEAGUE_OCCUPY_CHANGE, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, `${defenseTeam.roleName}`, getPointName(originPointId)] });
|
||||
params.pushRec(attackRoleId, attackLeague, GVG_REC_TYPE.BATTLE_BY_ROLE, GVG_REC_ID.TEAM_GET_POINT, [`队伍${attackIndex}`, defenseName, getPointName(defenseOriginPoint)]);
|
||||
}
|
||||
} else {
|
||||
if(!defenseTeam.isRobot) {
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, groupKey, 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, groupKey, type: GVG_REC_TYPE.BATTLE_BY_CITY, recId: GVG_REC_ID.CITY_CATAPULT, createTime: nowSeconds(), params: [`${attackTeam.roleName}`, getCityName(cityId)] });
|
||||
if(!defenseTeam.isRobot) params.pushRec(defenseRoleId, defenseLeague, GVG_REC_TYPE.BATTLE_BY_ROLE, GVG_REC_ID.TEAM_BE_ATTACKED_SUCCESS, [attackName, `队伍${defenseIndex}`]);
|
||||
params.pushRec(attackRoleId, attackLeague, GVG_REC_TYPE.BATTLE_BY_ROLE, GVG_REC_ID.TEAM_ATTACK_FAIL, [`队伍${attackIndex}`, defenseName]);
|
||||
}
|
||||
|
||||
await GVGRecModel.addRecs(params.getUpdateParam());
|
||||
}
|
||||
|
||||
class GVGRecUpArr {
|
||||
private arr: GVGRecUpdate[] = [];
|
||||
private configId: number;
|
||||
private cityId: number;
|
||||
private groupKey: string;
|
||||
private createTime: number;
|
||||
|
||||
constructor(configId: number, cityId: number, groupKey: string, createTime: number) {
|
||||
this.configId = configId;
|
||||
this.cityId = cityId;
|
||||
this.groupKey = groupKey;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public pushRec(roleId: string, leagueCode: string, type: GVG_REC_TYPE, recId: GVG_REC_ID, params: string[]) {
|
||||
this.arr.push({
|
||||
configId: this.configId, cityId: this.cityId, groupKey: this.groupKey, createTime: this.createTime,
|
||||
roleId, leagueCode, type, recId, params
|
||||
})
|
||||
}
|
||||
|
||||
public getUpdateParam() {
|
||||
return this.arr;
|
||||
}
|
||||
}
|
||||
|
||||
function getPointName(pointId: number) {
|
||||
@@ -102,21 +131,21 @@ function getPointName(pointId: number) {
|
||||
return dicArea.areaName||'';
|
||||
}
|
||||
|
||||
function getCityName(cityId: number) {
|
||||
let dicCity = gameData.gvgCity.get(cityId);
|
||||
return dicCity?.cityName||'';
|
||||
}
|
||||
// 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, groupKey } = team;
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, groupKey, 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, groupKey, type: GVG_REC_TYPE.BATTLE_BY_LEAGUE, recId: GVG_REC_ID.LEAGUE_TEAM_SETTLE, createTime: nowSeconds(), params: [`${roleName}`, getPointName(pointId)] });
|
||||
}
|
||||
// export async function addTeamSettleRec(team: GVGTeamType) {
|
||||
// let { roleId, roleName, leagueCode, configId, cityId, pointId, groupKey } = team;
|
||||
// await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, groupKey, 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, groupKey, 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, groupKey } = team;
|
||||
await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, groupKey, type: GVG_REC_TYPE.BATTLE_BY_LEAGUE, recId: GVG_REC_ID.LEAGUE_TEAM_LEAVE, createTime: nowSeconds(), params: [`${roleName}`, getPointName(pointId)] });
|
||||
}
|
||||
// export async function addTeamLeaveRec(team: GVGTeamType, pointId: number) {
|
||||
// let { roleId, roleName, leagueCode, configId, cityId, groupKey } = team;
|
||||
// await GVGRecModel.addRec({ roleId, leagueCode, configId, cityId, groupKey, type: GVG_REC_TYPE.BATTLE_BY_LEAGUE, recId: GVG_REC_ID.LEAGUE_TEAM_LEAVE, createTime: nowSeconds(), params: [`${roleName}`, getPointName(pointId)] });
|
||||
// }
|
||||
|
||||
|
||||
// —————— 频道消息 ——————
|
||||
|
||||
@@ -111,22 +111,26 @@ export enum GVG_REC_TYPE {
|
||||
|
||||
// 动态具体id
|
||||
export enum GVG_REC_ID {
|
||||
ADD_RESOURCE = 1, // 成员贡献粮食、铁矿、木材
|
||||
SETTLE_POINT = 2, // 成员成功占领驻扎点
|
||||
POINT_BE_GRAB = 3, // 成员占领的驻扎点被其他联军抢占
|
||||
SEND_ITEM = 4, // 战备道具发放
|
||||
VESTIGE_RANK = 5, // 联军每日的征战排名
|
||||
LEAGUE_JOIN_GUILD = 6, // 军团加入联军
|
||||
LEAGUE_QUIT_GUILD = 7, // 军团退出联军
|
||||
TEAM_BE_HIT = 8, // 队伍被击败
|
||||
TEAM_GUARD_SUCCESS = 9, // 队伍防守成功
|
||||
TEAM_LOST_POINT = 10, // 队伍失去积分点
|
||||
CITY_TEAM_SETTLE = 12, // 入驻据点
|
||||
CITY_OCCUPY_CHANGE = 13,// 城池据点交替
|
||||
CITY_CATAPULT = 15, // 投石车被打掉
|
||||
LEAGUE_TEAM_SETTLE = 16, // 队伍入驻据点
|
||||
LEAGUE_TEAM_LEAVE = 17, // 队伍离开据点
|
||||
LEAGUE_OCCUPY_CHANGE = 18, // 联军据点交替
|
||||
ADD_RESOURCE = 101, // 成员贡献粮食、铁矿、木材
|
||||
SETTLE_POINT = 102, // 成员成功占领驻扎点
|
||||
POINT_BE_GRAB = 103, // 成员占领的驻扎点被其他联军抢占
|
||||
SEND_ITEM = 104, // 战备道具发放
|
||||
VESTIGE_RANK = 105, // 联军每日的征战排名
|
||||
LEAGUE_JOIN_GUILD = 106, // 军团加入联军
|
||||
LEAGUE_QUIT_GUILD = 107, // 军团退出联军
|
||||
LEAGUE_RENAME = 108, // 军团退出联军
|
||||
TEAM_BE_ATTACKED_FAIL = 201, // 队伍被击败
|
||||
TEAM_BE_ATTACKED_SUCCESS = 202, // 队伍防守成功
|
||||
TEAM_LOST_POINT = 203, // 队伍失去积分点
|
||||
TEAM_ATTACK_FAIL = 204, // 队伍进攻失败
|
||||
TEAM_ATTACK_SUCCESS = 205, // 队伍进攻成功
|
||||
TEAM_GET_POINT = 206, // 队伍驻守积分点
|
||||
// CITY_TEAM_SETTLE = 12, // 入驻据点
|
||||
// CITY_OCCUPY_CHANGE = 13,// 城池据点交替
|
||||
// CITY_CATAPULT = 15, // 投石车被打掉
|
||||
// LEAGUE_TEAM_SETTLE = 16, // 队伍入驻据点
|
||||
// LEAGUE_TEAM_LEAVE = 17, // 队伍离开据点
|
||||
// LEAGUE_OCCUPY_CHANGE = 18, // 联军据点交替
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,110 +1,86 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"id": 101,
|
||||
"type": 1,
|
||||
"template": "%d贡献了%d%d",
|
||||
"comments": "%d:玩家名 %d:粮食/木材/铁矿 %d:产量数值"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"id": 102,
|
||||
"type": 1,
|
||||
"template": "%d成功占领%d%d驻扎点",
|
||||
"comments": "%d:玩家名 %d:遗迹名 %d:第X名"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"id": 103,
|
||||
"type": 1,
|
||||
"template": "%d占领%d%d驻扎点被%d成员抢占",
|
||||
"comments": "%d:玩家名 %d:遗迹名 %d:第X名 %d联军名"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"id": 104,
|
||||
"type": 1,
|
||||
"template": "%d激活成功,%d获得%d",
|
||||
"comments": "%d:神机点名字 %d:本次获得该道具的玩家名,以顿号隔开 %d:道具名"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"id": 105,
|
||||
"type": 1,
|
||||
"template": "今日的遗迹已关闭,在大家的不懈努力下联军获得%d",
|
||||
"comments": "%d:联军驻扎分排名"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"id": 106,
|
||||
"type": 1,
|
||||
"template": "%d军团加入本联军",
|
||||
"comments": "%d:军团名"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"id": 107,
|
||||
"type": 1,
|
||||
"template": "%d军团已退出本联军",
|
||||
"comments": "%d:军团名"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"id": 108,
|
||||
"type": 1,
|
||||
"template": "本联军已正式更名为%d",
|
||||
"comments": "%d:联军名"
|
||||
},
|
||||
{
|
||||
"id": 201,
|
||||
"type": 2,
|
||||
"template": "%d击败了您的%d,队伍进入休整",
|
||||
"comments": "%d:玩家名 %d:队伍1/队伍2/队伍3"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"id": 202,
|
||||
"type": 2,
|
||||
"template": "%d挑战了您的%d,对方铩羽而归",
|
||||
"comments": "%d:玩家名 %d:队伍1/队伍2/队伍3"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"id": 203,
|
||||
"type": 2,
|
||||
"template": "%d击败了您的%d,您失去了%d",
|
||||
"comments": "%d:玩家名 %d:队伍1/队伍2/队伍3 %d:据点名称"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"type": 3,
|
||||
"template": "%d入驻了%d",
|
||||
"comments": "%d:玩家名 %d:据点名称"
|
||||
"id": 204,
|
||||
"type": 2,
|
||||
"template": "您的%d进攻了%d,您不慎落败",
|
||||
"comments": "%d:队伍1/队伍2/队伍3,%d:玩家名"
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"type": 3,
|
||||
"template": "%d击败了%d,占领了%d",
|
||||
"comments": "%d:玩家名 %d:玩家名 %d:据点名称"
|
||||
"id": 205,
|
||||
"type": 2,
|
||||
"template": "您的%d进攻了%d,对方落败而归",
|
||||
"comments": "%d:队伍1/队伍2/队伍3,%d:玩家名"
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"type": 3,
|
||||
"template": "%d累计获得%d杀",
|
||||
"comments": "%d:玩家名 %d:累计击杀数"
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"type": 3,
|
||||
"template": "%d击破了%d的一辆投石车",
|
||||
"comments": "%d:玩家名 %d:城池名"
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"type": 4,
|
||||
"template": "我方联军的%d入驻了%d",
|
||||
"comments": "%d:玩家名 %d:据点名称"
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"type": 4,
|
||||
"template": "我方联军的%d离开了%d",
|
||||
"comments": "%d:玩家名 %d:据点名称"
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"type": 4,
|
||||
"template": "%d击败了我方联军%d,占领了%d",
|
||||
"comments": "%d:玩家名 %d:玩家名 %d:据点名称"
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"type": 4,
|
||||
"template": "我方联军的%d累计获得%d杀",
|
||||
"comments": "%d:玩家名 %d:累计击杀数"
|
||||
"id": 206,
|
||||
"type": 2,
|
||||
"template": "您的%d进攻了%d,您占据了%d",
|
||||
"comments": "%d:队伍1/队伍2/队伍3,%d:玩家名 %d:据点名称"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user