Skip to content

Sp1rit/ArkData

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARK Player & Tribe file parser

I created this library to use for my new version of the ARK Player & Tribe Viewer. It is an easy way to parse player & tribe files from ARK: Survival Evolved to extract information of you users that RCON tools can't provide.

While I plan to add more fields to be read out, there are some things that can't be parsed easily. An example are the tamed dinos which are saved in the world file.

NuGet

https://www.nuget.org/packages/ArkData/

Install-Package ArkData

Usage

Simple creation of a new container

var container = Container.Create();

Advanced creation by providing dependencies. This allows you to provide custom parsers.

var playerParser = new PlayerFileParser();
var tribeParser = new TribeFileParser();
var steamApi = new SteamApi();
var steamServer = new SteamServer();

var container = new Container(playerParser, tribeParser, steamApi, steamServer);

To load player & tribe files you just need the following line. The players and tribes will be loaded and interlinked so tribes are linked to owners/members.

container.LoadDirectory("C:\\ArkDataFiles");

You can also load additional Steam information for the user like bans and its avatar. In addition to that the Steam username is refreshed if it has changed since ARK only saves the user name when the player first joins the server.

container.LoadSteamData("SteamAPIKey");

To see if a player is online the have to request the online players from your server. You can do that with a simple call.

var ip = IPAddress.Parse("127.0.0.1");
var server = new IPEndPoint(ip, 27015);

container.LoadOnlinePlayers(server);

All methods can also be accessed asynchronous using the async pattern.

var container = new Container(playerParser, tribeParser, steamApi, steamServer);

await container.LoadDirectoryAsync("C:\\ArkDataFiles");
await container.LoadSteamData("SteamAPIKey");
await container.LoadOnlinePlayers(ip, 27015);

Putting it together

// Initialize shared dependencies
var playerParser = new PlayerFileParser();
var tribeParser = new TribeFileParser();
var steamApi = new SteamApi();
var steamServer = new SteamServer();

// Define server endpoints
var publicServer = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 27015);
var privateServer = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 27015);

// Public server
var container1 = new Container(playerParser, tribeParser, steamApi, steamServer);
await container1.LoadDirectoryAsync("C:\Server1\SaveData");
await container1.LoadSteamData("MY-STEAM-KEY");
await container1.LoadOnlinePlayers(publicServer);

var onlinePlayers = container1.Players.Where(p => p.Online);

// Private server
// Don't need steam ban information for private server so don't provide steam api
var privateConainer = new Container(playerParser, tribeParser, null, steamServer);
await privateConainer.LoadDirectoryAsync("C:\PrivateServer\SaveData");
await privateContainer.LoadOnlinePlayers(privateServer);

var averageLevel = privateContainer.Players.Average(p => p.Level);

About

Provides easy methods to parse server files of ARK: Survival Evolved.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages