public VendorTeleportGump(ShopMap map) : base(10, 10) { m_ShopMap = map; m_Used = map.Used; AddPage(0); AddBackground(0, 0, 414, 214, 0x7752); if (m_Used) { /** * Please select 'Accept' if you would like to return to ~1_loc~ (~2_facet~). This map will be deleted after use. */ AddHtmlLocalized(27, 47, 380, 80, 1154637, string.Format("{0}\t#{1}", ShopMap.GetLocationFormatted(map.PreviousLocation, map.PreviousMap), map.PreviousMap.GetNameCliloc()), 0x4E73, false, false); } else { /** * Please select 'Accept' if you would like to pay ~1_cost~ gold to teleport to vendor ~2_name~. * For this price you will also be able to teleport back to this location within the next ~3_minutes~ minutes. */ AddHtmlLocalized(27, 47, 380, 80, 1154635, string.Format("{0}\t{1}\t{2}", ShopMap.TeleportCost, map.VendorName, ShopMap.DeleteDelayMinutes), 0x4E73, false, false); } AddButton(377, 167, 0x7746, 0x7746, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(267, 167, 100, 40, 1114514, "#1150299", 0x4E73, false, false); // <DIV ALIGN=RIGHT>ACCEPT</DIV> AddButton(7, 167, 0x7747, 0x7747, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(47, 167, 100, 40, 1150300, 0x4E73, false, false); // CANCEL }
public bool CheckTopAlleyRight(Coordinates current) { Coordinates check = new Coordinates(current.x, current.y + 1); if (!ShopMap.ContainsKey(check)) { return(false); } int column = current.y + 1; bool isThere = false; List <CellState> cellsProducts = new List <CellState>(); var subCells = ShopMap.Select(i => i.Key).Where(d => d.y == column && d.x <= current.x).ToList(); for (int i = 0; i < subCells.Count(); i++) { cellsProducts.Add(ShopMap[subCells[i]]); } foreach (CellState s in cellsProducts) { if (ListOfProducts.Contains(new Product(s))) { isThere = true; } } return(isThere); }
public void RemoveProductFromListIfPossible(Coordinates currentCoordinates) { Coordinates lCoords = new Coordinates(currentCoordinates.x, currentCoordinates.y - 1); Coordinates rCoords = new Coordinates(currentCoordinates.x, currentCoordinates.y + 1); if (!ShopMap.ContainsKey(lCoords) || !ShopMap.ContainsKey(rCoords)) { return; } if (IsTheItemOnListOfProductLeft(currentCoordinates)) { foreach (var c in ListOfProducts.ToList()) { if (c.NameOfProduct.StateOfCell == ShopMap[lCoords].StateOfCell) { ListOfProducts.Remove(c); } } } if (IsTheItemOnListOfProductRight(currentCoordinates)) { foreach (var c in ListOfProducts.ToList()) { if (c.NameOfProduct.StateOfCell == ShopMap[rCoords].StateOfCell) { ListOfProducts.Remove(c); } } } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID == 2) { VendorSearchQueryGump.StartSearch(from, m_Criteria, m_Page + 1); return; } int index = info.ButtonID - 100; if (!from.BeginAction(typeof(ShopMap))) { from.SendLocalizedMessage(500119); // You must wait to perform another action return; } Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => from.EndAction(typeof(ShopMap))); if (index >= 0 && index < m_Items.Length) { IVendorSearchItem item = m_Items[index]; var mapItem = new ShopMap(item.Vendor, item.Container); if (from.AddToBackpack(mapItem)) { from.SendLocalizedMessage(1154690); // The vendor map has been placed in your backpack. } else { from.SendLocalizedMessage(502385); // Your pack cannot hold this item. mapItem.Delete(); } from.SendGump(new VendorSearchResultsGump(m_Items, m_Criteria, m_Page)); } }
public bool IsCustomerIsOnTop(Coordinates currentCoordinates) { Coordinates check = new Coordinates(currentCoordinates.x, currentCoordinates.y); if (!ShopMap.ContainsKey(check)) { return(false); } Coordinates tempCoordinates = new Coordinates(currentCoordinates.x, currentCoordinates.y); while (!(ShopMap[tempCoordinates].StateOfCell == CellState.TypeOfCell.WALL)) { if (ShopMap[tempCoordinates].StateOfCell == CellState.TypeOfCell.PRIORITY_PASSAGE) { return(true); } tempCoordinates = new Coordinates(tempCoordinates.x + 1, tempCoordinates.y); } return(false); }
public bool IsTheItemOnListOfProductRight(Coordinates currentCoordinates) { Coordinates check = new Coordinates(currentCoordinates.x, currentCoordinates.y + 1); if (!ShopMap.ContainsKey(check)) { return(false); } bool isThere = false; Coordinates cords = new Coordinates(currentCoordinates.x, currentCoordinates.y + 1); ShopMap.TryGetValue(cords, out CellState cell); foreach (var products in ListOfProducts) { if (products.NameOfProduct.StateOfCell == cell.StateOfCell) { isThere = true; } } return(isThere); }
public List <ShopMap> GetList(string type = "") { var list = new List <ShopMap>(); //获取账户 var accounts = _serviceAccount.GetAccounts(Global.USER_ID); //已经映射过的门店 var listMapped = _serviceShop.GetByUserId(Global.USER_ID); //获取365门店 var listShop365 = Bak365Service.GetShopList(); //根据账户获取门店 foreach (var account in accounts) { EleUserApiService serviceUser = new EleUserApiService(); var res = serviceUser.GetUser(account.AccessToken); if (res.error != null) { continue; } JObject jObject = JObject.Parse(res.result.ToString()); JArray shops = JArray.Parse(jObject["authorizedShops"].ToString()); foreach (var shop in shops) { ShopMap shopMap = new ShopMap(); shopMap.AccountId = account.Id; shopMap.AccountNo = account.AccountNo; shopMap.AccountName = account.AccountName; shopMap.AccessToken = account.AccessToken; shopMap.ShopId = (long)shop["id"]; shopMap.ShopNameEle = shop["name"].ToString(); if (type.ToUpper() == "MATCH") { foreach (var shop365 in listShop365) { if (shop["name"].ToString().Contains(shop365.Value)) { shopMap.ShopNo = shop365.Key; shopMap.ShopName = shop365.Value; break; } } } else { var dd = listMapped.Find(a => a.ShopId.ToString() == shop["id"].ToString()); if (dd != null) { shopMap.ShopNo = dd.ShopNo; shopMap.ShopName = listShop365[dd.ShopNo]; } } list.Add(shopMap); } } return(list); }