Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Operator Stats

Albie edited this page Aug 7, 2020 · 1 revision

Because each operator has their own "id" and "gadget", we need to use some sort of dataset to leverage the stats available. DragonFruit maintain an operator dataset, available from the Dragon6-Assets repo

To Use

  1. In your program create use d6Client.GetOperatorInfo(); to get a copy of the operators and their data. Store this somewhere, like in a file and refer to it to get the info faster (make sure it's updated regularly, like every 3 days)

    From a file, you can use OperatorData.FromFile(path); to read the data from a file and FileServices.WriteFile(path, operators); to write the file

  2. Use the extension method d6Client.GetOperatorStats(account, operators) where operators is the IEnumerable<OperatorStats> we have just read-in to get the operators filled in.

Example

This could be in a dependency-injected class or something?

private IEnumerable<OperatorStats> _operatorInfo;

public IEnumerable<OperatorStats> OperatorInfo => _operatorInfo ??= d6Client.GetOperatorInfo(); //todo check how long has elapsed since last download.

public IEnumerable<OperatorStats> GetOperatorInfoFor(AccountInfo account)
{
    return d6Client.GetOperatorStats(account, OperatorInfo); //don't worry about concurrency messing with the objects - the deserializer clones them and uses the cloned objects
}