pavog/craftconomy3

exchange command

Closed this issue · 5 comments

pavog commented

From @SirWhisperWind on March 4, 2018 6:7

I have 3 currency on my server that i want to work the same as if its like typical mmorpg games.

Gold
Silver
Copper

im trying to set up where 100 Copper is equal to 1 Silver and 100 Silver is equal to 1 Gold

commands i tried:
/currency exchange Copper Silver 0.01
/currency exchange Copper Silver .01
= /money exchange Copper Silver 100 = still 1 for 1 ratio
even random /currency exchange Copper Silver 100 < Still 1 = 1 ratio >

/currency exchange Silver Gold 0.01
/currency exchange Silver Gold .01
= /money exchange Silver Gold 100 = still 1 for 1 ratio

Copied from original issue: greatman#136

pavog commented

Commands to reproduce:

/currency add bronze bronze bronzi bronzi B
/currency add silver silver silvi silvi S
/currency add gold gold goldi goldi G

/currency exchange silver bronze 1000
/currency exchange gold silver 1000

Result should be:

/money exchange silver bronze 1
> 1.0 silver has been converted to 1000 bronze
pavog commented

Hopefully fixed in v3.4.1.
Will have a look into this tomorrow or so.

pavog commented

Hey @SirWhisperWind I got it :)
Try these steps:

Setup the database:

/ccsetup database ...
...

Setup the first / main currency:

/ccsetup currency name bronze
/ccsetup currency nameplural bronze
/ccsetup currency minor bronzi
/ccsetup currency minorplural bronzi
/ccsetup currency sign B
/ccsetup basic
/ccsetup basic 100000
/ccsetup basic 50
/ccsetup basic signfront

Add the other two currecies:

/currency add silver silver silvi silvi S
/currency add gold gold goldi goldi G

Set the exchange rates (to higher currency):

/currency exchange bronze silver 1000
/currency exchange silver gold 1000

Set the exchange rates (to lower currency):

/currency exchange silver bronze 0.001
/currency exchange gold silver 0.001

Try to exchange currencies:

/money exchange bronze silver 1000
 > 1000.0 bronze has been converted to 1.0 silver

/money exchange silver gold 1000
 > 1000.0 silver has been converted to 1.0 gold

Try to exchange backwards:

/money exchange silver bronze 1
 > 1.0 silver has been converted to 1000.0 bronze 

/money exchange gold silver 1
 > 1.0 gold has been converted to 1000.0 silver

If you want to add exchange methods for bronze to gold or gold to bronze it works the same way.

pavog commented

Thanks for reporting the issue.
Try again with v1.3.4.