コード例 #1
0
ファイル: DuelRequests.cs プロジェクト: Veraatversus/HZBot
        /// <summary>Checks for duel complete asynchronous.</summary>
        /// <param name="plugin">The plugin.</param>
        /// <returns></returns>
        public static async Task <string> CheckForDuelCompleteAsync(this DuelPlugin plugin)
        {
            var error = await plugin.Account.DefaultRequestContent("checkForDuelComplete")
                        .AddKeyValue("rct", "2")
                        .AddLog($"[Duel] CheckDuelComplete...")
                        .PostToHzAsync();

            return(error);
        }
コード例 #2
0
ファイル: DuelRequests.cs プロジェクト: Veraatversus/HZBot
        /// <summary>Starts the duell asynchronous.</summary>
        /// <param name="plugin">The plugin.</param>
        /// <param name="charID">The character identifier.</param>
        /// <param name="usePremiumCurrency">if set to <c>true</c> [use premium currency].</param>
        /// <returns></returns>
        public static async Task <string> StartDuellAsync(this DuelPlugin plugin, string charID, bool usePremiumCurrency = false)
        {
            var error = await plugin.Account.DefaultRequestContent("startDuel")
                        .AddKeyValue("character_id", charID)
                        .AddKeyValue("use_premium", usePremiumCurrency.ToString().ToLower())
                        .AddKeyValue("rct", "2")
                        .AddLog("[Duel] StartDuel...")
                        .PostToHzAsync();

            return(error);
        }
コード例 #3
0
ファイル: DuelRequests.cs プロジェクト: Veraatversus/HZBot
        /// <summary>Claims the duel rewards asynchronous.</summary>
        /// <param name="plugin">The plugin.</param>
        /// <returns></returns>
        public static async Task <string> ClaimDuelRewardsAsync(this DuelPlugin plugin)
        {
            // Editiere DuelHistory ob Gewonnen
            if (plugin.DuelList != null)
            {
                var index = plugin.DuelList.FirstOrDefault(c => c.id == plugin.Account.Data.ActiveDuel.character_b_id);
                if (index != null)
                {
                    index.Status = (plugin.Account.Data.duel.character_a_status == 2 ? 1 : 0);
                }
            }
            var status = plugin.Account.Data.duel.character_a_status == 2 ? "Gewonnen" : "Verloren!";
            var error  = await plugin.Account.DefaultRequestContent("claimDuelRewards")
                         .AddKeyValue("rct", "2")
                         .AddKeyValue("discard_item", "false")
                         .AddLog($"[Duel] ClaimDuelReward: Status={status}")
                         .PostToHzAsync();

            return(error);
        }