Rename cr to Mg for consistency with the currency mod.

This commit is contained in:
luk3yx 2021-08-07 16:11:08 +12:00
parent bef7663572
commit 2ef3d5919e
3 changed files with 10 additions and 10 deletions

View File

@ -35,7 +35,7 @@ The following lurkcoin-specific functions and variables exist:
- `lurkcoin.get_exchange_rate(amount, to, callback)`: Get an exchange rate
from this server.
- `lurkcoin.pay(from, to, server, amount, callback)`: Makes `from` pay someone
`amount`cr, and calls `callback` on success/faliure. `callback` should have two
`amount`Mg, and calls `callback` on success/faliure. `callback` should have two
parameters, `success` and `msg`.
- `lurkcoin.server_name`: The account name used to log into lurkcoin.
@ -59,7 +59,7 @@ The below functions (except `getbal` and `pay`) return `true` on success and
- `lurkcoin.bank.subtract(name, amount, reason)`: Subtracts `amount` from
`name`'s balance. Will return false if `amount` is below `0`.
- `lurkcoin.bank.pay(from, to, amount)`: Makes user `from` pay a user
`amount`cr. This will return two values, `success` (true/false) and
`amount` Mg. This will return two values, `success` (true/false) and
`message` (a string).
#### Changing the currently used bank
@ -77,4 +77,4 @@ implemented (except `pay`) must have the same return values as described in this
documentation, and are entirely optional (they will be automatically created if
they are not included). Any missing functions are "filled in" automatically.
*By default, payments are rounded down to the nearest 0.01cr.*
*By default, payments are rounded down to the nearest 0.01 Mg.*

View File

@ -40,11 +40,11 @@ local function get_formspec(name, page, params)
-- The formspec template
local formspec = 'size[8,9]' .. lurkcoin.formspec_prepend ..
'label[0.5,1.75;Your balance: ' ..
e(lurkcoin.bank.getbal(name)) .. 'cr.]' ..
e(lurkcoin.bank.getbal(name)) .. 'Mg.]' ..
centre_label('1,0.55;6,0.5', 'Welcome to a ' .. lurkcoin.server_name ..
' ATM!') ..
'label[0.5,2.25;Exchange rate: \194\1641.00 is equal to ' ..
e(lurkcoin.exchange_rate) .. 'cr.]' ..
e(lurkcoin.exchange_rate) .. 'Mg.]' ..
centre_label('1.75,1.05;4.5,0.5', 'Your account: ' .. name) ..
'image[0.5,0.5;1,1;' .. formspec_img .. ']' ..
'image[6.5,0.5;1,1;' .. formspec_img .. ']'
@ -73,7 +73,7 @@ function formspecs.pay(name, fields)
'field[0.8,4.8;7,1;server;Server the user is on;' ..
e(fields.server or lurkcoin.server_name) .. ']' ..
'field_close_on_enter[server;false]' ..
'field[0.8,6.15;7,1;amount;Amount to pay (in cr);' ..
'field[0.8,6.15;7,1;amount;Amount to pay (in Mg);' ..
e(fields.amount or '5.00') .. ']' ..
'field_close_on_enter[amount;false]'
@ -100,12 +100,12 @@ function formspecs.pay(name, fields)
fields._exchange_rate = data
return lurkcoin.show_atm(name, 'pay', fields)
end)
return formspec .. '\n' .. fields.amount .. 'cr is equal to' ..
return formspec .. '\n' .. fields.amount .. 'Mg is equal to' ..
' ...\n\n(Calculating...)]'
end
exc = tostring(math.floor(exc * 100) / 100)
formspec = formspec .. '\n' .. fields.amount .. 'cr is ' ..
formspec = formspec .. '\n' .. fields.amount .. 'Mg is ' ..
'equal to ' .. exc .. '.'
end
formspec = formspec .. ']' ..

View File

@ -113,7 +113,7 @@ local function sync_callback(res)
if not acknowledged_transactions[id] then
if lurkcoin.bank.user_exists(t.target) then
acknowledged_transactions[id] = true
logf('[%s] \194\164%s (sent %s, received %scr) - ' ..
logf('[%s] \194\164%s (sent %s, received %sMg) - ' ..
'Transaction from %q on %q to %q.',
t.id, t.amount, t.sent_amount, t.received_amount, t.source,
t.source_server, t.target)
@ -218,7 +218,7 @@ function lurkcoin.pay(source, target, target_server, amount, callback)
local_currency = true
}, function(res)
if res.success then
logf('User %q paid %q (on server %q) %scr.', source, target,
logf('User %q paid %q (on server %q) %sMg.', source, target,
target_server, amount)
return callback(true, 'Transaction sent!')
end