StartFarming() 개인적인 메소드

private StartFarming ( ) : Task
리턴 Task
예제 #1
0
        private async void OnPurchaseResponse(ArchiHandler.PurchaseResponseCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            var purchaseResult = callback.PurchaseResult;
            var items          = callback.Items;

            SendMessageToUser(SteamMasterID, "Status: " + purchaseResult + " | Items: " + string.Join("", items));

            if (purchaseResult == ArchiHandler.PurchaseResponseCallback.EPurchaseResult.OK)
            {
                await CardsFarmer.StartFarming().ConfigureAwait(false);
            }
        }
예제 #2
0
        private async void OnLoggedOn(SteamUser.LoggedOnCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            EResult result = callback.Result;

            switch (result)
            {
            case EResult.AccountLogonDenied:
                AuthCode = Program.GetUserInput(SteamLogin, Program.EUserInputType.SteamGuard);
                break;

            case EResult.AccountLoginDeniedNeedTwoFactor:
                TwoFactorAuth = Program.GetUserInput(SteamLogin, Program.EUserInputType.TwoFactorAuthentication);
                break;

            case EResult.OK:
                Logging.LogGenericInfo(BotName, "Successfully logged on!");

                if (!SteamNickname.Equals("null"))
                {
                    SteamFriends.SetPersonaName(SteamNickname);
                }

                if (SteamParentalPIN.Equals("null"))
                {
                    SteamParentalPIN = Program.GetUserInput(BotName, Program.EUserInputType.SteamParentalPIN);
                }

                await ArchiWebHandler.Init(SteamClient, callback.WebAPIUserNonce, callback.VanityURL, SteamParentalPIN).ConfigureAwait(false);

                ulong clanID = SteamMasterClanID;
                if (clanID != 0)
                {
                    SteamFriends.JoinChat(clanID);
                }

                if (Statistics)
                {
                    SteamFriends.JoinChat(Program.ArchiSCFarmGroup);
                    await ArchiWebHandler.JoinClan(Program.ArchiSCFarmGroup).ConfigureAwait(false);
                }

                await CardsFarmer.StartFarming().ConfigureAwait(false);

                break;

            case EResult.Timeout:
            case EResult.TryAnotherCM:
                Logging.LogGenericWarning(BotName, "Unable to login to Steam: " + callback.Result + " / " + callback.ExtendedResult + ", retrying...");
                await Stop().ConfigureAwait(false);

                await Utilities.SleepAsync(CallbackSleep).ConfigureAwait(false);

                Start();
                break;

            default:
                Logging.LogGenericWarning(BotName, "Unable to login to Steam: " + callback.Result + " / " + callback.ExtendedResult);
                await Shutdown().ConfigureAwait(false);

                break;
            }
        }
예제 #3
0
        private async void OnFriendMsg(SteamFriends.FriendMsgCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            if (callback.EntryType != EChatEntryType.ChatMsg)
            {
                return;
            }

            ulong steamID = callback.Sender;

            if (steamID != SteamMasterID)
            {
                return;
            }

            string message = callback.Message;

            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            if (message.Length == 17 && message[5] == '-' && message[11] == '-')
            {
                ArchiHandler.RedeemKey(message);
                return;
            }

            if (!message.StartsWith("!"))
            {
                return;
            }

            if (!message.Contains(" "))
            {
                switch (message)
                {
                case "!exit":
                    await ShutdownAllBots().ConfigureAwait(false);

                    break;

                case "!farm":
                    await CardsFarmer.StartFarming().ConfigureAwait(false);

                    SendMessageToUser(steamID, "Done!");
                    break;

                case "!restart":
                    await Program.Restart().ConfigureAwait(false);

                    break;

                case "!status":
                    ResponseStatus(steamID);
                    break;

                case "!stop":
                    await Shutdown().ConfigureAwait(false);

                    break;
                }
            }
            else
            {
                string[] args = message.Split(' ');
                switch (args[0])
                {
                case "!start":
                    ResponseStart(steamID, args[1]);
                    break;

                case "!stop":
                    await ResponseStop(steamID, args[1]).ConfigureAwait(false);

                    break;
                }
            }
        }