Exemplo n.º 1
0
        public static Item ConstructMerchantsTrinket(Mobile m, StoreEntry entry)
        {
            switch (entry.Name[0].Number)
            {
            case 1156827: return(new MerchantsTrinket(false));

            case 1156828: return(new MerchantsTrinket(true));
            }

            return(null);
        }
Exemplo n.º 2
0
        public static Item ConstructHaochisPigment(Mobile m, StoreEntry entry)
        {
            var info = HaochisPigment.Table.FirstOrDefault(x => x.Localization == entry.Name[1].Number);

            if (info != null)
            {
                return(new HaochisPigment(info.Type, 50));
            }

            return(null);
        }
Exemplo n.º 3
0
        public static Item ConstructHairDye(Mobile m, StoreEntry entry)
        {
            var info = NaturalHairDye.Table.FirstOrDefault(x => x.Localization == entry.Name[1].Number);

            if (info != null)
            {
                return(new NaturalHairDye(info.Type));
            }

            return(null);
        }
Exemplo n.º 4
0
 public void SetCartAmount(StoreEntry entry, int amount)
 {
     if (amount > 0)
     {
         AddToCart(entry, amount);
     }
     else
     {
         RemoveFromCart(entry);
     }
 }
Exemplo n.º 5
0
        public static Item ConstructForgedMetal(Mobile m, StoreEntry entry)
        {
            switch (entry.Name[1].Number)
            {
            case 1156686: return(new ForgedMetalOfArtifacts(10));

            case 1156687: return(new ForgedMetalOfArtifacts(5));
            }

            return(null);
        }
Exemplo n.º 6
0
        public void RemoveFromCart(StoreEntry entry)
        {
            if (Cart != null && Cart.ContainsKey(entry))
            {
                Cart.Remove(entry);

                if (Cart.Count == 0)
                {
                    Cart = null;
                }
            }
        }
Exemplo n.º 7
0
        public void AddToCart(StoreEntry entry, int amount)
        {
            if (Cart == null)
            {
                Cart = new Dictionary <StoreEntry, int>();
            }

            if (Cart.Count < UltimaStore.MaxCart || Cart.ContainsKey(entry))
            {
                Cart[entry] = amount;
            }
        }
Exemplo n.º 8
0
        public static List <StoreEntry> GetList(StoreCategory cat, StoreEntry forcedEntry = null)
        {
            if (forcedEntry != null)
            {
                return(new List <StoreEntry>()
                {
                    forcedEntry
                });
            }

            return(Entries.Where(e => e.Category == cat).ToList());
        }
Exemplo n.º 9
0
        public static Item ConstructSoulstone(Mobile m, StoreEntry entry)
        {
            switch (entry.Name[0].Number)
            {
            case 1078835: return(new SoulstoneToken(SoulstoneType.Blue));

            case 1078834: return(new SoulstoneToken(SoulstoneType.Green));

            case 1158404: return(new SoulstoneToken(SoulstoneType.Violet));
            }

            return(null);
        }
Exemplo n.º 10
0
        public UltimaStoreGump(PlayerMobile pm, StoreEntry forcedEntry = null)
            : base(pm, 100, 200)
        {
            StoreList = UltimaStore.GetList(Category, forcedEntry);

            if (forcedEntry == null)
            {
                UltimaStore.SortList(StoreList, SortBy);
            }

            pm.Frozen        = true;
            pm.Hidden        = true;
            pm.TempSquelched = true;
        }
Exemplo n.º 11
0
        public static Item ConstructEarrings(Mobile m, StoreEntry entry)
        {
            AosElementAttribute ele = AosElementAttribute.Physical;

            switch (entry.Name[0].Number)
            {
            case 1071092: ele = AosElementAttribute.Fire; break;

            case 1071093: ele = AosElementAttribute.Cold; break;

            case 1071094: ele = AosElementAttribute.Poison; break;

            case 1071095: ele = AosElementAttribute.Energy; break;
            }

            return(new EarringsOfProtection(ele));
        }
Exemplo n.º 12
0
        public static bool IsFeatured(StoreEntry entry)
        {
            bool isFeatured = false;

            for (var index = 0; index < UltimaStore.Entries.Count; index++)
            {
                var e = UltimaStore.Entries[index];

                if (e.ItemType == entry.ItemType && e.Category == StoreCategory.Featured)
                {
                    isFeatured = true;
                    break;
                }
            }

            return(entry.Category == StoreCategory.Featured || isFeatured);
        }
Exemplo n.º 13
0
        public static Item ConstructPigments(Mobile m, StoreEntry entry)
        {
            PigmentType type = PigmentType.None;

            for (int i = 0; i < PigmentsOfTokuno.Table.Length; i++)
            {
                if (PigmentsOfTokuno.Table[i][1] == entry.Name[1].Number)
                {
                    type = (PigmentType)i;
                    break;
                }
            }

            if (type != PigmentType.None)
            {
                return(new PigmentsOfTokuno(type, 50));
            }

            return(null);
        }
Exemplo n.º 14
0
        public static Item ConstructMiniHouseDeed(Mobile m, StoreEntry entry)
        {
            int label = entry.Name[1].Number;

            switch (label)
            {
            default:
                for (int i = 0; i < MiniHouseInfo.Info.Length; i++)
                {
                    if (MiniHouseInfo.Info[i].LabelNumber == entry.Name[1].Number)
                    {
                        var type = (MiniHouseType)i;

                        return(new MiniHouseDeed(type));
                    }
                }
                return(null);

            case 1157015: return(new MiniHouseDeed(MiniHouseType.TwoStoryWoodAndPlaster));

            case 1157014: return(new MiniHouseDeed(MiniHouseType.TwoStoryStoneAndPlaster));
            }
        }
Exemplo n.º 15
0
 public bool IsFeatured(StoreEntry entry)
 {
     return(entry.Category == StoreCategory.Featured ||
            UltimaStore.Entries.Any(e => e.ItemType == entry.ItemType && e.Category == StoreCategory.Featured));
 }
Exemplo n.º 16
0
 public static Item ConstructRobe(Mobile m, StoreEntry entry)
 {
     return(new HoodedBritanniaRobe(entry.ItemID));
 }
Exemplo n.º 17
0
 public static void Register(StoreEntry entry)
 {
     Entries.Add(entry);
 }
Exemplo n.º 18
0
 public void RemoveFromCart(StoreEntry entry)
 {
     Cart.Remove(entry);
 }
Exemplo n.º 19
0
 public PromoItemGump(PlayerMobile pm, StoreEntry entry, int image)
     : base(pm, 150, 200)
 {
     Image = image;
     Entry = entry;
 }
Exemplo n.º 20
0
 public static Item ConstructBOBCoverTwo(Mobile m, StoreEntry entry)
 {
     return(new BagOfBulkOrderCovers(1, 11));
 }
Exemplo n.º 21
0
        public override void AddGumpLayout()
        {
            AddPage(0);
            AddImage(0, 0, 0x9C49);

            AddECHandleInput();

            AddButton(36, 97, Category == StoreCategory.Featured ? 0x9C5F : 0x9C55, 0x9C5F, 100, GumpButtonType.Reply, 0);
            AddHtmlLocalized(36, 100, 125, 25, 1114513, "#1156587", 0x7FFF, false, false); // Featured

            AddECHandleInput();
            AddECHandleInput();

            AddButton(36, 126, Category == StoreCategory.Character ? 0x9C5F : 0x9C55, 0x9C5F, 101, GumpButtonType.Reply, 0);
            AddHtmlLocalized(36, 129, 125, 25, 1114513, "#1156588", 0x7FFF, false, false); // Character

            AddECHandleInput();
            AddECHandleInput();

            AddButton(36, 155, Category == StoreCategory.Equipment ? 0x9C5F : 0x9C55, 0x9C5F, 102, GumpButtonType.Reply, 0);
            AddHtmlLocalized(36, 158, 125, 25, 1114513, "#1078237", 0x7FFF, false, false); // Equipment

            AddECHandleInput();
            AddECHandleInput();

            AddButton(36, 184, Category == StoreCategory.Decorations ? 0x9C5F : 0x9C55, 0x9C5F, 103, GumpButtonType.Reply, 0);
            AddHtmlLocalized(36, 187, 125, 25, 1114513, "#1044501", 0x7FFF, false, false); // Decorations

            AddECHandleInput();
            AddECHandleInput();

            AddButton(36, 213, Category == StoreCategory.Mounts ? 0x9C5F : 0x9C55, 0x9C5F, 104, GumpButtonType.Reply, 0);
            AddHtmlLocalized(36, 216, 125, 25, 1114513, "#1154981", 0x7FFF, false, false); // Mounts

            AddECHandleInput();
            AddECHandleInput();

            AddButton(36, 242, Category == StoreCategory.Misc ? 0x9C5F : 0x9C55, 0x9C5F, 105, GumpButtonType.Reply, 0);
            AddHtmlLocalized(36, 245, 125, 25, 1114513, "#1011173", 0x7FFF, false, false); // Miscellaneous

            AddECHandleInput();
            AddECHandleInput();

            AddButton(36, 271, 0x9C55, 0x9C5F, 106, GumpButtonType.Reply, 0);
            AddHtmlLocalized(36, 274, 125, 25, 1114513, "#1156589", 0x7FFF, false, false); // Promotional Code

            AddECHandleInput();
            AddECHandleInput();

            AddButton(36, 300, 0x9C55, 0x9C5F, 107, GumpButtonType.Reply, 0);
            AddHtmlLocalized(36, 303, 125, 25, 1114513, "#1156875", 0x7FFF, false, false); // FAQ

            AddECHandleInput();

            AddImage(36, 331, 0x9C4A);

            AddHtmlLocalized(36, 334, 125, 25, 1114513, "#1044580", 0x2945, false, false); // Sort By

            AddButton(43, 360, SortBy == SortBy.Name ? 0x9C4F : 0x9C4E, SortBy == SortBy.Name ? 0x9C4F : 0x9C4E, 108, GumpButtonType.Reply, 0);
            AddHtmlLocalized(68, 360, 88, 25, 1037013, 0x6B55, false, false); // Name

            AddButton(43, 386, SortBy == SortBy.PriceLower ? 0x9C4F : 0x9C4E, SortBy == SortBy.PriceLower ? 0x9C4F : 0x9C4E, 109, GumpButtonType.Reply, 0);
            AddHtmlLocalized(68, 386, 88, 25, 1062218, 0x6B55, false, false); // Price Down
            AddImage(110, 386, 0x9C60);

            AddButton(43, 412, SortBy == SortBy.PriceHigher ? 0x9C4F : 0x9C4E, SortBy == SortBy.PriceHigher ? 0x9C4F : 0x9C4E, 110, GumpButtonType.Reply, 0);
            AddHtmlLocalized(68, 412, 88, 25, 1062218, 0x6B55, false, false); // Price Up
            AddImage(110, 412, 0x9C61);

            AddButton(43, 438, SortBy == SortBy.Newest ? 0x9C4F : 0x9C4E, SortBy == SortBy.Newest ? 0x9C4F : 0x9C4E, 111, GumpButtonType.Reply, 0);
            AddHtmlLocalized(68, 438, 88, 25, 1156590, 0x6B55, false, false); // Newest

            AddButton(43, 464, SortBy == SortBy.Oldest ? 0x9C4F : 0x9C4E, SortBy == SortBy.Oldest ? 0x9C4F : 0x9C4E, 112, GumpButtonType.Reply, 0);
            AddHtmlLocalized(68, 464, 88, 25, 1156591, 0x6B55, false, false); // Oldest

            AddECHandleInput();

            AddButton(598, 36, Category == StoreCategory.Cart ? 0x9C5E : 0x9C54, 0x9C5E, 113, GumpButtonType.Reply, 0);
            AddHtmlLocalized(628, 39, 123, 25, 1156593, string.Format("@{0}@{1}", UltimaStore.CartCount(User), Configuration.CartCapacity), 0x7FFF, false, false);

            AddECHandleInput();

            AddBackground(167, 516, 114, 22, 0x2486);
            AddTextEntry(169, 518, 110, 18, 0, 0, "", 169);

            AddECHandleInput();

            AddButton(286, 516, 0x9C52, 0x9C5C, 114, GumpButtonType.Reply, 0);
            AddHtmlLocalized(286, 519, 64, 22, 1114513, "#1154641", 0x7FFF, false, false); // Search

            AddECHandleInput();

            AddImage(36, 74, 0x9C56);
            AddLabelCropped(59, 74, 100, 14, 0x1C7, UltimaStore.GetCurrency(User).ToString("N0"));

            AddECHandleInput();

            if (!Search && Category == StoreCategory.Cart)
            {
                PlayerProfile profile = UltimaStore.GetProfile(User);

                AddImage(167, 74, 0x9C4C);

                if (profile != null && profile.Cart != null && profile.Cart.Count > 0)
                {
                    int i = 0;

                    foreach (KeyValuePair <StoreEntry, int> kvp in profile.Cart)
                    {
                        StoreEntry entry  = kvp.Key;
                        int        amount = kvp.Value;

                        int index = UltimaStore.Entries.IndexOf(entry);

                        if (entry.Name[0].Number > 0)
                        {
                            AddHtmlLocalized(175, 84 + (35 * i), 256, 25, entry.Name[0].Number, 0x6B55, false, false);
                        }
                        else
                        {
                            AddHtml(175, 84 + (35 * i), 256, 25, Color(C16232(0x6B55), entry.Name[0].String), false, false);
                        }

                        AddButton(431, 81 + (35 * i), 0x9C52, 0x9C5C, index + 2000, GumpButtonType.Reply, 0);

                        AddLabelCropped(457, 82 + (35 * i), 38, 22, 0x9C2, amount.ToString());
                        AddLabelCropped(531, 82 + (35 * i), 100, 14, 0x1C7, (entry.Cost * amount).ToString("N0"));

                        AddButton(653, 81 + (35 * i), 0x9C52, 0x9C5C, index + 3000, GumpButtonType.Reply, 0);
                        AddHtmlLocalized(653, 84 + (35 * i), 64, 22, 1114513, "#1011403", 0x7FFF, false, false); // Remove

                        AddImage(175, 109 + (35 * i), 0x9C4D);

                        ++i;
                    }
                }

                AddHtmlLocalized(508, 482, 125, 25, 1156594, 0x6B55, false, false); // Subtotal:
                AddImage(588, 482, 0x9C56);
                AddLabelCropped(611, 480, 100, 14, 0x1C7, UltimaStore.GetSubTotal(Cart).ToString("N0"));

                AddECHandleInput();
                AddECHandleInput();

                AddButton(653, 516, 0x9C52, 0x9C52, 115, GumpButtonType.Reply, 0);
                AddHtmlLocalized(653, 519, 64, 22, 1114513, "#1062219", 0x7FFF, false, false); // Buy
            }
            else
            {
                if (Search)
                {
                    StoreList = UltimaStore.GetSortedList(SearchText);

                    UltimaStore.SortList(StoreList, SortBy);

                    if (StoreList.Count == 0)
                    {
                        User.SendLocalizedMessage(1154587, "", 1281); // No items matched your search.
                        return;
                    }
                }

                int listIndex = Page * 6;
                int pageIndex = 0;
                int pages     = (int)Math.Ceiling((double)StoreList.Count / 6);

                for (int i = listIndex; i < StoreList.Count && pageIndex < 6; i++)
                {
                    StoreEntry entry = StoreList[i];
                    int        x     = _Offset[pageIndex][0];
                    int        y     = _Offset[pageIndex][1];

                    AddButton(x, y, 0x9C4B, 0x9C4B, i + 1000, GumpButtonType.Reply, 0);

                    if (entry.Tooltip > 0)
                    {
                        AddTooltip(entry.Tooltip);
                    }
                    else
                    {
                        Item item = UltimaStore.UltimaStoreContainer.FindDisplayItem(entry.ItemType);

                        if (item != null)
                        {
                            AddItemProperty(item);
                        }
                    }

                    if (IsFeatured(entry))
                    {
                        AddImage(x, y + 189, 0x9C58);
                    }

                    for (int j = 0; j < entry.Name.Length; j++)
                    {
                        if (entry.Name[j].Number > 0)
                        {
                            AddHtmlLocalized(x, y + (j * 14) + 4, 183, 25, 1114513, string.Format("#{0}", entry.Name[j].Number.ToString()), 0x7FFF, false, false);
                        }
                        else
                        {
                            AddHtml(x, y + (j * 14) + 4, 183, 25, ColorAndCenter("#FFFFFF", entry.Name[j].String), false, false);
                        }
                    }

                    if (entry.ItemID > 0)
                    {
                        Rectangle2D b = ItemBounds.Table[entry.ItemID];

                        AddItem((x + 91) - b.Width / 2 - b.X, (y + 108) - b.Height / 2 - b.Y, entry.ItemID, entry.Hue);
                    }
                    else
                    {
                        AddImage((x + 91) - 72, (y + 108) - 72, entry.GumpID);
                    }

                    AddImage(x + 60, y + 192, 0x9C56);
                    AddLabelCropped(x + 80, y + 190, 143, 25, 0x9C2, entry.Cost.ToString("N0"));

                    AddECHandleInput();
                    AddECHandleInput();

                    ++pageIndex;
                    ++listIndex;
                }

                if (Page + 1 < pages)
                {
                    AddButton(692, 516, 0x9C51, 0x9C5B, 116, GumpButtonType.Reply, 0);
                }

                if (Page > 0)
                {
                    AddButton(648, 516, 0x9C50, 0x9C5A, 117, GumpButtonType.Reply, 0);
                }
            }

            if (Configuration.CurrencyDisplay)
            {
                AddHtml(43, 496, 120, 16, Color("#FFFFFF", "Currency:"), false, false);
                AddHtml(43, 518, 120, 16, Color("#FFFFFF", Configuration.CurrencyName), false, false);
            }
        }
Exemplo n.º 22
0
 public static Item ConstructHitchingPost(Mobile m, StoreEntry entry)
 {
     return(new HitchingPost(false));
 }
Exemplo n.º 23
0
        public override void OnResponse(RelayInfo info)
        {
            int id = info.ButtonID;

            if (id == 0)
            {
                ReleaseHidden(User);
                return;
            }

            PlayerProfile profile = UltimaStore.GetProfile(User);

            switch (id)
            {
            // Change Category
            case 100:
            case 101:
            case 102:
            case 103:
            case 104:
            case 105:
            {
                Search = false;

                StoreCategory oldCat = profile.Category;

                profile.Category = (StoreCategory)id - 99;

                if (oldCat != profile.Category)
                {
                    StoreList = UltimaStore.GetList(Category);
                    Page      = 0;
                }

                Refresh();
                return;
            }

            // Promo Code
            case 106:
            {
                Refresh();
                SendGump(new PromoCodeGump(User, this));
                return;
            }

            // FAQ
            case 107:
            {
                if (!string.IsNullOrWhiteSpace(Configuration.Website))
                {
                    User.LaunchBrowser(Configuration.Website);
                }
                else
                {
                    User.LaunchBrowser("https://uo.com/ultima-store/");
                }

                Refresh();
                return;
            }

            // Change Sort Method
            case 108:
            case 109:
            case 110:
            case 111:
            case 112:
            {
                SortBy oldSort = profile.SortBy;

                profile.SortBy = (SortBy)id - 108;

                if (oldSort != profile.SortBy)
                {
                    // re-orders the list
                    if (oldSort == SortBy.Newest || oldSort == SortBy.Oldest)
                    {
                        ColUtility.Free(StoreList);

                        StoreList = UltimaStore.GetList(Category);
                    }

                    UltimaStore.SortList(StoreList, profile.SortBy);

                    Page = 0;
                }

                Refresh();
                return;
            }

            // Cart View
            case 113:
            {
                if (profile != null)
                {
                    profile.Category = StoreCategory.Cart;
                }

                Refresh();
                return;
            }

            // Search
            case 114:
            {
                TextRelay searchTxt = info.GetTextEntry(0);

                if (searchTxt != null && !string.IsNullOrEmpty(searchTxt.Text))
                {
                    Search     = true;
                    SearchText = searchTxt.Text;
                }
                else
                {
                    User.SendLocalizedMessage(1150315);         // That text is unacceptable.
                }

                Refresh();
                return;
            }

            // Buy
            case 115:
            {
                if (UltimaStore.CartCount(User) == 0)
                {
                    if (profile != null)
                    {
                        profile.Category = StoreCategory.Cart;
                    }

                    Refresh();
                    return;
                }

                int total = UltimaStore.GetSubTotal(Cart);

                if (total <= UltimaStore.GetCurrency(User, true))
                {
                    SendGump(new ConfirmPurchaseGump(User));
                }
                else
                {
                    SendGump(new NoFundsGump(User));
                }

                return;
            }

            // Next Page
            case 116:
            {
                ++Page;

                Refresh();
                return;
            }

            // Previous Page
            case 117:
            {
                --Page;

                Refresh();
                return;
            }
            }

            if (id < 2000) // Add To Cart
            {
                Refresh();

                StoreEntry entry = StoreList[id - 1000];

                if (Cart == null || Cart.Count < 10)
                {
                    SendGump(new ConfirmCartGump(User, this, entry));
                    return;
                }

                User.SendLocalizedMessage(1156745); // Your store cart is currently full.
            }
            else if (id < 3000)                     // Change Amount In Cart
            {
                Refresh();

                StoreEntry entry = UltimaStore.Entries[id - 2000];

                SendGump(new ConfirmCartGump(User, this, entry, Cart != null && Cart.ContainsKey(entry) ? Cart[entry] : 0));
                return;
            }
            else if (id < 4000) // Remove From Cart
            {
                StoreEntry entry = UltimaStore.Entries[id - 3000];

                if (profile != null)
                {
                    profile.RemoveFromCart(entry);
                }

                Refresh();
                return;
            }

            ReleaseHidden(User);
        }