chore(deps): upgrade Angular 18 → 19
- ng update @angular/core@19 @angular/cli@19 @angular/material@19 @angular-eslint/schematics@19 - Migration: remove standalone:true (now default in v19) from 60 components - Migration: zone.js 0.14 → 0.15 - Fix pre-existing build budget error: raise initial bundle limit to 5mb (app ships large static JSON assets)
This commit is contained in:
+44
-42
@@ -6,26 +6,26 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { FortificationCardContentComponent } from '../fortification-card-content/fortification-card-content.component';
|
||||
import {
|
||||
HWGuildWarEnemySlot, HWGuildWarEnemyTeam, HWGuildWarFortification,
|
||||
HWGuildWarHeroTeam, HWGuildWarTitanTeam, HWGuildWarSlots, HWMember
|
||||
HWGuildWarEnemySlot,
|
||||
HWGuildWarEnemyTeam,
|
||||
HWGuildWarFortification,
|
||||
HWGuildWarHeroTeam,
|
||||
HWGuildWarTitanTeam,
|
||||
HWGuildWarSlots,
|
||||
HWMember,
|
||||
} from '@models';
|
||||
|
||||
/* JSON data */
|
||||
import guildWarData from 'src/files-data/hw-guild-war.json'; // page Overview -> Statistics | page Guild War -> Guild War
|
||||
import guildWarInfo from 'src/files-data/hw-guild-war-info.json'; // page Guild War -> Guild War
|
||||
import guildWarData from 'src/files-data/hw-guild-war.json'; // page Overview -> Statistics | page Guild War -> Guild War
|
||||
import guildWarInfo from 'src/files-data/hw-guild-war-info.json'; // page Guild War -> Guild War
|
||||
//import guildWarLog from 'src/files-data/hw-guild-war-log.json'; // page Guild War -> Guild War
|
||||
import guildWarSlots from 'src/files-data/hw-guild-war-slots.json'; // no pages
|
||||
|
||||
@Component({
|
||||
selector: 'app-guildwar-attack',
|
||||
standalone: true,
|
||||
imports: [
|
||||
DatePipe, DecimalPipe,
|
||||
MatCardModule, MatDividerModule, MatIconModule,
|
||||
FortificationCardContentComponent
|
||||
],
|
||||
imports: [DatePipe, DecimalPipe, MatCardModule, MatDividerModule, MatIconModule, FortificationCardContentComponent],
|
||||
templateUrl: './guildwar-attack.component.html',
|
||||
styleUrl: './guildwar-attack.component.scss'
|
||||
styleUrl: './guildwar-attack.component.scss',
|
||||
})
|
||||
export class GuildwarAttackComponent implements OnInit {
|
||||
private _championsByPower: HWMember[] = [];
|
||||
@@ -35,13 +35,14 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
public title = 'Fortifications';
|
||||
public subtitle = 'Guild War Attack';
|
||||
public now = new Date();
|
||||
public warInfo: { day: number, clanEnemyName: string, endTime: number, nextWarTime: number, nextLockTime: number } = {
|
||||
day: 0,
|
||||
clanEnemyName: '',
|
||||
endTime: 0,
|
||||
nextWarTime: 0,
|
||||
nextLockTime: 0
|
||||
};
|
||||
public warInfo: { day: number; clanEnemyName: string; endTime: number; nextWarTime: number; nextLockTime: number } =
|
||||
{
|
||||
day: 0,
|
||||
clanEnemyName: '',
|
||||
endTime: 0,
|
||||
nextWarTime: 0,
|
||||
nextLockTime: 0,
|
||||
};
|
||||
|
||||
@Input() set members(value: HWMember[]) {
|
||||
this.guildMembers = value;
|
||||
@@ -50,9 +51,9 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.warInfo.day = parseInt(guildWarInfo.day);
|
||||
this.warInfo.clanEnemyName = guildWarInfo.enemyClan.title;
|
||||
this.warInfo.endTime = (guildWarInfo.endTime * 1000);
|
||||
this.warInfo.nextWarTime = (guildWarInfo.nextWarTime * 1000);
|
||||
this.warInfo.nextLockTime = (guildWarInfo.nextLockTime * 1000);
|
||||
this.warInfo.endTime = guildWarInfo.endTime * 1000;
|
||||
this.warInfo.nextWarTime = guildWarInfo.nextWarTime * 1000;
|
||||
this.warInfo.nextLockTime = guildWarInfo.nextLockTime * 1000;
|
||||
this._setChampionsByPower();
|
||||
this._setEnemies();
|
||||
}
|
||||
@@ -81,7 +82,7 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
count: count,
|
||||
teams: teams,
|
||||
positions: this._enemySlots,
|
||||
slots: slots[name]
|
||||
slots: slots[name],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -89,10 +90,10 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
const teams: HWMember[] = [];
|
||||
const slots: HWGuildWarSlots = guildWarSlots.slots;
|
||||
let count = 0;
|
||||
slots[name].forEach(slot => {
|
||||
slots[name].forEach((slot) => {
|
||||
let enemies: HWMember[] = [];
|
||||
let team: HWMember = {} as HWMember;
|
||||
enemies = this.guildEnemies.filter(enemy => parseInt(enemy.id) === this._enemySlots[slot]);
|
||||
enemies = this.guildEnemies.filter((enemy) => parseInt(enemy.id) === this._enemySlots[slot]);
|
||||
if (enemies.length) {
|
||||
team = enemies[0];
|
||||
teams.push(team);
|
||||
@@ -115,7 +116,7 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
count: count,
|
||||
teams: teams,
|
||||
positions: this._enemySlots,
|
||||
slots: slots[name]
|
||||
slots: slots[name],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -125,21 +126,21 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
warriors.push(parseInt(data[0]));
|
||||
}
|
||||
for (const data of Object.entries(guildWarInfo.enemyClanMembers)) {
|
||||
const enemy: HWMember = {} as HWMember;
|
||||
Object.assign(enemy, data[1]);
|
||||
if (warriors.indexOf(parseInt(enemy.id)) !== -1) {
|
||||
enemy.champion = true;
|
||||
} else {
|
||||
enemy.champion = false;
|
||||
}
|
||||
enemy.heroes = { power: 0, teams: []};
|
||||
enemy.titans = { power: 0, teams: []};
|
||||
const enemy: HWMember = {} as HWMember;
|
||||
Object.assign(enemy, data[1]);
|
||||
if (warriors.indexOf(parseInt(enemy.id)) !== -1) {
|
||||
enemy.champion = true;
|
||||
} else {
|
||||
enemy.champion = false;
|
||||
}
|
||||
enemy.heroes = { power: 0, teams: [] };
|
||||
enemy.titans = { power: 0, teams: [] };
|
||||
|
||||
//console.log(guildWarInfo.enemySlots);
|
||||
//console.log(guildWarInfo.enemySlots);
|
||||
|
||||
this.guildEnemies.push(enemy);
|
||||
this.guildEnemies.push(enemy);
|
||||
}
|
||||
|
||||
|
||||
for (const data of Object.entries(guildWarInfo.enemySlots)) {
|
||||
const ennemySlot: HWGuildWarEnemySlot = {} as HWGuildWarEnemySlot;
|
||||
Object.assign(ennemySlot, data[1]);
|
||||
@@ -187,13 +188,15 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
this.guildEnemies.sort((a, b) => ((a.heroes.power + a.titans.power) > (b.heroes.power + b.titans.power) ? -1 : 1)); // Descending
|
||||
this.guildEnemies.sort((a, b) =>
|
||||
a.heroes.power + a.titans.power > b.heroes.power + b.titans.power ? -1 : 1,
|
||||
); // Descending
|
||||
}
|
||||
}
|
||||
|
||||
private _setChampionsByPower(): void {
|
||||
for (const [teamId, teamValues] of Object.entries(guildWarData.teams)) {
|
||||
const index = this.guildMembers.findIndex(member => member.id === teamId);
|
||||
const index = this.guildMembers.findIndex((member) => member.id === teamId);
|
||||
if (index === -1) continue;
|
||||
let totalHeroPower = 0;
|
||||
let totalTitanPower = 0;
|
||||
@@ -211,8 +214,8 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
this.guildMembers[index].heroes = { power: totalHeroPower, teams: heroes };
|
||||
this.guildMembers[index].titans = { power: totalTitanPower, teams: titans };
|
||||
}
|
||||
this.guildMembers.sort((a, b) => ((a.heroes.power + a.titans.power) > (b.heroes.power + b.titans.power) ? -1 : 1)); // Descending
|
||||
this._championsByPower = this.guildMembers.filter(member => member.champion === true);
|
||||
this.guildMembers.sort((a, b) => (a.heroes.power + a.titans.power > b.heroes.power + b.titans.power ? -1 : 1)); // Descending
|
||||
this._championsByPower = this.guildMembers.filter((member) => member.champion === true);
|
||||
}
|
||||
|
||||
getEnemies(): HWMember[] {
|
||||
@@ -282,5 +285,4 @@ export class GuildwarAttackComponent implements OnInit {
|
||||
//return this._getFortification(indexes, 'titans', 'Spring Of Elements');
|
||||
return this._getDefense('titans', 'Spring Of Elements');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user