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))); }
public static CityDetail Parse(JToken token) { var result = new CityDetail(); var merchants = new List <Merchant>(); if (token["merchants"] != null) { foreach (var subToken in token["merchants"]) { var merchant = (Merchant)(int)subToken["id"]; merchants.Add(merchant); } } result.Merchants = merchants; result.AutoPass = false; if (token["autoPass"] != null) { result.AutoPass = (bool)token["autoPass"]; } return(result); }