Ejemplo n.º 1
0
        /// <summary>
        /// Attempts to refresh all heroes.
        /// </summary>
        private async Task<bool> RefreshHeroesAsync() {
            if (asyncLock) {
                return false;
            }
            try {
                asyncLock = true;
                var packet = await packetWriter.SendCommandAsync("41100", "0");
                if (packet == null) {
                    return false;
                }

                barracks = Barracks.Parse(JToken.Parse(packet.Message));
                var details = new List<HeroDetail>();
                var heroIds = new List<int>();
                foreach (var hero in barracks.Heroes) {
                    heroIds.Add(hero.Id);
                    var p1 = await packetWriter.SendCommandAsync("41107", hero.Id.ToString());
                    if (p1 == null) {
                        return false;
                    }
                    var detail = HeroDetail.Parse(JToken.Parse(p1.Message));
                    details.Add(detail);
                }

                heroDetails = details;
                heroList.SetObjects(heroIds, true);
                return true;
            } finally {
                asyncLock = false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Nhận thưởng tiêu xu hằng ngày.
        /// </summary>
        public static async void UseGoldDailyAsync(this IPacketWriter writer)
        {
            for (int i = 1; i < 32; i++)
            {
                await writer.SendCommandAsync("64631", i.ToString(), "2");

                await Task.Delay(500);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Lấy thông tin của nhiêm vụ.
        /// </summary>
        /// <param name="taskId">ID nhiêm vụ.</param>
        public static async Task <TaskDetail> RefreshTaskAsync(this IPacketWriter writer, int taskId)
        {
            var packet = await writer.SendCommandAsync(44201, taskId.ToString());

            if (packet == null)
            {
                return(null);
            }
            return(TaskDetail.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Làm mới sở nghiên cứu.
        /// </summary>
        public static async Task <InstituteInfo> RefreshInstituteAsync(this IPacketWriter writer)
        {
            var packet = await writer.SendCommandAsync("63601");

            if (packet == null)
            {
                return(null);
            }
            return(InstituteInfo.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Giao diện nâng.
        /// </summary>
        /// <param name="type">Loại trang: 0 = Tất cả, 1 = Vũ khí, etc...</param>
        /// <param name="index">Thứ tự trang.</param>
        /// <param name="size">Kích thước trang.</param>
        /// <returns></returns>
        public static async Task <UpgradeInfo> RefreshUpgradeAsync(this IPacketWriter writer, int type, int index, int size)
        {
            var packet = await writer.SendCommandAsync(39301, type.ToString(), index.ToString(), size.ToString());

            if (packet == null)
            {
                return(null);
            }
            return(UpgradeInfo.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Nâng cấp trang bị.
        /// </summary>
        /// <param name="equipmentId">ID của trang bị.</param>
        /// <param name="magic">Ma lực hiện tại.</param>
        public static async Task <UpgradeResult> UpgradeEquipmentAsync(this IPacketWriter writer, int equipmentId, int magic)
        {
            var packet = await writer.SendCommandAsync(39302, equipmentId.ToString(), "0", magic.ToString());

            if (packet == null)
            {
                return(null);
            }
            return(UpgradeResult.Parse(packet));
        }
Ejemplo n.º 7
0
        public static async Task <ImposeInfo> RefreshImposeAsync(this IPacketWriter writer)
        {
            var packet = await writer.SendCommandAsync(12400);

            if (packet == null)
            {
                return(null);
            }
            return(ImposeInfo.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Giao diện túi đồ.
        /// </summary>
        /// <param name="index">Thứ tự của trang.</param>
        /// <param name="size">Kích thước của mỗi trang.</param>
        public static async Task <StoreInfo> RefreshStoreAsync(this IPacketWriter writer, int index, int size)
        {
            var packet = await writer.SendCommandAsync(39100, index.ToString(), size.ToString());

            if (packet == null)
            {
                return(null);
            }
            return(StoreInfo.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Làm mới danh sách nhiệm vụ.
        /// </summary>
        public static async Task <TaskBoard> RefreshTaskBoardAsync(this IPacketWriter writer)
        {
            var packet = await writer.SendCommandAsync(44301);

            if (packet == null)
            {
                return(null);
            }
            return(TaskBoard.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 10
0
        public static async Task <CityDetail> RefreshCityAsync(this IPacketWriter writer, int areaId, int scopeId, int cityIndex)
        {
            var packet = await writer.SendCommandAsync("31106", areaId.ToString(), scopeId.ToString(), cityIndex.ToString());

            if (packet == null)
            {
                return(null);
            }
            return(CityDetail.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 11
0
        public static async Task <Scope> RefreshScopeAsync(this IPacketWriter writer, int areaId, int scopeId)
        {
            var packet = await writer.SendCommandAsync("31102", areaId.ToString(), scopeId.ToString());

            if (packet == null)
            {
                return(null);
            }
            return(Scope.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 12
0
        public static async Task <MarketInfo> RefreshMarketAsync(this IPacketWriter writer)
        {
            var packet = await writer.SendCommandAsync(13100);

            if (packet == null)
            {
                return(null);
            }
            return(MarketInfo.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Nhận liên thắng.
        /// </summary>
        /// <param name="year">năm nhận liên thắng.</param>
        /// <param name="lt">số liên thắng.</param>
        public static async Task <Packet> GetMailTTCAsync(this IPacketWriter writer, int year, int boss)
        {
            var packet = await writer.SendCommandAsync(60601, boss.ToString(), year.ToString());

            if (packet == null)
            {
                return(null);
            }
            string str   = "";
            JToken token = JToken.Parse(packet.Message);

            if (token.ToString() != "\"\"" && token.ToString() != "")
            {
                Console.WriteLine(token.ToString());
                JArray array = (JArray)token["goodsDtoList"];

                for (int i = 0; i < array.Count; i++)
                {
                    JObject obj = (JObject)array[i];
                    str += obj["id"].ToString().Replace("\"", "") + ",";
                }
            }
            return(await writer.SendCommandAsync(60603, boss.ToString(), str, year.ToString(), "0"));
        }
Ejemplo n.º 14
0
        private async Task SendCommand(string commandId, params string[] parameters)
        {
            if (commandId.Length == 0)
            {
                return;
            }
            replyBox.Clear();
            var nonEmptyParameters = parameters.Where(p => p.Length > 0).ToArray();
            var packet             = await packetWriter.SendCommandAsync(commandId, nonEmptyParameters);

            if (packet == null)
            {
                return;
            }
            replyBox.Text = packet.Message;
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Hạ cấp trang bị.
 /// </summary>
 /// <param name="equipmentId">ID của trang bị.</param>
 /// <param name="magic">Ma lực hiện tại</param>
 public static async Task <Packet> DegradeEquipmentAsync(this IPacketWriter writer, int equipmentId, int magic)
 {
     return(await writer.SendCommandAsync(39103, equipmentId.ToString(), "0", magic.ToString()));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Cải tiến.
 /// </summary>
 /// <param name="heroId">ID của tướng.</param>
 public static async Task <Packet> ImproveHeroAsync(this IPacketWriter writer, int heroId)
 {
     return(await writer.SendCommandAsync(41301, heroId.ToString(), "0"));
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Collect.
 /// </summary>
 public static async Task <Packet> Collect(this IPacketWriter writer, int value)
 {
     return(await writer.SendCommandAsync("30401", value + ""));
 }
Ejemplo n.º 18
0
 public static async Task <Packet> RefreshCollectAsync(this IPacketWriter writer)
 {
     return(await writer.SendCommandAsync("30100"));
 }
Ejemplo n.º 19
0
 public static Task <Packet> RefreshOutsideAsync(this IPacketWriter writer, long playerId)
 {
     return(writer.SendCommandAsync("62002", playerId.ToString()));
 }
Ejemplo n.º 20
0
 public static async Task <Packet> SendCommandAsync(this IPacketWriter writer, string commandId, params string[] parameters)
 {
     return(await writer.SendCommandAsync(Int32.Parse(commandId), parameters));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Hạ cấp hàng loạt.
 /// </summary>
 /// <param name="equipmentId">ID của trang bị.</param>
 public static async Task <Packet> DegradeEquipmentAllAsync(this IPacketWriter writer, int equipmentId)
 {
     return(await writer.SendCommandAsync(39402, equipmentId.ToString()));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Khiêu chiến với người chơi khác.
 /// </summary>
 /// <param name="playerId">ID của người chơi bị khiêu chiến.</param>
 /// <param name="playerRank">Thứ hạng hiện tại của người chơi bị khiêu chiến.</param>
 public static async Task <Packet> DuelArenaAsync(this IPacketWriter writer, long playerId, int playerRank)
 {
     return(await writer.SendCommandAsync("64007", playerId.ToString(), playerRank.ToString()));
 }
Ejemplo n.º 23
0
 public static Task <Packet> GetDrillResultAsync(this IPacketWriter writer)
 {
     return(writer.SendCommandAsync("62007", "3", "101"));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Làm mới võ đài.
 /// </summary>
 public static async Task <Packet> RefreshArenaAsync(this IPacketWriter writer)
 {
     return(await writer.SendCommandAsync("64005"));
 }
Ejemplo n.º 25
0
 public static Task <Packet> DrillAsync(this IPacketWriter writer)
 {
     return(writer.SendCommandAsync("62006", "3", "101", "0", "0"));
 }
Ejemplo n.º 26
0
 public static async Task <Packet> SetDefaultFormationAsync(this IPacketWriter writer, int formationId)
 {
     return(await writer.SendCommandAsync("42104", formationId.ToString()));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Chuyen bang chu.
 /// </summary>
 ///
 public static async Task <Packet> Swap(this IPacketWriter writer, long slot1Id)
 {
     return(await writer.SendCommandAsync("32108", slot1Id + ""));
 }
Ejemplo n.º 28
0
 public static async Task <Packet> RemoveAllHeroesFromFormationAsync(this IPacketWriter writer, int formationId)
 {
     return(await writer.SendCommandAsync("42107", formationId.ToString()));
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Tìm bang chu.
 /// </summary>
 public static async Task <Packet> RefreshLegionAsync(this IPacketWriter writer)
 {
     return(await writer.SendCommandAsync("32101", "0", "12", " "));
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Giữ cải tiến.
 /// </summary>
 /// <param name="heroId">ID của tướng</param>
 public static async Task <Packet> KeepStatsAsync(this IPacketWriter writer, int heroId)
 {
     return(await writer.SendCommandAsync(41303, heroId.ToString(), "0"));
 }