diff --git a/README.md b/README.md index 234a5f7..9a23c22 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,66 @@ -# minertrade -It adds various types of money, barter table, dispensing machines, safe in homes interconnected with ATMs in stores. +# MINERTRADE + +It adds various types of money, exchange table, Dispensing Machines, Strongbox in homes interconnected with ATMs in stores. + +**SCREENSHOT IN PORTUGUESE:** +![](https://github.com/Lunovox/tradelands/raw/master/screenshot.png) + +**Itens adicionados:** + * Types of Moneys: + * Minercoin + * Minermoney + * Piggy Bank + * Credit Card + * Exchange Table (P2P) + * It makes safe exchanges from player to player without the need to put your items on the ground. + * Dispensing Machine + * Sells your items, even if you are not online. + * Personal Strongbox + * Save your money in this safe and withdraw your money at any shop that has an ATM. + * Public ATM + * Save your money in the ATM, and withdraw your money in your Personal Safe or other ATM in the shops scattered around the map. + +**Dependencies:** + * default → Minetest Game Included + * dye → Minetest Game Included + +**Optional Dependencies:** + * [intllib](https://github.com/minetest-mods/intllib) → Facilitates the translation of several other mods into your native language, or other languages. + * [tradelands](https://github.com/Lunovox/tradelands) → Protection of rent door (not yet implemented). + +**Licence: ** + * GNU AGPL: https://pt.wikipedia.org/wiki/GNU_Affero_General_Public_License + +**Developers:** + * Lunovox + +**Comandos:** + * Lets you check the contents of another players strongbox. + * /checkstrongbox + * /csb + +**Settings:** + * Change the file **'config.lua'** to change the initial settings of the mod, such as: + * Path of Database + * Delay of Install Strongbox and ATM, + * Size of inventory of Strongbox and ATM, + +**Translate to Others Languages:** + +* This mod currently are configured to language: + * English + * Portuguese + +* To add a new language to this mod just follow the steps below: + * Enable the complementary mod **'intllib'.** + * Set your language in **'minetest.conf'** by adding the [````language = ````] property. + * Example for French Language: ````language = fr```` + * Make a copy of the file [ **pt.txt** ] in the [ **locale** ] folder that is inside the mod for [````locale/.txt````]. + * Example for French language: ````locale/fr.txt```` + * Open the file [````locale/.txt````] in a simple text editor. + * Translate all lines. But, just here that stems the right of the equals symbol (=). + * Example for French Language: ````DISPENSING MACHINE = MACHINE DE DISTRIBUTION```` + +![](https://github.com/Lunovox/tradelands/raw/master/screenshot2.png) + +![](https://github.com/Lunovox/tradelands/raw/master/screenshot3.png) \ No newline at end of file diff --git a/commands.lua b/commands.lua index 6125f49..abe00dd 100644 --- a/commands.lua +++ b/commands.lua @@ -1,52 +1,38 @@ minetest.register_privilege("checkstrongbox", { - description="Permite verificar o conteúdo do cofre de outro jogador", + description=modMinerTrade.translate("Lets you check the contents of another players strongbox."), give_to_singleplayer=false, }) -modMinerTrade.doCheckStrongBox = function(playername, param) - local targetname = string.match(param, "^([^ ]+)$") - if type(targetname)=="string" and targetname~="" then - if modMinerTrade.safe and modMinerTrade.safe[targetname] then +modMinerTrade.propCheckStrongBox = function(playername, param) + return { + params = "", + description = modMinerTrade.translate("Lets you check the contents of another players strongbox."), + func = function(playername, param) + if minetest.get_player_privs(playername).checkstrongbox then + local targetname = string.match(param, "^([^ ]+)$") + if type(targetname)=="string" and targetname~="" then + if modMinerTrade.safe and modMinerTrade.safe[targetname] then - local inv = modMinerTrade.getDetachedInventory(targetname) - minetest.show_formspec( - playername, - "safe_"..targetname, - modMinerTrade.getFormspec(targetname) - ) - return true - else - minetest.chat_send_player(playername, "[STRONGBOX:ERRO] O cofre de "..dump(targetname).." nao foi criado ainda!") - end - else - minetest.chat_send_player(playername, "[STRONGBOX:ERRO] /checkstrongbox ") - end - return false + local inv = modMinerTrade.getDetachedInventory(targetname) + minetest.show_formspec( + playername, + "safe_"..targetname, + modMinerTrade.getFormspec(targetname) + ) + return true + else + minetest.chat_send_player(playername, "[MINERTRADE:ERRO] "..modMinerTrade.translate("The strongbox of %s was not created yet!"):format(dump(targetname))) + end + else + minetest.chat_send_player(playername, "[MINERTRADE:ERRO] /"..modMinerTrade.translate("checkstrongbox").." | "..modMinerTrade.translate("Lets you check the contents of another players strongbox.")) + end + else + minetest.chat_send_player(playername, "[MINERTRADE:ERRO] "..modMinerTrade.translate("You do not have permission to run this command without the privileges 'checkstrongbox'!")) + end + return false + end, + } end -minetest.register_chatcommand("checkstrongbox", { - params = "", - description = "Verifica o conteúdo do cofre de um jogador", - privs = {checkstrongbox=true}, - func = function(playername, param) - return modMinerTrade.doCheckStrongBox(playername, param) - end, -}) - -minetest.register_chatcommand("csb", { - params = "", - description = "Verifica o conteúdo do cofre de um jogador", - privs = {checkstrongbox=true}, - func = function(playername, param) - return modMinerTrade.doCheckStrongBox(playername, param) - end, -}) - -minetest.register_chatcommand("checarcofre", { - params = "", - description = "Verifica o conteúdo do cofre de um jogador", - privs = {checkstrongbox=true}, - func = function(playername, param) - return modMinerTrade.doCheckStrongBox(playername, param) - end, -}) +minetest.register_chatcommand(modMinerTrade.translate("checkstrongbox"), modMinerTrade.propCheckStrongBox(playername, param)) +minetest.register_chatcommand("csb", modMinerTrade.propCheckStrongBox(playername, param)) diff --git a/description.txt b/description.txt index d2db64c..6627c0a 100644 --- a/description.txt +++ b/description.txt @@ -1,19 +1,19 @@ -Habilita itens interessantes para criação de um comércio no servidor. +It adds various types of money, exchange table, Dispensing Machines, Strongbox in homes interconnected with ATMs in stores. Itens adicionados: - * Dinheiro de Mineiros ( - → Moeda - → Cédula - → Porquinho - → Cartão de Crédito - * Mesa de Escambo (P2P) - → Permite fazer trocas seguras com outros jogadores sem precisa derrubar itens no chão. - * Maquina Dispensadora - → Permite por seus itens a venda mesmo que você não esteja online. - * Cofre Particular - → O Cofre está interligado com o Caixa Eletrônico para guardar seu dinheiros e pertences valiosos, mas precisa de 30 minutos para serem ativados apos seu posicionamento no mapa para evitar que os jogadores levem o cofre para sua exploracao do mapa. - * Caixa Eletrônico Público - → O Caixa Eletrônico só pode ser posicionado próximo a uma máquina dispensadora. + * Types of Moneys: + → Minercoin + → Minermoney + → Piggy Bank + → Credit Card + * Exchange Table (P2P) + → It makes safe exchanges from player to player without the need to put your items on the ground. + * Dispensing Machine + → Sells your items, even if you are not online. + * Personal Strongbox + → Save your money in this safe and withdraw your money at any shop that has an ATM. + * Public ATM + → Save your money in the ATM, and withdraw your money in your Personal Safe or other ATM in the shops scattered around the map. Licence: * GNU AGPL: https://pt.wikipedia.org/wiki/GNU_Affero_General_Public_License @@ -22,7 +22,29 @@ Developers: * Lunovox Comandos: - * Exibe o que um jogador tem no cofre (necessita de priv 'checkstrongbox'). + * Lets you check the contents of another players strongbox. * /checkstrongbox * /csb - * /checarcofre + +Settings: + * Change the file 'config.lua' to change the initial settings of the mod, such as: + * Path of Database + * Delay of Install Strongbox and ATM, + * Size of inventory of Strongbox and ATM, + +Translate to Others Languages: + +* This mod currently are configured to language: + * English + * Portuguese + +* To add a new language to this mod just follow the steps below: + * Enable the complementary mod 'intllib'. + * Set your language in 'minetest.conf' by adding the [language = ] property. + * Example for French Language: language = fr + * Make a copy of the file [ pt.txt ] in the [ locale ] folder that is inside the mod for [locale/.txt]. + * Example for French language: locale/fr.txt + * Open the file [locale/.txt] in a simple text editor. + * Translate all lines. But, just here that stems the right of the equals symbol (=). + * Example for French Language: DISPENSING MACHINE = MACHINE DE DISTRIBUTION + diff --git a/item_strongbox.lua b/item_strongbox.lua index f0fd5b0..435356c 100644 --- a/item_strongbox.lua +++ b/item_strongbox.lua @@ -1,5 +1,5 @@ minetest.register_node("minertrade:strongbox", { - description = modMinerTrade.translate("STRONGBOX\n* Save your money in this safe and withdraw your money at any store that has an ATM."), + description = modMinerTrade.translate("STRONGBOX\n* Save your money in this safe and withdraw your money at any shop that has an ATM."), --inventory_image = "safe_front.png", paramtype = "light", @@ -21,7 +21,7 @@ minetest.register_node("minertrade:strongbox", { local meta = minetest.get_meta(pos) local ownername = placer:get_player_name() or "" meta:set_string("owner", ownername) - meta:set_string("infotext", modMinerTrade.translate("STRONGBOX (Property of '%s')\n* Save your money in this safe and withdraw your money at any store that has an ATM."):format(ownername)) + meta:set_string("infotext", modMinerTrade.translate("STRONGBOX (Property of '%s')\n* Save your money in this safe and withdraw your money at any shop that has an ATM."):format(ownername)) local now = os.time() --Em milisegundos meta:set_string("opentime", now+modMinerTrade.delayConstruct) end, @@ -37,7 +37,7 @@ minetest.register_node("minertrade:strongbox", { local playername = clicker:get_player_name() local meta = minetest.get_meta(pos) local ownername = meta:get_string("owner") - meta:set_string("infotext", modMinerTrade.translate("STRONGBOX (Property of '%s')\n* Save your money in this safe and withdraw your money at any store that has an ATM."):format(ownername)) + meta:set_string("infotext", modMinerTrade.translate("STRONGBOX (Property of '%s')\n* Save your money in this safe and withdraw your money at any shop that has an ATM."):format(ownername)) if modMinerTrade.isOpen(meta, clicker) then local opentime = tonumber(meta:get_string("opentime")) or 0 local now = os.time() --Em milisegundos diff --git a/locale/pt.txt b/locale/pt.txt index 4a6ad10..7dd5db3 100644 --- a/locale/pt.txt +++ b/locale/pt.txt @@ -36,7 +36,7 @@ You can not change your own machine!=Voce nao pode trocar na sua propria maquina The stock of '%s' is gone. Contact him!=O estoque de '%s' acabou. Contacte-o! The dispending can not be done. Make sure you offer what the machine asks for!=A dispensa não pode ser feita. Verifique se você ofereceu o que a máquina pede! -#------- item_barter_table.lua --------------------------------------------------------------------------- +#------- item_exchange_table.lua --------------------------------------------------------------------------- EXCHANGE TABLE\n(Player to Player)=MESA DE ESCAMBO\n(Jogador para Jogador) EXCHANGE TABLE\n* It makes safe exchanges from player to player without the need to put your items on the ground.=MESA DE ESCAMBO\n* Faz trocas seguras jogador a jogador sem a necessidade de colocar seu itens no chão. '%s' offer='%s' oferece @@ -47,8 +47,8 @@ Cancel=Cancelar Confirm=Confirmar #------- item_strongbox.lua --------------------------------------------------------------------------- -STRONGBOX\n* Save your money in this safe and withdraw your money at any store that has an ATM.=COFRE\n* Guarde seu dinheiro neste cofre e retire seu dinheiro em qualquer loja que possua um Caixa Eletrônico. -STRONGBOX (Property of '%s')\n* Save your money in this safe and withdraw your money at any store that has an ATM.=COFRE (Propriedade de '%s')\n* Guarde seu dinheiro neste cofre e retire seu dinheiro em qualquer loja que possua um Caixa Eletrônico. +STRONGBOX\n* Save your money in this safe and withdraw your money at any shop that has an ATM.=COFRE\n* Guarde seu dinheiro neste cofre e retire seu dinheiro em qualquer loja que possua um Caixa Eletrônico. +STRONGBOX (Property of '%s')\n* Save your money in this safe and withdraw your money at any shop that has an ATM.=COFRE (Propriedade de '%s')\n* Guarde seu dinheiro neste cofre e retire seu dinheiro em qualquer loja que possua um Caixa Eletrônico. [MINERTRADE] The safe is going to work %02d seconds after it is installed!=[MINERTRADE] O cofre sá vai funcionar %02d segundos depois de instalado! [MINERTRADE] You do not have access to the safe belonging to '%s'!=[MINERTRADE] Você não tem acesso ao cofre pertencente a '%s'! @@ -57,6 +57,12 @@ PUBLIC ATM\n* Save your money in the ATM, and withdraw your money in your Person [MINERTRADE] You can not install this 'ATM' too far from a 'Dispensing Machine'!=[MINERTRADE] Você não pode instalar este 'Caixa Eletrônico' muito longe de uma 'Máquina Dispensadora'! [MINERTRADE] The ATM will only run %02d seconds after it is installed!=[MINERTRADE] O Caixa Eletrônico só vai funcionar %02d segundos depois de instalado! +#------- commands.lua --------------------------------------------------------------------------- +checkstrongbox=checacofre +Lets you check the contents of another players strongbox.=Permite verificar o conteúdo do cofre de outro jogador. +The strongbox of %s was not created yet!=O Cofre de %s não foi criado ainda! +You do not have permission to run this command without the privileges 'checkstrongbox'!=Você não tem permissão para executar este comando sem o privilégio 'checkstrongbox'! + #------- on_final.lua --------------------------------------------------------------------------- Saving strongbox from all players in the file '%s'!=Salvando cofre de todos os jogadores no arquivo '%s'!