예제 #1
0
        public async Task <TaskResult> Do(int times)
        {
            var weapon = upgrade.Equipments.FirstOrDefault(item => item.Quality == EquipmentQuality.Trang);

            if (weapon == null)
            {
                // Không có vũ khí trắng.
                Debug.Assert(false);
                return(TaskResult.CanNotBeDone);
            }

            // Hạ cấp hàng loạt.
            var p0 = await writer.DegradeEquipmentAllAsync(weapon.Id);

            if (p0 == null)
            {
                return(TaskResult.LostConnection);
            }

            for (int i = 0; i < times; ++i)
            {
                var result = await DoSingle(weapon.Id, upgrade.Magic);

                if (result != TaskResult.Done)
                {
                    return(result);
                }
            }
            return(TaskResult.Done);
        }