Auto-formatting for context classes.

This commit is contained in:
Refringe 2023-11-10 15:23:51 -05:00
parent ab7f41b924
commit 5fa8803f8c
No known key found for this signature in database
GPG Key ID: 64E03E5F892C6F9E
3 changed files with 29 additions and 28 deletions

View File

@ -11,15 +11,16 @@ export class ApplicationContext
private static holderMaxSize = 10;
/**
* Called like:
* @examples
*
* const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue<IRegisterPlayerRequestData>();
* const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST)
* .getValue<IRegisterPlayerRequestData>();
*
* const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue<string>();
* const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID)
* .getValue<string>();
*
* const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue<IStartOfflineRaidRequestData>();
* @param type
* @returns
* const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO)
* .getValue<IStartOfflineRaidRequestData>();
*/
public getLatestValue(type: ContextVariableType): ContextVariable
{
@ -27,7 +28,6 @@ export class ApplicationContext
{
return this.variables.get(type)?.getTail()?.getValue();
}
return undefined;
}
@ -37,7 +37,6 @@ export class ApplicationContext
{
return this.variables.get(type).toList();
}
return undefined;
}
@ -45,12 +44,18 @@ export class ApplicationContext
{
let list: LinkedList<ContextVariable>;
if (this.variables.has(type))
{
list = this.variables.get(type);
}
else
{
list = new LinkedList<ContextVariable>();
}
if (list.getSize() >= ApplicationContext.holderMaxSize)
{
list.removeFirst();
}
list.add(new ContextVariable(value, type));
this.variables.set(type, list);

View File

@ -1,11 +1,7 @@
export enum ContextVariableType
{
/** Logged in users session id */
SESSION_ID = 0,
/** Currently acive raid information */
RAID_CONFIGURATION = 1,
/** Timestamp when client first connected */
CLIENT_START_TIMESTAMP = 2,
/** When player is loading into map and loot is requested */
REGISTER_PLAYER_REQUEST = 3
{
SESSION_ID = 0, // Logged in users session id
RAID_CONFIGURATION = 1, // Currently active raid information
CLIENT_START_TIMESTAMP = 2, // Timestamp when client first connected
REGISTER_PLAYER_REQUEST = 3, // When player is loading into map and loot is requested
}