public void RecruitKnight(string knightName) { var stopwatch = Stopwatch.StartNew(); var featureResults = FeatureResults.Success; try { OnFeatureStart?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now); _plemionaDefaultFeatures.RecruitKnight(knightName); } catch (BotCheckException) { featureResults = FeatureResults.BotCheck; throw; } catch (FeatureException fe) { featureResults = fe.PlemionaError ? FeatureResults.PlemionaError : FeatureResults.UnexpectedError; throw; } finally { OnFeatureEnd?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now, stopwatch.ElapsedMilliseconds, featureResults); stopwatch.Stop(); } }
public OwnPlayer GetOwnPlayer() { var stopwatch = Stopwatch.StartNew(); var featureResults = FeatureResults.Success; try { OnFeatureStart?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now); var ownPlayer = _plemionaDefaultFeatures.GetOwnPlayer(); return(ownPlayer); } catch (BotCheckException) { featureResults = FeatureResults.BotCheck; throw; } catch (FeatureException fe) { featureResults = fe.PlemionaError ? FeatureResults.PlemionaError : FeatureResults.UnexpectedError; throw; } finally { OnFeatureEnd?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now, stopwatch.ElapsedMilliseconds, featureResults); stopwatch.Stop(); } }
public IEnumerable <Village> GetNerbaryVillages(int radiusFields) { var stopwatch = Stopwatch.StartNew(); var featureResults = FeatureResults.Success; try { OnFeatureStart?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now); var villages = _plemionaDefaultFeatures.GetNerbaryVillages(radiusFields); return(villages); } catch (BotCheckException) { featureResults = FeatureResults.BotCheck; throw; } catch (FeatureException fe) { featureResults = fe.PlemionaError ? FeatureResults.PlemionaError : FeatureResults.UnexpectedError; throw; } finally { OnFeatureEnd?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now, stopwatch.ElapsedMilliseconds, featureResults); stopwatch.Stop(); } }
public void SignIn(string plemionaUrl, string username, string password, int worldNumber) { var stopwatch = Stopwatch.StartNew(); var featureResults = FeatureResults.Success; try { OnFeatureStart?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now); _plemionaDefaultFeatures.SignIn(plemionaUrl, username, password, worldNumber); } catch (BotCheckException) { featureResults = FeatureResults.BotCheck; throw; } catch (FeatureException fe) { featureResults = fe.PlemionaError ? FeatureResults.PlemionaError : FeatureResults.UnexpectedError; throw; } finally { OnFeatureEnd?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now, stopwatch.ElapsedMilliseconds, featureResults); stopwatch.Stop(); } }
public void SendTroops(Troops troops, int coordinateX, int coordinateY, TroopsIntentions troopsIntentions, SendingTroopsInfo sendingTroopsInfo = null) { var stopwatch = Stopwatch.StartNew(); var featureResults = FeatureResults.Success; try { OnFeatureStart?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now); _plemionaDefaultFeatures.SendTroops(troops, coordinateX, coordinateY, troopsIntentions, sendingTroopsInfo); } catch (BotCheckException) { featureResults = FeatureResults.BotCheck; throw; } catch (FeatureException fe) { featureResults = fe.PlemionaError ? FeatureResults.PlemionaError : FeatureResults.UnexpectedError; throw; } finally { OnFeatureEnd?.Invoke(MethodBase.GetCurrentMethod().Name, DateTime.Now, stopwatch.ElapsedMilliseconds, featureResults); stopwatch.Stop(); } }