Don't StoreStats achievement on trigger if already unlocked

This commit is contained in:
Garry Newman 2017-07-28 17:03:12 +01:00
parent 1c04459cdb
commit a26ae696c2

View File

@ -50,14 +50,10 @@ public Achievement Find( string identifier )
/// </summary> /// </summary>
public bool Trigger( string identifier, bool apply = true ) public bool Trigger( string identifier, bool apply = true )
{ {
var r = client.native.userstats.SetAchievement( identifier ); var a = Find( identifier );
if ( a == null ) return false;
if ( apply ) return a.Trigger( apply );
{
client.Stats.StoreStats();
}
return r;
} }
/// <summary> /// <summary>
@ -159,6 +155,9 @@ public Achievement( Client client, int index )
/// </summary> /// </summary>
public bool Trigger( bool apply = true ) public bool Trigger( bool apply = true )
{ {
if ( State )
return false;
State = true; State = true;
UnlockTime = DateTime.Now; UnlockTime = DateTime.Now;