Compare commits

...

24 commits

Author SHA1 Message Date
Lunovox
407b671e08 2024-12-06 00:40:48 -03:00
Lunovox
4159eb3205 [fix] Fixed the critical glitch. 2024-11-25 07:43:50 -03:00
Lunovox
f617ce5fbb [change] New format of 'dispensing mschine'. 2024-11-24 01:20:19 -03:00
Lunovox
2376bb969d 2024-11-19 15:14:53 -03:00
Lunovox
1627146ffe [add] Adding integration to 'computing' mod apps. 2024-11-19 14:27:03 -03:00
Lunovox
30775e527f 2024-11-04 04:57:36 -03:00
Lunovox
ac908795b3 [fix] Fixed URLs. 2024-11-04 04:53:48 -03:00
Lunovox
eab03d1121 2024-11-04 04:40:35 -03:00
Lunovox
07042aff76 [fix] Fixing the license for ContentDB. 2024-11-04 04:26:07 -03:00
Lunovox
ffa421159a [doc][fix] Fixed doc to version '2.2.3'. 2024-11-04 00:03:53 -03:00
Lunovox
79d3eb0682 [fix] Fixed the new method to config then dispensing machine to trade.
ALERTER: https://qoto.org/@reinaldo/112832090438550688
2024-07-23 11:11:09 -03:00
Lunovox
83dac770b0 Merge branch 'master' of gitlab.com:lunovox/minertrade 2024-07-22 09:56:38 -03:00
Lunovox
0059f0646b [refact] New method to config then dispensing machine to trade. 2024-07-22 09:55:26 -03:00
Lunovox
e3d3f8b4b8 2024-04-05 20:55:22 -03:00
Lunovox
c437c7c4e8 [fix] Pequena adaptação ao ContentDB. 2024-03-24 08:03:58 -03:00
Lunovox
7382f4f16d 2024-03-21 11:42:31 -03:00
Lunovox
e2ba5ac452 [fix][tested] Fixed the background to new Printed Paper. 2024-03-21 11:37:48 -03:00
Lunovox
a12f929178 [remake][notested] New background to Printed Paper. 2024-03-21 11:14:51 -03:00
Lunovox
7effda9f5c [fix] Fix the Paper Printed. (but the texture of background is ugly.) 2024-03-21 10:30:11 -03:00
Lunovox
d60357fd34 [bugfix] Fix Critical Bug.
2024-03-19 13:26:09: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '' in callback environment_Step(): ...t.minetest/files/Minetest/mods/minertrade/api_payday.lua:57: attempt to compare number with nil
2024-03-19 13:26:09: ERROR[Main]: stack traceback:
2024-03-19 13:26:09: ERROR[Main]: 	...t.minetest/files/Minetest/mods/minertrade/api_payday.lua:57: in function 'doPay'
2024-03-19 13:26:09: ERROR[Main]: 	...t.minetest/files/Minetest/mods/minertrade/api_payday.lua:99: in function <...t.minetest/files/Minetest/mods/minertrade/api_payday.lua:95>
2024-03-19 13:26:09: ERROR[Main]: 	...test.minetest/files/Minetest/builtin/common/register.lua:26: in function <...test.minetest/files/Minetest/builtin/common/register.lua:12>
2024-03-19 13:57:03 -03:00
Lunovox
7e9a30ff95 [feat][v2.2.0] Change account 'City Hall' to 'THE GOVERNMENT' of mod 'E-Urn'. 2024-03-01 20:27:27 -03:00
Lunovox
8d35a41e9c [feat] add The Governmemt Menu 2024-03-01 11:45:35 -03:00
Lunovox Heavenfinder
791b6ec14d Update mod.conf 2023-08-23 17:32:57 +00:00
Lunovox
178164563a 2023-08-23 14:16:06 -03:00
17 changed files with 945 additions and 370 deletions

53
.gitignore vendored
View file

@ -1,47 +1,12 @@
#Lunovox Files # Backup Files
.git *.~
*.old *.old
*~ *.bkp
*.backup
# Files of POedit
*.mo *.mo
# Compiled Lua sources # Arquivo de versionamento:
luac.out *.diff
*.patch
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

433
LICENSE_MEDIA Normal file
View file

@ -0,0 +1,433 @@
Creative Commons BY-SA 4.0
Legal Code International
[Attribution] [ShareAlike]
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
Source: https://creativecommons.org/licenses/by-sa/4.0/legalcode

View file

@ -1,10 +1,10 @@
![01] ![01]
<small> Other Screenshots: [02] [03] [04] [05] [06] [07] [08] </small> Other Screenshots: [02] [03] [04] [05] [06] [07] [08] [09]
Badge: [![ContentDB_en_icon]][ContentDB_en_link] [![DownloadsCDB_en_icon]][DownloadsCDB_en_link] Badge: [![ContentDB_en_icon]][ContentDB_en_link] [![DownloadsCDB_en_icon]][DownloadsCDB_en_link]
# 💵 [MINERTRADE] # 💵 [MINERTRADE][mod_minertrade]
[![minetest_icon]][minetest_link] It adds various types of money, Exchange Table, Dispensing Machines, and ATMs in stores. [![minetest_icon]][minetest_link] It adds various types of money, Exchange Table, Dispensing Machines, and ATMs in stores.
@ -42,12 +42,15 @@ Badge: [![ContentDB_en_icon]][ContentDB_en_link] [![DownloadsCDB_en_icon]][Downl
| :--: | :--: | :-- | | :--: | :--: | :-- |
| default | Mandatory | Minetest Game Included. | | default | Mandatory | Minetest Game Included. |
| dye | Mandatory | Minetest Game Included. | | dye | Mandatory | Minetest Game Included. |
| [intllib] | Optional | Facilitates the translation of this mod into your native language, or other languages. | | [intllib][mod_intllib] | Optional | Facilitates the translation of this mod into your native language, or other languages. |
| [correio] | Optional | Issues a letter to the owner of the ```Dispensing Machine``` when the machine needs the owner's intervention. | | [correio][mod_correio] | Optional | Issues a letter to the owner of the ```Dispensing Machine``` when the machine needs the owner's intervention. |
| [eurn][mod_eurn] | Optional | Select by vote who will be the president of the server with access to the public safe. |
| [computing][mod_computing] | Optional | Add multiple devices, such as mobile phones and desktops, that allow you to access the bank remotely. |
## **License:** ## **License:**
* [![license_icon]][license_link] * [![license_code_icon]][license_code_link]
* [![license_media_icon]][license_media_link]
See more details in wiki: See more details in wiki:
@ -55,7 +58,7 @@ See more details in wiki:
## **Developers:** ## **Developers:**
* Lunovox Heavenfinder: [email](mailto:lunovox@disroot.org), [social web](https://qoto.org/@lunovox), [WebChat](https://cloud.disroot.org/call/9aa2t7ib), [xmpp](xmpp:lunovox@disroot.org?join), [audio conference](mumble:mumble.disroot.org), [more contacts](https:libreplanet.org/wiki/User:Lunovox) * Lunovox Heavenfinder: [email](mailto:lunovox@disroot.org), [social web](https://qoto.org/@lunovox), [WebChat](https://cloud.disroot.org/call/9aa2t7ib), [xmpp](xmpp:lunovox@disroot.org?join), [audio conference](mumble:mumble.disroot.org), [more contacts](https://libreplanet.org/wiki/User:Lunovox)
## **Downloads:** ## **Downloads:**
@ -90,28 +93,37 @@ You don't need to do any of these presets mentioned below to make this mod work.
[06]:https://gitlab.com/lunovox/minertrade/-/raw/master/screenshot6.png [06]:https://gitlab.com/lunovox/minertrade/-/raw/master/screenshot6.png
[07]:https://gitlab.com/lunovox/minertrade/-/raw/master/screenshot7.png [07]:https://gitlab.com/lunovox/minertrade/-/raw/master/screenshot7.png
[08]:https://gitlab.com/lunovox/minertrade/-/raw/master/screenshot8.png [08]:https://gitlab.com/lunovox/minertrade/-/raw/master/screenshot8.png
[correio]:https://gitlab.com/lunovox/correio [09]:https://gitlab.com/lunovox/minertrade/-/raw/master/screenshot9.png
[English]:https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License [English]:https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License
[Git Repository]:https://gitlab.com/lunovox/minertrade [Git Repository]:https://gitlab.com/lunovox/minertrade
[intllib]:https://github.com/minetest-mods/intllib
[license_icon]:https://img.shields.io/static/v1?label=GNU%20AGPL%20v3.0&message=Download&color=yellow [license_code_icon]:https://img.shields.io/static/v1?label=LICENSE%20CODE&message=GNU%20AGPL%20v3.0&color=yellow
[license_link]:https://gitlab.com/lunovox/minertrade/-/raw/master/LICENSE [license_code_link]:https://gitlab.com/lunovox/minertrade/-/raw/master/LICENSE_CODE
[license_media_icon]:https://img.shields.io/static/v1?label=LICENSE%20MEDIA&message=CC%20BY-SA-4.0&color=yellow
[license_media_link]:https://gitlab.com/lunovox/minertrade/-/raw/master/LICENSE_MEDIA
[locale/README.md]:https://gitlab.com/lunovox/minertrade/-/tree/master/locale?ref_type=heads [locale/README.md]:https://gitlab.com/lunovox/minertrade/-/tree/master/locale?ref_type=heads
[MINERTRADE]:https://gitlab.com/lunovox/minertrade [mod_minertrade]:https://gitlab.com/lunovox/minertrade
[minetest_icon]:https://img.shields.io/static/v1?label=Minetest&message=Mod&color=brightgreen [minetest_icon]:https://img.shields.io/static/v1?label=Minetest&message=Mod&color=brightgreen
[minetest_link]:https://minetest.net [minetest_link]:https://minetest.net
[mod_computing]:https://gitlab.com/lunovox/computing
[mod_correio]:https://gitlab.com/lunovox/correio
[mod_eurn]:https://gitlab.com/lunovox/e-urn
[mod_intllib]:https://content.luanti.org/packages/kaeza/intllib/
[mod_tradelands]:https://gitlab.com/Lunovox/tradelands
[Portuguese]:https://pt.wikipedia.org/wiki/GNU_Affero_General_Public_License [Portuguese]:https://pt.wikipedia.org/wiki/GNU_Affero_General_Public_License
[Stable Versions]:https://gitlab.com/lunovox/minertrade/-/tags [Stable Versions]:https://gitlab.com/lunovox/minertrade/-/tags
[tradelands]:https://gitlab.com/Lunovox/tradelands
[wiki_en_icon]:https://img.shields.io/static/v1?label=GNU%20AGPL%20v3.0&message=EN&color=blue [wiki_en_icon]:https://img.shields.io/static/v1?label=GNU%20AGPL%20v3.0&message=EN&color=blue
[wiki_en_link]:https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License [wiki_en_link]:https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License
[wiki_pt_icon]:https://img.shields.io/static/v1?label=GNU%20AGPL%20v3.0&message=PT&color=blue [wiki_pt_icon]:https://img.shields.io/static/v1?label=GNU%20AGPL%20v3.0&message=PT&color=blue
[wiki_pt_link]:https://pt.wikipedia.org/wiki/GNU_Affero_General_Public_License [wiki_pt_link]:https://pt.wikipedia.org/wiki/GNU_Affero_General_Public_License
[ContentDB_en_icon]:https://content.minetest.net/packages/Lunovox/minertrade/shields/title/ [ContentDB_en_icon]:https://content.luanti.org/packages/Lunovox/minertrade/shields/title/
[ContentDB_en_link]:https://content.minetest.net/packages/Lunovox/minertrade/ [ContentDB_en_link]:https://content.luanti.org/packages/Lunovox/minertrade/
[DownloadsCDB_en_icon]:https://content.minetest.net/packages/Lunovox/minertrade/shields/downloads/ [DownloadsCDB_en_icon]:https://content.luanti.org/packages/Lunovox/minertrade/shields/downloads/
[DownloadsCDB_en_link]:https://gitlab.com/lunovox/minertrade/-/tags [DownloadsCDB_en_link]:https://gitlab.com/lunovox/minertrade/-/tags

64
api.lua
View file

@ -1,33 +1,33 @@
--FONTE: https://forum.minetest.net/viewtopic.php?pid=48124 --FONTE: https://forum.core.net/viewtopic.php?pid=48124
modMinerTrade.debug = function(text, playername) modMinerTrade.debug = function(text, playername)
if text ~= nil if text ~= nil
and type(text) == "string" and type(text) == "string"
and text ~= "" and text ~= ""
then then
if minetest.settings:get_bool("minertrade.debug") then if core.settings:get_bool("minertrade.debug") then
if playername ~= nil if playername ~= nil
and type(playername) == "string" and type(playername) == "string"
and playername ~= "" and playername ~= ""
then then
local player = minetest.get_player_by_name(playername) local player = core.get_player_by_name(playername)
if player ~=nil and player:is_player() then if player ~=nil and player:is_player() then
minetest.chat_send_player( core.chat_send_player(
playername, text playername, text
) )
minetest.log('action',"["..modMinerTrade.modName:upper()..":DEBUG:"..playername.."] "..text) core.log('warning',"["..modMinerTrade.modName:upper()..":DEBUG:"..playername.."] "..text)
else else
minetest.log('error', core.log('error',
"["..modMinerTrade.modName:upper()..":DEBUG] " "["..modMinerTrade.modName:upper()..":DEBUG] "
..modSoundChat.translate( ..modSoundChat.translate(
"Unable to address debug for player '%s'." "Unable to address debug for player '%s'."
):format(dump(playername)) ):format(dump(playername))
) )
minetest.log('action',"["..modMinerTrade.modName:upper()..":DEBUG] "..text) core.log('warning',"["..modMinerTrade.modName:upper()..":DEBUG] "..text)
end end
else else
minetest.chat_send_all(text) core.chat_send_all(text)
minetest.log('action',"["..modMinerTrade.modName:upper()..":DEBUG] "..text) core.log('warning',"["..modMinerTrade.modName:upper()..":DEBUG] "..text)
end end
end end
end end
@ -43,17 +43,17 @@ modMinerTrade.getNodesInRange = function(pos, search_distance, nodenames)
local minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance} local minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
local maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance} local maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
local nodes = minetest.find_nodes_in_area(minp, maxp, nodenames) local nodes = core.find_nodes_in_area(minp, maxp, nodenames)
--local nodes = minetest.env:find_nodes_in_area(minp, maxp, nodenames) --deprecado --local nodes = core.env:find_nodes_in_area(minp, maxp, nodenames) --deprecado
return #nodes return #nodes
end end
modMinerTrade.doSoundPlayer = function(playername, sfxFile, intDistace) modMinerTrade.doSoundPlayer = function(playername, sfxFile, intDistace)
if intDistace == nil or (type(intDistace) == "number" and intDistace>= 0) then if intDistace == nil or (type(intDistace) == "number" and intDistace>= 0) then
if type(playername) == "string" and type(sfxFile) == "string" and playername ~= "" and sfxFile ~= "" then if type(playername) == "string" and type(sfxFile) == "string" and playername ~= "" and sfxFile ~= "" then
local player = minetest.get_player_by_name(playername) local player = core.get_player_by_name(playername)
if player ~=nil and player:is_player() then if player ~=nil and player:is_player() then
return minetest.sound_play(sfxFile, { return core.sound_play(sfxFile, {
object = player, --Se retirar esta linha tocará para todos. (Provavelmente ¬¬) object = player, --Se retirar esta linha tocará para todos. (Provavelmente ¬¬)
gain = 1.0, -- 1.0 = Volume total gain = 1.0, -- 1.0 = Volume total
max_hear_distance = intDistace, max_hear_distance = intDistace,
@ -66,9 +66,9 @@ end
modMinerTrade.canInteract = function(meta, player) modMinerTrade.canInteract = function(meta, player)
if player:get_player_name() == meta:get_string("owner") if player:get_player_name() == meta:get_string("owner")
or minetest.get_player_privs(player:get_player_name()).server or core.get_player_privs(player:get_player_name()).server
or minetest.get_player_privs(player:get_player_name()).checkchest or core.get_player_privs(player:get_player_name()).checkchest
or (minetest.get_modpath("tradelands") and modTradeLands.canInteract(player:getpos(), player:get_player_name())) or (core.get_modpath("tradelands") and modTradeLands.canInteract(player:getpos(), player:get_player_name()))
then then
return true return true
end end
@ -85,9 +85,9 @@ end
modMinerTrade.getPosMachineName = function(posMachine) modMinerTrade.getPosMachineName = function(posMachine)
if type(posMachine)=="table" and type(posMachine.x)=="number" and type(posMachine.y)=="number" and type(posMachine.z)=="number" then if type(posMachine)=="table" and type(posMachine.x)=="number" and type(posMachine.y)=="number" and type(posMachine.z)=="number" then
return minetest.pos_to_string(modMinerTrade.floor_pos(posMachine)) return core.pos_to_string(modMinerTrade.floor_pos(posMachine))
else else
minetest.log( core.log(
"error",("[modMinerTrade.getPosMachineName(posMachine='%s')] "):format(dump(posMachine)) "error",("[modMinerTrade.getPosMachineName(posMachine='%s')] "):format(dump(posMachine))
..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine") ..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine")
) )
@ -103,13 +103,13 @@ modMinerTrade.setMachineFlagsAlert = function (posMachine, value)
if type(value)=="number" and value>=0 then if type(value)=="number" and value>=0 then
modMinerTrade.machine_flags[posMachineName].lastalert = value modMinerTrade.machine_flags[posMachineName].lastalert = value
else else
minetest.log( core.log(
"error",("[modMinerTrade.setMachineFlagsAlert(posMachine='%s', value='%d')] "):format(dump(posMachine), dump(value)) "error",("[modMinerTrade.setMachineFlagsAlert(posMachine='%s', value='%d')] "):format(dump(posMachine), dump(value))
..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("message") ..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("message")
) )
end end
else else
minetest.log( core.log(
"error",("[modMinerTrade.setMachineFlagsAlert(posMachine='%s', value='%s')] "):format(dump(posMachine), dump(dump)) "error",("[modMinerTrade.setMachineFlagsAlert(posMachine='%s', value='%s')] "):format(dump(posMachine), dump(dump))
..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine") ..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine")
) )
@ -124,7 +124,7 @@ modMinerTrade.getMachineFlagsAlert = function (posMachine)
if type(modMinerTrade.machine_flags[posMachineName].lastalert)~="number" or modMinerTrade.machine_flags[posMachineName].lastalert < 0 then modMinerTrade.machine_flags[posMachineName].lastalert = 0 end if type(modMinerTrade.machine_flags[posMachineName].lastalert)~="number" or modMinerTrade.machine_flags[posMachineName].lastalert < 0 then modMinerTrade.machine_flags[posMachineName].lastalert = 0 end
return modMinerTrade.machine_flags[posMachineName].lastalert return modMinerTrade.machine_flags[posMachineName].lastalert
else else
minetest.log( core.log(
"error",("[modMinerTrade.getMachineFlagsAlert(posMachine='%s', value='%s')] "):format(dump(posMachine), dump(dump)) "error",("[modMinerTrade.getMachineFlagsAlert(posMachine='%s', value='%s')] "):format(dump(posMachine), dump(dump))
..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine") ..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine")
) )
@ -132,10 +132,10 @@ modMinerTrade.getMachineFlagsAlert = function (posMachine)
end end
modMinerTrade.sendMailMachine = function(posMachine, ownername, message) modMinerTrade.sendMailMachine = function(posMachine, ownername, message)
if minetest.get_modpath("correio") then if core.get_modpath("correio") then
local mailMachineInterval = (60*60) local mailMachineInterval = (60*60)
if type(posMachine)=="table" and type(posMachine.x)=="number" and type(posMachine.y)=="number" and type(posMachine.z)=="number" then if type(posMachine)=="table" and type(posMachine.x)=="number" and type(posMachine.y)=="number" and type(posMachine.z)=="number" then
if type(ownername)=="string" and ownername:trim()~="" and minetest.player_exists(ownername) then --Checks whether the owner really exists. if type(ownername)=="string" and ownername:trim()~="" and core.player_exists(ownername) then --Checks whether the owner really exists.
if type(message)=="string" and message:trim()~="" then if type(message)=="string" and message:trim()~="" then
local agora = os.time() local agora = os.time()
local macFlag = modMinerTrade.getMachineFlagsAlert(posMachine) local macFlag = modMinerTrade.getMachineFlagsAlert(posMachine)
@ -146,12 +146,12 @@ modMinerTrade.sendMailMachine = function(posMachine, ownername, message)
message:trim() message:trim()
) )
if carta~=nil then if carta~=nil then
minetest.log('action', core.log('action',
modMinerTrade.translate("A letter was sent by the dispensing machine '%s' to '%s' advising about '%s'!"): modMinerTrade.translate("A letter was sent by the dispensing machine '%s' to '%s' advising about '%s'!"):
format(modMinerTrade.getPosMachineName(posMachine), ownername , message) format(modMinerTrade.getPosMachineName(posMachine), ownername , message)
) )
else else
minetest.log( core.log(
"error",("[modMinerTrade.sendMailMachine(posMachine='%s', ownername='%s', message='%s')] "):format(dump(posMachine), dump(ownername), dump(message)) "error",("[modMinerTrade.sendMailMachine(posMachine='%s', ownername='%s', message='%s')] "):format(dump(posMachine), dump(ownername), dump(message))
..modMinerTrade.translate("Due to an unknown error, it was not possible to send an email through the dispensing machine!") ..modMinerTrade.translate("Due to an unknown error, it was not possible to send an email through the dispensing machine!")
) )
@ -159,38 +159,38 @@ modMinerTrade.sendMailMachine = function(posMachine, ownername, message)
modMinerTrade.setMachineFlagsAlert(posMachine, agora) modMinerTrade.setMachineFlagsAlert(posMachine, agora)
end --if macFlag + mailMachineInterval < agora then end --if macFlag + mailMachineInterval < agora then
else else
minetest.log( core.log(
"error",("[modMinerTrade.sendMailMachine(posMachine='%s', ownername='%s', message='%s')] "):format(dump(posMachine), dump(ownername), dump(message)) "error",("[modMinerTrade.sendMailMachine(posMachine='%s', ownername='%s', message='%s')] "):format(dump(posMachine), dump(ownername), dump(message))
..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("message") ..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("message")
) )
end end
else else
minetest.log( core.log(
"error",("[modMinerTrade.sendMailMachine(posMachine='%s', ownername='%s', message='%s')] "):format(dump(posMachine), dump(ownername), dump(message)) "error",("[modMinerTrade.sendMailMachine(posMachine='%s', ownername='%s', message='%s')] "):format(dump(posMachine), dump(ownername), dump(message))
..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("ownername") ..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("ownername")
) )
end end
else else
minetest.log( core.log(
"error",("[modMinerTrade.sendMailMachine(posMachine='%s', ownername='%s', message='%s')] "):format(dump(posMachine), dump(ownername), dump(message)) "error",("[modMinerTrade.sendMailMachine(posMachine='%s', ownername='%s', message='%s')] "):format(dump(posMachine), dump(ownername), dump(message))
..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine") ..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine")
) )
end end
end --if minetest.get_modpath("correio") then end --if core.get_modpath("correio") then
end end
modMinerTrade.errorDispensing = function(erroMessage, player, pos, ownername) modMinerTrade.errorDispensing = function(erroMessage, player, pos, ownername)
if type(erroMessage)=="string" and erroMessage:trim()~="" then if type(erroMessage)=="string" and erroMessage:trim()~="" then
if player:is_player() then if player:is_player() then
local playername = player:get_player_name() local playername = player:get_player_name()
minetest.chat_send_player(playername, core.colorize("#00ff00", "["..modMinerTrade.translate("DISPENSING MACHINE").."]: ")..erroMessage) core.chat_send_player(playername, core.colorize("#00ff00", "["..modMinerTrade.translate("DISPENSING MACHINE").."]: ")..erroMessage)
minetest.sound_play("sfx_failure", {object=player, max_hear_distance=5.0,}) core.sound_play("sfx_failure", {object=player, max_hear_distance=5.0,})
end end
if type(pos)~="nil" and type(ownername)=="string" and ownername:trim()~="" then if type(pos)~="nil" and type(ownername)=="string" and ownername:trim()~="" then
modMinerTrade.sendMailMachine(pos, ownername, erroMessage) modMinerTrade.sendMailMachine(pos, ownername, erroMessage)
end end
else else
minetest.log( core.log(
"error",("[modMinerTrade.errorDispensing(erroMessage='%s', player, pos, ownername)] "):format(dump(erroMessage)) "error",("[modMinerTrade.errorDispensing(erroMessage='%s', player, pos, ownername)] "):format(dump(erroMessage))
..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("erroMessage") ..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("erroMessage")
) )

View file

@ -15,8 +15,7 @@ modMinerTrade.salary = {
getValue = function() getValue = function()
if modMinerTrade.salary.value == nil then if modMinerTrade.salary.value == nil then
modMinerTrade.salary.value = minetest.settings:get("minertrade.salary.value") modMinerTrade.salary.value = minetest.settings:get("minertrade.salary.value")
if modMinerTrade.salary.value == nil if type(modMinerTrade.salary.value) ~= "number"
or type(tonumber(modMinerTrade.salary.value)) ~= "number"
or tonumber(modMinerTrade.salary.value) < 1 or tonumber(modMinerTrade.salary.value) < 1
then then
modMinerTrade.salary.value = 1 modMinerTrade.salary.value = 1
@ -40,6 +39,53 @@ modMinerTrade.salary = {
end end
return tonumber(modMinerTrade.salary.intervalcheck) return tonumber(modMinerTrade.salary.intervalcheck)
end, end,
doPay = function()
local players = minetest.get_connected_players()
if #players >= 1 then
if modMinerTrade.bank.last_pay ~= minetest.get_day_count() then
modMinerTrade.bank.last_pay = minetest.get_day_count()
local valueSalary = modMinerTrade.salary.getValue()
local description = modMinerTrade.translate("The Government deposited the %2d° salary in your bank account!"):format(minetest.get_day_count())
local payedPeoples = 0
for _, player in ipairs(players) do
local playername = player:get_player_name()
if minetest.get_player_privs(playername).salary then
if modMinerTrade.isExistAcount(playername) then
local publicBalance = modMinerTrade.getBalance("THE GOVERNMENT")
local colorTitle = ""
if publicBalance >= valueSalary then
payedPeoples = payedPeoples + 1
modMinerTrade.addBalance("THE GOVERNMENT", 0 - valueSalary)
modMinerTrade.addBalance(playername, valueSalary)
modMinerTrade.addStatement(playername, valueSalary, description)
colorTitle = "#00FF00"
modMinerTrade.doSoundPlayer(playername, "sfx_cash_register", 5)
else
colorTitle = "#FF0000"
modMinerTrade.doSoundPlayer(playername, "sfx_failure", 5)
description = modMinerTrade.translate("The Government did not have enough balance to deposit the %2dth salary in its bank account!"):format(minetest.get_day_count())
end
minetest.chat_send_player(
playername,
core.colorize(colorTitle,
"["..modMinerTrade.translate("THE GOVERNMENT").."]: "
)..description
)
--else
--modMinerTrade.debug("api_payday.lua >>> "..playername.." sem conta!")
end
end
end -- Final off for _, player in ipairs(players) do
if payedPeoples >= 1 then
modMinerTrade.addStatement("THE GOVERNMENT", 0 - (payedPeoples * valueSalary),
modMinerTrade.translate("Daily Bonus Payment for %02d players online!"):format(payedPeoples)
)
end
minetest.log('action',"[MINERTRADE] "..description)
modMinerTrade.doBankSave()
end
end
end,
} }
minetest.after(3.5, function() minetest.after(3.5, function()
@ -49,34 +95,7 @@ minetest.after(3.5, function()
modMinerTrade.salary.timer = modMinerTrade.salary.timer + dtime modMinerTrade.salary.timer = modMinerTrade.salary.timer + dtime
if modMinerTrade.salary.timer >= modMinerTrade.salary.getIntervalCheck() then if modMinerTrade.salary.timer >= modMinerTrade.salary.getIntervalCheck() then
modMinerTrade.salary.timer = 0 modMinerTrade.salary.timer = 0
local players = minetest.get_connected_players() modMinerTrade.salary.doPay()
if #players >= 1 then
if modMinerTrade.bank.last_pay ~= minetest.get_day_count() then
modMinerTrade.bank.last_pay = minetest.get_day_count()
local description = modMinerTrade.translate("The city hall deposited the %2d° salary in your bank account!"):format(minetest.get_day_count())
for _, player in ipairs(players) do
local playername = player:get_player_name()
if minetest.get_player_privs(playername).salary then
if modMinerTrade.isExistAcount(playername) then
local value = modMinerTrade.salary.getValue()
modMinerTrade.addBalance(playername, value)
modMinerTrade.addStatement(playername, value, description)
minetest.chat_send_player(
playername,
core.colorize("#00FF00",
"["..modMinerTrade.translate("CITY HALL").."]: "
)..description
)
modMinerTrade.doSoundPlayer(playername, "sfx_cash_register", 5)
else
modMinerTrade.debug("api_payday.lua >>> "..playername.." sem conta!")
end
end
end -- Final off for _, player in ipairs(players) do
minetest.log('action',"[MINERTRADE] "..description)
modMinerTrade.doBankSave()
end
end
end end
end) end)
end end

View file

@ -10,6 +10,7 @@ dofile(modPath.."/item_atm.lua")
--dofile(modPath.."/item_strongbox.lua") --dofile(modPath.."/item_strongbox.lua")
--dofile(modPath.."/item_strongbox_old.lua") --dofile(modPath.."/item_strongbox_old.lua")
dofile(modPath.."/item_minercash.lua") dofile(modPath.."/item_minercash.lua")
dofile(modPath.."/item_computing_app.lua")
--dofile(path.."/item_rent_door.lua") --dofile(path.."/item_rent_door.lua")
dofile(modPath.."/api_payday.lua") dofile(modPath.."/api_payday.lua")
--dofile(modPath.."/commands.lua") --dofile(modPath.."/commands.lua")

View file

@ -1,4 +1,4 @@
minetest.register_privilege("developer", { core.register_privilege("developer", {
description=modMinerTrade.translate("Can access evolving ATM functions."), description=modMinerTrade.translate("Can access evolving ATM functions."),
give_to_singleplayer=false, give_to_singleplayer=false,
}) })
@ -11,24 +11,24 @@ modMinerTrade.getUrlDatabase = function()
else else
extension = ".tbl" extension = ".tbl"
end end
return minetest.get_worldpath().."/minertrade"..extension return core.get_worldpath().."/minertrade"..extension
end end
modMinerTrade.doBankSave = function() modMinerTrade.doBankSave = function()
--modMinerTrade.debug("modMinerTrade.doBankSave() >>> "..modMinerTrade.getUrlDatabase()) --modMinerTrade.debug("modMinerTrade.doBankSave() >>> "..modMinerTrade.getUrlDatabase())
local file = io.open(modMinerTrade.getUrlDatabase(), "w") local file = io.open(modMinerTrade.getUrlDatabase(), "w")
if file then if file then
local content = minetest.serialize(modMinerTrade.bank) local content = core.serialize(modMinerTrade.bank)
--modMinerTrade.debug("modMinerTrade.doBankSave() >>> content = "..dump(content)) --modMinerTrade.debug("modMinerTrade.doBankSave() >>> content = "..dump(content))
if modMinerTrade.save_compressed then if modMinerTrade.save_compressed then
content = minetest.encode_base64(content) content = core.encode_base64(content)
end end
file:write(content) file:write(content)
file:close() file:close()
minetest.log('action',"[MINERTRADE] "..modMinerTrade.translate("Saving data bank in the file '%s'!"):format(modMinerTrade.getUrlDatabase())) core.log('action',"[MINERTRADE] "..modMinerTrade.translate("Saving data bank in the file '%s'!"):format(modMinerTrade.getUrlDatabase()))
else else
minetest.log('error',"[MINERTRADE:ERRO] "..modMinerTrade.translate("The file '%s' is not in table format!"):format(modMinerTrade.getUrlDatabase())) core.log('error',"[MINERTRADE:ERRO] "..modMinerTrade.translate("The file '%s' is not in table format!"):format(modMinerTrade.getUrlDatabase()))
end end
end end
@ -37,30 +37,30 @@ modMinerTrade.doBankLoad = function()
local file = io.open(modMinerTrade.getUrlDatabase(), "r") local file = io.open(modMinerTrade.getUrlDatabase(), "r")
if file then if file then
if modMinerTrade.save_compressed then if modMinerTrade.save_compressed then
modMinerTrade.bank = minetest.deserialize(minetest.decode_base64(file:read("*all"))) modMinerTrade.bank = core.deserialize(core.decode_base64(file:read("*all")))
else else
modMinerTrade.bank = minetest.deserialize(file:read("*all")) modMinerTrade.bank = core.deserialize(file:read("*all"))
end end
--modMinerTrade.debug("modMinerTrade.doBankLoad() >>> modMinerTrade.bank = "..dump(modMinerTrade.bank)) --modMinerTrade.debug("modMinerTrade.doBankLoad() >>> modMinerTrade.bank = "..dump(modMinerTrade.bank))
file:close() file:close()
if not modMinerTrade.bank or type(modMinerTrade.bank) ~= "table" then if not modMinerTrade.bank or type(modMinerTrade.bank) ~= "table" then
minetest.log('error',"[MINERTRADE:ERRO] "..modMinerTrade.translate("The file '%s' is not in table format!"):format(modMinerTrade.getUrlDatabase())) core.log('error',"[MINERTRADE:ERRO] "..modMinerTrade.translate("The file '%s' is not in table format!"):format(modMinerTrade.getUrlDatabase()))
return { } return { }
else else
minetest.log('action',"[MINERTRADE] "..modMinerTrade.translate("Opening '%s' with data bank!"):format(modMinerTrade.getUrlDatabase())) core.log('action',"[MINERTRADE] "..modMinerTrade.translate("Opening '%s' with data bank!"):format(modMinerTrade.getUrlDatabase()))
end end
end end
end end
modMinerTrade.getDelayToUse = function() modMinerTrade.getDelayToUse = function()
if modMinerTrade.delay_to_use == nil then if modMinerTrade.delay_to_use == nil then
modMinerTrade.delay_to_use = minetest.settings:get("minertrade.delay_to_use") modMinerTrade.delay_to_use = core.settings:get("minertrade.delay_to_use")
if modMinerTrade.delay_to_use == nil if modMinerTrade.delay_to_use == nil
or type(tonumber(modMinerTrade.delay_to_use)) ~= "number" or type(tonumber(modMinerTrade.delay_to_use)) ~= "number"
or tonumber(modMinerTrade.delay_to_use) < 1 or tonumber(modMinerTrade.delay_to_use) < 1
then then
modMinerTrade.delay_to_use = 300 -- 300 = 5 minutes modMinerTrade.delay_to_use = 300 -- 300 = 5 minutes
minetest.settings:set("minertrade.delay_to_use", modMinerTrade.delay_to_use) core.settings:set("minertrade.delay_to_use", modMinerTrade.delay_to_use)
end end
end end
return tonumber(modMinerTrade.delay_to_use) return tonumber(modMinerTrade.delay_to_use)
@ -68,7 +68,10 @@ end
modMinerTrade.canInteract = function(playername) modMinerTrade.canInteract = function(playername)
--local clickername = clicker:get_player_name() --local clickername = clicker:get_player_name()
if minetest.get_player_privs(playername).mayor then if core.get_player_privs(playername).mayor
or core.get_player_privs(playername).protection_bypass
or core.get_player_privs(playername).server
then
return true return true
end end
return false return false
@ -92,6 +95,7 @@ modMinerTrade.createAcount = function(playername)
} }
--modMinerTrade.bank.player[playername].account_created --modMinerTrade.bank.player[playername].account_created
modMinerTrade.bank.accounts = modMinerTrade.bank.accounts + 1 modMinerTrade.bank.accounts = modMinerTrade.bank.accounts + 1
modMinerTrade.doBankSave()
return true return true
else else
return false return false
@ -101,9 +105,11 @@ modMinerTrade.createAcount = function(playername)
end end
modMinerTrade.getBalance = function(playername) modMinerTrade.getBalance = function(playername)
local balance = 0
if modMinerTrade.isExistAcount(playername) then if modMinerTrade.isExistAcount(playername) then
return modMinerTrade.bank.player[playername].balance balance = tonumber(modMinerTrade.bank.player[playername].balance)
end end
return balance
end end
modMinerTrade.addBalance = function(playername, value) modMinerTrade.addBalance = function(playername, value)
@ -117,14 +123,14 @@ modMinerTrade.addBalance = function(playername, value)
end end
modMinerTrade.getMaxStatements = function() --MÁXIMO DE EXTRATOS ARMAZENADOS. modMinerTrade.getMaxStatements = function() --MÁXIMO DE EXTRATOS ARMAZENADOS.
local maxStatements = minetest.settings:get("minertrade.bank.max_statements") local maxStatements = core.settings:get("minertrade.bank.max_statements")
if maxStatements == nil if maxStatements == nil
or type(tonumber(maxStatements)) ~= "number" or type(tonumber(maxStatements)) ~= "number"
or tonumber(maxStatements) < 1 --Min or tonumber(maxStatements) < 1 --Min
or tonumber(maxStatements) > 300 --Max or tonumber(maxStatements) > 300 --Max
then then
maxStatements = 30 maxStatements = 30
minetest.settings:set("minertrade.bank.max_statements", tostring(maxStatements)) core.settings:set("minertrade.bank.max_statements", tostring(maxStatements))
end end
return tonumber(maxStatements) return tonumber(maxStatements)
end end
@ -179,7 +185,7 @@ end
modMinerTrade.getSalt_Hash = function() modMinerTrade.getSalt_Hash = function()
if modMinerTrade.bank.salt_hash == nil then if modMinerTrade.bank.salt_hash == nil then
modMinerTrade.bank.salt_hash = minetest.encode_base64("SALT_HASH: "..os.date("%Y-%B-%d %Hh:%Mm:%Ss")) modMinerTrade.bank.salt_hash = core.encode_base64("SALT_HASH: "..os.date("%Y-%B-%d %Hh:%Mm:%Ss"))
end end
return modMinerTrade.bank.salt_hash return modMinerTrade.bank.salt_hash
end end
@ -199,62 +205,58 @@ modMinerTrade.addTransferProof_v2 = function(player, accountname, txtBeneficiary
.."\n"..modMinerTrade.translate("Account Holder")..": "..accountname .."\n"..modMinerTrade.translate("Account Holder")..": "..accountname
.."\n"..modMinerTrade.translate("Beneficiary")..": "..txtBeneficiary .."\n"..modMinerTrade.translate("Beneficiary")..": "..txtBeneficiary
.."\n"..modMinerTrade.translate("When")..": "..when .."\n"..modMinerTrade.translate("When")..": "..when
.."\n"..modMinerTrade.translate("Value")..": "..txtValue.." minercash" .."\n"..modMinerTrade.translate("Value")..": "..("%02d"):format(tonumber(txtValue)).." minercash"
.."\n"..modMinerTrade.translate("Transfer Reason")..": "..txtReason .."\n"..modMinerTrade.translate("Transfer Reason")..": "..txtReason
local Auth = minetest.get_password_hash( local Auth = core.get_password_hash(
modMinerTrade.getSalt_Hash(), modMinerTrade.getSalt_Hash(),
minetest.encode_base64(docData:trim()) core.encode_base64(docData:trim())
) )
local htmlBody = [[ local htmlBody = [[
<global valign=middle halign=left margin=10 background=#FFFFFF00 color=#000000 hovercolor=#00FF00 size=12 font=mono>
<tag name=action color=#FF0000 hovercolor=#00FF00 font=mono size=12>
<center> <center>
<img name=obj_piggy_bank.png float=center width=96 height=96> <img name=obj_piggy_bank.png float=center width=96 height=96>
<style font=mono color=#FF0000 size=24><b>[MINETEST_BANK]</b></style> <style font=mono color=#FF0000 size=24><b><minetest_bank/></b></style>
[TRANSFER_PROOF] <transfer_proof/>
</center> </center>
[DOC_DATA] <doc_data/>
<center> <center>
---------------------------------= [AUTHENTICATION_HASH] =------------------------------------- -------------= AUTHENTICATION HASH =--------------
[AUTH] <center><transfer_auth/></center>
----------------------------------------------------------------------------------------------- --------------------------------------------------
[EXIST_MESSAGE] <exit_message/>
</center> </center>
]] ]]
--[[ --[[ ]]
htmlBody = htmlBody:gsub( htmlBody = htmlBody:gsub('<minetest_bank/>', core.formspec_escape(modMinerTrade.translate("MINETEST BANK")))
"[MINETEST_BANK]", htmlBody = htmlBody:gsub('AUTHENTICATION HASH', core.formspec_escape(modMinerTrade.translate("AUTHENTICATION HASH")))
modMinerTrade.translate("MINETEST BANK") htmlBody = htmlBody:gsub('<exit_message/>', core.formspec_escape(modMinerTrade.translate("Press <b>ESC</b> to exit this screen!")))
) htmlBody = htmlBody:gsub('<transfer_proof/>', core.formspec_escape(title))
htmlBody = htmlBody:gsub( htmlBody = htmlBody:gsub('<doc_data/>', core.formspec_escape(docData))
"[EXIST_MESSAGE]", htmlBody = htmlBody:gsub('<transfer_auth/>', core.formspec_escape(Auth))
modMinerTrade.translate("Press <b>ESC</b> to exit this screen!")
)
htmlBody = htmlBody:gsub("[TRANSFER_PROOF]", title)
htmlBody = htmlBody:gsub("[DOC_DATA]", docData)
htmlBody = htmlBody:gsub("[AUTH]", Auth)
--]] --]]
--local player = minetest.get_player_by_name(playername)
modMinerTrade.addPaperPrinted(player, itemDescription, htmlBody) modMinerTrade.addPaperPrinted(player, itemDescription, htmlBody)
end end
modMinerTrade.addTransferProof = function(player, accountname, txtBeneficiary, txtValue, txtReason) modMinerTrade.addTransferProof_v1 = function(player, accountname, txtBeneficiary, txtValue, txtReason)
local playername = player:get_player_name() local playername = player:get_player_name()
local objProof = modMinerTrade.getProofStack(playername, accountname, txtBeneficiary, txtValue, txtReason) local objProof = modMinerTrade.getProofStack(playername, accountname, txtBeneficiary, txtValue, txtReason)
local invPlayer = player:get_inventory() local invPlayer = player:get_inventory()
if invPlayer:room_for_item("main", objProof) then-- verifica se compartimento de Recebimento de pagamento do vendedor tem espaço if invPlayer:room_for_item("main", objProof) then-- verifica se compartimento de Recebimento de pagamento do vendedor tem espaço
invPlayer:add_item("main", objProof) invPlayer:add_item("main", objProof)
minetest.chat_send_player(playername, core.chat_send_player(playername,
core.colorize("#00FF00", "["..modMinerTrade.translate("ATM").."]: ") core.colorize("#00FF00", "["..modMinerTrade.translate("ATM").."]: ")
..modMinerTrade.translate("Transfer successful!") ..modMinerTrade.translate("Transfer successful!")
) )
else else
minetest.add_item(player:get_pos(), objProof) core.add_item(player:get_pos(), objProof)
minetest.chat_send_player(playername, core.chat_send_player(playername,
core.colorize("#00FF00", "["..modMinerTrade.translate("ATM").."]: ") core.colorize("#00FF00", "["..modMinerTrade.translate("ATM").."]: ")
..core.colorize("#FF0000", ..core.colorize("#FF0000",
modMinerTrade.translate("The Transfer Proof was left on the floor because '%s' inventory has no free space."):format(playername) modMinerTrade.translate("The Transfer Proof was left on the floor because '%s' inventory has no free space."):format(playername)
@ -264,7 +266,7 @@ modMinerTrade.addTransferProof = function(player, accountname, txtBeneficiary, t
end end
modMinerTrade.getProofStack = function(playername, accountname, txtBeneficiary, txtValue, txtReason) modMinerTrade.getProofStack = function(playername, accountname, txtBeneficiary, txtValue, txtReason)
local player = minetest.get_player_by_name(playername) local player = core.get_player_by_name(playername)
if player ~= nil and player:is_player() then if player ~= nil and player:is_player() then
local lpp = 14 -- Lines per book's page local lpp = 14 -- Lines per book's page
local max_text_size = 10000 local max_text_size = 10000
@ -290,9 +292,9 @@ modMinerTrade.getProofStack = function(playername, accountname, txtBeneficiary,
.."\n"..modMinerTrade.translate("Value")..": "..txtValue.." minercash" .."\n"..modMinerTrade.translate("Value")..": "..txtValue.." minercash"
.."\n"..modMinerTrade.translate("Transfer Reason")..": "..txtReason .."\n"..modMinerTrade.translate("Transfer Reason")..": "..txtReason
local Auth = minetest.get_password_hash( local Auth = core.get_password_hash(
modMinerTrade.getSalt_Hash(), modMinerTrade.getSalt_Hash(),
minetest.encode_base64(myDocument:trim()) core.encode_base64(myDocument:trim())
) )
data.text = "" data.text = ""
.."\n"..myDocument:trim() .."\n"..myDocument:trim()
@ -332,18 +334,34 @@ end
modMinerTrade.showAccountBank = { modMinerTrade.showAccountBank = {
--modMinerTrade.showAccountBank.inAtm(playername, accountname) --modMinerTrade.showAccountBank.inAtm(playername, accountname)
inAtm = function(playername, accountname) inAtm = function(playername, accountname)
modMinerTrade.bank.player[playername].focused_accountname = accountname if modMinerTrade.isExistAcount(accountname) then
modMinerTrade.bank.player[playername].focused_accountmode = "atm" modMinerTrade.bank.player[playername].focused_accountname = accountname
modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5) modMinerTrade.bank.player[playername].focused_accountmode = "atm"
modMinerTrade.showAccountBank.frmMain(playername) modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
modMinerTrade.showAccountBank.frmMain(playername)
end
end, end,
--modMinerTrade.showAccountBank.inCreditCard(playername, accountname) --modMinerTrade.showAccountBank.inCreditCard(playername, accountname)
inCreditCard = function(playername, accountname) inCreditCard = function(playername, accountname)
if modMinerTrade.isExistAcount(accountname) then
modMinerTrade.bank.player[playername].focused_accountname = accountname
modMinerTrade.bank.player[playername].focused_accountmode = "online"
modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
modMinerTrade.showAccountBank.frmMain(playername)
end
end,
--[[ ]]
inPublicAccess = function(playername) --
local accountname = "THE GOVERNMENT"
if not modMinerTrade.isExistAcount(accountname) then
modMinerTrade.createAcount(accountname)
end
modMinerTrade.bank.player[playername].focused_accountname = accountname modMinerTrade.bank.player[playername].focused_accountname = accountname
modMinerTrade.bank.player[playername].focused_accountmode = "online" modMinerTrade.bank.player[playername].focused_accountmode = "public_access"
modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5) modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
modMinerTrade.showAccountBank.frmMain(playername) modMinerTrade.showAccountBank.frmMain(playername)
end, end,
--]]
frmMain = function(playername) --FORMULÁRIO: PRINCIPAL / RAIZ frmMain = function(playername) --FORMULÁRIO: PRINCIPAL / RAIZ
local accountname = modMinerTrade.bank.player[playername].focused_accountname local accountname = modMinerTrade.bank.player[playername].focused_accountname
local accountmode = modMinerTrade.bank.player[playername].focused_accountmode local accountmode = modMinerTrade.bank.player[playername].focused_accountmode
@ -356,39 +374,61 @@ modMinerTrade.showAccountBank = {
--.."background[5.0,-0.25;10,10;default_steel_block.png^text_atm_front.png]" --.."background[5.0,-0.25;10,10;default_steel_block.png^text_atm_front.png]"
.. "box[0.00,0.10;5.50,9.5;#000000]" .. "box[0.00,0.10;5.50,9.5;#000000]"
.. "button[0.25,0.50;5.00,0.5;btnBalance;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BALANCE"))).."]" .. "button[0.25,0.50;5.00,0.5;btnBalance;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BALANCE"))).."]"
.. "button[0.25,1.25;5.00,0.5;btnStatement;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("STATEMENT"))).."]" .. "button[0.25,1.25;5.00,0.5;btnStatement;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("STATEMENT"))).."]"
.. "button[0.25,3.50;5.00,0.5;btnTransfers;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("TRANSFERS"))).."]" if type(accountmode) == "string" and ( --Aacesso público à contas públicas não tem transferência.
if accountmode == "atm"
accountmode~=nil or accountmode == "online"
and type(accountmode) == "string" or (
and accountmode == "atm" accountmode == "public_access" and (
core.get_player_privs(playername).mayor
or (core.global_exists("modEUrn") and modEUrn.getPresidentName()==playername)
)
)
)
then then
formspec = formspec formspec = formspec
.. "button[0.25,2.00;5.00,0.5;btnDeposits;"..minetest.formspec_escape(core.colorize("#FFFFF", modMinerTrade.translate("DEPOSITS"))).."]" .. "button[0.25,3.50;5.00,0.5;btnTransfers;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("TRANSFERS"))).."]"
.. "button[0.25,2.75;5.00,0.5;btnWithdrawals;"..minetest.formspec_escape(core.colorize("#FFFFF", modMinerTrade.translate("WITHDRAWALS"))).."]" -- [DINHEIRO E CHECK]
end end
if minetest.get_player_privs(playername).developer then if type(accountmode) == "string" and (accountmode == "atm" or accountmode == "public_access") then
formspec = formspec formspec = formspec
.. "button[0.25,5.00;5.00,0.5;btnCreditCard;"..minetest.formspec_escape(core.colorize("#888888", modMinerTrade.translate("CREDIT CARD"))).."]" -- [EXPEDIR E MUDAR SENHA] .. "button[0.25,2.00;5.00,0.5;btnDeposits;"..core.formspec_escape(core.colorize("#FFFFF", modMinerTrade.translate("DEPOSITS"))).."]"
.. "button[0.25,4.25;5.00,0.5;btnLoans;"..minetest.formspec_escape(core.colorize("#888888", modMinerTrade.translate("LOANS"))).."]" --Emprestimos end
.. "button[0.25,5.75;5.00,0.5;btnLottery;"..minetest.formspec_escape(core.colorize("#888888", modMinerTrade.translate("LOTTERY"))).."]" --Lotérica if type(accountmode) == "string" and accountmode == "atm"
.. "button[0.25,6.50;5.00,0.5;btnSetings;"..minetest.formspec_escape(core.colorize("#888888", modMinerTrade.translate("SETTINGS"))).."]" --Se quer ou não uma senha, se quer receber uma carta quando houver uma nova movimentacao. then
formspec = formspec
.. "button[0.25,2.75;5.00,0.5;btnWithdrawals;"..core.formspec_escape(core.colorize("#FFFFF", modMinerTrade.translate("WITHDRAWALS"))).."]" -- [DINHEIRO E CHECK]
end
if core.get_player_privs(playername).developer then
formspec = formspec
.. "button[0.25,5.00;5.00,0.5;btnCreditCard;"..core.formspec_escape(core.colorize("#888888", modMinerTrade.translate("CREDIT CARD"))).."]" -- [EXPEDIR E MUDAR SENHA]
.. "button[0.25,4.25;5.00,0.5;btnLoans;"..core.formspec_escape(core.colorize("#888888", modMinerTrade.translate("LOANS"))).."]" --Emprestimos
.. "button[0.25,5.75;5.00,0.5;btnLottery;"..core.formspec_escape(core.colorize("#888888", modMinerTrade.translate("LOTTERY"))).."]" --Lotérica
.. "button[0.25,6.50;5.00,0.5;btnSetings;"..core.formspec_escape(core.colorize("#888888", modMinerTrade.translate("SETTINGS"))).."]" --Se quer ou não uma senha, se quer receber uma carta quando houver uma nova movimentacao.
end
if type(accountmode) == "string" and accountmode ~= "public_access"
then
formspec = formspec
.."button[0.25,6.50;5.00,0.5;btnPublicAccess;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("THE GOVERNMENT"))).."]"
end end
formspec = formspec formspec = formspec
.."button_exit[0.25,7.25;5.00,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" .."button_exit[0.25,7.25;5.00,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
--.. "box[6.0,0.25;9.5,9.5;#000000]" --.. "box[6.0,0.25;9.5,9.5;#000000]"
.."background[6.0,0.25;9.5,9.5;text_atm_front.png]" .."background[6.0,0.25;9.5,9.5;text_atm_front.png]"
minetest.show_formspec(playername, "frmAtmMain", formspec) core.show_formspec(playername, "frmAtmMain", formspec)
end, end,
frmBalance = function(playername) --FORMULÁRIO: SALDO frmBalance = function(playername) --FORMULÁRIO: SALDO
local accountname = modMinerTrade.bank.player[playername].focused_accountname local accountname = modMinerTrade.bank.player[playername].focused_accountname
local account_created = ""
local msgBalance = "" local msgBalance = ""
if modMinerTrade.isExistAcount(accountname) then if modMinerTrade.isExistAcount(accountname) then
msgBalance = modMinerTrade.translate("You have %02d minercash."):format(modMinerTrade.getBalance(accountname)) msgBalance = modMinerTrade.translate("You have %02d minercash."):format(modMinerTrade.getBalance(accountname))
account_created = modMinerTrade.bank.player[accountname].account_created
else else
msgBalance = modMinerTrade.translate("Player '%s' is not an account holder of this bank."):format(accountname) msgBalance = modMinerTrade.translate("Player '%s' is not an account holder of this bank."):format(accountname)
account_created = "----/--/-- --:--:--"
end end
--local tblStatements = modMinerTrade.getStatement(accountname) --local tblStatements = modMinerTrade.getStatement(accountname)
@ -402,22 +442,22 @@ modMinerTrade.showAccountBank = {
--..default.gui_slots --..default.gui_slots
.. "box[0.00,0.10;5.50,9.5;#000000]" .. "box[0.00,0.10;5.50,9.5;#000000]"
.. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" .. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
.."button_exit[0.25,6.50;5.00,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" .."button_exit[0.25,6.50;5.00,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
.. "box[6.0,0.25;9.5,9.5;#00000088]" .. "box[6.0,0.25;9.5,9.5;#00000088]"
.."background[6.0,0.25;9.5,9.5;text_atm_front.png]" .."background[6.0,0.25;9.5,9.5;text_atm_front.png]"
.. "textarea[6.75,1.00;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("NAME OF BANKING ACCOUNT HOLDER")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", accountname:upper())).."]" .. "textarea[6.75,1.00;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("NAME OF BANKING ACCOUNT HOLDER")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", accountname:upper())).."]"
.. "textarea[6.75,2.50;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("ACCOUNT CREATED")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.bank.player[accountname].account_created)).."]" .. "textarea[6.75,2.50;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("ACCOUNT CREATED")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", account_created)).."]"
.. "textarea[6.75,4.00;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("FINANCIAL TRANSACTIONS")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", ("%02d"):format(totalTransactions).." transactions.")).."]" .. "textarea[6.75,4.00;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("FINANCIAL TRANSACTIONS")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", ("%02d"):format(totalTransactions).." transactions.")).."]"
.. "textarea[6.75,5.50;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]" .. "textarea[6.75,5.50;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]"
modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5) modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
minetest.show_formspec( core.show_formspec(
playername, playername,
"frmAtmBalance", "frmAtmBalance",
formspec formspec
@ -434,12 +474,12 @@ modMinerTrade.showAccountBank = {
--.."bgcolor[#636D76FF;false]" --.."bgcolor[#636D76FF;false]"
--.."background[-0.25,-0.25;10,11;safe_inside.png]" --.."background[-0.25,-0.25;10,11;safe_inside.png]"
--.."button[0,0.0;4,0.5;btnAtmMain;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" --.."button[0,0.0;4,0.5;btnAtmMain;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
--.."button_exit[0,3.0;4,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" --.."button_exit[0,3.0;4,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
.. "box[0.00,0.10;5.50,9.5;#000000]" .. "box[0.00,0.10;5.50,9.5;#000000]"
.. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" .. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
.."button_exit[0.25,6.50;5.00,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" .."button_exit[0.25,6.50;5.00,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
.. "box[6.0,0.25;9.5,9.5;#00000088]" .. "box[6.0,0.25;9.5,9.5;#00000088]"
--.."background[5.0,0.25;9.5,9.5;text_atm_front.png]" --.."background[5.0,0.25;9.5,9.5;text_atm_front.png]"
@ -448,9 +488,9 @@ modMinerTrade.showAccountBank = {
local isAccount = modMinerTrade.isExistAcount(accountname) local isAccount = modMinerTrade.isExistAcount(accountname)
if isAccount then if isAccount then
formspec = formspec formspec = formspec
.. "label[6.25,0.50;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("STATEMENT")..":")).."]" .. "label[6.25,0.50;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("STATEMENT")..":")).."]"
--.. "label[5.25,2.50;"..minetest.formspec_escape(core.colorize("#00FFFF", msgStatement)).."]" --.. "label[5.25,2.50;"..core.formspec_escape(core.colorize("#00FFFF", msgStatement)).."]"
--"textarea[5.75,1.00;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("STATEMENT")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", msgStatement)).."]" --"textarea[5.75,1.00;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("STATEMENT")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", msgStatement)).."]"
local listStatement = modMinerTrade.getStatement(accountname) local listStatement = modMinerTrade.getStatement(accountname)
local plusStatement = "#888,"..modMinerTrade.translate("")..","..modMinerTrade.translate("WHEN")..","..modMinerTrade.translate("VALUE") local plusStatement = "#888,"..modMinerTrade.translate("")..","..modMinerTrade.translate("WHEN")..","..modMinerTrade.translate("VALUE")
@ -463,9 +503,9 @@ modMinerTrade.showAccountBank = {
--local line = oneStatement.when.." | "..sign..oneStatement.value.." minercash." --local line = oneStatement.when.." | "..sign..oneStatement.value.." minercash."
local line = "#FFF," local line = "#FFF,"
..(("%03d"):format(i)).."," ..(("%03d"):format(i))..","
..minetest.formspec_escape(oneStatement.when) ..core.formspec_escape(oneStatement.when)
.."," ..","
..minetest.formspec_escape(sign..("%02d"):format(oneStatement.value).." MT$.") ..core.formspec_escape(sign..("%02d"):format(oneStatement.value).." MT$.")
if plusStatement == "" then if plusStatement == "" then
plusStatement = line plusStatement = line
else else
@ -480,9 +520,9 @@ modMinerTrade.showAccountBank = {
sign = "+" sign = "+"
end end
plusStatement = plusStatement..",#FFFF00,," plusStatement = plusStatement..",#FFFF00,,"
--..minetest.formspec_escape(os.date("%Y-%B-%d %Hh:%Mm:%Ss")) --..core.formspec_escape(os.date("%Y-%B-%d %Hh:%Mm:%Ss"))
..minetest.formspec_escape(modMinerTrade.translate("TOTAL")..": ") ..core.formspec_escape(modMinerTrade.translate("TOTAL")..": ")
..minetest.formspec_escape(sign..("%02d"):format(value).." minercash.") ..core.formspec_escape(sign..("%02d"):format(value).." minercash.")
.."," ..","
end end
--]] --]]
@ -504,13 +544,13 @@ modMinerTrade.showAccountBank = {
end end
formspec = formspec formspec = formspec
.."textarea[6.75,8.50;9.0,1.5;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("TRANSACTION DETAILS")..":"))..";" .."textarea[6.75,8.50;9.0,1.5;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("TRANSACTION DETAILS")..":"))..";"
..minetest.formspec_escape(core.colorize("#00FFFF", msgStatement)) ..core.formspec_escape(core.colorize("#00FFFF", msgStatement))
.."]" .."]"
minetest.show_formspec( core.show_formspec(
playername, playername,
"frmAtmStatement", "frmAtmStatement",
formspec formspec
@ -526,31 +566,31 @@ modMinerTrade.showAccountBank = {
--..default.gui_slots --..default.gui_slots
.. "box[0.00,0.10;5.50,9.5;#000000]" .. "box[0.00,0.10;5.50,9.5;#000000]"
.. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" .. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
.."button_exit[0.25,6.50;5.00,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" .."button_exit[0.25,6.50;5.00,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
.."background[6.0,0.25;9.5,9.5;text_atm_front.png]" .."background[6.0,0.25;9.5,9.5;text_atm_front.png]"
.. "box[6.0,0.25;9.5,9.5;#000000CC]" .. "box[6.0,0.25;9.5,9.5;#000000CC]"
.. "label[6.75,0.75;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("SELECT BANK WITHDRAWAL METHOD")..":")).."]" .. "label[6.75,0.75;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("SELECT BANK WITHDRAWAL METHOD")..":")).."]"
--.. "textarea[5.75,1.00;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]" --.. "textarea[5.75,1.00;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]"
--.. "button[6.25,1.50;1.00,1.00;btnAtmMain;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" --.. "button[6.25,1.50;1.00,1.00;btnAtmMain;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
--.."style_type[image_button;bgcolor=#00000000;border=false]" --.."style_type[image_button;bgcolor=#00000000;border=false]"
--.."style[btnMinercoin;bgimg=sbl_save.png;bgimg_hovered=sbl_save_pressed.png;bgimg_pressed=sbl_save_pressed.png;border=false]" --.."style[btnMinercoin;bgimg=sbl_save.png;bgimg_hovered=sbl_save_pressed.png;bgimg_pressed=sbl_save_pressed.png;border=false]"
.. "label[9.25,3.25;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("MINERCASH"))).."]" .. "label[9.25,3.25;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("MINERCASH"))).."]"
.."tooltip[btnMinercoin;"..minetest.formspec_escape(modMinerTrade.translate("Withdrawals in minercash."))..";#CCCC0088;#000000]" .."tooltip[btnMinercoin;"..core.formspec_escape(modMinerTrade.translate("Withdrawals in minercash."))..";#CCCC0088;#000000]"
.."image_button[7.25,2.50;2.00,2.00;obj_minercoin.png;btnGiveCash;]" .."image_button[7.25,2.50;2.00,2.00;obj_minercoin.png;btnGiveCash;]"
.. "label[9.25,5.75;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BANK CHECK"))).."]" .. "label[9.25,5.75;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BANK CHECK"))).."]"
.."tooltip[btnMinercoin;"..minetest.formspec_escape(modMinerTrade.translate("Withdrawals in bank check."))..";#CCCC0088;#000000]" .."tooltip[btnMinercoin;"..core.formspec_escape(modMinerTrade.translate("Withdrawals in bank check."))..";#CCCC0088;#000000]"
.."image_button[7.25,5.00;2.00,2.00;obj_bank_check.png;btnGiveCheck;]" .."image_button[7.25,5.00;2.00,2.00;obj_bank_check.png;btnGiveCheck;]"
modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5) modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
minetest.show_formspec(playername, "frmAtmWithdrawals", formspec) core.show_formspec(playername, "frmAtmWithdrawals", formspec)
end, end,
frmGiveCash = function(playername, txtValue, msgDetails) --FORMULÁRIO: SAQUE EM DINHEIRO frmGiveCash = function(playername, txtValue, msgDetails) --FORMULÁRIO: SAQUE EM DINHEIRO
local accountname = modMinerTrade.bank.player[playername].focused_accountname local accountname = modMinerTrade.bank.player[playername].focused_accountname
--modMinerTrade.debug("modMinerTrade.showAccountBank.frmGiveCash() >>> playername = "..playername.." | txtValue = "..dump(txtValue).." | msgDetails = "..dump(msgDetails)) modMinerTrade.debug("modMinerTrade.showAccountBank.frmGiveCash() >>> playername = "..playername.." | txtValue = "..dump(txtValue).." | msgDetails = "..dump(msgDetails))
local msgBalance = "" local msgBalance = ""
if modMinerTrade.isExistAcount(accountname) then if modMinerTrade.isExistAcount(accountname) then
@ -566,13 +606,13 @@ modMinerTrade.showAccountBank = {
--..default.gui_slots --..default.gui_slots
.. "box[0.00,0.10;5.50,9.5;#000000]" .. "box[0.00,0.10;5.50,9.5;#000000]"
.. "button[0.25,0.50;5.00,0.5;btnWithdrawals;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" .. "button[0.25,0.50;5.00,0.5;btnWithdrawals;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
.."button_exit[0.25,6.50;5.00,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" .."button_exit[0.25,6.50;5.00,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
.."background[6.0,0.25;9.5,9.5;text_atm_front.png]" .."background[6.0,0.25;9.5,9.5;text_atm_front.png]"
.. "box[6.0,0.25;9.5,9.5;#000000CC]" .. "box[6.0,0.25;9.5,9.5;#000000CC]"
.. "textarea[6.75,1.00;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]" .. "textarea[6.75,1.00;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]"
if modMinerTrade.isExistAcount(accountname) then if modMinerTrade.isExistAcount(accountname) then
if txtValue == nil or txtValue == "" then if txtValue == nil or txtValue == "" then
@ -582,28 +622,28 @@ modMinerTrade.showAccountBank = {
msgDetails = modMinerTrade.translate("Write the value that want to withdrawal!") msgDetails = modMinerTrade.translate("Write the value that want to withdrawal!")
end end
formspec = formspec formspec = formspec
--.. "label[5.25,0.50;"..minetest.formspec_escape(core.colorize("#00FFFF", "WITHDRAWAL IN MINERCASH:")).."]" --.. "label[5.25,0.50;"..core.formspec_escape(core.colorize("#00FFFF", "WITHDRAWAL IN MINERCASH:")).."]"
.."field[7.00,3.50;3.00,0.50;txtValue;" .."field[7.00,3.50;3.00,0.50;txtValue;"
..minetest.formspec_escape( ..core.formspec_escape(
core.colorize( core.colorize(
"#00FFFF", "#00FFFF",
modMinerTrade.translate("VALUE")..":" modMinerTrade.translate("VALUE")..":"
) )
)..";" )..";"
..minetest.formspec_escape(txtValue) ..core.formspec_escape(txtValue)
.."]" .."]"
.. "button[9.85,3.00;4.00,1.00;btnAtmGive;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("WITHDRAWAL"))).."]" .. "button[9.85,3.00;4.00,1.00;btnAtmGive;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("WITHDRAWAL"))).."]"
.."textarea[6.75,8.50;9.0,1.5;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("DETAILS")..":"))..";" .."textarea[6.75,8.50;9.0,1.5;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("DETAILS")..":"))..";"
..minetest.formspec_escape(core.colorize("#00FFFF", msgDetails)) ..core.formspec_escape(core.colorize("#00FFFF", msgDetails))
.."]" .."]"
end end
minetest.show_formspec(playername, "frmAtmGiveCash", formspec) core.show_formspec(playername, "frmAtmGiveCash", formspec)
end, end,
frmDeposits = function(playername) --FORMULÁRIO: DEPÓSITOS frmDeposits = function(playername) --FORMULÁRIO: DEPÓSITOS
local accountname = modMinerTrade.bank.player[playername].focused_accountname local accountname = modMinerTrade.bank.player[playername].focused_accountname
-- playername = player:get_player_name() -- playername = player:get_player_name()
local newInv = minetest.create_detached_inventory("deposits_"..accountname, { local newInv = core.create_detached_inventory("deposits_"..playername, {
-- Called when a player wants to move items inside the inventory -- Called when a player wants to move items inside the inventory
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
@ -633,11 +673,11 @@ modMinerTrade.showAccountBank = {
-- Called after the actual action has happened, according to what was allowed. -- Called after the actual action has happened, according to what was allowed.
on_move = function(inv, from_list, from_index, to_list, to_index, count, player) on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
--modMinerTrade.setSafeInventory(playername, inv:get_list("safe")) --modMinerTrade.setSafeInventory(playername, inv:get_list("safe"))
--minetest.log('action',playername.." colocou "..stack:get_count().." '"..stack:get_name().."' em seu cofre!") --core.log('action',playername.." colocou "..stack:get_count().." '"..stack:get_name().."' em seu cofre!")
end, end,
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname, index, stack, player)
--modMinerTrade.setSafeInventory(playername, inv:get_list("safe")) --modMinerTrade.setSafeInventory(playername, inv:get_list("safe"))
--minetest.log('action',modMinerTrade.translate("Player '%s' has placed %02d '%s' in his safe!"):format(playername, stack:get_count(), stack:get_name())) --core.log('action',modMinerTrade.translate("Player '%s' has placed %02d '%s' in his safe!"):format(playername, stack:get_count(), stack:get_name()))
--local accountname = player:get_player_name() --local accountname = player:get_player_name()
if modMinerTrade.checkValidStack(stack) >= 1 then if modMinerTrade.checkValidStack(stack) >= 1 then
local stackValue = modMinerTrade.getValueStack(stack) local stackValue = modMinerTrade.getValueStack(stack)
@ -660,7 +700,7 @@ modMinerTrade.showAccountBank = {
end, end,
on_take = function(inv, listname, index, stack, player) on_take = function(inv, listname, index, stack, player)
--modMinerTrade.setSafeInventory(playername, inv:get_list("safe")) --modMinerTrade.setSafeInventory(playername, inv:get_list("safe"))
--minetest.log('action',modMinerTrade.translate("Player '%s' has removed %02d '%s' in his safe!"):format(playername, stack:get_count(), stack:get_name())) --core.log('action',modMinerTrade.translate("Player '%s' has removed %02d '%s' in his safe!"):format(playername, stack:get_count(), stack:get_name()))
end, end,
}) })
@ -683,35 +723,35 @@ modMinerTrade.showAccountBank = {
--..default.gui_slots --..default.gui_slots
.. "box[0.00,0.10;5.50,9.5;#000000]" .. "box[0.00,0.10;5.50,9.5;#000000]"
.. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" .. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
.."button_exit[0.25,6.50;5.00,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" .."button_exit[0.25,6.50;5.00,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
.."background[6.0,0.25;9.5,9.5;text_atm_front.png]" .."background[6.0,0.25;9.5,9.5;text_atm_front.png]"
.. "box[6.0,0.25;9.5,9.5;#000000AA]" .. "box[6.0,0.25;9.5,9.5;#000000AA]"
.. "label[6.50,0.50;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BANK DEPOSIT") )).."]" .. "label[6.50,0.50;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BANK DEPOSIT") )).."]"
--.. "textarea[5.75,1.00;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]" --.. "textarea[5.75,1.00;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]"
.. "box[6.5,1.50;8.5,1.05;#00FF0044]" .. "box[6.5,1.50;8.5,1.05;#00FF0044]"
.."textarea[7.25,2.00;9.0,2.0;;" .."textarea[7.25,2.00;9.0,2.0;;"
..minetest.formspec_escape(core.colorize("#FFFF00", modMinerTrade.translate("YOUR BALANCE")..":"))..";" ..core.formspec_escape(core.colorize("#FFFF00", modMinerTrade.translate("YOUR BALANCE")..":"))..";"
..minetest.formspec_escape(core.colorize("#FFFFFF", minetest.formspec_escape(msgBalance))) ..core.formspec_escape(core.colorize("#FFFFFF", core.formspec_escape(msgBalance)))
.."]" .."]"
--listcolors[slot_bg_normal;slot_bg_hover;slot_border;tooltip_bgcolor;tooltip_fontcolor] --listcolors[slot_bg_normal;slot_bg_hover;slot_border;tooltip_bgcolor;tooltip_fontcolor]
.."listcolors[#88888866;#666666;#CCCCCC;#444444;#FFFFFF]" .."listcolors[#88888866;#666666;#CCCCCC;#444444;#FFFFFF]"
.."label[7.00,3.00;"..minetest.formspec_escape(modMinerTrade.translate("ATM entrance"))..":]" .."label[7.00,3.00;"..core.formspec_escape(modMinerTrade.translate("ATM entrance"))..":]"
.."image[9.00,3.35;2,2;obj_minercoin.png]" .."image[9.00,3.35;2,2;obj_minercoin.png]"
.."image[10.50,3.75;1,1;gui_arrow.png^[transformR270]" .."image[10.50,3.75;1,1;gui_arrow.png^[transformR270]"
.."list[detached:"..minetest.formspec_escape("deposits_"..accountname)..";deposit;11.50,3.75;1,1;]" .."list[detached:"..core.formspec_escape("deposits_"..playername)..";deposit;11.50,3.75;1,1;]"
--.."button[3,2.0;2,1;exchange;"..minetest.formspec_escape(modMinerTrade.translate("DEPOSIT")).."]" --.."button[3,2.0;2,1;exchange;"..core.formspec_escape(modMinerTrade.translate("DEPOSIT")).."]"
.."label[7.00,5.00;"..minetest.formspec_escape(modMinerTrade.translate("Your Inventory"))..":]" .."label[7.00,5.00;"..core.formspec_escape(modMinerTrade.translate("Your Inventory"))..":]"
.."list[current_player;main;7.00,5.50;8,4;]" .."list[current_player;main;7.00,5.50;8,4;]"
minetest.show_formspec(playername, "frmAtmDeposits", formspec) core.show_formspec(playername, "frmAtmDeposits", formspec)
end, end,
frmTransfer = function(playername) --FORMULÁRIO: TRANSFERÊNCIAS frmTransfer = function(playername) --FORMULÁRIO: TRANSFERÊNCIAS
local accountname = modMinerTrade.bank.player[playername].focused_accountname local accountname = modMinerTrade.bank.player[playername].focused_accountname
@ -731,13 +771,13 @@ modMinerTrade.showAccountBank = {
--..default.gui_slots --..default.gui_slots
.. "box[0.00,0.10;5.50,9.5;#000000]" .. "box[0.00,0.10;5.50,9.5;#000000]"
.. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" .. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
.."button_exit[0.25,6.50;5.00,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" .."button_exit[0.25,6.50;5.00,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
.."background[6.0,0.25;9.5,9.5;text_atm_front.png]" .."background[6.0,0.25;9.5,9.5;text_atm_front.png]"
.. "box[6.0,0.25;9.5,9.5;#000000CC]" .. "box[6.0,0.25;9.5,9.5;#000000CC]"
.. "textarea[6.75,1.00;9.0,9.0;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..minetest.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]" .. "textarea[6.75,1.00;9.0,9.0;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("BALANCES")..":"))..";"..core.formspec_escape(core.colorize("#00FFFF", msgBalance)).."]"
if modMinerTrade.isExistAcount(accountname) then if modMinerTrade.isExistAcount(accountname) then
if txtBeneficiary == nil or type(txtBeneficiary) ~= "string" then if txtBeneficiary == nil or type(txtBeneficiary) ~= "string" then
@ -753,41 +793,41 @@ modMinerTrade.showAccountBank = {
msgDetails = modMinerTrade.translate("Write the 'beneficiary player name' and the 'value in minercash' that want to transfer!") msgDetails = modMinerTrade.translate("Write the 'beneficiary player name' and the 'value in minercash' that want to transfer!")
end end
formspec = formspec formspec = formspec
--.. "label[5.25,0.50;"..minetest.formspec_escape(core.colorize("#00FFFF", "WITHDRAWAL IN MINERCASH:")).."]" --.. "label[5.25,0.50;"..core.formspec_escape(core.colorize("#00FFFF", "WITHDRAWAL IN MINERCASH:")).."]"
.."field[7.00,3.50;6.00,0.50;txtBeneficiary;" .."field[7.00,3.50;6.00,0.50;txtBeneficiary;"
..minetest.formspec_escape( ..core.formspec_escape(
core.colorize( core.colorize(
"#00FFFF", "#00FFFF",
modMinerTrade.translate("BENEFICIARY NAME")..":" modMinerTrade.translate("BENEFICIARY NAME")..":"
) )
)..";" )..";"
..minetest.formspec_escape(txtBeneficiary) ..core.formspec_escape(txtBeneficiary)
.."]" .."]"
.."field[7.00,5.00;3.00,0.50;txtValue;" .."field[7.00,5.00;3.00,0.50;txtValue;"
..minetest.formspec_escape( ..core.formspec_escape(
core.colorize( core.colorize(
"#00FFFF", "#00FFFF",
modMinerTrade.translate("VALUE")..":" modMinerTrade.translate("VALUE")..":"
) )
)..";" )..";"
..minetest.formspec_escape(txtValue) ..core.formspec_escape(txtValue)
.."]" .."]"
.."field[7.00,6.50;9.00,0.50;txtReason;" .."field[7.00,6.50;9.00,0.50;txtReason;"
..minetest.formspec_escape( ..core.formspec_escape(
core.colorize( core.colorize(
"#00FFFF", "#00FFFF",
modMinerTrade.translate("REASON OF TRANSFER")..":" modMinerTrade.translate("REASON OF TRANSFER")..":"
) )
)..";" )..";"
..minetest.formspec_escape(txtReason) ..core.formspec_escape(txtReason)
.."]" .."]"
.. "button[9.85,7.50;4.00,1.00;btnAtmTransfer;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("DO TRANSFER"))).."]" .. "button[9.85,7.50;4.00,1.00;btnAtmTransfer;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("DO TRANSFER"))).."]"
.."textarea[6.75,8.50;9.0,1.5;;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("DETAILS")..":"))..";" .."textarea[6.75,8.50;9.0,1.5;;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("DETAILS")..":"))..";"
..minetest.formspec_escape(core.colorize("#00FFFF", msgDetails)) ..core.formspec_escape(core.colorize("#00FFFF", msgDetails))
.."]" .."]"
end end
minetest.show_formspec(playername, "frmAtmTransfer", formspec) core.show_formspec(playername, "frmAtmTransfer", formspec)
end, end,
frmLoanFunctions = function(playername) --FORMULÁRIO: FUNÇÕES DE EMPRESTIMO frmLoanFunctions = function(playername) --FORMULÁRIO: FUNÇÕES DE EMPRESTIMO
local accountname = modMinerTrade.bank.player[playername].focused_accountname local accountname = modMinerTrade.bank.player[playername].focused_accountname
@ -799,28 +839,28 @@ modMinerTrade.showAccountBank = {
--..default.gui_slots --..default.gui_slots
.. "box[0.00,0.10;5.50,9.5;#000000]" .. "box[0.00,0.10;5.50,9.5;#000000]"
.. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]" .. "button[0.25,0.50;5.00,0.5;btnAtmMain;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("BACK"))).."]"
.."button_exit[0.25,6.50;5.00,0.5;;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]" .."button_exit[0.25,6.50;5.00,0.5;;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("EXIT"))).."]"
.."background[6.0,0.25;9.5,9.5;text_atm_front.png]" .."background[6.0,0.25;9.5,9.5;text_atm_front.png]"
.. "box[6.0,0.25;9.5,9.5;#000000CC]" .. "box[6.0,0.25;9.5,9.5;#000000CC]"
.. "label[6.75,0.75;"..minetest.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("LOAN FUNCTIONS")..":")).."]" .. "label[6.75,0.75;"..core.formspec_escape(core.colorize("#00FFFF", modMinerTrade.translate("LOAN FUNCTIONS")..":")).."]"
.. "label[9.25,3.25;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("NEW LOANS AVAILABLE"))).."]" .. "label[9.25,3.25;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("NEW LOANS AVAILABLE"))).."]"
.."tooltip[btnMinercoin;"..minetest.formspec_escape(modMinerTrade.translate("List of all loan offers that you can take advantage of at low cost."))..";#CCCC0088;#000000]" .."tooltip[btnMinercoin;"..core.formspec_escape(modMinerTrade.translate("List of all loan offers that you can take advantage of at low cost."))..";#CCCC0088;#000000]"
.."image_button[7.25,2.50;2.00,2.00;obj_moneysuitcase.png;btnLoansAvailable;]" .."image_button[7.25,2.50;2.00,2.00;obj_moneysuitcase.png;btnLoansAvailable;]"
.. "label[9.25,5.75;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("LOANS WITH PENDING RETURNS"))).."]" .. "label[9.25,5.75;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("LOANS WITH PENDING RETURNS"))).."]"
.."tooltip[btnMinercoin;"..minetest.formspec_escape(modMinerTrade.translate("List of all loans you have taken and that are still pending repayment."))..";#CCCC0088;#000000]" .."tooltip[btnMinercoin;"..core.formspec_escape(modMinerTrade.translate("List of all loans you have taken and that are still pending repayment."))..";#CCCC0088;#000000]"
.."image_button[7.25,5.00;2.00,2.00;obj_credit_card.png;btnLoansPendingReturns;]" .."image_button[7.25,5.00;2.00,2.00;obj_credit_card.png;btnLoansPendingReturns;]"
.. "label[9.25,8.25;"..minetest.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("RULES FOR LOANS"))).."]" .. "label[9.25,8.25;"..core.formspec_escape(core.colorize("#FFFFFF", modMinerTrade.translate("RULES FOR LOANS"))).."]"
.."tooltip[btnMinercoin;"..minetest.formspec_escape(modMinerTrade.translate("List of all rules for you to have access to a loan."))..";#CCCC0088;#000000]" .."tooltip[btnMinercoin;"..core.formspec_escape(modMinerTrade.translate("List of all rules for you to have access to a loan."))..";#CCCC0088;#000000]"
.."image_button[7.25,7.50;2.00,2.00;obj_bank_check.png;btnLoansRules;]" .."image_button[7.25,7.50;2.00,2.00;obj_bank_check.png;btnLoansRules;]"
modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5) modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
minetest.show_formspec(playername, "frmAtmLoanFunctions", formspec) core.show_formspec(playername, "frmAtmLoanFunctions", formspec)
end, end,
} }
@ -866,8 +906,8 @@ end
modMinerTrade.delDetachedInventory = function(playername) modMinerTrade.delDetachedInventory = function(playername)
--core.detached_inventories["safe_"..ownername] = nil --core.detached_inventories["safe_"..ownername] = nil
return minetest.remove_detached_inventory("deposits_"..playername) return core.remove_detached_inventory("deposits_"..playername)
--return minetest.remove_detached_inventory_raw("safe_"..ownername) --return core.remove_detached_inventory_raw("safe_"..ownername)
end end
@ -880,8 +920,8 @@ modMinerTrade.onReceiveFields = function(player, formname, fields)
elseif fields.quit then elseif fields.quit then
--são funções importantíssimas para não perder inventário do jogador e nem calça legging no servidor. --são funções importantíssimas para não perder inventário do jogador e nem calça legging no servidor.
modMinerTrade.doBankSave() modMinerTrade.doBankSave()
local isDeleted = modMinerTrade.delDetachedInventory(playername) --local isDeleted = modMinerTrade.delDetachedInventory(playername)
modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> Database saved and delete detached inventory... Done ["..dump(isDeleted).."]") --modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> Database saved and delete detached inventory... Done ["..dump(isDeleted).."]")
else else
if formname == "frmAtmMain" then if formname == "frmAtmMain" then
if fields.btnBalance ~= nil then if fields.btnBalance ~= nil then
@ -900,12 +940,15 @@ modMinerTrade.onReceiveFields = function(player, formname, fields)
elseif fields.btnLoans ~= nil then elseif fields.btnLoans ~= nil then
modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5) modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
modMinerTrade.showAccountBank.frmLoanFunctions(playername) modMinerTrade.showAccountBank.frmLoanFunctions(playername)
elseif fields.btnPublicAccess ~= nil then
modMinerTrade.showAccountBank.inPublicAccess(playername)
end end
elseif formname == "frmAtmStatement" then elseif formname == "frmAtmStatement" then
--modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> player = "..playername.." | formname = "..formname.." | fields = "..dump(fields)) modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> player = "..playername.." | formname = "..formname.." | fields = "..dump(fields))
if fields.fldStatement ~= nil then if fields.fldStatement ~= nil then
local tblStatement = modMinerTrade.getStatement(playername) local tblStatement = modMinerTrade.getStatement(playername)
local fldStatement = minetest.explode_table_event(fields.fldStatement) local fldStatement = core.explode_table_event(fields.fldStatement)
modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> fldStatement = "..dump(fldStatement))
if fldStatement.row ~= nil and type(fldStatement.row) == "number" and fldStatement.row >= 2 and fldStatement.row <= #tblStatement+1 then if fldStatement.row ~= nil and type(fldStatement.row) == "number" and fldStatement.row >= 2 and fldStatement.row <= #tblStatement+1 then
--modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> fldStatement = "..dump(fldStatement)) --modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> fldStatement = "..dump(fldStatement))
modMinerTrade.showAccountBank.frmStatement(playername, fldStatement.row) modMinerTrade.showAccountBank.frmStatement(playername, fldStatement.row)
@ -930,10 +973,11 @@ modMinerTrade.onReceiveFields = function(player, formname, fields)
and tonumber(fields.txtValue) >= 1 and tonumber(fields.txtValue) >= 1
then then
local myValue = fields.txtValue local myValue = fields.txtValue
if modMinerTrade.isExistAcount(playername) then local accountname = modMinerTrade.bank.player[playername].focused_accountname
local myBalance = modMinerTrade.getBalance(playername) if modMinerTrade.isExistAcount(accountname) then
local myBalance = modMinerTrade.getBalance(accountname)
if tonumber(myValue) <= myBalance then if tonumber(myValue) <= myBalance then
local player = minetest.get_player_by_name(playername) local player = core.get_player_by_name(playername)
if player ~= nil and player:is_player() then if player ~= nil and player:is_player() then
local delivered = 0 local delivered = 0
local items = modMinerTrade.convValueToItemList(tonumber(myValue)) local items = modMinerTrade.convValueToItemList(tonumber(myValue))
@ -983,14 +1027,14 @@ modMinerTrade.onReceiveFields = function(player, formname, fields)
):format(myBalance) ):format(myBalance)
) )
end end
else else --if modMinerTrade.isExistAcount(playername) then
modMinerTrade.doSoundPlayer(playername, "sfx_failure", 5) modMinerTrade.doSoundPlayer(playername, "sfx_failure", 5)
end end
end end
elseif formname == "frmAtmTransfer" then elseif formname == "frmAtmTransfer" then
if fields.btnAtmTransfer ~= nil then if fields.btnAtmTransfer ~= nil then
--modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> player = "..playername.." | formname = "..formname.." | fields = "..dump(fields)) --modMinerTrade.debug("modMinerTrade.onReceiveFields() >>> player = "..playername.." | formname = "..formname.." | fields = "..dump(fields))
local player = minetest.get_player_by_name(playername) local player = core.get_player_by_name(playername)
if player ~= nil and player:is_player() then if player ~= nil and player:is_player() then
local accountname = modMinerTrade.bank.player[playername].focused_accountname local accountname = modMinerTrade.bank.player[playername].focused_accountname
@ -1037,8 +1081,8 @@ modMinerTrade.onReceiveFields = function(player, formname, fields)
modMinerTrade.translate("The '%s' say to '%s': '%s'"):format(playername, txtBeneficiary, txtReason) modMinerTrade.translate("The '%s' say to '%s': '%s'"):format(playername, txtBeneficiary, txtReason)
) )
modMinerTrade.addTransferProof(player, accountname, txtBeneficiary, txtValue, txtReason) --modMinerTrade.addTransferProof_v1(player, accountname, txtBeneficiary, txtValue, txtReason)
modMinerTrade.addTransferProof_v2(player, accountname, txtBeneficiary, txtValue, txtReason)
--modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5) --modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
--modMinerTrade.showAccountBank.frmTransfer(playername, txtBeneficiary, txtValue, txtReason, msgDetails) --FORMULÁRIO: SAQUE --modMinerTrade.showAccountBank.frmTransfer(playername, txtBeneficiary, txtValue, txtReason, msgDetails) --FORMULÁRIO: SAQUE
@ -1087,11 +1131,11 @@ end
--############################################################################################################### --###############################################################################################################
minetest.register_node("minertrade:atm", { core.register_node("minertrade:atm", {
description = core.colorize("#00FF00", description = core.colorize("#00FF00",
modMinerTrade.translate("PUBLIC ATM") modMinerTrade.translate("PUBLIC ATM")
).."\n\t* "..modMinerTrade.translate("Deposit and Withdraw your minercash into your bank account."), ).."\n\t* "..modMinerTrade.translate("Deposit and Withdraw your minercash into your bank account."),
--inventory_image = minetest.inventorycube("text_atm_front_1.png"), --inventory_image = core.inventorycube("text_atm_front_1.png"),
--inventory_image = "text_atm_front_1.png", --inventory_image = "text_atm_front_1.png",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
@ -1140,27 +1184,27 @@ minetest.register_node("minertrade:atm", {
local posAbove = pointed_thing.above --acima local posAbove = pointed_thing.above --acima
local posUnder = pointed_thing.under --abaixo local posUnder = pointed_thing.under --abaixo
if not placer or not placer:is_player() or if not placer or not placer:is_player() or
not minetest.registered_nodes[minetest.get_node(posAbove).name].buildable_to not core.registered_nodes[core.get_node(posAbove).name].buildable_to
then --Verifica se pode construir sobre os objetos construiveis then --Verifica se pode construir sobre os objetos construiveis
return itemstack return itemstack
end end
local nodeUnder = minetest.get_node(posUnder) local nodeUnder = core.get_node(posUnder)
if minetest.registered_nodes[nodeUnder.name].on_rightclick then --Verifica se o itema na mao do jogador tem funcao rightclick if core.registered_nodes[nodeUnder.name].on_rightclick then --Verifica se o itema na mao do jogador tem funcao rightclick
return minetest.registered_nodes[nodeUnder.name].on_rightclick(posUnder, nodeUnder, placer, itemstack) return core.registered_nodes[nodeUnder.name].on_rightclick(posUnder, nodeUnder, placer, itemstack)
end end
if if
modMinerTrade.canInteract(playername) modMinerTrade.canInteract(playername)
or modMinerTrade.getNodesInRange(posAbove, 5, "minertrade:dispensingmachine") >= 1 or modMinerTrade.getNodesInRange(posAbove, 5, "minertrade:dispensingmachine") >= 1
then then
local facedir = minetest.dir_to_facedir(placer:get_look_dir()) local facedir = core.dir_to_facedir(placer:get_look_dir())
--minetest.chat_send_player(playername, "[ATM] aaaaaa") --core.chat_send_player(playername, "[ATM] aaaaaa")
minetest.set_node(posAbove, { core.set_node(posAbove, {
name = "minertrade:atm", name = "minertrade:atm",
param2 = facedir, param2 = facedir,
}) })
local meta = minetest.get_meta(posAbove) local meta = core.get_meta(posAbove)
meta:set_string("infotext", meta:set_string("infotext",
--[[ --[[
modMinerTrade.translate( modMinerTrade.translate(
@ -1179,7 +1223,7 @@ minetest.register_node("minertrade:atm", {
end end
itemstack:take_item() -- itemstack:take_item() = Ok itemstack:take_item() -- itemstack:take_item() = Ok
else else
minetest.chat_send_player(playername, core.chat_send_player(playername,
core.colorize("#00ff00", "["..modMinerTrade.translate("ATM").."]: ") core.colorize("#00ff00", "["..modMinerTrade.translate("ATM").."]: ")
..modMinerTrade.translate("You can not install this 'ATM' too far from a 'Dispensing Machine'!") ..modMinerTrade.translate("You can not install this 'ATM' too far from a 'Dispensing Machine'!")
) )
@ -1191,7 +1235,7 @@ minetest.register_node("minertrade:atm", {
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
local clickername = clicker:get_player_name() local clickername = clicker:get_player_name()
local meta = minetest.get_meta(pos) local meta = core.get_meta(pos)
--meta:set_string("infotext", modMinerTrade.translate("PUBLIC ATM\n* Save your money in the ATM, and withdraw your money in your Personal Safe or other ATM in the shops scattered around the map.")) --meta:set_string("infotext", modMinerTrade.translate("PUBLIC ATM\n* Save your money in the ATM, and withdraw your money in your Personal Safe or other ATM in the shops scattered around the map."))
local opentime = tonumber(meta:get_string("opentime")) or 0 local opentime = tonumber(meta:get_string("opentime")) or 0
local now = os.time() --Em milisegundos local now = os.time() --Em milisegundos
@ -1208,9 +1252,9 @@ minetest.register_node("minertrade:atm", {
--modMinerTrade.showAccountBank.frmMain(clickername) --modMinerTrade.showAccountBank.frmMain(clickername)
modMinerTrade.showAccountBank.inAtm(clickername, clickername) modMinerTrade.showAccountBank.inAtm(clickername, clickername)
else else
--minetest.sound_play("sfx_failure", {object=clicker, max_hear_distance=5.0,}) --core.sound_play("sfx_failure", {object=clicker, max_hear_distance=5.0,})
modMinerTrade.doSoundPlayer(clickername, "sfx_failure", 5) modMinerTrade.doSoundPlayer(clickername, "sfx_failure", 5)
minetest.chat_send_player(clickername, core.chat_send_player(clickername,
core.colorize("#00ff00", "["..modMinerTrade.translate("ATM").."]: ") core.colorize("#00ff00", "["..modMinerTrade.translate("ATM").."]: ")
..modMinerTrade.translate( ..modMinerTrade.translate(
"The ATM will only run %02d seconds after it is installed!" "The ATM will only run %02d seconds after it is installed!"
@ -1222,7 +1266,7 @@ minetest.register_node("minertrade:atm", {
}) })
--[[ --]] --[[ --]]
minetest.register_craft({ core.register_craft({
output = 'minertrade:atm', output = 'minertrade:atm',
recipe = { recipe = {
{"default:steel_ingot" ,"default:steel_ingot" ,"default:steel_ingot"}, {"default:steel_ingot" ,"default:steel_ingot" ,"default:steel_ingot"},
@ -1231,24 +1275,24 @@ minetest.register_craft({
} }
}) })
--]] --]]
minetest.register_alias("atm","minertrade:atm") core.register_alias("atm","minertrade:atm")
minetest.register_alias(modMinerTrade.translate("atm"),"minertrade:atm") core.register_alias(modMinerTrade.translate("atm"),"minertrade:atm")
minetest.register_on_player_receive_fields(function(sender, formname, fields) core.register_on_player_receive_fields(function(sender, formname, fields)
return modMinerTrade.onReceiveFields(sender, formname, fields) return modMinerTrade.onReceiveFields(sender, formname, fields)
end) end)
minetest.register_on_joinplayer(function(player) core.register_on_joinplayer(function(player)
local playername = player:get_player_name() local playername = player:get_player_name()
if not modMinerTrade.isExistAcount(playername) then if not modMinerTrade.isExistAcount(playername) then
modMinerTrade.createAcount(playername) modMinerTrade.createAcount(playername)
end end
end) end)
minetest.register_on_leaveplayer(function(player) core.register_on_leaveplayer(function(player)
modMinerTrade.doBankSave() modMinerTrade.doBankSave()
end) end)
minetest.register_on_shutdown(function() core.register_on_shutdown(function()
modMinerTrade.doBankSave() modMinerTrade.doBankSave()
end) end)

24
item_computing_app.lua Normal file
View file

@ -0,0 +1,24 @@
if core.global_exists("modComputing") then
modComputing.add_app("minertrade:btnWebBank", {
icon_name = "btnWebBank",
icon_title = modMinerTrade.translate("WEB BANK"),
icon_descryption = modMinerTrade.translate("Allows you to access the bank account anywhere in the world."),
icon_type = "button", --types: button/button_exit
icon_image = "obj_credit_card.png",
on_iconclick = function(player)
local playername = player:get_player_name()
core.log(
"action","["..modMinerTrade.modName:upper().."] "
..modMinerTrade.translate(
"Player '@1' is trying to access the '@2' via the '@3'!"
, playername
, "bank account"
, "computing app"
)
)
modMinerTrade.showAccountBank.inCreditCard(playername, playername)
end,
})
end

View file

@ -4,9 +4,9 @@ modMinerTrade.dispensing = {
modMinerTrade.dispensing.formspec = { modMinerTrade.dispensing.formspec = {
customer = function(pos) customer = function(pos)
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
local formspec = "size[8,10.5]" local formspec = "size[8,10.25]"
--.."bgcolor[#00880033;false]" --.."bgcolor[#00880033;false]"
.."background[-0.25,-0.25;8.50,11.50;dispensador_traz.png]" .."background[-0.25,-0.25;8.50,11.00;dispensador_traz.png]"
--listcolors[slot_bg_normal;slot_bg_hover;slot_border;tooltip_bgcolor;tooltip_fontcolor] --listcolors[slot_bg_normal;slot_bg_hover;slot_border;tooltip_bgcolor;tooltip_fontcolor]
.."listcolors[#004400EE;#008800;#00FF00;#CCCC00;#FFFFFF]" .."listcolors[#004400EE;#008800;#00FF00;#CCCC00;#FFFFFF]"
@ -20,17 +20,17 @@ modMinerTrade.dispensing.formspec = {
.."list[current_player;customer_gets;0,4.0;3,2;]" .."list[current_player;customer_gets;0,4.0;3,2;]"
.."button[3,2.0;2,1;exchange;"..minetest.formspec_escape(modMinerTrade.translate("ACCEPT")).."]" .."button[3,2.0;2,1;exchange;"..minetest.formspec_escape(modMinerTrade.translate("ACCEPT")).."]"
.."button[3,3.0;2,1;btnRefill;"..minetest.formspec_escape(modMinerTrade.translate("REFILL")).."]"
.."label[0,6.0;"..minetest.formspec_escape(modMinerTrade.translate("Current customer inventory"))..":]" .."label[0,6.0;"..minetest.formspec_escape(modMinerTrade.translate("Current customer inventory"))..":]"
.."list[current_player;main;0,6.5;8,4;]" .."list[current_player;main;0,6.5;8,4;]"
.."label[5,1.0;"..minetest.formspec_escape(modMinerTrade.translate("The Machine Need"))..":]" .."label[5,1.0;"..minetest.formspec_escape(modMinerTrade.translate("The Machine Need"))..":]"
.."list["..list_name..";owner_wants;5,1.5;3,2;]" .."list["..list_name..";owner_wants;5,1.5;3,2;]"
.."label[5,3.5;"..minetest.formspec_escape(modMinerTrade.translate("The Machine Offer"))..":]" .."label[5,3.5;"..minetest.formspec_escape(modMinerTrade.translate("The Machine Offer"))..":]"
.."list["..list_name..";owner_gives;5,4.0;3,2;]" .."list["..list_name..";owner_gives;5,4.0;3,2;]"
--.."label[0,10.75;("..minetest.formspec_escape(modMinerTrade.translate("Ctrl + RMB → Owner Interface"))..")]"
--.."listcolors[#00000000;#00000022;#00000000;#00000033;#FFFFFFFF]" --.."listcolors[#00000000;#00000022;#00000000;#00000033;#FFFFFFFF]"
--.."listcolors[#00000000;#00000033]" --.."listcolors[#00000000;#00000033]"
@ -39,9 +39,9 @@ modMinerTrade.dispensing.formspec = {
end, end,
owner = function(pos) owner = function(pos)
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
local formspec = "size[8,11]" local formspec = "size[8,10.50]"
--.."bgcolor[#00880033;false]" --.."bgcolor[#00880033;false]"
.."background[-0.25,-0.25;8.50,11.50;dispensador_traz.png]" .."background[-0.25,-0.25;8.50,11.25;dispensador_traz.png]"
--listcolors[slot_bg_normal;slot_bg_hover;slot_border;tooltip_bgcolor;tooltip_fontcolor] --listcolors[slot_bg_normal;slot_bg_hover;slot_border;tooltip_bgcolor;tooltip_fontcolor]
.."listcolors[#004400EE;#008800;#00FF00;#CCCC00;#FFFFFF]" .."listcolors[#004400EE;#008800;#00FF00;#CCCC00;#FFFFFF]"
.."label[0,0;"..minetest.formspec_escape(modMinerTrade.translate("Received (Your Profit)"))..":]" .."label[0,0;"..minetest.formspec_escape(modMinerTrade.translate("Received (Your Profit)"))..":]"
@ -63,7 +63,7 @@ modMinerTrade.dispensing.formspec = {
.."tooltip[btnSaveText;"..minetest.formspec_escape(modMinerTrade.translate("Save The Announcement"))..";#CCCC00;#000000]" .."tooltip[btnSaveText;"..minetest.formspec_escape(modMinerTrade.translate("Save The Announcement"))..";#CCCC00;#000000]"
.."label[0,6.25;"..minetest.formspec_escape(modMinerTrade.translate("Seller current inventory"))..":]" .."label[0,6.25;"..minetest.formspec_escape(modMinerTrade.translate("Seller current inventory"))..":]"
.."list[current_player;main;0,6.75.0;8,4;]" .."list[current_player;main;0,6.75.0;8,4;]"
.."label[0,10.75;("..minetest.formspec_escape(modMinerTrade.translate("Ctrl + Right Click Mouse → Customer Interface"))..")]" --.."label[0,10.75;("..minetest.formspec_escape(modMinerTrade.translate("Ctrl + RMB → Customer Interface"))..")]"
return formspec return formspec
end, end,
} }
@ -107,6 +107,7 @@ modMinerTrade.dispensing.canOpen = function(pos, playername)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if if
meta:get_string("owner")==playername meta:get_string("owner")==playername
or minetest.get_player_privs(playername).protection_bypass
or ( or (
minetest.get_modpath("tradelands") minetest.get_modpath("tradelands")
and modTradeLands.getOwnerName(pos)~="" and modTradeLands.getOwnerName(pos)~=""
@ -124,7 +125,11 @@ end
local box_format = { local box_format = {
type = "fixed", type = "fixed",
fixed = { {-.5,-.5,-.3125, .5,.5+1/3,.3125} } fixed = {
--{-.5,-.5,-.3125, .5,.5+1/3,.3125},
{-.5,-.1875,-.3250, .5, .5000,.3000},
{-.5,-.5000,-.3000, .5,-.1875,.3000},
}
} }
minetest.register_node("minertrade:dispensingmachine", { minetest.register_node("minertrade:dispensingmachine", {
@ -169,11 +174,14 @@ minetest.register_node("minertrade:dispensingmachine", {
modMinerTrade.dispensing.loja_atual[clicker:get_player_name()] = pos modMinerTrade.dispensing.loja_atual[clicker:get_player_name()] = pos
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local clickername = clicker:get_player_name() local clickername = clicker:get_player_name()
minetest.show_formspec(clickername,"modMinerTrade.balcaodeloja_formspec",modMinerTrade.dispensing.formspec.customer(pos))
--[[
if modMinerTrade.dispensing.canOpen(pos, clickername) and not clicker:get_player_control().aux1 then if modMinerTrade.dispensing.canOpen(pos, clickername) and not clicker:get_player_control().aux1 then
minetest.show_formspec(clickername,"modMinerTrade.balcaodeloja_formspec",modMinerTrade.dispensing.formspec.owner(pos)) minetest.show_formspec(clickername,"modMinerTrade.balcaodeloja_formspec",modMinerTrade.dispensing.formspec.owner(pos))
else else
minetest.show_formspec(clickername,"modMinerTrade.balcaodeloja_formspec",modMinerTrade.dispensing.formspec.customer(pos)) minetest.show_formspec(clickername,"modMinerTrade.balcaodeloja_formspec",modMinerTrade.dispensing.formspec.customer(pos))
end end
--]]
--return itemstack --return itemstack
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
@ -219,14 +227,28 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields)
--minetest.chat_send_player(sendername,"ownername('"..ownername.."') == sendername('"..sendername.."')") --minetest.chat_send_player(sendername,"ownername('"..ownername.."') == sendername('"..sendername.."')")
if fields.btnRefill then
if modMinerTrade.dispensing.canOpen(pos, sendername) then
minetest.show_formspec(sendername,"modMinerTrade.balcaodeloja_formspec",modMinerTrade.dispensing.formspec.owner(pos))
else
minetest.chat_send_player(sendername,
core.colorize("#ff0000", "["..modMinerTrade.translate("DISPENSING MACHINE").."]: ")
..modMinerTrade.translate("You cannot fill the dispensing machine if you are not the owner!")
)
minetest.sound_play("sfx_alert", {object=sender, max_hear_distance=5.0,})
end
return
end
if modMinerTrade.dispensing.canOpen(pos, sendername) and sender:get_player_control().aux1 then if modMinerTrade.dispensing.canOpen(pos, sendername) and sender:get_player_control().aux1 then
minetest.chat_send_player(sendername, minetest.chat_send_player(sendername,
core.colorize("#00ff00", "["..modMinerTrade.translate("DISPENSING MACHINE").."]: ") core.colorize("#ff0000", "["..modMinerTrade.translate("DISPENSING MACHINE").."]: ")
..modMinerTrade.translate("You can not change your own machine!") ..modMinerTrade.translate("You can not change your own machine!")
) )
minetest.sound_play("sfx_alert", {object=sender, max_hear_distance=5.0,}) minetest.sound_play("sfx_alert", {object=sender, max_hear_distance=5.0,})
return return
else else
--minetest.chat_send_player(sendername,"fields="..dump(fields)) --minetest.chat_send_player(sendername,"fields="..dump(fields))
if fields.txtOffer ~= nil then if fields.txtOffer ~= nil then
if fields.txtOffer ~= "" then if fields.txtOffer ~= "" then

View file

@ -273,61 +273,13 @@ minetest.register_alias(
minetest.register_craftitem("minertrade:creditcard", { minetest.register_craftitem("minertrade:creditcard", {
description = core.colorize("#00FF00", description = core.colorize("#00FF00",
modMinerTrade.translate("CREDIT CARD") modMinerTrade.translate("CREDIT CARD")
).."\n\t* "..modMinerTrade.translate("Allows you to access the bank account of the credit card owner anywhere in the world."), ).."\n\t* "..modMinerTrade.translate("Allows you to access the bank account anywhere in the world."),
inventory_image = "obj_credit_card.png", inventory_image = "obj_credit_card.png",
--stack_max=9, --Acumula 9 por slot --stack_max=9, --Acumula 9 por slot
groups = {cash=0, trade=1}, groups = {cash=0, trade=1},
on_use = function(itemstack, player) on_use = function(itemstack, player)
--[[
modMinerTrade.showInventory(
clicker,
clickername,
modMinerTrade.translate("PUBLIC ATM - Account of '%s':"):format(clickername)
)
--]]
local playername = player:get_player_name() local playername = player:get_player_name()
--modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
--modMinerTrade.showAtm.frmMain(playername)
modMinerTrade.showAccountBank.inCreditCard(playername, playername) modMinerTrade.showAccountBank.inCreditCard(playername, playername)
--[[
local playername = player:get_player_name()
local meta = itemstack:get_meta()
local old_data = minetest.deserialize(itemstack:get_metadata())
if old_data then
meta:from_table({ fields = old_data })
end
local tmpDatabase = meta:to_table().fields
if type(tmpDatabase.ownername)~="string" or tmpDatabase.ownername=="" then
tmpDatabase.ownername = playername
tmpDatabase.description = modMinerTrade.translate("CREDIT CARD of '%s'"):format(tmpDatabase.ownername)
local invPlayer = player:get_inventory()
local new_stack
local count = itemstack:get_count()
itemstack:set_count(count - 1)
new_stack = ItemStack("minertrade:creditcard")
new_stack:get_meta():from_table({ fields = tmpDatabase })
if invPlayer:room_for_item("main", new_stack) then
invPlayer:add_item("main", new_stack)
else
minetest.add_item(player:get_pos(), new_stack)
end
minetest.chat_send_player(playername,
core.colorize("#00FF00", "["..modMinerTrade.translate("CREDIT CARD").."]: ")
..modMinerTrade.translate("Your name has been saved to this credit card. Anyone using this credit card will be able to access the '%s' bank account."):format(tmpDatabase.ownername)
)
minetest.sound_play("sfx_alert", {object=player, max_hear_distance=5.0,})
return itemstack
end
modMinerTrade.showInventory(
player,
tmpDatabase.ownername,
modMinerTrade.translate("ACCOUNT BANK of '%s':"):format(tmpDatabase.ownername)
)
return itemstack
--]]
end, end,
}) })

View file

@ -69,12 +69,12 @@ modMinerTrade.showPaperPrinted = function(playername, text)
myFormSpec = myFormSpec myFormSpec = myFormSpec
--.."formspec_version[5.6.0]" --.."formspec_version[5.6.0]"
.."formspec_version[6]" .."formspec_version[6]"
.."size[16,8,true]" .."size[11,11,true]"
.."no_prepend[]" .."no_prepend[]"
.."bgcolor[#08080844;true]" --Padrão: #080808BB .."bgcolor[#08080844;true]" --Padrão: #080808BB
.."background[0,0;16,8;bgf_scroll.png]" .."background[0,0;11,11;bgf_scroll.png]"
--.."vertlabel[15.75,0.5;"..minetest.formspec_escape(modMinerTrade.translate("PRINTED PAPER")).."]" --.."vertlabel[15.75,0.5;"..minetest.formspec_escape(modMinerTrade.translate("PRINTED PAPER")).."]"
.."hypertext[1.75,1.5;12.75,4.75;myPage;" .."hypertext[1.00,1.00;9.25,7.50;myPage;"
--..minetest.formspec_escape("<global margin=10 valign=0 color=#FF00FF hovercolor=#00FFFF size=12 font=normal halign=center >") --..minetest.formspec_escape("<global margin=10 valign=0 color=#FF00FF hovercolor=#00FFFF size=12 font=normal halign=center >")
.."<global valign=middle halign=left margin=10 background=#FFFFFF00 color=#000000 hovercolor=#00FF00 size=12 font=normal>" .."<global valign=middle halign=left margin=10 background=#FFFFFF00 color=#000000 hovercolor=#00FF00 size=12 font=normal>"
.."<tag name=action color=#FF0000 hovercolor=#00FF00 font=normal size=12>" .."<tag name=action color=#FF0000 hovercolor=#00FF00 font=normal size=12>"

92
mod.cdb.json Normal file
View file

@ -0,0 +1,92 @@
{
"name": "minertrade",
"title": "Minertrade",
"type": "MOD",
"version": "v2.3.1",
"dev_state":"ALPHA",
"min_minetest_version": "5.7",
"max_minetest_version": null,
/*
"author": [
"Lunovox Heavenfinder: [email](mailto:lunovox@disroot.org), [social web](http:qoto.org/@lunovox), [webchat](https://cloud.disroot.org/call/9aa2t7ib), [xmpp](xmpp:lunovox@disroot.org?join), [Mumble](mumble:mumble.disroot.org), [more contacts](https:libreplanet.org/wiki/User:Lunovox)",
],
/**/
"authors": [
{
"name": "Lunovox Heavenfinder",
"email": "lunovox@disroot.org",
"social web": "http:qoto.org/@lunovox",
"webchat": "https://cloud.disroot.org/call/9aa2t7ib",
"xmpp": "xmpp:lunovox@disroot.org?join",
"mumble": "mumble:mumble.disroot.org",
"homepage": "https://libreplanet.org/wiki/User:Lunovox",
"more contacts": "https://libreplanet.org/wiki/User:Lunovox",
},
],
"tags": [
"Commerce / Economy",
"Multiplayer-focused",
"Crafting",
"Beta",
],
"keywords": [
"lunovox",
"trade",
"Commerce",
"Economy",
"protection",
"Multiplayer",
],
"languages": [
"en",
"pt",
"pt_BR",
],
"supported_games": [
"minetest_game",
],
"dependencies":
{
"default": "https://content.minetest.net/packages/Minetest/minetest_game/",
"dye": "https://content.minetest.net/packages/Minetest/minetest_game/",
},
"optional_dependencies":
{
"intllib": "https://content.minetest.net/packages/kaeza/intllib/",
"correio": "https://gitlab.com/lunovox/correio",
"eurn": "https://gitlab.com/lunovox/e-urn",
"computing": "https://gitlab.com/lunovox/computing",
},
"license": {
"is_foss":true,
"name":"GNU AGPL-3.0 or later",
"url": "https://gitlab.com/lunovox/minertrade/-/raw/master/LICENSE_CODE",
},
"media_license": {
"is_foss":false,
"name":"CC BY-SA 4.0"
"url":"https://gitlab.com/lunovox/minertrade/-/blob/master/LICENSE_MEDIA",
},
"screenshots": [
"https://gitlab.com/lunovox/minertrade/-/raw/master/screenshot.png",
],
"website": null,
"forums": null,
"video_url": null,
"donate_url": "https://liberapay.com/Lunovox/donate",
"translation_url": "https://gitlab.com/lunovox/minertrade/-/blob/master/locale/README.md",
"repo": "https://gitlab.com/lunovox/minertrade.git",
"ignore": [
".git",
"*.~",
"*.old",
"*.bkp",
"*.backup",
"*.mo",
"*.diff",
"*.patch",
],
"issue_tracker": "https://gitlab.com/lunovox/minertrade/-/issues",
"short_description":"It adds various types of money, exchange table, Dispensing Machines, ATMs in stores.",
"long_description": null,
}

View file

@ -1,9 +1,20 @@
# suggestion over this file: http://dev.minetest.net/Modding_Intro # suggestion over this file: http://dev.minetest.net/Modding_Intro
name = minertrade name = minertrade
description = It adds various types of money, exchange table, Dispensing Machines, Strongbox in homes interconnected with ATMs in stores.
author = Lunovox Heavenfinder
title = Minertrade title = Minertrade
description = It adds various types of money, exchange table, Dispensing Machines, ATMs in stores.
version = 2.3.1
dev_state = BETA
license = GNU AGPL-3.0
media_license = CC BY-SA 4.0
supported_games = minetest_game
depends = default,dye depends = default,dye
optional_depends = intllib,correio optional_depends = intllib,correio,eurn,computing
min_minetest_version = 5.7
max_minetest_version =
author = Lunovox Heavenfinder: [email](mailto:lunovox@disroot.org), [social web](http:qoto.org/@lunovox), [webchat](https://cloud.disroot.org/call/9aa2t7ib), [xmpp](xmpp:lunovox@disroot.org?join), [Mumble](mumble:mumble.disroot.org), [more contacts](https:libreplanet.org/wiki/User:Lunovox)
created = 2017-03-13 00:00
update = 2024-11-25 07:42
donate_url = https://liberapay.com/Lunovox/donate
translation_url = https://gitlab.com/lunovox/minertrade/-/blob/master/locale/README.md
repository = https://gitlab.com/lunovox/minertrade

BIN
screenshot9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
textures/bgf_scroll.xcf Normal file

Binary file not shown.