olimatt

Member
It seems that the entry doesn’t support text input. I’ve tried reworking StoreEntry and UltimaStore using RewardEntry and RewardSystem as an example but keep getting the same error that an int can't be converted to a string.

StoreEntry.cs:
using Server.Items;
using System;

namespace Server.Engines.UOStore
{
    public class StoreEntry
    {
        public Type ItemType { get; private set; }
        public TextDefinition[] Name { get; private set; }
        public int Tooltip { get; private set; }
        public string TooltipString { get; private set; }
        public int GumpID { get; private set; }
        public int ItemID { get; private set; }
        public int Hue { get; private set; }
        public int Price { get; private set; }
        public StoreCategory Category { get; private set; }
        public Func<Mobile, StoreEntry, Item> Constructor { get; private set; }

        public int Cost => (int)Math.Ceiling(Price * Configuration.CostMultiplier);

        public StoreEntry(Type itemType, TextDefinition name, int tooltip, int itemID, int gumpID, int hue, int cost, StoreCategory cat, Func<Mobile, StoreEntry, Item> constructor = null)
            : this(itemType, new[] { name }, tooltip, itemID, gumpID, hue, cost, cat, constructor)
        { }

        public StoreEntry(Type itemType, TextDefinition[] name, int tooltip, int itemID, int gumpID, int hue, int cost, StoreCategory cat, Func<Mobile, StoreEntry, Item> constructor = null)
        {
            ItemType = itemType;
            Name = name;
            Tooltip = tooltip;
            ItemID = itemID;
            GumpID = gumpID;
            Hue = hue;
            Price = cost;
            Category = cat;
            Constructor = constructor;
        }
        
        public StoreEntry(Type itemType, TextDefinition[] name, string tooltip, int itemID, int gumpID, int hue, int cost, StoreCategory cat, Func<Mobile, StoreEntry, Item> constructor = null)
        {
            ItemType = itemType;
            Name = name;
            TooltipString = tooltip;
            ItemID = itemID;
            GumpID = gumpID;
            Hue = hue;
            Price = cost;
            Category = cat;
            Constructor = constructor;
        }

        public bool Construct(Mobile m, bool test = false)
        {
            Item item;

            if (Constructor != null)
            {
                item = Constructor(m, this);
            }
            else
            {
                item = Activator.CreateInstance(ItemType) as Item;
            }

            if (item != null)
            {
                if (item is IAccountRestricted)
                {
                    ((IAccountRestricted)item).Account = m.Account.Username;
                }

                if (m.Backpack == null || !m.Alive || !m.Backpack.TryDropItem(m, item, false))
                {
                    UltimaStore.AddPendingItem(m, item);

                    // Your purchased will be delivered to you once you free up room in your backpack.
                    // Your purchased item will be delivered to you once you are resurrected.
                    m.SendLocalizedMessage(m.Alive ? 1156846 : 1156848);
                }
                else if (item is IPromotionalToken && ((IPromotionalToken)item).ItemName != null)
                {
                    // A token has been placed in your backpack. Double-click it to redeem your ~1_PROMO~.
                    m.SendLocalizedMessage(1075248, ((IPromotionalToken)item).ItemName.ToString());
                }
                else if (item.LabelNumber > 0 || item.Name != null)
                {
                    string name = item.LabelNumber > 0 ? ("#" + item.LabelNumber) : item.Name;

                    // Your purchase of ~1_ITEM~ has been placed in your backpack.
                    m.SendLocalizedMessage(1156844, name);
                }
                else
                {
                    // Your purchased item has been placed in your backpack.
                    m.SendLocalizedMessage(1156843);
                }

                if (test)
                {
                    item.Delete();
                }

                return true;
            }

            Utility.WriteConsoleColor(ConsoleColor.Red, String.Format("[Ultima Store Warning]: {0} failed to construct.", ItemType.Name));

            return false;
        }
    }
}

Test entry:

C#:
Register<GreenGoblinStatuette>(1125133, "Test String", 0xA095, 0, 0, 600, cat);

Error:

C#:
Errors:
 + Services/UltimaStore/UltimaStore.cs:
    CS1503: Line 86: Argument 2: cannot convert from 'string' to 'int'

If I test an entry that uses a text definition, I get the same but slightly different error.

C#:
Errors:
 + Services/UltimaStore/UltimaStore.cs:
    CS1503: Line 88: Argument 1: cannot convert from 'Server.TextDefinition[]' to 'Server.TextDefinition'
    CS1503: Line 88: Argument 2: cannot convert from 'string' to 'int'
 
They ripped that ability out with the latest version of the server. The base gump that the store display uses specifically had text support removed so it allows only cliloc entries. It even looks for the "empty" cliloc values that let you append your desired text and it filters them out too.

The example in Tasanar's post from 2018 was how it used to work but that functionality is gone now.

I spent a week restoring it on my development shard. It's one of the unique elements of what I hope to offer (and it uses tokens as currency) so I ask for understanding when I say it's not something I can share.
 
They ripped that ability out with the latest version of the server. The base gump that the store display uses specifically had text support removed so it allows only cliloc entries. It even looks for the "empty" cliloc values that let you append your desired text and it filters them out too.

The example in Tasanar's post from 2018 was how it used to work but that functionality is gone now.

I spent a week restoring it on my development shard. It's one of the unique elements of what I hope to offer (and it uses tokens as currency) so I ask for understanding when I say it's not something I can share.

It's totally cool, I get it. What I don't get is why it was removed in the first place. Why add something to the server if you can't use it how you want? Isn't the point of all this to be creative? I guess I can look at older versions and try to change it back but it's rather dumb to work backwards.
 
I tried to add Aegis to uostore by following code
C#:
Register<Aegis>(1159165, 1158738, 0x1B76, 0, 0x47E, 600, cat);
where "Aegis" is used to identify the item dropped to your backpack after bought, "0x1B76" is shield picture displayed in uostore gump, "0x47E" is hue of the shield displayed, "600" is price. However, "1159165" and "1158738" are something related to the cliloc that I cannot modify. The former number refers to name of this product on uostore gump, the latter number refers to discription of this product.

The key is to add some custom text to replace "1159165" and "1158738", or , at least, a blank text.
 
What I don't get is why it was removed in the first place.

I think the reasoning given was that gumps that allowed arbitrary text (not cliloc) were a risk of client crashing. Maybe it's more of a problem with the enhanced client; I use only the classic client and never had a problem with the old way.


Holyblablabla --

There is a cliloc for the word Aegis (1151705) but the description won't be available unless you edit the cliloc.enu file with UOFiddler, save it in your game folder, and distribute it to your players. You could try one of the blank cliloc entries if you want it to have no description and just let your players look it up.
 
There is a cliloc for the word Aegis (1151705) but the description won't be available unless you edit the cliloc.enu file with UOFiddler, save it in your game folder, and distribute it to your players. You could try one of the blank cliloc entries if you want it to have no description and just let your players look it up.

Thanks for your reply, Falkor. There are plenty of empty entries in cliloc. Is anyone OK?

blanktext.PNG
 
If you want to add your own, any of the empties should be ok. Just know you're locked into using one client for your shard or a future update will overwrite your custom cliloc file.

UOFiddler is a little tricky here. After you add a new entry in one of the empty areas as pictured in your screen shot, double-click it until it opens in another small window. In that window, click "save" in the top right corner. The "flag" listing to the right of your new entry should now say Modified. Once you're finished editing clilocs, hit Save and that will create a new cliloc.enu file for you to copy into the client directory.

cliloc edit.jpg
 
I tried to add Aegis to uostore by following code
C#:
Register<Aegis>(1159165, 1158738, 0x1B76, 0, 0x47E, 600, cat);
where "Aegis" is used to identify the item dropped to your backpack after bought, "0x1B76" is shield picture displayed in uostore gump, "0x47E" is hue of the shield displayed, "600" is price. However, "1159165" and "1158738" are something related to the cliloc that I cannot modify. The former number refers to name of this product on uostore gump, the latter number refers to discription of this product.

The key is to add some custom text to replace "1159165" and "1158738", or , at least, a blank text.
Where can i find the picture code like "0x1B76"
 
Where can i find the picture code like "0x1B76"
I figured it out. I unknowingly already knew how. I had the syntax wrong and it wasn't working for me. But you can get the item id from UOFiddler. You can use the search function to help. You can get the item id from the top right. It is labled Graphic.
 

Attachments

  • UOFiddler.items.png
    UOFiddler.items.png
    580.2 KB · Views: 29
  • UOFiddler.itemid.png
    UOFiddler.itemid.png
    12.9 KB · Views: 29
Thanks a lot
I figured it out. I unknowingly already knew how. I had the syntax wrong and it wasn't working for me. But you can get the item id from UOFiddler. You can use the search function to help. You can get the item id from the top right. It is labled Graphic.
Thanks a lot
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back