军团活动:诸侯混战自动宣战
This commit is contained in:
@@ -226,15 +226,6 @@ export class CityActivityHandler {
|
|||||||
let pushResult = await UserGuildActivityRecModel.pushCityRecord(code, { round, hid, damage });
|
let pushResult = await UserGuildActivityRecModel.pushCityRecord(code, { round, hid, damage });
|
||||||
if(!pushResult) return resResult(STATUS.WRONG_PARMS);
|
if(!pushResult) return resResult(STATUS.WRONG_PARMS);
|
||||||
|
|
||||||
gateHp = obj.getGateHpAndInc(serverId, cityId, dicCity.hp, -1 * damage);
|
|
||||||
if(gateHp <= 0) {
|
|
||||||
// 推送 停止活动并结算奖励
|
|
||||||
await sendSingleCityActEndMsg(cityId, serverId);
|
|
||||||
}
|
|
||||||
// 推送 城门血量
|
|
||||||
let chatSid = await getCityChannelSid(cityId);
|
|
||||||
pinus.app.rpc.chat.guildRemote.pushCityGateHp.toServer(chatSid, cityId, gateHp);
|
|
||||||
|
|
||||||
// 更新redis数据
|
// 更新redis数据
|
||||||
let role = await RoleModel.findByRoleId(roleId);
|
let role = await RoleModel.findByRoleId(roleId);
|
||||||
let { lv, vLv, head, frame, spine, title } = role;
|
let { lv, vLv, head, frame, spine, title } = role;
|
||||||
@@ -246,6 +237,15 @@ export class CityActivityHandler {
|
|||||||
let params = new GuildRankParam(guild.icon, guild.name, guild.lv, leader);
|
let params = new GuildRankParam(guild.icon, guild.name, guild.lv, leader);
|
||||||
let guildScore = await setRank(getCityKeyName(REDIS_KEY.CITY_ACTIVITY, cityId), serverId, guild.code, damage, Date.now(), params, true);
|
let guildScore = await setRank(getCityKeyName(REDIS_KEY.CITY_ACTIVITY, cityId), serverId, guild.code, damage, Date.now(), params, true);
|
||||||
|
|
||||||
|
gateHp = obj.getGateHpAndInc(serverId, cityId, dicCity.hp, -1 * damage);
|
||||||
|
if(gateHp <= 0) {
|
||||||
|
// 推送 停止活动并结算奖励
|
||||||
|
await sendSingleCityActEndMsg(cityId, serverId);
|
||||||
|
}
|
||||||
|
// 推送 城门血量
|
||||||
|
let chatSid = await getCityChannelSid(cityId);
|
||||||
|
pinus.app.rpc.chat.guildRemote.pushCityGateHp.toServer(chatSid, cityId, gateHp);
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, {
|
return resResult(STATUS.SUCCESS, {
|
||||||
code,
|
code,
|
||||||
...statusResult,
|
...statusResult,
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ export class GateActivityHandler {
|
|||||||
async debugStartActivity(msg: { aid: number }, session: BackendSession) {
|
async debugStartActivity(msg: { aid: number }, session: BackendSession) {
|
||||||
let { aid } = msg;
|
let { aid } = msg;
|
||||||
let dic = gameData.guildActivity.get(aid);
|
let dic = gameData.guildActivity.get(aid);
|
||||||
|
if(!dic) return resResult(STATUS.WRONG_PARMS);
|
||||||
let result = await pinus.app.rpc.systimer.systimerRemote.guildActivityStart.toServer('systimer-server-1', dic);
|
let result = await pinus.app.rpc.systimer.systimerRemote.guildActivityStart.toServer('systimer-server-1', dic);
|
||||||
if(!result) {
|
if(!result) {
|
||||||
return resResult(STATUS.GUILD_ACTIVITY_IS_OPEN)
|
return resResult(STATUS.GUILD_ACTIVITY_IS_OPEN)
|
||||||
@@ -337,6 +338,8 @@ export class GateActivityHandler {
|
|||||||
await pinus.app.rpc.systimer.systimerRemote.cityActivityEnd.toServer('systimer-server-1');
|
await pinus.app.rpc.systimer.systimerRemote.cityActivityEnd.toServer('systimer-server-1');
|
||||||
} else if (aid == GUILD_ACTIVITY_TYPE.RACE_ACTIVITY) {
|
} else if (aid == GUILD_ACTIVITY_TYPE.RACE_ACTIVITY) {
|
||||||
await pinus.app.rpc.systimer.systimerRemote.raceActivityEnd.toServer('systimer-server-1');
|
await pinus.app.rpc.systimer.systimerRemote.raceActivityEnd.toServer('systimer-server-1');
|
||||||
|
} else {
|
||||||
|
return resResult(STATUS.WRONG_PARMS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// !! 注意,这条函数会改变内存中的字典表,仅用于测试中使用
|
// !! 注意,这条函数会改变内存中的字典表,仅用于测试中使用
|
||||||
|
|||||||
@@ -476,15 +476,17 @@ export async function cityActivitySettleReward(cityId: number, serverId: number)
|
|||||||
*/
|
*/
|
||||||
async function autoDeclare(serverId: number) {
|
async function autoDeclare(serverId: number) {
|
||||||
let allCities = await GuildActivityCityModel.getAllCities(serverId);
|
let allCities = await GuildActivityCityModel.getAllCities(serverId);
|
||||||
for(let { cityId, guardGuildCode } of allCities) {
|
let guardList = new Array<{ cityId: number, guardGuildCode: string }>();
|
||||||
|
for (let { cityId, guardGuildCode } of allCities) {
|
||||||
|
guardList.push({ cityId, guardGuildCode });
|
||||||
|
await GuildActivityCityModel.guard(serverId, cityId, "", "");
|
||||||
|
}
|
||||||
|
for (let { cityId, guardGuildCode } of guardList) {
|
||||||
let dicCity = gameData.cityActivity.get(cityId);
|
let dicCity = gameData.cityActivity.get(cityId);
|
||||||
if(guardGuildCode && dicCity.nextCity) {
|
if (guardGuildCode && dicCity.nextCity) {
|
||||||
await GuildActivityCityModel.declare(serverId, dicCity.nextCity, guardGuildCode);
|
await GuildActivityCityModel.declare(serverId, dicCity.nextCity, guardGuildCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(let { cityId } of allCities) {
|
|
||||||
await GuildActivityCityModel.guard(serverId, cityId, "", "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user