/// <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))); }
public DailyTaskWrapper(TaskInfo info, TaskDetail detail, ITaskHelper helper) { this.info = info; this.detail = detail; this.helper = helper; var times = detail.Quality - detail.DoneNum; Debug.Assert(times > 0); Difficulty = helper.PredictDifficulty(times); }
public static TaskDetail Parse(JToken token) { var result = new TaskDetail(); result.CanReceived = (bool)token["canrecive"]; var taskdto = token["taskdto"]; result.Quality = (int)taskdto["quality"]; // result.Type = (int) taskdto["type"]; ??? result.Name = (string)taskdto["name"]; result.DoneNum = (int)taskdto["num"]; var type = TaskType.Other; if (result.Name == "Mua bán lúa") { type = TaskType.Food; } else if (result.Name == "Cải tạo") { type = TaskType.Improve; } else if (result.Name == "Thu Thuế") { type = TaskType.Impose; } else if (result.Name == "Sử dụng Xu") { type = TaskType.Gold; } else if (result.Name == "Chinh chiến") { type = TaskType.AttackNpc; } else if (result.Name == "Nâng cấp trang bị") { type = TaskType.Upgrade; } result.Type = type; return(result); }