forked from minetest-mods/global_exchange
Compare commits
2 Commits
b22b72f5c2
...
6989f6a00e
Author | SHA1 | Date | |
---|---|---|---|
6989f6a00e | |||
9c8f62320e |
@ -9,14 +9,15 @@ local S = minetest.get_translator("global_exchange")
|
|||||||
|
|
||||||
-- NALC split() function
|
-- NALC split() function
|
||||||
local function split(str, sep)
|
local function split(str, sep)
|
||||||
if not str then return nil end
|
if not str then return "Item doesn't exist" end
|
||||||
local result = {}
|
local result = {}
|
||||||
local regex = ("([^%s]+)"):format(sep)
|
local regex = ("([^%s]+)"):format(sep)
|
||||||
for each in str:gmatch(regex) do
|
for each in str:gmatch(regex) do
|
||||||
if #each > 30 then
|
local sub = nil
|
||||||
each = string.sub(each, 1, 30).."..."
|
if #each > 34 then
|
||||||
|
sub = string.sub(each, 1, 34).."..."
|
||||||
end
|
end
|
||||||
table.insert(result, each)
|
table.insert(result, sub or each)
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
@ -50,8 +51,8 @@ local function mk_summary_fs()
|
|||||||
local all_items = minetest.registered_items
|
local all_items = minetest.registered_items
|
||||||
for i, row in ipairs(exchange:market_summary()) do
|
for i, row in ipairs(exchange:market_summary()) do
|
||||||
local def = all_items[row.Item] or {}
|
local def = all_items[row.Item] or {}
|
||||||
add_row(row.Item,
|
add_row(#row.Item > 24 and string.sub(row.Item, 1, 24).."..." or row.Item,
|
||||||
split(def.description, "\n")[1] or S("Unknown Item"),
|
split(def.description, "\n")[1] or S("No description"),
|
||||||
wear_string(row.Wear),
|
wear_string(row.Wear),
|
||||||
row.Buy_Volume or 0,
|
row.Buy_Volume or 0,
|
||||||
row.Buy_Max or "N/A",
|
row.Buy_Max or "N/A",
|
||||||
|
@ -53,6 +53,7 @@ Buy Max=Achat Max
|
|||||||
Sell Vol=Qté vente
|
Sell Vol=Qté vente
|
||||||
Sell Min=Vente Min
|
Sell Min=Vente Min
|
||||||
Unknown Item=Item inconnue
|
Unknown Item=Item inconnue
|
||||||
|
No description=Pas de description
|
||||||
New (-0%)=Neuf (-0%)
|
New (-0%)=Neuf (-0%)
|
||||||
Good (-10%)=Bon (-10%)
|
Good (-10%)=Bon (-10%)
|
||||||
Worn (-50%)=Usé (-50%)
|
Worn (-50%)=Usé (-50%)
|
||||||
|
Reference in New Issue
Block a user