DOCUMENTATION
Class GameRoom
Uses:
To create and keep track of all the players on the room
Params
| name |
type |
description |
| red |
list[int] |
array of ID's |
| blue |
list[int] |
array of ID's |
| spect |
list[int] |
array of ID's |
| max_players |
list[int] |
the max players in red or blue |
Methods
constructor
Uses:
To create new objects of this type
Params
| name |
type |
description |
| max_players |
int |
The number of players for the teams (red and blue) |
Pre-conditions:
Post-conditions
isGameMax
Uses:
Returns if both teams are full
Params
| name |
type |
description |
| c |
gameRoom |
the Game Room |
Pre-conditions:
Post-conditions
addPlayer
Uses:
Adds a player to the teams that needs a player. If both teams have the exact same number of
players and they are less than the max_players, the player is added to red. If both the teams are full, the player is set to the spect's teams
Params
| name |
type |
description |
| id |
int |
The player's ID. |
Pre-conditions:
Post-conditions
#addPlayerRed/Blue/Spect
Uses:
Deletes the player from all the teams and set it to the selected (red, blue or spect)
Params
| name |
type |
description |
| c |
gameRoom |
the Game Room |
| id |
int |
The player's id to set to the given team |
Pre-conditions:
Post-conditions
deletePlayer
Uses:
Deletes the player from all the teams. It don't affect the orders in the arrays. All the elements after this are set with an index befero they were originally placed
Params
| name |
type |
description |
| id |
int |
The player's ID |
Pre-conditions:
Post-conditions
#searchID_red/blue/spect
Uses:
Gets the index in the given team. If no player has this id, it returns -1
Params
| name |
type |
description |
| c |
gameRoom |
the Game Room |
| id |
int |
The player's id |
Pre-conditions:
Post-conditions
movePlayer
Uses:
Moves the player to the team passed
Params
| name |
type |
description |
| c |
gameRoom |
the Game Room |
| id |
int |
The player's ID |
| team |
id |
The player's team |
Pre-conditions:
Post-conditions
movePlayerIfNeeded
Uses:
Params
| name |
type |
description |
| c |
gameRoom |
the Game Room |
|
|
|
Pre-conditions:
Post-conditions
#existID
Uses:
Params
| name |
type |
description |
| c |
gameRoom |
the Game Room |
| id |
int |
The player's id |
Pre-conditions:
Post-conditions
Class Player
Uses:
To create and keep track of all the players on the room
Params
| name |
type |
description |
| res |
list[int] |
array of ID's |
| blue |
list[int] |
array of ID's |
| spect |
list[int] |
array of ID's |
| max_players |
list[int] |
the max players in red or blue |
Methods
constructor
Uses:
Creates the player object with the given parameters and afk set to false
Params
| name |
type |
description |
| id |
int |
The player's ID |
| auth |
string |
The player's auth |
| name |
string |
The player's name |
| authorization |
int |
The level of authorization to make some commands |
Pre-conditions:
Post-conditions
invertAFK
Uses:
Set the afk state to the negative of the afk parameter
Params
| name |
type |
description |
| Pla |
Player |
The player object |
Pre-conditions:
Post-conditions
set authorization
Uses:
Sets the authorization of the player to a given authorization
Params
| name |
type |
description |
| Pla |
Player |
The player object |
| authorization |
int |
The player's authorization |
Pre-conditions:
Post-conditions
Class List_of_players
Uses:
To create and keep track of all the players on the room
Params
| name |
type |
description |
| list |
array() |
A list of the players |
Methods
constructor
Uses:
Creates the object List_of_players
Params
It doesn't take any parameter
Pre-conditions:
Post-conditions
addPlayer
Uses:
Adds a player to the list
Params
| name |
type |
description |
| list |
List_of_players |
The list of players' object |
| player |
Player |
Player to add to the list |
Pre-conditions:
Post-conditions
#getPlayer
Uses:
Params
Pre-conditions:
Post-conditions
getPlayerByID
Uses:
Params
Pre-conditions:
Post-conditions
#searchID
Uses:
Params
Pre-conditions:
Post-conditions
#removePlayer
Uses:
Params
Pre-conditions:
Post-conditions
#removePlayerByID
Uses:
Params
Pre-conditions:
Post-conditions
Class PlayerStats
Uses:
To create and keep track of all the players on the room
Params
| name |
type |
description |
| res |
list[int] |
array of ID's |
| blue |
list[int] |
array of ID's |
| spect |
list[int] |
array of ID's |
| max_players |
list[int] |
the max players in red or blue |
Methods
constructor
Uses:
Params
Pre-conditions:
Post-conditions
storePlayer
Uses:
Params
Pre-conditions:
Post-conditions
incrementGoal
Uses:
Params
Pre-conditions:
Post-conditions
incrementGames
Uses:
Params
Pre-conditions:
Post-conditions
incrementLoses
Uses:
Params
Pre-conditions:
Post-conditions
incrementWonMatches
Uses:
Params
Pre-conditions:
Post-conditions
incrementAssists
Uses:
Params
Pre-conditions:
Post-conditions
incrementAgainstGoals
Uses:
Params
Pre-conditions:
Post-conditions
incrementMVP
Uses:
Params
Pre-conditions:
Post-conditions
Class statsTeams
Uses:
To create and keep track of all the players on the room
Params
| name |
type |
description |
| res |
list[int] |
array of ID's |
| blue |
list[int] |
array of ID's |
| spect |
list[int] |
array of ID's |
| max_players |
list[int] |
the max players in red or blue |
Methods
constructor
Uses:
Params
Pre-conditions:
Post-conditions
setFalseIsGameMax
Uses:
Params
Pre-conditions:
Post-conditions
storeData
Uses:
Params
Pre-conditions:
Post-conditions
addMatch
Uses:
Params
Pre-conditions:
Post-conditions
addVictoryTo
Uses:
Params
Pre-conditions:
Post-conditions
addDefeatTo
Uses:
Params
Pre-conditions:
Post-conditions
addGoalTo
Uses:
Params
Pre-conditions:
Post-conditions
addAsisTo
Uses:
Params
Pre-conditions:
Post-conditions
Class LocalStorage
Uses:
To create and keep track of all the players on the room
Params
| name |
type |
description |
| res |
list[int] |
array of ID's |
| blue |
list[int] |
array of ID's |
| spect |
list[int] |
array of ID's |
| max_players |
list[int] |
the max players in red or blue |
Methods
existsData
Uses:
Params
Pre-conditions:
Post-conditions
storeData
Uses:
Params
Pre-conditions:
Post-conditions
getData
Uses:
Params
Pre-conditions:
Post-conditions
getAllLocalStorage
Uses:
Params
Pre-conditions:
Post-conditions
importLocalStorage
Uses:
Params
Pre-conditions:
Post-conditions
Class colaConLimit
Uses:
To create and keep track of all the players on the room
Params
| name |
type |
description |
| res |
list[int] |
array of ID's |
| blue |
list[int] |
array of ID's |
| spect |
list[int] |
array of ID's |
| max_players |
list[int] |
the max players in red or blue |
Methods
constructor
Uses:
Params
Pre-conditions:
Post-conditions
length
Uses:
Params
Pre-conditions:
Post-conditions
isEmpty
Uses:
Params
Pre-conditions:
Post-conditions
addElement
Uses:
Params
Pre-conditions:
Post-conditions
Functions
Function setTeam
Uses:
Params
Pre-conditions:
Post-conditions
Function isCommand
Uses:
Params
Pre-conditions:
Post-conditions
Function makeCommand
Uses:
Params
Pre-conditions:
Post-conditions
Function showMessage
Uses:
Params
Pre-conditions:
Post-conditions
class GameRoom
Params
| name |
type |
description |
| red |
int |
array of ID's |
| blue |
int |
array of ID's |
| spect |
int |
array of ID's |
| max_players |
int |
the max players in red or blue |
Methods
Uses
This object is for keep a track of the players in all the room and to move them from one team to another
-
constructor
- params:
- max_players : int
The number of players for the teams (red and blue)
- pre-condition:
- post-condition:
- |res.red| = 0
- |res.blue| = 0
- |res.spect| = 0
- res.max_players = max_players
-
getters
-
isGameMax
-
addPlayer
-
addPlayerRed
-
addPlayerBlue
-
addPlayerSpect
-
deletePlayer
-
searchID_red
-
searchID_blue
-
searchID_spect
-
movePlayer
-
movePlayerIfNeeded
-
existID