Skip to content

Commit feb8803

Browse files
committed
True 1.8.11 fix for conquest
1 parent 7f64bed commit feb8803

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

bin/AreaTournament/AreaTournament.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ class AreaTournament {
128128
this.actualRound++;
129129
await conn.query("UPDATE conquesttournamentinfo SET actualRound = ? WHERE idArea = ?;", [this.actualRound, this.idArea]);
130130
this.rounds[this.actualRound] = new AreaTournamentRound(this.actualRound, this.rounds[this.actualRound - 1].winners, this.idArea);
131-
this.doFights();
131+
this.rounds[this.actualRound].init();
132+
await this.doFights();
132133
}
133134
//console.log("Tournament Finished for area : " + this.idArea + " Winner is : " + this.rounds[this.actualRound].winners[0].name);
134135
}
@@ -191,28 +192,20 @@ class AreaTournament {
191192
return (await conn.query("SELECT count(*) as total FROM conquesttournamentinscriptions WHERE idArea = ?;", [idArea]))[0].total;
192193
}
193194

194-
hasWinner() {
195-
return this.maxRounds > 0;
196-
}
197-
198195

199196
/**
200197
* End Tournament
201198
* then reset it
202199
*/
203200
async endTournament() {
204-
if (this.hasWinner()) {
205-
let oldOwner = await Area.staticGetOwnerID(this.idArea);
206-
if (oldOwner !== this.rounds[this.maxRounds].winners[0]) {
207-
await Area.resetBonuses(this.idArea);
208-
// TODO: Améliorer le système pour le rendre plus juste
209-
//await Area.oneLessLevel(this.idArea);
210-
}
211-
await Area.staticSetOwner(this.idArea, this.rounds[this.maxRounds].winners[0]);
212-
console.log("Winner of the area : " + this.idArea + " is " + (await conn.query("SELECT nom FROM guilds WHERE idGuild = ?", [this.rounds[this.maxRounds].winners[0]]))[0].nom);
213-
} else {
214-
console.log(`No Winner, idArea: ${this.idArea}\nDebug Info: ${this}`);
201+
let oldOwner = await Area.staticGetOwnerID(this.idArea);
202+
if (oldOwner !== this.rounds[this.maxRounds].winners[0]) {
203+
await Area.resetBonuses(this.idArea);
204+
// TODO: Améliorer le système pour le rendre plus juste
205+
//await Area.oneLessLevel(this.idArea);
215206
}
207+
await Area.staticSetOwner(this.idArea, this.rounds[this.maxRounds].winners[0]);
208+
console.log("Winner of the area : " + this.idArea + " is " + (await conn.query("SELECT nom FROM guilds WHERE idGuild = ?", [this.rounds[this.maxRounds].winners[0]]))[0].nom);
216209

217210
await this.resetTournament();
218211
await this.scheduleTournament();

0 commit comments

Comments
 (0)