-
Notifications
You must be signed in to change notification settings - Fork 6
Operator Stats
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
-
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 andFileServices.WriteFile(path, operators);
to write the file -
Use the extension method
d6Client.GetOperatorStats(account, operators)
whereoperators
is theIEnumerable<OperatorStats>
we have just read-in to get the operators filled in.
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
}