Mod API Reference:GamePlayer: Difference between revisions

From War.app Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 29: Line 29:
* '''State''' ''[[Mod API Reference:GamePlayerState|GamePlayerState]] (enum)'':  
* '''State''' ''[[Mod API Reference:GamePlayerState|GamePlayerState]] (enum)'':  
* '''Surrendered''' ''boolean'':  
* '''Surrendered''' ''boolean'':  
* '''Team''' ''[[Mod API Reference:TeamID|TeamID]]'':  
* '''Team''' ''[[Mod API Reference:TeamID|TeamID]]'': Specifies the team the player started the game on.  Note that if a team is changed by a GameOrderEvent, this field will still show the team the player started on.  Use GameStanding to determine if a player's team has been overridden.
* '''TimesBooted''' ''integer'':  
* '''TimesBooted''' ''integer'':  
* '''TimesComeBackFromAI''' ''integer'':  
* '''TimesComeBackFromAI''' ''integer'':  
Line 38: Line 38:
== Functions ==
== Functions ==


* '''DisplayName'''('''standingOpt''' ''[[Mod API Reference:GameStanding|GameStanding]]'', '''includeAIWas''' ''boolean'') returns string:  Gets the name of a player.  Typically you will just pass nil and false to the two arguments. Note that this function should only ever be called from Client hooks, as the server does not load player names.
* '''DisplayName'''('''standingOpt''' ''[[Mod API Reference:GameStanding|GameStanding]]'', '''includeAIWas''' ''boolean'') returns string:  Gets the name of a player.  Typically you will just pass nil and false to the two arguments.   Keep in mind that players can change their names, so a mod should never depend on a player having the same name from one turn to the next.


* '''Income'''('''armiesFromReinforcementCards''' ''integer'', '''standing''' ''[[Mod API Reference:GameStanding|GameStanding]]'', '''bypassArmyCap''' ''boolean'', '''ignoreSanctionCards''' ''boolean'') returns [[Mod API Reference:PlayerIncome|PlayerIncome]]:  Determine's a player's income (number of armies they receive per turn.)
* '''Income'''('''armiesFromReinforcementCards''' ''integer'', '''standing''' ''[[Mod API Reference:GameStanding|GameStanding]]'', '''bypassArmyCap''' ''boolean'', '''ignoreSanctionCards''' ''boolean'') returns [[Mod API Reference:PlayerIncome|PlayerIncome]]:  Determine's a player's income (number of armies they receive per turn.)
Line 45: Line 45:
** bypassArmyCap: If this game has the army cap enabled, pass true here to bypass it and get what their income would be if the army cap didn't exist.
** bypassArmyCap: If this game has the army cap enabled, pass true here to bypass it and get what their income would be if the army cap didn't exist.
** ignoreSanctionCards: If this game has sanction cards, and the player is being affected by them, pass true here to bypass them and get what their income would be if they weren't affected by sanction cards.
** ignoreSanctionCards: If this game has sanction cards, and the player is being affected by them, pass true here to bypass them and get what their income would be if they weren't affected by sanction cards.
[[Category:Mod API Reference]]

Latest revision as of 15:08, 28 August 2026

GamePlayer: All details about a player in a game.

  • AIPlayerID Nullable<PlayerID>:
  • AutopilotUsedForNLCFirstTurn boolean:
  • BegunFirstTurn Nullable<DateTime>:
  • BootedBy Nullable<PlayerID>:
  • BootedDuration Nullable<TimeSpan>:
  • Color GameColor:
  • ColorLockedIn boolean:
  • DateInvited DateTime:
  • EndedFirstTurn Nullable<DateTime>:
  • GameID GameID:
  • GamePlayerID integer:
  • HasCommittedOrders boolean:
  • HighestTurnWatched integer:
  • HumanTurnedIntoAI boolean:
  • ID PlayerID:
  • IsAI boolean:
  • IsAIOrHumanTurnedIntoAI boolean:
  • LastGameSpeed TimeSpan:
  • OrdersRevision integer:
  • PlayerID Nullable<PlayerID>:
  • PlayersAcceptedMySurrender Table<PlayerID,DateTime>:
  • PlayersVotedToBoot Table<PlayerID,DateTime>:
  • ScenarioID integer:
  • SeenEndGameWindow boolean:
  • Slot Nullable<Slot>:
  • SpeedRecordBase DateTime:
  • SpeedSamplesForBoot Array<integer>:
  • State GamePlayerState (enum):
  • Surrendered boolean:
  • Team TeamID: Specifies the team the player started the game on. Note that if a team is changed by a GameOrderEvent, this field will still show the team the player started on. Use GameStanding to determine if a player's team has been overridden.
  • TimesBooted integer:
  • TimesComeBackFromAI integer:
  • TurnSince DateTime:
  • WasOpenSeat boolean:


Functions

  • DisplayName(standingOpt GameStanding, includeAIWas boolean) returns string: Gets the name of a player. Typically you will just pass nil and false to the two arguments. Keep in mind that players can change their names, so a mod should never depend on a player having the same name from one turn to the next.
  • Income(armiesFromReinforcementCards integer, standing GameStanding, bypassArmyCap boolean, ignoreSanctionCards boolean) returns PlayerIncome: Determine's a player's income (number of armies they receive per turn.)
    • armiesFromReinforcementCards: Pass in how many armies this player is receiving from playing reinforcement cards. Simply pass 0 if they're not playing any or you want to assume they won't play any in this calculation.
    • standing: To get a player's current income, simply pass the latest standing. Otherwise, if you're looking at history, you can pass a standing to get their income at that point in time.
    • bypassArmyCap: If this game has the army cap enabled, pass true here to bypass it and get what their income would be if the army cap didn't exist.
    • ignoreSanctionCards: If this game has sanction cards, and the player is being affected by them, pass true here to bypass them and get what their income would be if they weren't affected by sanction cards.