军团活动:诸侯混战自动宣战
This commit is contained in:
@@ -444,6 +444,7 @@ async function updateUserRecAndSendHonour(honour: number, myScore: number, rank:
|
||||
*/
|
||||
export async function cityActivitySettleReward(cityId: number, serverId: number) {
|
||||
let obj = getCityActivityObj();
|
||||
if(obj.hasSent(serverId, cityId)) return;
|
||||
|
||||
let dicCity = gameData.cityActivity.get(cityId);
|
||||
if (!dicCity) return;
|
||||
@@ -455,9 +456,10 @@ export async function cityActivitySettleReward(cityId: number, serverId: number)
|
||||
for (let { rank: guildRank, code: guildCode, name, num } of ranks) {
|
||||
if (guildRank == 1) {
|
||||
if (isSuccess) {
|
||||
await GuildActivityCityModel.guard(serverId, cityId, guildCode, name); // 占领
|
||||
console.log(dicCity)
|
||||
await GuildActivityCityModel.guard(serverId, cityId, dicCity?.nextCity, guildCode, name); // 占领
|
||||
} else {
|
||||
await GuildActivityCityModel.guard(serverId, cityId, "", ""); // 无人能占领
|
||||
await GuildActivityCityModel.guard(serverId, cityId, 0, "", ""); // 无人能占领
|
||||
}
|
||||
}
|
||||
let rewards = getGuildAuctionRewards(GUILD_ACTIVITY_TYPE.CITY_ACTIVITY, guildRank, cityId);
|
||||
@@ -496,18 +498,10 @@ export async function cityActivitySettleReward(cityId: number, serverId: number)
|
||||
* 清空完declareGuilds之后,做下一次活动的自动宣战
|
||||
*/
|
||||
export async function autoDeclare(serverId: number) {
|
||||
let allCities = await GuildActivityCityModel.getAllCities(serverId);
|
||||
let guardList = new Array<{ cityId: number, guardGuildCode: string }>();
|
||||
for (let { cityId, guardGuildCode } of allCities) {
|
||||
guardList.push({ cityId, guardGuildCode });
|
||||
await GuildActivityCityModel.clearGuard(serverId, cityId);
|
||||
}
|
||||
// console.log(JSON.stringify(guardList));
|
||||
for (let { cityId, guardGuildCode } of guardList) {
|
||||
let dicCity = gameData.cityActivity.get(cityId);
|
||||
if (guardGuildCode && dicCity.nextCity) {
|
||||
await GuildActivityCityModel.declare(serverId, dicCity.nextCity, guardGuildCode);
|
||||
}
|
||||
await GuildActivityCityModel.clearGuardAndStartNext(serverId);
|
||||
for(let [ cityId ] of gameData.cityActivity) {
|
||||
let msg = { cityId, declareGuildCode: "", declareCount: 0 };
|
||||
await sendMessageToCityWithSuc(cityId, PUSH_ROUTE.GUILD_CITY_DECLARE, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user