Adds webhooks to Sid Meier's Civilization 5 games. Install this on your pitboss server to be notified anytime a player starts/ends their turn or connects/disconnects.
-
Edit
steamapps/common/Sid Meier's Civilization V/Assets/DLC/Expansion2/UI/InGame/TopPanel.lua
and append the content ofGameStateHook.lua
. This injects the game hook logic, which logs the game state to the game console. Other files can be used, (i.e. if you do not have BNW), but this file works. If you choose to inject into another file, make sure that it is being loaded when hosting a game. -
Edit
Documents/My Games/Sid Meier's Civilization 5/config.ini
and enable logging.
;Update these two properties
MessageLog = 1
LoggingEnabled = 1
-
Copy
WatchLog.ps1
toDocuments/My Games/Sid Meier's Civilization 5/Logs
. Changehttps://my-endpoint.com
to be whatever endpoint you want. -
Make sure that powershell scripts are enabled on your system. https:/go.microsoft.com/fwlink/?LinkID=135170
-
Start the game.
-
Run the
Watchlog.ps1
script. Note that you may need to manually open a powershell console,cd
to the logs directory, and then run the script. Windows does not seem able to automatically open a powershell console in a folder which contains an apostrophe'
, which is the case with the default game directory.
Civ5 Pitboss Webhook will send an HTTP POST request with a JSON body.
{
"gameTurn": 118,
"players": [
{
"id": 1,
"nickName": "Atreides",
"civilization": "Morocco",
"isTurnComplete": false,
"isOnline": true,
"isAlive": true
},
{
"id": 2,
"nickName": "bobby_joe",
"civilization": "America",
"isTurnComplete": true,
"isOnline": false,
"isAlive": true
}
]
}
- Make sure that the game is running before running the script. Make sure that powershell scripts are enabled. (Step 4.)