-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Outfit wars support #314
Merged
Merged
Outfit wars support #314
Changes from 21 commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
452f6a7
Update submodules for nexus data
ryanjsims 763b4a6
Bump constants submodule to nexus branch
ryanjsims 70026bf
Start adding data types to API for outfit wars instances
ryanjsims f99836b
Add outfit-wars API as alias of instance endpoint(s)
ryanjsims a5656e6
Merge branch 'dev' into outfit-wars
Maelstromeous e32623d
Fix module updater and point to OW branch
Maelstromeous 6401a39
Updated constants
Maelstromeous cf46694
Created and updated various DTOs and entities to implement the outfit…
Maelstromeous 9e262ea
Changed from team1 etc to use blue vs red.
Maelstromeous e8e2165
Updated constants ref
Maelstromeous 3aa0d2b
Removed previously migrated interfaces
Maelstromeous 686ed61
Updated constants
Maelstromeous 35f5ecb
Updated outfit wars controller
Maelstromeous 6dd3286
Fixed DTOs
Maelstromeous 593473a
Minor fix to instance metagame controller
Maelstromeous c900ca3
Fixed facility control entity referencing the wrong thing
Maelstromeous 8013339
Updated constants ref
Maelstromeous 6f6ca5b
Corrected various wonkies with the outfitwars entity
Maelstromeous 19c7671
Fixed instanceId example in OW entity
Maelstromeous f36cd15
Live metagame now supports ps2alertsEventType and creates it for new …
Maelstromeous 007ebc4
Fixed outfit wars update DTO
Maelstromeous 73897c7
Update constants commit
ryanjsims 9642c19
Removed deprecated census endpoints for oshur data, this is now serve…
Maelstromeous 2618bb8
Deleted reverse engineered oshur data
Maelstromeous 8fc3e46
Updated description
Maelstromeous daa9d76
Fully supporting OW facility control events now
Maelstromeous d6acd14
Update constants commit
ryanjsims 2a32bd1
Update constants commit
ryanjsims dafaf7e
Add API support for outfit wars instance metadata embed
ryanjsims 714bd3b
Revert outfitwars team updates being handled by API, now handled in a…
ryanjsims 4256b62
Added an Outfitwars Ranking cron job that will pull data from Falcon'…
ryanjsims c7b52c9
Add Rankings API
ryanjsims 7a640a9
Bump constants commit
ryanjsims 153d82c
Add census service id variable for outfitwars ranking cron fallback
ryanjsims 0525185
Add upsertMany, which uses one conditional per doc to upsert
ryanjsims dbd5908
Update outfitwars rankings to use round numbers from constants
ryanjsims 4374256
Reset the cron interval to once per week
ryanjsims 885b0e0
Make round a query parameter on both outfit-wars/rankings and outfit-…
ryanjsims 8695c3e
Merge branch 'dev' into outfit-wars
Maelstromeous fd3789b
Cleaned up code slightly to use a response type interface and just ma…
Maelstromeous 3227fed
Updated consts
Maelstromeous 267d7fb
Fixed healthcheck for outfit wars cron, set it to run at top of every…
Maelstromeous f2f2b6b
eslint fix
Maelstromeous 16ec760
Fixed various documentation issues
Maelstromeous 874c2c7
Use null coalese not or coalese
Maelstromeous 478d9c0
Added OutfitwarsRankingInterface and made the embeds implement it - f…
Maelstromeous 5ca1887
Changed cron back to running on Sundays, removed the indicator
Maelstromeous 6c20694
Increase default page size for ranking to accomodate all matches
ryanjsims fe90d3d
Handle cases where falcon ranking interface may not be updated yet
ryanjsims b222a9f
Merge branch 'dev' into outfit-wars
Maelstromeous a530852
Removed old vars.local.yml location
Maelstromeous ad7618a
Bump API constants commit
ryanjsims be4a734
Eslint
Maelstromeous f4d8dfb
Added ps2AlertsEventType as a property to all relevant aggregates
Maelstromeous 9b525bf
Corrected various inconsistently named entities for ps2AlertsEventType.
Maelstromeous b7198fc
Undone a booboo
Maelstromeous 39e8b1e
Removed zone being in the common implicit as it simply isn't always n…
Maelstromeous 80a284d
Merge branch 'outfit-wars' into ps2alerts-event-type
Maelstromeous 11b9f3e
Updated constants ref
Maelstromeous ae31925
Corrected casing on Ps2AlertsEventState to match constants repo
Maelstromeous 58705ac
Merge branch 'outfit-wars' into ps2alerts-event-type
Maelstromeous c92477b
Added BaseAggregatorController and Bracket and Ps2AlertsEventType pipes
Maelstromeous 3a25033
Add instanceId to outfitwars ranking entity
ryanjsims ce0f655
bump constants
ryanjsims 0a3c376
Use :outfit not {outfit}
ryanjsims 4a7e5cb
Bump constants commit
ryanjsims 20c564b
Make round of ranking be based on number of matches played
ryanjsims 329335e
Added BaseAggregatorController and Bracket and Ps2AlertsEventType pipes
Maelstromeous 0536c38
Merge remote-tracking branch 'origin/ps2alerts-event-type' into ps2al…
Maelstromeous 8057928
Linting
Maelstromeous 9b29c37
Rewrote the transformGlobal bracket handling to make more sense
Maelstromeous 65ea95d
Added character.name as an index for global character entity, it'll b…
Maelstromeous b659135
Temp change to change cron running for OW to every 5 mins for initial…
Maelstromeous 0a0c763
Merge branch 'dev' into outfit-wars
Maelstromeous 7ba73db
Added ps2AlertsEventType query options to each appropriate endpoint
Maelstromeous efbe056
Fixed OW instances not getting combat history
Maelstromeous 0901e4b
Reverted an ps2AlertsEventType where it does not exist
Maelstromeous 46ced39
Add support to cron job for outfit war matches falcon endpoint
ryanjsims c2bda7c
Only use $setOnInsert since data should not be modified after creation
ryanjsims 16e5c5b
Injecting service ID into API containers
Maelstromeous File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[submodule "src/modules/data/ps2alerts-constants"] | ||
path = src/modules/data/ps2alerts-constants | ||
url = https://github.com/ps2alerts/constants | ||
branch = outfit-wars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
#!/usr/bin/env bash | ||
cd src/modules/data/ps2alerts-constants | ||
git fetch && git pull | ||
cd ../../../../ | ||
git submodule update --remote |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
// import {Inject, Injectable, Logger} from '@nestjs/common'; | ||
// import {Cron, CronExpression} from '@nestjs/schedule'; | ||
// import MongoOperationsService from '../../services/mongo/mongo.operations.service'; | ||
// import {Ps2alertsEventState} from '../data/ps2alerts-constants/ps2alertsEventState'; | ||
// import InstanceMetagameTerritoryEntity from '../data/entities/instance/instance.metagame.territory.entity'; | ||
// import InstanceFactionCombatAggregateEntity | ||
// from '../data/entities/aggregate/instance/instance.faction.combat.aggregate.entity'; | ||
// import InstanceCombatHistoryAggregateEntity | ||
// from '../data/entities/aggregate/instance/instance.combat.history.aggregate.entity'; | ||
// import {RedisCacheService} from '../../services/cache/redis.cache.service'; | ||
// import {World} from "../data/ps2alerts-constants/world"; | ||
// import {Zone} from "../data/ps2alerts-constants/zone"; | ||
// import {Faction} from "../data/ps2alerts-constants/faction"; | ||
// import {Cache} from "cache-manager"; | ||
// | ||
// @Injectable() | ||
// export class PopulationHistoryCron { | ||
// private readonly logger = new Logger(PopulationHistoryCron.name); | ||
// | ||
// private cacheClient: Cache; | ||
// | ||
// constructor( | ||
// @Inject(MongoOperationsService) private readonly mongoOperationsService: MongoOperationsService, | ||
// private readonly cacheService: RedisCacheService, | ||
// ) { | ||
// this.cacheClient = cacheService.getClient(); | ||
// } | ||
// | ||
// @Cron(CronExpression.EVERY_MINUTE) | ||
// async handleCron(): Promise<void> { | ||
// this.logger.log('Running population history job'); | ||
// | ||
// // Grab the current actives | ||
// // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
// const actives: InstanceMetagameTerritoryEntity[] = await this.mongoOperationsService.findMany(InstanceMetagameTerritoryEntity, {state: Ps2alertsEventState.STARTED}); | ||
// | ||
// const documents: Array<{ instance: string, timestamp: Date, vs: number, nc: number, tr: number, nso: number, total: number }> = []; | ||
// | ||
// for await (const instance of actives) { | ||
// // If instance is overdue, don't process | ||
// if (Date.now() > (instance.timeStarted.getTime() + instance.duration)) { | ||
// this.logger.warn(`Instance [${instance.instanceId}] is overdue, skipping population history job`); | ||
// continue; | ||
// } | ||
// | ||
// // Scan through each world, each zone and each faction to get the count from the set. | ||
// let total = 0; | ||
// | ||
// for (const faction of factionArray) { | ||
// const worldZoneKey = `${instance.world}-${instance.zone}-${faction}`; | ||
// const chars = await this.getCharacterList(world, zone, faction); | ||
// | ||
// // If there are no characters, don't bother. | ||
// if (chars.length === 0) { | ||
// continue; | ||
// } | ||
// | ||
// total += chars.length; | ||
// | ||
// // If this is the first run for the world / zone, make a empty PopulationData entry. | ||
// if (!populationData.has(mapKey)) { | ||
// populationData.set(mapKey, new PopulationData( | ||
// world, | ||
// zone, | ||
// 0, | ||
// 0, | ||
// 0, | ||
// 0, | ||
// 0, | ||
// )); | ||
// } | ||
// | ||
// const map = populationData.get(mapKey); | ||
// | ||
// if (map) { | ||
// const factionShortKey = FactionUtils.parseFactionIdToShortName(faction); | ||
// // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// // @ts-ignore | ||
// map[factionShortKey] = chars.length; | ||
// populationData.set(mapKey, map); | ||
// } | ||
// } | ||
// | ||
// // Update totals | ||
// const map = populationData.get(mapKey); | ||
// | ||
// if (map) { | ||
// map.total = total; | ||
// populationData.set(mapKey, map); | ||
// } | ||
// | ||
// // Pull latest populations from redis | ||
// try { | ||
// const | ||
// | ||
// // Check if instances match data | ||
// documents.push({ | ||
// instance: instance.instanceId, | ||
// timestamp: new Date(), | ||
// vs: event.vs, | ||
// nc: event.nc, | ||
// tr: event.tr, | ||
// nso: event.nso, | ||
// total: event.total, | ||
// }); | ||
// this.logger.log(`Updated population history for instance ${instance.instanceId}`); | ||
// } catch (e) { | ||
// // Ignore error if there isn't any | ||
// } | ||
// } | ||
// | ||
// if (documents.length > 0) { | ||
// await this.mongoOperationsService.insertMany( | ||
// InstanceCombatHistoryAggregateEntity, | ||
// documents, | ||
// ); | ||
// } | ||
// | ||
// // @See CronHealthIndicator | ||
// // This sets the fact that the cron has run, so if it hasn't been run it will be terminated. | ||
// const key = '/crons/combatHistory'; | ||
// await this.cacheService.set(key, Date.now(), 65); // 65 seconds = deadline for this cron | ||
// this.logger.debug('Set combat cron run time'); | ||
// } | ||
// | ||
// private getCharacters(world: World, zone: Zone, faction: Faction) { | ||
// const chars = await this.cacheClient.smembers(`CharacterPresencePops-${world}-${zone}-${faction}`); | ||
// | ||
// // For each character, loop through and check if they still exist in Redis, which is based off an expiry. | ||
// // If they don't, they're inactive, so we'll delete them out of the set. | ||
// // eslint-disable-next-line @typescript-eslint/no-for-in-array | ||
// for (const char in chars) { | ||
// const exists = await this.cacheClient.exists(`CharacterPresence-${chars[char]}`); | ||
// | ||
// if (!exists) { | ||
// CharacterPresenceHandler.logger.silly(`Removing stale char ${chars[char]} from set CharacterPresencePops-${world}-${zone}-${faction}`); | ||
// await this.cacheClient.srem(`CharacterPresencePops-${world}-${zone}-${faction}`, chars[char]); | ||
// changes = true; | ||
// } | ||
// } | ||
// | ||
// // Since the above list has been changed, we'll return the characters again. | ||
// if (changes) { | ||
// return await this.cacheClient.smembers(`CharacterPresencePops-${world}-${zone}-${faction}`); | ||
// } | ||
// } | ||
// } |
14 changes: 14 additions & 0 deletions
14
src/modules/data/entities/aggregate/common/outfitwars.teams.embed.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable @typescript-eslint/explicit-member-accessibility,@typescript-eslint/naming-convention */ | ||
import {Column} from 'typeorm'; | ||
import {ApiProperty} from '@nestjs/swagger'; | ||
import OutfitEmbed from './outfit.embed'; | ||
|
||
export default class OutfitWarsTeamsEmbed { | ||
@ApiProperty({description: 'Red team outfit info'}) | ||
@Column(() => OutfitEmbed) | ||
red: OutfitEmbed; | ||
|
||
@ApiProperty({description: 'Blue team outfit info'}) | ||
@Column(() => OutfitEmbed) | ||
blue: OutfitEmbed; | ||
} |
44 changes: 44 additions & 0 deletions
44
src/modules/data/entities/aggregate/common/outfitwars.territory.result.embed.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* eslint-disable @typescript-eslint/explicit-member-accessibility,@typescript-eslint/naming-convention */ | ||
import {Column} from 'typeorm'; | ||
import {ApiProperty} from '@nestjs/swagger'; | ||
import {Team, outfitWarsTeamArray} from '../../../ps2alerts-constants/outfitwars/team'; | ||
import OutfitWarsTeamsEmbed from './outfitwars.teams.embed'; | ||
|
||
export default class OutfitWarsTerritoryResultEmbed { | ||
@ApiProperty({example: 33, description: 'Blue team capture percentage'}) | ||
@Column({ | ||
type: 'number', | ||
}) | ||
blue: number; | ||
|
||
@ApiProperty({example: 33, description: 'Red team capture percentage'}) | ||
@Column({ | ||
type: 'number', | ||
}) | ||
red: number; | ||
|
||
@ApiProperty({example: 33, description: 'Percentage of bases cut off from warpgates (which don\'t contribute to faction score)'}) | ||
@Column({ | ||
type: 'number', | ||
}) | ||
cutoff: number; | ||
|
||
@ApiProperty({example: Team.RED, enum: outfitWarsTeamArray, description: 'victor of the instance. 1 = Red, 2 = Blue'}) | ||
@Column({ | ||
type: 'number', | ||
enum: outfitWarsTeamArray, | ||
}) | ||
victor: Team; | ||
|
||
@ApiProperty({example: false, description: 'Per base capture worth in percentage'}) | ||
@Column({ | ||
type: 'decimal', | ||
precision: 2, | ||
scale: 2, | ||
}) | ||
perBasePercentage: number; | ||
|
||
@ApiProperty({description: 'Victory data for the instance'}) | ||
@Column(() => OutfitWarsTeamsEmbed) | ||
outfits: OutfitWarsTeamsEmbed; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file shouldn't exist in this PR, my bad