ServUO Version
Publish Unknown
Ultima Expansion
None
Has anyone done any type of currency conversion like Dungeons and Dragons had with copper, silver, gold and platinum?
I have added those to my core server files and have it running like gold in core just haven't found any conversions systems for in game like for vendors where like 10 copper = 1 silver 10 silver = 1 gold 10 gold = 1 platinum. and can buy things and have it convert into these types of currency.
 
My idea was to use raelis vendor stone that allows anything to be currency. Even apples. Then make static art of vendors. Then make item scripts for different coins. And you just change the graphic of the vendor stones too say a static image of blacksmith. Change the currency to the constructable of your new coin say platinum. The they click the blacksmith and it will open the gump of the vendor stone. Scripting with graphics =)
 
The easiest way to achieve this is to define a list of exchange rates relative to gold, where gold to gold is always 1:1 (or 100%)
Every custom currency you add would have a rate against gold, such as silver, for example, could be 0.10:1 (or 10%)

So if an item is worth 100 gold, and you opt to pay in silver, the price would be 1,000 silver using the formula:

SILVER = ( GOLD_PRICE * ( 1 / SILVER_RATE ) )
SILVER = ( GOLD_PRICE * ( 1 / 0.10 ) )
:. 1,000 = ( 100 * ( 1 / 0.10 ) )


The premise of this is based on a working feature I developed, that you can use for reference:
 
Cool I will look at these options as a stepping stone just needed a place to start from. Thanks for the suggestions and keep them coming if anyone has more ideas lol If i get this all figured out ill post what i have come up with in futre if anyone wants to do this in future.
Just to give you an idea i put this into my core server mobile.cs
Currency:
[Flags]
    public enum MobileDelta
    {
        Copper=        0x02000000,
        Silver=        0x04000000,
        Platinum=    0x06000000           
    }

    #region Var declarations
    private int m_TotalCopper, m_TotalSilver, m_TotalGold, m_TotalPlatinum, m_TotalItems, m_TotalWeight;

of course there is more but they act as gold would act in game as a form of currency and counted as such
 
Last edited:
Flags-based enums should always be powers of two for the values: 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, ...

0x06000000 in your case would be 0x02000000 and 0x04000000 combined, making Platinum equivalent to Copper | Silver, which would cause unexpected behaviour.
 
Back