Initial import
This commit is contained in:
commit
d8ce83bcf2
674
LICENSE
Normal file
674
LICENSE
Normal file
@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
33
README.md
Normal file
33
README.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
<h2>Système <em>Cthulhu Tenebris</em> pour Foundry Virtual TableTop</h2>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>Ceci est une application qui permet de jouer au jeu de rôle "<em>Cthulhu Tenebris</em>" sur la plateforme de jeu Foundry Virtual Tabletop.</p>
|
||||||
|
|
||||||
|
<h2>Disclaimer</h2>
|
||||||
|
<p>"<em>Cthulhu Tenebris</em>" est un jeu de rôle conçu par Les XII Singes.</p>
|
||||||
|
|
||||||
|
<p>Toutes les marques, logo et illustrations utilisés sont la propriété de ReSpell SAS et utilisés avec autorisation.</p>
|
||||||
|
|
||||||
|
<h2>Contributeurs</h2>
|
||||||
|
<p>Ce système est développé par Kristov, et publié avec l'accord des auteurs et ayants droits.</p>
|
||||||
|
<p>La bannière, le tour de token, et l'adaptation des dés en mode Cthulhu Tenebris sombre et Cthulhu Tenebris clair ont été mis à disposition gracieusement par Pretre</p>
|
||||||
|
|
||||||
|
<h2>Communauté</h2>
|
||||||
|
|
||||||
|
<p>Rejoignez-nous sur le serveur <a href="https://discord.com/invite/pPSDNJk">Discord francophone dédié à Foundry Virtual Tabletop</a><br />
|
||||||
|
Nous serons ravis d'y avoir vos retours sur le système, des signalements de bug, des idées d'amélioration, ou simplement des encouragements !</p>
|
||||||
|
|
||||||
|
<h2>Licences</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Le code HTML, CSS et Javascript de ce projet est placé sous <a href="https://choosealicense.com/licenses/gpl-3.0/">licence GNU General Public License v3.0</a></li>
|
||||||
|
|
||||||
|
<li>Foundry VTT support is covered by the following license: <a href="https://foundryvtt.com/article/license/">Limited License Agreement for module development 17/02/2021</a>.</li>
|
||||||
|
</ul>
|
11067
assets/LFG LONG 1 color.ai
Normal file
11067
assets/LFG LONG 1 color.ai
Normal file
File diff suppressed because one or more lines are too long
11184
assets/LFG LONG.ai
Normal file
11184
assets/LFG LONG.ai
Normal file
File diff suppressed because one or more lines are too long
11011
assets/LFG icon 1 color 2.ai
Normal file
11011
assets/LFG icon 1 color 2.ai
Normal file
File diff suppressed because one or more lines are too long
11816
assets/LFG short.ai
Normal file
11816
assets/LFG short.ai
Normal file
File diff suppressed because one or more lines are too long
BIN
assets/LFG_LONG_page_1.jpg
Normal file
BIN
assets/LFG_LONG_page_1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 273 KiB |
BIN
assets/LFG_short_1_page_1.jpg
Normal file
BIN
assets/LFG_short_1_page_1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 244 KiB |
67349
assets/LF_Banner_Final.ai
Normal file
67349
assets/LF_Banner_Final.ai
Normal file
File diff suppressed because one or more lines are too long
BIN
assets/LethalFantasyLogo_Yellow.jpg
Normal file
BIN
assets/LethalFantasyLogo_Yellow.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 818 KiB |
BIN
assets/image0.jpg
Normal file
BIN
assets/image0.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 409 KiB |
1195
css/lethal-fantasy.css
Normal file
1195
css/lethal-fantasy.css
Normal file
File diff suppressed because it is too large
Load Diff
228
eslint.config.mjs
Normal file
228
eslint.config.mjs
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
import jsdoc from 'eslint-plugin-jsdoc';
|
||||||
|
import prettier from 'eslint-plugin-prettier';
|
||||||
|
import configPrettier from 'eslint-config-prettier';
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
"node_modules/",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
"build.mjs",
|
||||||
|
"gulpfile.js"
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
browser: true,
|
||||||
|
es2022: true,
|
||||||
|
node: true,
|
||||||
|
jquery: true,
|
||||||
|
},
|
||||||
|
ecmaVersion: 2022,
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
jsdoc,
|
||||||
|
prettier
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
'array-bracket-spacing': ['warn', 'never'],
|
||||||
|
'array-callback-return': 'warn',
|
||||||
|
'arrow-spacing': 'warn',
|
||||||
|
'comma-dangle': ['warn', 'never'],
|
||||||
|
'comma-style': 'warn',
|
||||||
|
'computed-property-spacing': 'warn',
|
||||||
|
'constructor-super': 'error',
|
||||||
|
'default-param-last': 'warn',
|
||||||
|
'dot-location': ['warn', 'property'],
|
||||||
|
'eol-last': ['error', 'always'],
|
||||||
|
'eqeqeq': ['warn', 'smart'],
|
||||||
|
'func-call-spacing': 'warn',
|
||||||
|
'func-names': ['warn', 'never'],
|
||||||
|
'getter-return': 'warn',
|
||||||
|
'lines-between-class-members': 'warn',
|
||||||
|
'new-parens': ['warn', 'always'],
|
||||||
|
'no-alert': 'warn',
|
||||||
|
'no-array-constructor': 'warn',
|
||||||
|
'no-class-assign': 'warn',
|
||||||
|
'no-compare-neg-zero': 'warn',
|
||||||
|
'no-cond-assign': 'warn',
|
||||||
|
'no-const-assign': 'error',
|
||||||
|
'no-constant-condition': 'warn',
|
||||||
|
'no-constructor-return': 'warn',
|
||||||
|
'no-delete-var': 'warn',
|
||||||
|
'no-dupe-args': 'warn',
|
||||||
|
'no-dupe-class-members': 'warn',
|
||||||
|
'no-dupe-keys': 'warn',
|
||||||
|
'no-duplicate-case': 'warn',
|
||||||
|
'no-duplicate-imports': ['warn', { includeExports: true }],
|
||||||
|
'no-empty': ['warn', { allowEmptyCatch: true }],
|
||||||
|
'no-empty-character-class': 'warn',
|
||||||
|
'no-empty-pattern': 'warn',
|
||||||
|
'no-func-assign': 'warn',
|
||||||
|
'no-global-assign': 'warn',
|
||||||
|
'no-implicit-coercion': ['warn', { allow: ['!!'] }],
|
||||||
|
'no-implied-eval': 'warn',
|
||||||
|
'no-import-assign': 'warn',
|
||||||
|
'no-invalid-regexp': 'warn',
|
||||||
|
'no-irregular-whitespace': 'warn',
|
||||||
|
'no-iterator': 'warn',
|
||||||
|
'no-lone-blocks': 'warn',
|
||||||
|
'no-lonely-if': 'off',
|
||||||
|
'no-loop-func': 'warn',
|
||||||
|
'no-misleading-character-class': 'warn',
|
||||||
|
'no-mixed-operators': 'warn',
|
||||||
|
'no-multi-str': 'warn',
|
||||||
|
'no-multiple-empty-lines': 'warn',
|
||||||
|
'no-new-func': 'warn',
|
||||||
|
'no-new-object': 'warn',
|
||||||
|
'no-new-symbol': 'warn',
|
||||||
|
'no-new-wrappers': 'warn',
|
||||||
|
'no-nonoctal-decimal-escape': 'warn',
|
||||||
|
'no-obj-calls': 'warn',
|
||||||
|
'no-octal': 'warn',
|
||||||
|
'no-octal-escape': 'warn',
|
||||||
|
'no-promise-executor-return': 'warn',
|
||||||
|
'no-proto': 'warn',
|
||||||
|
'no-regex-spaces': 'warn',
|
||||||
|
'no-script-url': 'warn',
|
||||||
|
'no-self-assign': 'warn',
|
||||||
|
'no-self-compare': 'warn',
|
||||||
|
'no-setter-return': 'warn',
|
||||||
|
'no-sequences': 'warn',
|
||||||
|
'no-template-curly-in-string': 'warn',
|
||||||
|
'no-this-before-super': 'error',
|
||||||
|
'no-unexpected-multiline': 'warn',
|
||||||
|
'no-unmodified-loop-condition': 'warn',
|
||||||
|
'no-unneeded-ternary': 'warn',
|
||||||
|
'no-unreachable': 'warn',
|
||||||
|
'no-unreachable-loop': 'warn',
|
||||||
|
'no-unsafe-negation': ['warn', { enforceForOrderingRelations: true }],
|
||||||
|
'no-unsafe-optional-chaining': ['warn', { disallowArithmeticOperators: true }],
|
||||||
|
'no-unused-expressions': 'warn',
|
||||||
|
'no-useless-backreference': 'warn',
|
||||||
|
'no-useless-call': 'warn',
|
||||||
|
'no-useless-catch': 'warn',
|
||||||
|
'no-useless-computed-key': ['warn', { enforceForClassMembers: true }],
|
||||||
|
'no-useless-concat': 'warn',
|
||||||
|
'no-useless-constructor': 'warn',
|
||||||
|
'no-useless-rename': 'warn',
|
||||||
|
'no-useless-return': 'warn',
|
||||||
|
'no-var': 'warn',
|
||||||
|
'no-void': 'warn',
|
||||||
|
'no-whitespace-before-property': 'warn',
|
||||||
|
'prefer-numeric-literals': 'warn',
|
||||||
|
'prefer-object-spread': 'warn',
|
||||||
|
'prefer-regex-literals': 'warn',
|
||||||
|
'prefer-spread': 'warn',
|
||||||
|
'rest-spread-spacing': ['warn', 'never'],
|
||||||
|
'semi-spacing': 'warn',
|
||||||
|
'semi-style': ['warn', 'last'],
|
||||||
|
'space-unary-ops': ['warn', { words: true, nonwords: false }],
|
||||||
|
'switch-colon-spacing': 'warn',
|
||||||
|
'symbol-description': 'warn',
|
||||||
|
'template-curly-spacing': ['warn', 'never'],
|
||||||
|
'unicode-bom': ['warn', 'never'],
|
||||||
|
'use-isnan': ['warn', { enforceForSwitchCase: true, enforceForIndexOf: true }],
|
||||||
|
'valid-typeof': ['warn', { requireStringLiterals: true }],
|
||||||
|
'wrap-iife': ['warn', 'inside'],
|
||||||
|
'arrow-parens': ['warn', 'as-needed', { requireForBlockBody: false }],
|
||||||
|
'capitalized-comments': ['warn', 'always', {
|
||||||
|
ignoreConsecutiveComments: true,
|
||||||
|
ignorePattern: 'noinspection',
|
||||||
|
}],
|
||||||
|
'comma-spacing': 'warn',
|
||||||
|
'dot-notation': 'warn',
|
||||||
|
indent: ['warn', 2, { SwitchCase: 1 }],
|
||||||
|
'key-spacing': 'warn',
|
||||||
|
'keyword-spacing': ['warn', { overrides: { catch: { before: true, after: false } } }],
|
||||||
|
'max-len': ['warn', {
|
||||||
|
code: 180,
|
||||||
|
ignoreTrailingComments: true,
|
||||||
|
ignoreUrls: true,
|
||||||
|
ignoreStrings: true,
|
||||||
|
ignoreTemplateLiterals: true,
|
||||||
|
}],
|
||||||
|
'prettier/prettier': ['error', { printWidth: 180 }],
|
||||||
|
'no-extra-boolean-cast': ['warn', { enforceForLogicalOperands: true }],
|
||||||
|
'no-extra-semi': 'warn',
|
||||||
|
'no-multi-spaces': ['warn', { ignoreEOLComments: true }],
|
||||||
|
'no-tabs': 'warn',
|
||||||
|
'no-throw-literal': 'error',
|
||||||
|
'no-trailing-spaces': 'warn',
|
||||||
|
'no-useless-escape': 'warn',
|
||||||
|
'nonblock-statement-body-position': ['warn', 'beside'],
|
||||||
|
'one-var': ['warn', 'never'],
|
||||||
|
'operator-linebreak': ['warn', 'before', {
|
||||||
|
overrides: { '=': 'after', '+=': 'after', '-=': 'after' },
|
||||||
|
}],
|
||||||
|
'prefer-template': 'warn',
|
||||||
|
'quote-props': ['warn', 'as-needed', { keywords: false }],
|
||||||
|
quotes: ['warn', 'double', { avoidEscape: true, allowTemplateLiterals: false }],
|
||||||
|
semi: 'warn',
|
||||||
|
'space-before-blocks': ['warn', 'always'],
|
||||||
|
'space-before-function-paren': ['warn', {
|
||||||
|
anonymous: 'never',
|
||||||
|
named: 'never',
|
||||||
|
asyncArrow: 'always',
|
||||||
|
}],
|
||||||
|
'spaced-comment': 'warn',
|
||||||
|
'jsdoc/check-access': 'warn',
|
||||||
|
'jsdoc/check-alignment': 'warn',
|
||||||
|
'jsdoc/check-examples': 'off',
|
||||||
|
'jsdoc/check-indentation': 'off',
|
||||||
|
'jsdoc/check-line-alignment': 'off',
|
||||||
|
'jsdoc/check-param-names': 'warn',
|
||||||
|
'jsdoc/check-property-names': 'warn',
|
||||||
|
'jsdoc/check-syntax': 'off',
|
||||||
|
'jsdoc/check-tag-names': ['warn', { definedTags: ['category'] }],
|
||||||
|
'jsdoc/check-types': 'warn',
|
||||||
|
'jsdoc/check-values': 'warn',
|
||||||
|
'jsdoc/empty-tags': 'warn',
|
||||||
|
'jsdoc/implements-on-classes': 'warn',
|
||||||
|
'jsdoc/match-description': 'off',
|
||||||
|
'jsdoc/newline-after-description': 'off',
|
||||||
|
'jsdoc/no-bad-blocks': 'warn',
|
||||||
|
'jsdoc/no-defaults': 'off',
|
||||||
|
'jsdoc/no-types': 'off',
|
||||||
|
'jsdoc/no-undefined-types': 'off',
|
||||||
|
'jsdoc/require-description': 'warn',
|
||||||
|
'jsdoc/require-description-complete-sentence': 'off',
|
||||||
|
'jsdoc/require-example': 'off',
|
||||||
|
'jsdoc/require-file-overview': 'off',
|
||||||
|
'jsdoc/require-hyphen-before-param-description': ['warn', 'never'],
|
||||||
|
'jsdoc/require-jsdoc': 'warn',
|
||||||
|
'jsdoc/require-param': 'warn',
|
||||||
|
'jsdoc/require-param-description': 'off',
|
||||||
|
'jsdoc/require-param-name': 'warn',
|
||||||
|
'jsdoc/require-param-type': 'warn',
|
||||||
|
'jsdoc/require-property': 'warn',
|
||||||
|
'jsdoc/require-property-description': 'off',
|
||||||
|
'jsdoc/require-property-name': 'warn',
|
||||||
|
'jsdoc/require-property-type': 'warn',
|
||||||
|
'jsdoc/require-returns': 'off',
|
||||||
|
'jsdoc/require-returns-check': 'warn',
|
||||||
|
'jsdoc/require-returns-description': 'off',
|
||||||
|
'jsdoc/require-returns-type': 'warn',
|
||||||
|
'jsdoc/require-throws': 'off',
|
||||||
|
'jsdoc/require-yields': 'warn',
|
||||||
|
'jsdoc/require-yields-check': 'warn',
|
||||||
|
'jsdoc/valid-types': 'off',
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
jsdoc: {
|
||||||
|
preferredTypes: {
|
||||||
|
'.<>': '<>',
|
||||||
|
object: 'Object',
|
||||||
|
Object: 'object',
|
||||||
|
},
|
||||||
|
mode: 'typescript',
|
||||||
|
tagNamePreference: {
|
||||||
|
augments: 'extends',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// Ajout de la configuration Prettier qui désactive les règles ESLint en conflit avec Prettier
|
||||||
|
configPrettier
|
||||||
|
];
|
BIN
fonts/caslonpro-bold.otf
Normal file
BIN
fonts/caslonpro-bold.otf
Normal file
Binary file not shown.
BIN
fonts/caslonpro-bolditalic.otf
Normal file
BIN
fonts/caslonpro-bolditalic.otf
Normal file
Binary file not shown.
BIN
fonts/caslonpro-italic.otf
Normal file
BIN
fonts/caslonpro-italic.otf
Normal file
Binary file not shown.
BIN
fonts/caslonpro-regular.otf
Normal file
BIN
fonts/caslonpro-regular.otf
Normal file
Binary file not shown.
BIN
fonts/catfranken-deutsch.ttf
Normal file
BIN
fonts/catfranken-deutsch.ttf
Normal file
Binary file not shown.
32
gulpfile.js
Normal file
32
gulpfile.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
const gulp = require('gulp');
|
||||||
|
const less = require('gulp-less');
|
||||||
|
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
/* Compile LESS
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
function compileLESS() {
|
||||||
|
return gulp.src("styles/fvtt-lethal-fantasy.less")
|
||||||
|
.pipe(less())
|
||||||
|
.pipe(gulp.dest("./css"))
|
||||||
|
}
|
||||||
|
const css = gulp.series(compileLESS);
|
||||||
|
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
/* Watch Updates
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
const SIMPLE_LESS = ["styles/*.less"];
|
||||||
|
|
||||||
|
function watchUpdates() {
|
||||||
|
gulp.watch(SIMPLE_LESS, css);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
/* Export Tasks
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
|
exports.default = gulp.series(
|
||||||
|
gulp.parallel(css),
|
||||||
|
watchUpdates
|
||||||
|
);
|
||||||
|
exports.css = css;
|
||||||
|
|
438
lang/en.json
Normal file
438
lang/en.json
Normal file
@ -0,0 +1,438 @@
|
|||||||
|
{
|
||||||
|
"TYPES": {
|
||||||
|
"Actor": {
|
||||||
|
"character": "Personnage",
|
||||||
|
"opponent": "Adversaire"
|
||||||
|
},
|
||||||
|
"Item": {
|
||||||
|
"path": "Voie",
|
||||||
|
"talent": "Talent",
|
||||||
|
"weapon": "Arme",
|
||||||
|
"armor": "Armure",
|
||||||
|
"spell": "Sortilège",
|
||||||
|
"attack": "Attaque"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"LETHALFANTASY": {
|
||||||
|
"Character": {
|
||||||
|
"FIELDS": {
|
||||||
|
"voies": {
|
||||||
|
"majeure": {
|
||||||
|
"nom": {
|
||||||
|
"label": "Voie"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mineure": {
|
||||||
|
"nom": {
|
||||||
|
"label": "Voie Mineure"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commanditaire": {
|
||||||
|
"label": "Commanditaire"
|
||||||
|
},
|
||||||
|
"dv": {
|
||||||
|
"label": "Dé de Vie"
|
||||||
|
},
|
||||||
|
"pv": {
|
||||||
|
"value": {
|
||||||
|
"label": "Points de Vie",
|
||||||
|
"short": "PV"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dmax": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Dégâts max"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"caracteristiques": {
|
||||||
|
"rob": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Robustesse",
|
||||||
|
"short": "Rob"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dex": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Dextérité",
|
||||||
|
"short": "Dex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Intelligence",
|
||||||
|
"short": "Int"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"per": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Perception",
|
||||||
|
"short": "Per"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vol": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Volonté",
|
||||||
|
"short": "Vol"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ressources": {
|
||||||
|
"san": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Santé Mentale"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oeil": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Œil"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"verbe": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Verbe"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bourse": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Bourse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"magie": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Magie"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Label": {
|
||||||
|
"personnage": "Personnage",
|
||||||
|
"caracteristiques": "Caractéristiques",
|
||||||
|
"ressources": "Ressources",
|
||||||
|
"description": "Description",
|
||||||
|
"langues": "Langues",
|
||||||
|
"notes": "Notes",
|
||||||
|
"details": "Détails",
|
||||||
|
"biography": "Biographie",
|
||||||
|
"biens": "Biens",
|
||||||
|
"talents": "Talents",
|
||||||
|
"attaques": "Attaques"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Opponent": {
|
||||||
|
"FIELDS": {
|
||||||
|
"dv": {
|
||||||
|
"label": "Dé de Vie"
|
||||||
|
},
|
||||||
|
"pv": {
|
||||||
|
"value": {
|
||||||
|
"label": "Points de Vie"
|
||||||
|
},
|
||||||
|
"max": {
|
||||||
|
"label": "Points de Vie max"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"armure": {
|
||||||
|
"label": "Armure"
|
||||||
|
},
|
||||||
|
"malus": {
|
||||||
|
"label": "Malus d'adversité"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"label": "Actions"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Talent": {
|
||||||
|
"FIELDS": {
|
||||||
|
"description": {
|
||||||
|
"label": "Description"
|
||||||
|
},
|
||||||
|
"appris": {
|
||||||
|
"label": "Appris"
|
||||||
|
},
|
||||||
|
"progression": {
|
||||||
|
"label": "Progression"
|
||||||
|
},
|
||||||
|
"niveau": {
|
||||||
|
"label": "Niveau"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": "(Niveau {niveau})"
|
||||||
|
},
|
||||||
|
"Path": {
|
||||||
|
"FIELDS": {
|
||||||
|
"description": {
|
||||||
|
"label": "Description"
|
||||||
|
},
|
||||||
|
"biens": {
|
||||||
|
"label": "Biens"
|
||||||
|
},
|
||||||
|
"langues": {
|
||||||
|
"label": "Langues"
|
||||||
|
},
|
||||||
|
"talents": {
|
||||||
|
"label": "Talents"
|
||||||
|
},
|
||||||
|
"voies": {
|
||||||
|
"majeure": {
|
||||||
|
"label": "Voie Majeure"
|
||||||
|
},
|
||||||
|
"mineure": {
|
||||||
|
"label": "Voie Mineure"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dv": {
|
||||||
|
"label": "Dé de Vie"
|
||||||
|
},
|
||||||
|
"dmax": {
|
||||||
|
"label": "Dégâts max"
|
||||||
|
},
|
||||||
|
"caracteristiques": {
|
||||||
|
"rob": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Robustesse",
|
||||||
|
"short": "Rob"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dex": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Dextérité",
|
||||||
|
"short": "Dex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Intelligence",
|
||||||
|
"short": "Int"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"per": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Perception",
|
||||||
|
"short": "Per"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vol": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Volonté",
|
||||||
|
"short": "Vol"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ressources": {
|
||||||
|
"san": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Santé Mentale"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oeil": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Œil"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"verbe": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Verbe"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bourse": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Bourse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"magie": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Magie"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Weapon": {
|
||||||
|
"FIELDS": {
|
||||||
|
"categorie": {
|
||||||
|
"label": "Catégorie"
|
||||||
|
},
|
||||||
|
"degats": {
|
||||||
|
"label": "Dégâts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Category": {
|
||||||
|
"main": "Mains Nues",
|
||||||
|
"improvisee": "Armes Improvisées",
|
||||||
|
"courte": "Armes courtes",
|
||||||
|
"longue": "Armes longues",
|
||||||
|
"lourde": "Armes lourdes"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Armor": {
|
||||||
|
"FIELDS": {
|
||||||
|
"categorie": {
|
||||||
|
"label": "Catégorie"
|
||||||
|
},
|
||||||
|
"valeur": {
|
||||||
|
"label": "Valeur"
|
||||||
|
},
|
||||||
|
"malus": {
|
||||||
|
"label": "Malus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Category": {
|
||||||
|
"sommaire": "Armures sommaires",
|
||||||
|
"legere": "Armures légères",
|
||||||
|
"guerre": "Armures de guerre"
|
||||||
|
},
|
||||||
|
"details": "Valeur : {valeur} - Malus : {malus}"
|
||||||
|
},
|
||||||
|
"Spell": {
|
||||||
|
"FIELDS": {
|
||||||
|
"description": {
|
||||||
|
"label": "Description"
|
||||||
|
},
|
||||||
|
"preparation": {
|
||||||
|
"label": "Préparation"
|
||||||
|
},
|
||||||
|
"cible": {
|
||||||
|
"label": "Cible"
|
||||||
|
},
|
||||||
|
"portee": {
|
||||||
|
"label": "Portée"
|
||||||
|
},
|
||||||
|
"duree": {
|
||||||
|
"label": "Durée"
|
||||||
|
},
|
||||||
|
"consequenceA": {
|
||||||
|
"label": "Conséquence A"
|
||||||
|
},
|
||||||
|
"consequenceB": {
|
||||||
|
"label": "Conséquence B"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Range": {
|
||||||
|
"na": "-",
|
||||||
|
"contact": "Contact",
|
||||||
|
"proche": "Proche",
|
||||||
|
"loin": "Loin",
|
||||||
|
"distant": "Distant"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Attack": {
|
||||||
|
"FIELDS": {
|
||||||
|
"degats": {
|
||||||
|
"label": "Dégâts"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Label": {
|
||||||
|
"description": "Description",
|
||||||
|
"biens": "Biens",
|
||||||
|
"langues": "Langues",
|
||||||
|
"profil": "Profil",
|
||||||
|
"details": "Détails",
|
||||||
|
"talents": "Talents",
|
||||||
|
"progressionPossible": "Progression possible",
|
||||||
|
"equipement": "Equipement",
|
||||||
|
"spells" : "Sortilèges",
|
||||||
|
"level": "Niveau",
|
||||||
|
"degats": "Dégâts",
|
||||||
|
"ressource": "Ressource",
|
||||||
|
"sauvegarde": "Sauvegarde",
|
||||||
|
"newArmor": "Nouvelle armure",
|
||||||
|
"newWeapon": "Nouvelle arme",
|
||||||
|
"armor": "Armure",
|
||||||
|
"malus": "Malus",
|
||||||
|
"jet": "Jet de ",
|
||||||
|
"progress": "Progression",
|
||||||
|
"hasProgressed": "A progressé dans la caractéristique",
|
||||||
|
"noProgress": "N'a pas progressé dans la caractéristique",
|
||||||
|
"experience": "Expérience",
|
||||||
|
"experienceDetail": "Expérience {detail}",
|
||||||
|
"maximum": "Maximum"
|
||||||
|
},
|
||||||
|
"Edit": "Editer",
|
||||||
|
"Delete": "Supprimer",
|
||||||
|
"ToggleSheet": "Changer de mode",
|
||||||
|
"Warning": {
|
||||||
|
"dejaDeuxVoies": "Vous avez déjà choisi deux voies",
|
||||||
|
"dejaVoieMajeure": "Vous avez déjà choisi cette voie comme voie majeure",
|
||||||
|
"voieMajeureAjoutee": "Voie majeure ajoutée",
|
||||||
|
"voieMineureAjoutee": "Voie mineure ajoutée",
|
||||||
|
"voieMajeureSupprimee": "Voie majeure supprimée",
|
||||||
|
"voieMineureSupprimee": "Voie mineure supprimée",
|
||||||
|
"plusDeRessource": "Vous n'avez plus de ressource {ressource}"
|
||||||
|
},
|
||||||
|
"Dialog": {
|
||||||
|
"ajoutVoieMajeure": "Ajouter une voie majeure va automatiquement remplacer les caractéristiques, les ressources, les langues et les biens. Continuer ?",
|
||||||
|
"ajoutVoieMajeureTitre": "Ajout d'une voie majeure",
|
||||||
|
"ajoutVoieMineureTitre": "Ajout d'une voie mineure",
|
||||||
|
"suppressionTalents": "Supprimer cette voie va supprimer les talents associés. Continuer ?",
|
||||||
|
"talentDansVoie": "Ce talent est présent dans la voie {path}. Voulez-vous vraiment le supprimer ?",
|
||||||
|
"titleSave": "Jet de sauvegarde",
|
||||||
|
"titleResource": "Jet de ressource",
|
||||||
|
"titleDamage": "Jet de dégâts",
|
||||||
|
"titleAttack": "Jet d'attaque",
|
||||||
|
"titleStandard": "Jet standard"
|
||||||
|
},
|
||||||
|
"Roll": {
|
||||||
|
"save": "Jet de sauvegarde <br> {save}",
|
||||||
|
"resource": "Jet de ressource <br> {resource}",
|
||||||
|
"damage": "Jet de dégâts <br> {item}",
|
||||||
|
"attack": "Jet d'attaque <br> {item}",
|
||||||
|
"roll": "Lancer",
|
||||||
|
"aide": "Aider",
|
||||||
|
"gene": "Gêner",
|
||||||
|
"adversite": "Adversité",
|
||||||
|
"avantagesDesavantages": "Avantages et désavantages",
|
||||||
|
"normal": "Normal",
|
||||||
|
"avantage": "Avec avantage",
|
||||||
|
"desavantage": "Avec désavantage",
|
||||||
|
"doubleAvantage": "Avec double avantage",
|
||||||
|
"doubleDesavantage": "Avec double désavantage",
|
||||||
|
"visibilite": "Visibilité du lancer",
|
||||||
|
"success": "Réussite",
|
||||||
|
"failure": "Echec",
|
||||||
|
"resourceLost": "Ressource perdue",
|
||||||
|
"displayArmor": "{targetName} a une armure de {targetArmor}. <br>Dégâts réels : {realDamage}"
|
||||||
|
},
|
||||||
|
"Tooltip": {
|
||||||
|
"learnedTalents": "Les talents appris sont en gras",
|
||||||
|
"saveIntroTextTooltip": "Caractéristique : {value} <br> Aide : {aide} <br> Gêne : {gene} <br> Modificateur : {modificateur}",
|
||||||
|
"addAttack": "Ajouter une attaque",
|
||||||
|
"addEquipment": "Ajouter une arme, Shift + Click pour ajouter une armure",
|
||||||
|
"addSpell": "Ajouter un sortilège"
|
||||||
|
},
|
||||||
|
"Setting": {
|
||||||
|
"displayOpponentMalus": "Afficher le malus d'adversité",
|
||||||
|
"displayOpponentMalusHint": "Affiche le malus d'adversité pour les joueurs.",
|
||||||
|
"fortune": "Roue de Fortune",
|
||||||
|
"fortuneHint": "Valeur de la roue de Fortune. Nombre de joueurs + 1 en début de partie."
|
||||||
|
},
|
||||||
|
"Chat": {
|
||||||
|
"askFortune": "{name} veut utiliser un point de Fortune !",
|
||||||
|
"askRollForAll": "Jet de {value}",
|
||||||
|
"askRollForOne": "Jet de {value} pour {name}"
|
||||||
|
},
|
||||||
|
"Fortune": {
|
||||||
|
"title": "Roue de Fortune"
|
||||||
|
},
|
||||||
|
"Manager": {
|
||||||
|
"title": "Gestionnaire de Personnages",
|
||||||
|
"player": "Utilisateur",
|
||||||
|
"character": "Personnage",
|
||||||
|
"rob": "Robustesse",
|
||||||
|
"dex": "Dextérité",
|
||||||
|
"int": "Intelligence",
|
||||||
|
"per": "Perception",
|
||||||
|
"vol": "Volonté",
|
||||||
|
"pv": "Points de Vie",
|
||||||
|
"san": "Santé Mentale",
|
||||||
|
"oeil": "Œil",
|
||||||
|
"verbe": "Verbe",
|
||||||
|
"bourse": "Bourse",
|
||||||
|
"magie": "Magie",
|
||||||
|
"roll": "Faire le jet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
438
lang/fr.json
Normal file
438
lang/fr.json
Normal file
@ -0,0 +1,438 @@
|
|||||||
|
{
|
||||||
|
"TYPES": {
|
||||||
|
"Actor": {
|
||||||
|
"character": "Personnage",
|
||||||
|
"opponent": "Adversaire"
|
||||||
|
},
|
||||||
|
"Item": {
|
||||||
|
"path": "Voie",
|
||||||
|
"talent": "Talent",
|
||||||
|
"weapon": "Arme",
|
||||||
|
"armor": "Armure",
|
||||||
|
"spell": "Sortilège",
|
||||||
|
"attack": "Attaque"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"LETHALFANTASY": {
|
||||||
|
"Character": {
|
||||||
|
"FIELDS": {
|
||||||
|
"voies": {
|
||||||
|
"majeure": {
|
||||||
|
"nom": {
|
||||||
|
"label": "Voie"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mineure": {
|
||||||
|
"nom": {
|
||||||
|
"label": "Voie Mineure"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commanditaire": {
|
||||||
|
"label": "Commanditaire"
|
||||||
|
},
|
||||||
|
"dv": {
|
||||||
|
"label": "Dé de Vie"
|
||||||
|
},
|
||||||
|
"pv": {
|
||||||
|
"value": {
|
||||||
|
"label": "Points de Vie",
|
||||||
|
"short": "PV"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dmax": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Dégâts max"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"caracteristiques": {
|
||||||
|
"rob": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Robustesse",
|
||||||
|
"short": "Rob"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dex": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Dextérité",
|
||||||
|
"short": "Dex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Intelligence",
|
||||||
|
"short": "Int"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"per": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Perception",
|
||||||
|
"short": "Per"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vol": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Volonté",
|
||||||
|
"short": "Vol"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ressources": {
|
||||||
|
"san": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Santé Mentale"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oeil": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Œil"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"verbe": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Verbe"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bourse": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Bourse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"magie": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Magie"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Label": {
|
||||||
|
"personnage": "Personnage",
|
||||||
|
"caracteristiques": "Caractéristiques",
|
||||||
|
"ressources": "Ressources",
|
||||||
|
"description": "Description",
|
||||||
|
"langues": "Langues",
|
||||||
|
"notes": "Notes",
|
||||||
|
"details": "Détails",
|
||||||
|
"biography": "Biographie",
|
||||||
|
"biens": "Biens",
|
||||||
|
"talents": "Talents",
|
||||||
|
"attaques": "Attaques"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Opponent": {
|
||||||
|
"FIELDS": {
|
||||||
|
"dv": {
|
||||||
|
"label": "Dé de Vie"
|
||||||
|
},
|
||||||
|
"pv": {
|
||||||
|
"value": {
|
||||||
|
"label": "Points de Vie"
|
||||||
|
},
|
||||||
|
"max": {
|
||||||
|
"label": "Points de Vie max"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"armure": {
|
||||||
|
"label": "Armure"
|
||||||
|
},
|
||||||
|
"malus": {
|
||||||
|
"label": "Malus d'adversité"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"label": "Actions"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Talent": {
|
||||||
|
"FIELDS": {
|
||||||
|
"description": {
|
||||||
|
"label": "Description"
|
||||||
|
},
|
||||||
|
"appris": {
|
||||||
|
"label": "Appris"
|
||||||
|
},
|
||||||
|
"progression": {
|
||||||
|
"label": "Progression"
|
||||||
|
},
|
||||||
|
"niveau": {
|
||||||
|
"label": "Niveau"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": "(Niveau {niveau})"
|
||||||
|
},
|
||||||
|
"Path": {
|
||||||
|
"FIELDS": {
|
||||||
|
"description": {
|
||||||
|
"label": "Description"
|
||||||
|
},
|
||||||
|
"biens": {
|
||||||
|
"label": "Biens"
|
||||||
|
},
|
||||||
|
"langues": {
|
||||||
|
"label": "Langues"
|
||||||
|
},
|
||||||
|
"talents": {
|
||||||
|
"label": "Talents"
|
||||||
|
},
|
||||||
|
"voies": {
|
||||||
|
"majeure": {
|
||||||
|
"label": "Voie Majeure"
|
||||||
|
},
|
||||||
|
"mineure": {
|
||||||
|
"label": "Voie Mineure"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dv": {
|
||||||
|
"label": "Dé de Vie"
|
||||||
|
},
|
||||||
|
"dmax": {
|
||||||
|
"label": "Dégâts max"
|
||||||
|
},
|
||||||
|
"caracteristiques": {
|
||||||
|
"rob": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Robustesse",
|
||||||
|
"short": "Rob"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dex": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Dextérité",
|
||||||
|
"short": "Dex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Intelligence",
|
||||||
|
"short": "Int"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"per": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Perception",
|
||||||
|
"short": "Per"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vol": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Volonté",
|
||||||
|
"short": "Vol"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ressources": {
|
||||||
|
"san": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Santé Mentale"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oeil": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Œil"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"verbe": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Verbe"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bourse": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Bourse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"magie": {
|
||||||
|
"valeur": {
|
||||||
|
"label": "Magie"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Weapon": {
|
||||||
|
"FIELDS": {
|
||||||
|
"categorie": {
|
||||||
|
"label": "Catégorie"
|
||||||
|
},
|
||||||
|
"degats": {
|
||||||
|
"label": "Dégâts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Category": {
|
||||||
|
"main": "Mains Nues",
|
||||||
|
"improvisee": "Armes Improvisées",
|
||||||
|
"courte": "Armes courtes",
|
||||||
|
"longue": "Armes longues",
|
||||||
|
"lourde": "Armes lourdes"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Armor": {
|
||||||
|
"FIELDS": {
|
||||||
|
"categorie": {
|
||||||
|
"label": "Catégorie"
|
||||||
|
},
|
||||||
|
"valeur": {
|
||||||
|
"label": "Valeur"
|
||||||
|
},
|
||||||
|
"malus": {
|
||||||
|
"label": "Malus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Category": {
|
||||||
|
"sommaire": "Armures sommaires",
|
||||||
|
"legere": "Armures légères",
|
||||||
|
"guerre": "Armures de guerre"
|
||||||
|
},
|
||||||
|
"details": "Valeur : {valeur} - Malus : {malus}"
|
||||||
|
},
|
||||||
|
"Spell": {
|
||||||
|
"FIELDS": {
|
||||||
|
"description": {
|
||||||
|
"label": "Description"
|
||||||
|
},
|
||||||
|
"preparation": {
|
||||||
|
"label": "Préparation"
|
||||||
|
},
|
||||||
|
"cible": {
|
||||||
|
"label": "Cible"
|
||||||
|
},
|
||||||
|
"portee": {
|
||||||
|
"label": "Portée"
|
||||||
|
},
|
||||||
|
"duree": {
|
||||||
|
"label": "Durée"
|
||||||
|
},
|
||||||
|
"consequenceA": {
|
||||||
|
"label": "Conséquence A"
|
||||||
|
},
|
||||||
|
"consequenceB": {
|
||||||
|
"label": "Conséquence B"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Range": {
|
||||||
|
"na": "-",
|
||||||
|
"contact": "Contact",
|
||||||
|
"proche": "Proche",
|
||||||
|
"loin": "Loin",
|
||||||
|
"distant": "Distant"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Attack": {
|
||||||
|
"FIELDS": {
|
||||||
|
"degats": {
|
||||||
|
"label": "Dégâts"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Label": {
|
||||||
|
"description": "Description",
|
||||||
|
"biens": "Biens",
|
||||||
|
"langues": "Langues",
|
||||||
|
"profil": "Profil",
|
||||||
|
"details": "Détails",
|
||||||
|
"talents": "Talents",
|
||||||
|
"progressionPossible": "Progression possible",
|
||||||
|
"equipement": "Equipement",
|
||||||
|
"spells" : "Sortilèges",
|
||||||
|
"level": "Niveau",
|
||||||
|
"degats": "Dégâts",
|
||||||
|
"ressource": "Ressource",
|
||||||
|
"sauvegarde": "Sauvegarde",
|
||||||
|
"newArmor": "Nouvelle armure",
|
||||||
|
"newWeapon": "Nouvelle arme",
|
||||||
|
"armor": "Armure",
|
||||||
|
"malus": "Malus",
|
||||||
|
"jet": "Jet de ",
|
||||||
|
"progress": "Progression",
|
||||||
|
"hasProgressed": "A progressé dans la caractéristique",
|
||||||
|
"noProgress": "N'a pas progressé dans la caractéristique",
|
||||||
|
"experience": "Expérience",
|
||||||
|
"experienceDetail": "Expérience {detail}",
|
||||||
|
"maximum": "Maximum"
|
||||||
|
},
|
||||||
|
"Edit": "Editer",
|
||||||
|
"Delete": "Supprimer",
|
||||||
|
"ToggleSheet": "Changer de mode",
|
||||||
|
"Warning": {
|
||||||
|
"dejaDeuxVoies": "Vous avez déjà choisi deux voies",
|
||||||
|
"dejaVoieMajeure": "Vous avez déjà choisi cette voie comme voie majeure",
|
||||||
|
"voieMajeureAjoutee": "Voie majeure ajoutée",
|
||||||
|
"voieMineureAjoutee": "Voie mineure ajoutée",
|
||||||
|
"voieMajeureSupprimee": "Voie majeure supprimée",
|
||||||
|
"voieMineureSupprimee": "Voie mineure supprimée",
|
||||||
|
"plusDeRessource": "Vous n'avez plus de ressource {ressource}"
|
||||||
|
},
|
||||||
|
"Dialog": {
|
||||||
|
"ajoutVoieMajeure": "Ajouter une voie majeure va automatiquement remplacer les caractéristiques, les ressources, les langues et les biens. Continuer ?",
|
||||||
|
"ajoutVoieMajeureTitre": "Ajout d'une voie majeure",
|
||||||
|
"ajoutVoieMineureTitre": "Ajout d'une voie mineure",
|
||||||
|
"suppressionTalents": "Supprimer cette voie va supprimer les talents associés. Continuer ?",
|
||||||
|
"talentDansVoie": "Ce talent est présent dans la voie {path}. Voulez-vous vraiment le supprimer ?",
|
||||||
|
"titleSave": "Jet de sauvegarde",
|
||||||
|
"titleResource": "Jet de ressource",
|
||||||
|
"titleDamage": "Jet de dégâts",
|
||||||
|
"titleAttack": "Jet d'attaque",
|
||||||
|
"titleStandard": "Jet standard"
|
||||||
|
},
|
||||||
|
"Roll": {
|
||||||
|
"save": "Jet de sauvegarde <br> {save}",
|
||||||
|
"resource": "Jet de ressource <br> {resource}",
|
||||||
|
"damage": "Jet de dégâts <br> {item}",
|
||||||
|
"attack": "Jet d'attaque <br> {item}",
|
||||||
|
"roll": "Lancer",
|
||||||
|
"aide": "Aider",
|
||||||
|
"gene": "Gêner",
|
||||||
|
"adversite": "Adversité",
|
||||||
|
"avantagesDesavantages": "Avantages et désavantages",
|
||||||
|
"normal": "Normal",
|
||||||
|
"avantage": "Avec avantage",
|
||||||
|
"desavantage": "Avec désavantage",
|
||||||
|
"doubleAvantage": "Avec double avantage",
|
||||||
|
"doubleDesavantage": "Avec double désavantage",
|
||||||
|
"visibilite": "Visibilité du lancer",
|
||||||
|
"success": "Réussite",
|
||||||
|
"failure": "Echec",
|
||||||
|
"resourceLost": "Ressource perdue",
|
||||||
|
"displayArmor": "{targetName} a une armure de {targetArmor}. <br>Dégâts réels : {realDamage}"
|
||||||
|
},
|
||||||
|
"Tooltip": {
|
||||||
|
"learnedTalents": "Les talents appris sont en gras",
|
||||||
|
"saveIntroTextTooltip": "Caractéristique : {value} <br> Aide : {aide} <br> Gêne : {gene} <br> Modificateur : {modificateur}",
|
||||||
|
"addAttack": "Ajouter une attaque",
|
||||||
|
"addEquipment": "Ajouter une arme, Shift + Click pour ajouter une armure",
|
||||||
|
"addSpell": "Ajouter un sortilège"
|
||||||
|
},
|
||||||
|
"Setting": {
|
||||||
|
"displayOpponentMalus": "Afficher le malus d'adversité",
|
||||||
|
"displayOpponentMalusHint": "Affiche le malus d'adversité pour les joueurs.",
|
||||||
|
"fortune": "Roue de Fortune",
|
||||||
|
"fortuneHint": "Valeur de la roue de Fortune. Nombre de joueurs + 1 en début de partie."
|
||||||
|
},
|
||||||
|
"Chat": {
|
||||||
|
"askFortune": "{name} veut utiliser un point de Fortune !",
|
||||||
|
"askRollForAll": "Jet de {value}",
|
||||||
|
"askRollForOne": "Jet de {value} pour {name}"
|
||||||
|
},
|
||||||
|
"Fortune": {
|
||||||
|
"title": "Roue de Fortune"
|
||||||
|
},
|
||||||
|
"Manager": {
|
||||||
|
"title": "Gestionnaire de Personnages",
|
||||||
|
"player": "Utilisateur",
|
||||||
|
"character": "Personnage",
|
||||||
|
"rob": "Robustesse",
|
||||||
|
"dex": "Dextérité",
|
||||||
|
"int": "Intelligence",
|
||||||
|
"per": "Perception",
|
||||||
|
"vol": "Volonté",
|
||||||
|
"pv": "Points de Vie",
|
||||||
|
"san": "Santé Mentale",
|
||||||
|
"oeil": "Œil",
|
||||||
|
"verbe": "Verbe",
|
||||||
|
"bourse": "Bourse",
|
||||||
|
"magie": "Magie",
|
||||||
|
"roll": "Faire le jet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
295
lethal-fantasy.mjs
Normal file
295
lethal-fantasy.mjs
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
/**
|
||||||
|
* Lethal Fantasy RPG System
|
||||||
|
* Author: LeRatierBretonnien/Uberwald
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { SYSTEM } from "./module/config/system.mjs"
|
||||||
|
globalThis.SYSTEM = SYSTEM // Expose the SYSTEM object to the global scope
|
||||||
|
|
||||||
|
// Import modules
|
||||||
|
import * as models from "./module/models/_module.mjs"
|
||||||
|
import * as documents from "./module/documents/_module.mjs"
|
||||||
|
import * as applications from "./module/applications/_module.mjs"
|
||||||
|
|
||||||
|
import { handleSocketEvent } from "./module/socket.mjs"
|
||||||
|
import { configureDiceSoNice } from "./module/dice.mjs"
|
||||||
|
import { Macros } from "./module/macros.mjs"
|
||||||
|
import { initControlButtons } from "./module/control-buttons.mjs"
|
||||||
|
import { setupTextEnrichers } from "./module/enrichers.mjs"
|
||||||
|
|
||||||
|
Hooks.once("init", function () {
|
||||||
|
console.info("Lethal Fantasy RPG | Initializing System")
|
||||||
|
console.info(SYSTEM.ASCII)
|
||||||
|
|
||||||
|
globalThis.lethalFantasy = game.system
|
||||||
|
game.system.CONST = SYSTEM
|
||||||
|
|
||||||
|
// Expose the system API
|
||||||
|
game.system.api = {
|
||||||
|
applications,
|
||||||
|
models,
|
||||||
|
documents,
|
||||||
|
}
|
||||||
|
|
||||||
|
CONFIG.Actor.documentClass = documents.LethalFantasyActor
|
||||||
|
CONFIG.Actor.dataModels = {
|
||||||
|
character: models.LethalFantasyCharacter,
|
||||||
|
opponent: models.LethalFantasyOpponent,
|
||||||
|
}
|
||||||
|
|
||||||
|
CONFIG.Item.documentClass = documents.LethalFantasyItem
|
||||||
|
CONFIG.Item.dataModels = {
|
||||||
|
path: models.LethalFantasyPath,
|
||||||
|
talent: models.LethalFantasyTalent,
|
||||||
|
weapon: models.LethalFantasyWeapon,
|
||||||
|
armor: models.LethalFantasyArmor,
|
||||||
|
spell: models.LethalFantasySpell,
|
||||||
|
attack: models.LethalFantasyAttack,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register sheet application classes
|
||||||
|
Actors.unregisterSheet("core", ActorSheet)
|
||||||
|
Actors.registerSheet("lethalFantasy", applications.LethalFantasyCharacterSheet, { types: ["character"], makeDefault: true })
|
||||||
|
Actors.registerSheet("lethalFantasy", applications.LethalFantasyOpponentSheet, { types: ["opponent"], makeDefault: true })
|
||||||
|
|
||||||
|
Items.unregisterSheet("core", ItemSheet)
|
||||||
|
Items.registerSheet("lethalFantasy", applications.LethalFantasyTalentSheet, { types: ["talent"], makeDefault: true })
|
||||||
|
Items.registerSheet("lethalFantasy", applications.LethalFantasyPathSheet, { types: ["path"], makeDefault: true })
|
||||||
|
Items.registerSheet("lethalFantasy", applications.LethalFantasyWeaponSheet, { types: ["weapon"], makeDefault: true })
|
||||||
|
Items.registerSheet("lethalFantasy", applications.LethalFantasySpellSheet, { types: ["spell"], makeDefault: true })
|
||||||
|
Items.registerSheet("lethalFantasy", applications.LethalFantasyArmorSheet, { types: ["armor"], makeDefault: true })
|
||||||
|
Items.registerSheet("lethalFantasy", applications.LethalFantasyAttackSheet, { types: ["attack"], makeDefault: true })
|
||||||
|
|
||||||
|
// Other Document Configuration
|
||||||
|
CONFIG.ChatMessage.documentClass = documents.LethalFantasyChatMessage
|
||||||
|
|
||||||
|
// Dice system configuration
|
||||||
|
CONFIG.Dice.rolls.push(documents.LethalFantasyRoll)
|
||||||
|
|
||||||
|
// Register system settings
|
||||||
|
game.settings.register("lethalFantasy", "displayOpponentMalus", {
|
||||||
|
name: "TENEBRIS.Setting.displayOpponentMalus",
|
||||||
|
hint: "TENEBRIS.Setting.displayOpponentMalusHint",
|
||||||
|
scope: "world",
|
||||||
|
config: true,
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
game.settings.register("lethalFantasy", "fortune", {
|
||||||
|
name: "TENEBRIS.Setting.fortune",
|
||||||
|
hint: "TENEBRIS.Setting.fortuneHint",
|
||||||
|
scope: "world",
|
||||||
|
config: true,
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
requiresReload: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
game.settings.register("lethalFantasy", "worldKey", {
|
||||||
|
name: "Unique world key",
|
||||||
|
scope: "world",
|
||||||
|
config: false,
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
})
|
||||||
|
|
||||||
|
// Activate socket handler
|
||||||
|
game.socket.on(`system.${SYSTEM.id}`, handleSocketEvent)
|
||||||
|
|
||||||
|
// Pre-localize configuration objects
|
||||||
|
// TODO : encore d'actualité ?
|
||||||
|
// preLocalizeConfig()
|
||||||
|
|
||||||
|
initControlButtons()
|
||||||
|
|
||||||
|
setupTextEnrichers()
|
||||||
|
|
||||||
|
// Gestion des jets de dés depuis les journaux
|
||||||
|
document.addEventListener("click", (event) => {
|
||||||
|
const anchor = event.target.closest("a.ask-roll-journal")
|
||||||
|
if (!anchor) return
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
const type = anchor.dataset.rollType
|
||||||
|
const target = anchor.dataset.rollTarget
|
||||||
|
const title = anchor.dataset.rollTitle
|
||||||
|
const avantage = anchor.dataset.rollAvantage
|
||||||
|
applications.LethalFantasyManager.askRollForAll(type, target, title, avantage)
|
||||||
|
})
|
||||||
|
|
||||||
|
console.info("CTHULHU TENEBRIS | System Initialized")
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform one-time configuration of system configuration objects.
|
||||||
|
*/
|
||||||
|
function preLocalizeConfig() {
|
||||||
|
const localizeConfigObject = (obj, keys) => {
|
||||||
|
for (let o of Object.values(obj)) {
|
||||||
|
for (let k of keys) {
|
||||||
|
o[k] = game.i18n.localize(o[k])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CONFIG.Dice.rollModes = Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
|
||||||
|
|
||||||
|
// localizeConfigObject(SYSTEM.ACTION.TAG_CATEGORIES, ["label"])
|
||||||
|
// localizeConfigObject(CONFIG.Dice.rollModes, ["label"])
|
||||||
|
}
|
||||||
|
|
||||||
|
Hooks.once("ready", function () {
|
||||||
|
console.info("CTHULHU TENEBRIS | Ready")
|
||||||
|
game.system.applicationFortune = new applications.LethalFantasyFortune()
|
||||||
|
game.system.applicationFortune.render(true)
|
||||||
|
game.system.applicationManager = new applications.LethalFantasyManager()
|
||||||
|
if (game.user.isGM) {
|
||||||
|
game.system.applicationManager.render(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SYSTEM.DEV_MODE) {
|
||||||
|
registerWorldCount("lethalFantasy")
|
||||||
|
}
|
||||||
|
_showUserGuide()
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
async function _showUserGuide() {
|
||||||
|
if (game.user.isGM) {
|
||||||
|
const newVer = game.system.version
|
||||||
|
const userGuideJournalName = "Guide du système"
|
||||||
|
const userGuideCompendiumLabel = "userguide"
|
||||||
|
|
||||||
|
let currentVer = "0"
|
||||||
|
let oldUserGuide = game.journal.getName(userGuideJournalName)
|
||||||
|
if (oldUserGuide !== undefined && oldUserGuide !== null && oldUserGuide.getFlag("lethalFantasy", "UserGuideVersion") !== undefined) {
|
||||||
|
currentVer = oldUserGuide.getFlag("lethalFantasy", "UserGuideVersion")
|
||||||
|
}
|
||||||
|
if (newVer === currentVer) {
|
||||||
|
// Up to date
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let newReleasePack = game.packs.find((p) => p.metadata.name === userGuideCompendiumLabel)
|
||||||
|
if (newReleasePack === null || newReleasePack === undefined) {
|
||||||
|
console.info("CTHULHU TENEBRIS | No compendium found for the system guide")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await newReleasePack.getIndex()
|
||||||
|
|
||||||
|
let newUserGuide = newReleasePack.index.find((j) => j.name === userGuideJournalName)
|
||||||
|
if (newUserGuide === undefined || newUserGuide === null) {
|
||||||
|
console.info("CTHULHU TENEBRIS | No system guide found in the compendium")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't delete until we have new release Pack
|
||||||
|
if (oldUserGuide !== null && oldUserGuide !== undefined) {
|
||||||
|
await oldUserGuide.delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
await game.journal.importFromCompendium(newReleasePack, newUserGuide._id)
|
||||||
|
let newReleaseJournal = game.journal.getName(newUserGuide.name)
|
||||||
|
|
||||||
|
await newReleaseJournal.setFlag("lethalFantasy", "UserGuideVersion", newVer)
|
||||||
|
|
||||||
|
// Show journal
|
||||||
|
await newReleaseJournal.sheet.render(true, { sheetMode: "text" })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
Hooks.on("renderChatMessage", (message, html, data) => {
|
||||||
|
const typeMessage = data.message.flags.lethalFantasy?.typeMessage
|
||||||
|
// Message de fortune
|
||||||
|
if (typeMessage === "fortune") {
|
||||||
|
if (game.user.isGM && !data.message.flags.lethalFantasy?.accepted) {
|
||||||
|
html.find(".button").click((event) => applications.LethalFantasyFortune.acceptRequest(event, html, data))
|
||||||
|
} else {
|
||||||
|
html.find(".button").each((i, btn) => {
|
||||||
|
btn.style.display = "none"
|
||||||
|
})
|
||||||
|
if (game.user.isGM) {
|
||||||
|
html.find(".fortune-accepted").each((i, btn) => (btn.style.display = "flex"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Message de demande de jet de dés
|
||||||
|
else if (typeMessage === "askRoll") {
|
||||||
|
// Affichage des boutons de jet de dés uniquement pour les joueurs
|
||||||
|
if (game.user.isGM) {
|
||||||
|
html.find(".ask-roll-dice").each((i, btn) => {
|
||||||
|
btn.style.display = "none"
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
html.find(".ask-roll-dice").click((event) => {
|
||||||
|
const btn = $(event.currentTarget)
|
||||||
|
const type = btn.data("type")
|
||||||
|
const value = btn.data("value")
|
||||||
|
const avantage = btn.data("avantage") ?? "="
|
||||||
|
const character = game.user.character
|
||||||
|
if (type === SYSTEM.ROLL_TYPE.RESOURCE) character.rollResource(value)
|
||||||
|
else if (type === SYSTEM.ROLL_TYPE.SAVE) character.rollSave(value, avantage)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
Hooks.on("updateSetting", async (setting, update, options, id) => {
|
||||||
|
if (setting.key === "lethalFantasy.fortune") {
|
||||||
|
game.system.applicationFortune.render(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Dice-so-nice Ready
|
||||||
|
Hooks.once("diceSoNiceReady", (dice3d) => {
|
||||||
|
configureDiceSoNice(dice3d)
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a macro when dropping an entity on the hotbar
|
||||||
|
* Item - open roll dialog
|
||||||
|
* Actor - open actor sheet
|
||||||
|
* Journal - open journal sheet
|
||||||
|
*/
|
||||||
|
Hooks.on("hotbarDrop", (bar, data, slot) => {
|
||||||
|
if (["Actor", "Item", "JournalEntry", "roll", "rollDamage", "rollAttack"].includes(data.type)) {
|
||||||
|
Macros.createLethalFantasyMacro(data, slot)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register world usage statistics
|
||||||
|
* @param {string} registerKey
|
||||||
|
*/
|
||||||
|
function registerWorldCount(registerKey) {
|
||||||
|
if (game.user.isGM) {
|
||||||
|
let worldKey = game.settings.get(registerKey, "worldKey")
|
||||||
|
if (worldKey === undefined || worldKey === "") {
|
||||||
|
worldKey = foundry.utils.randomID(32)
|
||||||
|
game.settings.set(registerKey, "worldKey", worldKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simple API counter
|
||||||
|
const worldData = {
|
||||||
|
register_key: registerKey,
|
||||||
|
world_key: worldKey,
|
||||||
|
foundry_version: `${game.release.generation}.${game.release.build}`,
|
||||||
|
system_name: game.system.id,
|
||||||
|
system_version: game.system.version,
|
||||||
|
}
|
||||||
|
|
||||||
|
let apiURL = "https://worlds.qawstats.info/worlds-counter"
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
type: "POST",
|
||||||
|
data: JSON.stringify(worldData),
|
||||||
|
contentType: "application/json; charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
10
module/applications/_module.mjs
Normal file
10
module/applications/_module.mjs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export { default as LethalFantasyCharacterSheet } from "./sheets/character-sheet.mjs"
|
||||||
|
export { default as LethalFantasyOpponentSheet } from "./sheets/opponent-sheet.mjs"
|
||||||
|
export { default as LethalFantasyPathSheet } from "./sheets/path-sheet.mjs"
|
||||||
|
export { default as LethalFantasyTalentSheet } from "./sheets/talent-sheet.mjs"
|
||||||
|
export { default as LethalFantasyWeaponSheet } from "./sheets/weapon-sheet.mjs"
|
||||||
|
export { default as LethalFantasyArmorSheet } from "./sheets/armor-sheet.mjs"
|
||||||
|
export { default as LethalFantasySpellSheet } from "./sheets/spell-sheet.mjs"
|
||||||
|
export { default as LethalFantasyAttackSheet } from "./sheets/attack-sheet.mjs"
|
||||||
|
export { default as LethalFantasyFortune } from "./fortune.mjs"
|
||||||
|
export { default as LethalFantasyManager } from "./manager.mjs"
|
156
module/applications/fortune.mjs
Normal file
156
module/applications/fortune.mjs
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
|
||||||
|
import { SYSTEM } from "../config/system.mjs"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An application for configuring the permissions which are available to each User role.
|
||||||
|
* @extends ApplicationV2
|
||||||
|
* @mixes HandlebarsApplication
|
||||||
|
* @alias PermissionConfig
|
||||||
|
*/
|
||||||
|
export default class LethalFantasyFortune extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
/** @inheritDoc */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
id: "tenebris-application-fortune",
|
||||||
|
tag: "form",
|
||||||
|
window: {
|
||||||
|
contentClasses: ["tenebris-fortune"],
|
||||||
|
title: "TENEBRIS.Fortune.title",
|
||||||
|
controls: [],
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
width: 200,
|
||||||
|
height: 200,
|
||||||
|
top: 80,
|
||||||
|
left: 150,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
closeOnSubmit: true,
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
fortune: LethalFantasyFortune.#requestFortune,
|
||||||
|
increaseFortune: LethalFantasyFortune.#increaseFortune,
|
||||||
|
decreaseFortune: LethalFantasyFortune.#decreaseFortune,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
_getHeaderControls() {
|
||||||
|
const controls = []
|
||||||
|
if (game.user.isGM) {
|
||||||
|
controls.push(
|
||||||
|
{
|
||||||
|
action: "increaseFortune",
|
||||||
|
icon: "fa fa-plus",
|
||||||
|
label: "Augmenter",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: "decreaseFortune",
|
||||||
|
icon: "fa fa-minus",
|
||||||
|
label: "Diminuer",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return controls
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/fortune.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Rendering */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext(_options = {}) {
|
||||||
|
return {
|
||||||
|
fortune: game.settings.get("tenebris", "fortune"),
|
||||||
|
userId: game.user.id,
|
||||||
|
isGM: game.user.isGM,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the request for a fortune.
|
||||||
|
*
|
||||||
|
* @param {Event} event The event that triggered the request.
|
||||||
|
* @param {Object} target The target object for the request.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static #requestFortune(event, target) {
|
||||||
|
console.debug("request Fortune, event, target")
|
||||||
|
game.socket.emit(`system.${SYSTEM.id}`, {
|
||||||
|
action: "fortune",
|
||||||
|
data: {
|
||||||
|
userId: game.user.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #increaseFortune(event, target) {
|
||||||
|
console.log("increase Fortune", event, target)
|
||||||
|
const currentValue = game.settings.get("tenebris", "fortune")
|
||||||
|
const newValue = currentValue + 1
|
||||||
|
await game.settings.set("tenebris", "fortune", newValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #decreaseFortune(event, target) {
|
||||||
|
console.log("decrease Fortune", event, target)
|
||||||
|
const currentValue = game.settings.get("tenebris", "fortune")
|
||||||
|
if (currentValue > 0) {
|
||||||
|
const newValue = currentValue - 1
|
||||||
|
await game.settings.set("tenebris", "fortune", newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the fortune spcket event for a given user.
|
||||||
|
*
|
||||||
|
* @param {Object} [options] The options object.
|
||||||
|
* @param {string} [options.userId] The ID of the user.
|
||||||
|
* @returns {Promise<ChatMessage>} - The created chat message.
|
||||||
|
*/
|
||||||
|
static async handleSocketEvent({ userId } = {}) {
|
||||||
|
console.debug(`handleSocketEvent Fortune from ${userId} !`)
|
||||||
|
const origin = game.users.get(userId)
|
||||||
|
const chatData = {
|
||||||
|
name: origin.name,
|
||||||
|
actingCharImg: origin.character?.img,
|
||||||
|
origin: origin,
|
||||||
|
user: game.user,
|
||||||
|
isGM: game.user.isGM,
|
||||||
|
}
|
||||||
|
const content = await renderTemplate("systems/fvtt-lethal-fantasy/templates/chat-fortune.hbs", chatData)
|
||||||
|
const messageData = {
|
||||||
|
style: CONST.CHAT_MESSAGE_STYLES.OTHER,
|
||||||
|
user: origin,
|
||||||
|
speaker: { user: origin },
|
||||||
|
content: content,
|
||||||
|
flags: { tenebris: { typeMessage: "fortune", accepted: false } },
|
||||||
|
}
|
||||||
|
ChatMessage.applyRollMode(messageData, CONST.DICE_ROLL_MODES.PRIVATE)
|
||||||
|
return ChatMessage.implementation.create(messageData)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the acceptance of a request event in the chat message by the GM
|
||||||
|
*
|
||||||
|
* @param {Event} event The event object that triggered the request.
|
||||||
|
* @param {HTMLElement} html The HTML element associated with the event.
|
||||||
|
* @param {Object} data Additional data related to the event.
|
||||||
|
* @returns {Promise<void>} A promise that resolves when the request has been processed.
|
||||||
|
*/
|
||||||
|
static async acceptRequest(event, html, data) {
|
||||||
|
console.debug("acceptRequest Fortune", event, html, data)
|
||||||
|
const currentValue = game.settings.get("tenebris", "fortune")
|
||||||
|
if (currentValue > 0) {
|
||||||
|
const newValue = currentValue - 1
|
||||||
|
await game.settings.set("tenebris", "fortune", newValue)
|
||||||
|
}
|
||||||
|
let message = game.messages.get(data.message._id)
|
||||||
|
message.update({ "flags.tenebris.accepted": true })
|
||||||
|
}
|
||||||
|
}
|
142
module/applications/manager.mjs
Normal file
142
module/applications/manager.mjs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
|
||||||
|
import { SYSTEM } from "../config/system.mjs"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An application for configuring the permissions which are available to each User role.
|
||||||
|
* @extends ApplicationV2
|
||||||
|
* @mixes HandlebarsApplication
|
||||||
|
* @alias PermissionConfig
|
||||||
|
*/
|
||||||
|
export default class LethalFantasyManager extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
id: "tenebris-application-manager",
|
||||||
|
tag: "form",
|
||||||
|
window: {
|
||||||
|
contentClasses: ["tenebris-manager"],
|
||||||
|
title: "TENEBRIS.Manager.title",
|
||||||
|
resizable: true,
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
width: "auto",
|
||||||
|
height: "auto",
|
||||||
|
top: 80,
|
||||||
|
left: 400,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
closeOnSubmit: true,
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
resourceAll: LethalFantasyManager.#onResourceAll,
|
||||||
|
resourceOne: LethalFantasyManager.#onResourceOne,
|
||||||
|
saveAll: LethalFantasyManager.#onSaveAll,
|
||||||
|
saveOne: LethalFantasyManager.#onSaveOne,
|
||||||
|
openSheet: LethalFantasyManager.#onOpenSheet,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/manager.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Rendering */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext(_options = {}) {
|
||||||
|
return {
|
||||||
|
players: game.users.filter((u) => u.hasPlayerOwner && u.active),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #onResourceAll(event, target) {
|
||||||
|
const value = event.target.dataset.resource
|
||||||
|
LethalFantasyManager.askRollForAll("resource", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #onSaveAll(event, target) {
|
||||||
|
const value = event.target.dataset.save
|
||||||
|
LethalFantasyManager.askRollForAll("save", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
static #onResourceOne(event, target) {
|
||||||
|
const value = event.target.dataset.resource
|
||||||
|
const recipient = event.target.parentElement.dataset.userId
|
||||||
|
const name = event.target.parentElement.dataset.characterName
|
||||||
|
LethalFantasyManager.askRollForOne("resource", value, recipient, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #onSaveOne(event, target) {
|
||||||
|
const value = event.target.dataset.save
|
||||||
|
const recipient = event.target.parentElement.dataset.userId
|
||||||
|
const name = event.target.parentElement.dataset.characterName
|
||||||
|
LethalFantasyManager.askRollForOne("save", value, recipient, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
static #onOpenSheet(event, target) {
|
||||||
|
const characterId = event.target.dataset.characterId
|
||||||
|
game.actors.get(characterId).sheet.render(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
static async askRollForAll(type, value, title = null, avantage = null) {
|
||||||
|
let label = game.i18n.localize(`TENEBRIS.Manager.${value}`)
|
||||||
|
let text = game.i18n.format("TENEBRIS.Chat.askRollForAll", { value: label })
|
||||||
|
|
||||||
|
if (avantage) {
|
||||||
|
switch (avantage) {
|
||||||
|
case "++":
|
||||||
|
text += ` ${game.i18n.localize("TENEBRIS.Roll.doubleAvantage")}`
|
||||||
|
break
|
||||||
|
case "+":
|
||||||
|
text += ` ${game.i18n.localize("TENEBRIS.Roll.avantage")}`
|
||||||
|
break
|
||||||
|
case "-":
|
||||||
|
text += ` ${game.i18n.localize("TENEBRIS.Roll.desavantage")}`
|
||||||
|
break
|
||||||
|
case "--":
|
||||||
|
text += ` ${game.i18n.localize("TENEBRIS.Roll.doubleDesavantage")}`
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatMessage.create({
|
||||||
|
user: game.user.id,
|
||||||
|
content: await renderTemplate(`systems/fvtt-lethal-fantasy/templates/chat-ask-roll.hbs`, {
|
||||||
|
title: title !== null ? title : "",
|
||||||
|
text: text,
|
||||||
|
rollType: type,
|
||||||
|
value: value,
|
||||||
|
avantage: avantage,
|
||||||
|
}),
|
||||||
|
flags: { tenebris: { typeMessage: "askRoll" } },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
static async askRollForOne(type, value, recipient, name) {
|
||||||
|
let label = game.i18n.localize(`TENEBRIS.Manager.${value}`)
|
||||||
|
const text = game.i18n.format("TENEBRIS.Chat.askRollForOne", { value: label, name: name })
|
||||||
|
|
||||||
|
game.socket.emit(`system.${SYSTEM.id}`, {
|
||||||
|
action: "askRoll",
|
||||||
|
data: {
|
||||||
|
userId: recipient,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
ChatMessage.create({
|
||||||
|
user: game.user.id,
|
||||||
|
content: await renderTemplate(`systems/fvtt-lethal-fantasy/templates/chat-ask-roll.hbs`, {
|
||||||
|
text: text,
|
||||||
|
rollType: type,
|
||||||
|
value: value,
|
||||||
|
}),
|
||||||
|
whisper: [recipient],
|
||||||
|
flags: { tenebris: { typeMessage: "askRoll" } },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
27
module/applications/sheets/armor-sheet.mjs
Normal file
27
module/applications/sheets/armor-sheet.mjs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyArmorSheet extends LethalFantasyItemSheet {
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["armor"],
|
||||||
|
position: {
|
||||||
|
width: 400,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["armor-content"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/armor.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = await super._prepareContext()
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
}
|
27
module/applications/sheets/attack-sheet.mjs
Normal file
27
module/applications/sheets/attack-sheet.mjs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyAttackSheet extends LethalFantasyItemSheet {
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["attack"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["attack-content"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/attack.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = await super._prepareContext()
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
}
|
292
module/applications/sheets/base-actor-sheet.mjs
Normal file
292
module/applications/sheets/base-actor-sheet.mjs
Normal file
@ -0,0 +1,292 @@
|
|||||||
|
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||||
|
|
||||||
|
export default class LethalFantasyActorSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ActorSheetV2) {
|
||||||
|
/**
|
||||||
|
* Different sheet modes.r
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||||
|
|
||||||
|
constructor(options = {}) {
|
||||||
|
super(options)
|
||||||
|
this.#dragDrop = this.#createDragDropHandlers()
|
||||||
|
}
|
||||||
|
|
||||||
|
#dragDrop
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["tenebris", "actor"],
|
||||||
|
position: {
|
||||||
|
width: 1400,
|
||||||
|
height: "auto",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
resizable: true,
|
||||||
|
},
|
||||||
|
dragDrop: [{ dragSelector: '[data-drag="true"], .rollable', dropSelector: null }],
|
||||||
|
actions: {
|
||||||
|
editImage: LethalFantasyActorSheet.#onEditImage,
|
||||||
|
toggleSheet: LethalFantasyActorSheet.#onToggleSheet,
|
||||||
|
edit: LethalFantasyActorSheet.#onItemEdit,
|
||||||
|
delete: LethalFantasyActorSheet.#onItemDelete,
|
||||||
|
createSpell: LethalFantasyActorSheet.#onCreateSpell,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current sheet mode.
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
_sheetMode = this.constructor.SHEET_MODES.PLAY
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the sheet currently in 'Play' mode?
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
get isPlayMode() {
|
||||||
|
return this._sheetMode === this.constructor.SHEET_MODES.PLAY
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the sheet currently in 'Edit' mode?
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
get isEditMode() {
|
||||||
|
return this._sheetMode === this.constructor.SHEET_MODES.EDIT
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = {
|
||||||
|
fields: this.document.schema.fields,
|
||||||
|
systemFields: this.document.system.schema.fields,
|
||||||
|
actor: this.document,
|
||||||
|
system: this.document.system,
|
||||||
|
source: this.document.toObject(),
|
||||||
|
enrichedDescription: await TextEditor.enrichHTML(this.document.system.description, { async: true }),
|
||||||
|
isEditMode: this.isEditMode,
|
||||||
|
isPlayMode: this.isPlayMode,
|
||||||
|
isEditable: this.isEditable,
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
_onRender(context, options) {
|
||||||
|
this.#dragDrop.forEach((d) => d.bind(this.element))
|
||||||
|
// Add listeners to rollable elements
|
||||||
|
const rollables = this.element.querySelectorAll(".rollable")
|
||||||
|
rollables.forEach((d) => d.addEventListener("click", this._onRoll.bind(this)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// #region Drag-and-Drop Workflow
|
||||||
|
/**
|
||||||
|
* Create drag-and-drop workflow handlers for this Application
|
||||||
|
* @returns {DragDrop[]} An array of DragDrop handlers
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
#createDragDropHandlers() {
|
||||||
|
return this.options.dragDrop.map((d) => {
|
||||||
|
d.permissions = {
|
||||||
|
dragstart: this._canDragStart.bind(this),
|
||||||
|
drop: this._canDragDrop.bind(this),
|
||||||
|
}
|
||||||
|
d.callbacks = {
|
||||||
|
dragstart: this._onDragStart.bind(this),
|
||||||
|
dragover: this._onDragOver.bind(this),
|
||||||
|
drop: this._onDrop.bind(this),
|
||||||
|
}
|
||||||
|
return new DragDrop(d)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to begin a dragstart workflow for a given drag selector
|
||||||
|
* @param {string} selector The candidate HTML selector for dragging
|
||||||
|
* @returns {boolean} Can the current user drag this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragStart(selector) {
|
||||||
|
return this.isEditable
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector
|
||||||
|
* @param {string} selector The candidate HTML selector for the drop target
|
||||||
|
* @returns {boolean} Can the current user drop on this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragDrop(selector) {
|
||||||
|
return this.isEditable && this.document.isOwner
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur at the beginning of a drag start workflow.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragStart(event) {
|
||||||
|
if ("link" in event.target.dataset) return
|
||||||
|
|
||||||
|
const el = event.currentTarget.closest('[data-drag="true"]')
|
||||||
|
const dragType = el.dataset.dragType
|
||||||
|
|
||||||
|
let dragData = {}
|
||||||
|
|
||||||
|
let target
|
||||||
|
switch (dragType) {
|
||||||
|
case "save":
|
||||||
|
target = event.currentTarget.querySelector("input")
|
||||||
|
dragData = {
|
||||||
|
actorId: this.document.id,
|
||||||
|
type: "roll",
|
||||||
|
rollType: target.dataset.rollType,
|
||||||
|
rollTarget: target.dataset.rollTarget,
|
||||||
|
value: target.value,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "resource":
|
||||||
|
target = event.currentTarget.querySelector("select")
|
||||||
|
dragData = {
|
||||||
|
actorId: this.document.id,
|
||||||
|
type: "roll",
|
||||||
|
rollType: target.dataset.rollType,
|
||||||
|
rollTarget: target.dataset.rollTarget,
|
||||||
|
value: target.value,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "damage":
|
||||||
|
dragData = {
|
||||||
|
actorId: this.document.id,
|
||||||
|
type: "rollDamage",
|
||||||
|
rollType: el.dataset.dragType,
|
||||||
|
rollTarget: el.dataset.itemId,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "attack":
|
||||||
|
dragData = {
|
||||||
|
actorId: this.document.id,
|
||||||
|
type: "rollAttack",
|
||||||
|
rollValue: el.dataset.rollValue,
|
||||||
|
rollTarget: el.dataset.rollTarget,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
// Handle other cases or do nothing
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract the data you need
|
||||||
|
|
||||||
|
if (!dragData) return
|
||||||
|
|
||||||
|
// Set data transfer
|
||||||
|
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is over a drop target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragOver(event) {}
|
||||||
|
|
||||||
|
async _onDropItem(item) {
|
||||||
|
let itemData = item.toObject()
|
||||||
|
await this.document.createEmbeddedDocuments("Item", [itemData], { renderSheet: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Actions
|
||||||
|
/**
|
||||||
|
* Handle toggling between Edit and Play mode.
|
||||||
|
* @param {Event} event The initiating click event.
|
||||||
|
* @param {HTMLElement} target The current target of the event listener.
|
||||||
|
*/
|
||||||
|
static #onToggleSheet(event, target) {
|
||||||
|
const modes = this.constructor.SHEET_MODES
|
||||||
|
this._sheetMode = this.isEditMode ? modes.PLAY : modes.EDIT
|
||||||
|
this.render()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle changing a Document's image.
|
||||||
|
*
|
||||||
|
* @this LethalFantasyCharacterSheet
|
||||||
|
* @param {PointerEvent} event The originating click event
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action]
|
||||||
|
* @returns {Promise}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #onEditImage(event, target) {
|
||||||
|
const attr = target.dataset.edit
|
||||||
|
const current = foundry.utils.getProperty(this.document, attr)
|
||||||
|
const { img } = this.document.constructor.getDefaultArtwork?.(this.document.toObject()) ?? {}
|
||||||
|
const fp = new FilePicker({
|
||||||
|
current,
|
||||||
|
type: "image",
|
||||||
|
redirectToRoot: img ? [img] : [],
|
||||||
|
callback: (path) => {
|
||||||
|
this.document.update({ [attr]: path })
|
||||||
|
},
|
||||||
|
top: this.position.top + 40,
|
||||||
|
left: this.position.left + 10,
|
||||||
|
})
|
||||||
|
return fp.browse()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit an existing item within the Actor
|
||||||
|
* Start with the uuid, if it's not found, fallback to the id (as Embedded item in the actor)
|
||||||
|
* @this LethalFantasyCharacterSheet
|
||||||
|
* @param {PointerEvent} event The originating click event
|
||||||
|
* @param {HTMLElement} target the capturing HTML element which defined a [data-action]
|
||||||
|
*/
|
||||||
|
static async #onItemEdit(event, target) {
|
||||||
|
const id = target.getAttribute("data-item-id")
|
||||||
|
const uuid = target.getAttribute("data-item-uuid")
|
||||||
|
let item
|
||||||
|
item = await fromUuid(uuid)
|
||||||
|
if (!item) item = this.document.items.get(id)
|
||||||
|
if (!item) return
|
||||||
|
item.sheet.render(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an existing talent within the Actor
|
||||||
|
* Use the uuid to display the talent sheet
|
||||||
|
* @param {PointerEvent} event The originating click event
|
||||||
|
* @param {HTMLElement} target the capturing HTML element which defined a [data-action]
|
||||||
|
*/
|
||||||
|
static async #onItemDelete(event, target) {
|
||||||
|
const itemUuid = target.getAttribute("data-item-uuid")
|
||||||
|
const talent = await fromUuid(itemUuid)
|
||||||
|
await talent.deleteDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the creation of a new attack item.
|
||||||
|
*
|
||||||
|
* @param {Event} event The event that triggered the creation of the attack.
|
||||||
|
* @param {Object} target The target object where the attack will be created.
|
||||||
|
* @private
|
||||||
|
* @static
|
||||||
|
*/
|
||||||
|
static #onCreateSpell(event, target) {
|
||||||
|
const item = this.document.createEmbeddedDocuments("Item", [{ name: "Nouveau sortilège", type: "spell" }])
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
}
|
193
module/applications/sheets/base-item-sheet.mjs
Normal file
193
module/applications/sheets/base-item-sheet.mjs
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||||
|
|
||||||
|
export default class LethalFantasyItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
|
||||||
|
/**
|
||||||
|
* Different sheet modes.
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||||
|
|
||||||
|
constructor(options = {}) {
|
||||||
|
super(options)
|
||||||
|
this.#dragDrop = this.#createDragDropHandlers()
|
||||||
|
}
|
||||||
|
|
||||||
|
#dragDrop
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["tenebris", "item"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
height: "auto",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
resizable: true,
|
||||||
|
},
|
||||||
|
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
|
||||||
|
actions: {
|
||||||
|
toggleSheet: LethalFantasyItemSheet.#onToggleSheet,
|
||||||
|
editImage: LethalFantasyItemSheet.#onEditImage,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current sheet mode.
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
_sheetMode = this.constructor.SHEET_MODES.PLAY
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the sheet currently in 'Play' mode?
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
get isPlayMode() {
|
||||||
|
return this._sheetMode === this.constructor.SHEET_MODES.PLAY
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the sheet currently in 'Edit' mode?
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
get isEditMode() {
|
||||||
|
return this._sheetMode === this.constructor.SHEET_MODES.EDIT
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = {
|
||||||
|
fields: this.document.schema.fields,
|
||||||
|
systemFields: this.document.system.schema.fields,
|
||||||
|
item: this.document,
|
||||||
|
system: this.document.system,
|
||||||
|
source: this.document.toObject(),
|
||||||
|
enrichedDescription: await TextEditor.enrichHTML(this.document.system.description, { async: true }),
|
||||||
|
isEditMode: this.isEditMode,
|
||||||
|
isPlayMode: this.isPlayMode,
|
||||||
|
isEditable: this.isEditable,
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
_onRender(context, options) {
|
||||||
|
this.#dragDrop.forEach((d) => d.bind(this.element))
|
||||||
|
}
|
||||||
|
|
||||||
|
// #region Drag-and-Drop Workflow
|
||||||
|
/**
|
||||||
|
* Create drag-and-drop workflow handlers for this Application
|
||||||
|
* @returns {DragDrop[]} An array of DragDrop handlers
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
#createDragDropHandlers() {
|
||||||
|
return this.options.dragDrop.map((d) => {
|
||||||
|
d.permissions = {
|
||||||
|
dragstart: this._canDragStart.bind(this),
|
||||||
|
drop: this._canDragDrop.bind(this),
|
||||||
|
}
|
||||||
|
d.callbacks = {
|
||||||
|
dragstart: this._onDragStart.bind(this),
|
||||||
|
dragover: this._onDragOver.bind(this),
|
||||||
|
drop: this._onDrop.bind(this),
|
||||||
|
}
|
||||||
|
return new DragDrop(d)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to begin a dragstart workflow for a given drag selector
|
||||||
|
* @param {string} selector The candidate HTML selector for dragging
|
||||||
|
* @returns {boolean} Can the current user drag this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragStart(selector) {
|
||||||
|
return this.isEditable
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector
|
||||||
|
* @param {string} selector The candidate HTML selector for the drop target
|
||||||
|
* @returns {boolean} Can the current user drop on this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragDrop(selector) {
|
||||||
|
return this.isEditable && this.document.isOwner
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur at the beginning of a drag start workflow.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragStart(event) {
|
||||||
|
const el = event.currentTarget
|
||||||
|
if ("link" in event.target.dataset) return
|
||||||
|
|
||||||
|
// Extract the data you need
|
||||||
|
let dragData = null
|
||||||
|
|
||||||
|
if (!dragData) return
|
||||||
|
|
||||||
|
// Set data transfer
|
||||||
|
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is over a drop target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragOver(event) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {}
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Actions
|
||||||
|
/**
|
||||||
|
* Handle toggling between Edit and Play mode.
|
||||||
|
* @param {Event} event The initiating click event.
|
||||||
|
* @param {HTMLElement} target The current target of the event listener.
|
||||||
|
*/
|
||||||
|
static #onToggleSheet(event, target) {
|
||||||
|
const modes = this.constructor.SHEET_MODES
|
||||||
|
this._sheetMode = this.isEditMode ? modes.PLAY : modes.EDIT
|
||||||
|
this.render()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle changing a Document's image.
|
||||||
|
*
|
||||||
|
* @this LethalFantasyCharacterSheet
|
||||||
|
* @param {PointerEvent} event The originating click event
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action]
|
||||||
|
* @returns {Promise}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #onEditImage(event, target) {
|
||||||
|
const attr = target.dataset.edit
|
||||||
|
const current = foundry.utils.getProperty(this.document, attr)
|
||||||
|
const { img } = this.document.constructor.getDefaultArtwork?.(this.document.toObject()) ?? {}
|
||||||
|
const fp = new FilePicker({
|
||||||
|
current,
|
||||||
|
type: "image",
|
||||||
|
redirectToRoot: img ? [img] : [],
|
||||||
|
callback: (path) => {
|
||||||
|
this.document.update({ [attr]: path })
|
||||||
|
},
|
||||||
|
top: this.position.top + 40,
|
||||||
|
left: this.position.left + 10,
|
||||||
|
})
|
||||||
|
return fp.browse()
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
}
|
341
module/applications/sheets/character-sheet.mjs
Normal file
341
module/applications/sheets/character-sheet.mjs
Normal file
@ -0,0 +1,341 @@
|
|||||||
|
import LethalFantasyActorSheet from "./base-actor-sheet.mjs"
|
||||||
|
import { ROLL_TYPE } from "../../config/system.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet {
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["character"],
|
||||||
|
position: {
|
||||||
|
width: 1150,
|
||||||
|
height: 780,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["character-content"],
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
deleteVoieMajeure: LethalFantasyCharacterSheet.#onDeleteVoieMajeure,
|
||||||
|
deleteVoieMineure: LethalFantasyCharacterSheet.#onDeleteVoieMineure,
|
||||||
|
createEquipment: LethalFantasyCharacterSheet.#onCreateEquipment,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/character-main.hbs",
|
||||||
|
},
|
||||||
|
tabs: {
|
||||||
|
template: "templates/generic/tab-navigation.hbs",
|
||||||
|
},
|
||||||
|
items: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/character-items.hbs",
|
||||||
|
},
|
||||||
|
biography: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/character-biography.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
tabGroups = {
|
||||||
|
sheet: "items",
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare an array of form header tabs.
|
||||||
|
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||||
|
*/
|
||||||
|
#getTabs() {
|
||||||
|
const tabs = {
|
||||||
|
items: { id: "items", group: "sheet", icon: "fa-solid fa-shapes", label: "TENEBRIS.Character.Label.details" },
|
||||||
|
biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "TENEBRIS.Character.Label.biography" },
|
||||||
|
}
|
||||||
|
for (const v of Object.values(tabs)) {
|
||||||
|
v.active = this.tabGroups[v.group] === v.id
|
||||||
|
v.cssClass = v.active ? "active" : ""
|
||||||
|
}
|
||||||
|
return tabs
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = await super._prepareContext()
|
||||||
|
context.tabs = this.#getTabs()
|
||||||
|
|
||||||
|
context.tooltipsCaracteristiques = {
|
||||||
|
rob: this._generateTooltip("save", "rob"),
|
||||||
|
dex: this._generateTooltip("save", "dex"),
|
||||||
|
int: this._generateTooltip("save", "int"),
|
||||||
|
per: this._generateTooltip("save", "per"),
|
||||||
|
vol: this._generateTooltip("save", "vol"),
|
||||||
|
dmax: this._generateTooltip("other", "dmax"),
|
||||||
|
}
|
||||||
|
|
||||||
|
context.tooltipsRessources = {
|
||||||
|
san: this._generateTooltip("resource", "san"),
|
||||||
|
oeil: this._generateTooltip("resource", "oeil"),
|
||||||
|
verbe: this._generateTooltip("resource", "verbe"),
|
||||||
|
bourse: this._generateTooltip("resource", "bourse"),
|
||||||
|
magie: this._generateTooltip("resource", "magie"),
|
||||||
|
}
|
||||||
|
|
||||||
|
context.rollType = {
|
||||||
|
saveRob: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "save",
|
||||||
|
rollTarget: "rob",
|
||||||
|
tooltip: this._generateTooltip("save", "rob"),
|
||||||
|
},
|
||||||
|
saveDex: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "save",
|
||||||
|
rollTarget: "dex",
|
||||||
|
tooltip: this._generateTooltip("save", "dex"),
|
||||||
|
},
|
||||||
|
saveInt: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "save",
|
||||||
|
rollTarget: "int",
|
||||||
|
tooltip: this._generateTooltip("save", "int"),
|
||||||
|
},
|
||||||
|
savePer: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "save",
|
||||||
|
rollTarget: "per",
|
||||||
|
tooltip: this._generateTooltip("save", "per"),
|
||||||
|
drag: true,
|
||||||
|
},
|
||||||
|
saveVol: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "save",
|
||||||
|
rollTarget: "vol",
|
||||||
|
tooltip: this._generateTooltip("save", "vol"),
|
||||||
|
drag: true,
|
||||||
|
},
|
||||||
|
resourceSan: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "resource",
|
||||||
|
rollTarget: "san",
|
||||||
|
tooltip: this._generateTooltip("resource", "san"),
|
||||||
|
drag: true,
|
||||||
|
},
|
||||||
|
resourceOeil: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "resource",
|
||||||
|
rollTarget: "oeil",
|
||||||
|
tooltip: this._generateTooltip("resource", "oeil"),
|
||||||
|
drag: true,
|
||||||
|
},
|
||||||
|
resourceVerbe: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "resource",
|
||||||
|
rollTarget: "verbe",
|
||||||
|
tooltip: this._generateTooltip("resource", "verbe"),
|
||||||
|
drag: true,
|
||||||
|
},
|
||||||
|
resourceBourse: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "resource",
|
||||||
|
rollTarget: "bourse",
|
||||||
|
tooltip: this._generateTooltip("resource", "bourse"),
|
||||||
|
drag: true,
|
||||||
|
},
|
||||||
|
resourceMagie: {
|
||||||
|
action: "roll",
|
||||||
|
rollType: "resource",
|
||||||
|
rollTarget: "magie",
|
||||||
|
tooltip: this._generateTooltip("resource", "magie"),
|
||||||
|
drag: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
_generateTooltip(type, target) {
|
||||||
|
if (type === ROLL_TYPE.SAVE) {
|
||||||
|
const progres = this.document.system.caracteristiques[target].progression.progres
|
||||||
|
? game.i18n.localize("TENEBRIS.Label.hasProgressed")
|
||||||
|
: game.i18n.localize("TENEBRIS.Label.noProgress")
|
||||||
|
return `${game.i18n.localize("TENEBRIS.Label.experience")} : ${this.document.system.caracteristiques[target].progression.experience} <br> ${progres}`
|
||||||
|
} else if (type === ROLL_TYPE.RESOURCE) {
|
||||||
|
return `${game.i18n.localize("TENEBRIS.Label.maximum")} : ${this.document.system.ressources[target].max} <br> ${game.i18n.localize("TENEBRIS.Label.experience")} : ${this.document.system.ressources[target].experience}`
|
||||||
|
} else if (type === "other") {
|
||||||
|
return `${game.i18n.localize("TENEBRIS.Label.experience")} : ${this.document.system.dmax.experience}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
const doc = this.document
|
||||||
|
switch (partId) {
|
||||||
|
case "main":
|
||||||
|
context.enrichedBiens = await TextEditor.enrichHTML(doc.system.biens, { async: true })
|
||||||
|
break
|
||||||
|
case "items":
|
||||||
|
context.tab = context.tabs.items
|
||||||
|
const talents = await this._prepareTalents()
|
||||||
|
context.talents = talents
|
||||||
|
context.talentsAppris = talents.filter((talent) => talent.appris)
|
||||||
|
context.weapons = doc.itemTypes.weapon
|
||||||
|
context.armors = doc.itemTypes.armor
|
||||||
|
context.spells = doc.itemTypes.spell
|
||||||
|
context.hasSpells = context.spells.length > 0
|
||||||
|
break
|
||||||
|
case "biography":
|
||||||
|
context.tab = context.tabs.biography
|
||||||
|
context.enrichedDescription = await TextEditor.enrichHTML(doc.system.description, { async: true })
|
||||||
|
context.enrichedLangues = await TextEditor.enrichHTML(doc.system.langues, { async: true })
|
||||||
|
context.enrichedNotes = await TextEditor.enrichHTML(doc.system.notes, { async: true })
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the talents for the character sheet.
|
||||||
|
*
|
||||||
|
* @returns {Array} An array of talents with their properties.
|
||||||
|
*/
|
||||||
|
async _prepareTalents() {
|
||||||
|
const talents = await Promise.all(
|
||||||
|
this.document.itemTypes.talent.map(async (talent) => {
|
||||||
|
const pathName = await talent.system.getPathName()
|
||||||
|
return {
|
||||||
|
id: talent.id,
|
||||||
|
uuid: talent.uuid,
|
||||||
|
name: talent.name,
|
||||||
|
img: talent.img,
|
||||||
|
path: `Obtenu par ${pathName}`,
|
||||||
|
description: talent.system.improvedDescription,
|
||||||
|
progression: talent.system.progression,
|
||||||
|
niveau: talent.system.niveau,
|
||||||
|
appris: talent.system.appris,
|
||||||
|
details: talent.system.details,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
talents.sort((a, b) => b.appris - a.appris || a.name.localeCompare(b.name, game.i18n.lang))
|
||||||
|
return talents
|
||||||
|
}
|
||||||
|
|
||||||
|
// #region Drag-and-Drop Workflow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {
|
||||||
|
if (!this.isEditable || !this.isEditMode) return
|
||||||
|
const data = TextEditor.getDragEventData(event)
|
||||||
|
|
||||||
|
// Handle different data types
|
||||||
|
switch (data.type) {
|
||||||
|
case "Item":
|
||||||
|
const item = await fromUuid(data.uuid)
|
||||||
|
if (!["path", "weapon", "armor", "spell"].includes(item.type)) return
|
||||||
|
if (item.type === "path") return this.#onDropPathItem(item)
|
||||||
|
if (item.type === "weapon") return super._onDropItem(item)
|
||||||
|
if (item.type === "armor") return this._onDropItem(item)
|
||||||
|
if (item.type === "spell") return this._onDropItem(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async #onDropPathItem(item) {
|
||||||
|
await this.document.addPath(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Actions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suppression de la voie majeure
|
||||||
|
* @param {Event} event The initiating click event.
|
||||||
|
* @param {HTMLElement} target The current target of the event listener.
|
||||||
|
*/
|
||||||
|
static async #onDeleteVoieMajeure(event, target) {
|
||||||
|
const proceed = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
content: game.i18n.localize("TENEBRIS.Dialog.suppressionTalents"),
|
||||||
|
rejectClose: false,
|
||||||
|
modal: true,
|
||||||
|
})
|
||||||
|
if (!proceed) return
|
||||||
|
const path = this.document.items.get(this.document.system.voies.majeure.id)
|
||||||
|
if (!path) return
|
||||||
|
await this.document.deletePath(path, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suppression de la voie mineure
|
||||||
|
* @param {Event} event The initiating click event.
|
||||||
|
* @param {HTMLElement} target The current target of the event listener.
|
||||||
|
*/
|
||||||
|
static async #onDeleteVoieMineure(event, target) {
|
||||||
|
const proceed = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
content: game.i18n.localize("TENEBRIS.Dialog.suppressionTalents"),
|
||||||
|
rejectClose: false,
|
||||||
|
modal: true,
|
||||||
|
})
|
||||||
|
if (!proceed) return
|
||||||
|
const path = this.document.items.get(this.document.system.voies.mineure.id)
|
||||||
|
if (!path) return
|
||||||
|
await this.document.deletePath(path, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new attack item directly from the sheet and embeds it into the document.
|
||||||
|
* @param {Event} event The initiating click event.
|
||||||
|
* @param {HTMLElement} target The current target of the event listener.
|
||||||
|
*/
|
||||||
|
static #onCreateEquipment(event, target) {
|
||||||
|
// Création d'une armure
|
||||||
|
if (event.shiftKey) {
|
||||||
|
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("TENEBRIS.Label.newArmor"), type: "armor" }])
|
||||||
|
}
|
||||||
|
// Création d'une arme
|
||||||
|
else {
|
||||||
|
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("TENEBRIS.Label.newWeapon"), type: "weapon" }])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the roll action triggered by user interaction.
|
||||||
|
*
|
||||||
|
* @param {PointerEvent} event The event object representing the user interaction.
|
||||||
|
* @param {HTMLElement} target The target element that triggered the roll.
|
||||||
|
*
|
||||||
|
* @returns {Promise<void>} A promise that resolves when the roll action is complete.
|
||||||
|
*
|
||||||
|
* @throws {Error} Throws an error if the roll type is not recognized.
|
||||||
|
*
|
||||||
|
* @description This method checks the current mode (edit or not) and determines the type of roll
|
||||||
|
* (save, resource, or damage) based on the target element's data attributes. It retrieves the
|
||||||
|
* corresponding value from the document's system and performs the roll.
|
||||||
|
*/
|
||||||
|
async _onRoll(event, target) {
|
||||||
|
if (this.isEditMode) return
|
||||||
|
// Jet de sauvegarde
|
||||||
|
let elt = event.currentTarget.querySelector("input")
|
||||||
|
// Jet de ressource
|
||||||
|
if (!elt) elt = event.currentTarget.querySelector("select")
|
||||||
|
// Jet de dégâts
|
||||||
|
if (!elt) elt = event.currentTarget
|
||||||
|
const rollType = elt.dataset.rollType
|
||||||
|
let rollTarget
|
||||||
|
switch (rollType) {
|
||||||
|
case ROLL_TYPE.SAVE:
|
||||||
|
rollTarget = elt.dataset.rollTarget
|
||||||
|
break
|
||||||
|
case ROLL_TYPE.RESOURCE:
|
||||||
|
rollTarget = elt.dataset.rollTarget
|
||||||
|
break
|
||||||
|
case ROLL_TYPE.DAMAGE:
|
||||||
|
rollTarget = elt.dataset.itemId
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
await this.document.system.roll(rollType, rollTarget)
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
}
|
89
module/applications/sheets/opponent-sheet.mjs
Normal file
89
module/applications/sheets/opponent-sheet.mjs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
import LethalFantasyActorSheet from "./base-actor-sheet.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyOpponentSheet extends LethalFantasyActorSheet {
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["opponent"],
|
||||||
|
position: {
|
||||||
|
width: 800,
|
||||||
|
height: 700,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["opponent-content"],
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
createAttack: LethalFantasyOpponentSheet.#onCreateAttack,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/opponent.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = await super._prepareContext()
|
||||||
|
context.attacks = context.actor.itemTypes.attack
|
||||||
|
context.spells = context.actor.itemTypes.spell
|
||||||
|
context.hasSpells = context.spells.length > 0
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {
|
||||||
|
if (!this.isEditable || !this.isEditMode) return
|
||||||
|
const data = TextEditor.getDragEventData(event)
|
||||||
|
|
||||||
|
// Handle different data types
|
||||||
|
switch (data.type) {
|
||||||
|
case "Item":
|
||||||
|
const item = await fromUuid(data.uuid)
|
||||||
|
if (item.type === "attack") return this.#onDropAttackItem(item)
|
||||||
|
if (item.type === "spell") return this._onDropItem(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the drop event of an attack item.
|
||||||
|
*
|
||||||
|
* @param {Object} item The attack item being dropped.
|
||||||
|
* @returns {Promise<void>} A promise that resolves when the attack item has been added to the document.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
async #onDropAttackItem(item) {
|
||||||
|
await this.document.addAttack(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the creation of a new attack item.
|
||||||
|
*
|
||||||
|
* @param {Event} event The event that triggered the creation of the attack.
|
||||||
|
* @param {Object} target The target object where the attack will be created.
|
||||||
|
* @private
|
||||||
|
* @static
|
||||||
|
*/
|
||||||
|
static #onCreateAttack(event, target) {
|
||||||
|
const item = this.document.createEmbeddedDocuments("Item", [{ name: "Nouvelle attaque", type: "attack" }])
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll a damage roll.
|
||||||
|
* @param {PointerEvent} event The originating click event
|
||||||
|
* @param {HTMLElement} target the capturing HTML element which defined a [data-action]
|
||||||
|
*/
|
||||||
|
async _onRoll(event, target) {
|
||||||
|
if (this.isEditMode) return
|
||||||
|
const elt = event.currentTarget
|
||||||
|
const rollValue = elt.dataset.rollValue
|
||||||
|
const rollTarget = elt.dataset.itemName
|
||||||
|
|
||||||
|
await this.document.system.roll(rollValue, rollTarget)
|
||||||
|
}
|
||||||
|
}
|
141
module/applications/sheets/path-sheet.mjs
Normal file
141
module/applications/sheets/path-sheet.mjs
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyPathSheet extends LethalFantasyItemSheet {
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["path"],
|
||||||
|
position: {
|
||||||
|
width: 1400,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["path-content"],
|
||||||
|
},
|
||||||
|
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
|
||||||
|
actions: {
|
||||||
|
edit: LethalFantasyPathSheet.#onTalentEdit,
|
||||||
|
delete: LethalFantasyPathSheet.#onTalentDelete,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
header: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/path-header.hbs",
|
||||||
|
},
|
||||||
|
tabs: {
|
||||||
|
template: "templates/generic/tab-navigation.hbs",
|
||||||
|
},
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/path-main.hbs",
|
||||||
|
},
|
||||||
|
talents: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/path-talents.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
tabGroups = {
|
||||||
|
sheet: "main",
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare an array of form header tabs.
|
||||||
|
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||||
|
*/
|
||||||
|
#getTabs() {
|
||||||
|
const tabs = {
|
||||||
|
main: { id: "main", group: "sheet", icon: "fa-solid fa-user", label: "TENEBRIS.Label.profil" },
|
||||||
|
talents: { id: "talents", group: "sheet", icon: "fa-solid fa-book", label: "TENEBRIS.Label.talents" },
|
||||||
|
}
|
||||||
|
for (const v of Object.values(tabs)) {
|
||||||
|
v.active = this.tabGroups[v.group] === v.id
|
||||||
|
v.cssClass = v.active ? "active" : ""
|
||||||
|
}
|
||||||
|
return tabs
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = await super._prepareContext()
|
||||||
|
context.tabs = this.#getTabs()
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
const doc = this.document
|
||||||
|
switch (partId) {
|
||||||
|
case "main":
|
||||||
|
context.tab = context.tabs.main
|
||||||
|
context.enrichedBiens = await TextEditor.enrichHTML(this.document.system.biens, { async: true })
|
||||||
|
context.enrichedLangues = await TextEditor.enrichHTML(this.document.system.langues, { async: true })
|
||||||
|
break
|
||||||
|
case "talents":
|
||||||
|
context.tab = context.tabs.talents
|
||||||
|
const talentItems = []
|
||||||
|
for (const talent of this.item.system.talents) {
|
||||||
|
const talentItem = await fromUuid(talent)
|
||||||
|
if (talentItem) talentItems.push(talentItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
context.talents = talentItems
|
||||||
|
context.talents.sort((a, b) => a.name.localeCompare(b.name, game.i18n.lang))
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* Seul un item de type Talent peut être déposé sur une voie.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {
|
||||||
|
const data = TextEditor.getDragEventData(event)
|
||||||
|
|
||||||
|
switch (data.type) {
|
||||||
|
case "Item":
|
||||||
|
if (this.isPlayMode) return
|
||||||
|
const item = await fromUuid(data.uuid)
|
||||||
|
if (item.type !== "talent") return
|
||||||
|
|
||||||
|
console.debug("dropped item", item)
|
||||||
|
const talents = this.item.toObject().system.talents
|
||||||
|
talents.push(item.uuid)
|
||||||
|
this.item.update({ "system.talents": talents })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// #region Actions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit an existing talent within the path item
|
||||||
|
* Use the uuid to display the talent sheet (from world or compendium)
|
||||||
|
* @param {PointerEvent} event The originating click event
|
||||||
|
* @param {HTMLElement} target the capturing HTML element which defined a [data-action]
|
||||||
|
*/
|
||||||
|
static async #onTalentEdit(event, target) {
|
||||||
|
const itemUuid = target.getAttribute("data-item-uuid")
|
||||||
|
const talent = await fromUuid(itemUuid)
|
||||||
|
talent.sheet.render(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an existing talent within the path item
|
||||||
|
* Use the uuid to remove it form the array of talents
|
||||||
|
* @param {PointerEvent} event The originating click event
|
||||||
|
* @param {HTMLElement} target the capturing HTML element which defined a [data-action]
|
||||||
|
*/
|
||||||
|
static async #onTalentDelete(event, target) {
|
||||||
|
const itemUuid = target.getAttribute("data-item-uuid")
|
||||||
|
|
||||||
|
const talents = this.item.toObject().system.talents
|
||||||
|
const index = talents.indexOf(itemUuid)
|
||||||
|
talents.splice(index, 1)
|
||||||
|
this.item.update({ "system.talents": talents })
|
||||||
|
}
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
}
|
21
module/applications/sheets/spell-sheet.mjs
Normal file
21
module/applications/sheets/spell-sheet.mjs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasySpellSheet extends LethalFantasyItemSheet {
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["spell"],
|
||||||
|
position: {
|
||||||
|
width: 450,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["spell-content"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/spell.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
29
module/applications/sheets/talent-sheet.mjs
Normal file
29
module/applications/sheets/talent-sheet.mjs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyTalentSheet extends LethalFantasyItemSheet {
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["talent"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["talent-content"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/talent.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = await super._prepareContext()
|
||||||
|
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.improvedDescription, { async: true })
|
||||||
|
context.canProgress = this.document.system.canProgress
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
}
|
21
module/applications/sheets/weapon-sheet.mjs
Normal file
21
module/applications/sheets/weapon-sheet.mjs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyWeaponSheet extends LethalFantasyItemSheet {
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["weapon"],
|
||||||
|
position: {
|
||||||
|
width: 400,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["weapon-content"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/fvtt-lethal-fantasy/templates/weapon.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
5
module/config/armor.mjs
Normal file
5
module/config/armor.mjs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export const CATEGORY = Object.freeze({
|
||||||
|
sommaire: { id: "sommaire", label: "LETHALFANTASY.Armor.Category.sommaire" },
|
||||||
|
legere: { id: "legere", label: "LETHALFANTASY.Armor.Category.legere" },
|
||||||
|
guerre: { id: "guerre", label: "LETHALFANTASY.Armor.Category.guerre" },
|
||||||
|
})
|
50
module/config/character.mjs
Normal file
50
module/config/character.mjs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
export const CHARACTERISTICS = Object.freeze({
|
||||||
|
rob: {
|
||||||
|
id: "rob",
|
||||||
|
label: "LETHALFANTASY.Character.rob.label",
|
||||||
|
abbreviation: "LETHALFANTASY.Character.rob.short",
|
||||||
|
},
|
||||||
|
dex: {
|
||||||
|
id: "dex",
|
||||||
|
label: "LETHALFANTASY.Character.dex.label",
|
||||||
|
abbreviation: "LETHALFANTASY.Character.dex.short",
|
||||||
|
},
|
||||||
|
int: {
|
||||||
|
id: "int",
|
||||||
|
label: "LETHALFANTASY.Character.int.label",
|
||||||
|
abbreviation: "LETHALFANTASY.Character.int.short",
|
||||||
|
},
|
||||||
|
per: {
|
||||||
|
id: "per",
|
||||||
|
label: "LETHALFANTASY.Character.per.label",
|
||||||
|
abbreviation: "LETHALFANTASY.Character.per.short",
|
||||||
|
},
|
||||||
|
vol: {
|
||||||
|
id: "vol",
|
||||||
|
label: "LETHALFANTASY.Character.vol.label",
|
||||||
|
abbreviation: "LETHALFANTASY.Character.vol.short",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export const RESOURCES = Object.freeze({
|
||||||
|
san: {
|
||||||
|
id: "san",
|
||||||
|
label: "LETHALFANTASY.Character.san.label",
|
||||||
|
},
|
||||||
|
oeil: {
|
||||||
|
id: "oeil",
|
||||||
|
label: "LETHALFANTASY.Character.oeil.label",
|
||||||
|
},
|
||||||
|
verbe: {
|
||||||
|
id: "verbe",
|
||||||
|
label: "LETHALFANTASY.Character.verbe.label",
|
||||||
|
},
|
||||||
|
bourse: {
|
||||||
|
id: "bourse",
|
||||||
|
label: "LETHALFANTASY.Character.bourse.label",
|
||||||
|
},
|
||||||
|
magie: {
|
||||||
|
id: "magie",
|
||||||
|
label: "LETHALFANTASY.Character.magie.label",
|
||||||
|
},
|
||||||
|
})
|
22
module/config/spell.mjs
Normal file
22
module/config/spell.mjs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
export const RANGE = Object.freeze({
|
||||||
|
na: {
|
||||||
|
id: "na",
|
||||||
|
label: "LETHALFANTASY.Spell.Range.na",
|
||||||
|
},
|
||||||
|
contact: {
|
||||||
|
id: "contact",
|
||||||
|
label: "LETHALFANTASY.Spell.Range.contact",
|
||||||
|
},
|
||||||
|
proche: {
|
||||||
|
id: "proche",
|
||||||
|
label: "LETHALFANTASY.Spell.Range.proche",
|
||||||
|
},
|
||||||
|
loin: {
|
||||||
|
id: "loin",
|
||||||
|
label: "LETHALFANTASY.Spell.Range.loin",
|
||||||
|
},
|
||||||
|
distant: {
|
||||||
|
id: "distant",
|
||||||
|
label: "LETHALFANTASY.Spell.Range.distant",
|
||||||
|
},
|
||||||
|
})
|
102
module/config/system.mjs
Normal file
102
module/config/system.mjs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
import * as CHARACTER from "./character.mjs"
|
||||||
|
import * as WEAPON from "./weapon.mjs"
|
||||||
|
import * as ARMOR from "./armor.mjs"
|
||||||
|
import * as SPELL from "./spell.mjs"
|
||||||
|
|
||||||
|
export const SYSTEM_ID = "tenebris"
|
||||||
|
export const DEV_MODE = false
|
||||||
|
|
||||||
|
export const RESOURCE_VALUE = Object.freeze({
|
||||||
|
ZERO: "0",
|
||||||
|
D4: "d4",
|
||||||
|
D6: "d6",
|
||||||
|
D8: "d8",
|
||||||
|
D10: "d10",
|
||||||
|
D12: "d12",
|
||||||
|
})
|
||||||
|
|
||||||
|
export const DICE_VALUE = Object.freeze({
|
||||||
|
D4: "d4",
|
||||||
|
D6: "d6",
|
||||||
|
D8: "d8",
|
||||||
|
D10: "d10",
|
||||||
|
D12: "d12",
|
||||||
|
})
|
||||||
|
|
||||||
|
export const DICE_VALUES = ["0", "d4", "d6", "d8", "d10", "d12"]
|
||||||
|
|
||||||
|
export const ROLL_TYPE = Object.freeze({
|
||||||
|
SAVE: "save",
|
||||||
|
RESOURCE: "resource",
|
||||||
|
DAMAGE: "damage",
|
||||||
|
ATTACK: "attack",
|
||||||
|
})
|
||||||
|
|
||||||
|
export const MINOR_PATH = Object.freeze({
|
||||||
|
epee: {
|
||||||
|
onze: "rob",
|
||||||
|
neuf: {
|
||||||
|
main: "per",
|
||||||
|
plume: "vol",
|
||||||
|
livre: "int",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
main: {
|
||||||
|
onze: "dex",
|
||||||
|
neuf: {
|
||||||
|
chene: "rob",
|
||||||
|
plume: "vol",
|
||||||
|
livre: "int",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plume: {
|
||||||
|
onze: "int",
|
||||||
|
neuf: {
|
||||||
|
chene: "rob",
|
||||||
|
main: "per",
|
||||||
|
epee: "dex",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
chene: {
|
||||||
|
onze: "per",
|
||||||
|
neuf: {
|
||||||
|
plume: "vol",
|
||||||
|
livre: "int",
|
||||||
|
epee: "dex",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
livre: {
|
||||||
|
onze: "vol",
|
||||||
|
neuf: {
|
||||||
|
chene: "rob",
|
||||||
|
main: "per",
|
||||||
|
epee: "dex",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export const ASCII = `
|
||||||
|
██████ ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████████ ███████ ███ ██ ███████ ██████ ██████ ██ ███████
|
||||||
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
|
██ ██ ███████ ██ ██ ██ ███████ ██ ██ ██ █████ ██ ██ ██ █████ ██████ ██████ ██ ███████
|
||||||
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
|
██████ ██ ██ ██ ██████ ███████ ██ ██ ██████ ██ ███████ ██ ████ ███████ ██████ ██ ██ ██ ███████ `
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include all constant definitions within the SYSTEM global export
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
export const SYSTEM = {
|
||||||
|
id: SYSTEM_ID,
|
||||||
|
CHARACTERISTICS: CHARACTER.CHARACTERISTICS,
|
||||||
|
RESOURCES: CHARACTER.RESOURCES,
|
||||||
|
RESOURCE_VALUE,
|
||||||
|
WEAPON_CATEGORY: WEAPON.CATEGORY,
|
||||||
|
WEAPON_DAMAGE: WEAPON.DAMAGE,
|
||||||
|
ARMOR_CATEGORY: ARMOR.CATEGORY,
|
||||||
|
SPELL_RANGE: SPELL.RANGE,
|
||||||
|
ASCII,
|
||||||
|
MINOR_PATH,
|
||||||
|
ROLL_TYPE,
|
||||||
|
DEV_MODE,
|
||||||
|
}
|
30
module/config/weapon.mjs
Normal file
30
module/config/weapon.mjs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
export const CATEGORY = Object.freeze({
|
||||||
|
mains: {
|
||||||
|
id: "mains",
|
||||||
|
label: "LETHALFANTASY.Weapon.Category.main",
|
||||||
|
},
|
||||||
|
improvisee: {
|
||||||
|
id: "improvisee",
|
||||||
|
label: "LETHALFANTASY.Weapon.Category.improvisee",
|
||||||
|
},
|
||||||
|
courte: {
|
||||||
|
id: "courte",
|
||||||
|
label: "LETHALFANTASY.Weapon.Category.courte",
|
||||||
|
},
|
||||||
|
longue: {
|
||||||
|
id: "longue",
|
||||||
|
label: "LETHALFANTASY.Weapon.Category.longue",
|
||||||
|
},
|
||||||
|
lourde: {
|
||||||
|
id: "lourde",
|
||||||
|
label: "LETHALFANTASY.Weapon.Category.lourde",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export const DAMAGE = Object.freeze({
|
||||||
|
UN: "1",
|
||||||
|
D4: "d4",
|
||||||
|
D6: "d6",
|
||||||
|
D8: "d8",
|
||||||
|
D10: "d10",
|
||||||
|
})
|
44
module/control-buttons.mjs
Normal file
44
module/control-buttons.mjs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* Menu spécifique au système
|
||||||
|
*/
|
||||||
|
export function initControlButtons() {
|
||||||
|
CONFIG.Canvas.layers.tenebris = { layerClass: ControlsLayer, group: "primary" }
|
||||||
|
|
||||||
|
Hooks.on("getSceneControlButtons", (btns) => {
|
||||||
|
let menu = []
|
||||||
|
|
||||||
|
menu.push({
|
||||||
|
name: "fortune",
|
||||||
|
title: game.i18n.localize("TENEBRIS.Fortune.title"),
|
||||||
|
icon: "fa-solid fa-clover",
|
||||||
|
button: true,
|
||||||
|
onClick: () => {
|
||||||
|
if (!foundry.applications.instances.has("tenebris-application-fortune")) {
|
||||||
|
game.system.applicationFortune.render(true)
|
||||||
|
} else game.system.applicationFortune.close()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (game.user.isGM) {
|
||||||
|
menu.push({
|
||||||
|
name: "gm-manager",
|
||||||
|
title: game.i18n.localize("TENEBRIS.Manager.title"),
|
||||||
|
icon: "fa-solid fa-users",
|
||||||
|
button: true,
|
||||||
|
onClick: () => {
|
||||||
|
if (!foundry.applications.instances.has("tenebris-application-manager")) {
|
||||||
|
game.system.applicationManager.render(true)
|
||||||
|
} else game.system.applicationManager.close()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
btns.push({
|
||||||
|
name: "tenebris",
|
||||||
|
title: "Cthulhu LethalFantasy",
|
||||||
|
icon: "tenebris",
|
||||||
|
layer: "tenebris",
|
||||||
|
tools: menu,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
4
module/documents/_module.mjs
Normal file
4
module/documents/_module.mjs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export { default as LethalFantasyActor } from "./actor.mjs"
|
||||||
|
export { default as LethalFantasyItem } from "./item.mjs"
|
||||||
|
export { default as LethalFantasyRoll } from "./roll.mjs"
|
||||||
|
export { default as LethalFantasyChatMessage } from "./chat-message.mjs"
|
220
module/documents/actor.mjs
Normal file
220
module/documents/actor.mjs
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
import { ROLL_TYPE } from "../config/system.mjs"
|
||||||
|
export default class LethalFantasyActor extends Actor {
|
||||||
|
async _preCreate(data, options, user) {
|
||||||
|
await super._preCreate(data, options, user)
|
||||||
|
|
||||||
|
// Configure prototype token settings
|
||||||
|
const prototypeToken = {}
|
||||||
|
if (this.type === "character") {
|
||||||
|
Object.assign(prototypeToken, {
|
||||||
|
sight: { enabled: true },
|
||||||
|
actorLink: true,
|
||||||
|
disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY,
|
||||||
|
})
|
||||||
|
this.updateSource({ prototypeToken })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a path to the character.
|
||||||
|
* First path added is the major path, second path added is the minor path.
|
||||||
|
* Create all talents of the path and add them to the character.
|
||||||
|
* Add the path to the character.
|
||||||
|
*
|
||||||
|
* @param {Object} item The item to add as a path.
|
||||||
|
* @returns {Promise<void>} - A promise that resolves when the path is added.
|
||||||
|
*/
|
||||||
|
async addPath(item) {
|
||||||
|
if (this.type !== "character") return
|
||||||
|
let itemData = item.toObject()
|
||||||
|
if (this.system.hasVoieMajeure && this.system.hasVoieMineure) {
|
||||||
|
ui.notifications.warn(game.i18n.localize("TENEBRIS.Warning.dejaDeuxVoies"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Voie mineure
|
||||||
|
if (this.system.hasVoieMajeure) {
|
||||||
|
if (this.system.voies.majeure.nom === item.name) {
|
||||||
|
ui.notifications.warn(game.i18n.localize("TENEBRIS.Warning.dejaVoieMajeure"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Voie de base
|
||||||
|
const isBasePath = itemData.system.key !== "" && this.system.voies.majeure.key !== ""
|
||||||
|
|
||||||
|
let dropNotification
|
||||||
|
let neufModifie
|
||||||
|
let onze
|
||||||
|
let neuf
|
||||||
|
if (isBasePath) {
|
||||||
|
onze = game.system.CONST.MINOR_PATH[itemData.system.key].onze
|
||||||
|
const labelOnze = game.i18n.localize(`TENEBRIS.Character.FIELDS.caracteristiques.${onze}.valeur.label`)
|
||||||
|
dropNotification = `La valeur de ${labelOnze} va être modifiée pour 11`
|
||||||
|
neuf = game.system.CONST.MINOR_PATH[itemData.system.key].neuf[this.system.voies.majeure.key]
|
||||||
|
if (neuf) {
|
||||||
|
neufModifie = true
|
||||||
|
const labelNeuf = game.i18n.localize(`TENEBRIS.Character.FIELDS.caracteristiques.${neuf}.valeur.label`)
|
||||||
|
dropNotification += `<br> La valeur de ${labelNeuf} va être modifiée pour 9`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dropNotification = "Vous devez modifier manuellement les caractéristiques selon la voie ajoutée"
|
||||||
|
}
|
||||||
|
|
||||||
|
dropNotification += `<br>Vous pouvez renoncer à des biens de la voie majeure pour ceux de la voie mineure`
|
||||||
|
dropNotification += `<br> Vous pouvez renoncer à des langues de la voie majeure pour celles de la voie mineure`
|
||||||
|
|
||||||
|
const proceed = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
window: { title: game.i18n.localize("TENEBRIS.Dialog.ajoutVoieMineureTitre") },
|
||||||
|
content: dropNotification,
|
||||||
|
rejectClose: false,
|
||||||
|
modal: true,
|
||||||
|
})
|
||||||
|
if (!proceed) return
|
||||||
|
|
||||||
|
let voie
|
||||||
|
|
||||||
|
// Création de la voie
|
||||||
|
voie = await this.createEmbeddedDocuments("Item", [itemData], { renderSheet: false })
|
||||||
|
|
||||||
|
if (isBasePath) {
|
||||||
|
await this.update({
|
||||||
|
"system.voies.mineure.nom": item.name,
|
||||||
|
"system.voies.mineure.id": voie[0].id,
|
||||||
|
"system.voies.mineure.key": item.system.key,
|
||||||
|
[`system.caracteristiques.${onze}.valeur`]: 11,
|
||||||
|
"system.langues": `${this.system.langues} <br>${item.name} : ${item.system.langues}`,
|
||||||
|
"system.biens": `${this.system.biens} <br>${item.name} : ${item.system.biens}`,
|
||||||
|
})
|
||||||
|
if (neufModifie) {
|
||||||
|
await this.update({
|
||||||
|
[`system.caracteristiques.${neuf}.valeur`]: 9,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await this.update({
|
||||||
|
"system.voies.mineure.nom": item.name,
|
||||||
|
"system.voies.mineure.id": voie[0].id,
|
||||||
|
"system.voies.mineure.key": item.system.key,
|
||||||
|
"system.langues": `${this.system.langues} <br>${item.name} : ${item.system.langues}`,
|
||||||
|
"system.biens": `${this.system.biens} <br>${item.name} : ${item.system.biens}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Création des talents
|
||||||
|
let newTalents = []
|
||||||
|
for (const talent of itemData.system.talents) {
|
||||||
|
const talentItem = await fromUuid(talent)
|
||||||
|
if (talentItem) {
|
||||||
|
const newTalent = await this.createEmbeddedDocuments("Item", [talentItem.toObject()])
|
||||||
|
// Modification de la voie du talent
|
||||||
|
await newTalent[0].update({ "system.path": voie[0].uuid })
|
||||||
|
newTalents.push(newTalent[0].uuid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Mise à jour de la voie avec les nouveaux talents
|
||||||
|
await voie[0].update({ "system.talents": newTalents })
|
||||||
|
|
||||||
|
return ui.notifications.info(game.i18n.localize("TENEBRIS.Warning.voieMineureAjoutee"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Voie majeure
|
||||||
|
else {
|
||||||
|
const proceed = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
window: { title: game.i18n.localize("TENEBRIS.Dialog.ajoutVoieMajeureTitre") },
|
||||||
|
content: game.i18n.localize("TENEBRIS.Dialog.ajoutVoieMajeure"),
|
||||||
|
rejectClose: false,
|
||||||
|
modal: true,
|
||||||
|
})
|
||||||
|
if (!proceed) return
|
||||||
|
|
||||||
|
// Création de la voie
|
||||||
|
const voie = await this.createEmbeddedDocuments("Item", [itemData], { renderSheet: false })
|
||||||
|
|
||||||
|
// Création des talents
|
||||||
|
let newTalents = []
|
||||||
|
for (const talent of itemData.system.talents) {
|
||||||
|
const talentItem = await fromUuid(talent)
|
||||||
|
if (talentItem) {
|
||||||
|
const newTalent = await this.createEmbeddedDocuments("Item", [talentItem.toObject()])
|
||||||
|
// Modification de la voie du talent
|
||||||
|
await newTalent[0].update({ "system.path": voie[0].uuid })
|
||||||
|
newTalents.push(newTalent[0].uuid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Mise à jour de la voie avec les nouveaux talents
|
||||||
|
await voie[0].update({ "system.talents": newTalents })
|
||||||
|
|
||||||
|
await this.update({
|
||||||
|
"system.voies.majeure.id": voie[0].id,
|
||||||
|
"system.voies.majeure.nom": item.name,
|
||||||
|
"system.voies.majeure.key": item.system.key,
|
||||||
|
"system.caracteristiques.rob": item.system.caracteristiques.rob,
|
||||||
|
"system.caracteristiques.dex": item.system.caracteristiques.dex,
|
||||||
|
"system.caracteristiques.int": item.system.caracteristiques.int,
|
||||||
|
"system.caracteristiques.per": item.system.caracteristiques.per,
|
||||||
|
"system.caracteristiques.vol": item.system.caracteristiques.vol,
|
||||||
|
"system.ressources.san": item.system.ressources.san,
|
||||||
|
"system.ressources.oeil": item.system.ressources.oeil,
|
||||||
|
"system.ressources.verbe": item.system.ressources.verbe,
|
||||||
|
"system.ressources.bourse": item.system.ressources.bourse,
|
||||||
|
"system.ressources.magie": item.system.ressources.magie,
|
||||||
|
"system.dv": item.system.dv,
|
||||||
|
"system.dmax.valeur": item.system.dmax,
|
||||||
|
"system.langues": `${item.name} : ${item.system.langues}`,
|
||||||
|
"system.biens": `${item.name} : ${item.system.biens}`,
|
||||||
|
})
|
||||||
|
return ui.notifications.info(game.i18n.localize("TENEBRIS.Warning.voieMajeureAjoutee"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a specified path and its associated talents.
|
||||||
|
*
|
||||||
|
* @param {Object} path The path object to be deleted.
|
||||||
|
* @param {boolean} isMajor Indicates if the path is a major path, elswise it is a minor path.
|
||||||
|
* @returns {Promise<void>} A promise that resolves when the deletion is complete.
|
||||||
|
* @throws {Error} Throws an error if the type is not "character".
|
||||||
|
*/
|
||||||
|
async deletePath(path, isMajor) {
|
||||||
|
if (this.type !== "character") return
|
||||||
|
|
||||||
|
// Delete all talents linked to the path
|
||||||
|
let toDelete = path.system.talents.map((talent) => foundry.utils.parseUuid(talent).id)
|
||||||
|
toDelete.push(path.id)
|
||||||
|
await this.deleteEmbeddedDocuments("Item", toDelete)
|
||||||
|
|
||||||
|
// Voie majeure
|
||||||
|
if (isMajor) {
|
||||||
|
await this.update({ "system.voies.majeure.nom": "", "system.voies.majeure.id": null, "system.voies.majeure.key": "" })
|
||||||
|
ui.notifications.info(game.i18n.localize("TENEBRIS.Warning.voieMajeureSupprimee"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Voie mineure
|
||||||
|
else {
|
||||||
|
await this.update({ "system.voies.mineure.nom": "", "system.voies.mineure.id": null, "system.voies.mineure.key": "" })
|
||||||
|
ui.notifications.info(game.i18n.localize("TENEBRIS.Warning.voieMineureSupprimee"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an attack to the actor if the actor type is "opponent".
|
||||||
|
*
|
||||||
|
* @param {Object} attack The attack object to be added.
|
||||||
|
* @returns {Promise<void>} A promise that resolves when the attack has been added.
|
||||||
|
*/
|
||||||
|
async addAttack(attack) {
|
||||||
|
if (this.type !== "opponent") return
|
||||||
|
|
||||||
|
await this.createEmbeddedDocuments("Item", [attack])
|
||||||
|
}
|
||||||
|
|
||||||
|
async rollResource(resource) {
|
||||||
|
if (this.type !== "character") return
|
||||||
|
await this.system.roll(ROLL_TYPE.RESOURCE, resource)
|
||||||
|
}
|
||||||
|
|
||||||
|
async rollSave(save, avantage) {
|
||||||
|
if (this.type !== "character") return
|
||||||
|
await this.system.roll(ROLL_TYPE.SAVE, save, avantage)
|
||||||
|
}
|
||||||
|
}
|
21
module/documents/chat-message.mjs
Normal file
21
module/documents/chat-message.mjs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import LethalFantasyRoll from "./roll.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyChatMessage extends ChatMessage {
|
||||||
|
async _renderRollContent(messageData) {
|
||||||
|
const data = messageData.message
|
||||||
|
if (this.rolls[0] instanceof LethalFantasyRoll) {
|
||||||
|
const isPrivate = !this.isContentVisible
|
||||||
|
// _renderRollHTML va appeler render sur tous les rolls
|
||||||
|
const rollHTML = await this._renderRollHTML(isPrivate)
|
||||||
|
if (isPrivate) {
|
||||||
|
data.flavor = game.i18n.format("CHAT.PrivateRollContent", { user: this.user.name })
|
||||||
|
messageData.isWhisper = false
|
||||||
|
messageData.alias = this.user.name
|
||||||
|
}
|
||||||
|
data.content = `<section class="dice-rolls">${rollHTML}</section>`
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return super._renderRollContent(messageData)
|
||||||
|
}
|
||||||
|
}
|
1
module/documents/item.mjs
Normal file
1
module/documents/item.mjs
Normal file
@ -0,0 +1 @@
|
|||||||
|
export default class LethalFantasyItem extends Item {}
|
592
module/documents/roll.mjs
Normal file
592
module/documents/roll.mjs
Normal file
@ -0,0 +1,592 @@
|
|||||||
|
import { ROLL_TYPE } from "../config/system.mjs"
|
||||||
|
import LethalFantasyUtils from "../utils.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyRoll extends Roll {
|
||||||
|
/**
|
||||||
|
* The HTML template path used to render dice checks of this type
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
static CHAT_TEMPLATE = "systems/fvtt-lethal-fantasy/templates/chat-message.hbs"
|
||||||
|
|
||||||
|
get type() {
|
||||||
|
return this.options.type
|
||||||
|
}
|
||||||
|
|
||||||
|
get isSave() {
|
||||||
|
return this.type === ROLL_TYPE.SAVE
|
||||||
|
}
|
||||||
|
|
||||||
|
get isResource() {
|
||||||
|
return this.type === ROLL_TYPE.RESOURCE
|
||||||
|
}
|
||||||
|
|
||||||
|
get isDamage() {
|
||||||
|
return this.type === ROLL_TYPE.DAMAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
get target() {
|
||||||
|
return this.options.target
|
||||||
|
}
|
||||||
|
|
||||||
|
get value() {
|
||||||
|
return this.options.value
|
||||||
|
}
|
||||||
|
|
||||||
|
get treshold() {
|
||||||
|
return this.options.treshold
|
||||||
|
}
|
||||||
|
|
||||||
|
get actorId() {
|
||||||
|
return this.options.actorId
|
||||||
|
}
|
||||||
|
|
||||||
|
get actorName() {
|
||||||
|
return this.options.actorName
|
||||||
|
}
|
||||||
|
|
||||||
|
get actorImage() {
|
||||||
|
return this.options.actorImage
|
||||||
|
}
|
||||||
|
|
||||||
|
get introText() {
|
||||||
|
return this.options.introText
|
||||||
|
}
|
||||||
|
|
||||||
|
get introTextTooltip() {
|
||||||
|
return this.options.introTextTooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
get aide() {
|
||||||
|
return this.options.aide
|
||||||
|
}
|
||||||
|
|
||||||
|
get gene() {
|
||||||
|
return this.options.gene
|
||||||
|
}
|
||||||
|
|
||||||
|
get modificateur() {
|
||||||
|
return this.options.modificateur
|
||||||
|
}
|
||||||
|
|
||||||
|
get avantages() {
|
||||||
|
return this.options.avantages
|
||||||
|
}
|
||||||
|
|
||||||
|
get resultType() {
|
||||||
|
return this.options.resultType
|
||||||
|
}
|
||||||
|
|
||||||
|
get isFailure() {
|
||||||
|
return this.resultType === "failure"
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasTarget() {
|
||||||
|
return this.options.hasTarget
|
||||||
|
}
|
||||||
|
|
||||||
|
get targetName() {
|
||||||
|
return this.options.targetName
|
||||||
|
}
|
||||||
|
|
||||||
|
get targetArmor() {
|
||||||
|
return this.options.targetArmor
|
||||||
|
}
|
||||||
|
|
||||||
|
get targetMalus() {
|
||||||
|
return this.options.targetMalus
|
||||||
|
}
|
||||||
|
|
||||||
|
get realDamage() {
|
||||||
|
return this.options.realDamage
|
||||||
|
}
|
||||||
|
|
||||||
|
get rollAdvantage() {
|
||||||
|
return this.options.rollAdvantage
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates introductory text based on the roll type.
|
||||||
|
*
|
||||||
|
* @returns {string} The formatted introductory text for the roll.
|
||||||
|
*/
|
||||||
|
_createIntroText() {
|
||||||
|
let text
|
||||||
|
|
||||||
|
switch (this.type) {
|
||||||
|
case ROLL_TYPE.SAVE:
|
||||||
|
const saveLabel = game.i18n.localize(`TENEBRIS.Character.FIELDS.caracteristiques.${this.target}.valeur.label`)
|
||||||
|
text = game.i18n.format("TENEBRIS.Roll.save", { save: saveLabel })
|
||||||
|
text = text.concat("<br>").concat(`Seuil : ${this.treshold}`)
|
||||||
|
break
|
||||||
|
case ROLL_TYPE.RESOURCE:
|
||||||
|
const resourceLabel = game.i18n.localize(`TENEBRIS.Character.FIELDS.ressources.${this.target}.valeur.label`)
|
||||||
|
text = game.i18n.format("TENEBRIS.Roll.resource", { resource: resourceLabel })
|
||||||
|
break
|
||||||
|
case ROLL_TYPE.DAMAGE:
|
||||||
|
const damageLabel = this.target
|
||||||
|
text = game.i18n.format("TENEBRIS.Roll.damage", { item: damageLabel })
|
||||||
|
break
|
||||||
|
case ROLL_TYPE.ATTACK:
|
||||||
|
const attackLabel = this.target
|
||||||
|
text = game.i18n.format("TENEBRIS.Roll.attack", { item: attackLabel })
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an introductory text tooltip with characteristics and modifiers.
|
||||||
|
*
|
||||||
|
* @returns {string} A formatted string containing the value, help, hindrance, and modifier.
|
||||||
|
*/
|
||||||
|
_createIntroTextTooltip() {
|
||||||
|
let tooltip = game.i18n.format("TENEBRIS.Tooltip.saveIntroTextTooltip", { value: this.value, aide: this.aide, gene: this.gene, modificateur: this.modificateur })
|
||||||
|
if (this.hasTarget) {
|
||||||
|
tooltip = tooltip.concat(`<br>Cible : ${this.targetName}`)
|
||||||
|
}
|
||||||
|
return tooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prompt the user with a dialog to configure and execute a roll.
|
||||||
|
*
|
||||||
|
* @param {Object} options Configuration options for the roll.
|
||||||
|
* @param {string} options.rollType The type of roll being performed (e.g., RESOURCE, DAMAGE, ATTACK, SAVE).
|
||||||
|
* @param {string} options.rollValue The initial value or formula for the roll.
|
||||||
|
* @param {string} options.rollTarget The target of the roll.
|
||||||
|
* @param {"="|"+"|"++"|"-"|"--"} options.rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=).
|
||||||
|
* @param {string} options.actorId The ID of the actor performing the roll.
|
||||||
|
* @param {string} options.actorName The name of the actor performing the roll.
|
||||||
|
* @param {string} options.actorImage The image of the actor performing the roll.
|
||||||
|
* @param {boolean} options.hasTarget Whether the roll has a target.
|
||||||
|
* @param {Object} options.target The target of the roll, if any.
|
||||||
|
* @param {Object} options.data Additional data for the roll.
|
||||||
|
*
|
||||||
|
* @returns {Promise<Object|null>} The roll result or null if the dialog was cancelled.
|
||||||
|
*/
|
||||||
|
static async prompt(options = {}) {
|
||||||
|
let formula = options.rollValue
|
||||||
|
|
||||||
|
// Formula for a resource roll
|
||||||
|
if (options.rollType === ROLL_TYPE.RESOURCE) {
|
||||||
|
let ressource = game.i18n.localize(`TENEBRIS.Character.FIELDS.ressources.${options.rollTarget}.valeur.label`)
|
||||||
|
if (formula === "0" || formula === "") {
|
||||||
|
ui.notifications.warn(game.i18n.format("TENEBRIS.Warning.plusDeRessource", { ressource: ressource }))
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollModes = Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
|
||||||
|
const fieldRollMode = new foundry.data.fields.StringField({
|
||||||
|
choices: rollModes,
|
||||||
|
blank: false,
|
||||||
|
default: "public",
|
||||||
|
})
|
||||||
|
|
||||||
|
const choiceAide = foundry.utils.mergeObject({ 0: "0" }, options.rollValue <= 10 ? { 1: "1" } : { 1: "1", 2: "2" })
|
||||||
|
const choiceGene = {
|
||||||
|
0: "0",
|
||||||
|
"-1": "-1",
|
||||||
|
"-2": "-2",
|
||||||
|
"-3": "-3",
|
||||||
|
"-4": "-4",
|
||||||
|
"-5": "-5",
|
||||||
|
"-6": "-6",
|
||||||
|
"-7": "-7",
|
||||||
|
"-8": "-8",
|
||||||
|
"-9": "-9",
|
||||||
|
"-10": "-10",
|
||||||
|
}
|
||||||
|
const choiceAvantage = { normal: "Normal", avantage: "Avantage", desavantage: "Désavantage", doubleAvantage: "Double avantage", doubleDesavantage: "Double désavantage" }
|
||||||
|
const choiceModificateur = {
|
||||||
|
0: "0",
|
||||||
|
"-1": "-1",
|
||||||
|
"-2": "-2",
|
||||||
|
"-3": "-3",
|
||||||
|
"-4": "-4",
|
||||||
|
"-5": "-5",
|
||||||
|
"-6": "-6",
|
||||||
|
"-7": "-7",
|
||||||
|
"-8": "-8",
|
||||||
|
"-9": "-9",
|
||||||
|
"-10": "-10",
|
||||||
|
}
|
||||||
|
|
||||||
|
let damageDice
|
||||||
|
let damageDiceMax
|
||||||
|
let damageDiceFinal
|
||||||
|
let damageDiceLowered
|
||||||
|
|
||||||
|
// Damage roll : check the roll is not above the maximum damage
|
||||||
|
if (options.rollType === ROLL_TYPE.DAMAGE) {
|
||||||
|
damageDice = options.rollValue
|
||||||
|
damageDiceMax = game.actors.get(options.actorId).system.dmax.valeur
|
||||||
|
damageDiceFinal = LethalFantasyUtils.maxDamage(damageDice, damageDiceMax)
|
||||||
|
damageDiceLowered = damageDiceFinal !== damageDice
|
||||||
|
// Récupération du nom de l'objet si c'est un jet depuis la fiche de l'acteur
|
||||||
|
// Si c'est via une macro le nom est connu
|
||||||
|
options.rollTarget = game.actors.get(options.actorId).items.get(options.rollTarget).name
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.rollType === ROLL_TYPE.ATTACK) {
|
||||||
|
damageDice = options.rollValue
|
||||||
|
}
|
||||||
|
|
||||||
|
let malus = "0"
|
||||||
|
let targetMalus = "0"
|
||||||
|
let targetName
|
||||||
|
let targetArmor
|
||||||
|
const displayOpponentMalus = game.settings.get("tenebris", "displayOpponentMalus")
|
||||||
|
|
||||||
|
if (options.rollType === ROLL_TYPE.SAVE && options.hasTarget && options.target.document.actor.type === "opponent") {
|
||||||
|
targetName = options.target.document.actor.name
|
||||||
|
if (displayOpponentMalus) malus = options.target.document.actor.system.malus.toString()
|
||||||
|
else targetMalus = options.target.document.actor.system.malus.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.rollType === ROLL_TYPE.DAMAGE && options.hasTarget && options.target.document.actor.type === "opponent") {
|
||||||
|
targetName = options.target.document.actor.name
|
||||||
|
targetArmor = options.target.document.actor.system.armure.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
let dialogContext = {
|
||||||
|
isSave: options.rollType === ROLL_TYPE.SAVE,
|
||||||
|
isResource: options.rollType === ROLL_TYPE.RESOURCE,
|
||||||
|
isDamage: options.rollType === ROLL_TYPE.DAMAGE,
|
||||||
|
isAttack: options.rollType === ROLL_TYPE.ATTACK,
|
||||||
|
rollModes,
|
||||||
|
fieldRollMode,
|
||||||
|
choiceAide,
|
||||||
|
choiceGene,
|
||||||
|
choiceAvantage,
|
||||||
|
choiceModificateur,
|
||||||
|
damageDice,
|
||||||
|
damageDiceMax,
|
||||||
|
damageDiceFinal,
|
||||||
|
damageDiceLowered,
|
||||||
|
formula,
|
||||||
|
hasTarget: options.hasTarget,
|
||||||
|
malus,
|
||||||
|
targetName,
|
||||||
|
targetArmor,
|
||||||
|
rollAdvantage: this._convertAvantages(options.rollAdvantage),
|
||||||
|
rangeAdvantage: this._convertRollAdvantageToRange(options.rollAdvantage),
|
||||||
|
}
|
||||||
|
const content = await renderTemplate("systems/fvtt-lethal-fantasy/templates/roll-dialog.hbs", dialogContext)
|
||||||
|
|
||||||
|
const title = LethalFantasyRoll.createTitle(options.rollType, options.rollTarget)
|
||||||
|
const label = game.i18n.localize("TENEBRIS.Roll.roll")
|
||||||
|
const rollContext = await foundry.applications.api.DialogV2.wait({
|
||||||
|
window: { title: title },
|
||||||
|
classes: ["tenebris"],
|
||||||
|
content,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
label: label,
|
||||||
|
callback: (event, button, dialog) => {
|
||||||
|
const output = Array.from(button.form.elements).reduce((obj, input) => {
|
||||||
|
if (input.name) obj[input.name] = input.value
|
||||||
|
return obj
|
||||||
|
}, {})
|
||||||
|
// Avantages
|
||||||
|
switch (output.avantages) {
|
||||||
|
case "1":
|
||||||
|
output.avantages = "doubleDesavantage"
|
||||||
|
break
|
||||||
|
case "2":
|
||||||
|
output.avantages = "desavantage"
|
||||||
|
break
|
||||||
|
case "3":
|
||||||
|
output.avantages = "normal"
|
||||||
|
break
|
||||||
|
case "4":
|
||||||
|
output.avantages = "avantage"
|
||||||
|
break
|
||||||
|
case "5":
|
||||||
|
output.avantages = "doubleAvantage"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
rejectClose: false, // Click on Close button will not launch an error
|
||||||
|
render: (event, dialog) => {
|
||||||
|
const rangeInput = dialog.querySelector('input[name="avantages"]')
|
||||||
|
if (rangeInput) {
|
||||||
|
rangeInput.addEventListener("change", (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
const readOnly = dialog.querySelector('input[name="selectAvantages"]')
|
||||||
|
readOnly.value = this._convertAvantages(event.target.value)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// If the user cancels the dialog, exit
|
||||||
|
if (rollContext === null) return
|
||||||
|
|
||||||
|
let treshold
|
||||||
|
|
||||||
|
if (options.rollType === ROLL_TYPE.SAVE) {
|
||||||
|
const aide = rollContext.aide === "" ? 0 : parseInt(rollContext.aide, 10)
|
||||||
|
const gene = rollContext.gene === "" ? 0 : parseInt(rollContext.gene, 10)
|
||||||
|
const modificateur = rollContext.modificateur === "" ? 0 : parseInt(rollContext.modificateur, 10)
|
||||||
|
|
||||||
|
if (options.rollType === ROLL_TYPE.SAVE) {
|
||||||
|
let dice = "1d20"
|
||||||
|
switch (rollContext.avantages) {
|
||||||
|
case "avantage":
|
||||||
|
dice = "2d20kl"
|
||||||
|
break
|
||||||
|
case "desavantage":
|
||||||
|
dice = "2d20kh"
|
||||||
|
break
|
||||||
|
case "doubleAvantage":
|
||||||
|
dice = "3d20kl"
|
||||||
|
break
|
||||||
|
case "doubleDesavantage":
|
||||||
|
dice = "3d20kh"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
formula = `${dice}`
|
||||||
|
}
|
||||||
|
|
||||||
|
treshold = options.rollValue + aide + gene + modificateur
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formula for a damage roll
|
||||||
|
if (options.rollType === ROLL_TYPE.DAMAGE) {
|
||||||
|
formula = damageDiceFinal
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formula for an attack roll
|
||||||
|
if (options.rollType === ROLL_TYPE.ATTACK) {
|
||||||
|
formula = damageDice
|
||||||
|
}
|
||||||
|
|
||||||
|
const rollData = {
|
||||||
|
type: options.rollType,
|
||||||
|
target: options.rollTarget,
|
||||||
|
value: options.rollValue,
|
||||||
|
treshold: treshold,
|
||||||
|
actorId: options.actorId,
|
||||||
|
actorName: options.actorName,
|
||||||
|
actorImage: options.actorImage,
|
||||||
|
rollMode: rollContext.visibility,
|
||||||
|
hasTarget: options.hasTarget,
|
||||||
|
targetName,
|
||||||
|
targetArmor,
|
||||||
|
targetMalus,
|
||||||
|
...rollContext,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A hook event that fires before the roll is made.
|
||||||
|
* @function tenebris.preRoll
|
||||||
|
* @memberof hookEvents
|
||||||
|
* @param {Object} options Options for the roll.
|
||||||
|
* @param {Object} rollData All data related to the roll.
|
||||||
|
* @returns {boolean} Explicitly return `false` to prevent roll to be made.
|
||||||
|
*/
|
||||||
|
if (Hooks.call("tenebris.preRoll", options, rollData) === false) return
|
||||||
|
|
||||||
|
const roll = new this(formula, options.data, rollData)
|
||||||
|
|
||||||
|
await roll.evaluate()
|
||||||
|
|
||||||
|
let resultType
|
||||||
|
if (options.rollType === ROLL_TYPE.SAVE) {
|
||||||
|
resultType = roll.total <= treshold ? "success" : "failure"
|
||||||
|
} else if (options.rollType === ROLL_TYPE.RESOURCE) {
|
||||||
|
resultType = roll.total === 1 || roll.total === 2 ? "failure" : "success"
|
||||||
|
}
|
||||||
|
|
||||||
|
let realDamage
|
||||||
|
if (options.rollType === ROLL_TYPE.DAMAGE) {
|
||||||
|
realDamage = Math.max(0, roll.total - parseInt(targetArmor, 10))
|
||||||
|
}
|
||||||
|
|
||||||
|
roll.options.resultType = resultType
|
||||||
|
roll.options.treshold = treshold
|
||||||
|
roll.options.introText = roll._createIntroText()
|
||||||
|
roll.options.introTextTooltip = roll._createIntroTextTooltip()
|
||||||
|
roll.options.realDamage = realDamage
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A hook event that fires after the roll has been made.
|
||||||
|
* @function tenebris.Roll
|
||||||
|
* @memberof hookEvents
|
||||||
|
* @param {Object} options Options for the roll.
|
||||||
|
* @param {Object} rollData All data related to the roll.
|
||||||
|
@param {LethalFantasyRoll} roll The resulting roll.
|
||||||
|
* @returns {boolean} Explicitly return `false` to prevent roll to be made.
|
||||||
|
*/
|
||||||
|
if (Hooks.call("tenebris.Roll", options, rollData, roll) === false) return
|
||||||
|
|
||||||
|
return roll
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a title based on the given type.
|
||||||
|
*
|
||||||
|
* @param {string} type The type of the roll.
|
||||||
|
* @param {string} target The target of the roll.
|
||||||
|
* @returns {string} The generated title.
|
||||||
|
*/
|
||||||
|
static createTitle(type, target) {
|
||||||
|
switch (type) {
|
||||||
|
case ROLL_TYPE.SAVE:
|
||||||
|
return `${game.i18n.localize("TENEBRIS.Dialog.titleSave")} : ${game.i18n.localize(`TENEBRIS.Manager.${target}`)}`
|
||||||
|
case ROLL_TYPE.RESOURCE:
|
||||||
|
return `${game.i18n.localize("TENEBRIS.Dialog.titleResource")} : ${game.i18n.localize(`TENEBRIS.Manager.${target}`)}`
|
||||||
|
case ROLL_TYPE.DAMAGE:
|
||||||
|
return `${game.i18n.localize("TENEBRIS.Dialog.titleDamage")} : ${target}`
|
||||||
|
case ROLL_TYPE.ATTACK:
|
||||||
|
return `${game.i18n.localize("TENEBRIS.Dialog.titleAttack")} : ${target}`
|
||||||
|
default:
|
||||||
|
return game.i18n.localize("TENEBRIS.Dialog.titleStandard")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async render(chatOptions = {}) {
|
||||||
|
let chatData = await this._getChatCardData(chatOptions.isPrivate)
|
||||||
|
return await renderTemplate(this.constructor.CHAT_TEMPLATE, chatData)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the data required for rendering a roll chat card.
|
||||||
|
*
|
||||||
|
* @param {boolean} isPrivate Indicates if the chat card is private.
|
||||||
|
* @returns {Promise<Object>} A promise that resolves to an object containing the chat card data.
|
||||||
|
* @property {Array<string>} css - CSS classes for the chat card.
|
||||||
|
* @property {Object} data - The data associated with the roll.
|
||||||
|
* @property {number} diceTotal - The total value of the dice rolled.
|
||||||
|
* @property {boolean} isGM - Indicates if the user is a Game Master.
|
||||||
|
* @property {string} formula - The formula used for the roll.
|
||||||
|
* @property {number} total - The total result of the roll.
|
||||||
|
* @property {boolean} isSave - Indicates if the roll is a saving throw.
|
||||||
|
* @property {boolean} isResource - Indicates if the roll is related to a resource.
|
||||||
|
* @property {boolean} isDamage - Indicates if the roll is for damage.
|
||||||
|
* @property {boolean} isFailure - Indicates if the roll is a failure.
|
||||||
|
* @property {Array} avantages - Advantages associated with the roll.
|
||||||
|
* @property {string} actorId - The ID of the actor performing the roll.
|
||||||
|
* @property {string} actingCharName - The name of the character performing the roll.
|
||||||
|
* @property {string} actingCharImg - The image of the character performing the roll.
|
||||||
|
* @property {string} introText - Introductory text for the roll.
|
||||||
|
* @property {string} introTextTooltip - Tooltip for the introductory text.
|
||||||
|
* @property {string} resultType - The type of result (e.g., success, failure).
|
||||||
|
* @property {boolean} hasTarget - Indicates if the roll has a target.
|
||||||
|
* @property {string} targetName - The name of the target.
|
||||||
|
* @property {number} targetArmor - The armor value of the target.
|
||||||
|
* @property {number} realDamage - The real damage dealt.
|
||||||
|
* @property {boolean} isPrivate - Indicates if the chat card is private.
|
||||||
|
* @property {string} cssClass - The combined CSS classes as a single string.
|
||||||
|
* @property {string} tooltip - The tooltip text for the chat card.
|
||||||
|
*/
|
||||||
|
async _getChatCardData(isPrivate) {
|
||||||
|
const cardData = {
|
||||||
|
css: [SYSTEM.id, "dice-roll"],
|
||||||
|
data: this.data,
|
||||||
|
diceTotal: this.dice.reduce((t, d) => t + d.total, 0),
|
||||||
|
isGM: game.user.isGM,
|
||||||
|
formula: this.formula,
|
||||||
|
total: this.total,
|
||||||
|
isSave: this.isSave,
|
||||||
|
isResource: this.isResource,
|
||||||
|
isDamage: this.isDamage,
|
||||||
|
isFailure: this.isFailure,
|
||||||
|
avantages: this.avantages,
|
||||||
|
actorId: this.actorId,
|
||||||
|
actingCharName: this.actorName,
|
||||||
|
actingCharImg: this.actorImage,
|
||||||
|
introText: this.introText,
|
||||||
|
introTextTooltip: this.introTextTooltip,
|
||||||
|
resultType: this.resultType,
|
||||||
|
hasTarget: this.hasTarget,
|
||||||
|
targetName: this.targetName,
|
||||||
|
targetArmor: this.targetArmor,
|
||||||
|
realDamage: this.realDamage,
|
||||||
|
isPrivate: isPrivate,
|
||||||
|
}
|
||||||
|
cardData.cssClass = cardData.css.join(" ")
|
||||||
|
cardData.tooltip = isPrivate ? "" : await this.getTooltip()
|
||||||
|
return cardData
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the roll result to a chat message.
|
||||||
|
*
|
||||||
|
* @param {Object} [messageData={}] Additional data to include in the message.
|
||||||
|
* @param {Object} options Options for message creation.
|
||||||
|
* @param {string} options.rollMode The mode of the roll (e.g., public, private).
|
||||||
|
* @param {boolean} [options.create=true] Whether to create the message.
|
||||||
|
* @returns {Promise} - A promise that resolves when the message is created.
|
||||||
|
*/
|
||||||
|
async toMessage(messageData = {}, { rollMode, create = true } = {}) {
|
||||||
|
super.toMessage(
|
||||||
|
{
|
||||||
|
isSave: this.isSave,
|
||||||
|
isResource: this.isResource,
|
||||||
|
isDamage: this.isDamage,
|
||||||
|
isFailure: this.resultType === "failure",
|
||||||
|
avantages: this.avantages,
|
||||||
|
introText: this.introText,
|
||||||
|
introTextTooltip: this.introTextTooltip,
|
||||||
|
actingCharName: this.actorName,
|
||||||
|
actingCharImg: this.actorImage,
|
||||||
|
hasTarget: this.hasTarget,
|
||||||
|
targetName: this.targetName,
|
||||||
|
targetArmor: this.targetArmor,
|
||||||
|
targetMalus: this.targetMalus,
|
||||||
|
realDamage: this.realDamage,
|
||||||
|
...messageData,
|
||||||
|
},
|
||||||
|
{ rollMode: rollMode },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used in the avantages select and with the rollAdvantage parameter: convert the selected value to the corresponding string
|
||||||
|
static _convertAvantages(value) {
|
||||||
|
switch (value) {
|
||||||
|
case "1":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.doubleDesavantage")
|
||||||
|
case "2":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.desavantage")
|
||||||
|
case "3":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.normal")
|
||||||
|
case "4":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.avantage")
|
||||||
|
case "5":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.doubleAvantage")
|
||||||
|
case "--":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.doubleDesavantage")
|
||||||
|
case "-":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.desavantage")
|
||||||
|
case "=":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.normal")
|
||||||
|
case "+":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.avantage")
|
||||||
|
case "++":
|
||||||
|
return game.i18n.localize("TENEBRIS.Roll.doubleAvantage")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used in the rollAdvantage parameter: convert the selected value to the corresponding range value
|
||||||
|
static _convertRollAdvantageToRange(value) {
|
||||||
|
switch (value) {
|
||||||
|
case "--":
|
||||||
|
return 1
|
||||||
|
case "-":
|
||||||
|
return 2
|
||||||
|
case "=":
|
||||||
|
return 3
|
||||||
|
case "+":
|
||||||
|
return 4
|
||||||
|
case "++":
|
||||||
|
return 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
80
module/enrichers.mjs
Normal file
80
module/enrichers.mjs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/**
|
||||||
|
* Enricher qui permet de transformer un texte en un lien de lancer de dés
|
||||||
|
* Pour une syntaxe de type @jet[x]{y}(z) avec x la caractéristique, y le titre et z l'avantage
|
||||||
|
* x de type rob, dex, int, per, vol pour les caractéristiques
|
||||||
|
* et de type oeil, verbe, san, bourse, magie pour les ressources
|
||||||
|
* y est le titre du jet et permet de décrire l'action
|
||||||
|
* z est l'avantage du jet, avec pour valeurs possibles : --, -, +, ++
|
||||||
|
*/
|
||||||
|
export function setupTextEnrichers() {
|
||||||
|
CONFIG.TextEditor.enrichers = CONFIG.TextEditor.enrichers.concat([
|
||||||
|
{
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
|
pattern: /\@jet\[(.+?)\]{(.*?)}\((.*?)\)/gm,
|
||||||
|
enricher: async (match, options) => {
|
||||||
|
const a = document.createElement("a")
|
||||||
|
a.classList.add("ask-roll-journal")
|
||||||
|
const target = match[1]
|
||||||
|
const title = match[2]
|
||||||
|
const avantage = match[3]
|
||||||
|
|
||||||
|
let type = "resource"
|
||||||
|
if (["rob", "dex", "int", "per", "vol"].includes(target)) {
|
||||||
|
type = "save"
|
||||||
|
}
|
||||||
|
|
||||||
|
let rollAvantage = "normal"
|
||||||
|
if (avantage) {
|
||||||
|
switch (avantage) {
|
||||||
|
case "++":
|
||||||
|
rollAvantage = "++"
|
||||||
|
break
|
||||||
|
case "+":
|
||||||
|
rollAvantage = "+"
|
||||||
|
break
|
||||||
|
case "-":
|
||||||
|
rollAvantage = "-"
|
||||||
|
break
|
||||||
|
case "--":
|
||||||
|
rollAvantage = "--"
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a.dataset.rollType = type
|
||||||
|
a.dataset.rollTarget = target
|
||||||
|
a.dataset.rollTitle = title
|
||||||
|
a.dataset.rollAvantage = rollAvantage
|
||||||
|
a.innerHTML = `
|
||||||
|
<i class="fas fa-dice-d20"></i> ${getLibelle(target)}${rollAvantage !== "normal" ? rollAvantage : ""}
|
||||||
|
`
|
||||||
|
return a
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
}
|
||||||
|
const mapLibelles = {
|
||||||
|
rob: "ROB",
|
||||||
|
dex: "DEX",
|
||||||
|
int: "INT",
|
||||||
|
per: "PER",
|
||||||
|
vol: "VOL",
|
||||||
|
oeil: "OEIL",
|
||||||
|
verbe: "VERBE",
|
||||||
|
san: "SANTE MENTALE",
|
||||||
|
bourse: "BOURSE",
|
||||||
|
magie: "MAGIE",
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le libellé associé à la valeur qui sera affiché dans le journal
|
||||||
|
* @param {string} value
|
||||||
|
*/
|
||||||
|
function getLibelle(value) {
|
||||||
|
if (mapLibelles[value]) {
|
||||||
|
return mapLibelles[value]
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
82
module/macros.mjs
Normal file
82
module/macros.mjs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
export class Macros {
|
||||||
|
/**
|
||||||
|
* Creates a macro based on the type of data dropped onto the hotbar.
|
||||||
|
*
|
||||||
|
* @param {Object} dropData The data object representing the item dropped.
|
||||||
|
* @param {string} dropData.type The type of the dropped item (e.g., "Actor", "JournalEntry", "roll").
|
||||||
|
* @param {string} dropData.uuid The UUID of the dropped item.
|
||||||
|
* @param {string} [dropData.actorId] The ID of the actor (required if type is "roll").
|
||||||
|
* @param {string} [dropData.rollType] The type of roll (required if type is "roll").
|
||||||
|
* @param {string} [dropData.rollTarget] The target of the roll (required if type is "roll").
|
||||||
|
* @param {string} [dropData.value] The value of the roll (required if type is "roll").
|
||||||
|
* @param {number} slot The hotbar slot where the macro will be created.
|
||||||
|
*
|
||||||
|
* @returns {Promise<void>} A promise that resolves when the macro is created.
|
||||||
|
*/
|
||||||
|
static createLethalFantasyMacro = async function (dropData, slot) {
|
||||||
|
switch (dropData.type) {
|
||||||
|
case "Actor":
|
||||||
|
const actor = await fromUuid(dropData.uuid)
|
||||||
|
const actorCommand = `game.actors.get("${actor.id}").sheet.render(true)`
|
||||||
|
this.createMacro(slot, actor.name, actorCommand, actor.img)
|
||||||
|
break
|
||||||
|
|
||||||
|
case "JournalEntry":
|
||||||
|
const journal = await fromUuid(dropData.uuid)
|
||||||
|
const journalCommand = `game.journal.get("${journal.id}").sheet.render(true)`
|
||||||
|
this.createMacro(slot, journal.name, journalCommand, journal.img ? journal.img : "icons/svg/book.svg")
|
||||||
|
break
|
||||||
|
|
||||||
|
case "roll":
|
||||||
|
const rollCommand =
|
||||||
|
dropData.rollType === "save"
|
||||||
|
? `game.actors.get('${dropData.actorId}').system.roll('${dropData.rollType}', '${dropData.rollTarget}', '=');`
|
||||||
|
: `game.actors.get('${dropData.actorId}').system.roll('${dropData.rollType}', '${dropData.rollTarget}');`
|
||||||
|
const rollName = `${game.i18n.localize("TENEBRIS.Label.jet")} ${game.i18n.localize(`TENEBRIS.Manager.${dropData.rollTarget}`)}`
|
||||||
|
this.createMacro(slot, rollName, rollCommand, "icons/svg/d20-grey.svg")
|
||||||
|
break
|
||||||
|
|
||||||
|
case "rollDamage":
|
||||||
|
const weapon = game.actors.get(dropData.actorId).items.get(dropData.rollTarget)
|
||||||
|
const rollDamageCommand = `game.actors.get('${dropData.actorId}').system.roll('${dropData.rollType}', '${dropData.rollTarget}');`
|
||||||
|
const rollDamageName = `${game.i18n.localize("TENEBRIS.Label.jet")} ${weapon.name}`
|
||||||
|
this.createMacro(slot, rollDamageName, rollDamageCommand, weapon.img)
|
||||||
|
break
|
||||||
|
|
||||||
|
case "rollAttack":
|
||||||
|
const rollAttackCommand = `game.actors.get('${dropData.actorId}').system.roll('${dropData.rollValue}', '${dropData.rollTarget}');`
|
||||||
|
const rollAttackName = `${game.i18n.localize("TENEBRIS.Label.jet")} ${dropData.rollTarget}`
|
||||||
|
this.createMacro(slot, rollAttackName, rollAttackCommand, "icons/svg/d20-grey.svg")
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Handle other cases or do nothing
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a macro
|
||||||
|
* All macros are flaged with a tenebris.macro flag at true
|
||||||
|
* @param {*} slot
|
||||||
|
* @param {*} name
|
||||||
|
* @param {*} command
|
||||||
|
* @param {*} img
|
||||||
|
*/
|
||||||
|
static createMacro = async function (slot, name, command, img) {
|
||||||
|
let macro = game.macros.contents.find((m) => m.name === name && m.command === command)
|
||||||
|
if (!macro) {
|
||||||
|
macro = await Macro.create(
|
||||||
|
{
|
||||||
|
name: name,
|
||||||
|
type: "script",
|
||||||
|
img: img,
|
||||||
|
command: command,
|
||||||
|
flags: { "tenebris.macro": true },
|
||||||
|
},
|
||||||
|
{ displaySheet: false },
|
||||||
|
)
|
||||||
|
game.user.assignHotbarMacro(macro, slot)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
module/models/_module.mjs
Normal file
8
module/models/_module.mjs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export { default as LethalFantasyCharacter } from "./character.mjs"
|
||||||
|
export { default as LethalFantasyOpponent } from "./opponent.mjs"
|
||||||
|
export { default as LethalFantasyPath } from "./path.mjs"
|
||||||
|
export { default as LethalFantasyTalent } from "./talent.mjs"
|
||||||
|
export { default as LethalFantasyArmor } from "./armor.mjs"
|
||||||
|
export { default as LethalFantasyWeapon } from "./weapon.mjs"
|
||||||
|
export { default as LethalFantasySpell } from "./spell.mjs"
|
||||||
|
export { default as LethalFantasyAttack } from "./attack.mjs"
|
34
module/models/armor.mjs
Normal file
34
module/models/armor.mjs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { SYSTEM } from "../config/system.mjs"
|
||||||
|
import { CATEGORY } from "../config/armor.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyArmor extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||||
|
const schema = {}
|
||||||
|
|
||||||
|
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
|
||||||
|
schema.categorie = new fields.StringField({ required: true, initial: "sommaire", choices: SYSTEM.ARMOR_CATEGORY })
|
||||||
|
|
||||||
|
schema.valeur = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||||
|
|
||||||
|
schema.malus = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||||
|
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static LOCALIZATION_PREFIXES = ["TENEBRIS.Armor"]
|
||||||
|
|
||||||
|
get armorCategory() {
|
||||||
|
return game.i18n.localize(CATEGORY[this.categorie].label)
|
||||||
|
}
|
||||||
|
|
||||||
|
get details() {
|
||||||
|
return game.i18n.format("TENEBRIS.Armor.details", {
|
||||||
|
valeur: this.valeur,
|
||||||
|
malus: this.malus,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
18
module/models/attack.mjs
Normal file
18
module/models/attack.mjs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
export default class LethalFantasy extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
const schema = {}
|
||||||
|
|
||||||
|
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
schema.degats = new fields.StringField({ required: false, nullable: true, blank: true })
|
||||||
|
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static LOCALIZATION_PREFIXES = ["TENEBRIS.Attack"]
|
||||||
|
|
||||||
|
get toolTip() {
|
||||||
|
return this.description || ""
|
||||||
|
}
|
||||||
|
}
|
176
module/models/character.mjs
Normal file
176
module/models/character.mjs
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
import { ROLL_TYPE, SYSTEM } from "../config/system.mjs"
|
||||||
|
import LethalFantasyRoll from "../documents/roll.mjs"
|
||||||
|
import LethalFantasyUtils from "../utils.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyCharacter extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||||
|
const schema = {}
|
||||||
|
|
||||||
|
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
schema.langues = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
schema.biens = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
|
||||||
|
// Caractéristiques
|
||||||
|
const characteristicField = (label) => {
|
||||||
|
const schema = {
|
||||||
|
valeur: new fields.NumberField({ ...requiredInteger, initial: 10, min: 0 }),
|
||||||
|
progression: new fields.SchemaField({
|
||||||
|
experience: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
|
progres: new fields.BooleanField(),
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
return new fields.SchemaField(schema, { label })
|
||||||
|
}
|
||||||
|
|
||||||
|
schema.caracteristiques = new fields.SchemaField(
|
||||||
|
Object.values(SYSTEM.CHARACTERISTICS).reduce((obj, characteristic) => {
|
||||||
|
obj[characteristic.id] = characteristicField(characteristic.label)
|
||||||
|
return obj
|
||||||
|
}, {}),
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ressources
|
||||||
|
const resourceField = (label) => {
|
||||||
|
const schema = {
|
||||||
|
valeur: new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
initial: SYSTEM.RESOURCE_VALUE.ZERO,
|
||||||
|
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
|
||||||
|
blank: true,
|
||||||
|
}),
|
||||||
|
max: new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
initial: SYSTEM.RESOURCE_VALUE.ZERO,
|
||||||
|
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
|
||||||
|
blank: true,
|
||||||
|
}),
|
||||||
|
experience: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
|
}
|
||||||
|
return new fields.SchemaField(schema, { label })
|
||||||
|
}
|
||||||
|
|
||||||
|
schema.ressources = new fields.SchemaField(
|
||||||
|
Object.values(SYSTEM.RESOURCES).reduce((obj, resource) => {
|
||||||
|
obj[resource.id] = resourceField(resource.label)
|
||||||
|
return obj
|
||||||
|
}, {}),
|
||||||
|
)
|
||||||
|
|
||||||
|
schema.commanditaire = new fields.StringField({})
|
||||||
|
|
||||||
|
schema.dv = new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
initial: SYSTEM.RESOURCE_VALUE.ZERO,
|
||||||
|
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
|
||||||
|
})
|
||||||
|
|
||||||
|
schema.pv = new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
|
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
|
})
|
||||||
|
|
||||||
|
schema.dmax = new fields.SchemaField({
|
||||||
|
valeur: new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
initial: SYSTEM.RESOURCE_VALUE.ZERO,
|
||||||
|
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
|
||||||
|
}),
|
||||||
|
experience: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
|
})
|
||||||
|
|
||||||
|
schema.voies = new fields.SchemaField({
|
||||||
|
majeure: new fields.SchemaField({
|
||||||
|
id: new fields.DocumentIdField(),
|
||||||
|
key: new fields.StringField({ required: true }),
|
||||||
|
nom: new fields.StringField({ required: true }),
|
||||||
|
}),
|
||||||
|
mineure: new fields.SchemaField({
|
||||||
|
id: new fields.DocumentIdField(),
|
||||||
|
key: new fields.StringField({ required: true }),
|
||||||
|
nom: new fields.StringField({ required: true }),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static LOCALIZATION_PREFIXES = ["TENEBRIS.Character"]
|
||||||
|
|
||||||
|
get hasVoieMajeure() {
|
||||||
|
return !!this.voies.majeure.id
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasVoieMineure() {
|
||||||
|
return !!this.voies.mineure.id
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rolls a dice for a character.
|
||||||
|
* @param {("save"|"resource|damage")} rollType The type of the roll.
|
||||||
|
* @param {number} rollTarget The target value for the roll. Which caracteristic or resource. If the roll is a damage roll, this is the id of the item.
|
||||||
|
* @param {"="|"+"|"++"|"-"|"--"} rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=).
|
||||||
|
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
|
||||||
|
*/
|
||||||
|
async roll(rollType, rollTarget, rollAdvantage = "=") {
|
||||||
|
let rollValue
|
||||||
|
let opponentTarget
|
||||||
|
switch (rollType) {
|
||||||
|
case ROLL_TYPE.SAVE:
|
||||||
|
rollValue = this.caracteristiques[rollTarget].valeur
|
||||||
|
opponentTarget = game.user.targets.first()
|
||||||
|
break
|
||||||
|
case ROLL_TYPE.RESOURCE:
|
||||||
|
rollValue = this.ressources[rollTarget].valeur
|
||||||
|
break
|
||||||
|
case ROLL_TYPE.DAMAGE:
|
||||||
|
rollValue = this.parent.items.get(rollTarget).system.degats
|
||||||
|
opponentTarget = game.user.targets.first()
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
// Handle other cases or do nothing
|
||||||
|
break
|
||||||
|
}
|
||||||
|
await this._roll(rollType, rollTarget, rollValue, opponentTarget, rollAdvantage)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rolls a dice for a character.
|
||||||
|
* @param {("save"|"resource|damage")} rollType The type of the roll.
|
||||||
|
* @param {number} rollTarget The target value for the roll. Which caracteristic or resource. If the roll is a damage roll, this is the id of the item.
|
||||||
|
* @param {number} rollValue The value of the roll. If the roll is a damage roll, this is the dice to roll.
|
||||||
|
* @param {Token} opponentTarget The target of the roll : used for save rolls to get the oppponent's malus.
|
||||||
|
* @param {"="|"+"|"++"|"-"|"--"} rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=).
|
||||||
|
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
|
||||||
|
*/
|
||||||
|
async _roll(rollType, rollTarget, rollValue, opponentTarget = undefined, rollAdvantage = "=") {
|
||||||
|
const hasTarget = opponentTarget !== undefined
|
||||||
|
let roll = await LethalFantasyRoll.prompt({
|
||||||
|
rollType,
|
||||||
|
rollTarget,
|
||||||
|
rollValue,
|
||||||
|
actorId: this.parent.id,
|
||||||
|
actorName: this.parent.name,
|
||||||
|
actorImage: this.parent.img,
|
||||||
|
hasTarget,
|
||||||
|
target: opponentTarget,
|
||||||
|
rollAdvantage,
|
||||||
|
})
|
||||||
|
if (!roll) return null
|
||||||
|
|
||||||
|
// Perte de ressouces
|
||||||
|
if (rollType === ROLL_TYPE.RESOURCE && roll.resultType === "failure") {
|
||||||
|
const value = this.ressources[rollTarget].valeur
|
||||||
|
const newValue = LethalFantasyUtils.findLowerDice(value)
|
||||||
|
await this.parent.update({ [`system.ressources.${rollTarget}.valeur`]: newValue })
|
||||||
|
}
|
||||||
|
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||||
|
}
|
||||||
|
}
|
49
module/models/opponent.mjs
Normal file
49
module/models/opponent.mjs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import LethalFantasyRoll from "../documents/roll.mjs"
|
||||||
|
import { ROLL_TYPE } from "../config/system.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyOpponent extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||||
|
const schema = {}
|
||||||
|
|
||||||
|
schema.dv = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||||
|
schema.pv = new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
|
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
|
||||||
|
})
|
||||||
|
schema.armure = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||||
|
schema.malus = new fields.NumberField({ ...requiredInteger, initial: 0, max: 0 })
|
||||||
|
schema.actions = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||||
|
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
// Attaques : embedded items of type Attack
|
||||||
|
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static LOCALIZATION_PREFIXES = ["TENEBRIS.Opponent"]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rolls a dice attack for an opponent.
|
||||||
|
* @param {number} rollValue The dice to roll.
|
||||||
|
* @param {number} rollTarget The name of the attack
|
||||||
|
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
|
||||||
|
*/
|
||||||
|
async roll(rollValue, rollTarget) {
|
||||||
|
let roll = await LethalFantasyRoll.prompt({
|
||||||
|
rollType: ROLL_TYPE.ATTACK,
|
||||||
|
rollValue,
|
||||||
|
rollTarget,
|
||||||
|
actorId: this.parent.id,
|
||||||
|
actorName: this.parent.name,
|
||||||
|
actorImage: this.parent.img,
|
||||||
|
})
|
||||||
|
if (!roll) return null
|
||||||
|
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||||
|
}
|
||||||
|
|
||||||
|
get toolTip() {
|
||||||
|
return this.description || ""
|
||||||
|
}
|
||||||
|
}
|
83
module/models/path.mjs
Normal file
83
module/models/path.mjs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
import { SYSTEM } from "../config/system.mjs"
|
||||||
|
export default class LethalFantasyPath extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
const schema = {}
|
||||||
|
|
||||||
|
schema.key = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||||
|
|
||||||
|
// Caractéristiques
|
||||||
|
const characteristicField = (label) => {
|
||||||
|
const schema = {
|
||||||
|
valeur: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
integer: true,
|
||||||
|
initial: 10,
|
||||||
|
min: 0,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
return new fields.SchemaField(schema, { label })
|
||||||
|
}
|
||||||
|
|
||||||
|
schema.caracteristiques = new fields.SchemaField(
|
||||||
|
Object.values(SYSTEM.CHARACTERISTICS).reduce((obj, characteristic) => {
|
||||||
|
obj[characteristic.id] = characteristicField(characteristic.label)
|
||||||
|
return obj
|
||||||
|
}, {}),
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ressources
|
||||||
|
const resourceField = (label) => {
|
||||||
|
const schema = {
|
||||||
|
valeur: new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
initial: SYSTEM.RESOURCE_VALUE.ZERO,
|
||||||
|
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
return new fields.SchemaField(schema, { label })
|
||||||
|
}
|
||||||
|
|
||||||
|
schema.ressources = new fields.SchemaField(
|
||||||
|
Object.values(SYSTEM.RESOURCES).reduce((obj, resource) => {
|
||||||
|
obj[resource.id] = resourceField(resource.label)
|
||||||
|
return obj
|
||||||
|
}, {}),
|
||||||
|
)
|
||||||
|
|
||||||
|
schema.dv = new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
initial: SYSTEM.RESOURCE_VALUE.ZERO,
|
||||||
|
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
|
||||||
|
})
|
||||||
|
|
||||||
|
schema.dmax = new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
initial: SYSTEM.RESOURCE_VALUE.ZERO,
|
||||||
|
choices: Object.fromEntries(Object.entries(SYSTEM.RESOURCE_VALUE).map(([key, value]) => [value, { label: `${value}` }])),
|
||||||
|
})
|
||||||
|
|
||||||
|
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
|
||||||
|
schema.biens = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
|
||||||
|
schema.langues = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
|
||||||
|
schema.talents = new fields.ArrayField(new fields.DocumentUUIDField())
|
||||||
|
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static LOCALIZATION_PREFIXES = ["TENEBRIS.Path"]
|
||||||
|
|
||||||
|
async getAllTalents() {
|
||||||
|
const talents = []
|
||||||
|
this.talents.forEach(async (element) => {
|
||||||
|
const talent = await fromUuid(element)
|
||||||
|
if (talent) talents.push(talent)
|
||||||
|
})
|
||||||
|
return talents
|
||||||
|
}
|
||||||
|
}
|
27
module/models/spell.mjs
Normal file
27
module/models/spell.mjs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { SYSTEM } from "../config/system.mjs"
|
||||||
|
export default class LethalFantasySpell extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||||
|
const schema = {}
|
||||||
|
|
||||||
|
schema.description = new fields.HTMLField({
|
||||||
|
required: false,
|
||||||
|
blank: true,
|
||||||
|
initial: "",
|
||||||
|
textSearch: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
schema.preparation = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||||
|
schema.cible = new fields.StringField({ required: true })
|
||||||
|
schema.portee = new fields.StringField({ required: true, initial: "contact", choices: SYSTEM.SPELL_RANGE })
|
||||||
|
schema.duree = new fields.StringField({ required: true })
|
||||||
|
schema.consequenceA = new fields.StringField({ required: true })
|
||||||
|
schema.consequenceB = new fields.StringField({ required: true })
|
||||||
|
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static LOCALIZATION_PREFIXES = ["TENEBRIS.Spell"]
|
||||||
|
}
|
44
module/models/talent.mjs
Normal file
44
module/models/talent.mjs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
export default class LethalFantasyTalent extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||||
|
const schema = {}
|
||||||
|
|
||||||
|
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
|
||||||
|
schema.appris = new fields.BooleanField()
|
||||||
|
schema.progression = new fields.BooleanField()
|
||||||
|
schema.niveau = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 3 })
|
||||||
|
schema.path = new fields.DocumentUUIDField()
|
||||||
|
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static LOCALIZATION_PREFIXES = ["TENEBRIS.Talent"]
|
||||||
|
|
||||||
|
get canProgress() {
|
||||||
|
return this.progression
|
||||||
|
}
|
||||||
|
|
||||||
|
get isLearned() {
|
||||||
|
return this.appris
|
||||||
|
}
|
||||||
|
|
||||||
|
get improvedDescription() {
|
||||||
|
return this.description.replace(/#niveau\b/g, this.niveau)
|
||||||
|
}
|
||||||
|
|
||||||
|
get details() {
|
||||||
|
if (this.progression)
|
||||||
|
return game.i18n.format("TENEBRIS.Talent.details", {
|
||||||
|
niveau: this.niveau,
|
||||||
|
})
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPathName() {
|
||||||
|
const path = await fromUuid(this.path)
|
||||||
|
return path ? path.name : ""
|
||||||
|
}
|
||||||
|
}
|
24
module/models/weapon.mjs
Normal file
24
module/models/weapon.mjs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { SYSTEM } from "../config/system.mjs"
|
||||||
|
import { CATEGORY } from "../config/weapon.mjs"
|
||||||
|
export default class LethalFantasyWeapon extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
const schema = {}
|
||||||
|
|
||||||
|
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||||
|
schema.categorie = new fields.StringField({ required: true, initial: "mains", choices: SYSTEM.WEAPON_CATEGORY })
|
||||||
|
schema.degats = new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
initial: SYSTEM.WEAPON_DAMAGE.UN,
|
||||||
|
choices: Object.fromEntries(Object.entries(SYSTEM.WEAPON_DAMAGE).map(([key, value]) => [value, { label: `${value}` }])),
|
||||||
|
})
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static LOCALIZATION_PREFIXES = ["TENEBRIS.Weapon"]
|
||||||
|
|
||||||
|
get weaponCategory() {
|
||||||
|
return game.i18n.localize(CATEGORY[this.categorie].label)
|
||||||
|
}
|
||||||
|
}
|
33
module/socket.mjs
Normal file
33
module/socket.mjs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import LethalFantasyFortune from "./applications/fortune.mjs"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles socket events based on the provided action.
|
||||||
|
*
|
||||||
|
* @param {Object} [params={}] The parameters for the socket event.
|
||||||
|
* @param {string|null} [params.action=null] The action to be performed.
|
||||||
|
* @param {Object} [params.data={}] The data associated with the action.
|
||||||
|
* @returns {*} The result of the action handler, if applicable.
|
||||||
|
*/
|
||||||
|
export function handleSocketEvent({ action = null, data = {} } = {}) {
|
||||||
|
console.debug("handleSocketEvent", action, data)
|
||||||
|
switch (action) {
|
||||||
|
case "fortune":
|
||||||
|
return LethalFantasyFortune.handleSocketEvent(data)
|
||||||
|
case "askRoll":
|
||||||
|
return _askRoll(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the socket event to ask for a roll.
|
||||||
|
*
|
||||||
|
* @param {Object} [options={}] The options object.
|
||||||
|
* @param {string} [options.userId] The ID of the user who initiated the roll.
|
||||||
|
*/
|
||||||
|
export function _askRoll({ userId } = {}) {
|
||||||
|
console.debug(`handleSocketEvent _askRoll from ${userId} !`)
|
||||||
|
const currentUser = game.user._id
|
||||||
|
if (userId === currentUser) {
|
||||||
|
foundry.audio.AudioHelper.play({ src: "/systems/fvtt-lethal-fantasy/sounds/drums.wav", volume: 0.8, autoplay: true, loop: false }, false)
|
||||||
|
}
|
||||||
|
}
|
23
module/utils.mjs
Normal file
23
module/utils.mjs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { DICE_VALUES } from "./config/system.mjs"
|
||||||
|
|
||||||
|
export default class LethalFantasyUtils {
|
||||||
|
// Return the maximum damage limited by the maximum damage of the character
|
||||||
|
static maxDamage(damage, damageMax) {
|
||||||
|
const damageIndex = DICE_VALUES.indexOf(damage)
|
||||||
|
const damageMaxIndex = DICE_VALUES.indexOf(damageMax)
|
||||||
|
|
||||||
|
// If damage exceeds damageMax, return damageMax
|
||||||
|
if (damageIndex > damageMaxIndex) {
|
||||||
|
return damageMax
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, return damage (as it is less than or equal to damageMax)
|
||||||
|
return damage
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used when a ressource is lost to find the next lower dice
|
||||||
|
static findLowerDice(dice) {
|
||||||
|
let index = DICE_VALUES.indexOf(dice)
|
||||||
|
return DICE_VALUES[index - 1]
|
||||||
|
}
|
||||||
|
}
|
27
package.json
Normal file
27
package.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "fvtt-lethal-fantasy",
|
||||||
|
"private": true,
|
||||||
|
"version": "1.0.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.8.0",
|
||||||
|
"@foundryvtt/foundryvtt-cli": "^1.0.2",
|
||||||
|
"commander": "^11.1.0",
|
||||||
|
"eslint": "^9.9.0",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"eslint-plugin-jsdoc": "^48.11.0",
|
||||||
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
|
"globals": "^15.9.0",
|
||||||
|
"less": "^4.1.3",
|
||||||
|
"prettier": "^3.3.3"
|
||||||
|
},
|
||||||
|
"author": "LeRatierBretonnien",
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"dependencies": {
|
||||||
|
"gulp": "^5.0.0",
|
||||||
|
"gulp-less": "^5.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"pushLDBtoYML": "node ./tools/pushLDBtoYML.mjs",
|
||||||
|
"pullYMLtoLDB": "node ./tools/pullYMLtoLDB.mjs"
|
||||||
|
}
|
||||||
|
}
|
46
styles/application-fortune.less
Normal file
46
styles/application-fortune.less
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#tenebris-application-fortune {
|
||||||
|
font-family: var(--font-primary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
color: var(--color-light-1);
|
||||||
|
|
||||||
|
menu {
|
||||||
|
.rollable:hover,
|
||||||
|
.rollable:focus {
|
||||||
|
text-shadow: 0 0 8px var(--color-shadow-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
section {
|
||||||
|
background-image: url("../assets/background-small.webp");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.application-fortune {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
//align-items: center;
|
||||||
|
font-size: calc(var(--font-size-standard) * 3);
|
||||||
|
button {
|
||||||
|
color: var(--color-light-1);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
margin-top: 10px;
|
||||||
|
border: none;
|
||||||
|
background-color: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.application-fortune-gm {
|
||||||
|
//padding-right: 50px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.application-fortune-player {
|
||||||
|
//padding-right: 20px;
|
||||||
|
justify-content: space-between
|
||||||
|
}
|
||||||
|
}
|
21
styles/application-manager.less
Normal file
21
styles/application-manager.less
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#tenebris-application-manager {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
font-family: var(--font-primary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1);
|
||||||
|
color: var(--color-dark-1);
|
||||||
|
background-image: var(--background-image-base);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
|
||||||
|
.tenebris-table {
|
||||||
|
margin: 1rem;
|
||||||
|
background: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
.player {
|
||||||
|
font-size: calc(var(--font-size-standard) * 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
styles/armor.less
Normal file
16
styles/armor.less
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.armor-content {
|
||||||
|
.sheet-common();
|
||||||
|
.item-sheet-common();
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
flex: 10%;
|
||||||
|
}
|
||||||
|
}
|
16
styles/attack.less
Normal file
16
styles/attack.less
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.attack-content {
|
||||||
|
.sheet-common();
|
||||||
|
.item-sheet-common();
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
flex: 10%;
|
||||||
|
}
|
||||||
|
}
|
332
styles/character.less
Normal file
332
styles/character.less
Normal file
@ -0,0 +1,332 @@
|
|||||||
|
.character-content {
|
||||||
|
.sheet-common();
|
||||||
|
.character-sheet-common();
|
||||||
|
overflow: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-main {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.character-personnage {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.character-gauche {
|
||||||
|
min-width: 180px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.character-gauche-image {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
.character-img {
|
||||||
|
height: 140px;
|
||||||
|
width: auto;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-dv,
|
||||||
|
.character-dmax {
|
||||||
|
.form-fields {
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.character-dmax-edit {
|
||||||
|
input {
|
||||||
|
display: flex;
|
||||||
|
width: 60px;
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 5px 0 5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-droite {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 5px;
|
||||||
|
|
||||||
|
.character-name {
|
||||||
|
display: flex;
|
||||||
|
input {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-infos {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
label {
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-voie-majeure,
|
||||||
|
.character-voie-mineure {
|
||||||
|
display: flex;
|
||||||
|
input {
|
||||||
|
width: 280px;
|
||||||
|
}
|
||||||
|
.controls {
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-commanditaire {
|
||||||
|
display: flex;
|
||||||
|
input {
|
||||||
|
width: 280px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-pv {
|
||||||
|
display: flex;
|
||||||
|
gap: 2px;
|
||||||
|
align-items: center;
|
||||||
|
.character-pv-value {
|
||||||
|
.form-fields input {
|
||||||
|
flex: none;
|
||||||
|
width: 50px;
|
||||||
|
margin-left: 10px;
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.character-pv-max {
|
||||||
|
clear: both;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin: 3px 0;
|
||||||
|
align-items: center;
|
||||||
|
input {
|
||||||
|
width: 50px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pv-separator {
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-personnage-play {
|
||||||
|
min-width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-personnage-edit {
|
||||||
|
min-width: 650px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-caracteristiques {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 5px;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.character-caracteristique {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.rollable:hover,
|
||||||
|
.rollable:focus {
|
||||||
|
text-shadow: 0 0 8px var(--color-shadow-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.form-group {
|
||||||
|
flex: 1;
|
||||||
|
padding-left: 5px;
|
||||||
|
.form-fields {
|
||||||
|
flex: none;
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.experience {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
input {
|
||||||
|
display: flex;
|
||||||
|
width: 70px;
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 5px 0 5px;
|
||||||
|
}
|
||||||
|
input[type="number"] {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
input[type="checkbox"] {
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
input[type="checkbox"]:checked {
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
input[type="checkbox"]:checked::after {
|
||||||
|
color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-caracteristiques-play {
|
||||||
|
min-width: 225px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-caracteristiques-edit {
|
||||||
|
min-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-ressources {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 5px;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.character-ressource {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.rollable:hover,
|
||||||
|
.rollable:focus {
|
||||||
|
text-shadow: 0 0 8px var(--color-shadow-primary);
|
||||||
|
cursor:
|
||||||
|
pointer;
|
||||||
|
}
|
||||||
|
.form-group {
|
||||||
|
flex: 1;
|
||||||
|
padding-left: 5px;
|
||||||
|
.form-fields {
|
||||||
|
flex: none;
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.character-ressource-edit {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
input {
|
||||||
|
display: flex;
|
||||||
|
width: 70px;
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 5px 0 5px;
|
||||||
|
}
|
||||||
|
input[type="number"] {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.5);
|
||||||
|
text-align: center;
|
||||||
|
width: 75px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-ressources-play {
|
||||||
|
min-width: 235px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-ressources-edit {
|
||||||
|
min-width: 400px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-biography {
|
||||||
|
prose-mirror.inactive {
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
prose-mirror.active {
|
||||||
|
min-height: 150px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab.character-items {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
legend {
|
||||||
|
a {
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.talents {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(5, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
.talent {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
.item-img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.weapons {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
.weapon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
.item-img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
margin: 5px 0 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.armors {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
.armor {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
.item-img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
margin: 5px 0 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.spells {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
.spell {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.appris {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
prose-mirror.inactive {
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
prose-mirror.active {
|
||||||
|
min-height: 150px;
|
||||||
|
}
|
||||||
|
}
|
40
styles/chat.less
Normal file
40
styles/chat.less
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
&.fortune {
|
||||||
|
img {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
.intro-chat {
|
||||||
|
border-radius: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
.intro-img {
|
||||||
|
padding: 5px;
|
||||||
|
width: 80px;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
.intro-right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.introText {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
width: 210px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.button.control, .fortune-accepted {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.ask-roll {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
}
|
24
styles/fonts.less
Normal file
24
styles/fonts.less
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: "Cat Franken";
|
||||||
|
src: url("../fonts/catfranken-deutsch.ttf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Caslon";
|
||||||
|
src: url("../fonts/caslonpro-regular.otf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Caslon Bold";
|
||||||
|
src: url("../fonts/caslonpro-bold.otf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Caslon Bold Italic";
|
||||||
|
src: url("../fonts/caslonpro-bolditalic.otf") format("truetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Caslon Italic";
|
||||||
|
src: url("../fonts/caslonpro-italic.otf") format("truetype");
|
||||||
|
}
|
59
styles/global.less
Normal file
59
styles/global.less
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
:root {
|
||||||
|
--font-size-standard: 0.8125rem;
|
||||||
|
--background-image-base: url("../assets/parchment.jpg");
|
||||||
|
--font-secondary: "Amiri", serif;
|
||||||
|
--logo-standard: url("../assets/tenebris-logo.webp");
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo {
|
||||||
|
content: var(--logo-standard);
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pause > img {
|
||||||
|
content: var(--logo-standard);
|
||||||
|
height: 192px;
|
||||||
|
width: 192px;
|
||||||
|
top: -45px;
|
||||||
|
left: calc(50% - 96px);
|
||||||
|
}
|
||||||
|
|
||||||
|
i.tenebris {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
background-image: var(--logo-standard);
|
||||||
|
background-size: 100%;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
filter: grayscale(1);
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.application.dialog.tenebris {
|
||||||
|
font-family: var(--font-primary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
background-image: var(--background-image-base);
|
||||||
|
button:hover {
|
||||||
|
background: var(--color-dark-6);
|
||||||
|
}
|
||||||
|
.legend {
|
||||||
|
font-family: var(--font-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#tooltip.tooltip-avantages {
|
||||||
|
max-width: 550px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-message,
|
||||||
|
.chat-message.whisper {
|
||||||
|
font-family: var(--font-primary);
|
||||||
|
background-image: var(--background-image-base);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
}
|
18
styles/lethal-fantasy.less
Normal file
18
styles/lethal-fantasy.less
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
@import "global.less";
|
||||||
|
|
||||||
|
.tenebris {
|
||||||
|
@import "mixins.less";
|
||||||
|
@import "character.less";
|
||||||
|
@import "opponent.less";
|
||||||
|
@import "path.less";
|
||||||
|
@import "talent.less";
|
||||||
|
@import "weapon.less";
|
||||||
|
@import "armor.less";
|
||||||
|
@import "spell.less";
|
||||||
|
@import "attack.less";
|
||||||
|
@import "chat.less";
|
||||||
|
}
|
||||||
|
|
||||||
|
@import "roll.less";
|
||||||
|
@import "application-fortune.less";
|
||||||
|
@import "application-manager.less";
|
74
styles/mixins.less
Normal file
74
styles/mixins.less
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
.sheet-common() {
|
||||||
|
font-family: var(--font-primary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1);
|
||||||
|
color: var(--color-dark-1);
|
||||||
|
background-image: var(--background-image-base);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
|
||||||
|
input:disabled,
|
||||||
|
select:disabled {
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
border-color: transparent;
|
||||||
|
color: var(--color-dark-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
select {
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
border-color: var(--color-dark-6);
|
||||||
|
color: var(--color-dark-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[name="name"] {
|
||||||
|
height: 50px;
|
||||||
|
margin-right: 10px;
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 2);
|
||||||
|
font-weight: bold;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-fields {
|
||||||
|
input,
|
||||||
|
select {
|
||||||
|
text-align: center;
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.6);
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.character-sheet-common {
|
||||||
|
label {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-sheet-common {
|
||||||
|
.form-fields {
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.6);
|
||||||
|
flex: 50%;
|
||||||
|
}
|
||||||
|
}
|
86
styles/opponent.less
Normal file
86
styles/opponent.less
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
.opponent-content {
|
||||||
|
.sheet-common();
|
||||||
|
overflow: scroll;
|
||||||
|
label {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.opponent-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
.opponent-img {
|
||||||
|
width: 100px;
|
||||||
|
height: auto;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
.character-name {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.opponent-main {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
.opponent-gauche {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 250px;
|
||||||
|
|
||||||
|
.opponent-caracteristiques {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.form-fields {
|
||||||
|
flex: none;
|
||||||
|
input {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.opponent-attacks {
|
||||||
|
legend {
|
||||||
|
a {
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.opponent-attack {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.opponent-spells {
|
||||||
|
legend {
|
||||||
|
a {
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.opponent-spell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.opponent-droite {
|
||||||
|
.opponent-description {
|
||||||
|
flex: 1; /* Prend également l'espace disponible */
|
||||||
|
min-width: 200px; /* Pour éviter que le contenu ne déborde */
|
||||||
|
prose-mirror.inactive {
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
prose-mirror.active {
|
||||||
|
min-height: 450px;
|
||||||
|
height: 100%;
|
||||||
|
min-width: 200px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
94
styles/path.less
Normal file
94
styles/path.less
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
.path-content {
|
||||||
|
.sheet-common();
|
||||||
|
.item-sheet-common();
|
||||||
|
|
||||||
|
.path-name {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.control {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-main {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 2fr 2fr 1fr;
|
||||||
|
|
||||||
|
.profil {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.profil-gauche,
|
||||||
|
.profil-droite {
|
||||||
|
flex: 1; /* Chaque colonne prend la moitié de l'espace disponible */
|
||||||
|
padding: 10px; /* Espacement intérieur */
|
||||||
|
}
|
||||||
|
|
||||||
|
.profil-gauche {
|
||||||
|
margin-right: 10px; /* Espace entre les deux colonnes */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Optionnel : supprimer le margin-right sur la dernière colonne si vous avez besoin d'un espacement précis */
|
||||||
|
.profil-droite {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.biens {
|
||||||
|
prose-mirror {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.langues {
|
||||||
|
prose-mirror {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
prose-mirror.inactive {
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
prose-mirror.active {
|
||||||
|
min-height: 150px;
|
||||||
|
}
|
||||||
|
grid-column: span 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-talents {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(5, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
.talent {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.name {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.5);
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
.controls {
|
||||||
|
font-size: calc(var(--font-size-standard) * 0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.progression {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
.description {
|
||||||
|
font-size: calc(var(--font-size-standard) * 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
112
styles/roll.less
Normal file
112
styles/roll.less
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
.application.dialog.tenebris {
|
||||||
|
color: var(--color-dark-1);
|
||||||
|
|
||||||
|
input,
|
||||||
|
select {
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
border-color: var(--color-dark-6);
|
||||||
|
color: var(--color-dark-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tenebris-roll-dialog {
|
||||||
|
fieldset {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[name="selectAvantages"] {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-aide-gene {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
select {
|
||||||
|
border: none;
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
color: var(--color-dark-2);
|
||||||
|
width: 60px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-modificateur {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
select {
|
||||||
|
border: none;
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
color: var(--color-dark-2);
|
||||||
|
width: 60px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-avantages {
|
||||||
|
#selectAvantages {
|
||||||
|
background-color: inherit;
|
||||||
|
text-align: center;
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-damage,
|
||||||
|
.dialog-resource,
|
||||||
|
.dialog-save {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 2);
|
||||||
|
color: var(--color-dark-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.dice-roll {
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.dice-total,
|
||||||
|
.dice-formula {
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
.dice-total {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.message-header {
|
||||||
|
font-family: var(--font-primary);
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
.intro-chat {
|
||||||
|
border-radius: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
.intro-img {
|
||||||
|
padding: 5px;
|
||||||
|
width: 80px;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
.intro-right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.introText {
|
||||||
|
font-family: var(--font-secondary);
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
width: 210px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.result {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
text-shadow: 0 0 10px var(--color-shadow-primary);
|
||||||
|
}
|
||||||
|
}
|
21
styles/spell.less
Normal file
21
styles/spell.less
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
.spell-content {
|
||||||
|
.sheet-common();
|
||||||
|
.item-sheet-common();
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
flex: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[name="system.consequenceA"], input[name="system.consequenceB"] {
|
||||||
|
font-size: calc(var(--font-size-standard) * 1.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
26
styles/talent.less
Normal file
26
styles/talent.less
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
.talent-content {
|
||||||
|
.sheet-common();
|
||||||
|
.item-sheet-common();
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="checkbox"] {
|
||||||
|
font-size: var(--font-size-14);
|
||||||
|
width: 20px;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="checkbox"]:checked {
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="checkbox"]:checked::after {
|
||||||
|
color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
}
|
16
styles/weapon.less
Normal file
16
styles/weapon.less
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.weapon-content {
|
||||||
|
.sheet-common();
|
||||||
|
.item-sheet-common();
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
flex: 10%;
|
||||||
|
}
|
||||||
|
}
|
54
system.json
Normal file
54
system.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"id": "fvtt-lethal-fantasy",
|
||||||
|
"title": "Lethal Fantasy RPG",
|
||||||
|
"description": "",
|
||||||
|
"manifest": "#{MANIFEST}#",
|
||||||
|
"download": "#{DOWNLOAD}#",
|
||||||
|
"url": "#{URL}#",
|
||||||
|
"license": "LICENSE",
|
||||||
|
"version": "#{VERSION}#",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Uberwald",
|
||||||
|
"discord": "LeRatierBretonnien"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"compatibility": {
|
||||||
|
"minimum": "12",
|
||||||
|
"verified": "12"
|
||||||
|
},
|
||||||
|
"esmodules": ["lethal-fantasy.mjs"],
|
||||||
|
"styles": ["css/lethal-fantasy.css"],
|
||||||
|
"languages": [
|
||||||
|
{
|
||||||
|
"lang": "en",
|
||||||
|
"name": "Anglais",
|
||||||
|
"path": "lang/fr.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"documentTypes": {
|
||||||
|
"Actor": {
|
||||||
|
"character": { "htmlFields": ["description", "langues", "notes"] },
|
||||||
|
"opponent": { "htmlFields": ["description"] }
|
||||||
|
},
|
||||||
|
"Item": {
|
||||||
|
"path": { "htmlFields": ["description", "biens", "langues"] },
|
||||||
|
"talent": { "htmlFields": ["description"] },
|
||||||
|
"weapon": { "htmlFields": ["description"] },
|
||||||
|
"armor": { "htmlFields": ["description"] },
|
||||||
|
"spell": { "htmlFields": ["description"] },
|
||||||
|
"attack": { "htmlFields": ["description"] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"grid": {
|
||||||
|
"distance": 10,
|
||||||
|
"units": "m"
|
||||||
|
},
|
||||||
|
"primaryTokenAttribute": "hp",
|
||||||
|
"socket": true,
|
||||||
|
"background": "systems/fvtt-lethal-fantasy/assets/background.webp",
|
||||||
|
"packs": [
|
||||||
|
{
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
20
templates/armor.hbs
Normal file
20
templates/armor.hbs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<section>
|
||||||
|
<div class="header">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-edit="img" data-action="editImage" data-tooltip="{{item.name}}" />
|
||||||
|
{{formInput fields.name value=source.name}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{formField systemFields.categorie value=system.categorie localize=true}}
|
||||||
|
{{formField systemFields.valeur value=system.valeur}}
|
||||||
|
{{formField systemFields.malus value=system.malus}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.description"}}</legend>
|
||||||
|
{{formInput
|
||||||
|
systemFields.description
|
||||||
|
enriched=enrichedDescription
|
||||||
|
value=system.description
|
||||||
|
name="system.description"
|
||||||
|
toggled="false"
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
12
templates/attack.hbs
Normal file
12
templates/attack.hbs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<section>
|
||||||
|
<div class="header">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-edit="img" data-action="editImage" data-tooltip="{{item.name}}" />
|
||||||
|
{{formInput fields.name value=source.name}}
|
||||||
|
</div>
|
||||||
|
{{formField systemFields.degats value=system.degats}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.description"}}</legend>
|
||||||
|
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</section>
|
14
templates/character-biography.hbs
Normal file
14
templates/character-biography.hbs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<section class="tab character-{{tab.id}} {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Character.Label.description"}}</legend>
|
||||||
|
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Character.Label.langues"}}</legend>
|
||||||
|
{{formInput systemFields.langues enriched=enrichedLangues value=system.langues name="system.langues" toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Character.Label.notes"}}</legend>
|
||||||
|
{{formInput systemFields.notes enriched=enrichedNotes value=system.notes name="system.notes" toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
103
templates/character-items.hbs
Normal file
103
templates/character-items.hbs
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<section class="tab character-{{tab.id}} {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend data-tooltip="{{localize "TENEBRIS.Tooltip.learnedTalents"}}" data-tooltip-direction="UP">{{localize "TENEBRIS.Label.talents"}}</legend>
|
||||||
|
<div class="talents">
|
||||||
|
{{#if @root.isEditMode}}
|
||||||
|
{{#each talents as |item|}}
|
||||||
|
{{!log "path-talent" this}}
|
||||||
|
<div class="talent {{#if item.appris}}appris{{/if}}" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
|
||||||
|
<div class="name" data-tooltip="{{{item.description}}}<br><br>{{item.path}}" data-tooltip-direction="UP">{{item.name}}
|
||||||
|
{{#if item.progression}}<span data-tooltip="{{localize 'TENEBRIS.Label.progressionPossible'}}"> (P)</span>{{/if}}
|
||||||
|
{{#if (and item.progression (gt item.niveau 1))}}{{localize 'TENEBRIS.Label.level'}} {{item.niveau}}{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Edit'}}" data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Delete'}}" data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{else}}
|
||||||
|
{{#each talentsAppris as |item|}}
|
||||||
|
{{!log "path-talent appris" this}}
|
||||||
|
<div class="talent" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-tooltip="{{{item.description}}}<br><br>{{item.path}}">
|
||||||
|
{{#if (ne item.img "icons/svg/item-bag.svg")}}
|
||||||
|
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
|
||||||
|
{{/if}}
|
||||||
|
{{item.name}} {{item.details}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.equipement"}}{{#if isEditMode}}<a class="action" data-tooltip="{{localize "TENEBRIS.Tooltip.addEquipment"}}" data-tooltip-direction="UP"><i class="fas fa-plus" data-action="createEquipment"></i></a>{{/if}}</legend>
|
||||||
|
<div class="weapons">
|
||||||
|
{{#each weapons as |item|}}
|
||||||
|
{{!log 'weapon' this}}
|
||||||
|
<div class="weapon" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true" data-drag-type="damage">
|
||||||
|
{{#if (ne item.img "icons/svg/item-bag.svg")}}
|
||||||
|
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
|
||||||
|
{{/if}}
|
||||||
|
<div class="name" data-tooltip="{{{item.system.description}}}">
|
||||||
|
{{item.name}}
|
||||||
|
</div>
|
||||||
|
<a {{#if (ne item.system.degats "1")}}class="rollable" data-item-id="{{item.id}}" data-action="roll" data-roll-type="damage" data-roll-value="{{item.system.degats}}"{{/if}}>{{localize "TENEBRIS.Label.degats"}} : {{item.system.degats}}</a>
|
||||||
|
{{#if @root.isEditMode}}
|
||||||
|
<div class="controls">
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Edit'}}" data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Delete'}}" data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
<div class="armors">
|
||||||
|
{{#each armors as |item|}}
|
||||||
|
{{!log 'armor' this}}
|
||||||
|
<div class="armor" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
|
||||||
|
<div class="name" data-tooltip="{{{item.system.description}}}">
|
||||||
|
{{item.name}}
|
||||||
|
</div>
|
||||||
|
{{localize "TENEBRIS.Label.armor"}} : {{item.system.valeur}} {{localize "TENEBRIS.Label.malus"}} : {{item.system.malus}}
|
||||||
|
{{#if @root.isEditMode}}
|
||||||
|
<div class="controls">
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Edit'}}" data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Delete'}}" data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.biens"}}</legend>
|
||||||
|
{{formInput systemFields.biens enriched=enrichedBiens value=system.biens name="system.biens" toggled=true }}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{#if (or isEditMode (and isPlayMode hasSpells))}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.spells"}}{{#if isEditMode}}<a class="action" data-tooltip="{{localize "TENEBRIS.Tooltip.addSpell"}}" data-tooltip-direction="UP"><i class="fas fa-plus" data-action="createSpell"></i></a>{{/if}}</legend>
|
||||||
|
<div class="spells">
|
||||||
|
{{#each spells as |item|}}
|
||||||
|
{{!log 'weapon' this}}
|
||||||
|
<div class="spell" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true" data-drag-type="spell">
|
||||||
|
<div class="name" data-tooltip="{{{item.system.description}}}">
|
||||||
|
{{item.name}}
|
||||||
|
</div>
|
||||||
|
{{#if @root.isEditMode}}
|
||||||
|
<div class="controls">
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Edit'}}" data-action="edit" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Delete'}}" data-action="delete" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
{{/if}}
|
||||||
|
</section>
|
187
templates/character-main.hbs
Normal file
187
templates/character-main.hbs
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
<section class="character-main character-main-{{ifThen isPlayMode 'play' 'edit'}}">
|
||||||
|
{{!log "character-main" this}}
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Character.Label.personnage"}}</legend>
|
||||||
|
<div class="character-personnage character-personnage-{{ifThen isPlayMode 'play' 'edit'}}">
|
||||||
|
<div class="character-gauche">
|
||||||
|
<div class="character-gauche-image">
|
||||||
|
<img class="character-img" src="{{actor.img}}" data-edit="img" data-action="editImage" data-tooltip="{{actor.name}}" />
|
||||||
|
</div>
|
||||||
|
<div class="character-dv">
|
||||||
|
{{formField systemFields.dv value=system.dv rootId=partId disabled=isPlayMode classes="character-dv"}}
|
||||||
|
</div>
|
||||||
|
<div class="character-dmax" data-tooltip="{{tooltipsCaracteristiques.dmax}}">
|
||||||
|
{{formField systemFields.dmax.fields.valeur value=system.dmax.valeur rootId=partId disabled=isPlayMode classes="character-dmax"}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="character-dmax-edit">
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experienceDetail" detail='Dégâts max'}}">{{formInput systemFields.dmax.fields.experience value=system.dmax.experience}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="character-droite">
|
||||||
|
<div class="character-name">
|
||||||
|
{{formInput fields.name value=source.name rootId=partId disabled=isPlayMode}}
|
||||||
|
<a class="control" data-action="toggleSheet" data-tooltip="TENEBRIS.ToggleSheet" data-tooltip-direction="UP">
|
||||||
|
<i class="fa-solid fa-user-{{ifThen isPlayMode 'lock' 'pen'}}"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="character-infos">
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="character-voie-majeure">
|
||||||
|
{{formField systemFields.voies.fields.majeure.fields.nom value=system.voies.majeure.nom rootId=partId disabled=true}}
|
||||||
|
{{#if system.hasVoieMajeure}}
|
||||||
|
<div class="controls">
|
||||||
|
<a class="control" data-action="edit" data-item-id="{{actor.system.voies.majeure.id}}" data-tooltip="{{localize 'TENEBRIS.Edit'}}"><i class="fas fa-edit"></i></a>
|
||||||
|
{{#if (not system.hasVoieMineure)}}
|
||||||
|
<a class="control" data-action="deleteVoieMajeure" data-tooltip="{{localize 'TENEBRIS.Delete'}}"><i class="fas fa-trash"></i></a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-voie-mineure">
|
||||||
|
{{formField systemFields.voies.fields.mineure.fields.nom value=system.voies.mineure.nom rootId=partId disabled=true}}
|
||||||
|
{{#if system.hasVoieMineure}}
|
||||||
|
<div class="controls">
|
||||||
|
<a class="control" data-action="edit" data-item-id="{{actor.system.voies.majeure.id}}" data-tooltip="{{localize 'TENEBRIS.Edit'}}"><i class="fas fa-edit"></i></a>
|
||||||
|
<a class="control" data-action="deleteVoieMineure" data-tooltip="{{localize 'TENEBRIS.Delete'}}"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="character-voie-majeure">
|
||||||
|
{{formField systemFields.voies.fields.majeure.fields.nom value=system.voies.majeure.nom rootId=partId disabled=true}}
|
||||||
|
</div>
|
||||||
|
{{#if system.hasVoieMineure}}
|
||||||
|
<div class="character-voie-mineure">
|
||||||
|
{{formField systemFields.voies.fields.mineure.fields.nom value=system.voies.mineure.nom rootId=partId disabled=true}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
<div class="character-commanditaire">
|
||||||
|
{{formField systemFields.commanditaire value=system.commanditaire rootId=partId disabled=isPlayMode classes="character-commanditaire"}}
|
||||||
|
</div>
|
||||||
|
<div class="character-pv">
|
||||||
|
<div class="character-pv-value">
|
||||||
|
{{formField systemFields.pv.fields.value value=system.pv.value}}
|
||||||
|
</div>
|
||||||
|
<div class="pv-separator">/</div>
|
||||||
|
<div class="character-pv-max">
|
||||||
|
{{formInput systemFields.pv.fields.max value=system.pv.max rootId=partId disabled=isPlayMode}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="character-caracteristiques character-caracteristiques-{{ifThen isPlayMode 'play' 'edit'}}">
|
||||||
|
<legend>{{localize "TENEBRIS.Character.Label.caracteristiques"}}</legend>
|
||||||
|
<div class="character-caracteristique" data-drag="true" data-drag-type="save">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsCaracteristiques.rob}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.caracteristiques.fields.rob.fields.valeur value=system.caracteristiques.rob.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.saveRob}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="experience">
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.caracteristiques.fields.rob.fields.progression.fields.experience value=system.caracteristiques.rob.progression.experience}}</div>
|
||||||
|
<div class="experience-progress" data-tooltip="{{localize "TENEBRIS.Label.progress"}}">{{formInput systemFields.caracteristiques.fields.rob.fields.progression.fields.progres value=system.caracteristiques.rob.progression.progres}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-caracteristique" data-drag="true" data-drag-type="save">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsCaracteristiques.dex}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.caracteristiques.fields.dex.fields.valeur value=system.caracteristiques.dex.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.saveDex}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="experience">
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.caracteristiques.fields.dex.fields.progression.fields.experience value=system.caracteristiques.dex.progression.experience}}</div>
|
||||||
|
<div class="experience-progress" data-tooltip="{{localize "TENEBRIS.Label.progress"}}">{{formInput systemFields.caracteristiques.fields.dex.fields.progression.fields.progres value=system.caracteristiques.dex.progression.progres}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-caracteristique" data-drag="true" data-drag-type="save">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsCaracteristiques.int}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.caracteristiques.fields.int.fields.valeur value=system.caracteristiques.int.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.saveInt}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="experience">
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.caracteristiques.fields.int.fields.progression.fields.experience value=system.caracteristiques.int.progression.experience}}</div>
|
||||||
|
<div class="experience-progress" data-tooltip="{{localize "TENEBRIS.Label.progress"}}">{{formInput systemFields.caracteristiques.fields.int.fields.progression.fields.progres value=system.caracteristiques.int.progression.progres}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-caracteristique" data-drag="true" data-drag-type="save">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsCaracteristiques.per}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.caracteristiques.fields.per.fields.valeur value=system.caracteristiques.per.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.savePer}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="experience">
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.caracteristiques.fields.per.fields.progression.fields.experience value=system.caracteristiques.per.progression.experience}}</div>
|
||||||
|
<div class="experience-progress" data-tooltip="{{localize "TENEBRIS.Label.progress"}}">{{formInput systemFields.caracteristiques.fields.per.fields.progression.fields.progres value=system.caracteristiques.per.progression.progres}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-caracteristique" data-drag="true" data-drag-type="save">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsCaracteristiques.vol}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.caracteristiques.fields.vol.fields.valeur value=system.caracteristiques.vol.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.saveVol}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="experience">
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.caracteristiques.fields.vol.fields.progression.fields.experience value=system.caracteristiques.vol.progression.experience}}</div>
|
||||||
|
<div class="experience-progress" data-tooltip="{{localize "TENEBRIS.Label.progress"}}">{{formInput systemFields.caracteristiques.fields.vol.fields.progression.fields.progres value=system.caracteristiques.vol.progression.progres}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="character-ressources character-ressources-{{ifThen isPlayMode 'play' 'edit'}}">
|
||||||
|
<legend>{{localize "TENEBRIS.Character.Label.ressources"}}</legend>
|
||||||
|
<div class="character-ressource" data-drag="true" data-drag-type="resource">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsRessources.san}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.ressources.fields.san.fields.valeur value=system.ressources.san.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.resourceSan}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="character-ressource-edit">
|
||||||
|
{{formInput systemFields.ressources.fields.san.fields.max value=system.ressources.san.max}}
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.ressources.fields.san.fields.experience value=system.ressources.san.experience}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-ressource" data-drag="true" data-drag-type="resource">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsRessources.oeil}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.ressources.fields.oeil.fields.valeur value=system.ressources.oeil.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.resourceOeil}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="character-ressource-edit">
|
||||||
|
{{formInput systemFields.ressources.fields.oeil.fields.max value=system.ressources.oeil.max}}
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.ressources.fields.oeil.fields.experience value=system.ressources.oeil.experience}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-ressource" data-drag="true" data-drag-type="resource">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsRessources.verbe}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.ressources.fields.verbe.fields.valeur value=system.ressources.verbe.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.resourceVerbe}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="character-ressource-edit">
|
||||||
|
{{formInput systemFields.ressources.fields.verbe.fields.max value=system.ressources.verbe.max}}
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.ressources.fields.verbe.fields.experience value=system.ressources.verbe.experience}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-ressource" data-drag="true" data-drag-type="resource">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsRessources.bourse}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.ressources.fields.bourse.fields.valeur value=system.ressources.bourse.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.resourceBourse}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="character-ressource-edit">
|
||||||
|
{{formInput systemFields.ressources.fields.bourse.fields.max value=system.ressources.bourse.max}}
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.ressources.fields.bourse.fields.experience value=system.ressources.bourse.experience}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="character-ressource" data-drag="true" data-drag-type="resource">
|
||||||
|
<i class="fa fa-question-circle" aria-hidden="true" data-tooltip="{{tooltipsRessources.magie}}" style="font-size: small;"></i>
|
||||||
|
{{formField systemFields.ressources.fields.magie.fields.valeur value=system.ressources.magie.valeur rootId=partId disabled=isPlayMode classes="rollable" dataset=rollType.resourceMagie}}
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<div class="character-ressource-edit">
|
||||||
|
{{formInput systemFields.ressources.fields.magie.fields.max value=system.ressources.magie.max}}
|
||||||
|
<div data-tooltip="{{localize "TENEBRIS.Label.experience"}}">{{formInput systemFields.ressources.fields.magie.fields.experience value=system.ressources.magie.experience}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</section>
|
6
templates/chat-ask-roll.hbs
Normal file
6
templates/chat-ask-roll.hbs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<div class="tenebris ask-roll">
|
||||||
|
<h4 class="ask-roll-title">{{title}}<br>{{text}}</h4>
|
||||||
|
<a class="ask-roll-dice" data-type="{{rollType}}" data-value="{{value}}" data-avantage="{{avantage}}">
|
||||||
|
<i class="fas fa-dice-d20" title="{{localize 'TENEBRIS.Manager.roll'}}"></i> {{localize 'TENEBRIS.Manager.roll'}}
|
||||||
|
</a>
|
||||||
|
</div>
|
17
templates/chat-fortune.hbs
Normal file
17
templates/chat-fortune.hbs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{!log 'chat-fortune' this}}
|
||||||
|
<div class="tenebris fortune">
|
||||||
|
<div class="intro-chat">
|
||||||
|
{{#if (ne actingCharImg "icons/svg/mystery-man.svg")}}
|
||||||
|
<div class="intro-img">
|
||||||
|
<img src="{{actingCharImg}}" data-tooltip="{{name}}" />
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
<div class="intro-right">
|
||||||
|
<p class="introText">{{localize "TENEBRIS.Chat.askFortune" name=name}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{#if isGM}}
|
||||||
|
<a class="button control" data-action="accept-fortune" data-tooltip="Accepter"><i class="fa-solid fa-check"></i></a>
|
||||||
|
<div class="fortune-accepted" style="display: none;">Accepté !</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
55
templates/chat-message.hbs
Normal file
55
templates/chat-message.hbs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{{!log 'chat-message' this}}
|
||||||
|
<div class="{{cssClass}}">
|
||||||
|
<div class="intro-chat">
|
||||||
|
{{#if (ne actingCharImg "icons/svg/mystery-man.svg")}}
|
||||||
|
<div class="intro-img">
|
||||||
|
<img src="{{actingCharImg}}" data-tooltip="{{actingCharName}}" />
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div></div>
|
||||||
|
{{/if}}
|
||||||
|
<div class="intro-right">
|
||||||
|
<p class="introText" {{#if isSave}}data-tooltip="{{introTextTooltip}}"{{/if}}>{{{introText}}}
|
||||||
|
{{#if isSave}}
|
||||||
|
<br>
|
||||||
|
{{#if (eq avantages "avantage")}} {{localize "TENEBRIS.Roll.avantage"}}{{/if}}
|
||||||
|
{{#if (eq avantages "desavantage")}} {{localize "TENEBRIS.Roll.desavantage"}}{{/if}}
|
||||||
|
{{#if (eq avantages "doubleAvantage")}} {{localize "TENEBRIS.Roll.doubleAvantage"}}{{/if}}
|
||||||
|
{{#if (eq avantages "doubleDesavantage")}} {{localize "TENEBRIS.Roll.doubleDesavantage"}}{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{#if isSave}}
|
||||||
|
<div class="result">
|
||||||
|
{{#if (eq resultType "success")}}
|
||||||
|
{{#if isPrivate}}?{{else}}{{localize "TENEBRIS.Roll.success"}}{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{#if isPrivate}}?{{else}}{{localize "TENEBRIS.Roll.failure"}}{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if isResource}}
|
||||||
|
<div class="result">
|
||||||
|
{{#if (eq resultType "success")}}
|
||||||
|
{{#if isPrivate}}?{{else}}{{localize "TENEBRIS.Roll.success"}}{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{#if isPrivate}}?{{else}}{{localize "TENEBRIS.Roll.failure"}}{{#if isFailure}} ({{localize "TENEBRIS.Roll.resourceLost"}}){{/if}}{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if isDamage}}
|
||||||
|
<div>
|
||||||
|
{{#if (and isGM hasTarget)}}
|
||||||
|
{{{localize "TENEBRIS.Roll.displayArmor" targetName=targetName targetArmor=targetArmor realDamage=realDamage}}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#unless isPrivate}}
|
||||||
|
<div class="dice-result">
|
||||||
|
<h4 class="dice-total">{{total}}</h4>
|
||||||
|
<div class="dice-formula">{{formula}}</div>
|
||||||
|
{{{tooltip}}}
|
||||||
|
</div>
|
||||||
|
{{/unless}}
|
||||||
|
</div>
|
9
templates/fortune.hbs
Normal file
9
templates/fortune.hbs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{{!log "fortune" this}}
|
||||||
|
<div class="application-fortune application-fortune-{{ifThen isGM 'gm' 'player'}}">
|
||||||
|
{{#unless isGM}}
|
||||||
|
<button type="button" class="action-button frame-brown" data-action="fortune" data-user-id={{userId}}>
|
||||||
|
<label>Dépenser</label>
|
||||||
|
</button>
|
||||||
|
{{/unless}}
|
||||||
|
<div class="application-fortune-value">{{fortune}}</div>
|
||||||
|
</div>
|
39
templates/manager.hbs
Normal file
39
templates/manager.hbs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<table class="tenebris-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{localize "TENEBRIS.Manager.player"}}</th>
|
||||||
|
<th>{{localize "TENEBRIS.Manager.character"}}</th>
|
||||||
|
<th>{{localize "TENEBRIS.Manager.pv"}}</th>
|
||||||
|
<td data-action="saveAll" data-save="rob">{{localize "TENEBRIS.Manager.rob"}}</td>
|
||||||
|
<td data-action="saveAll" data-save="dex">{{localize "TENEBRIS.Manager.dex"}}</td>
|
||||||
|
<td data-action="saveAll" data-save="int">{{localize "TENEBRIS.Manager.int"}}</td>
|
||||||
|
<td data-action="saveAll" data-save="per">{{localize "TENEBRIS.Manager.per"}}</td>
|
||||||
|
<td data-action="saveAll" data-save="vol">{{localize "TENEBRIS.Manager.vol"}}</td>
|
||||||
|
<td data-action="resourceAll" data-resource="san">{{localize "TENEBRIS.Manager.san"}}</td>
|
||||||
|
<td data-action="resourceAll" data-resource="oeil">{{localize "TENEBRIS.Manager.oeil"}}</td>
|
||||||
|
<td data-action="resourceAll" data-resource="verbe">{{localize "TENEBRIS.Manager.verbe"}}</td>
|
||||||
|
<td data-action="resourceAll" data-resource="bourse">{{localize "TENEBRIS.Manager.bourse"}}</td>
|
||||||
|
<td data-action="resourceAll" data-resource="magie">{{localize "TENEBRIS.Manager.magie"}}</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each players as |player|}}
|
||||||
|
{{!log "player" this}}
|
||||||
|
<tr class="player" data-user-id="{{player.id}}" data-character-name="{{player.character.name}}" data-character-id="{{player.character.id}}">
|
||||||
|
<td>{{player.name}}</td>
|
||||||
|
<td data-action="openSheet" data-character-id="{{player.character.id}}">{{player.character.name}}</td>
|
||||||
|
<td>{{player.character.system.pv.value}}</td>
|
||||||
|
<td data-action="saveOne" data-save="rob">{{player.character.system.caracteristiques.rob.valeur}}</td>
|
||||||
|
<td data-action="saveOne" data-save="dex">{{player.character.system.caracteristiques.dex.valeur}}</td>
|
||||||
|
<td data-action="saveOne" data-save="int">{{player.character.system.caracteristiques.int.valeur}}</td>
|
||||||
|
<td data-action="saveOne" data-save="per">{{player.character.system.caracteristiques.per.valeur}}</td>
|
||||||
|
<td data-action="saveOne" data-save="vol">{{player.character.system.caracteristiques.vol.valeur}}</td>
|
||||||
|
<td data-action="resourceOne" data-resource="san">{{player.character.system.ressources.san.valeur}}</td>
|
||||||
|
<td data-action="resourceOne" data-resource="oeil">{{player.character.system.ressources.oeil.valeur}}</td>
|
||||||
|
<td data-action="resourceOne" data-resource="verbe">{{player.character.system.ressources.verbe.valeur}}</td>
|
||||||
|
<td data-action="resourceOne" data-resource="bourse">{{player.character.system.ressources.bourse.valeur}}</td>
|
||||||
|
<td data-action="resourceOne" data-resource="magie">{{player.character.system.ressources.magie.valeur}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
79
templates/opponent.hbs
Normal file
79
templates/opponent.hbs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<section>
|
||||||
|
{{!log "opponent sheet" this}}
|
||||||
|
<div class="opponent-header">
|
||||||
|
<img class="opponent-img" src="{{actor.img}}" data-edit="img" data-action="editImage" data-tooltip="{{actor.name}}" />
|
||||||
|
{{formInput fields.name value=source.name}}
|
||||||
|
<a class="control" data-action="toggleSheet" data-tooltip="TENEBRIS.ToggleSheet" data-tooltip-direction="UP">
|
||||||
|
<i class="fa-solid fa-user-{{ifThen isPlayMode 'lock' 'pen'}}"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="opponent-main">
|
||||||
|
<div class="opponent-gauche">
|
||||||
|
<fieldset class="opponent-caracteristiques">
|
||||||
|
<legend>{{localize "TENEBRIS.Character.Label.caracteristiques"}}</legend>
|
||||||
|
{{formField systemFields.dv value=system.dv disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.pv.fields.value value=system.pv.value}}
|
||||||
|
{{formField systemFields.pv.fields.max value=system.pv.max disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.armure value=system.armure disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.malus value=system.malus disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.actions value=system.actions disabled=isPlayMode}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="opponent-attacks">
|
||||||
|
<legend>{{localize "TENEBRIS.Character.Label.attaques"}}
|
||||||
|
{{#if isEditMode}}<a class="action" data-tooltip="{{localize 'TENEBRIS.Tooltip.addAttack'}}" data-tooltip-direction="UP"><i
|
||||||
|
class="fas fa-plus"
|
||||||
|
data-action="createAttack"
|
||||||
|
></i></a>{{/if}}</legend>
|
||||||
|
{{#each attacks as |attack|}}
|
||||||
|
<div class="opponent-attack" data-drag="true" data-drag-type="attack" data-roll-value="{{attack.system.degats}}" data-roll-target="{{attack.name}}">
|
||||||
|
<div class="attack-name">
|
||||||
|
<a
|
||||||
|
class="rollable"
|
||||||
|
data-item-id="{{attack.id}}"
|
||||||
|
data-item-name="{{attack.name}}"
|
||||||
|
data-action="roll"
|
||||||
|
data-roll-type="attack"
|
||||||
|
data-roll-value="{{attack.system.degats}}"
|
||||||
|
>{{attack.system.degats}}</a>
|
||||||
|
(<span data-tooltip="{{attack.system.toolTip}}">{{attack.name}}</span>)
|
||||||
|
</div>
|
||||||
|
{{#if @root.isEditMode}}
|
||||||
|
<div class="controls">
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Edit'}}" data-action="edit" data-item-id="{{attack.id}}" data-item-uuid="{{attack.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Delete'}}" data-action="delete" data-item-id="{{attack.id}}" data-item-uuid="{{attack.uuid}}"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{#if (or isEditMode (and isPlayMode hasSpells))}}
|
||||||
|
<fieldset class="opponent-spells">
|
||||||
|
<legend>{{localize "TENEBRIS.Label.spells"}}{{#if isEditMode}}<a class="action" data-tooltip="{{localize "TENEBRIS.Tooltip.addSpell"}}" data-tooltip-direction="UP"><i class="fas fa-plus" data-action="createSpell"></i></a>{{/if}}</legend>
|
||||||
|
{{#each spells as |spell|}}
|
||||||
|
<div class="opponent-spell">
|
||||||
|
<div class="name" data-tooltip="{{{spell.system.description}}}">
|
||||||
|
{{spell.name}}
|
||||||
|
</div>
|
||||||
|
{{#if @root.isEditMode}}
|
||||||
|
<div class="controls">
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Edit'}}" data-action="edit" data-item-id="{{spell.id}}" data-item-uuid="{{spell.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Delete'}}" data-action="delete" data-item-id="{{spell.id}}" data-item-uuid="{{spell.uuid}}"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</fieldset>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opponent-droite">
|
||||||
|
<fieldset class="opponent-description">
|
||||||
|
<legend>{{localize "TENEBRIS.Label.description"}}</legend>
|
||||||
|
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true compact=true}}
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
7
templates/path-header.hbs
Normal file
7
templates/path-header.hbs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<section class="path-name">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-edit="img" data-action="editImage" data-tooltip="{{item.name}}" />
|
||||||
|
{{formInput fields.name value=source.name rootId=partId disabled=isPlayMode}}
|
||||||
|
<a class="control" data-action="toggleSheet" data-tooltip="TENEBRIS.ToggleSheet">
|
||||||
|
<i class="fa-solid fa-user-{{ifThen isPlayMode 'lock' 'pen'}}"></i>
|
||||||
|
</a>
|
||||||
|
</section>
|
44
templates/path-main.hbs
Normal file
44
templates/path-main.hbs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<section class="tab path-{{tab.id}} {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.profil"}}</legend>
|
||||||
|
<div class="profil">
|
||||||
|
<div class="profil-gauche">
|
||||||
|
{{formField systemFields.caracteristiques.fields.rob.fields.valeur value=system.caracteristiques.rob.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.caracteristiques.fields.dex.fields.valeur value=system.caracteristiques.dex.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.caracteristiques.fields.int.fields.valeur value=system.caracteristiques.int.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.caracteristiques.fields.per.fields.valeur value=system.caracteristiques.per.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.caracteristiques.fields.vol.fields.valeur value=system.caracteristiques.vol.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.dv value=system.dv rootId=partId disabled=isPlayMode}}
|
||||||
|
</div>
|
||||||
|
<div class="profil-droite">
|
||||||
|
{{formField systemFields.dmax value=system.dmax rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.ressources.fields.san.fields.valeur value=system.ressources.san.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.ressources.fields.oeil.fields.valeur value=system.ressources.oeil.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.ressources.fields.verbe.fields.valeur value=system.ressources.verbe.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.ressources.fields.bourse.fields.valeur value=system.ressources.bourse.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
{{formField systemFields.ressources.fields.magie.fields.valeur value=system.ressources.magie.valeur rootId=partId disabled=isPlayMode}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="biens">
|
||||||
|
<legend>{{localize "TENEBRIS.Label.biens"}}</legend>
|
||||||
|
{{formInput systemFields.biens enriched=enrichedBiens value=system.biens documentUUID=item.uuid name="system.biens" collaborate="true" toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="langues">
|
||||||
|
<legend>{{localize "TENEBRIS.Label.langues"}}</legend>
|
||||||
|
{{formInput systemFields.langues enriched=enrichedLangues value=system.langues documentUUID=item.uuid name="system.langues" collaborate="true" toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="description">
|
||||||
|
<legend>{{localize "TENEBRIS.Label.description"}}</legend>
|
||||||
|
{{formInput
|
||||||
|
systemFields.description
|
||||||
|
enriched=enrichedDescription
|
||||||
|
value=system.description
|
||||||
|
name="system.description"
|
||||||
|
toggled=true
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
28
templates/path-talents.hbs
Normal file
28
templates/path-talents.hbs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<section class="tab path-{{tab.id}} {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
|
||||||
|
{{!log "path-talents" this}}
|
||||||
|
{{#each talents as |item|}}
|
||||||
|
{{!log "path-talent" this}}
|
||||||
|
<div class="talent" data-item-uuid="{{item.uuid}}">
|
||||||
|
<div class="header">
|
||||||
|
<div class="name">{{item.name}} {{#if item.system.canProgress}}<span data-tooltip="{{localize 'TENEBRIS.Label.progressionPossible'}}"> (P)</span>{{/if}}
|
||||||
|
{{#if item.system.isLearned}}
|
||||||
|
<span data-tooltip="{{localize 'TENEBRIS.Talent.FIELDS.appris.label'}}"> <i class="fa-solid fa-book"></i>({{item.system.niveau}})</span>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{#if @root.isEditMode}}
|
||||||
|
<div class="controls">
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Edit'}}" data-action="edit" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
<a data-tooltip="{{localize 'TENEBRIS.Delete'}}" data-action="delete" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{#if item.system.isLearned}}
|
||||||
|
<div class="progression">
|
||||||
|
<div>{{localize "TENEBRIS.Label.appris"}}</div>
|
||||||
|
<div>{{localize "TENEBRIS.Label.niveau"}} {{item.system.niveau}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
<div class="description">{{{item.system.improvedDescription}}}</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</section>
|
61
templates/roll-dialog.hbs
Normal file
61
templates/roll-dialog.hbs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
{{log "roll-dialog" this}}
|
||||||
|
<div class="tenebris-roll-dialog">
|
||||||
|
{{#if isSave}}
|
||||||
|
<fieldSet>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.sauvegarde"}}</legend>
|
||||||
|
<div class="dialog-save">{{formula}}</div>
|
||||||
|
</fieldSet>
|
||||||
|
<fieldSet class="dialog-avantages">
|
||||||
|
<legend>{{localize "TENEBRIS.Roll.avantagesDesavantages"}}</legend>
|
||||||
|
<input
|
||||||
|
type="range"
|
||||||
|
name="avantages"
|
||||||
|
min="1"
|
||||||
|
max="5"
|
||||||
|
value="{{rangeAdvantage}}"
|
||||||
|
data-tooltip="Double désavantage - Désavantage - Normal - Avantage - Double avantage"
|
||||||
|
data-tooltip-direction="UP"
|
||||||
|
data-tooltip-class="tooltip-avantages"
|
||||||
|
/>
|
||||||
|
<input id="selectAvantages" name="selectAvantages" readonly value="{{rollAdvantage}}">
|
||||||
|
</fieldSet>
|
||||||
|
<div class="dialog-aide-gene">
|
||||||
|
<fieldSet>
|
||||||
|
<legend>{{localize "TENEBRIS.Roll.aide"}}</legend>
|
||||||
|
<select name="aide">
|
||||||
|
{{selectOptions choiceAide}}
|
||||||
|
</select>
|
||||||
|
</fieldSet>
|
||||||
|
<fieldSet>
|
||||||
|
<legend>{{localize "TENEBRIS.Roll.gene"}}</legend>
|
||||||
|
<select name="gene">
|
||||||
|
{{selectOptions choiceGene}}
|
||||||
|
</select>
|
||||||
|
</fieldSet>
|
||||||
|
</div>
|
||||||
|
<fieldSet class="dialog-modificateur">
|
||||||
|
<legend>{{localize "TENEBRIS.Roll.adversite"}}</legend>
|
||||||
|
<select name="modificateur" {{#if hasTarget}}data-tooltip="Cible : {{targetName}}" data-tooltip-direction="UP"{{/if}}>
|
||||||
|
{{selectOptions choiceModificateur selected=malus}}
|
||||||
|
</select>
|
||||||
|
</fieldSet>
|
||||||
|
{{/if}}
|
||||||
|
{{#if (or isDamage isAttack)}}
|
||||||
|
<fieldSet>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.degats"}}</legend>
|
||||||
|
<div class="dialog-damage">{{damageDice}} {{#if damageDiceLowered}}limités par les dégâts max à {{damageDiceFinal}} {{/if}}</div>
|
||||||
|
</fieldSet>
|
||||||
|
{{/if}}
|
||||||
|
{{#if isResource}}
|
||||||
|
<fieldSet>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.ressource"}}</legend>
|
||||||
|
<div class="dialog-resource">{{formula}}</div>
|
||||||
|
</fieldSet>
|
||||||
|
{{/if}}
|
||||||
|
<fieldSet>
|
||||||
|
<legend>{{localize "TENEBRIS.Roll.visibilite"}}</legend>
|
||||||
|
<select name="visibility">
|
||||||
|
{{selectOptions rollModes selected=visibility}}
|
||||||
|
</select>
|
||||||
|
</fieldSet>
|
||||||
|
</div>
|
19
templates/spell.hbs
Normal file
19
templates/spell.hbs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<section>
|
||||||
|
<div class="header">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-edit="img" data-action="editImage" data-tooltip="{{item.name}}" />
|
||||||
|
{{formInput fields.name value=source.name}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{formField systemFields.preparation value=system.preparation}}
|
||||||
|
{{formField systemFields.cible value=system.cible}}
|
||||||
|
{{formField systemFields.portee value=system.portee localize=true}}
|
||||||
|
{{formField systemFields.duree value=system.duree}}
|
||||||
|
{{formField systemFields.consequenceA value=system.consequenceA}}
|
||||||
|
{{formField systemFields.consequenceB value=system.consequenceB}}
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.description"}}</legend>
|
||||||
|
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</section>
|
17
templates/talent.hbs
Normal file
17
templates/talent.hbs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<section>
|
||||||
|
<div class="header">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-edit="img" data-action="editImage" data-tooltip="{{item.name}}" />
|
||||||
|
{{formInput fields.name value=source.name}}
|
||||||
|
</div>
|
||||||
|
{{formField systemFields.appris value=system.appris}}
|
||||||
|
{{formField systemFields.progression value=system.progression}}
|
||||||
|
{{#if canProgress}}
|
||||||
|
{{formField systemFields.niveau value=system.niveau }}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.description"}}</legend>
|
||||||
|
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</section>
|
19
templates/weapon.hbs
Normal file
19
templates/weapon.hbs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<section>
|
||||||
|
<div class="header">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-edit="img" data-action="editImage" data-tooltip="{{item.name}}" />
|
||||||
|
{{formInput fields.name value=source.name}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{formField systemFields.categorie value=system.categorie localize=true}}
|
||||||
|
{{formField systemFields.degats value=system.degats}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "TENEBRIS.Label.description"}}</legend>
|
||||||
|
{{formInput
|
||||||
|
systemFields.description
|
||||||
|
enriched=enrichedDescription
|
||||||
|
value=system.description
|
||||||
|
name="system.description"
|
||||||
|
toggled=true
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
64
tools/CompendiumsManager.mjs
Normal file
64
tools/CompendiumsManager.mjs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import { extractPack, compilePack } from '@foundryvtt/foundryvtt-cli';
|
||||||
|
import { promises as fs } from 'fs';
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
const MODULE_ID = process.cwd();
|
||||||
|
|
||||||
|
export class CompendiumsManager {
|
||||||
|
|
||||||
|
static async packToDistDir(srcDir = 'packs_src', distDir = 'packs', mode = 'yaml') {
|
||||||
|
const yaml = mode === 'yaml'
|
||||||
|
const packs = await fs.readdir('./' + srcDir);
|
||||||
|
for (const pack of packs) {
|
||||||
|
if (pack === '.gitattributes') continue;
|
||||||
|
console.log('Packing ' + pack);
|
||||||
|
await compilePack(
|
||||||
|
`${MODULE_ID}/${srcDir}/${pack}`,
|
||||||
|
`${MODULE_ID}/${distDir}/${pack}`,
|
||||||
|
{ yaml }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async unpackToSrcDir(srcDir = 'packs_src', distDir = 'packs', mode = 'yaml') {
|
||||||
|
const yaml = mode === 'yaml'
|
||||||
|
const packs = await fs.readdir("./" + distDir);
|
||||||
|
for (const pack of packs) {
|
||||||
|
if (pack === ".gitattributes") continue;
|
||||||
|
if (pack === ".directory") continue;
|
||||||
|
if (pack.endsWith(".db")) continue;
|
||||||
|
console.log("Unpacking " + pack);
|
||||||
|
const directory = `./${srcDir}/${pack}`;
|
||||||
|
// Create the directory if it doesn't exist
|
||||||
|
await fs.mkdir(directory, { recursive: true });
|
||||||
|
try {
|
||||||
|
for (const file of await fs.readdir(directory)) {
|
||||||
|
await fs.unlink(path.join(directory, file));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === "ENOENT") console.log("No files inside of " + pack);
|
||||||
|
else console.log(error);
|
||||||
|
}
|
||||||
|
await extractPack(
|
||||||
|
`${MODULE_ID}/${distDir}/${pack}`,
|
||||||
|
`${MODULE_ID}/${srcDir}/${pack}`,
|
||||||
|
{
|
||||||
|
yaml: mode === 'yaml',
|
||||||
|
transformName: doc => CompendiumsManager.transformName(doc, mode === 'yaml'),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefaces the document with its type
|
||||||
|
* @param {object} doc - The document data
|
||||||
|
*/
|
||||||
|
static transformName(doc, yaml) {
|
||||||
|
const safeFileName = doc.name.replace(/[^a-zA-Z0-9А-я]/g, "_");
|
||||||
|
const type = doc._key.split("!")[1];
|
||||||
|
const prefix = ["actors", "items"].includes(type) ? doc.type : type;
|
||||||
|
|
||||||
|
return `${doc.name ? `${prefix}_${safeFileName}_${doc._id}` : doc._id}.${yaml ? "yml" : "json"}`;
|
||||||
|
}
|
||||||
|
}
|
3
tools/packCompendiumsToDist.mjs
Normal file
3
tools/packCompendiumsToDist.mjs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { CompendiumsManager } from './CompendiumsManager.mjs';
|
||||||
|
|
||||||
|
CompendiumsManager.packToDistDir()
|
3
tools/unpackCompendiumsFromDist.mjs
Normal file
3
tools/unpackCompendiumsFromDist.mjs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { CompendiumsManager } from './CompendiumsManager.mjs';
|
||||||
|
|
||||||
|
CompendiumsManager.unpackToSrcDir()
|
Loading…
x
Reference in New Issue
Block a user